how to Enumerate local fonts in silverlight 4
I heard about silverlight 开发者_如何学Python4 can use local fonts. So, is there a way fo enumerate them? I just want to have them shown into a listbox.
Use the SystemTypefaces
static property of the System.Windows.Media.Fonts
class. This provides a collection go Typeface
objects listing the set of fonts found in the system font folder.
I struggled with the same issue.
I ended up using Fonts.SystemFontFamilies
on the SERVER (in the PresentationCore dll), and then sending a list of strings (from the Source
property) to the Silverlight app. On my machine, sending 236 font names with a service call is about 8 KB, which is not that bad.
Yes, the client might not have all the fonts installed on his machine, but this is the best I could find.
精彩评论