渲染字体不同于IE相比,FF和Chrome [英] Rendering font differs from IE compared to FF and Chrome

查看:232
本文介绍了渲染字体不同于IE相比,FF和Chrome的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我注意到,如果大小是,例如,字体的渲染有很大不同。 11px。运行Windows 7

I have noticed that rendering of fonts differ considerably if the size is, for example. 11px. Running Windows 7

使用以下HTML和CSS

The following HTML and CSS is used

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title>Testing font</title>
        <style>
            body {
                font-family: "Helvetica","Arial",sans-serif;
                color: #1A1A1A;
                padding: 10px;
            }

            .foo{
                font-size: 14px;
            }
            .bar{
                font-size: 11px;
            }
        </style>
    </head>
    <body>
        <div class="foo">
                <p>HOME</p>
        </div>
        <div class="bar">
                <p>HOME</p>
        </div>
    </body>
</html>

如附图所示,FF和Chrome会以11px缩小宽度,而不是14px。

As the attached images shows, FF and Chrome tends to tighten the width in 11px but not in 14px.

为什么呢?有解决方法?

Why is that, is there a workaround?

推荐答案

Windows 7下的Firefox 7+ 使用GDI经典模式(使用提示)渲染所谓的Core Web字体,如Arial(因为它们更尖锐和可读性启用了提示)和DirectWrite为其他字体。使用GDI模式的特定字体列示如下:config pref:

Firefox 7+ under Windows 7 uses GDI Classic mode (with hinting) to render so called Core Web fonts like Arial (since they are more sharp and readable with hinting enabled), and DirectWrite (without hinting) for other fonts. Specific fonts to use GDI mode with are listed in following about:config pref:

gfx.font_rendering.cleartype_params.force_gdi_classic_for_families

AFAIK,Firefox中的呈现模式还取决于字体大小。对于足够大的字体大小和太小的字体(也许大于15px,也许小于9px),它也使用DirectWrite的Core Web字体。

AFAIK, rendering mode in Firefox depends also on font size. For enough-big font-sizes and too small ones (perhaps greater than 15px and maybe less than 9px), it uses DirectWrite for Core Web fonts too.

7总是使用DirectWrite。

IE9 under Windows 7 uses DirectWrite always.

Chrome似乎总是使用GDI经典模式。

Chrome seems to use GDI classic mode always.

这篇关于渲染字体不同于IE相比,FF和Chrome的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆