I have a text selection / specification dialog, where the user can specify the font from a list, set bold, italic, etc. I then use the info in a LOGFONT to create a CFont to subsequently use in a CEdit as a preview.
However, if the user picks a symbol font like Wingdings, the preview doesn't work correctly unless I set LOGFONT::lfCharset to SYMBOL_CHARSET. So, essentially given only a font name, how do I determine what the default charset should be (ie, how can I tell if I should us SYMBOL_CHARSET)?.
I've seen suggestions to use GetTextMetrics(), but that involves setting a font into a DC, and I haven't created the font yet, so...?
Once you have the name of the font, you can use EnumFontFamiliesEx to see if that font exists for a particular charset.  You can call it once with DEFAULT_CHARSET and, if that doesn't work, call it again with SYMBOL_CHARSET.
That's a guess anyway. I haven't had a chance to try it myself.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With