开发者

How many fonts are available in Prawn?

开发者 https://www.devze.com 2023-02-22 22:05 出处:网络
I\'ve been randomly trying fonts in Prawn, for Ruby. For Example: Times New Roman - Yes Palatino Linotype - No

I've been randomly trying fonts in Prawn, for Ruby.

For Example: Times New Roman - Yes Palatino Linotype - No

Is there a list of which fonts are available and which开发者_C百科 aren't?


There's a list of default fonts in the code, at lib/prawn/font/afm.rb (version 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 ]


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消