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 Size Displays [modified]

Font Size Displays [modified]

Scheduled Pinned Locked Moved C / C++ / MFC
c++jsontutorialquestion
4 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.
  • _ Offline
    _ Offline
    _AnsHUMAN_
    wrote on last edited by
    #1

    Hi All, I was just understanding how does MS set the font sizes. In an MFC application if we use CreateFont() API to create a font and set it's size to 8 and style to FW_BOLD.Something like this: myFont->CreateFont (8,0,0,0,FW_BOLD,0,0,0,0,0,0,0,0,"Tahoma"); This creates a font on the screen that is hard to read due to it's small size. But when we open MS-WORD and set it's font size to 8 and FONT to Tahoma, the user is able to read the text properly. So are the values displayed in list box in MS-WORD used to set the font size? or they are just to let the user see the values and don't have much meaning? In my application I would like to Create a font that shows as what Tahoma (size 8) is seen in MS-WORD.I am able to do this but not without setting the value (in bold above) to 12,14 or 16

    Somethings seem HARD to do, until we know how to do them. ;-)_AnShUmAn_

    A M 2 Replies Last reply
    0
    • _ _AnsHUMAN_

      Hi All, I was just understanding how does MS set the font sizes. In an MFC application if we use CreateFont() API to create a font and set it's size to 8 and style to FW_BOLD.Something like this: myFont->CreateFont (8,0,0,0,FW_BOLD,0,0,0,0,0,0,0,0,"Tahoma"); This creates a font on the screen that is hard to read due to it's small size. But when we open MS-WORD and set it's font size to 8 and FONT to Tahoma, the user is able to read the text properly. So are the values displayed in list box in MS-WORD used to set the font size? or they are just to let the user see the values and don't have much meaning? In my application I would like to Create a font that shows as what Tahoma (size 8) is seen in MS-WORD.I am able to do this but not without setting the value (in bold above) to 12,14 or 16

      Somethings seem HARD to do, until we know how to do them. ;-)_AnShUmAn_

      A Offline
      A Offline
      Arman S
      wrote on last edited by
      #2

      It is ten times smaller then the real font. So pass 10*N to have a font with size=N.

      -- ===== Arman

      _ 1 Reply Last reply
      0
      • A Arman S

        It is ten times smaller then the real font. So pass 10*N to have a font with size=N.

        -- ===== Arman

        _ Offline
        _ Offline
        _AnsHUMAN_
        wrote on last edited by
        #3

        I figured that out. but that is applicable in case of CreateFontIndirect(). I had tried it, but still the size differs from what is actually seen in WORD -- modified at 9:31 Monday 4th June, 2007

        Somethings seem HARD to do, until we know how to do them. ;-)_AnShUmAn_

        1 Reply Last reply
        0
        • _ _AnsHUMAN_

          Hi All, I was just understanding how does MS set the font sizes. In an MFC application if we use CreateFont() API to create a font and set it's size to 8 and style to FW_BOLD.Something like this: myFont->CreateFont (8,0,0,0,FW_BOLD,0,0,0,0,0,0,0,0,"Tahoma"); This creates a font on the screen that is hard to read due to it's small size. But when we open MS-WORD and set it's font size to 8 and FONT to Tahoma, the user is able to read the text properly. So are the values displayed in list box in MS-WORD used to set the font size? or they are just to let the user see the values and don't have much meaning? In my application I would like to Create a font that shows as what Tahoma (size 8) is seen in MS-WORD.I am able to do this but not without setting the value (in bold above) to 12,14 or 16

          Somethings seem HARD to do, until we know how to do them. ;-)_AnShUmAn_

          M Offline
          M Offline
          Mark Salsbery
          wrote on last edited by
          #4

          Font heights are in logical units. MS WORD is WYSIWYG so the logical units you enter in the font dialog are converted to the correct size font based on the size of the displayed document. If you aren't worried about exact font sizes, use an arbitrary negative height. If you need your font size based on actual dimensions then you'll need to convert the logical units to device units: Height = -MulDiv(PointSize, GetDeviceCaps(hdc, LOGPIXELSY), 72); Mark

          "Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder

          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