javascript - Firefox 上渲染不佳/抗锯齿的 Canvas 文本

标签 javascript firefox text canvas fonts

文本看起来像素化/锯齿(firefox 和 opera)

由于实际问题似乎没有太多可做的,是否有任何怪癖/技巧可以减少这种影响?

谢谢 /A

context.textBaseline = 'top'
context.fillStyle = color
context.font = "16px gotham_htfregular"
context.fillText("HD", 15, 11)

最佳答案

我不确定这是否有帮助,但它帮助我在 Canvas 内的图像上消除锯齿边缘:

                canvas {
                  image-rendering: optimizeSpeed;
                  image-rendering: -moz-crisp-edges;
                  image-rendering: -webkit-optimize-contrast;
                  image-rendering: optimize-contrast;
                  -ms-interpolation-mode: nearest-neighbor;
}

注意:-ms-interpolation-mode 适用于 IE,但包含在内是为了更好的衡量。

关于javascript - Firefox 上渲染不佳/抗锯齿的 Canvas 文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13602374/

相关文章:

python - 带有python的智能过滤器

c++ - 在文本文件中查找子字符串的最快方法

css - 字体在 Firefox 和 Chrome 中看起来不同

css - 过滤器 : progid:DXImageTransform. Microsoft.Alpha(style=1,opacity=80) 在 firefox 中不工作

javascript - ES6 是否支持像 { a as a1 } = obj 这样的扩展语法,或者是否有关于它的 RFC?

javascript - FizzBu​​zz:num%15 为第一,num%3 为第一

javascript - 无法调用 .click 函数 - Jquery

swift - 在 Swift 中读取文本文件

javascript - toggleClass 在循环 jquery 中选择

javascript - 叠加图像不显示