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. Open Type Font (OTF) problem.

Open Type Font (OTF) problem.

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
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.
  • S Offline
    S Offline
    Sameer_Thakur
    wrote on last edited by
    #1

    Hi. In my application I am trying to read all the fonts from system’s font folder and loading them in a drop down box so that user can pick any of the available fonts. I am using EnumFontFamProc() for reading all the fonts from Fonts folder and here is the code snippet for that…. int CALLBACK CFontCombo::EnumFontFamProc(ENUMLOGFONT FAR *lpelf, NEWTEXTMETRIC FAR *lpntm, int FontType, LPARAM lParam) { if(FontType & TRUETYPE_FONTTYPE) { CFontCombo *pxFC = (CFontCombo *) lParam; pxFC->AddString(lpelf->elfLogFont.lfFaceName); } return 1; } Application successfully reads all TTF (Tru Type Fonts) but fails to read OTF (Open Type Font) that are present in Fonts folder. What’s the solution for this problem? Thanks

    Sameer Thakur

    R O 2 Replies Last reply
    0
    • S Sameer_Thakur

      Hi. In my application I am trying to read all the fonts from system’s font folder and loading them in a drop down box so that user can pick any of the available fonts. I am using EnumFontFamProc() for reading all the fonts from Fonts folder and here is the code snippet for that…. int CALLBACK CFontCombo::EnumFontFamProc(ENUMLOGFONT FAR *lpelf, NEWTEXTMETRIC FAR *lpntm, int FontType, LPARAM lParam) { if(FontType & TRUETYPE_FONTTYPE) { CFontCombo *pxFC = (CFontCombo *) lParam; pxFC->AddString(lpelf->elfLogFont.lfFaceName); } return 1; } Application successfully reads all TTF (Tru Type Fonts) but fails to read OTF (Open Type Font) that are present in Fonts folder. What’s the solution for this problem? Thanks

      Sameer Thakur

      R Offline
      R Offline
      Rajesh R Subramanian
      wrote on last edited by
      #2

      int CALLBACK CFontCombo::EnumFontFamProc(ENUMLOGFONT FAR *lpelf,
      NEWTEXTMETRIC FAR *lpntm, int FontType, LPARAM lParam)
      {
      if(FontType & TRUETYPE_FONTTYPE) <-- What is this doing here??
      {
      CFontCombo *pxFC = (CFontCombo *) lParam;
      pxFC->AddString(lpelf->elfLogFont.lfFaceName);

      }
      return 1;
      }


      [Noobs Treatment Area]

      Nobody can give you wiser advice than yourself. - Cicero ப்ரம்மா

      1 Reply Last reply
      0
      • S Sameer_Thakur

        Hi. In my application I am trying to read all the fonts from system’s font folder and loading them in a drop down box so that user can pick any of the available fonts. I am using EnumFontFamProc() for reading all the fonts from Fonts folder and here is the code snippet for that…. int CALLBACK CFontCombo::EnumFontFamProc(ENUMLOGFONT FAR *lpelf, NEWTEXTMETRIC FAR *lpntm, int FontType, LPARAM lParam) { if(FontType & TRUETYPE_FONTTYPE) { CFontCombo *pxFC = (CFontCombo *) lParam; pxFC->AddString(lpelf->elfLogFont.lfFaceName); } return 1; } Application successfully reads all TTF (Tru Type Fonts) but fails to read OTF (Open Type Font) that are present in Fonts folder. What’s the solution for this problem? Thanks

        Sameer Thakur

        O Offline
        O Offline
        Optimus Chaos
        wrote on last edited by
        #3

        Hi, once I wrote a similar thing, but I used EnumFontFamiliesEx because it uses another callback proc which uses EnumFontFamExProc. There you get an NEWTEXTMETRICEX pointer and there you can test the ntmFlags member of the ntmTm member: if ( ( ( lpntme -> ntmTm.ntmFlags & NTM_PS_OPENTYPE ) == NTM_PS_OPENTYPE ) || ( ( lpntme -> ntmTm.ntmFlags & NTM_TT_OPENTYPE ) == NTM_TT_OPENTYPE ) ) { // this is an open type font ... } Cheers Stefan

        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