Stride

OPEN / CLOSE
  • Features
  • Blog
  • Documentation
  • Community
(icon) Download

  • Discord
  • Facebook
  • Twitter
  • YouTube

LANGUAGE

OPEN / CLOSE
  • English
  • 日本語
    Show / Hide Table of Contents

    IFontFactory Interface

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

    The interface to create and manage fonts.

    public interface IFontFactory
    Name Description
    Methods
    NewDynamic(Single, String, FontStyle, FontAntiAliasMode, Boolean, Single, Single, Char)

    Create a new instance of a dynamic font.

    NewScalable(Single, IList<Glyph>, IList<Image>, Single, Single, IList<Kerning>, Single, Single, Char)

    Create a new instance of a scalable font.

    NewScalable(Single, IList<Glyph>, IList<Texture>, Single, Single, IList<Kerning>, Single, Single, Char)

    Create a new instance of a scalable font.

    NewStatic(Single, IList<Glyph>, IList<Image>, Single, Single, IList<Kerning>, Single, Single, Char)

    Create a new instance of a static font.

    NewStatic(Single, IList<Glyph>, IList<Texture>, Single, Single, IList<Kerning>, Single, Single, Char)

    Create a new instance of a static font.

    | Improve this Doc View Source

    Methods


    NewDynamic(Single, String, FontStyle, FontAntiAliasMode, Boolean, Single, Single, Char)

    Create a new instance of a dynamic font.

    SpriteFont NewDynamic(float defaultSize, string fontName, FontStyle style, FontAntiAliasMode antiAliasMode = FontAntiAliasMode.Default, bool useKerning = false, float extraSpacing = 0F, float extraLineSpacing = 0F, char defaultCharacter = ' ')
    Parameters
    Type Name Description
    System.Single defaultSize

    The default size of the font in pixels.

    System.String fontName

    The family name of the (TrueType) font.

    FontStyle style

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

    FontAntiAliasMode antiAliasMode

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

    System.Boolean useKerning

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

    System.Single extraSpacing

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

    System.Single extraLineSpacing

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

    System.Char defaultCharacter

    The default character fall-back.

    Returns
    Type Description
    SpriteFont

    The newly created dynamic font


    NewScalable(Single, IList<Glyph>, IList<Image>, Single, Single, IList<Kerning>, Single, Single, Char)

    Create a new instance of a scalable font.

    SpriteFont NewScalable(float size, IList<Glyph> glyphs, IList<Image> images, float baseOffset, float defaultLineSpacing, IList<Kerning> kernings = null, float extraSpacing = 0F, float extraLineSpacing = 0F, char defaultCharacter = ' ')
    Parameters
    Type Name Description
    System.Single size

    The size of the font in pixels.

    System.Collections.Generic.IList<Glyph> glyphs

    The list of the font glyphs

    System.Collections.Generic.IList<Image> images

    The list of images containing the font character data

    System.Single baseOffset

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

    System.Single defaultLineSpacing

    The default line spacing of the font.

    System.Collections.Generic.IList<Kerning> kernings

    The list of the kerning information of the font

    System.Single extraSpacing

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

    System.Single extraLineSpacing

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

    System.Char defaultCharacter

    The default character fall-back.

    Returns
    Type Description
    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(Single, IList<Glyph>, IList<Texture>, Single, Single, IList<Kerning>, Single, Single, Char)

    Create a new instance of a scalable font.

    SpriteFont NewScalable(float size, IList<Glyph> glyphs, IList<Texture> textures, float baseOffset, float defaultLineSpacing, IList<Kerning> kernings = null, float extraSpacing = 0F, float extraLineSpacing = 0F, char defaultCharacter = ' ')
    Parameters
    Type Name Description
    System.Single size

    The size of the font in pixels.

    System.Collections.Generic.IList<Glyph> glyphs

    The list of the font glyphs

    System.Collections.Generic.IList<Texture> textures

    The list of textures containing the font character data

    System.Single baseOffset

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

    System.Single defaultLineSpacing

    The default line spacing of the font.

    System.Collections.Generic.IList<Kerning> kernings

    The list of the kerning information of the font

    System.Single extraSpacing

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

    System.Single extraLineSpacing

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

    System.Char defaultCharacter

    The default character fall-back.

    Returns
    Type Description
    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(Single, IList<Glyph>, IList<Image>, Single, Single, IList<Kerning>, Single, Single, Char)

    Create a new instance of a static font.

    SpriteFont NewStatic(float size, IList<Glyph> glyphs, IList<Image> images, float baseOffset, float defaultLineSpacing, IList<Kerning> kernings = null, float extraSpacing = 0F, float extraLineSpacing = 0F, char defaultCharacter = ' ')
    Parameters
    Type Name Description
    System.Single size

    The size of the font in pixels.

    System.Collections.Generic.IList<Glyph> glyphs

    The list of the font glyphs

    System.Collections.Generic.IList<Image> images

    The list of images containing the font character data

    System.Single baseOffset

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

    System.Single defaultLineSpacing

    The default line spacing of the font.

    System.Collections.Generic.IList<Kerning> kernings

    The list of the kerning information of the font

    System.Single extraSpacing

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

    System.Single extraLineSpacing

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

    System.Char defaultCharacter

    The default character fall-back.

    Returns
    Type Description
    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(Single, IList<Glyph>, IList<Texture>, Single, Single, IList<Kerning>, Single, Single, Char)

    Create a new instance of a static font.

    SpriteFont NewStatic(float size, IList<Glyph> glyphs, IList<Texture> textures, float baseOffset, float defaultLineSpacing, IList<Kerning> kernings = null, float extraSpacing = 0F, float extraLineSpacing = 0F, char defaultCharacter = ' ')
    Parameters
    Type Name Description
    System.Single size

    The size of the font in pixels.

    System.Collections.Generic.IList<Glyph> glyphs

    The list of the font glyphs

    System.Collections.Generic.IList<Texture> textures

    The list of textures containing the font character data

    System.Single baseOffset

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

    System.Single defaultLineSpacing

    The default line spacing of the font.

    System.Collections.Generic.IList<Kerning> kernings

    The list of the kerning information of the font

    System.Single extraSpacing

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

    System.Single extraLineSpacing

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

    System.Char defaultCharacter

    The default character fall-back.

    Returns
    Type Description
    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.


    Extension Methods

    ComponentBaseExtensions.DisposeBy<T>(T, ICollectorHolder)
    ComponentBaseExtensions.RemoveDisposeBy<T>(T, ICollectorHolder)
    • Improve this Doc
    • View Source
    In This Article
    In This Article
    • Methods
      • NewDynamic(Single, String, FontStyle, FontAntiAliasMode, Boolean, Single, Single, Char)
      • NewScalable(Single, IList<Glyph>, IList<Image>, Single, Single, IList<Kerning>, Single, Single, Char)
      • NewScalable(Single, IList<Glyph>, IList<Texture>, Single, Single, IList<Kerning>, Single, Single, Char)
      • NewStatic(Single, IList<Glyph>, IList<Image>, Single, Single, IList<Kerning>, Single, Single, Char)
      • NewStatic(Single, IList<Glyph>, IList<Texture>, Single, Single, IList<Kerning>, Single, Single, Char)
    • Extension Methods

    Back to top

    Copyright © 2019-2021 .NET Foundation and Contributors
    Supported by the .NET Foundation