Thread: finding out width of text using font x

  1. #1
    Registered User
    Join Date
    Jan 2005
    Posts
    108

    finding out width of text using font x

    Hello,

    I'm just curious if there is a good way to figure out, how much space would drawing a text would take with a specific font and specific text.. ?

    I mean, DrawText doesn't seem to return any information about how wide was the text, how many lines was printed.. etc. Am I missing something?

    Cheers!

  2. #2
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    >>would drawing a text would take with a specific font and specific text.. ?

    Win32
    GetTextExtentPoint32()

    MFC
    use DrawText, an empty rect and the flag DT_CALCRECT
    ie
    DrawText(String, &TextRect, DT_CALCRECT );
    "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

  3. #3
    Registered User
    Join Date
    Jan 2005
    Posts
    108
    Thanks!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. char copy
    By variable in forum C Programming
    Replies: 8
    Last Post: 02-06-2005, 10:18 PM
  2. struct question
    By caduardo21 in forum Windows Programming
    Replies: 5
    Last Post: 01-31-2005, 04:49 PM
  3. Changing the font on static text and buttons
    By Unregistered in forum Windows Programming
    Replies: 3
    Last Post: 06-28-2002, 09:36 AM
  4. Replies: 3
    Last Post: 02-08-2002, 10:15 PM
  5. Font and text type
    By Unregistered in forum C++ Programming
    Replies: 2
    Last Post: 02-02-2002, 12:33 PM