WOFF: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
m (→Example) |
||
Line 27: | Line 27: | ||
* Create an html page that includes the WOFF font and use it. | * Create an html page that includes the WOFF font and use it. | ||
Life example: http://tecfa.unige.ch/guides/WOFF/woff-blisssym-example.html (works under Windows, but | Life example: http://tecfa.unige.ch/guides/WOFF/woff-blisssym-example.html (works under Windows, but takes a while to display under Firefox/Unbuntu as of oct 2015) | ||
<source lang="HTML5"> | <source lang="HTML5"> |
Revision as of 20:11, 14 October 2015
Introduction
“The Web Open Font Format (WOFF) is a font format for use in web pages. It was developed during 2009 and is now a World Wide Web Consortium (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.”
Mime type
application/font-woff
Make sure that your server knows it.
Using WOFF files
In order to use WOFFs, use the CSS @font-face
directive. I will alllow:
- Defining a font name that you later can use
- Associate one or more font files with that name. If you plan to support fairly modern plus really modern browsers, you should provide both a woff and woff2 file.
Example
Let's create a web page that includes a [font]
- Donwnload BLISSYM.TTF from http://blissym.com/
- Convert with TTF to WOFF converter to WOFF 1
- On the same website there is also a WOFF2 converter you could try.
- Create an html page that includes the WOFF font and use it.
Life example: http://tecfa.unige.ch/guides/WOFF/woff-blisssym-example.html (works under Windows, but takes a while to display under Firefox/Unbuntu as of oct 2015)
<html>
<head>
<title>Simple WOFF example</title>
<meta charset="UTF-8"/>
<style type="text/css">
@font-face {
font-family: 'MyBliss';
src: url('BLISSYM.woff') format('woff');
url('BLISSYM.woff2') format('woff2');
}
.blissy {font-family:MyBliss;color:blue;}
</style>
</head>
<body>
<p>
Text in one paragraph includes a <a href="http://edutechwiki.unige.ch/en/WOFF">WOFF</a> font. The Web Open Font Format (WOFF) is a font format for use in web pages is a World Wide Web Consortium (W3C) Recommendation.
</p>
<p>
Look at the source, Lucille. Below some <a href="http://edutechwiki.unige.ch/en/Pictographic_language">Bliss symbols</a>:
</p>
<hr>
<span class="blissy">
</span>
<hr>
</body>
</html>
Links
- Web Open Font Format (Wikipedia)
- WOFF File Format 1.0, W3C Recommendation 13 December 2012
- Using @font-face (css-tricks.com)