Open Type Font (OTF) problem.
-
Hi. In my application I am trying to read all the fonts from system’s font folder and loading them in a drop down box so that user can pick any of the available fonts. I am using EnumFontFamProc() for reading all the fonts from Fonts folder and here is the code snippet for that…. int CALLBACK CFontCombo::EnumFontFamProc(ENUMLOGFONT FAR *lpelf, NEWTEXTMETRIC FAR *lpntm, int FontType, LPARAM lParam) { if(FontType & TRUETYPE_FONTTYPE) { CFontCombo *pxFC = (CFontCombo *) lParam; pxFC->AddString(lpelf->elfLogFont.lfFaceName); } return 1; } Application successfully reads all TTF (Tru Type Fonts) but fails to read OTF (Open Type Font) that are present in Fonts folder. What’s the solution for this problem? Thanks
Sameer Thakur
-
Hi. In my application I am trying to read all the fonts from system’s font folder and loading them in a drop down box so that user can pick any of the available fonts. I am using EnumFontFamProc() for reading all the fonts from Fonts folder and here is the code snippet for that…. int CALLBACK CFontCombo::EnumFontFamProc(ENUMLOGFONT FAR *lpelf, NEWTEXTMETRIC FAR *lpntm, int FontType, LPARAM lParam) { if(FontType & TRUETYPE_FONTTYPE) { CFontCombo *pxFC = (CFontCombo *) lParam; pxFC->AddString(lpelf->elfLogFont.lfFaceName); } return 1; } Application successfully reads all TTF (Tru Type Fonts) but fails to read OTF (Open Type Font) that are present in Fonts folder. What’s the solution for this problem? Thanks
Sameer Thakur
int CALLBACK CFontCombo::EnumFontFamProc(ENUMLOGFONT FAR *lpelf,
NEWTEXTMETRIC FAR *lpntm, int FontType, LPARAM lParam)
{
if(FontType & TRUETYPE_FONTTYPE) <-- What is this doing here??
{
CFontCombo *pxFC = (CFontCombo *) lParam;
pxFC->AddString(lpelf->elfLogFont.lfFaceName);}
return 1;
}
[Noobs Treatment Area]
Nobody can give you wiser advice than yourself. - Cicero ப்ரம்மா -
Hi. In my application I am trying to read all the fonts from system’s font folder and loading them in a drop down box so that user can pick any of the available fonts. I am using EnumFontFamProc() for reading all the fonts from Fonts folder and here is the code snippet for that…. int CALLBACK CFontCombo::EnumFontFamProc(ENUMLOGFONT FAR *lpelf, NEWTEXTMETRIC FAR *lpntm, int FontType, LPARAM lParam) { if(FontType & TRUETYPE_FONTTYPE) { CFontCombo *pxFC = (CFontCombo *) lParam; pxFC->AddString(lpelf->elfLogFont.lfFaceName); } return 1; } Application successfully reads all TTF (Tru Type Fonts) but fails to read OTF (Open Type Font) that are present in Fonts folder. What’s the solution for this problem? Thanks
Sameer Thakur
Hi, once I wrote a similar thing, but I used EnumFontFamiliesEx because it uses another callback proc which uses EnumFontFamExProc. There you get an NEWTEXTMETRICEX pointer and there you can test the ntmFlags member of the ntmTm member: if ( ( ( lpntme -> ntmTm.ntmFlags & NTM_PS_OPENTYPE ) == NTM_PS_OPENTYPE ) || ( ( lpntme -> ntmTm.ntmFlags & NTM_TT_OPENTYPE ) == NTM_TT_OPENTYPE ) ) { // this is an open type font ... } Cheers Stefan