Fonts and Silverlight

Recently I have been working a lot with fonts in Silverlight. Documentation on font support in Silverlight is sparse, so a little blog post series on fonts in general and how to use them in Silverlight.

This is part 1 where I will provide a quick introduction to TrueType, OpenType, Type 1, ClearType, CFF, PostScript outlines, TrueType font collections, obfuscated fonts, and more.

 

Fonts

A little history first; back in the late 1980s, Apple developed the TrueType font format as a competitor to Adobe's Type 1 fonts used in PostScript. Both TrueType and Type 1 fonts are so-called outline fonts, the glyphs are defined using lines and curves. TrueType outlines use quadratic Bezier splines, and Type 1 outlines use cubic Bezier splines.

Microsoft licensed TrueType and included the font in Windows 3.1 in 1992. Microsoft subsequently began modifying the font format to improve performance, remove bugs and add new capabilities such as font smoothing. Microsoft's ongoing development effort includes the TrueType Open specification, which is an extension of the original TrueType font format and works on both Microsoft and Apple platforms.

Version 2 of the TrueType Open format was released in 1997. TrueType Open v2, also called OpenType, is a collaborative effort with Adobe to produce a format capable of containing both TrueType and Type 1 data. OpenType is intended to supersede both TrueType and Type 1 font formats. Today, OpenType is a free, publicly available standard used commonly today on the major computer platforms.

 

Font files

OpenType fonts may contain either TrueType outlines or Type 1 outlines. An OpenType font file with TrueType outlines has file extension .ttf. OpenType fonts with TrueType outlines are also called OpenType (TrueType flavor) or just TrueType. Technically an OpenType font with TrueType outlines is the same as an TrueType font originally developed by Apple, OpenType just adds some additional font data.

OpenType files with Type 1 outlines have .otf as file extension. Type 1 outlines are stored in the font file using Adobe's Compact Font Format (CFF). Terms like OpenType (Postscript), Type 1 OpenType, OpenType Postscript, OpenType CFF all indicate an OpenType font with Type 1 outlines.

But wait, there is more. Multiple OpenType fonts with TrueType outlines may be packaged in a single file. These files are so-called TrueType collections (file extension .ttc). OpenType fonts with Type 1 outlines do not support TrueType collections.

If you are not confused yet, let me continue with obfuscated fonts. Obfuscated fonts are font files that are embedded in documents such as XPS and Microsoft Office 2007 formats. In order to prevent users to install those embedded fonts on their system, the first 32 bytes of the font file are encoded. Obfuscated fonts files are usually identified with file extension .odttf (OpenType with TrueType outlines) or .odttc (True Type collections).

 

ClearType

ClearType is not a font format, it is a rendering technology. ClearType attempts to improve the appearance of text on certain types of computer display screens by sacrificing color fidelity for additional intensity variation. ClearType support for text rendering was introduced with Silverlight 3 RTW in July 2009. There is no need to enable ClearType, it just works.

 

Silverlight

Silverlight supports both TrueType outlines and Type 1 outlines. OpenType fonts stored in single font files and TrueType collections are supported. Obfuscated fonts are also supported (as long as you follow the rules, more on that in the next blog post).

In short, Silverlight supports;

  • .ttf, OpenType with TrueType outlines (TrueType)
  • .otf, OpenType with Type 1 outlines
  • .ttc, TrueType Collection
  • .odtff, Obfuscated TrueType
  • .odttc, Obfuscated TrueType Collection

When Silverlight is installed, it doesn't install any fonts, it uses the fonts that are already installed on the client system. If you want to use a particular font in your Silverlight application you can package the font with your application. More on that in the next blog post.

 

More information.

I have barely scraped the surface on fonts here. If you want to learn more about fonts I highly recommend the following links:

 

 

Published: January 6, 2010

4 Comments

  1. KJ said: says:

    Hi,

    afaik SL3 comes with 9 fonts (arial,arial black,comic sans ms, courier new, georgia, lucida grande/sans,times new roman, trebuchet and verdana) and only in SL4 you have the abbility to use fonts installed on the clientcomputer (you can always a font ofcoures).

    Cheers,

    KJ

  2. Koen said: says:

    KJ, that's not entirely true. SL2 supports those 9 fonts, SL3 supports a lot more and in SL4 you can use all appearantly. In all cases no fonts are installed by Silverlight. More details in my next post.

  3. Pavanaja U B said: says:

    Opentype fonts are mainly needed for Indian languages. AFAIK, Silverlight does not render the Indic opentype fonts. Atmost it displays the glyphs, but does not apply the opetype layout tables, ie., glyph substitution, glyph positioning, etc does not happen. Please clarify.

    -Pavanaja

  4. Koen said: says:

    Pavananja: I do not know whether Silverlight supports all OpenType features for glyph rendering, but I do know that OpenType fonts are not just needed for Indian languages. I hope to provide more details in a next blog post.

 

Leave a comment

Comments are closed for this post