Thread: Measure text according to font

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Aug 2001
    Posts
    411

    Measure text according to font

    Say I create a font like so.

    Code:
    	HFONT font = CreateFont(f_height,f_width,0,0,f_weight,f_italic,
    				f_underline,f_strike,f_charset,OUT_TT_PRECIS,
    				CLIP_DEFAULT_PRECIS,f_quality,
    				FF_DONTCARE|DEFAULT_PITCH,font_name.c_str());
    	SelectObject(hdc, font);
    Pretend like everything works and is defined.

    Now, how do I figure out the unit length of a text string displayed with that font? Ive been looking for hours for a library function that dose that, and all I have found is Graphics.MeasureString from the .NET framework. But I am not using .NET.
    Last edited by Eber Kain; 11-04-2005 at 05:49 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. problem with my font manager
    By hannibar in forum C Programming
    Replies: 1
    Last Post: 03-07-2006, 08:03 AM
  2. char copy
    By variable in forum C Programming
    Replies: 8
    Last Post: 02-06-2005, 10:18 PM
  3. Ok, Structs, I need help I am not familiar with them
    By incognito in forum C++ Programming
    Replies: 7
    Last Post: 06-29-2002, 09:45 PM
  4. Changing the font on static text and buttons
    By Unregistered in forum Windows Programming
    Replies: 3
    Last Post: 06-28-2002, 09:36 AM
  5. Font and text type
    By Unregistered in forum C++ Programming
    Replies: 2
    Last Post: 02-02-2002, 12:33 PM