Optional
options: Readonly<TextMediaOptions>Private
_bitmapPrivate
_presentationReadonly
fillReadonly
fontReadonly
heightProtected
Readonly
listenersReadonly
resolutionReadonly
textReadonly
widthListen to events from this helper. Duplicate listeners allowed.
Protected
dispatchDispatch an event to all listeners.
Protected
dispatchDispatch an event to a specific listener. Listener does not have to be added
Stop listening to events from this helper. If a duplicate listener is removed, only one is removed.
True if a listener was removed, false otherwise.
Renders text as an ImageBitmap, which can then be used in widgets that consume a BackingMediaSource, like Icon. Useful for using font icons instead of images.
Height is retreived by measuring the fontBoundingBoxAscent and fontBoundingBoxDescent (falling back to actualBoundingBoxAscent and actualBoundingBoxDescent), as well as the hangingBaseline (falling back to the actualBoundingBoxAscent of the
M
character). Width is measured from the text being rendered, however, it's set to be the same as the height if it's smaller than the height to avoid issues with thin font icons (such as vertical ellipsis). The font is assumed to already be loaded by the time this class is instantiated.Throws if a scratch canvas can't be created.