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. Font in Combo

Font in Combo

Scheduled Pinned Locked Moved C / C++ / MFC
question
6 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.
  • P Offline
    P Offline
    p_1960
    wrote on last edited by
    #1

    Hi, How can i populate system font names in combobox...

    R 1 Reply Last reply
    0
    • P p_1960

      Hi, How can i populate system font names in combobox...

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

      1. Enumerating the Installed Fonts[^] 2. CComboBox::AddString()[^]

      It is a crappy thing, but it's life -^ Carlo Pallini

      P 1 Reply Last reply
      0
      • R Rajesh R Subramanian

        1. Enumerating the Installed Fonts[^] 2. CComboBox::AddString()[^]

        It is a crappy thing, but it's life -^ Carlo Pallini

        P Offline
        P Offline
        p_1960
        wrote on last edited by
        #3

        if possible please let me know how can i use in MFC dialog based project ..as im anew bie..

        R 1 Reply Last reply
        0
        • P p_1960

          if possible please let me know how can i use in MFC dialog based project ..as im anew bie..

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

          MFC does not have any special functions for this purpose. You can use this, I suppose:

          int CALLBACK EnumFontFamExProc(
          ENUMLOGFONTEX *lpelfe,
          NEWTEXTMETRICEX *lpntme,
          DWORD FontType,
          LPARAM lParam
          )
          {
          OutputDebugString(lpelfe->elfFullName); //Populate your combo box here
          return true;
          }

          CTestDlg::OnOK()
          {
          LOGFONT logFont;
          logFont.lfCharSet = 0;
          _tcscpy(logFont.lfFaceName, _T("\0"));
          logFont.lfPitchAndFamily = 0;
          EnumFontFamiliesEx(*GetDC(), &logFont, (FONTENUMPROC)EnumFontFamExProc, 0, 0);
          }

          Watch your debugger output window to see the results printed into it from the callback function.

          It is a crappy thing, but it's life -^ Carlo Pallini

          D 1 Reply Last reply
          0
          • R Rajesh R Subramanian

            MFC does not have any special functions for this purpose. You can use this, I suppose:

            int CALLBACK EnumFontFamExProc(
            ENUMLOGFONTEX *lpelfe,
            NEWTEXTMETRICEX *lpntme,
            DWORD FontType,
            LPARAM lParam
            )
            {
            OutputDebugString(lpelfe->elfFullName); //Populate your combo box here
            return true;
            }

            CTestDlg::OnOK()
            {
            LOGFONT logFont;
            logFont.lfCharSet = 0;
            _tcscpy(logFont.lfFaceName, _T("\0"));
            logFont.lfPitchAndFamily = 0;
            EnumFontFamiliesEx(*GetDC(), &logFont, (FONTENUMPROC)EnumFontFamExProc, 0, 0);
            }

            Watch your debugger output window to see the results printed into it from the callback function.

            It is a crappy thing, but it's life -^ Carlo Pallini

            D Offline
            D Offline
            David Crow
            wrote on last edited by
            #5

            Oh great, now he's gonna ask how to take the output from the debugger window and add it to a combobox. :doh:

            "Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown

            "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

            R 1 Reply Last reply
            0
            • D David Crow

              Oh great, now he's gonna ask how to take the output from the debugger window and add it to a combobox. :doh:

              "Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown

              "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

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

              :laugh: Stop giving him hints, won't you?

              It is a crappy thing, but it's life -^ Carlo Pallini

              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