Table of Contents

Class FontDataFactory

Namespace
Stride.Graphics.Font
Assembly
Stride.Graphics.dll

A font factory initializing only the data members of font. Used when creating a font in the only purpose use serializing on disk.

public class FontDataFactory : IFontFactory
Inheritance
FontDataFactory
Implements

Methods

NewDynamic(float, string, FontStyle, FontAntiAliasMode, bool, float, float, char)

Create a new instance of a dynamic font.

public SpriteFont NewDynamic(float defaultSize, string fontName, FontStyle style, FontAntiAliasMode antiAliasMode, bool useKerning, float extraSpacing, float extraLineSpacing, char defaultCharacter)

Parameters

defaultSize float

The default size of the font in pixels.

fontName string

The family name of the (TrueType) font.

style FontStyle

The style for the font. A combinaison of 'regular', 'bold' or 'italic'.

antiAliasMode FontAntiAliasMode

The anti-aliasing mode to use when rendering the font. By default, font textures are rendered in levels of grey.

useKerning bool

Specifies whether to use kerning information when rendering the font. Default value is false (NOT SUPPORTED YET)

extraSpacing float

The character extra spacing in pixels. Zero is default spacing, negative closer together, positive further apart.

extraLineSpacing float

This is the extra distance in pixels to add between each line of text. Zero is default spacing, negative closer together, positive further apart.

defaultCharacter char

The default character fall-back.

Returns

SpriteFont

The newly created dynamic font

NewScalable(float, IList<Glyph>, IList<Image>, float, float, IList<Kerning>, float, float, char)

Create a new instance of a scalable font.

public SpriteFont NewScalable(float size, IList<Glyph> glyphs, IList<Image> images, float baseOffset, float defaultLineSpacing, IList<Kerning> kernings = null, float extraSpacing = 0, float extraLineSpacing = 0, char defaultCharacter = ' ')

Parameters

size float

The size of the font in pixels.

glyphs IList<Glyph>

The list of the font glyphs

images IList<Image>

The list of images containing the font character data

baseOffset float

The number of pixels from the absolute top of the line to the base of the characters.

defaultLineSpacing float

The default line spacing of the font.

kernings IList<Kerning>

The list of the kerning information of the font

extraSpacing float

The character extra spacing in pixels. Zero is default spacing, negative closer together, positive further apart.

extraLineSpacing float

This is the extra distance in pixels to add between each line of text. Zero is default spacing, negative closer together, positive further apart.

defaultCharacter char

The default character fall-back.

Returns

SpriteFont

The newly created static font

Remarks

The font does not copy the provided glyphs information. Provided glyphs should not be modified after the creation of the font.

NewScalable(float, IList<Glyph>, IList<Texture>, float, float, IList<Kerning>, float, float, char)

Create a new instance of a scalable font.

public SpriteFont NewScalable(float size, IList<Glyph> glyphs, IList<Texture> textures, float baseOffset, float defaultLineSpacing, IList<Kerning> kernings = null, float extraSpacing = 0, float extraLineSpacing = 0, char defaultCharacter = ' ')

Parameters

size float

The size of the font in pixels.

glyphs IList<Glyph>

The list of the font glyphs

textures IList<Texture>

The list of textures containing the font character data

baseOffset float

The number of pixels from the absolute top of the line to the base of the characters.

defaultLineSpacing float

The default line spacing of the font.

kernings IList<Kerning>

The list of the kerning information of the font

extraSpacing float

The character extra spacing in pixels. Zero is default spacing, negative closer together, positive further apart.

extraLineSpacing float

This is the extra distance in pixels to add between each line of text. Zero is default spacing, negative closer together, positive further apart.

defaultCharacter char

The default character fall-back.

Returns

SpriteFont

The newly created static font

Remarks

The font does not copy the provided textures, glyphs information. Provided data should not be modified after the creation of the font. The textures should be disposed manually (if useless) after that the sprite font is not used anymore.

NewStatic(float, IList<Glyph>, IList<Image>, float, float, IList<Kerning>, float, float, char)

Create a new instance of a static font.

public SpriteFont NewStatic(float size, IList<Glyph> glyphs, IList<Image> images, float baseOffset, float defaultLineSpacing, IList<Kerning> kernings = null, float extraSpacing = 0, float extraLineSpacing = 0, char defaultCharacter = ' ')

Parameters

size float

The size of the font in pixels.

glyphs IList<Glyph>

The list of the font glyphs

images IList<Image>

The list of images containing the font character data

baseOffset float

The number of pixels from the absolute top of the line to the base of the characters.

defaultLineSpacing float

The default line spacing of the font.

kernings IList<Kerning>

The list of the kerning information of the font

extraSpacing float

The character extra spacing in pixels. Zero is default spacing, negative closer together, positive further apart.

extraLineSpacing float

This is the extra distance in pixels to add between each line of text. Zero is default spacing, negative closer together, positive further apart.

defaultCharacter char

The default character fall-back.

Returns

SpriteFont

The newly created static font

Remarks

The font does not copy the provided glyphs information. Provided glyphs should not be modified after the creation of the font.

NewStatic(float, IList<Glyph>, IList<Texture>, float, float, IList<Kerning>, float, float, char)

Create a new instance of a static font.

public SpriteFont NewStatic(float size, IList<Glyph> glyphs, IList<Texture> textures, float baseOffset, float defaultLineSpacing, IList<Kerning> kernings = null, float extraSpacing = 0, float extraLineSpacing = 0, char defaultCharacter = ' ')

Parameters

size float

The size of the font in pixels.

glyphs IList<Glyph>

The list of the font glyphs

textures IList<Texture>

The list of textures containing the font character data

baseOffset float

The number of pixels from the absolute top of the line to the base of the characters.

defaultLineSpacing float

The default line spacing of the font.

kernings IList<Kerning>

The list of the kerning information of the font

extraSpacing float

The character extra spacing in pixels. Zero is default spacing, negative closer together, positive further apart.

extraLineSpacing float

This is the extra distance in pixels to add between each line of text. Zero is default spacing, negative closer together, positive further apart.

defaultCharacter char

The default character fall-back.

Returns

SpriteFont

The newly created static font

Remarks

The font does not copy the provided textures, glyphs information. Provided data should not be modified after the creation of the font. The textures should be disposed manually (if useless) after that the sprite font is not used anymore.