问题
I heard about silverlight 4 can use local fonts. So, is there a way fo enumerate them? I just want to have them shown into a listbox.
回答1:
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.
回答2:
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.
来源:https://stackoverflow.com/questions/2673447/how-to-enumerate-local-fonts-in-silverlight-4