赛捷软件论坛's Archiver

vicky.yu 发表于 2026-10-10 10:50

微信小程序API 绘图setFontSize(设置字号)

canvasContext.setFontSize
定义
设置字体的字号。

参数
参数        类型        说明
fontSize        Number        字体的字号
例子
const ctx = wx.createCanvasContext('myCanvas')

ctx.setFontSize(20)
ctx.fillText('20', 20, 20)
ctx.setFontSize(30)
ctx.fillText('30', 40, 40)
ctx.setFontSize(40)
ctx.fillText('40', 60, 60)
ctx.setFontSize(50)
ctx.fillText('50', 90, 90)

ctx.draw()


微信小程序 canvas接口和方法绘图接口和方法

页: [1]

Powered by Discuz! Archiver 7.2  © 2001-2009 Comsenz Inc.