Web font in Chrome

10,631

Solution 1

There really is not anything you can do to improve this via CSS. The text rendering engines are different between Firefox and Chrome and you are seeing the results. If the font is not properly hinted and prepared for a web font you can expect results like this to be enhanced.

Where was the font acquired from?

You can try running it through FontSquirrel to see if any of the automatic hinting that Ethan offers might normalize this a bit.

Some additional information on rendering and DiretWrite which is what you are seeing as the big differentiators....http://blogs.adobe.com/typblography/2010/11/microsoft-directwrite-is-coming.html

Solution 2

Not sure if this is what you're seeing, but Chrome has an issue with anti-aliasing and truetype fonts. As per http://www.fontspring.com/blog/smoother-web-font-rendering-chrome, you can instead specify the SVG font before the TrueType in your font-face, e.g.:

@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');
}

The biggest downside is that Safari will download both the svg and the woff.

Solution 3

Try this:

 -webkit-text-stroke: .5px

The .5 is kind of arbitrary - some pixel value between 0 and 1 is the key. This forces sub-pixel hinting of the font.

A demo can be seen here: http://dabblet.com/gist/4154587

Solution 4

This is how I do all of mine and it's worked on IE, Firefox, Chrome

@font-face {
   font-family: 'NeutraTextBold';
   src: url('../fonts/neutra_text_bold-webfont.eot');
   src: url('../fonts/neutra_text_bold-webfont.eot?#iefix') format('embedded-opentype'),
     url('../fonts/neutra_text_bold-webfont.woff') format('woff'),
     url('../fonts/neutra_text_bold-webfont.ttf') format('truetype'),
     url('../fonts/neutra_text_bold-webfont.svg#NeutraTextBold') format('svg');
  font-weight: normal;
  font-style: normal;

}
body{
font: 12px 'NeutraTextBold', sans-serif;
color: #FFF;
}

I get my code from fontsquirrel

Share:
10,631
cambraca
Author by

cambraca

I just like programming. And music.

Updated on August 02, 2022

Comments

  • cambraca
    cambraca almost 2 years

    I have a webfont that looks amazing on Firefox, not so much on Chrome. I've tried playing with the text-rendering property, with less-than-spectacular results. My CSS is something like this:

    @font-face {
        font-family: 'TextFont';
        src: url('[my font file url]') format('truetype');
        font-weight: normal;
        font-style: normal;
    }
    body {
        font-family: TextFont, Tahoma, Geneva, sans-serif;
        text-rendering: auto;
    }
    

    Changing text-rendering doesn't seem to do anything in Firefox, so I'm posting a single screenshot for it.

    Results:

    • Firefox (a.k.a. "what it should look like")

      enter image description here

    • Chrome - text-rendering: auto

      enter image description here

    • Chrome - text-rendering: optimizeLegibility

      enter image description here

    • Chrome - text-rendering: optimizeSpeed

      enter image description here

    • Chrome - text-rendering: geometricPrecision

      enter image description here

    All of the Chrome screenshots look really bad compared to the Firefox one. Is there something I'm missing in the CSS?

    I'm using Windows 7, Firefox 8.0, and Chrome 15.0.

  • Andres
    Andres about 11 years
    not sure why I got a downvote for this, just trying to help with what seems to me a valid answer. If somebody cares to share with me as to why it's downvoted so I know for future reference.
  • djsadinoff
    djsadinoff about 10 years
    Hopefully someday chrome will fix this. Track the bug here: code.google.com/p/chromium/issues/detail?id=137692
  • ninjaSurfer
    ninjaSurfer almost 10 years
    careful with copy/pasting the above - the quote characters are "single quotes" not apostrophes. (CSS doesn't understand them)
  • Nils
    Nils almost 10 years
    Yikes! I fixed the apostrophes. Thanks for the note.