Skip to main content

DynamicDrawGetCharWeight

Callable

  • DynamicDrawGetCharWeight(weightMap, fontFamily, char): number

  • Returns the width "weight" of a single character in the given font, relative to the font's widest pre-measured (ASCII) character. Characters that weren't part of the pre-measured ASCII set - most importantly CJK and other non-Latin glyphs, which are typically wider than ASCII characters - are measured on demand and cached, so that arc text spaces them correctly instead of assuming a fixed width.


    Parameters

    • weightMap: { weights: Record<string, number>; width: number }

      The font's measurement map

      • weights: Record<string, number>
      • width: number
    • fontFamily: string

      The font family the text is being drawn in

    • char: string

      The single character to measure

    Returns number

    • The character's width relative to the font's widest pre-measured character