Skip to content

Commit

Permalink
Merge pull request #1622 from INEEDSSD/LayaAir_3.1
Browse files Browse the repository at this point in the history
fix: restore context font processing before saving, compatible with A…
  • Loading branch information
lirongf authored Sep 27, 2024
2 parents 44946e1 + 101a661 commit 1cb1d9e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/layaAir/laya/webgl/text/CharRender_Canvas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,11 +194,15 @@ export class CharRender_Canvas extends ICharRender {
//if (canvas.width != (w + 1) || canvas.height != (h + 1)) {
CharRender_Canvas.canvas.width = Math.min(w + 1, this.maxTexW);
CharRender_Canvas.canvas.height = Math.min(h + 1, this.maxTexH);
ctx.font = font;
//}
ctx.clearRect(0, 0, w + 1 + lineWidth, h + 1 + lineWidth);
ctx.setTransform(1, 0, 0, 1, 0, 0); // 强制清理缩放
ctx.save();
ctx.font = font;
if (Browser.onAlipayMiniGame) {
// 临时处理,兼容支付宝平台上自定义字体设置无效的问题
ctx.font = font;
}
if (this.scaleFontSize) {
//这里的缩放会导致与上面的缩放同时起作用。所以上面保护
ctx.scale(this.lastScaleX, this.lastScaleY);
Expand Down

0 comments on commit 1cb1d9e

Please sign in to comment.