1
Vote

Fixing custom fonts for dynamic languages

description

In Silverlight 2 Font URIs being restricted to Assembly resources; I fought against this a while ago in tactics since it breaks dynamic language support, but that didn't seem to startle people :(
 
For clarification, this doesn't work if the .ttf file is in the XAP; it must be an assembly reference.
 
<Glyphs FontUri="foo.ttf">
 
This breaks DLR support (Ruby/Python/JScript) because there are no user-dlls required to make an application. A ugly work-around could be to load a dummy DLL with the necessary resources, though I'm not sure if this works on a non-entry-point DLL.
 
Anyway, I'd like to figure out what I can do to nicely support custom fonts in Silverlight 2, and then what the best solution is to clean this up for the next release. Ideas?
 
http://timheuer.com/blog/archive/2008/03/10/embedding-fonts-in-silverlight-2.aspx

comments

jimmysch wrote Feb 4, 2009 at 11:13 PM

This might work:
<pre> WebClient c = new WebClient(); c.OpenReadCompleted += delegate(object o, OpenReadCompletedEventArgs args) { SomeTextHere.FontSource = new FontSource(args.Result); SomeTextHere.FontFamily = new FontFamily("Tim Heuer Normal"); }; c.OpenReadAsync(new Uri("http://localhost:12296/fonts/timheuer.ttf")); </pre>