Class: C12::PDF::Document
- Inherits:
-
Prawn::Document
- Object
- Prawn::Document
- C12::PDF::Document
- Defined in:
- lib/c12-commons/pdf.rb
Instance Method Summary collapse
-
#change_font(font = :default, size = 10) ⇒ Object
Sets the current font of the document.
Instance Method Details
#change_font(font = :default, size = 10) ⇒ Object
Sets the current font of the document. Font names are predefined. All of them are Georgian-character friendly fonts.
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/c12-commons/pdf.rb', line 20 def change_font(font = :default, size = 10) case font.to_s when 'default' ff = 'DejaVuSans' when 'bold' ff = 'DejaVuSans-Bold' when 'italic' ff = 'DejaVuSans-Oblique' when 'bold-italic' ff = 'DejaVuSans-BoldOblique' when 'serif' ff = 'DejaVuSerif' when 'serif-italic' ff = 'DejaVuSerif-Italic' when 'serif-bold' ff = 'DejaVuSerif-Bold' when 'serif-bold-italic' ff = 'DejaVuSerif-BoldItalic' else ff = 'DejaVuSans' end #pdf.font "#{Prawn::BASEDIR}/data/fonts/DejaVuSans.ttf" self.font File.("../pdf-assets/#{ff}.ttf", __FILE__), :size => size end |