Function measureTextDims

  • Measures the dimensions of a given string of text with a given font.

    Note that the first time calling this function is slower than subsequent calls because a dedicated canvas context must be created.

    Parameters

    • text: string
    • font: string

    Returns TextMetrics

    Returns a the TextMetrics of the measured text.