font size

This is a discussion on font size within the Windows Programming forums, part of the Platform Specific Boards category; Petzold says, "When a Windows application is guaranteed that a 10-point screen font is of average size, it can then ...

  1. #1
    binmoreeeee
    Guest

    Question font size

    Petzold says,
    "When a Windows application is guaranteed that a 10-point screen font is of average size, it can then display smaller (but still readable) text using an 8-point font and larger text using fonts of point sizes greater than 10."
    I don't understand the meaning of this sentence.
    Please teach me.

  2. #2
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,859
    "If your created 10 point font is readable, then others created different sizes will be also."

    Fonts vary in size depending on the device used (screen or printer are the most common)

    Windows uses a conversion (Pixcells per logical inch) to determine what size to draw the font in a given device contex (DC).

    Code:
    iFontSize=10;//create a 10 point font
    
    //get the size relative to the device we are using	
    nHeight = -MulDiv(iFontSize, GetDeviceCaps(pDrawItem->hDC, LOGPIXELSY), 72);
    //create the font
    hFont=CreateFont(nHeight ,0 ,0 ,0 ,FW_NORMAL ,0 ,0 ,0 ,1 ,OUT_DEFAULT_PRECIS ,0 ,PROOF_QUALITY ,0 ,FONT );
    //select it into the HDC capturing the current one to return when we are finished
    hSystemFont = SelectObject(pDrawItem->hDC,hFont);
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. char Handling, probably typical newbie stuff
    By Neolyth in forum C Programming
    Replies: 16
    Last Post: 06-21-2009, 05:05 AM
  2. How to Change Text File Font Size
    By space in forum Windows Programming
    Replies: 3
    Last Post: 08-08-2006, 12:42 AM
  3. Invalid conversion from 'void*' to 'BYTE' help
    By bikr692002 in forum C++ Programming
    Replies: 9
    Last Post: 02-22-2006, 11:27 AM
  4. Increasing Font Size when printing to the screen
    By array in forum C++ Programming
    Replies: 5
    Last Post: 04-18-2004, 02:30 PM
  5. The relation between Font Size & Dialog Units
    By Templario in forum Windows Programming
    Replies: 4
    Last Post: 02-27-2003, 05:32 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21