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

    Utility class for measuring text size using cached labels and font management.

    Index

    Constructors

    Properties

    appConfig: IAppConfig

    Style registry for resolving font styles.

    fontManager: IFontManager

    Font manager for retrieving fonts.

    holder: ISGNGroup

    Holder group for off-screen label measurement.

    labelCache: Record<string, ISGNLabel>

    Cache of label instances, keyed by font or style key.

    simpleLabelCache: Record<string, ISGNSimpleLabel>

    Cache of SimpleLabel instances for measurement (keyed by font uri + size + origins).

    Methods

    • Retrieves a font object using the specified key.

      Parameters

      • key: string

        The font key to look up.

      Returns undefined | ISGNFont

      The font object if found, otherwise undefined.

    • Measures the size of the given text using the specified parameters. Uses cached labels and resolves fonts/styles as needed.

      Parameters

      Returns TextSize

      The measured width and height of the text.