Sha256: 4e754c1591043a08a9c4db7a3086eaefe4e9c3dba17a2015de8ddbed3ecab9d2

Contents?: true

Size: 892 Bytes

Versions: 2

Compression:

Stored size: 892 Bytes

Contents

# encoding: utf-8
#
# This example shows the many ways of setting font sizes in Prawn
#
require File.expand_path(File.join(File.dirname(__FILE__),
                                   %w[.. example_helper]))

Prawn::Document.generate "font_size.pdf", :page_size => "A4" do

  # Explicit global changes
  font 'Helvetica'
  self.font_size = 16

  text 'Font at 16 point'

  # Transactional changes rolled back after block exit
  font_size 9 do
    text 'Font at 9 point'
    # single line changes, not persisted.
    text 'Font at manual override 20 point', :size => 20
    text 'Font at 9 point'
  end

  # Transactional changes rolled back after block exit on full fonts.
  font("Times-Roman", :style => :italic, :size => 12) do
    text "Font in times at 12"
    font_size(16) { text "Font in Times at 16" }
  end

  text 'Font at 16 point'

  font "Courier", :size => 40
  text "40 pt!"
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
prawn-0.11.1 examples/text/font_size.rb
davebenvenuti-prawn-0.11.1.pre examples/text/font_size.rb