Implementing @font-face


Published on

Fine typography has always been one of the stumbling points of web design. Limited at most to a handful of cross-platform specific fonts, web designers have often found it necessary to hack their way into typographically nuanced territory. Technologies such as sIFR and Cufon utilize Flash and Javascript techniques to achieve typographic variety, but often at the expense of clumsy technological implementation. @font-face brings with it the hope of a standard, cross-platform, cross-browser, lightweight method for referencing font-files not found on end users' computer. In other words: it allows web designers to store fonts on their server and reference them in CSS, regardless of what fonts the user browsing the page has installed.

Published in: Technology, Design
  • Be the first to comment

  • Be the first to like this

Implementing @font-face

  1. 1. by Mohamad Agus Sya’ban
  2. 2. @font-face is a CSS rule which allows you to show a font on a Web page even if that font is not installed on the users' computer.
  3. 3. <ul><li>Rely on native browser rendering, the same as with web safe fonts </li></ul><ul><li>Lightweight </li></ul><ul><li>Cufon/sIFR can be a little buggy </li></ul><ul><li>It’s like taking a candy from a baby :p </li></ul><ul><li>Print stylesheet work with @font-face </li></ul>
  4. 4. <ul><li>CSS2 introduced @font-face. </li></ul><ul><li>CSS2.1 killed it. </li></ul><ul><li>CSS3 is reintroducing it. </li></ul>
  5. 5. <ul><li>Why do you need to know the history? </li></ul><ul><li>Because, it means there is actually a feature of CSS3 that internet explorer supports, albeit, differently than all other supporting browsers. </li></ul>
  6. 6. <ul><li>Here is the @font-face browser: </li></ul><ul><li>Internet Explorer (all versions): EOT </li></ul><ul><li>Safari (3.2+): TTF / OTF </li></ul><ul><li>iPhone (3.1) SVG </li></ul><ul><li>Chrome (all versions): SVG ( TTF / OTF added 25th Jan 2010) </li></ul><ul><li>Firefox (3.5+): TTF / OTF (. WOFF added 3.6) </li></ul><ul><li>Opera (10+) TTF / OTF </li></ul>
  7. 7. <ul><li>Did I mention it before </li></ul><ul><li>that using @font-face is easy? </li></ul><ul><li>Well, you simply include a rule in your style sheet, and reference to the font files </li></ul>
  8. 8. <ul><li><a-remote-font-name>   </li></ul><ul><li>Specifies a font name that will be used as font face value for font properties. </li></ul><ul><li><source>  </li></ul><ul><li>URL for the remote font file location, or the name of a font on the user's computer in the form local(&quot;Font Name&quot;). </li></ul>@font-face { font-family: <a-remote-font-name>; src: <source>;   }
  9. 9. <ul><li>Then, if you want the font to appear in the H1, for example, </li></ul><ul><li>use: </li></ul>@font-face { font-family: MyriadPro; src: url('/MyriadPro.eot'); src: local(Myriad Pro'), url('/MyriadPro') format('opentype'), url(‘/MyriadPro') format('svg') } h1 { font-family: MyriadPro, Arial, Verdana, Serif; } Note: The above example uses some fall-back options in case @font-face isn't supported.
  10. 10. <ul><li> </li></ul><ul><li> </li></ul><ul><li> </li></ul><ul><li> </li></ul>
  11. 11. <ul><li>The only thing that matters now is </li></ul><ul><li>we need font-kit to implement @font-face . </li></ul>
  12. 12. <ul><li>There are a lot of online generators </li></ul><ul><li>e.g. </li></ul><ul><li> </li></ul><ul><li>Or you can grab some free kits here: </li></ul><ul><li> </li></ul>
  13. 13. <ul><li>Fonts must have a Web-font licence! Check the Web site you are downloading or purchasing the font from, or the documentation that comes with the font. </li></ul>
  14. 14. <ul><li>Sources: </li></ul><ul><li> </li></ul><ul><li> </li></ul><ul><li> </li></ul>