Google webfonts render choppy in Chrome on Windows

前端 未结 12 1500
遇见更好的自我
遇见更好的自我 2020-12-04 06:29

I use the Google Webfonts service on my website and rely heavily on it. It renders fine on most browsers, but in Chrome on Windows it renders especially bad. Very choppy and

12条回答
  •  旧巷少年郎
    2020-12-04 06:53

    Update August 2014

    Google finally fixes this issue in Chrome 37 natively!!!. But for historical reasons I won't delete this answer.

    Problem

    The issue is created because chrome actually cannot render TrueType fonts with correct anti-aliasing. However, chrome still renders SVG files well. If you move the call for your svg file up in your syntax above the woff, chrome will download the svg and use it instead of the woff file. Some tricks like you propose work well, but only on certain font sizes.

    But this bug is very well known to the Chrome developer team, and has been in fixing since July 2012. See the official bug report thread here: https://code.google.com/p/chromium/issues/detail?id=137692

    Update Oct 2013 (Thanks to @Catch22)

    Apparently some websites may experience intermittent spacing issues when rendering the svg. So there is a better way to skin it. If you call the svg with a media query specific to Chrome, the spacing issues disappear:

    @media screen and (-webkit-min-device-pixel-ratio:0) {
      @font-face {
          font-family: 'MyWebFont';
          src: url('webfont.svg#svgFontName') format('svg');
      }
    }
    

    First approach solution:

    The Fontspring bulletproof syntax modified to serve the svg first:

    @font-face {
        font-family: 'MyWebFont';
        src: url('webfont.eot'); 
        src: url('webfont.eot?#iefix') format('embedded-opentype'),
             url('webfont.svg#svgFontName') format('svg'),
             url('webfont.woff') format('woff'),
             url('webfont.ttf')  format('truetype');
    }
    

    Further reading:

    • CSS properties that affect type rendering
    • Smoother Web Font Rendering in Chrome for Windows
    • How to Bulletproof @font-face Web Fonts

提交回复
热议问题