canvas fillText文字超长显示错误

发布于 7 年前作者 yanwang8034 次浏览最后编辑 7 年前来自 ask

在设置text-align: right时,fillText文字超长被压缩后,模拟器上还是正常的右对齐,真机上变成了左对齐。测试代码如下:

   var ctx = wx.createCanvasContext('test', this);
 
   ctx.setTextAlign('right');
 
   ctx.setFillStyle('white');
 
   ctx.setFontSize(20);
 
   var skdVersion = wx.getSystemInfoSync().SDKVersion;
 
   ctx.fillText('测试右对齐文字超长, sdk: ' + skdVersion, 300, 40, 120);
 
   ctx.draw();

模拟器:

iphonex:

3 回复
lei01
lei011 楼6 年前

你好,问题已复现,我们会尽快修复

hetao
hetao2 楼6 年前

你好,麻烦提供下测试设备的机型和复现问题的代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html?search-key=%E4%BB%A3%E7%A0%81%E7%89%87%E6%AE%B5)

duping
duping3 楼5 年前

wechatide://minicode/1jTabLmx6KZCPS:代码片段好像没有真机预览,我是在iphone7 plus/iphoneX上测试的