Beautiful Web
  Typography
โฆ Letter, text, & page
  Simon Pascal Klein โ€” @klepas
  Version 5.4
Beautiful Web Typography




             Introโ€ฆ
Beautiful Web Typography




             Iโ€™m Pascal Klein.
Beautiful Web Typography




             Iโ€™mโ€ฆ
         1. a graphic & web designer;
        2. a bit of a UI and UX a๏ฌcionado;
        3. and, incurably, a rampant โ€˜typophileโ€™.
Beautiful Web Typography




                โ€˜Typophilesโ€™ are รผber gฮตฮตks who
                                  typography.

                       Hands up and make yourselves known.
Beautiful Web Typography




             tyโ€ขpogโ€ขraโ€ขphy | tฤซหˆpรคgrษ™fฤ“ | โ€ขn
             Typography is the art of creating and setting type
             with the purpose of honouring the text it sets.
Beautiful Web Typography




             Typography can bring aesthetic order to
             information, helping users read & navigate.
Beautiful Web Typography




              i.e.   make textual stu๏ฌ€ look pretty.

                                โ˜ป
Beautiful Web Typography




                                       premise:


                           The intertubes today are
                                  info-heavy.

                                Much of it is textual.
                             Much of it is a pain to read.
Beautiful Web Typography




             Assumptions?
             It sucks? Itโ€™s boring?
         1. Limited to sans-serif only for readability?
        2. Only โ€˜web-safeโ€™ fonts?
        3. Limited controlโ€”resort to Flash and other non-
             standard technologies?
Beautiful Web Typography




                           Not quite.

                             (Yay!)
Beautiful Web Typography




         1. Letter (micro)
        2. Text
        3. Page or grid (macro)
Beautiful Web Typography




        0. Reset
             All the browsers have their own default styling for
             various (x)HTML elements. This makes it a pain for
             cross-browser consistency.
Beautiful Web Typography




             body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,form,fieldset,in
             put,textarea,p,blockquote,th,td {margin:0;padding:0;}
             table {border-collapse:collapse;border-spacing:0;}
             fieldset,img {border:0;}
             address,caption,cite,code,dfn,em,strong,th,var {font-style:
             normal;font-weight:normal;}
             ul,ol {list-style:none;}
             caption,th {text-align:left;}
             h1,h2,h3,h4,h5,h6 {font-size:100%;font-weight:normal;}
             q:before,q:after {content:'';}
             abbr,acronym {border:0;}



             Googling โ€œCSS reset stylesheetsโ€ should land you
             with numerous examples. This one above is from
             the Yahoo! UI library.
Beautiful Web Typography




             Letter & Text
          โ€ข typeface (font) and style
          โ€ข spacing (tracking/letter-spacing)
          โ€ข individual glyphs
Beautiful Web Typography




             serif
             sans serif
             script
             blackletter
             monospace
Beautiful Web Typography




             Mixing typefaces requires special attention. Try to
             align x-heights and sizes. X-heights?


             x-height x-height
             Helvetica Regular 96pt & Dolly Regular 96pt.



             x-height x-height
             Helvetica Regular 96pt & Dolly Regular 108pt.
Beautiful Web Typography




             Use a limited palette of type families. A common
             and e๏ฌ€ective technique is to pair a serif and a
             sans serif face together. E.g.:
         1. one sets the body, the other the headings;
        2. one sets primary content, the other UI controls.

             We do this with the font-family property.
Beautiful Web Typography




                      โ€ฆbut only โ€˜web safeโ€™ fonts?
Beautiful Web Typography




             Arial
             Verdana
             Courier New
             Times New Roman
             Georgia
             Trebuchet MS
Beautiful Web Typography




             Options for setting fonts:
         1. Installed fonts (mostly web-safe)
        2. SIFR or other JS and Flash replacement
        3. Cufรณn et al. (http://tinyurl.com/git-cufon)
        4. webfonts: EOT/EOT Lite via @font-face
        5. webfonts: OT/TTF via @font-face
        6. webfonts: SVG via @font-face
        7. Hosting & licensing services
        8. OpenType permissions extension?
        9. webfont ๏ฌle proposal (.webfont, ZOT , WOFF)?
Beautiful Web Typography




        1. Installed or web-safe fonts
             Simply call upon them directly in your font stack
             declarations, e.g.:
             font-family:   Baskerville,
                            Times,
                            'Times New Roman',
                            serif;

             font-family: 'Helvetica Neue',
                            Helvetica,
                            'Arial',
                            sans-serif;
Beautiful Web Typography




             Font stacks:
          โ€ข desired
          โ€ข fallback
          โ€ข generic (e.g. serif, sans-serif, monospace)
Beautiful Web Typography




        2. sifr et al.
             Flash text replacement that in unison with JS
             replaces type using type from a Flash ๏ฌle.

             Not a feasible solution long-term:
         1. does subsetting;
        2. non-standard: relies on both Flash and JS;
        3. performance: high page load time โ€” not feasible
             for body copy.
Beautiful Web Typography




        3. Cufรณn & js implementations
             These were the ๏ฌrst JS-only implementations.
             Cufรณn converts font paths to VML paths stored in
             JSON ,    then rendering the font paths using JS.

             Various thoughts and concerns:
         1. not accessible but works in most browsers;
        2. type foundries are/were sceptical โ€” not a โ€˜serviceโ€™;
             limited palette of typefaces;
        3. converter is often proprietary.
Beautiful Web Typography




        4. webfonts: eot/eot Lite
             Developed by Microsoft, Embedded OpenType
             subsets, compresses, and encrypts OT and TTF. Can
             be restricted a list of trusted roots. Uses webfonts.
             Described as โ€˜DRM icing on an OpenType cakeโ€™.

             Not feasible as-is currently:
         1. non-standard, proprietary solution;
        2. requires a proprietary converter (WEFT) to use;
        3. proposal rejected by W 3C & only supported by IE .
Beautiful Web Typography




        5. webfonts: ot/ttf
             Also uses webfonts CSS @font-face and links
             directly via the src: declaration to an OT/TTF ๏ฌle
             which is downloaded and used to render the type.

             Feasible but:
         1. OT/TTF ๏ฌles can easily be downloaded;
        2. supported in Safari 3.1+, Firefox 3.5+ (planned for
             Opera 10 and Chrome 2.0 beta);
        3. subsetting & compression comes down to author.
Beautiful Web Typography




        6. webfonts: svg
             Works just as EOT and OT/TTF , instead linking
             directly via the src: declaration to an SVG ๏ฌle
             which is downloaded and used to render the type.

             Thoughts:
         1. again, SVG ๏ฌles can easily be downloaded;
        2. supported in Chrome 0.3+, Opera 9, and iPhone
             Safari 3.1; needs command switches otherwise;
        3. subsetting & compression comes down to author.
Beautiful Web Typography




        7. Hosting & licensing services
             Generally foundry initiatives that are JS-based
             (though not exclusively) and hosted, paid
             subscription models: select, pay, inject; done.

             Thoughts:
         1. deemed โ€˜the solutionโ€™ (though still in-the-works);
        2. standards-based, good browser support, and easy;
        3. subsetting and/or compression service-side.
Beautiful Web Typography
Beautiful Web Typography




        8. ot permissions extension?
             Proposed by David Burlow from Font Bureau as a
             simple permissions table extension for OpenType
             with a perm tag.

             Thoughts:
         1. simple: no change in the OT format; no wrapper;
        2. standards-based, but no compression;
        3. reverse-engineer-able (just edit the XML).
Beautiful Web Typography




        9. webfont ๏ฌle proposal
             Proposed by Tal Leming, Erik van Blokland et al. as
             an alternative to EOT, compressing the font and an
             accompanying meta-data XML ๏ฌle. Uses webfonts.

             Considerations:
         1. compact, simple, elegant, easily standards-based;
        2. reverse-engineer-able?; CORS in discussion;
        3. โ€ฆbut (somewhat surprisingly) gaining support
             from type designers and foundries alike.
Beautiful Web Typography




           WOFF      proposed ๏ฌle structure:

               WOFFHeader              basic info & o๏ฌ€sets to data blocks

               TableDirectory          font ๏ฌle info (sizes, location, โ€ฆ)

               FontTables              sfnt-based font data, compressed

               ExtendedMetadata        optional XML data, compressed

                                       optional arbitrary, unable to a๏ฌ€ect
               PrivateData
                                       the usage or load behaviour


                      WOFF   will be supported in Firefox 3.6.
Beautiful Web Typography



           .webfont example metadata structure:

               <fontdata>       name, ๏ฌle name, format

               <creationdate>   creation data stamp of font ๏ฌle

               <vendor>         vendor info; attr.: name, URL

               <designer>       designer info; attr.: name, URL , role

               <license>        license; attr.: URL , ID

               <licenseename>   name for the licensee of the font

               <description>    description for the font

               <copyright>      copyright for the font

               <trademark>      trademark for the font

               <privatedata>    additional arbitrary, private info.
Beautiful Web Typography




             โ€˜bullet-proofโ€™ @font-face declarations

               @font-face {
                  font-family: "Your typeface";
                  src: url("type/filename.eot");
                  src: local("Alt name"), local("Alt-name"),
                      url("type/filename.woff") format("woff"),
                      url("type/filename.otf") format("opentype"),
                      url("type/filename.svg#id") format("svg");
                  }
Beautiful Web Typography




             When using @font-face, weโ€™re essentially dealing
             with separate font ๏ฌles of the same family for the
             various font styles, e.g., foobar-regular.otf, foobar-
             italic.otf, foobar-bold.otf, foobar-smallcaps.otf &c.
             This can become an issue โ€” consider elements
             such as strong and em which are styled with
             setting the face in a bold and italic respectively.
             If we declare the italic via @font-face (as we
             would to get the style into our design) what will
             happen is that the italic is digitally italicised (fake
             italics) by the font rendering engine. Result?
Beautiful Web Typography




             If we avoid or overwrite the various declarations
             (e.g. em { font-style: normal;}) and for
             whatever reason our desired @font-face font
             isnโ€™t available, we rob other fonts in the font-
             stack of their styling.
Beautiful Web Typography




             We overcome both these issues by setting the
             font styles within the @font-face declaration:

               @font-face {
                 font-family: "Your italic typeface";
                 font-style: italic;
                 src: url("type/filename.eot");
                 src: local("Alt italic name"), local("Alt-italic-name"),
                     url("type/filename-italic.woff") format("woff"),
                     url("type/filename-italic.otf") format("opentype"),
                     url("type/filename-italic.svg#id") format("svg");
                 }
Beautiful Web Typography




             Why are they two entries for local in src?
             src: local("Alt italic name"), local("Alt-italic-name"),


             Some browsers refer to the fonts using their
             PostScript names.
Beautiful Web Typography




           Finding it in Font Book under Mac OS X:
Beautiful Web Typography




             There is a free downloadable Font properties
             extension for Windows. Once installed right-click
             โ†’ Properties on a font ๏ฌle and click on the Names
             tab to see the name details.
             See: http://bit.ly/ms-font-prop.


             There are similar tools on the free desktops.
Beautiful Web Typography




             When using @font-face for self-hosted fonts, we
             need to subset and compress ourselves.
             Subsetting allows us to remove knowingly unused
             glyphs from the font ๏ฌle, thus limiting ๏ฌle size.
             E.g. if we know we wonโ€™t ever need Greek
             characters we can remove them likely drastically
             reducing the font ๏ฌles size, lowering page size.
             Subsetting is can be done in a font editorโ€”I
             suggest FontForge (FOSS)โ€”open your font, select
             unused character blocks and delete them; save.
Beautiful Web Typography




             Save yourself a headacheโ€”skip using the WEFT
             converter and instead use ttf2eot. Why?

         1. WEFT will use Monotypeโ€™s proprietary
             compression algorithm and gzip is better;
        2. WEFT only works on Windows XP;
        3. t๏ฌ€2eot doesnโ€™t compressโ€”use gzip server-side.

             There are online front ends to ttf2eot:
          โ€ข http://ttf2eot.sebastiankippe.com/
          โ€ข http://fontsquirrel.com/fontface/generator
Beautiful Web Typography




             For compression, letโ€™s gzip (via .htaccess):

             # gzips content if possible
             <IfModule mod_gzip.c>
                 mod_gzip_on         Yes
                 mod_gzip_dechunk    Yes
                 mod_gzip_item_include file      .(html?|css|js|...|otf|eot)$
                 mod_gzip_item_include handler   ^cgi-script$
                 ...
                 mod_gzip_item_include mime      ^application/vnd.ms-fontobject$
             </IfModule>




             Donโ€™t be surprised to see reductions of 40โ€“50%!
Beautiful Web Typography




             While weโ€™re at it, letโ€™s cache the font assets too:

             # Cache following file types for one month
             <FilesMatch ".(js|jpeg|jpg|...|otf|eot)$">
                   Header set Cache-Control "max-age=2592000"
             </FilesMatch>
Beautiful Web Typography




                               Meanwhile:

                     Webfonts arenโ€™t the holy grail of web
                            typography problemsโ€ฆ


         โ€œTypography is not picking a โ€˜coolโ€™ font.โ€
                                              โ€“ Jeff Croft
Beautiful Web Typography




             Also remember, most fonts available from
             type foundries are not optimised for screen
             usage; theyโ€™re for print.
Beautiful Web Typography




             Use a combination of families, styles, weights and
             to breath some fresh air into your web type.

          โ€ข font-weight controls weight and accepts
             numerical and descriptive (e.g. normal) values.

          โ€ข font-style controlsโ€ฆ style. Accepts the descrip-
             tive values (normal, italic, and oblique).

          โ€ข font-variant controls case and accepts the
             values normal and small-caps.
Beautiful Web Typography




             roman (โ€˜normalโ€™)
             italic โ‰  oblique
             ultralight regular bold
             & bold italic condensed
             S MALL - CAPITALS
Web Typography




            Tracking
            Tracking
            Letter-spacing
            Letter-spacing
Beautiful Web Typography




             Letสผs see some loose word-
             spacing in actionโ€ฆ

             And now both loose word-spacing
             and tracking featured together.
Beautiful Web Typography




             And ๏ฌnally, the recent popular
             trend of negative tracking.
Beautiful Web Typography




             Tracking and word-spacing can help di๏ฌ€erentiate,
             aiding readability by removing disruption.

             E.g. setting acronyms or numerical tabular data.
Beautiful Web Typography




             Full-capital acronyms, along with other full-cap-
             sized glyphs can disturb the ๏ฌ‚ow of the text:

             Lorem ipsum dolor sit amet, NASA consectetur adipiscing
             et. Vestibulum elit pellentesque; ac habitant orci tristique
             senectus et 4,962 malesuada fames egestas HTML sit lectus.

             Lorem ipsum dolor sit amet, nasa consectetur adipiscing
             et. Vestibulum elit pellentesque; ac habitant orci tristique
             senectus et 4,962 malesuada fames egestas html sit lectus.
Beautiful Web Typography




          โ€ข letter-spacing and word-spacing controls
             tracking and word-spacing respectively. Both take
             numerical values and normal.

             Sadly no property for controlling ๏ฌgure variantsโ€”
             hopes set for CSS3. For now use Georgia which
             (only) features hanging or โ€˜old-styleโ€™ ๏ฌgures.
Beautiful Web Typography




          โ€ข font-size controlsโ€ฆ font sizes. Takes numerical
             and descriptive values. Most user agents (e.g.
             browsers) set default value at 16px.

             Size font sizes relatively using ems or %.

             An em is a relative unit best to be thought of as a
             box. It is relative to the point size of a speci๏ฌc
             font (i.e. 1 em in a 12 point typeface is 12 point).
Beautiful Web Typography




             Why?
          โ€ข Some UAs donโ€™t support font-resizing (Ctrl + +/-) or
             page scaling when measurements are de๏ฌned in
             absolute terms.
          โ€ข JS-based text resize widgets โ‰  text accessibility.
          โ€ข Many devices and many user agentsโ€”be careful in
             making assumptions.
Beautiful Web Typography




             Key: remember font sizes are inherited:
             parents โ†’ children.

             To calculate, ๏ฌnd what one pixel is in ems and
             then multiply by the desired font size (in pixels):

               1 รท parent font-size ร— required pixel value
                                 = em value
Beautiful Web Typography




             62.5% trick
             Simplify your calculations. Consider:

             p { font-size: 80%; }
             blockquote { font-size: 80%; }


             80% of 16px is 12.8px, so p and blockquote
             elements will be that size, but what happens
             when we put a p element inside a blockquote
             element? The parent (blockquote) is 12.8px so the
             p will be rendered at 80% of that: 10.42px.
Beautiful Web Typography




             62.5% trick (contโ€™d)
             In 2004 Richard Rutter wrote an article outlining a
             trick he used to make these calculations simpler:
          โ€ข browsers have common default size of 16px; thus:
          โ€ข set body to 62.5% and reset all to 10px; thus:
          โ€ข from here calculations are simpler for direct
             descendants of the body, e.g. 12px = 1.2em; 8px =
             0.8em. Further nested elements are (still) relative.
Beautiful Web Typography




             To ๏ฌnd an elementโ€™s font size in absolute terms
             (e.g. pixels) you can use the Firefox โ€˜Web
             Developerโ€™ plugin: Information โ†’ Display Element
             Information.
Beautiful Web Typography




             Stick it to a scale
             Donโ€™t just arbitrarily set type; use a scale:


               6, 7, 8, 9,   10, 11, 12, 14,   16, 18, 21, 24,   36, 48,   60, 72.
               the โ€œclassic scaleโ€


               9, 10, 11, 12, 13,



               another scale
                                      14, 18,     24, 36,        48, 64, 72,    96.
               8,   13,   21,      34,           55,
               scale based on the Fibonacci sequence
                                                             89.
Beautiful Web Typography




             At small sizes font-decoration: underline;
             can render descender glyphs (g, j, p, q, y) di๏ฌƒcult
             to read: use border-bottom: 1px solid;

             โ€ฆconsectetuer adipiscing elitโ€ฆ

                           โ€ฆadipiscing elitโ€ฆ
                           โ€ฆconsectetuer adipiscing elitโ€ฆ

                                   โ€ฆadipiscing elitโ€ฆ
Beautiful Web Typography




             Correct glyphs
             Consider:




                           1'61"
                            ' "
Beautiful Web Typography




                           "This is a group of words
                            surrounded by a bunch
                                of tick marks."
Beautiful Web Typography




                      โ€œThis is a quotation!โ€
                                      - Jeff Croft
Beautiful Web Typography




                           โ€˜โ€™ โ€œโ€
                              โ€™
Beautiful Web Typography




                    - hyphen   Mary-Anne, Walter-Strauss


                   โ€“ en dash   Aprilโ€“May, ages 3โ€“5, pp. 37โ€“38


               โ€” em dash       Phrase markerโ€”(generally) not spacedโ€”like so.


                     โ€“ minus   5โ€“4=1
Beautiful Web Typography




                 โ€œ         opening double quote   &ldquo;
                 โ€         closing double quote   &rdquo;
                 โ€˜         opening single quote   &lsquo;
                 โ€™         closing single quote   &rsquo;
                 โ€“         en dash                &ndash;
                โ€”          em dash                &mdash;
                โˆ’ minus                           &minus;
                 ร—         multiplication         &times;
                โ€ฆ          ellipsis               &hellip;
Beautiful Web Typography




             Smartypants et al.
            โ€˜Doing something repetitively? Likely youโ€™re doing it wrong.โ€™

             Smartypants et al. are parsers that translate plain
             ASCII     characters into โ€œsmartโ€ typographic (x)HTML
             entities (and beyond just punctuation).

          โ€ข Smartypants (PHP, Perl, & Movable Type);
          โ€ข Typogrify (Python/Django);
          โ€ข wp-Typography (WordPress);
          โ€ข Markdown, Textile et al., โ€ฆ
Beautiful Web Typography




             Give ampersands love
             Italic ampersand variants are often much prettier
             than their common roman counterparts:



             &&&&&&
             &&&&&&
Beautiful Web Typography




             Marking paragraphs (and more)
             Donโ€™t be afraid to mark new paragraphs with
             indents, outdents, white-lines, a pilcrow (ยถ) or
             other ornament (e.g. โฆ), versals, headers &c.

             โ€ฆor a combination thereof.

             See: http://tinyurl.com/para-typography.
Beautiful Web Typography




             Measures
             The measure is the length of a single line. It is
             important to select a good measure for running
             text. Do this with the width property.

             Ideally these should be relative to the font size,
             such that the type scales proportionately to the
             measure; use ems or percentages.
Beautiful Web Typography




             Measures (contโ€™d)
             Web type generally bene๏ฌts from smaller
             measures than those in print. A good ballpark is
             10โ€“15 words/75โ€“100 characters per line for body
             copy, single column.

             Generally use ๏ฌ‚ush-left (text-align: left;) for
             running text, particularly when set in a narrow
             measure. Justi๏ฌcation can work at ample
             measures and better with serif typefaces.
Beautiful Web Typography




             Leading (line-height)
             Donโ€™t forget to set an ample leading for running
             text! Done using the line-height property and
             you can use a unit-less number (e.g. 1.5 which
             acts as a multiplier of the font size);

             Leading spans from baseline to baselineโ€ฆ and I
             need some more text to illustrate the point. โ˜บ
Beautiful Web Typography




             Hanging punctuation
             Traditionally punctuation marks, bullets, lists,
             hyphens, and brackets all hang in the margin.


           โ€œ Lorem ipsum dolor sit amet, consectetuer
             adipiscing elit. Integer a odio. Vivamus placerat felis
             id risus. Cras mollis est. Etiam mollis vulputate
           ( lorem nullam turpis non massa rhoncus sodales.)โ€
Beautiful Web Typography




             Hanging punctuation (contโ€™d)
             Simply with lists by setting their margins to zero.

             Possible for opening punctuation marks using
             background-image or a negative text-indent.
             CSS 3
                 will hopefully support hanging punctuation
             with a proposed hanging-punctuation property.

             See: http://tinyurl.com/w3c-hanging-punct.
Beautiful Web Typography




             Web: text = ui
             Distinguish content elements from application
             controls (e.g. a userโ€™s username and description
             from a logout link or text-๏ฌeld title).
             Often done with colour (e.g. setting controls
             gray), size (making them a tad smaller) and with
             di๏ฌ€erent typefaces or font styles.
Beautiful Web Typography
Beautiful Web Typography
Beautiful Web Typography




             Page (grid)
             Grids bring order to your page and help specify
             where things should go.

             Remember to put in apt โ€œguttersโ€ (margins
             between columns) to separate your columns.

             Ruler guides help enormously: use the Web
             Developer extension for Firefox or ruler
             background images (also see the YUI library).
Beautiful Web Typography
Beautiful Web Typography
Beautiful Web Typography




             Addendum
             Please donโ€™t use Comic Sans unless you have a
             very, very good reason for its application.
isbn: 0-88179-206-3
Beautiful Web Typography




             Inspirational typophiles
           โ€ข Cameron Moll: cameronmoll.com

           โ€ข Je๏ฌ€ Croft: je๏ฌ€croft.com

           โ€ข Je๏ฌ€rey Zeldman: zeldman.com

           โ€ข Mark Boulton: markboulton.co.uk

           โ€ข Richard Rutter: clagnut.com

           โ€ข Jon Tan: jontangerine.com
Beautiful Web Typography




             Resources & reading
           โ€ข http://webtypography.net

           โ€ข http://alistapart.com/topics/design/typography

           โ€ข http://usabletype.org

           โ€ข http://ilovetypography.com

           โ€ข http://www.papress.com/other/thinkingwithtype/
Thanks!
            klepas@klepas.org

            klepas.org

            @klepas



Licensed CC BY -NC-ND
http://creativecommons.org/licenses/by-nc-nd/2.5/au/

Beautiful Web Typography v5.3 Edge of the Web presentation

  • 1.
    Beautiful Web Typography โฆ Letter, text, & page Simon Pascal Klein โ€” @klepas Version 5.4
  • 2.
  • 3.
    Beautiful Web Typography Iโ€™m Pascal Klein.
  • 4.
    Beautiful Web Typography Iโ€™mโ€ฆ 1. a graphic & web designer; 2. a bit of a UI and UX a๏ฌcionado; 3. and, incurably, a rampant โ€˜typophileโ€™.
  • 5.
    Beautiful Web Typography โ€˜Typophilesโ€™ are รผber gฮตฮตks who typography. Hands up and make yourselves known.
  • 6.
    Beautiful Web Typography tyโ€ขpogโ€ขraโ€ขphy | tฤซหˆpรคgrษ™fฤ“ | โ€ขn Typography is the art of creating and setting type with the purpose of honouring the text it sets.
  • 7.
    Beautiful Web Typography Typography can bring aesthetic order to information, helping users read & navigate.
  • 8.
    Beautiful Web Typography i.e. make textual stu๏ฌ€ look pretty. โ˜ป
  • 9.
    Beautiful Web Typography premise: The intertubes today are info-heavy. Much of it is textual. Much of it is a pain to read.
  • 10.
    Beautiful Web Typography Assumptions? It sucks? Itโ€™s boring? 1. Limited to sans-serif only for readability? 2. Only โ€˜web-safeโ€™ fonts? 3. Limited controlโ€”resort to Flash and other non- standard technologies?
  • 11.
    Beautiful Web Typography Not quite. (Yay!)
  • 12.
    Beautiful Web Typography 1. Letter (micro) 2. Text 3. Page or grid (macro)
  • 13.
    Beautiful Web Typography 0. Reset All the browsers have their own default styling for various (x)HTML elements. This makes it a pain for cross-browser consistency.
  • 14.
    Beautiful Web Typography body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,form,fieldset,in put,textarea,p,blockquote,th,td {margin:0;padding:0;} table {border-collapse:collapse;border-spacing:0;} fieldset,img {border:0;} address,caption,cite,code,dfn,em,strong,th,var {font-style: normal;font-weight:normal;} ul,ol {list-style:none;} caption,th {text-align:left;} h1,h2,h3,h4,h5,h6 {font-size:100%;font-weight:normal;} q:before,q:after {content:'';} abbr,acronym {border:0;} Googling โ€œCSS reset stylesheetsโ€ should land you with numerous examples. This one above is from the Yahoo! UI library.
  • 15.
    Beautiful Web Typography Letter & Text โ€ข typeface (font) and style โ€ข spacing (tracking/letter-spacing) โ€ข individual glyphs
  • 16.
    Beautiful Web Typography serif sans serif script blackletter monospace
  • 17.
    Beautiful Web Typography Mixing typefaces requires special attention. Try to align x-heights and sizes. X-heights? x-height x-height Helvetica Regular 96pt & Dolly Regular 96pt. x-height x-height Helvetica Regular 96pt & Dolly Regular 108pt.
  • 18.
    Beautiful Web Typography Use a limited palette of type families. A common and e๏ฌ€ective technique is to pair a serif and a sans serif face together. E.g.: 1. one sets the body, the other the headings; 2. one sets primary content, the other UI controls. We do this with the font-family property.
  • 19.
    Beautiful Web Typography โ€ฆbut only โ€˜web safeโ€™ fonts?
  • 20.
    Beautiful Web Typography Arial Verdana Courier New Times New Roman Georgia Trebuchet MS
  • 21.
    Beautiful Web Typography Options for setting fonts: 1. Installed fonts (mostly web-safe) 2. SIFR or other JS and Flash replacement 3. Cufรณn et al. (http://tinyurl.com/git-cufon) 4. webfonts: EOT/EOT Lite via @font-face 5. webfonts: OT/TTF via @font-face 6. webfonts: SVG via @font-face 7. Hosting & licensing services 8. OpenType permissions extension? 9. webfont ๏ฌle proposal (.webfont, ZOT , WOFF)?
  • 22.
    Beautiful Web Typography 1. Installed or web-safe fonts Simply call upon them directly in your font stack declarations, e.g.: font-family: Baskerville, Times, 'Times New Roman', serif; font-family: 'Helvetica Neue', Helvetica, 'Arial', sans-serif;
  • 24.
    Beautiful Web Typography Font stacks: โ€ข desired โ€ข fallback โ€ข generic (e.g. serif, sans-serif, monospace)
  • 25.
    Beautiful Web Typography 2. sifr et al. Flash text replacement that in unison with JS replaces type using type from a Flash ๏ฌle. Not a feasible solution long-term: 1. does subsetting; 2. non-standard: relies on both Flash and JS; 3. performance: high page load time โ€” not feasible for body copy.
  • 26.
    Beautiful Web Typography 3. Cufรณn & js implementations These were the ๏ฌrst JS-only implementations. Cufรณn converts font paths to VML paths stored in JSON , then rendering the font paths using JS. Various thoughts and concerns: 1. not accessible but works in most browsers; 2. type foundries are/were sceptical โ€” not a โ€˜serviceโ€™; limited palette of typefaces; 3. converter is often proprietary.
  • 27.
    Beautiful Web Typography 4. webfonts: eot/eot Lite Developed by Microsoft, Embedded OpenType subsets, compresses, and encrypts OT and TTF. Can be restricted a list of trusted roots. Uses webfonts. Described as โ€˜DRM icing on an OpenType cakeโ€™. Not feasible as-is currently: 1. non-standard, proprietary solution; 2. requires a proprietary converter (WEFT) to use; 3. proposal rejected by W 3C & only supported by IE .
  • 28.
    Beautiful Web Typography 5. webfonts: ot/ttf Also uses webfonts CSS @font-face and links directly via the src: declaration to an OT/TTF ๏ฌle which is downloaded and used to render the type. Feasible but: 1. OT/TTF ๏ฌles can easily be downloaded; 2. supported in Safari 3.1+, Firefox 3.5+ (planned for Opera 10 and Chrome 2.0 beta); 3. subsetting & compression comes down to author.
  • 30.
    Beautiful Web Typography 6. webfonts: svg Works just as EOT and OT/TTF , instead linking directly via the src: declaration to an SVG ๏ฌle which is downloaded and used to render the type. Thoughts: 1. again, SVG ๏ฌles can easily be downloaded; 2. supported in Chrome 0.3+, Opera 9, and iPhone Safari 3.1; needs command switches otherwise; 3. subsetting & compression comes down to author.
  • 31.
    Beautiful Web Typography 7. Hosting & licensing services Generally foundry initiatives that are JS-based (though not exclusively) and hosted, paid subscription models: select, pay, inject; done. Thoughts: 1. deemed โ€˜the solutionโ€™ (though still in-the-works); 2. standards-based, good browser support, and easy; 3. subsetting and/or compression service-side.
  • 34.
  • 43.
    Beautiful Web Typography 8. ot permissions extension? Proposed by David Burlow from Font Bureau as a simple permissions table extension for OpenType with a perm tag. Thoughts: 1. simple: no change in the OT format; no wrapper; 2. standards-based, but no compression; 3. reverse-engineer-able (just edit the XML).
  • 44.
    Beautiful Web Typography 9. webfont ๏ฌle proposal Proposed by Tal Leming, Erik van Blokland et al. as an alternative to EOT, compressing the font and an accompanying meta-data XML ๏ฌle. Uses webfonts. Considerations: 1. compact, simple, elegant, easily standards-based; 2. reverse-engineer-able?; CORS in discussion; 3. โ€ฆbut (somewhat surprisingly) gaining support from type designers and foundries alike.
  • 45.
    Beautiful Web Typography WOFF proposed ๏ฌle structure: WOFFHeader basic info & o๏ฌ€sets to data blocks TableDirectory font ๏ฌle info (sizes, location, โ€ฆ) FontTables sfnt-based font data, compressed ExtendedMetadata optional XML data, compressed optional arbitrary, unable to a๏ฌ€ect PrivateData the usage or load behaviour WOFF will be supported in Firefox 3.6.
  • 46.
    Beautiful Web Typography .webfont example metadata structure: <fontdata> name, ๏ฌle name, format <creationdate> creation data stamp of font ๏ฌle <vendor> vendor info; attr.: name, URL <designer> designer info; attr.: name, URL , role <license> license; attr.: URL , ID <licenseename> name for the licensee of the font <description> description for the font <copyright> copyright for the font <trademark> trademark for the font <privatedata> additional arbitrary, private info.
  • 47.
    Beautiful Web Typography โ€˜bullet-proofโ€™ @font-face declarations @font-face { font-family: "Your typeface"; src: url("type/filename.eot"); src: local("Alt name"), local("Alt-name"), url("type/filename.woff") format("woff"), url("type/filename.otf") format("opentype"), url("type/filename.svg#id") format("svg"); }
  • 48.
    Beautiful Web Typography When using @font-face, weโ€™re essentially dealing with separate font ๏ฌles of the same family for the various font styles, e.g., foobar-regular.otf, foobar- italic.otf, foobar-bold.otf, foobar-smallcaps.otf &c. This can become an issue โ€” consider elements such as strong and em which are styled with setting the face in a bold and italic respectively. If we declare the italic via @font-face (as we would to get the style into our design) what will happen is that the italic is digitally italicised (fake italics) by the font rendering engine. Result?
  • 50.
    Beautiful Web Typography If we avoid or overwrite the various declarations (e.g. em { font-style: normal;}) and for whatever reason our desired @font-face font isnโ€™t available, we rob other fonts in the font- stack of their styling.
  • 51.
    Beautiful Web Typography We overcome both these issues by setting the font styles within the @font-face declaration: @font-face { font-family: "Your italic typeface"; font-style: italic; src: url("type/filename.eot"); src: local("Alt italic name"), local("Alt-italic-name"), url("type/filename-italic.woff") format("woff"), url("type/filename-italic.otf") format("opentype"), url("type/filename-italic.svg#id") format("svg"); }
  • 52.
    Beautiful Web Typography Why are they two entries for local in src? src: local("Alt italic name"), local("Alt-italic-name"), Some browsers refer to the fonts using their PostScript names.
  • 53.
    Beautiful Web Typography Finding it in Font Book under Mac OS X:
  • 54.
    Beautiful Web Typography There is a free downloadable Font properties extension for Windows. Once installed right-click โ†’ Properties on a font ๏ฌle and click on the Names tab to see the name details. See: http://bit.ly/ms-font-prop. There are similar tools on the free desktops.
  • 55.
    Beautiful Web Typography When using @font-face for self-hosted fonts, we need to subset and compress ourselves. Subsetting allows us to remove knowingly unused glyphs from the font ๏ฌle, thus limiting ๏ฌle size. E.g. if we know we wonโ€™t ever need Greek characters we can remove them likely drastically reducing the font ๏ฌles size, lowering page size. Subsetting is can be done in a font editorโ€”I suggest FontForge (FOSS)โ€”open your font, select unused character blocks and delete them; save.
  • 56.
    Beautiful Web Typography Save yourself a headacheโ€”skip using the WEFT converter and instead use ttf2eot. Why? 1. WEFT will use Monotypeโ€™s proprietary compression algorithm and gzip is better; 2. WEFT only works on Windows XP; 3. t๏ฌ€2eot doesnโ€™t compressโ€”use gzip server-side. There are online front ends to ttf2eot: โ€ข http://ttf2eot.sebastiankippe.com/ โ€ข http://fontsquirrel.com/fontface/generator
  • 57.
    Beautiful Web Typography For compression, letโ€™s gzip (via .htaccess): # gzips content if possible <IfModule mod_gzip.c> mod_gzip_on Yes mod_gzip_dechunk Yes mod_gzip_item_include file .(html?|css|js|...|otf|eot)$ mod_gzip_item_include handler ^cgi-script$ ... mod_gzip_item_include mime ^application/vnd.ms-fontobject$ </IfModule> Donโ€™t be surprised to see reductions of 40โ€“50%!
  • 58.
    Beautiful Web Typography While weโ€™re at it, letโ€™s cache the font assets too: # Cache following file types for one month <FilesMatch ".(js|jpeg|jpg|...|otf|eot)$"> Header set Cache-Control "max-age=2592000" </FilesMatch>
  • 59.
    Beautiful Web Typography Meanwhile: Webfonts arenโ€™t the holy grail of web typography problemsโ€ฆ โ€œTypography is not picking a โ€˜coolโ€™ font.โ€ โ€“ Jeff Croft
  • 60.
    Beautiful Web Typography Also remember, most fonts available from type foundries are not optimised for screen usage; theyโ€™re for print.
  • 61.
    Beautiful Web Typography Use a combination of families, styles, weights and to breath some fresh air into your web type. โ€ข font-weight controls weight and accepts numerical and descriptive (e.g. normal) values. โ€ข font-style controlsโ€ฆ style. Accepts the descrip- tive values (normal, italic, and oblique). โ€ข font-variant controls case and accepts the values normal and small-caps.
  • 62.
    Beautiful Web Typography roman (โ€˜normalโ€™) italic โ‰  oblique ultralight regular bold & bold italic condensed S MALL - CAPITALS
  • 64.
    Web Typography Tracking Tracking Letter-spacing Letter-spacing
  • 65.
    Beautiful Web Typography Letสผs see some loose word- spacing in actionโ€ฆ And now both loose word-spacing and tracking featured together.
  • 66.
    Beautiful Web Typography And ๏ฌnally, the recent popular trend of negative tracking.
  • 67.
    Beautiful Web Typography Tracking and word-spacing can help di๏ฌ€erentiate, aiding readability by removing disruption. E.g. setting acronyms or numerical tabular data.
  • 68.
    Beautiful Web Typography Full-capital acronyms, along with other full-cap- sized glyphs can disturb the ๏ฌ‚ow of the text: Lorem ipsum dolor sit amet, NASA consectetur adipiscing et. Vestibulum elit pellentesque; ac habitant orci tristique senectus et 4,962 malesuada fames egestas HTML sit lectus. Lorem ipsum dolor sit amet, nasa consectetur adipiscing et. Vestibulum elit pellentesque; ac habitant orci tristique senectus et 4,962 malesuada fames egestas html sit lectus.
  • 69.
    Beautiful Web Typography โ€ข letter-spacing and word-spacing controls tracking and word-spacing respectively. Both take numerical values and normal. Sadly no property for controlling ๏ฌgure variantsโ€” hopes set for CSS3. For now use Georgia which (only) features hanging or โ€˜old-styleโ€™ ๏ฌgures.
  • 70.
    Beautiful Web Typography โ€ข font-size controlsโ€ฆ font sizes. Takes numerical and descriptive values. Most user agents (e.g. browsers) set default value at 16px. Size font sizes relatively using ems or %. An em is a relative unit best to be thought of as a box. It is relative to the point size of a speci๏ฌc font (i.e. 1 em in a 12 point typeface is 12 point).
  • 71.
    Beautiful Web Typography Why? โ€ข Some UAs donโ€™t support font-resizing (Ctrl + +/-) or page scaling when measurements are de๏ฌned in absolute terms. โ€ข JS-based text resize widgets โ‰  text accessibility. โ€ข Many devices and many user agentsโ€”be careful in making assumptions.
  • 72.
    Beautiful Web Typography Key: remember font sizes are inherited: parents โ†’ children. To calculate, ๏ฌnd what one pixel is in ems and then multiply by the desired font size (in pixels): 1 รท parent font-size ร— required pixel value = em value
  • 73.
    Beautiful Web Typography 62.5% trick Simplify your calculations. Consider: p { font-size: 80%; } blockquote { font-size: 80%; } 80% of 16px is 12.8px, so p and blockquote elements will be that size, but what happens when we put a p element inside a blockquote element? The parent (blockquote) is 12.8px so the p will be rendered at 80% of that: 10.42px.
  • 74.
    Beautiful Web Typography 62.5% trick (contโ€™d) In 2004 Richard Rutter wrote an article outlining a trick he used to make these calculations simpler: โ€ข browsers have common default size of 16px; thus: โ€ข set body to 62.5% and reset all to 10px; thus: โ€ข from here calculations are simpler for direct descendants of the body, e.g. 12px = 1.2em; 8px = 0.8em. Further nested elements are (still) relative.
  • 75.
    Beautiful Web Typography To ๏ฌnd an elementโ€™s font size in absolute terms (e.g. pixels) you can use the Firefox โ€˜Web Developerโ€™ plugin: Information โ†’ Display Element Information.
  • 76.
    Beautiful Web Typography Stick it to a scale Donโ€™t just arbitrarily set type; use a scale: 6, 7, 8, 9, 10, 11, 12, 14, 16, 18, 21, 24, 36, 48, 60, 72. the โ€œclassic scaleโ€ 9, 10, 11, 12, 13, another scale 14, 18, 24, 36, 48, 64, 72, 96. 8, 13, 21, 34, 55, scale based on the Fibonacci sequence 89.
  • 77.
    Beautiful Web Typography At small sizes font-decoration: underline; can render descender glyphs (g, j, p, q, y) di๏ฌƒcult to read: use border-bottom: 1px solid; โ€ฆconsectetuer adipiscing elitโ€ฆ โ€ฆadipiscing elitโ€ฆ โ€ฆconsectetuer adipiscing elitโ€ฆ โ€ฆadipiscing elitโ€ฆ
  • 78.
    Beautiful Web Typography Correct glyphs Consider: 1'61" ' "
  • 79.
    Beautiful Web Typography "This is a group of words surrounded by a bunch of tick marks."
  • 80.
    Beautiful Web Typography โ€œThis is a quotation!โ€ - Jeff Croft
  • 81.
    Beautiful Web Typography โ€˜โ€™ โ€œโ€ โ€™
  • 82.
    Beautiful Web Typography - hyphen Mary-Anne, Walter-Strauss โ€“ en dash Aprilโ€“May, ages 3โ€“5, pp. 37โ€“38 โ€” em dash Phrase markerโ€”(generally) not spacedโ€”like so. โ€“ minus 5โ€“4=1
  • 83.
    Beautiful Web Typography โ€œ opening double quote &ldquo; โ€ closing double quote &rdquo; โ€˜ opening single quote &lsquo; โ€™ closing single quote &rsquo; โ€“ en dash &ndash; โ€” em dash &mdash; โˆ’ minus &minus; ร— multiplication &times; โ€ฆ ellipsis &hellip;
  • 84.
    Beautiful Web Typography Smartypants et al. โ€˜Doing something repetitively? Likely youโ€™re doing it wrong.โ€™ Smartypants et al. are parsers that translate plain ASCII characters into โ€œsmartโ€ typographic (x)HTML entities (and beyond just punctuation). โ€ข Smartypants (PHP, Perl, & Movable Type); โ€ข Typogrify (Python/Django); โ€ข wp-Typography (WordPress); โ€ข Markdown, Textile et al., โ€ฆ
  • 85.
    Beautiful Web Typography Give ampersands love Italic ampersand variants are often much prettier than their common roman counterparts: &&&&&& &&&&&&
  • 86.
    Beautiful Web Typography Marking paragraphs (and more) Donโ€™t be afraid to mark new paragraphs with indents, outdents, white-lines, a pilcrow (ยถ) or other ornament (e.g. โฆ), versals, headers &c. โ€ฆor a combination thereof. See: http://tinyurl.com/para-typography.
  • 87.
    Beautiful Web Typography Measures The measure is the length of a single line. It is important to select a good measure for running text. Do this with the width property. Ideally these should be relative to the font size, such that the type scales proportionately to the measure; use ems or percentages.
  • 88.
    Beautiful Web Typography Measures (contโ€™d) Web type generally bene๏ฌts from smaller measures than those in print. A good ballpark is 10โ€“15 words/75โ€“100 characters per line for body copy, single column. Generally use ๏ฌ‚ush-left (text-align: left;) for running text, particularly when set in a narrow measure. Justi๏ฌcation can work at ample measures and better with serif typefaces.
  • 89.
    Beautiful Web Typography Leading (line-height) Donโ€™t forget to set an ample leading for running text! Done using the line-height property and you can use a unit-less number (e.g. 1.5 which acts as a multiplier of the font size); Leading spans from baseline to baselineโ€ฆ and I need some more text to illustrate the point. โ˜บ
  • 90.
    Beautiful Web Typography Hanging punctuation Traditionally punctuation marks, bullets, lists, hyphens, and brackets all hang in the margin. โ€œ Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Integer a odio. Vivamus placerat felis id risus. Cras mollis est. Etiam mollis vulputate ( lorem nullam turpis non massa rhoncus sodales.)โ€
  • 91.
    Beautiful Web Typography Hanging punctuation (contโ€™d) Simply with lists by setting their margins to zero. Possible for opening punctuation marks using background-image or a negative text-indent. CSS 3 will hopefully support hanging punctuation with a proposed hanging-punctuation property. See: http://tinyurl.com/w3c-hanging-punct.
  • 92.
    Beautiful Web Typography Web: text = ui Distinguish content elements from application controls (e.g. a userโ€™s username and description from a logout link or text-๏ฌeld title). Often done with colour (e.g. setting controls gray), size (making them a tad smaller) and with di๏ฌ€erent typefaces or font styles.
  • 93.
  • 94.
  • 95.
    Beautiful Web Typography Page (grid) Grids bring order to your page and help specify where things should go. Remember to put in apt โ€œguttersโ€ (margins between columns) to separate your columns. Ruler guides help enormously: use the Web Developer extension for Firefox or ruler background images (also see the YUI library).
  • 96.
  • 97.
  • 98.
    Beautiful Web Typography Addendum Please donโ€™t use Comic Sans unless you have a very, very good reason for its application.
  • 99.
  • 100.
    Beautiful Web Typography Inspirational typophiles โ€ข Cameron Moll: cameronmoll.com โ€ข Je๏ฌ€ Croft: je๏ฌ€croft.com โ€ข Je๏ฌ€rey Zeldman: zeldman.com โ€ข Mark Boulton: markboulton.co.uk โ€ข Richard Rutter: clagnut.com โ€ข Jon Tan: jontangerine.com
  • 101.
    Beautiful Web Typography Resources & reading โ€ข http://webtypography.net โ€ข http://alistapart.com/topics/design/typography โ€ข http://usabletype.org โ€ข http://ilovetypography.com โ€ข http://www.papress.com/other/thinkingwithtype/
  • 102.
    Thanks! klepas@klepas.org klepas.org @klepas Licensed CC BY -NC-ND http://creativecommons.org/licenses/by-nc-nd/2.5/au/