1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
# encoding: utf-8
#
# This example demonstrates using the :style option for Document#text.
# If you are working with TTF fonts, you'll want to check out the
# documentation for Document#font_families and register your fonts with it.
#
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', '..', 'lib'))
require "prawn"
Prawn::Document.generate("family_style.pdf") do
["Courier","Helvetica","Times-Roman"].each do |f|
[:bold,:bold_italic,:italic,:normal].each do |s|
font f, :style => s
text "I'm writing in #{f} (#{s})"
end
end
font "Helvetica"
text "Normal"
text "Bold", :style => :bold
text "Bold Italic", :style => :bold_italic
text "Italic", :style => :italic
text "Normal"
end |