How do I add text in a canvas with a custom font

How would I be able to draw a text on a canvas with custom color and font?
It seems that the canvas only supports drawing with black text. Please help.



image

As far as I am aware, it is not possible to set a custom font for canvas drawtext. You can work around this by using a label and an extension (componentToImage) to create an image, which can be placed in an imageSprite on the canvas. Use paint colour to change the colour of the text.

Example

labelTextToCanvas.aia (23.4 KB)

Or set the image as a background for an arrangement. Use a label for the text and then use ComponentToImage to save the total. No need for a canvas at all if this was the only thing you were doing with it.

1 Like

The following allows a developer to change the font size and color of Text on a 300 x300 pixel Canvas.

setFontSizeAndColor

Thanks! This worked!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.