首页 > 解决方案 > 画布上的字体被拉伸并压扁

问题描述

当我在画布上渲染文本时,它似乎被拉伸并挤压在一起。我怎样才能解决这个问题?(图像放大以显示字体差异。两者均为 900% 缩放)

我想要的是:

我得到了什么:

我的代码:

            this.ctx.textAlign = "left";
            this.ctx.textBaseline = "middle";
            this.ctx.font = "10px Verdana";
            this.ctx.strokeStyle = 'black';
            this.ctx.lineWidth = 1;
            this.ctx.fillStyle = "rgba(204, 204, 204, 1)";
            this.ctx.fillText(text, startX, startY);

标签: javascriptcanvas

解决方案


推荐阅读