有没有办法覆盖 webkit 浏览器中的最小字体大小?
我在画布实例上渲染微小的文本,它在 Firefox 4 上按预期工作,但在 Chrome 和 Safari 上,字体使用这些浏览器中设置的最小字体大小进行渲染,该字体大小已经是最小值,无法通过UI(看起来像 6px 字体大小),但对于我想要完成的任务来说它仍然太大了。
我用来打印字体的代码类似于以下内容,以防它可能有用:
ctx.font = '4px Monospace';
ctx.fillText("Any text", 0, 10);
那么,是否有可能覆盖最小字体大小设置?
更新:我知道文本在 4px 下不可读,但这不是问题的重点。事实上,我根本不需要它可读。
更新 2:在 Safari 上此解决方案有效,但在 Chrome 中仍然不起作用。
谢谢。
I am rendering tiny text on a canvas instance and it works as expected on Firefox 4, but on Chrome and Safari the font renders using the minimum font size set in these browsers, which is already at its minimum and can't be lowered through the UI, (which looks like a 6px font size) but it is still too big for what I want to accomplish.
The code I am using to print the font is similar to the following, in case it might be useful:
ctx.font = '4px Monospace';
ctx.fillText("Any text", 0, 10);
So, is it possible at all to override the minimum font size settings?
Update: I know a text is not readable at 4px, but that's not the point of the question. I don't need it to be readable at all, as a matter of fact.
Update 2: On Safari this solution works, but it still doesn't work in Chrome.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以尝试使用更大的字体并缩放上下文:
记住保持缩放指定文本位置时请记住。
这很容易降低文本的图形质量,但在这种尺寸下,无论如何它都将很难阅读。
You could try using a bigger font and scaling the context:
Remember to keep the scaling in mind when specifying the position of your text.
This could easily reduce the graphics quality of the text, but at that size it will be pretty unreadable anyway.