FontTextureProcessor.GetCharacterForIndex Method

Note

This method is available only when developing for Windows.

Maps a glyph index to a character.

Syntax

'Declaration
Protected Overridable Function GetCharacterForIndex ( _
         index As Integer _
) As Char 
protected virtual char GetCharacterForIndex (
         int index
)
protected:
virtual wchar_t GetCharacterForIndex(
         int index
)

Parameters

  • index
    Type: Int32
    The glyph index. This is a zero-based index that corresponds to the position of the glyph in the original character. This value begins at the upper-left corner of the texture and increases when moving to the right and down.

Return Value

Type: Char
The character represented by the specified glyph index.

Exceptions

Exception type Condition
ArgumentOutOfRangeException index is out of the range of available characters.

Remarks

This method is designed to be overridden by a subclass of this processor. For example, if the original texture contains the characters A, B, and C, in that order, this method should return "A" when passed 0, "B" when passed 1, and "C" when passed 2. Subclasses of this processor may override this method to control which characters a bitmap font represents.

If not overridden, the default implementation of this function assumes a Unicode order of character code points starting at code point 32—the space character. In other words, it assumes that a character index of zero corresponds to a space character, a character index of 1 corresponds to an exclamation point ("!"), and so on.

A font texture must not contain more than one instance of any given character code point. For example, it must not contain two uppercase "A" characters. As a result, any implementation of this function should ensure that it cannot return the same character for two different indices.

Requirements

Namespace: Microsoft.Xna.Framework.Content.Pipeline.Processors

Assembly: Microsoft.Xna.Framework.Content.Pipeline (in microsoft.xna.framework.content.pipeline.dll)

See Also

Reference

FontTextureProcessor Class
FontTextureProcessor Members
Microsoft.Xna.Framework.Content.Pipeline.Processors Namespace

Platforms

Windows 7, Windows Vista, Windows XP