Class FontClient

    Definition

    Namespace:
    Tizen.NUI
    Assembly:
    Tizen.NUI.dll

    FontClient provides access to font information and resources.

    public class FontClient : BaseHandle, IDynamicResourceHandler, INameScope, System.IDisposable
    Inheritance
    object
    BindableObject
    Element
    BaseHandle
    FontClient
    Implements
    IDynamicResourceHandler
    INameScope
    System.IDisposable

    Properties

    View Source

    Instance

    Gets the singleton pattern of the FontClient object.

    Declaration
    public static FontClient Instance { get; }
    Property Value
    Type Description
    FontClient

    Methods

    View Source

    AddCustomFontDirectory(string)

    Adds custom fonts directory.

    Declaration
    public bool AddCustomFontDirectory(string path)
    Parameters
    Type Name Description
    string path

    Path to the fonts directory.

    Returns
    Type Description
    bool

    True if the fonts can be added.

    View Source

    Dispose(bool)

    Declaration
    protected override void Dispose(bool disposing)
    Parameters
    Type Name Description
    bool disposing
    Overrides
    BaseHandle.Dispose(bool)
    View Source

    EnableDesignCompatibility()

    Enable font specific design compatibility mode globally. When enabled, FontMetrics will adjust ascender/descender values at construction to ensure design compatibility rules.

    note

    This is a one-way switch. Once enabled, it cannot be disabled again during the lifetime of the process. This function must be called before any text is rendered.

    Declaration
    public static void EnableDesignCompatibility()
    View Source

    FindDefaultFont(uint, uint, bool)

    Finds the default font for displaying a UTF-32 character.

    Declaration
    public uint FindDefaultFont(uint charcode, uint requestedPointSize, bool preferColor)
    Parameters
    Type Name Description
    uint charcode

    The character for which a font is needed.

    uint requestedPointSize

    The point size in 26.6 fractional points. The default point size is 12*64.

    bool preferColor

    True if a color font is preferred.

    Returns
    Type Description
    uint

    A valid font identifier. Zero if the font does not exist.

    View Source

    FindDefaultFont(uint, uint)

    Find the default font for displaying a UTF-32 character.

    Declaration
    public uint FindDefaultFont(uint charcode, uint requestedPointSize)
    Parameters
    Type Name Description
    uint charcode

    The character for which a font is needed.

    uint requestedPointSize

    The point size in 26.6 fractional points. The default point size is 12*64.

    Returns
    Type Description
    uint

    A valid font identifier. Zero if the font does not exist.

    View Source

    FindDefaultFont(uint)

    Find the default font for displaying a UTF-32 character.

    Declaration
    public uint FindDefaultFont(uint charcode)
    Parameters
    Type Name Description
    uint charcode

    The character for which a font is needed.

    Returns
    Type Description
    uint

    A valid font identifier. Zero if the font does not exist.

    View Source

    FontPreLoad(List<string>, List<string>, bool, bool)

    This is used to pre-load FreeType font face in order to improve the runtime performance of the application.

    note

    The fonts in the fontPathList perform FT_New_Face during pre-loading, which can provide some performace benefits.
    The fonts in the memoryFontPathList read the font file and cache the buffer in memory during pre-load.
    This enables the use of FT_New_Memory_Face during runtime and provides a performance boost.
    It requires memory equivalent to the size of each font file.

    Declaration
    public static void FontPreLoad(List<string> fontPathList, List<string> memoryFontPathList, bool useThread, bool syncCreation = true)
    Parameters
    Type Name Description
    List<><string> fontPathList

    A list of font paths to be pre-loaded.

    List<><string> memoryFontPathList

    A list of memory font paths to be pre-loaded.

    bool useThread

    True if the font client should create thread and perform font pre-loading, false otherwise.

    bool syncCreation

    True if thread creation guarantees syncronization with the main thread, false async creation. Optional, the default value is true.

    View Source

    GetFontId(string, uint, uint)

    Retrieve the unique identifier for a font.

    Declaration
    public uint GetFontId(string path, uint requestedPointSize, uint faceIndex)
    Parameters
    Type Name Description
    string path

    The path to a font file.

    uint requestedPointSize

    The point size in 26.6 fractional points. The default point size is 12*64.

    uint faceIndex

    The index of the font face.

    Returns
    Type Description
    uint

    A valid font identifier. Zero if the font does not exist.

    View Source

    GetFontId(string, uint)

    Retrieve the unique identifier for a font.

    Declaration
    public uint GetFontId(string path, uint requestedPointSize)
    Parameters
    Type Name Description
    string path

    The path to a font file.

    uint requestedPointSize

    The point size in 26.6 fractional points. The default point size is 12*64.

    Returns
    Type Description
    uint

    A valid font identifier. Zero if the font does not exist.

    View Source

    GetFontId(string)

    Retrieve the unique identifier for a font.

    Declaration
    public uint GetFontId(string path)
    Parameters
    Type Name Description
    string path

    The path to a font file.

    Returns
    Type Description
    uint

    A valid font identifier. Zero if the font does not exist.

    View Source

    GetPointSize(uint)

    Retrieves the font point size of a given font id.

    Declaration
    public uint GetPointSize(uint id)
    Parameters
    Type Name Description
    uint id

    The font identifier.

    Returns
    Type Description
    uint

    The point size in 26.6 fractional points.

    View Source

    GetSystemFonts()

    Retrieve the list of font info supported by the system.

    Declaration
    public List<FontInfo> GetSystemFonts()
    Returns
    Type Description
    List<><FontInfo>

    The list of FontInfo

    Remarks

    FontInfo

    Examples

    The following example demonstrates how to use the GetSystemFonts method.

    var fontList = FontClient.Instance.GetSystemFonts();
    foreach(Tizen.NUI.Text.FontInfo fontInfo in fontList)
    {
       string fontFamily = fontInfo.Family;
       string fontPath = fontInfo.Path;
       FontWidthType fontWidth = fontInfo.Style.Width;
       FontWeightType fontWeight = fontInfo.Style.Weight;
       FontSlantType fontSlant = fontInfo.Style.Slant;
    }
    View Source

    IsCharacterSupportedByFont(uint, uint)

    Whether the given character is supported by the font.

    Declaration
    public bool IsCharacterSupportedByFont(uint fontId, uint character)
    Parameters
    Type Name Description
    uint fontId

    The id of the font.

    uint character

    The character in a font.

    Returns
    Type Description
    bool

    True if the character is supported by the font.

    View Source

    IsScalable(string)

    Check to see if a font is scalable.

    Declaration
    public bool IsScalable(string path)
    Parameters
    Type Name Description
    string path

    The path where the font file is located.

    Returns
    Type Description
    bool

    True if scalable.

    View Source

    PreCache(List<string>, List<string>, string, bool, bool)

    This is used to pre-cache FontConfig in order to improve the runtime performance of the application.

    Declaration
    public static void PreCache(List<string> fallbackFamilyList, List<string> extraFamilyList, string localeFamily, bool useThread, bool syncCreation = true)
    Parameters
    Type Name Description
    List<><string> fallbackFamilyList

    A list of fallback font families to be pre-cached.

    List<><string> extraFamilyList

    A list of additional font families to be pre-cached.

    string localeFamily

    A locale font family to be pre-cached.

    bool useThread

    True if the font client should create thread and perform pre-caching, false otherwise.

    bool syncCreation

    True if thread creation guarantees syncronization with the main thread, false async creation. Optional, the default value is true.

    View Source

    ResetSystemDefaults()

    Called when the user changes the system defaults.

    Declaration
    public void ResetSystemDefaults()

    Implements

    IDynamicResourceHandler
    INameScope
    System.IDisposable

    Extension Methods

    BindableObjectExtensions.SetBinding(BindableObject, BindableProperty, string, BindingMode, IValueConverter, string)
    NameScopeExtensions.FindByName<T>(Element, string)
    EXamlExtensions.LoadFromEXamlByRelativePath<T>(T, string)
    Extensions.LoadFromXaml<TXaml>(TXaml, string)
    Extensions.LoadFromXaml<TXaml>(TXaml, Type)
    Extensions.LoadFromXamlFile<TXaml>(TXaml, string)
    • View Source
    Back to top Copyright © 2016-2025 Samsung
    Generated by DocFX