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. Convert Font Size

Convert Font Size

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialquestion
4 Posts 2 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.
  • H Offline
    H Offline
    HumanOsc
    wrote on last edited by
    #1

    Hello... How to convert the font size from pixel to point... :confused: Any ideas ???

    J 1 Reply Last reply
    0
    • H HumanOsc

      Hello... How to convert the font size from pixel to point... :confused: Any ideas ???

      J Offline
      J Offline
      Jose Lamas Rios
      wrote on last edited by
      #2

      Try something like this:

      int RoundDiv(a,b)
      {
        return (a + b/2) / b;
      }
       
      int PixelToPoint(int nPixels)
      {
        return RoundDiv( nPixels * 72, GetDeviceCaps(GetDC(NULL), LOGPIXELSY) );
      }

      Hope it helps, -- jlr http://jlamas.blogspot.com/[^]

      H 1 Reply Last reply
      0
      • J Jose Lamas Rios

        Try something like this:

        int RoundDiv(a,b)
        {
          return (a + b/2) / b;
        }
         
        int PixelToPoint(int nPixels)
        {
          return RoundDiv( nPixels * 72, GetDeviceCaps(GetDC(NULL), LOGPIXELSY) );
        }

        Hope it helps, -- jlr http://jlamas.blogspot.com/[^]

        H Offline
        H Offline
        HumanOsc
        wrote on last edited by
        #3

        Big Thx for fast reply... :-D Believe it's the right thing i need... :laugh:

        H 1 Reply Last reply
        0
        • H HumanOsc

          Big Thx for fast reply... :-D Believe it's the right thing i need... :laugh:

          H Offline
          H Offline
          HumanOsc
          wrote on last edited by
          #4

          Big Thx... I have make some tests and it works fine... :-D

          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