Which Fontfile to use in a website?

落花浮王杯 提交于 2019-12-12 16:12:20

问题


Guys i am working on a custom project where i need font awesome But when checking fontawesome font files i can see they provide a lot of options

  1. JS
  2. SVG With JS
  3. WebFonts

As for as i know i should use WebFonts but in that i can see there are lot of font file.

  1. eot
  2. svg
  3. ttf
  4. woff
  5. woff2

is all the font formats are required ? Can we use only SVG ?

Actually i need my project in total of 2MB if i add all the font files it taking too much space.


回答1:


As of this posting your selected typeface, FontAwesome , contains 3,332 different glyphs. You are more than correct to assume that loading this file five times over will take up some serious system resources.

However…

Often when using a webfont for icons, we only use a portion of the many icons defined in the font. If you are only using three or four glyphs from FontAwesome, then loading those five times should be a light-as-a-feather job for your system.

How to do this? Use a font-subsetting service. Free and easy-to-follow instructions on their sites. There are several, but personally I've had success with fontello: http://fontello.com

I have subsetted (verb?) about 20-25 icons from FontAwesome (more than I needed) to provide simple icons on my site, and the file sizes are under 60KB, collectively.

And of course, the reason we load these five times over? To maximize cross-browser compatibility. Plain and simple. This does it.



来源:https://stackoverflow.com/questions/51392122/which-fontfile-to-use-in-a-website

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!