how to Enumerate local fonts in silverlight 4

北城余情 提交于 2019-12-23 19:17:47

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!