CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 1999
    Posts
    4

    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




  2. #2
    Join Date
    May 1999
    Location
    Oregon, USA
    Posts
    302

    Re: How to get the "adjusted" LOGFONT info after a CreatFont(Indirect) call?



    Can GetTextMetrics help ?



  3. #3
    Join Date
    Mar 1999
    Posts
    4

    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



  4. #4
    Join Date
    Mar 1999
    Posts
    4

    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




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured