I participate in a Rails project and I use two fonts that are in the folder /assets/fonts.
/assets/fonts
@font-face { font-family: FuturaStd-Light; src: url("/assets/fonts/FuturaStd-Light.otf"); } @font-face { font-family: HelveticaNeue; src: url("/assets/fonts//HelveticaNeue.dfont"); }
Fonts are very large files (especially the second one), and it downloads them forever. And on each page, the text appears after everything else.
Is there a better way to download fonts? Is there any way to cache them? Any ideas?
@ font-face is a great technique, but large font files will certainly slow down your site. There are many methods you can use to combat this:
, , IE , SCRIPT. , javascript, .
SCRIPT
:
, @font-face , google, typekit - . , , Google. , , - - . Html.erb:
<link href='http://fonts.googleapis.com/css?family=PT+Sans:400,700,400italic' rel='stylesheet' type='text/css'>
css:
h1 { font-family: "PT Sans", Arial, Helvetica, sans-serif; }