Click to See Complete Forum and Search --> : How to get the "adjusted" LOGFONT info after a CreatFont(Indirect) call?


Yves
March 29th, 1999, 09:47 AM
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

Gomez Addams
March 30th, 1999, 12:21 PM
Can GetTextMetrics help ?

Yves
March 30th, 1999, 04:40 PM
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

Yves
March 30th, 1999, 04:46 PM
Actually, digging further from your answer I found that GetOutlineTextMetrics gives the adjusted information.


Thanks a bunch.

-yves