Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Any genuine difference between file formats for fonts

I have a custom font in the following formats (with filesize):

font.eot (66kb)

font.svg (204kb)

font.afm (79kb)

font.otf (107kb)

font.woff (42kb)

font.pfb (130kb)

font.ttf (66kb)

So the exact same font has completely different file size depending on the format. .woff is smallest in size.

According to the @font-face page on w3school, EOT works on IE6+ while other formats work on IE9+ — besides that, I can't find any information on differences between these formats.

My question is, does it make any difference in terms of quality or compatibility choosing which format?

like image 657
Henrik Petterson Avatar asked Mar 23 '15 21:03

Henrik Petterson


1 Answers

Absolutely yes. Here is a great article about the exact question you are asking.

http://www.smashingmagazine.com/2011/03/02/the-font-face-rule-revisited-and-useful-tricks/

There is another font type that you did not list and is the most recommended format in terms of file size (smallest) and browser compatibility: WOFF (Web Open Font Format).

If you are targeting IE 8 and below you will need to use something in conjunction with WOFF. Here is an example targeting legacy browsers:

@font-face {
    font-family: Graublauweb;
    src: url('Graublauweb.eot'); /* IE9 Compatibility Modes */
    src: url('Graublauweb.eot?') format('eot'),  /* IE6-IE8 */
    url('Graublauweb.woff') format('woff'), /* Modern Browsers */
    url('Graublauweb.ttf')  format('truetype'), /* Safari, Android, iOS */
    url('Graublauweb.svg#svgGraublauweb') format('svg'); /* Legacy iOS */
}

And while not completely "there yet" in terms of browser adoption rates, the future will be WOFF 2.0 as the compression rates will be near 30% - 50% compared to WOFF.

Here is another resource that describes the different font formats: http://www.w3schools.com/css/css3_fonts.asp

TrueType Fonts (TTF)

TrueType is a font standard developed in the late 1980s, by Apple and Microsoft. TrueType is the most common font format for both the Mac OS and Microsoft Windows operating systems.

OpenType Fonts (OTF)

OpenType is a format for scalable computer fonts. It was built on TrueType, and is a registered trademark of Microsoft. OpenType fonts are used commonly today on the major computer platforms.

The Web Open Font Format (WOFF)

WOFF is a font format for use in web pages. It was developed in 2009, and is now a W3C Recommendation. WOFF is essentially OpenType or TrueType with compression and additional metadata. The goal is to support font distribution from a server to a client over a network with bandwidth constraints.

The Web Open Font Format (WOFF 2.0)

TrueType/OpenType font that provides better compression than WOFF 1.0.

SVG Fonts/Shapes

SVG fonts allow SVG to be used as glyphs when displaying text. The SVG 1.1 specification define a font module that allows the creation of fonts within an SVG document. You can also apply CSS to SVG documents, and the @font-face rule can be applied to text in SVG documents.

Embedded OpenType Fonts (EOT)

EOT fonts are a compact form of OpenType fonts designed by Microsoft for use as embedded fonts on web pages.

like image 124
xengravity Avatar answered Oct 02 '22 17:10

xengravity