Is it safe to use font-face instead of cufon and the like?

5

I'm working on a website and need to use fonts that the user may not have on their machine. Do most browsers now support @font-face ? From which versions? It is already possible to give up alternatives like cufón ?

    
asked by anonymous 04.09.2014 / 20:42

1 answer

4

Use font-face by making an import of the font in your code:

/* latin-ext */
@font-face {
  font-family: 'Lato';
  font-style: normal;
  font-weight: 400;
  src: local('Lato Regular'), local('Lato-Regular'), url(http://fonts.gstatic.com/s/lato/v10/ayfRv9GMahGqd-q6YxHjSg.woff2) format('woff2');
  unicode-range: U+0100-024F, U+1E00-1EFF, U+20A0-20AB, U+20AD-20CF, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
  font-family: 'Lato';
  font-style: normal;
  font-weight: 400;
  src: local('Lato Regular'), local('Lato-Regular'), url(http://fonts.gstatic.com/s/lato/v10/1YwB1sO8YE1Lyjf12WNiUA.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215, U+E0FF, U+EFFD, U+F000;
}

And applying the font in your css

font-family: 'Lato', sans-serif;

That any browser will run your source without problems. Including IE (ca)

    
23.09.2014 / 16:31