How to get individual character positions from font.MeasureString


How to get individual character positions from font.MeasureString
Author
Message
Karl Hulme
Karl Hulme
Forum Guru (50 reputation)Forum Guru (50 reputation)Forum Guru (50 reputation)Forum Guru (50 reputation)Forum Guru (50 reputation)Forum Guru (50 reputation)Forum Guru (50 reputation)Forum Guru (50 reputation)Forum Guru (50 reputation)
Group: Forum Members
Posts: 6, Visits: 16
The NFont.MeasureString function gives me the rendered size of text, catering for word-wrap.

How can I find out the bounds of each character?

I can measure each character individually of course, but this requires me to re-implement the word-wrap rules without knowing how they've been implemented in MeasureString or PaintString.  It's a clumsy approach, so I'm hoping there's a way to get at/interact with the existing implementation.

This might be unconnected, but I might need to generate NGlyphs and implement my own word-wrap rules - which is fine in theory, but I can't figure out how the NGlyph or NGlyphRun system hangs to together.  

Any pointers much appreciated.
Nevron Support
Nevron Support
Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)
Group: Administrators
Posts: 3.1K, Visits: 4.1K
Hi Karl,

Unfortunately the framework does not expose ways to measure individual characters other than measuring a single char at a time, which is cumbersome and error prone (this approach will not work with many languages that contain character reordering, substitution or use combining characters). We will consider making this public if this is still an issue for you - just let us know if you're still interested in this functionality.


Best Regards,
Nevron Support Team


GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic
2 active, 2 guests, 0 members, 0 anonymous
No members currently viewing this topic!

Login

Explore
Messages
Mentions
Search