none
Fonts in Silverlight

    Question

  • Hi!

    Just a quick question about fonts: Do I get it right that there are a bunch of fonts (8) built into the Silverlight plugin, and that the user do not need to have them installed in the OS?

    On MSDN I can read:

    Supported Local Fonts

    Text elements in Silverlight can use a subset of the fonts on the client computer. The following illustration shows the Latin fonts that Silverlight text elements can use from the local computer.

    Then follows a list:

    • Arial
    • Arial Black
    • Comic Sans MS
    • Courier New
    • Lucinda Grande/Lucinda Sans Unicode
    • Times New Roman
    • Trebuchet MS
    • Verdana

    Source: http://msdn.microsoft.com/en-us/library/cc189010(VS.95).aspx

    It is the “that Silverlight text elements can use from the local computer” that confuses me…

     

    Monday, August 25, 2008 3:00 AM

Answers

  • The fonts identified in the documentation were chosen based upon them being considered "web safe fonts" (http://en.wikipedia.org/wiki/Web-safe_fonts). Regarding the question of "why only these?" Well performance of startup is the primary reason. Since Silverlight uses a brand new text engine that doesn't rely on GDI it has to read all the fonts on your computer to know that FontFamily="Arial" maps to a specific file. This is done when Silverlight is first asked to render some text. In some cases in Silverlight 1.0 this "startup" cost on Vista was 3 seconds due to the additional language support the fonts in Vista has. We opted to only enumerate the fonts that are consider "web safe fonts" to keep this startup cost next to nothing.

    If a computer is missing a whole font family (say Arial) we perform fallback to the next font family in our list or in the FontFamily attribute (if you specify a fallback). Let me know if you have more questions.

    -mark
    Silverlight Program Manager
    Microsoft
    This post is provided "as-is"

    Monday, August 25, 2008 9:09 PM

All replies

  • Hi.

    If these fonts are already there in your local system then silverlight Can use them .so there is no need to embed any such font .

    But if those are not there or you want to use some external font you can embed them in your Silverlight Project .xap file and while rendering you can use those fonts after loading those..

     

    Mark this as answer if it answers your Question..

    Monday, August 25, 2008 3:07 AM
  • So, you mean those fonts in the list (Arial...Verdana) are NOT built into the Silverlight plugin? That is, the users need to have them already installed in their OS?

    I'm really confused about this. When reading posts about fonts here on the forums, I've always gotten the impression that these 8 fonts were included in Silverlight so that I can be sure that the users will see them correctly regardless of which fonts they have installed on their computer.

    If that is not the case, why even bother making a list with fonts?
     

    Monday, August 25, 2008 3:37 AM
  • As the most of win users have those fonts in their OS, it's not a good idea to add those 8 fonts to Silverlight Application or runtime.

     

    Monday, August 25, 2008 8:18 AM
  • But why highlight these fonts then, if they are not included in the plugin? What makes them special?

    Are these the ONLY fonts I can use of the ones that are installed on the clients? That is, even if the user has other fonts installed I still can't use them (unless I embed them)?

    As the most of win users have those fonts in their OS...

    I thought the whole point was to make Silverlight equally accessible in both Mac and Win (or any other supported OS)... 

    Monday, August 25, 2008 8:23 AM
  •  Are youi sure Mac computer don't have those fonts?

    Ref: http://www.msfrontpage.net/fp/ans-standardfonts.htm

    Microsoft Fonts on the Web (for Mac, Win3.x/95/NT)

    • Arial
    • Arial Black
    • Comic Sans MS
    • Courier New
    • Georgia
    • Impact
    • Times New Roman
    • Trebuchet MS
    • Verdana
    I never use Mac before but I think those fonts are available in Mac too.
    Monday, August 25, 2008 8:34 AM
  • Hi.

    I think main concept behind not adding any font is to keep silverlight plugin of small size only.Windows machine is already having these fonts.So

    If they will give all these things then plugin will not be light so it is always better to reuse them.

    If you want you can include fonts in your xap file and use them....

    Monday, August 25, 2008 9:06 AM
  • Are youi sure Mac computer don't have those fonts?

    I have no idea. Maybe these fonts are choosen because they are installed by default on both Win and Mac? And to ensure that your Silverlight app looks as you expect in the users browser, Silverlight restricts you to only use those fonts...

    But I don't think that makes much sense. Why highlight those fonts so much, and restrict use to only those fonts (unless embedding)? I mean, there must still be some mechanism to handle missing fonts. Even if those fonts are installed by default, someone might have uninstalled them. No very likely maybe, but not impossible. I believe there is support to specify several font in the FontFamily property by separating them with commas (I think I saw it in the video called "Using Custom Fonts in Silverlight" by Tim Heuer).

    Monday, August 25, 2008 9:14 AM
  • I am using a font named "Square721 BT".
    I Have a copy of the font file "Square721.TTF" in my folder, and XAML as follows:-

    <TextBlock x:Name="p1lab1" Canvas.Top ="58" FontFamily="Square721.TTF#Square721 BT" Text="Name Of The Track Playing" Canvas.Left="0"  FontSize="11" Foreground="lightblue"  />

    Method seems to work fine with any font file!

    Regards
    Marc.

    Monday, August 25, 2008 11:21 AM
  • The fonts identified in the documentation were chosen based upon them being considered "web safe fonts" (http://en.wikipedia.org/wiki/Web-safe_fonts). Regarding the question of "why only these?" Well performance of startup is the primary reason. Since Silverlight uses a brand new text engine that doesn't rely on GDI it has to read all the fonts on your computer to know that FontFamily="Arial" maps to a specific file. This is done when Silverlight is first asked to render some text. In some cases in Silverlight 1.0 this "startup" cost on Vista was 3 seconds due to the additional language support the fonts in Vista has. We opted to only enumerate the fonts that are consider "web safe fonts" to keep this startup cost next to nothing.

    If a computer is missing a whole font family (say Arial) we perform fallback to the next font family in our list or in the FontFamily attribute (if you specify a fallback). Let me know if you have more questions.

    -mark
    Silverlight Program Manager
    Microsoft
    This post is provided "as-is"

    Monday, August 25, 2008 9:09 PM
  • Thanks for clarifying this for me Mark. It makes a whole lot more sense to me now! :) 

    Tuesday, August 26, 2008 2:14 AM
  •  Very thorough explanation, thanks for the writeup!  I was curious about this myself, so I'm glad that someone asked the question.

    Tuesday, August 26, 2008 11:20 AM
  • If fallback mechanism is used, then WYSIWYG is lost. So to make sure end user sees what is intended, we need to embed supported fonts as well.
    Moreover, is there a way to know whether a font is Web-safe or not? Otherwise, one has to always refer to the list provided in Silverlight documentation.

    "Quote: In some cases in Silverlight 1.0 this "startup" cost on Vista was 3 seconds due to the additional language support the fonts in Vista has."

    On the other side of the coin, we need to embed/copy all non-supported fonts to server. This means even if user has those fonts on local machine still Silverlight will go to server for those fonts, which means there will be additional time taken.

    I think, either all the local fonts should be supported (that is what Flash Plugin does with dynamic text) or none. At most there can be a setting in Silverlight Plugin (through Silverlight.createObject()) to support only WebSafe fonts or all local fonts. This way developer knows there will be additional cost if all local fonts are to be supported.

    Thursday, September 25, 2008 4:21 AM