How many fonts are available in Prawn?

别来无恙 提交于 2020-01-01 02:35:06

问题


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 aren't?


回答1:


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 ]



回答2:


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.



来源:https://stackoverflow.com/questions/5599904/how-many-fonts-are-available-in-prawn

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