|
-
July 23rd, 2010, 04:21 PM
#1
Need clarification about CreateFontIndirect
Say, if I want to create a font:
Code:
LOGFONT lf = {0};
lf.lfHeight = 12;
lf.lfWeight = FW_THIN;
VERIFY(StringCchCopy(lf.lfFaceName, sizeof(lf.lfFaceName) / sizeof(lf.lfFaceName[0]), _T("Calibri")) == S_OK);
HFONT hFont = CreateFontIndirect(&lf);
if(!hFont)
{
//Font created OK
}
If I specify pretty much any name as lfFaceName CreateFontIndirect() returns a handle anyway. My understanding was that it will return NULL if it can't create that exact font. Am I correct on that one?
PS. I'm running this code on Windows 7, so maybe they added some fail-safe mechanism for it already...
PS 2. I'm kind of confused over this statement:
 Originally Posted by MSDN
The fonts for many East Asian languages have two typeface names: an English name and a localized name. CreateFont and CreateFontIndirect take the localized typeface name only on a system locale that matches the language, while they take the English typeface name on all other system locales. The best method is to try one name and, on failure, try the other.
I do not have a machine with East Asian languages, nor that I can speak those languages. What would be the correct way to create a font on those machines?
The strategy I thought of is to try to create a font that I want, say, "Calibri", and if it can't be created (if it's not installed), try some basic font, like "Arial" for instance. But again, CreateFontIndirect seems to return a handle for any font type name I specify for it.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|