CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2014
    Location
    Papillion
    Posts
    4

    EnumFontFamiliesEx() is not working correctly

    This thread is very similar to another thread that I posted, yet this title is much more accurate. I also came up with a better way of explaining the problem.

    Ultimately I need to find the easiest way to get the exact same list of fonts and styles the CFontDialog (and Notepad) provides.

    Apparently it is not always possible to get this set of Fontname + FontStyle from EnumFontFamiliesEx(). If this function is run once without LOGFONT:lfFaceName specified we get the set of names generally without styles.

    If we run this function again with LOGFONT:lfFaceName filled in for each returned font name we generally get back the names that are associated with the styles. This only works consistently if the first set of returned names does not contain style information.

    There are very many fonts that have some aspect of style embedded within their name.
    1) Brushwood Italic has no non-italic form
    2) Copper Black has no regular or bold form
    3) Arial has a Narrow form

    In the case of Calibri we only get back two names when we run EnumFontFamiliesEx() without LOGFONT:lfFaceName specified: 1) Calibri 2) Calibri Light Italic

    If we run we run EnumFontFamiliesEx() with the above LOGFONT:lfFaceName specified there is no way to get Calibri Italic or Calibri Light.

    What is the typical work-around for this apparent EnumFontFamiliesEx() bug?

  2. #2
    Join Date
    Feb 2014
    Location
    Papillion
    Posts
    4

    Re: EnumFontFamiliesEx() is not working correctly

    http://msdn.microsoft.com/en-us/libr...(v=vs.85).aspx

    The solution is to use the LOGFONT *lpelfe->lfFaceName parameter of the EnumFontFamExProc callback function, and not to use the ENUMLOGFONTEX::elfFullName parameter.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured