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.
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.