DynamicTextSize class

This class allows you to specify multiple sprite fonts (of different sizes), and then choose the largest that will fit within a given width. It is useful in cases where you are rendering arbitrary text (like Gamertags) within a limited space.

Constructors

public DynamicTextSize(bool caching)
Creates a new set of dynamic text sizes. If caching is turned on, results will be stored so that strings do not have to be measured again each time they are drawn.

Methods

public void AddTextStyle(TextStyle style)
Adds a new text style based on the TextStyle class. These must be added in order of largest to smallest.

public TextStyle GetStyleForTargetSize(string text, float maxWidth)
Returns the largest TextStyle that can be used to render the specified text within the given width.

Last edited Oct 24, 2009 at 7:16 PM by dylanwolf, version 1

Comments

No comments yet.