Skip to main content

DrawingGetTextSize

Callable

  • DrawingGetTextSize(Text: string, Width: number): [text: string, size: number]

  • Gets the text size needed to fit inside a given width according to the current font. This function is memoized because

    <code>
    MainCanvas.measureText(Text)
    </code>
    is a major resource hog.


    Parameters

    • Text: string

      Text to draw

    • Width: number

      Width in which the text has to fit

    Returns [text: string, size: number]

    • Text to draw and its font size

Index

Methods

Methods

clearCache

  • clearCache(): void
  • Clears the cache of the memoized function


    Returns void

Page Options