vendor/gems/prawn-0.3.0/lib/prawn/font.rb
# Hash that maps font family names to their styled individual font names
#  
# To add support for another font family, append to this hash, e.g:
#
#   pdf.font_families.update(
#    "MyTrueTypeFamily" => { :bold        => "foo-bold.ttf", 
#                            :italic      => "foo-italic.ttf",
#                            :bold_italic => "foo-bold-italic.ttf",
#                            :normal      => "foo.ttf" })
#
# This will then allow you to use the fonts like so:
#
#   pdf.font("MyTrueTypeFamily", :style => :bold)   
#   pdf.text "Some bold text"
#   pdf.font("MyTrueTypeFamily")
#   pdf.text "Some normal text"
#
# This assumes that you have appropriate TTF fonts for each style you 
# wish to support.
#                                                  
Hash that maps font family names to their styled individual font names
To add support for another font family, append to this hash, e.g.



This will then allow you to use the fonts like so.



This assumes that you have appropriate TTF fonts for each style you
wish to support.
Hash that maps font family names to their styled individual font names To add support for another font family append to this hash e . g . This will then allow you to use the fonts like so . This assumes that you have appropriate TTF fonts for each style you wish to support .
def font_families 
      @font_families ||= Hash.new { |h,k| h[k] = {} }.merge!(      
        { "Courier"     => { :bold        => "Courier-Bold",
                             :italic      => "Courier-Oblique",
                             :bold_italic => "Courier-BoldOblique",
                             :normal      => "Courier" },       
          "Times-Roman" => { :bold         => "Times-Bold",
                             :italic       => "Times-Italic",
                             :bold_italic  => "Times-BoldItalic",
                             :normal       => "Times-Roman" },        
          "Helvetica"   => { :bold         => "Helvetica-Bold",
                             :italic       => "Helvetica-Oblique",
                             :bold_italic  => "Helvetica-BoldOblique",
                             :normal       => "Helvetica" }        
        }) 
    end
def font_families @font_families ||= Hash . new { | h , k | h [ k ] = { } } . merge! ( { "Courier" => { :bold => "Courier-Bold" , :italic => "Courier-Oblique" , :bold_italic => "Courier-BoldOblique" , :normal => "Courier" } , "Times-Roman" => { :bold => "Times-Bold" , :italic => "Times-Italic" , :bold_italic => "Times-BoldItalic" , :normal => "Times-Roman" } , "Helvetica" => { :bold => "Helvetica-Bold" , :italic => "Helvetica-Oblique" , :bold_italic => "Helvetica-BoldOblique" , :normal => "Helvetica" } } ) end
Hash that maps font family names to their styled individual font names
To add support for another font family, append to this hash, e.g:
Hash that maps font family names to their styled individual font names To add support for another font family append to this hash e . g :