开发者

Which library for embeding external font into website?

I would like to use external font which is not in google fonts library, so, I need to load it as javascript. Which library is the best.

I am running Joomla and Mootools if it helps.

Thanks in adva开发者_如何学Gonce.


It doesn't have to be in the Google Fonts library for you to be able to use it with CSS fonts. First, declare an @font-face. For example:

@font-face {
    font-family: Symbola;
    font-style: normal;
    font-weight: normal;
    src: local('Symbola'), url('/misc/static/Symbola605.ttf/font/truetype') format('truetype');
}

Then, use the font-family that you specified in that block for any elements you wish to use the font in. This is a far superior alternatives to Flash-based 'text replacement' libraries, that are inaccessible.


http://cufon.shoqolate.com/generate/

Upload your font and use it ! :)


I've used the following:

  • sIFR: http://www.mikeindustries.com/blog/sifr
  • Cufon: http://cufon.shoqolate.com/generate/ (as mentioned by Dawid)
  • Fontsquirrel: http://www.fontsquirrel.com/fontface/generator

If possible go with fontsquirrel. You'll need to own the fonts tough, because they'll be free to download. If that's not an option give Cufon a try. I don't recommend sIFR. It's given me way more hassles than anything else and it's performance killer.

Cheers tj


I strongly suggest you use @font-face, not cufon, sifr or any image-replacement techniques. I used both cufon and sifr, they can't hold a candle to @font-face. They depend on javascript/flash, they add clutter to your markup while font-face depends only on css rule. Font-face technique leaves the text selectable and you can style it any way you want like any other text. It doesn't affect your performance either.

That said, cufon / sifr do have some special effect like gradients/shadows that should work cross-browser.

But to me, they are not worth the hassle.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜