Thread: font size

  1. #1

    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
    near a computer
    "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).

    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, 04:05 AM
  2. How to Change Text File Font Size
    By space in forum Windows Programming
    Replies: 3
    Last Post: 08-07-2006, 11:42 PM
  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, 01: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