问题描述
我注意到,由于字体渲染的变化,使用硬件加速的浏览器的字体大小不一样 - 使字符显得更小。在具有水平导航的网站上,这实际上已成为一个问题。
I've noticed that font sizes are not the same across browsers which use hardware acceleration due to the font rendering changes - making characters appear smaller. On sites with horizontal navigation, this is actually becoming an issue.
是否可以使用JavaScript或JS库检测硬件加速,因为它们已启用(或禁用)浏览器?
Is it possible to use JavaScript or a JS library to detect hardware acceleration as being enabled (or disabled) in the browser?
Modernizr似乎没有提供这种选择。
Modernizr doesn't seem to offer this choice.
推荐答案
字体呈现因浏览器,操作系统和用户设置而异。因此,您的网站应该优雅地处理这些差异,而不是依赖像素精确的字体渲染。硬件加速只是这种差异的另一个来源。
The font rendering differs depending on browser, OS and user settings. So your website should deal with such differences gracefully instead of relying on pixel exact font rendering. Hardware acceleration is just one more source of such differences.
因为你实际上并不想知道它是否是硬件加速,而是字体渲染的差异如何测量一些渲染文本的大小,并根据它调整您的页面?
Since you're not actually interested in finding out if it is hardware accelerated, but in differences in font rendering how about measuring the size some rendered text has, and adapt your page based on that?
这篇关于是否可以通过JavaScript在浏览器中检测硬件加速?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!