Hierarchy

  • TextRenderer<CanvasTextRendererState>
    • CanvasTextRenderer

Constructors

Properties

canvas: OffscreenCanvas | HTMLCanvasElement
context: CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D
set: Readonly<TrPropSetters<CanvasTextRendererState>>
stage: Stage
type: "canvas" | "sdf" = 'canvas'

Methods

  • Given text renderer properties (particularly the specific properties related to font selection) returns whether or not the renderer can render it.

    Parameters

    • props: TrFontProps

    Returns boolean

  • Destroy/Clean up the state object

    Parameters

    • state: CanvasTextRendererState

    Returns void

    Opposite of createState(). Frees any event listeners / resources held by the state that may not reliably get garbage collected.

  • Called by constructor to get a map of property setter functions for this renderer.

    Returns Partial<TrPropSetters<CanvasTextRendererState>>

  • Schedule a state update via queueMicrotask

    Parameters

    • state: CanvasTextRendererState

    Returns void

    This method is used to schedule a state update via queueMicrotask. This method should be called whenever a state update is needed, and it will ensure that the state is only updated once per microtask.

  • Allows the CoreTextNode to communicate changes to the isRenderable state of the itself.

    Parameters

    • state: CanvasTextRendererState
    • renderable: boolean

    Returns void

  • Parameters

    • state: CanvasTextRendererState
    • status:
          | "loaded"
          | "failed"
          | "loading"
          | "initialState"
          | "destroyed"
    • Optionalerror: Error

    Returns void