I have a code where I draw a string to screen. Let's say I need to draw two words next to each other, each word may have different font. How do I retrive the width of printed text so that I can adjust the axis to start drawing the second word next to first one?
Asked
Active
Viewed 6,523 times
2 Answers
5
Is this what you are looking for? http://msdn.microsoft.com/en-us/library/9bt8ty58.aspx

JTMon
- 3,189
- 22
- 24
-
Also check http://stackoverflow.com/questions/263614/calculate-the-display-width-of-a-string-in-c – JTMon Jul 27 '12 at 12:28
-
yes it is, I think if this answer was more descriptive it would be more helpful for other people, right now it doesn't say much apart of that link :), but linked document contains it – Petr Jul 27 '12 at 12:38
-
From the link: "To obtain metrics suitable for adjacent strings in layout (for example, when implementing formatted text), use the MeasureCharacterRanges method". – Generic Human Jul 27 '12 at 13:15