Search Results for

    Show / Hide Table of Contents

    Class Font

    Represents font object that can be using during text rendering (it uses Font Asset but with pre-cached data for chosen font properties).

    Inheritance
    System.Object
    Object
    Font
    Inherited Members
    Object.__unmanagedPtr
    Object.__internalId
    Object.Finalize()
    Object.As<T>()
    Object.NewValue(Type)
    Object.New(String)
    Object.Find<T>(Guid, Boolean)
    Object.Find(Guid, Type, Boolean)
    Object.TryFind<T>(Guid)
    Object.TryFind(Guid, Type)
    Object.Destroy(Object, Single)
    Object.DestroyNow(Object)
    Object.Destroy<T>(T, Single)
    Object.Equals(Object)
    Object.GetUnmanagedPtr(Object)
    Object.GetUnmanagedInterface(Object, Type)
    Object.FromUnmanagedPtr(IntPtr)
    Object.MapObjectID(Guid)
    Object.RemapObjectID(Guid)
    Object.GetHashCode()
    Object.ID
    Object.TypeName
    Namespace: FlaxEngine
    Assembly: FlaxEngine.CSharp.dll
    Syntax
    [Unmanaged]
    public sealed class Font : Object

    Constructors

    Font()

    Initializes a new instance of the Font.

    Declaration
    public Font()

    Properties

    Ascender

    Gets the largest vertical distance above the baseline for any character in the font.

    Declaration
    [Unmanaged]
    public int Ascender { get; }
    Property Value
    System.Int32

    Asset

    Gets parent font asset that contains font family used by this font.

    Declaration
    [Unmanaged]
    public FontAsset Asset { get; }
    Property Value
    FontAsset

    Descender

    Gets the largest vertical distance below the baseline for any character in the font.

    Declaration
    [Unmanaged]
    public int Descender { get; }
    Property Value
    System.Int32

    FallbackFonts

    The active fallback fonts.

    Declaration
    [Unmanaged]
    public static FontAsset[] FallbackFonts { get; set; }
    Property Value
    FontAsset[]

    Height

    Gets characters height.

    Declaration
    [Unmanaged]
    public int Height { get; }
    Property Value
    System.Int32

    LineGap

    Gets the line gap property.

    Declaration
    [Unmanaged]
    public int LineGap { get; }
    Property Value
    System.Int32

    Size

    Gets font size.

    Declaration
    [Unmanaged]
    public float Size { get; }
    Property Value
    System.Single

    Methods

    CacheText(String)

    Caches the given text to prepared for the rendering.

    Declaration
    [Unmanaged]
    public void CacheText(string text)
    Parameters
    System.String text

    The text witch characters to cache.

    GetCharPosition(String, ref TextRange, Int32)

    Calculates character position for given text and character index

    Declaration
    [Unmanaged]
    public Float2 GetCharPosition(string text, ref TextRange textRange, int index)
    Parameters
    System.String text

    The input text to test.

    TextRange textRange

    The input text range (substring range of the input text parameter).

    System.Int32 index

    The text position to get coordinates of.

    Returns
    Float2

    The character position (upper left corner which can be used for a caret position).

    GetCharPosition(String, ref TextRange, Int32, ref TextLayoutOptions)

    Calculates character position for given text and character index.

    Declaration
    [Unmanaged]
    public Float2 GetCharPosition(string text, ref TextRange textRange, int index, ref TextLayoutOptions layout)
    Parameters
    System.String text

    The input text to test.

    TextRange textRange

    The input text range (substring range of the input text parameter).

    System.Int32 index

    The text position to get coordinates of.

    TextLayoutOptions layout

    The text layout properties.

    Returns
    Float2

    The character position (upper left corner which can be used for a caret position).

    GetCharPosition(String, Int32)

    Calculates character position for given text and character index

    Declaration
    [Unmanaged]
    public Float2 GetCharPosition(string text, int index)
    Parameters
    System.String text

    The input text to test.

    System.Int32 index

    The text position to get coordinates of.

    Returns
    Float2

    The character position (upper left corner which can be used for a caret position).

    GetCharPosition(String, Int32, ref TextLayoutOptions)

    Calculates character position for given text and character index.

    Declaration
    [Unmanaged]
    public Float2 GetCharPosition(string text, int index, ref TextLayoutOptions layout)
    Parameters
    System.String text

    The input text to test.

    System.Int32 index

    The text position to get coordinates of.

    TextLayoutOptions layout

    The text layout properties.

    Returns
    Float2

    The character position (upper left corner which can be used for a caret position).

    GetKerning(Char, Char)

    Gets the kerning amount for a pair of characters.

    Declaration
    [Unmanaged]
    public int GetKerning(char first, char second)
    Parameters
    System.Char first

    The first character in the pair.

    System.Char second

    The second character in the pair.

    Returns
    System.Int32

    The kerning amount or 0 if no kerning.

    HitTestText(String, Float2)

    Calculates hit character index at given location.

    Declaration
    [Unmanaged]
    public int HitTestText(string text, Float2 location)
    Parameters
    System.String text

    The input text to test.

    Float2 location

    The input location to test.

    Returns
    System.Int32

    The selected character position index (can be equal to text length if location is outside of the layout rectangle).

    HitTestText(String, Float2, ref TextLayoutOptions)

    Calculates hit character index at given location.

    Declaration
    [Unmanaged]
    public int HitTestText(string text, Float2 location, ref TextLayoutOptions layout)
    Parameters
    System.String text

    The input text to test.

    Float2 location

    The input location to test.

    TextLayoutOptions layout

    The text layout properties.

    Returns
    System.Int32

    The selected character position index (can be equal to text length if location is outside of the layout rectangle).

    HitTestText(String, ref TextRange, Float2)

    Calculates hit character index at given location.

    Declaration
    [Unmanaged]
    public int HitTestText(string text, ref TextRange textRange, Float2 location)
    Parameters
    System.String text

    The input text to test.

    TextRange textRange

    The input text range (substring range of the input text parameter).

    Float2 location

    The input location to test.

    Returns
    System.Int32

    The selected character position index (can be equal to text length if location is outside of the layout rectangle).

    HitTestText(String, ref TextRange, Float2, ref TextLayoutOptions)

    Calculates hit character index at given location.

    Declaration
    [Unmanaged]
    public int HitTestText(string text, ref TextRange textRange, Float2 location, ref TextLayoutOptions layout)
    Parameters
    System.String text

    The input text to test.

    TextRange textRange

    The input text range (substring range of the input text parameter).

    Float2 location

    The input location to test.

    TextLayoutOptions layout

    The text layout properties.

    Returns
    System.Int32

    The selected character position index (can be equal to text length if location is outside of the layout rectangle).

    Invalidate()

    Invalidates all cached dynamic font atlases using this font. Can be used to reload font characters after changing font asset options.

    Declaration
    [Unmanaged]
    public void Invalidate()

    MeasureText(String)

    Measures minimum size of the rectangle that will be needed to draw given text

    Declaration
    [Unmanaged]
    public Float2 MeasureText(string text)
    Parameters
    System.String text

    The input text to test.

    Returns
    Float2

    The minimum size for that text and font to render properly.

    MeasureText(String, ref TextLayoutOptions)

    Measures minimum size of the rectangle that will be needed to draw given text.

    Declaration
    [Unmanaged]
    public Float2 MeasureText(string text, ref TextLayoutOptions layout)
    Parameters
    System.String text

    The input text to test.

    TextLayoutOptions layout

    The layout properties.

    Returns
    Float2

    The minimum size for that text and font to render properly.

    MeasureText(String, ref TextRange)

    Measures minimum size of the rectangle that will be needed to draw given text

    Declaration
    [Unmanaged]
    public Float2 MeasureText(string text, ref TextRange textRange)
    Parameters
    System.String text

    The input text to test.

    TextRange textRange

    The input text range (substring range of the input text parameter).

    Returns
    Float2

    The minimum size for that text and font to render properly.

    MeasureText(String, ref TextRange, ref TextLayoutOptions)

    Measures minimum size of the rectangle that will be needed to draw given text.

    Declaration
    [Unmanaged]
    public Float2 MeasureText(string text, ref TextRange textRange, ref TextLayoutOptions layout)
    Parameters
    System.String text

    The input text to test.

    TextRange textRange

    The input text range (substring range of the input text parameter).

    TextLayoutOptions layout

    The layout properties.

    Returns
    Float2

    The minimum size for that text and font to render properly.

    ProcessText(String)

    Processes text to get cached lines for rendering.

    Declaration
    [Unmanaged]
    public FontLineCache[] ProcessText(string text)
    Parameters
    System.String text

    The input text.

    Returns
    FontLineCache[]

    The output lines list.

    ProcessText(String, ref TextLayoutOptions)

    Processes text to get cached lines for rendering.

    Declaration
    [Unmanaged]
    public FontLineCache[] ProcessText(string text, ref TextLayoutOptions layout)
    Parameters
    System.String text

    The input text.

    TextLayoutOptions layout

    The layout properties.

    Returns
    FontLineCache[]

    The output lines list.

    ProcessText(String, ref TextRange)

    Processes text to get cached lines for rendering.

    Declaration
    [Unmanaged]
    public FontLineCache[] ProcessText(string text, ref TextRange textRange)
    Parameters
    System.String text

    The input text.

    TextRange textRange

    The input text range (substring range of the input text parameter).

    Returns
    FontLineCache[]

    The output lines list.

    ProcessText(String, ref TextRange, ref TextLayoutOptions)

    Processes text to get cached lines for rendering.

    Declaration
    [Unmanaged]
    public FontLineCache[] ProcessText(string text, ref TextRange textRange, ref TextLayoutOptions layout)
    Parameters
    System.String text

    The input text.

    TextRange textRange

    The input text range (substring range of the input text parameter).

    TextLayoutOptions layout

    The layout properties.

    Returns
    FontLineCache[]

    The output lines list.

    Extension Methods

    Extensions.ReflectiveCompare<T>(T, T)
    Extensions.DeepClone<T>(T)
    Extensions.RawClone<T>(T)
    In This Article
    Back to top Copyright © 2012-2024 Wojciech Figat