docs.unity3d.com
    Show / Hide Table of Contents

    Class TMP_FontAsset

    Inheritance
    System.Object
    Object
    ScriptableObject
    TMP_Asset
    TMP_FontAsset
    Inherited Members
    TMP_Asset.hashCode
    TMP_Asset.material
    TMP_Asset.materialHashCode
    UnityEngine.ScriptableObject.SetDirty()
    ScriptableObject.CreateInstance(String)
    ScriptableObject.CreateInstance(Type)
    UnityEngine.ScriptableObject.CreateInstance<T>()
    Object.GetInstanceID()
    UnityEngine.Object.GetHashCode()
    UnityEngine.Object.Equals(System.Object)
    UnityEngine.Object.InstantiateAsync<T>(T)
    UnityEngine.Object.InstantiateAsync<T>(T, UnityEngine.Transform)
    UnityEngine.Object.InstantiateAsync<T>(T, UnityEngine.Vector3, UnityEngine.Quaternion)
    UnityEngine.Object.InstantiateAsync<T>(T, UnityEngine.Transform, UnityEngine.Vector3, UnityEngine.Quaternion)
    UnityEngine.Object.InstantiateAsync<T>(T, System.Int32)
    UnityEngine.Object.InstantiateAsync<T>(T, System.Int32, UnityEngine.Transform)
    UnityEngine.Object.InstantiateAsync<T>(T, System.Int32, UnityEngine.Vector3, UnityEngine.Quaternion)
    UnityEngine.Object.InstantiateAsync<T>(T, System.Int32, System.ReadOnlySpan<UnityEngine.Vector3>, System.ReadOnlySpan<UnityEngine.Quaternion>)
    UnityEngine.Object.InstantiateAsync<T>(T, System.Int32, UnityEngine.Transform, UnityEngine.Vector3, UnityEngine.Quaternion)
    UnityEngine.Object.InstantiateAsync<T>(T, System.Int32, UnityEngine.Transform, UnityEngine.Vector3, UnityEngine.Quaternion, System.Threading.CancellationToken)
    UnityEngine.Object.InstantiateAsync<T>(T, System.Int32, UnityEngine.Transform, System.ReadOnlySpan<UnityEngine.Vector3>, System.ReadOnlySpan<UnityEngine.Quaternion>)
    UnityEngine.Object.InstantiateAsync<T>(T, System.Int32, UnityEngine.Transform, System.ReadOnlySpan<UnityEngine.Vector3>, System.ReadOnlySpan<UnityEngine.Quaternion>, System.Threading.CancellationToken)
    Object.Instantiate(Object, Vector3, Quaternion)
    Object.Instantiate(Object, Vector3, Quaternion, Transform)
    Object.Instantiate(Object)
    Object.Instantiate(Object, Scene)
    Object.Instantiate(Object, Transform)
    Object.Instantiate(Object, Transform, Boolean)
    UnityEngine.Object.Instantiate<T>(T)
    UnityEngine.Object.Instantiate<T>(T, UnityEngine.Vector3, UnityEngine.Quaternion)
    UnityEngine.Object.Instantiate<T>(T, UnityEngine.Vector3, UnityEngine.Quaternion, UnityEngine.Transform)
    UnityEngine.Object.Instantiate<T>(T, UnityEngine.Transform)
    UnityEngine.Object.Instantiate<T>(T, UnityEngine.Transform, System.Boolean)
    Object.Destroy(Object, Single)
    Object.Destroy(Object)
    Object.DestroyImmediate(Object, Boolean)
    Object.DestroyImmediate(Object)
    Object.FindObjectsOfType(Type)
    Object.FindObjectsOfType(Type, Boolean)
    Object.FindObjectsByType(Type, FindObjectsSortMode)
    Object.FindObjectsByType(Type, FindObjectsInactive, FindObjectsSortMode)
    Object.DontDestroyOnLoad(Object)
    UnityEngine.Object.DestroyObject(UnityEngine.Object, System.Single)
    UnityEngine.Object.DestroyObject(UnityEngine.Object)
    UnityEngine.Object.FindSceneObjectsOfType(System.Type)
    Object.FindObjectsOfTypeIncludingAssets(Type)
    UnityEngine.Object.FindObjectsOfType<T>()
    UnityEngine.Object.FindObjectsByType<T>(UnityEngine.FindObjectsSortMode)
    UnityEngine.Object.FindObjectsOfType<T>(System.Boolean)
    UnityEngine.Object.FindObjectsByType<T>(UnityEngine.FindObjectsInactive, UnityEngine.FindObjectsSortMode)
    UnityEngine.Object.FindObjectOfType<T>()
    UnityEngine.Object.FindObjectOfType<T>(System.Boolean)
    UnityEngine.Object.FindFirstObjectByType<T>()
    UnityEngine.Object.FindAnyObjectByType<T>()
    UnityEngine.Object.FindFirstObjectByType<T>(UnityEngine.FindObjectsInactive)
    UnityEngine.Object.FindAnyObjectByType<T>(UnityEngine.FindObjectsInactive)
    Object.FindObjectsOfTypeAll(Type)
    Object.FindObjectOfType(Type)
    Object.FindFirstObjectByType(Type)
    Object.FindAnyObjectByType(Type)
    Object.FindObjectOfType(Type, Boolean)
    Object.FindFirstObjectByType(Type, FindObjectsInactive)
    Object.FindAnyObjectByType(Type, FindObjectsInactive)
    Object.ToString()
    Object.name
    Object.hideFlags
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetType()
    System.Object.MemberwiseClone()
    System.Object.ReferenceEquals(System.Object, System.Object)
    Namespace: TMPro
    Syntax
    [Serializable]
    public class TMP_FontAsset : TMP_Asset

    Fields

    atlas

    Declaration
    [SerializeField]
    public Texture2D atlas
    Field Value
    Type Description
    Texture2D

    boldSpacing

    Declaration
    public float boldSpacing
    Field Value
    Type Description
    System.Single

    boldStyle

    Declaration
    public float boldStyle
    Field Value
    Type Description
    System.Single

    fallbackFontAssets

    List which contains the Fallback font assets for this font.

    Declaration
    [SerializeField]
    public List<TMP_FontAsset> fallbackFontAssets
    Field Value
    Type Description
    System.Collections.Generic.List<TMP_FontAsset>

    fontAssetType

    Declaration
    public TMP_FontAsset.FontAssetTypes fontAssetType
    Field Value
    Type Description
    TMP_FontAsset.FontAssetTypes

    fontCreationSettings

    Declaration
    [SerializeField]
    public FontCreationSetting fontCreationSettings
    Field Value
    Type Description
    FontCreationSetting

    fontWeights

    Declaration
    [SerializeField]
    public TMP_FontWeights[] fontWeights
    Field Value
    Type Description
    TMP_FontWeights[]

    italicStyle

    Declaration
    public byte italicStyle
    Field Value
    Type Description
    System.Byte

    normalSpacingOffset

    Declaration
    public float normalSpacingOffset
    Field Value
    Type Description
    System.Single

    normalStyle

    Declaration
    public float normalStyle
    Field Value
    Type Description
    System.Single

    tabSize

    Declaration
    public byte tabSize
    Field Value
    Type Description
    System.Byte

    Properties

    characterDictionary

    Declaration
    public Dictionary<int, TMP_Glyph> characterDictionary { get; }
    Property Value
    Type Description
    System.Collections.Generic.Dictionary<System.Int32, TMP_Glyph>

    defaultFontAsset

    Default Font Asset used as last resort when glyphs are missing.

    Declaration
    public static TMP_FontAsset defaultFontAsset { get; }
    Property Value
    Type Description
    TMP_FontAsset

    fontInfo

    The general information about the font.

    Declaration
    public FaceInfo fontInfo { get; }
    Property Value
    Type Description
    FaceInfo

    kerningDictionary

    Dictionary containing the kerning data

    Declaration
    public Dictionary<int, KerningPair> kerningDictionary { get; }
    Property Value
    Type Description
    System.Collections.Generic.Dictionary<System.Int32, KerningPair>

    kerningInfo

    Declaration
    public KerningTable kerningInfo { get; }
    Property Value
    Type Description
    KerningTable

    Methods

    AddFaceInfo(FaceInfo)

    Declaration
    public void AddFaceInfo(FaceInfo faceInfo)
    Parameters
    Type Name Description
    FaceInfo faceInfo

    AddGlyphInfo(TMP_Glyph[])

    Declaration
    public void AddGlyphInfo(TMP_Glyph[] glyphInfo)
    Parameters
    Type Name Description
    TMP_Glyph[] glyphInfo

    AddKerningInfo(KerningTable)

    Declaration
    public void AddKerningInfo(KerningTable kerningTable)
    Parameters
    Type Name Description
    KerningTable kerningTable

    GetCharacters(TMP_FontAsset)

    Function to extract all the characters from a font asset.

    Declaration
    public static string GetCharacters(TMP_FontAsset fontAsset)
    Parameters
    Type Name Description
    TMP_FontAsset fontAsset
    Returns
    Type Description
    System.String

    GetCharactersArray(TMP_FontAsset)

    Function which returns an array that contains all the characters from a font asset.

    Declaration
    public static int[] GetCharactersArray(TMP_FontAsset fontAsset)
    Parameters
    Type Name Description
    TMP_FontAsset fontAsset
    Returns
    Type Description
    System.Int32[]

    HasCharacter(Char)

    Function to check if a certain character exists in the font asset.

    Declaration
    public bool HasCharacter(char character)
    Parameters
    Type Name Description
    System.Char character
    Returns
    Type Description
    System.Boolean

    HasCharacter(Char, Boolean)

    Function to check if a character is contained in a font asset with the option to also check through fallback font assets.

    Declaration
    public bool HasCharacter(char character, bool searchFallbacks)
    Parameters
    Type Name Description
    System.Char character
    System.Boolean searchFallbacks
    Returns
    Type Description
    System.Boolean

    HasCharacter(Int32)

    Function to check if a certain character exists in the font asset.

    Declaration
    public bool HasCharacter(int character)
    Parameters
    Type Name Description
    System.Int32 character
    Returns
    Type Description
    System.Boolean

    HasCharacters(String)

    Function to check if certain characters exists in the font asset. Function returns false if any characters are missing.

    Declaration
    public bool HasCharacters(string text)
    Parameters
    Type Name Description
    System.String text

    String containing the characters to check

    Returns
    Type Description
    System.Boolean

    HasCharacters(String, out List<Char>)

    Function to check if certain characters exists in the font asset. Function returns a list of missing characters.

    Declaration
    public bool HasCharacters(string text, out List<char> missingCharacters)
    Parameters
    Type Name Description
    System.String text
    System.Collections.Generic.List<System.Char> missingCharacters
    Returns
    Type Description
    System.Boolean

    ReadFontDefinition()

    Declaration
    public void ReadFontDefinition()

    SortGlyphs()

    Function to sort the list of glyphs.

    Declaration
    public void SortGlyphs()
    Back to top
    Copyright © 2025 Unity Technologies
    • 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 02 April 2025