Class FontMap
A FontMap creates an Image containing a subset of rendered glyphs of a given Font. In addition a FontMap provides information about each glyph on the image such as its pixel position on the image. Such an image can be used together with the provided information to create geometry consisting of individual quads with each quad displaying a single character of a text string.
Inheritance
Inherited Members
Namespace: Fusee.Engine.Core
Assembly: Fusee.Engine.Core.dll
Syntax
public class FontMap
Constructors
FontMap(Font, UInt32, String)
Initializes a new instance of the FontMap class.
Declaration
public FontMap(Font font, uint pixelHeight, string alphabet = null)
Parameters
Type | Name | Description |
---|---|---|
Font | font | The font to be used. See Font. |
System.UInt32 | pixelHeight | Height in pixels of a character. See PixelHeight. |
System.String | alphabet | The alphabet. See Alphabet. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | |
System.ArgumentOutOfRangeException |
Properties
Alphabet
Gets and sets the list of characters that should be present on the font Image.
Declaration
public string Alphabet { get; set; }
Property Value
Type | Description |
---|---|
System.String | The alphabet. |
Font
Gets and sets the font displayed on this font map.
Declaration
public Font Font { get; set; }
Property Value
Type | Description |
---|---|
Font | The font. |
Image
Gets the image containing all characters specified in the Alphabet. Use this image as a texture used by individual rectangles each displaying a single character. Use the information retrieved from GetGlyphOnMap(UInt32) to position the character rectangles and to align their texture coordinates.
Declaration
public ImageData Image { get; }
Property Value
Type | Description |
---|---|
ImageData | The font image. |
PixelHeight
Gets and sets the pixel height of each character on this font. This setting will affect the size of the font Image , so be careful with this setting.
Declaration
public uint PixelHeight { get; set; }
Property Value
Type | Description |
---|---|
System.UInt32 | The height in pixels of an individual character. |
UpToDate
Gets a value indicating whether this FontMap is up-to-date.
Declaration
public bool UpToDate { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Methods
FixTextKerning(float3[], String, Single)
Fixes the kerning of a text (if possible). ToDo: Instead of fixing existing geometry provide methods to create kerned geometry.
Declaration
public float3[] FixTextKerning(float3[] vertices, string text, float scaleX)
Parameters
Type | Name | Description |
---|---|---|
float3[] | vertices | The vertices. |
System.String | text | The text. |
System.Single | scaleX | The scale x (OpenGL scaling factor). |
Returns
Type | Description |
---|---|
float3[] | The fixed vertices as an array of float3. |
GetGlyphOnMap(UInt32)
Gets the glyph on map information for the given character/glyph. This information can be used to create geometry textured with on single character from the font Image.
Declaration
public GlyphOnMap GetGlyphOnMap(uint c)
Parameters
Type | Name | Description |
---|---|---|
System.UInt32 | c | The character to obtain information for. |
Returns
Type | Description |
---|---|
GlyphOnMap | The GlyphOnMap record for the given character containing information where on the texture the glyph resides. |