Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How many fonts are available in Prawn?

Tags:

prawn

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?

like image 317
Ray301 Avatar asked Apr 08 '11 19:04

Ray301


2 Answers

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.

like image 188
James Healy Avatar answered Oct 25 '22 21:10

James Healy


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 ]
like image 27
sockmonk Avatar answered Oct 25 '22 23:10

sockmonk