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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. how can i get font used by pDC->DrawText

how can i get font used by pDC->DrawText

Scheduled Pinned Locked Moved C / C++ / MFC
question
5 Posts 4 Posters 1 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.
  • _ Offline
    _ Offline
    _T No name
    wrote on last edited by
    #1

    hi i m using pDC->drawtext() i want to knw the font used to draw this. i think that is system font can i get LOGFONT structure of that system font.

    CPalliniC 1 Reply Last reply
    0
    • _ _T No name

      hi i m using pDC->drawtext() i want to knw the font used to draw this. i think that is system font can i get LOGFONT structure of that system font.

      CPalliniC Offline
      CPalliniC Offline
      CPallini
      wrote on last edited by
      #2

      What about CDC::GetCurrentFont [^] and then CFont::GetLogFont [^]?

      If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
      This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
      [My articles]

      In testa che avete, signor di Ceprano?

      _ 1 Reply Last reply
      0
      • CPalliniC CPallini

        What about CDC::GetCurrentFont [^] and then CFont::GetLogFont [^]?

        If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
        This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
        [My articles]

        _ Offline
        _ Offline
        _T No name
        wrote on last edited by
        #3

        thanks it worked for me actually i want to set this perticualr font that why i needed that.. thank uy

        I 1 Reply Last reply
        0
        • _ _T No name

          thanks it worked for me actually i want to set this perticualr font that why i needed that.. thank uy

          I Offline
          I Offline
          Iain Clarke Warrior Programmer
          wrote on last edited by
          #4

          So, your question is kinda opposite to the one you asked! Here you go:

          CFont fMyFont (.....);
          CFont *fOld = pDC->SelectObject (&fMyFont); // keep track of original font
          pDC->DrawTest (...);
          pDC->SelectObject (&fOld); // put things back as they were

          "..."'s left as an exercise for the reader. Iain.

          Codeproject MVP for C++, I can't believe it's for my lounge posts...

          D 1 Reply Last reply
          0
          • I Iain Clarke Warrior Programmer

            So, your question is kinda opposite to the one you asked! Here you go:

            CFont fMyFont (.....);
            CFont *fOld = pDC->SelectObject (&fMyFont); // keep track of original font
            pDC->DrawTest (...);
            pDC->SelectObject (&fOld); // put things back as they were

            "..."'s left as an exercise for the reader. Iain.

            Codeproject MVP for C++, I can't believe it's for my lounge posts...

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

            Iain Clarke wrote:

            So, your question is kinda opposite to the one you asked!

            Do people really do that? :rolleyes:

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

            "The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch

            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