docs.unity3d.com
    Show / Hide Table of Contents

    Class TMP_FontAssetUtilities

    Inheritance
    Object
    TMP_FontAssetUtilities
    Namespace: TMPro
    Syntax
    public class TMP_FontAssetUtilities

    Properties

    instance

    Get a singleton instance of the Font Asset Utilities class.

    Declaration
    public static TMP_FontAssetUtilities instance { get; }
    Property Value
    Type Description
    TMP_FontAssetUtilities

    Methods

    GetCharacterFromFontAsset(UInt32, TMP_FontAsset, Boolean, FontStyles, FontWeight, out Boolean)

    Returns the text element (character) for the given unicode value taking into consideration the requested font style and weight. Function searches the source font asset, its list of font assets assigned as alternative typefaces and potentially its fallbacks. The font asset out parameter contains a reference to the font asset containing the character. The typeface type indicates whether the returned font asset is the source font asset, an alternative typeface or fallback font asset.

    Declaration
    public static TMP_Character GetCharacterFromFontAsset(uint unicode, TMP_FontAsset sourceFontAsset, bool includeFallbacks, FontStyles fontStyle, FontWeight fontWeight, out bool isAlternativeTypeface)
    Parameters
    Type Name Description
    UInt32 unicode

    The unicode value of the requested character

    TMP_FontAsset sourceFontAsset

    The font asset to be searched

    Boolean includeFallbacks

    Include the fallback font assets in the search

    FontStyles fontStyle

    The font style

    FontWeight fontWeight

    The font weight

    Boolean isAlternativeTypeface

    Indicates if the OUT font asset is an alternative typeface or fallback font asset

    Returns
    Type Description
    TMP_Character

    GetCharacterFromFontAssets(UInt32, TMP_FontAsset, List<TMP_FontAsset>, Boolean, FontStyles, FontWeight, out Boolean)

    Returns the text element (character) for the given unicode value taking into consideration the requested font style and weight. Function searches the provided list of font assets, the list of font assets assigned as alternative typefaces to them as well as their fallbacks. The font asset out parameter contains a reference to the font asset containing the character. The typeface type indicates whether the returned font asset is the source font asset, an alternative typeface or fallback font asset.

    Declaration
    public static TMP_Character GetCharacterFromFontAssets(uint unicode, TMP_FontAsset sourceFontAsset, List<TMP_FontAsset> fontAssets, bool includeFallbacks, FontStyles fontStyle, FontWeight fontWeight, out bool isAlternativeTypeface)
    Parameters
    Type Name Description
    UInt32 unicode

    The unicode value of the requested character

    TMP_FontAsset sourceFontAsset

    The font asset originating the search query

    List<TMP_FontAsset> fontAssets

    The list of font assets to search

    Boolean includeFallbacks

    Determines if the fallback of each font assets on the list will be searched

    FontStyles fontStyle

    The font style

    FontWeight fontWeight

    The font weight

    Boolean isAlternativeTypeface

    Determines if the OUT font asset is an alternative typeface or fallback font asset

    Returns
    Type Description
    TMP_Character

    GetSpriteCharacterFromSpriteAsset(UInt32, TMP_SpriteAsset, Boolean)

    Declaration
    public static TMP_SpriteCharacter GetSpriteCharacterFromSpriteAsset(uint unicode, TMP_SpriteAsset spriteAsset, bool includeFallbacks)
    Parameters
    Type Name Description
    UInt32 unicode
    TMP_SpriteAsset spriteAsset
    Boolean includeFallbacks
    Returns
    Type Description
    TMP_SpriteCharacter
    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023