How to get the "adjusted" LOGFONT info after a CreatFont(Indirect) call?
When I create a font with CFont.CreateFontIndirect or CFont.CreateFont the system takes the settings of the LOGFONT structure and creates a font as close as possible from the settings. However sometimes it need to use a different facename for this. How can I get the "adjusted" LOGFONT settings?
Example:
- I read a file for which the code set can be any Windows code set.
- I map the code set info to the correct lfCharset member of LOGFONT (for example 128 when the code set is cp932 (Japanese))
- I use "Tahoma" as the default facename.
When calling CreateFont or CreateFontIndirect the system smartly detects that Tahoma is not going to be OK for a lfcharset=128 (japanese is not supported in the Tahoma font) and use instead MS Gothic (a Japanese font). I'm really happy with that.
But now I want to get the "adjusted" settings really used. If I do a GetLogFont call I get the same info i passed, in this case "Tahoma" is still the facename rather than "MS Gothic".
In other words: How can you detect the font created has been adjusted and how do you get the new settings?
Thanks
-yves
Re: How to get the "adjusted" LOGFONT info after a CreatFont(Indirect) call?
Can GetTextMetrics help ?
Re: How to get the "adjusted" LOGFONT info after a CreatFont(Indirect) call?
Actually it does a little, some of the parameters are adjusted.
Thanks for pointing this out.
But I cannot get the new facename from TEXTMETRICS, just the font family name.
and that "adjusted" facename is what I need.
-yves
Re: How to get the "adjusted" LOGFONT info after a CreatFont(Indirect) call?
Actually, digging further from your answer I found that GetOutlineTextMetrics gives the adjusted information.
Thanks a bunch.
-yves