|
-
May 15th, 1999, 12:04 PM
#1
Finding size of certain character
How can I determine the pixel dimentions of a certain character of a certain font with Win32 API?
-
May 18th, 1999, 01:12 AM
#2
Re: Finding size of certain character
Check GetCharABCWidths function.
-
May 18th, 1999, 02:45 AM
#3
Re: Finding size of certain character
If hFont is the font you want to check, and you have a window hMyWindow, then use:
--- char cString[] = "X";
HDC hDC ;
HFONT hFntOld ;
int iLength ;
SIZE sFontSize ;
hDC = GetDC(hMyWindow);
hFntOld = (HFONT)SelectObject(hDC, hFont);
iLength = strlen(cString);
GetTextExtentPoint32(hDC, cString, iLength, &sFontSize);
// Now, sFontSize.cx has the width and sFontSize.cy has the height
// of "X" in your font.
// Tidy up.
SelectObject(hDC, hFntOld);
ReleaseDC(hMyWindow, hDC);
---
Does this help?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|