February 7th, 2014, 09:40 PM
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?
February 20th, 2014, 08:08 PM
Re: EnumFontFamiliesEx() is not working correctly
The solution is to use the LOGFONT *lpelfe->lfFaceName parameter of the EnumFontFamExProc callback function, and not to use the ENUMLOGFONTEX::elfFullName parameter.
Click Here to Expand Forum to Full Width
This is a Codeguru.com survey!