Class FontSystem
The system managing the fonts.
public class FontSystem : IFontFactory
- Inheritance
-
FontSystem
- Implements
Constructors
FontSystem()
Create a new instance of FontSystem base on the provided GraphicsDevice.
public FontSystem()
Methods
Draw()
public void Draw()
Load(GraphicsDevice, IDatabaseFileProviderService)
Load this system.
public void Load(GraphicsDevice graphicsDevice, IDatabaseFileProviderService fileProviderService)
Parameters
graphicsDevice
GraphicsDeviceThe graphics device.
fileProviderService
IDatabaseFileProviderService
Exceptions
- ArgumentNullException
graphicsDevice
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 = FontAntiAliasMode.Default, bool useKerning = false, float extraSpacing = 0, float extraLineSpacing = 0, char defaultCharacter = ' ')
Parameters
defaultSize
floatThe default size of the font in pixels.
fontName
stringThe family name of the (TrueType) font.
style
FontStyleThe style for the font. A combinaison of 'regular', 'bold' or 'italic'.
antiAliasMode
FontAntiAliasModeThe anti-aliasing mode to use when rendering the font. By default, font textures are rendered in levels of grey.
useKerning
boolSpecifies whether to use kerning information when rendering the font. Default value is false (NOT SUPPORTED YET)
extraSpacing
floatThe character extra spacing in pixels. Zero is default spacing, negative closer together, positive further apart.
extraLineSpacing
floatThis is the extra distance in pixels to add between each line of text. Zero is default spacing, negative closer together, positive further apart.
defaultCharacter
charThe 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
floatThe 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
floatThe number of pixels from the absolute top of the line to the base of the characters.
defaultLineSpacing
floatThe default line spacing of the font.
kernings
IList<Kerning>The list of the kerning information of the font
extraSpacing
floatThe character extra spacing in pixels. Zero is default spacing, negative closer together, positive further apart.
extraLineSpacing
floatThis is the extra distance in pixels to add between each line of text. Zero is default spacing, negative closer together, positive further apart.
defaultCharacter
charThe 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
floatThe 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
floatThe number of pixels from the absolute top of the line to the base of the characters.
defaultLineSpacing
floatThe default line spacing of the font.
kernings
IList<Kerning>The list of the kerning information of the font
extraSpacing
floatThe character extra spacing in pixels. Zero is default spacing, negative closer together, positive further apart.
extraLineSpacing
floatThis is the extra distance in pixels to add between each line of text. Zero is default spacing, negative closer together, positive further apart.
defaultCharacter
charThe 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
floatThe 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
floatThe number of pixels from the absolute top of the line to the base of the characters.
defaultLineSpacing
floatThe default line spacing of the font.
kernings
IList<Kerning>The list of the kerning information of the font
extraSpacing
floatThe character extra spacing in pixels. Zero is default spacing, negative closer together, positive further apart.
extraLineSpacing
floatThis is the extra distance in pixels to add between each line of text. Zero is default spacing, negative closer together, positive further apart.
defaultCharacter
charThe 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
floatThe 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
floatThe number of pixels from the absolute top of the line to the base of the characters.
defaultLineSpacing
floatThe default line spacing of the font.
kernings
IList<Kerning>The list of the kerning information of the font
extraSpacing
floatThe character extra spacing in pixels. Zero is default spacing, negative closer together, positive further apart.
extraLineSpacing
floatThis is the extra distance in pixels to add between each line of text. Zero is default spacing, negative closer together, positive further apart.
defaultCharacter
charThe 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.
Unload()
public void Unload()