Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. facing issue in “Ajantha” font on windows10 in GDIplus

facing issue in “Ajantha” font on windows10 in GDIplus

Scheduled Pinned Locked Moved C / C++ / MFC
graphicshelp
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Avinash Pandey
    wrote on last edited by
    #1

    I am facing an issue while printing some text using Ajantha Font, My observation says that after ANSI code 127 GDIPlus is not printing the correct font on windows 10 x64, where as GDI (Direct printing on DC does it correctly). CFont font; VERIFY(font.CreateFont( 40, // nHeight 20, // nWidth 0, // nEscapement 0, // nOrientation FW_DONTCARE, // nWeight FALSE, // bItalic FALSE, // bUnderline FALSE, // cStrikeOut DEFAULT_CHARSET, // nCharSet OUT_DEFAULT_PRECIS, // nOutPrecision CLIP_DEFAULT_PRECIS, // nClipPrecision DEFAULT_QUALITY, // nQuality DEFAULT_PITCH, // nPitchAndFamily _T("AJANTHA"))); // lpszFacename // Do something with the font just created... CClientDC cdc(this); CFont* def_font = cdc.SelectObject(&font); cdc.TextOut(11, 11, _T("€ € ~ ƒ „ …"), 11); cdc.SelectObject(def_font); Font mFont(dc.m_hDC, font); SolidBrush BlueBrush(Color(255, 0, 0, 255)); graphics.DrawString( strText, -1, &mFont, PointF(0, 150), pStringFormat, &BlueBrush); // Done with the font. Delete the font object. font.DeleteObject();

    L L 2 Replies Last reply
    0
    • A Avinash Pandey

      I am facing an issue while printing some text using Ajantha Font, My observation says that after ANSI code 127 GDIPlus is not printing the correct font on windows 10 x64, where as GDI (Direct printing on DC does it correctly). CFont font; VERIFY(font.CreateFont( 40, // nHeight 20, // nWidth 0, // nEscapement 0, // nOrientation FW_DONTCARE, // nWeight FALSE, // bItalic FALSE, // bUnderline FALSE, // cStrikeOut DEFAULT_CHARSET, // nCharSet OUT_DEFAULT_PRECIS, // nOutPrecision CLIP_DEFAULT_PRECIS, // nClipPrecision DEFAULT_QUALITY, // nQuality DEFAULT_PITCH, // nPitchAndFamily _T("AJANTHA"))); // lpszFacename // Do something with the font just created... CClientDC cdc(this); CFont* def_font = cdc.SelectObject(&font); cdc.TextOut(11, 11, _T("€ € ~ ƒ „ …"), 11); cdc.SelectObject(def_font); Font mFont(dc.m_hDC, font); SolidBrush BlueBrush(Color(255, 0, 0, 255)); graphics.DrawString( strText, -1, &mFont, PointF(0, 150), pStringFormat, &BlueBrush); // Done with the font. Delete the font object. font.DeleteObject();

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      What is contained in strText and what exactly do you see on the output?

      1 Reply Last reply
      0
      • A Avinash Pandey

        I am facing an issue while printing some text using Ajantha Font, My observation says that after ANSI code 127 GDIPlus is not printing the correct font on windows 10 x64, where as GDI (Direct printing on DC does it correctly). CFont font; VERIFY(font.CreateFont( 40, // nHeight 20, // nWidth 0, // nEscapement 0, // nOrientation FW_DONTCARE, // nWeight FALSE, // bItalic FALSE, // bUnderline FALSE, // cStrikeOut DEFAULT_CHARSET, // nCharSet OUT_DEFAULT_PRECIS, // nOutPrecision CLIP_DEFAULT_PRECIS, // nClipPrecision DEFAULT_QUALITY, // nQuality DEFAULT_PITCH, // nPitchAndFamily _T("AJANTHA"))); // lpszFacename // Do something with the font just created... CClientDC cdc(this); CFont* def_font = cdc.SelectObject(&font); cdc.TextOut(11, 11, _T("€ € ~ ƒ „ …"), 11); cdc.SelectObject(def_font); Font mFont(dc.m_hDC, font); SolidBrush BlueBrush(Color(255, 0, 0, 255)); graphics.DrawString( strText, -1, &mFont, PointF(0, 150), pStringFormat, &BlueBrush); // Done with the font. Delete the font object. font.DeleteObject();

        L Offline
        L Offline
        leon de boer
        wrote on last edited by
        #3

        Adding to what has already been said ... read carefully CreateFontA function | Microsoft Docs[^] Read this bit carefully

        Quote:

        To ensure consistent results when creating a font, do not specify OEM_CHARSET or DEFAULT_CHARSET. If you specify a typeface name in the lpszFace parameter, make sure that the fdwCharSet value matches the character set of the typeface specified in lpszFace.

        Specifically you may want to look at the GDIPLUS font class CFont Class | Microsoft Docs[^]

        Quote:

        The font mapper does not use the DEFAULT_CHARSET value. An application can use this value to allow the name and size of a font to fully describe the logical font. If a font with the specified name does not exist, a font from any character set can be substituted for the specified font. To avoid unexpected results, applications should use the DEFAULT_CHARSET value sparingly.

        Look at the sample code on the page and what setting they use, so what you really want to do for entirely predictable results is specify ANSI_CHARSET and use UNICODE strings, anything else is hit and miss :-)

        In vino veritas

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups