CanvasContext.setFontSize

Set the font size.

Parameters

It is Object type.

PropertyTypeDescription
fontSizeNumberThe font size.

Sample Code

copy
//.js
const ctx = my.createCanvasContext('awesomeCanvas')ï¼›

ctx.setFontSize(14)
ctx.fillText('14', 20, 20)
ctx.setFontSize(22)
ctx.fillText('22', 40, 40)
ctx.setFontSize(30)
ctx.fillText('30', 60, 60)
ctx.setFontSize(38)
ctx.fillText('38', 90, 90)

ctx.draw()