Click here to Skip to main content
15,895,142 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionHow do I get font width and height in pixels ? Pin
udiraz16-Jan-06 7:40
udiraz16-Jan-06 7:40 
AnswerRe: How do I get font width and height in pixels ? Pin
basementman16-Jan-06 7:47
basementman16-Jan-06 7:47 
GeneralRe: How do I get font width and height in pixels ? Pin
udiraz17-Jan-06 22:35
udiraz17-Jan-06 22:35 
GeneralRe: How do I get font width and height in pixels ? Pin
basementman18-Jan-06 4:11
basementman18-Jan-06 4:11 
GeneralRe: How do I get font width and height in pixels ? Pin
udiraz18-Jan-06 23:11
udiraz18-Jan-06 23:11 
GeneralRe: How do I get font width and height in pixels ? Pin
Shraddhan22-Jan-06 22:09
Shraddhan22-Jan-06 22:09 
GeneralRe: How do I get font width and height in pixels ? Pin
udiraz22-Jan-06 22:20
udiraz22-Jan-06 22:20 
GeneralRe: How do I get font width and height in pixels ? Pin
Shraddhan22-Jan-06 23:55
Shraddhan22-Jan-06 23:55 
I couldn't find information on GetTextExtentPoint32.

GetTextMetrics returns a TEXTMETRIC structure that gives average and maximum character width, which are no good for my purposes.

Under GetTextExtent and GetOutputTextExtent, Microsoft notes:

Since some devices do not place characters in regular cell arrays (that is, they carry out kerning), the sum of the extents of the characters in a string may not be equal to the extent of the string.

So clearly ambiguous!

My notes on my problem with fitting strings into CEdit controls mention that the text is shown with white space on either side. In fact, with large font sizes. the output is chopped on the right if it gets anywhere near the edge of the edit box. But I have no idea what the whitespace allowance should be. It depends on the face as well as the size.

So is this a feature of CEdit controls?

As for finding the overall height, one last ditch method occurred to me: draw the text to a bitmap and measure the height of the drawn area by scanning the pixels. Don't ask me how, though.

Shraddhan
GeneralRe: How do I get font width and height in pixels ? Pin
udiraz23-Jan-06 0:42
udiraz23-Jan-06 0:42 
QuestionSSE/SSE2 optimization with VC 8.0 Pin
pgrohs16-Jan-06 7:11
pgrohs16-Jan-06 7:11 
QuestionBeginner Visual c++ , code for adding two integers Pin
Technobizz16-Jan-06 6:55
Technobizz16-Jan-06 6:55 
AnswerRe: Beginner Visual c++ , code for adding two integers Pin
Bob Flynn16-Jan-06 7:18
Bob Flynn16-Jan-06 7:18 
AnswerRe: Beginner Visual c++ , code for adding two integers Pin
toxcct16-Jan-06 7:21
toxcct16-Jan-06 7:21 
General[Message Deleted]...and... Pin
toxcct16-Jan-06 7:46
toxcct16-Jan-06 7:46 
GeneralRe: :mad: :mad: :mad: :mad: :mad: Pin
BlackDice16-Jan-06 8:18
BlackDice16-Jan-06 8:18 
GeneralRe: :mad: :mad: :mad: :mad: :mad: Pin
Nish Nishant16-Jan-06 8:52
sitebuilderNish Nishant16-Jan-06 8:52 
GeneralRe: :mad: :mad: :mad: :mad: :mad: Pin
Bob Flynn16-Jan-06 10:22
Bob Flynn16-Jan-06 10:22 
GeneralRe: :mad: :mad: :mad: :mad: :mad: Pin
ThatsAlok16-Jan-06 17:00
ThatsAlok16-Jan-06 17:00 
GeneralRe: :mad: :mad: :mad: :mad: :mad: Pin
Rajesh R Subramanian16-Jan-06 19:26
professionalRajesh R Subramanian16-Jan-06 19:26 
AnswerRe: Beginner Visual c++ , code for adding two integers Pin
ThatsAlok16-Jan-06 16:58
ThatsAlok16-Jan-06 16:58 
AnswerRe: Beginner Visual c++ , code for adding two integers Pin
vikas amin17-Jan-06 2:36
vikas amin17-Jan-06 2:36 
QuestionNeed different versions for different project configurations Pin
Wheatbread16-Jan-06 6:04
Wheatbread16-Jan-06 6:04 
AnswerRe: Need different versions for different project configurations Pin
Bob Flynn16-Jan-06 7:24
Bob Flynn16-Jan-06 7:24 
GeneralRe: Need different versions for different project configurations Pin
Wheatbread16-Jan-06 8:41
Wheatbread16-Jan-06 8:41 
AnswerRe: Need different versions for different project configurations Pin
Oleg Didenko17-Jan-06 4:52
Oleg Didenko17-Jan-06 4:52 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.