I\'m trying to create a list of fonts for the user to choose from. I\'m doing this by using the EnumFontFamiliesEx function but unfortunately, the list of returned fonts is
I think the entire discussion here is misleading.
When I offer a font selector to my users, why should I care what fonts are hidden by Microsoft? And why should I hide all fonts that Microsoft thinks should be hidden by default?
What if my user wants to use just one of those fonts that Microsoft has hidden? Would I put the burden on my user to go to control panel to un-hide this font?
What if some day a chinese user wants to write a chinese text on an english Windows and the chinese font is hidden?
I think there is a much better way to restrict the large amount of fonts returned by EnumFontFamiliesEx().
I wrote my own font selector that has a font filter which allows the user to select the group of fonts he wants to use. This way I do not hide anything and give all the power to the user rather than to Microsoft!
The user might WANT to see ALL fonts! Sometimes one just needs Arial Black or Arial Narrow although Microsoft considers it should be hidden.
int CALLBACK EnumFontFamExProc(const LOGFONT* pk_Font,
const TEXTMETRIC* pk_Metric,
DWORD e_FontType,
LPARAM lParam)
{
if (e_FontType & TRUETYPE_FONTTYPE)
{
// u32_Flags128 = DWORD[4] = 4 * 32 bit = 128 bit
DWORD* u32_Flags128 = ((NEWTEXTMETRICEX*)pk_Metric)->ntmFontSig.fsUsb;
if (u32_Flags128[13 / 32] & (1 << (13 % 32)))
{
// the font contains arabic characters (bit 13)
}
if (u32_Flags128[38 / 32] & (1 << (38 % 32)))
{
// the font contains mathematical symbols (bit 38)
}
if (u32_Flags128[70 / 32] & (1 << (70 % 32)))
{
// the font contains tibetan characters (bit 70)
}
}
In the callback you get a 128 Bit flag that defines exactly which Unicode areas are supported by the font.
See http://msdn.microsoft.com/en-us/library/dd374090%28v=vs.85%29.aspx
You can use these 128 Bits to filter and reduce the count of fonts that you show in the font list:
