Visiblox » Archive for March 2010

Archive for March 2010

Using built-in, embedded and streamed fonts in Silverlight

Monday, March 1st, 2010

Silverlight gives the developer the possibility of completely customizing the developed application in all aspects. Defining fonts used for displaying text is no exception. However there are multiple ways on how to go ahead with specifying fonts to use, this article attempts to summarize the options.

Using built-in fonts

Silverlight comes with some fonts that can be used by default, often referred to as built-in fonts. This naming is not entirely correct as the Silverlight runtime does not contain any fonts. However if the specified font is present on the machine, it can be used by Silverlight. The list of these fonts can be found here.

Even though the list contains about 40 fonts, the selection is different on clients running Windows and those running OS X. The “web safe” list – the fonts that are generally installed on both Windows and OS X – are the following subset: Arial, Arial Black, Comic Sans MS, Courier New, Georgia, Lucia Grande, Lucia Sans Unicode, Times New Roman, Trebuchet and MS Verdana.

To specify a font of the default font types, simply specify the FontFamily property of the visual element:

Hello, World!

(Note that if the specified font can not be found on the client, Silverlight will fall back to the basic font type.)

Application displaying all of the built-in fonts available in Silverlight

To visualize the fonts available in Silverlight I’ve created a small application that lets one play around with the default fonts:

(more…)


Advanced Data Visualisation - Powered by Microsoft® Silverlight™ and WPF
© Scott Logic Limited 2011. All rights reserved. Terms of Use | About Us