微信小程式開發(fā)文檔
/ 微信小程序API 繪圖setFontSize(設(shè)置字號(hào))
微信小程序API 繪圖setFontSize(設(shè)置字號(hào))
setFontSize
定義
設(shè)置字體的字號(hào)。
參數(shù)
參數(shù) | 類型 | 說明 |
---|---|---|
fontSize | Number | 字體的字號(hào) |
例子
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()