[英]Get list of supported fonts in ITextSharp
I'm working with ITextSharp for a project and am looking for a reasonable way to get a string list of different fonts it has available for use. 我正在使用ITextSharp进行项目,我正在寻找一种合理的方法来获取可供使用的不同字体的字符串列表。
I thought maybe I could just use reflection and loop over a class of available fonts, but there does not seem to be an easy way to do this. 我想也许我可以只使用反射并循环一类可用的字体,但似乎没有一种简单的方法来做到这一点。 What I really want to do is provide a drop down of available/supported fonts for my users to select from
我真正想要做的是提供可供/支持的字体下拉供我的用户选择
Does anyone have any thoughts on how I might accomplish this? 有没有人对我如何做到这一点有任何想法?
This webpage has a great reference for how to work with the 14 embedded fonts in iTextSharp, as well as how to embed and use any fonts of your choosing. 这个网页有一个很好的参考,如何使用iTextSharp中的14种嵌入字体,以及如何嵌入和使用您选择的任何字体。
To get the list of fonts included in iTextSharp: 要获取iTextSharp中包含的字体列表:
Dim myCol As ICollection
//Returns the list of all font families included in iTextSharp.
myCol = iTextSharp.text.FontFactory.RegisteredFamilies
//Returns the list of all fonts included in iTextSharp.
myCol = iTextSharp.text.FontFactory.RegisteredFonts
An example of a font family is Helvetica. Helvetica是一个字体系列的例子。 An example of a font is Helvetica-Bold or Helvetica-Italic.
字体的一个例子是Helvetica-Bold或Helvetica-Italic。
First call FontFactory.RegisterDirectories(); 首先调用FontFactory.RegisterDirectories(); to get all fonts on the system registered.
获取系统上注册的所有字体。
Then call FontFactory.RegisteredFonts; 然后调用FontFactory.RegisteredFonts; to get all the fonts.
获得所有字体。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.