【问题标题】:Get list of supported fonts in ITextSharp获取 ITextSharp 中支持的字体列表
【发布时间】:2011-01-02 22:10:29
【问题描述】:

我正在为一个项目使用 ITextSharp,并且正在寻找一种合理的方法来获取它可以使用的不同字体的字符串列表。

我想也许我可以只使用反射并在一类可用字体上循环,但似乎没有一种简单的方法可以做到这一点。我真正想做的是为我的用户提供可用/支持字体的下拉列表以供选择

有人对我如何实现这一点有任何想法吗?

【问题讨论】:

    标签: c# fonts itextsharp


    【解决方案1】:

    这个webpage 对如何使用 iTextSharp 中的 14 种嵌入字体以及如何嵌入和使用您选择的任何字体提供了很好的参考。

    获取 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
    

    字体系列的一个例子是 Helvetica。字体的一个示例是 Helvetica-Bold 或 Helvetica-Italic。

    【讨论】:

      【解决方案2】:

      首先调用 FontFactory.RegisterDirectories();注册系统上的所有字体。

      然后调用 FontFactory.RegisteredFonts;获取所有字体。

      【讨论】:

        猜你喜欢
        • 2010-11-29
        • 2012-01-11
        • 1970-01-01
        • 1970-01-01
        • 2020-01-21
        • 2013-01-15
        • 2021-10-17
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多