Hosanna UI API v1.30.2-next
    Preparing search index...

    Class FontManagerPrivate

    Manages font caching and retrieval for the application.

    FontManager

    constructor Initializes a new instance of the FontManager class.

    getFontWithKey Retrieves a font based on the provided key. The key can be a font name, a size, or both separated by a comma. If the size is missing, the font name must be one of the system fonts. If the font name is missing, it will use the system default font.

    The key representing the font name and/or size.

    • The font object if found, otherwise undefined.

    private getFont Retrieves a font based on the provided name and size. If the font is not cached, it will be created and cached.

    The name of the font.

    The size of the font.

    • The font object if found or created, otherwise undefined.
    • Throws an error if the font is not registered.

    Implements

    Index

    Constructors

    Properties

    cachedFonts: { [key: string]: ISGNFont } = {}

    A cache of fonts keyed by font name and size.

    fontLabel: ISGNLabel = ...

    A label node used for retrieving system fonts.

    fontLoadCallbacks: ((fontUrl: string, success: boolean) => void)[] = []

    Callbacks for font load events.

    webGetFontStatus?: (fontUrl: string) => FontLoadStatus

    Reference to WebFontService.getFontStatus for web platform. This delegates to the authoritative source of font status.

    _simpleLabelDefaultFontSize: 36

    Default point size when getFontWithKey yields a font without an explicit positive size (matches MeasurementUtils.getSimpleTextSize fallback).

    Methods

    • Parameters

      • rawKey: string
      • resolvedKey: string
      • font: undefined | ISGNFont

      Returns undefined | ISGNFont

    • Retrieves a font based on the provided name and size. If the font is not cached, it will be created and cached.

      Parameters

      • nameOrPath: string

        The name or path of the font.

      • Optionalsize: number

        The size of the font.

      Returns undefined | ISGNFont

      The font object if found or created, otherwise undefined.

    • Gets the load status of a font. On web platform, delegates to WebFontService which is the authoritative source. On other platforms (Roku), returns NotRegistered as fonts are handled differently.

      Parameters

      • fontUrl: string

        The URL of the font.

      Returns FontLoadStatus

      The load status of the font.

    • Retrieves a font based on the provided key. The key can be a font name, a size, or both separated by a comma. If the size is missing, the font name must be one of the system fonts. If the font name is missing, it will use the system default font.

      Parameters

      • key: string

        The key representing the font name and/or size.

      Returns undefined | ISGNFont

      The font object if found, otherwise undefined.

    • Resolves a font key to fontUri and fontSize for ISGNSimpleLabel. Uses the same key rules as getFontWithKey. If the resolved font has no positive size (e.g. system font with implicit size), size defaults to 36.

      Parameters

      • key: string

        Font key (uri,size, system name, etc.).

      Returns undefined | SimpleLabelFontInfo

      [fontUri, fontSize], or undefined if the key does not resolve to a font with a usable URI.

    • Initializes font monitoring for web platform.

      Returns void

    • Subscribes to font load events.

      Parameters

      • callback: (fontUrl: string, success: boolean) => void

        Function called when a font load completes.

      Returns void

    • Removes a font load listener.

      Parameters

      • callback: (fontUrl: string, success: boolean) => void

        The callback function to remove.

      Returns void

    • Parameters

      • key: string

      Returns string