making drupal beautiful with web fonts

46
Aaron Stanush Dallas Drupal Days – July 9, 2011 Making Drupal beautiful with web fonts Designing in the @font-face of danger

Upload: four-kitchens

Post on 27-Jan-2015

121 views

Category:

Technology


3 download

DESCRIPTION

 

TRANSCRIPT

Page 1: Making drupal beautiful with web fonts

Aaron StanushDallas Drupal Days – July 9, 2011

Making Drupal beautiful with web fontsDesigning in the @font-face of danger

Page 2: Making drupal beautiful with web fonts

A little bit of history

Page 3: Making drupal beautiful with web fonts

It only took a decade

• 1997: CSS2 introduces @font-face

• IE4 supports @font-face

• 2008: Safari 3.1 supports @font-face

• 2009: Firefox 3.5 supports @font-face

• 2010: Chrome 4 supports @font-face

• iOS 4 supports TrueType

• Firefox 3.6, Chrome 6, IE9 support WOFF

• W3C publishes working draft for WOFF

Page 4: Making drupal beautiful with web fonts

Before• sIFR

• Flash-based

• Liked by foundries

• Hated by designers

• Cufón

• Javascript/JSON

• Lightweight

• Not trusted by foundries

After• Web fonts

• CSS + Web font file

• Hosted option

• WOFF = Security

• It’s just text

Page 5: Making drupal beautiful with web fonts

Then

• Arial

•Georgia

• Trebuchet MS

•Verdana

• Impact

• Times

• Palatino

•Helvetica• Courier New

• Comic Sans

Page 6: Making drupal beautiful with web fonts

aigcorporate.com

Page 7: Making drupal beautiful with web fonts

smartmoney.com

Page 8: Making drupal beautiful with web fonts

lostworldsfairs.com/moon

Now

Page 9: Making drupal beautiful with web fonts

The new web fontecosystem

Page 10: Making drupal beautiful with web fonts

Formats WOFFTTF EOT SVG

Font hostingservicesSelf-hosted

&Foundries Designers

Museo Gotham AvenirFonts

@font-face

Page 11: Making drupal beautiful with web fonts

Commerical fonts

‣ Foundries

‣ Hoefler Frere-Jones, FontFont, House Industries, EmType, exljbris, etc.

‣ Font stores

‣ FontShop.com

‣ MyFonts.com

Page 12: Making drupal beautiful with web fonts

webfonts.info/wiki/index.php?title=Web_fonts_licensing_overview

Web font licensingIt’s complicated. Everybody has their own rules.

Page 13: Making drupal beautiful with web fonts

Free and open source

• Font Squirrel

• fontsquirrel.com

• Google Web Fonts

• code.google.com/webfonts

• League of Movable Type

• theleagueofmovabletype.com

• Lost Type Co-op

• losttype.com

Page 14: Making drupal beautiful with web fonts

theleagueofmoveabletype.com/manifesto

It means that you're allowed to use these fonts personally or commercially, as long as you credit the original creator, and if you made tweaks and changes to the typefaces, any new typefaces resulting from it should be licensed under the same terms. That way all our fonts and any new fonts resulting from them will always be open.

“SIL Open font license

http://scripts.sil.org/OFL

Page 15: Making drupal beautiful with web fonts

Web font formats

• Embedded OpenType (EOT)

• TrueType + DRM

• Created by Microsoft

• TrueType (TTF)

• Standard desktop format

• SVG

• Used for iOS 3

• Web Open Font Format (WOFF)

• W3C standard (soon)

• 40% smaller than TTF

• Contains metadata

Page 16: Making drupal beautiful with web fonts

Credit: shoze.blogspot.com

Why do we need all these crazy font formats?

Page 17: Making drupal beautiful with web fonts

webfonts.info/wiki/index.php?title=@font-face_browser_support

Firefox 3.6+ Chrome 6+ IE 6-8 IE9 Safari 3.1+ iOS 4.2 Android 2.2

EOT • •TTF • • • • •SVG • •

WOFF • • •

@font-face browser support

Page 18: Making drupal beautiful with web fonts

@font-face kits

• Multiple file types

• EOT, WOFF, TTF, SVG, Cufon, HTML, CSS

• Pre-built kits

• fontsquirrel.com/fontface

• Build your own

• fontsquirrel.com/fontface/generator

Page 19: Making drupal beautiful with web fonts

The bulletproof@font-face method

Page 20: Making drupal beautiful with web fonts

@font-face { font-family: Gotham; src: url('gotham.ttf'); }

@font-face

Page 21: Making drupal beautiful with web fonts

fontspring.com/blog/further-hardening-of-the-bulletproof-syntax

@font-face { font-family: 'Gotham'; src: url('gotham.eot') format('eot'), src: url('gotham.eot?#iefix') format('embedded-opentype'), url('gotham.woff') format('woff'), url('gotham.ttf') format('truetype'), url('gotham.svg#gotham') format('svg'); }

the real @font-face

Page 22: Making drupal beautiful with web fonts

IE9 compatibility mode

EOT: IE9 compatibility mode

@font-face { font-family: 'Gotham'; src: url('gotham.eot') format('eot'), src: url('gotham.eot?#iefix') format('embedded-opentype'), url('gotham.woff') format('woff'), url('gotham.ttf') format('truetype'), url('gotham.svg#gotham') format('svg'); }

Page 23: Making drupal beautiful with web fonts

Unfortunately, you need the ?# to trick IE.

@font-face { font-family: 'Gotham'; src: url('gotham.eot') format('eot'), src: url('gotham.eot?#iefix') format('embedded-opentype'), url('gotham.woff') format('woff'), url('gotham.ttf') format('truetype'), url('gotham.svg#gotham') format('svg'); }

EOT: IE6, 7, 8

Page 24: Making drupal beautiful with web fonts

WOFF: Chrome, Firefox, IE9

@font-face { font-family: 'Gotham'; src: url('gotham.eot') format('eot'), src: url('gotham.eot?#iefix') format('embedded-opentype'), url('gotham.woff') format('woff'), url('gotham.ttf') format('truetype'), url('gotham.svg#gotham') format('svg'); }

Page 25: Making drupal beautiful with web fonts

@font-face { font-family: 'Gotham'; src: url('gotham.eot') format('eot'), src: url('gotham.eot?#iefix') format('embedded-opentype'), url('gotham.woff') format('woff'), url('gotham.ttf') format('truetype'), url('gotham.svg#gotham') format('svg'); }

TTF: iOS 4, legacy browsers

Page 26: Making drupal beautiful with web fonts

If the # value was not provided for you, open the SVG file in a text editor and look for:font id="mySVGFontName"

@font-face { font-family: 'Gotham'; src: url('gotham.eot') format('eot'), src: url('gotham.eot?#iefix') format('embedded-opentype'), url('gotham.woff') format('woff'), url('gotham.ttf') format('truetype'), url('gotham.svg#gotham') format('svg'); }

SVG: iOS 3

Page 27: Making drupal beautiful with web fonts

The joy of multiple weights

Page 28: Making drupal beautiful with web fonts

@h1 { font-family: Verdana;

font-weight: bold; }

Bold and non-bold. Hooray.

@h2 { font-family: Verdana; font-weight: normal; }

Verdana boldVerdanaVerdana bold italicVerdana italic

Page 29: Making drupal beautiful with web fonts

Gotham LightGotham Light ItalicGotham BookGotham Book ItalicGotham MediumGotham Medium ItalicGotham BoldGotham Bold ItalicGotham BlackGotham Black Italic

Real fonts have big families

Page 30: Making drupal beautiful with web fonts

Variant font-weight font-styleGotham Light 100 normalGotham Light Italic 100 italicGotham Book 200 normalGotham Book Italic 200 italicGotham Medium 300 normalGotham Medium Italic 300 italicGotham Bold 400 normalGotham Bold Italic 400 italicGotham Black 500 normalGotham Black Italic 500 italic

Page 31: Making drupal beautiful with web fonts

You can apply the same font-family name to each variant, as long as you

set the font-weight and font-style for each.

Page 32: Making drupal beautiful with web fonts

@font-face { font-family: ‘Gotham Light’;

src: url('gotham-light.ttf') format('truetype'); font-weight: 100;

}

h2 { font-family: ‘Gotham Light’; }

Calling each font by name. Eh.

Page 33: Making drupal beautiful with web fonts

@font-face { font-family: ‘Gotham’;

src: url('gotham-light.ttf') format('truetype'); font-weight: 100;

}

h1 { /* Gotham Black */ font-family: ‘Gotham’; font-weight: 500; }

One family, many weights. Boom.

@font-face { font-family: ‘Gotham’; src: url('gotham-black.ttf') format('truetype'); font-weight: 500; }

h2 { /* Gotham Light */ font-family: ‘Gotham’; font-weight: 100; }

456bereastreet.com/archive/201012/font-face_tip_define_font-weight_and_font-style_to_keep_your_css_simple

Page 34: Making drupal beautiful with web fonts

@font-face { font-family: ‘Gotham’;

src: url('gotham-light-italic.ttf') format('truetype'); font-weight: 100;font-style: italic;

}

.caption { font-family: ‘Gotham’; font-weight: 100; font-style: italic; }

456bereastreet.com/archive/201012/font-face_tip_define_font-weight_and_font-style_to_keep_your_css_simple

Italics too

Page 35: Making drupal beautiful with web fonts

Web font hosting services

Page 36: Making drupal beautiful with web fonts

Web font hosting

• Pros

• Large selection of high-quality fonts

• Very little coding

• No worrying about licensing

• No expensive font purchases

• Cons

• Not free: Pay by pageviews or per font

• No desktop version of the font

• Dependent on third-party service

Page 37: Making drupal beautiful with web fonts

Web font hosting services

• Paid

• Typekit.com

• webfonts.fonts.com

• Fontdeck.com

• Kernest.com

• Free

• google.com/webfonts

Page 38: Making drupal beautiful with web fonts

Who’s the best?bit.ly/web-font-hosts

Page 39: Making drupal beautiful with web fonts

Web fonts in Drupal

Page 40: Making drupal beautiful with web fonts

@font-your-face module

• Supports multiple font-hosting services

• No Javascript to add to your templates

• Browse font collection inside Drupal

• Assign CSS selectors through the UI

drupal.org/projects/font-your-face

Page 41: Making drupal beautiful with web fonts

Best practices

Page 42: Making drupal beautiful with web fonts

Best practices

• Only load the fonts you need

• Always use fallback fonts

• FOUT - Flash of Unstyled Text

• Font events

• Test, test, test

Page 43: Making drupal beautiful with web fonts

Web design isexciting again

Page 44: Making drupal beautiful with web fonts

lostworldsfairs.com

Page 45: Making drupal beautiful with web fonts

Aaron [email protected]

slideshare.net/fourkitchensfourkitchens.com/presentations

@aaronstanush

Page 46: Making drupal beautiful with web fonts

All content in this presentation, except where noted otherwise, is Creative Commons Attribution-ShareAlike 3.0 licensed and copyright 2009 Four Kitchen Studios, LLC.

Thanks!