Académique Documents
Professionnel Documents
Culture Documents
Choosing a font
body { font-family: Helvetica, Arial, sans-serif; font-size: 12pt; } h1, h2, h3 { font-weight: bold; } em { font-style: italic; }
Font fallback
body { font-family: Helvetica, Arial, sans-serif; font-size: 12pt; } h1, h2, h3 { font-weight: bold; } em { font-style: italic; }
37signals.com
Firefox 3.5, WinXP vs. Mac OS X 10.5
Limited choices
Arial
Georgia
Small caps
body { font-family: Times, Georgia, serif; } h2 { font-variant: small-caps; }
Font rendering
Win XP
Vista
Win 7
Mac OS X
Other
Synthetic artifacts
body { font-family: Futura; color: rgba(200,255,40,0.5); background-color: black; } <p>Away</p> <p><strong>Away</strong></p>
Font rendering
Different platforms have different font sets Rendering varies across platform, browser Synthetic rendering can cause subtle problems
CSS3 Fonts
Adding more typographic controls to CSS
CSS3 Fonts
More fonts via @font-face Better control of font features
@font-face rule
Proprietary implementations in Netscape & IE Dened in CSS2 but with lots of features CSS3 Fonts is more narrowly dened
Using @font-face
@font-face { font-family: Gentium; src: url(fonts/Gentium.ttf); } body { font-family: Gentium, Georgia, serif; }
Denes a font that is downloaded when needed Name is completely under author control One rule per style combination Activated per-document, not system-wide
Format hints
@font-face { font-family: Gentium; src: url(fonts/Gentium.woff) format(woff), url(fonts/Gentium.ttf) format(truetype); }
Declares format of data Unknown formats are skipped truetype, opentype synonymous(!)
Uses local version of the font if available Downloads the font if it isnt Dened using fullname or Postscript name
@font-face { font-family: Helvetica; src: local(Helvetica), url(HelveticaRegular.woff); } body { font-family: Helvetica, sans-serif; }
An Arial-free world?
Allows combining fonts for a single face Effective range is intersection of range with
character map
ttf/otf
Internet Explorer Firefox Safari Chrome Opera ?
eot
Better way
@font-face { font-family: Gentium; src: url(GenR102.eot); src: local(Gentium), url(GenR102.ttf) format(truetype); }
http://paulirish.com/2009/bulletproof-font-faceimplementation-syntax/
Font loading
How fonts load What about that ash?
WOFF
A new format for fonts on the web
WOFF background
Attempt to resolve lack of single, interoperable
format for web fonts Joint initiative: Tal Leming (Type Supply) Erik van Blokland (LettError) Jonathan Kew (Mozilla) With the support and input of many others in both the font and browser communities
Key features
Lossless compression of OpenType data Differentiates desktop and web fonts Allows additional metadata attached to a font Simple to implement
WOFF structure
font header data table font data table data table data table woff header data table data table data table data table metadata
woff
metadata
xml