11

我一直在为 Ruby 随机尝试 Prawn 中的字体。

例如:Times New Roman - 是 Palatino Linotype - 否

有哪些字体可用哪些不可用的列表吗?

4

2 回答 2

18

代码中有一个默认字体列表,位于 lib/prawn/font/afm.rb(版本 1.0.0.rc1):

module Prawn
  class Font
    class AFM < Font
      BUILT_INS = %w[ Courier Helvetica Times-Roman Symbol ZapfDingbats
                      Courier-Bold Courier-Oblique Courier-BoldOblique
                      Times-Bold Times-Italic Times-BoldItalic
                      Helvetica-Bold Helvetica-Oblique Helvetica-BoldOblique ]
于 2013-02-01T00:35:47.100 回答
10

14 fonts are available by default: Courier, Helvetica, Symbol, Times and ZapfDingbats in various bold and italic forms.

In nearly every case I'd recommend using the font() method to load an external truetype font of your choosing. This has the added benefit of give you the option to use non latin characters.

Short answer: there's no list, just use TTF.

于 2011-04-13T12:50:29.033 回答