microsoft / DirectXTK

The DirectX Tool Kit (aka DirectXTK) is a collection of helper classes for writing DirectX 11.x code in C++
https://walbourn.github.io/directxtk/
MIT License
2.55k stars 506 forks source link

Request to expose SpriteFont::Impl::FindGlyph() method to the toolkit's API #11

Closed ghost closed 9 years ago

ghost commented 9 years ago

I'm writing a framework based on DirectX which includes common UI controls such as buttons, labels, textboxes, etc. As you can imagine, the TextBox control required precise measurement of rendered fonts, which was only possible once I added a FindGlyph() wrapper to the SpriteFont class so that I could get offset information for characters. I could have possibly not required this if MeasureString() worked differently.

While ultimately I was able to complete the development of this control, my framework is now dependent on a custom, modified version of DirectXTK-- not a desirable thing, obviously.

If this change request is not feasible and there is a way to achieve precise font measurements through other means I would appreciate any assistance you could provide!

Thanks!

walbourn commented 9 years ago

What specific information do you need in the public interface?

ghost commented 9 years ago

Height/width and x/y offset of a character.

walbourn commented 9 years ago

Added SpriteFont::FindGlyph and SpriteFont::GetSpriteSheet

Change 427ed0811d1f13607314d498aa057e6634d70338