canvas的setfont无效
我的css
[@font-face](/user/font-face) { font-family : "iconfont" ; src : url ( 'https://ozqvwwv2s.bkt.clouddn.com/HYj1gf.eot' ); /* IE9*/ src : url ( 'https://ozqvwwv2s.bkt.clouddn.com/HYj1gf.eot#iefix' ) format ( 'embedded-opentype' ), /* IE6-IE8 */ url ( 'https://ozqvwwv2s.bkt.clouddn.com/HYj1gf.woff' ) format ( 'woff' ), /* chrome, firefox */ url ( 'https://ozqvwwv2s.bkt.clouddn.com/HYj1gf.ttf' ) format ( 'truetype' ), /* chrome, firefox, opera, Safari, Android, iOS 4.2+*/ url ( 'https://ozqvwwv2s.bkt.clouddn.com/HYj1gf.svg' ) format ( 'svg' ); /* iOS 4.1- */ } |
我的html
< canvas canvas-id = "myCanvas" style = "border: 1px solid;" /> |
我的js
const ctx = wx.createCanvasContext( 'myCanvas' ) ctx.font = "normal normal bold medium/normal iconfont" ; ctx.fillText( '我' , 20, 20) ctx.fillText( 'MINA' , 100, 100) ctx.draw() |
可是调试时认识默认字体。
有人遇到过类似问题?或者能解答的吗?
望指点,感激不尽!!