Sha256: c33f60a5e28f5b224196f68846815da2d76aae7572585d1bfe25917813a4719b

Contents?: true

Size: 1.13 KB

Versions: 8

Compression:

Stored size: 1.13 KB

Contents

# encoding: utf-8
#
# The <code>font_size</code> method works just like the <code>font</code>
# method.
#
# In fact we can even use <code>font</code> with the <code>:size</code> option
# to declare which size we want.
#
# Another way to change the font size is by supplying the <code>:size</code>
# option to the text methods.
#
# The default font size is <code>12</code>.
#
require File.expand_path(File.join(File.dirname(__FILE__),
                                   %w[.. example_helper]))

filename = File.basename(__FILE__).gsub('.rb', '.pdf')
Prawn::ManualBuilder::Example.generate(filename) do
  text "Let's see which is the current font_size: #{font_size.inspect}"

  move_down 10
  font_size 16
  text "Yeah, something bigger!"

  move_down 10
  font_size(25) { text "Even bigger!" }

  move_down 10
  text "Back to 16 again."

  move_down 10
  text "Single line on 20 using the :size option.", :size => 20

  move_down 10
  text "Back to 16 once more."

  move_down 10
  font("Courier", :size => 10) do
    text "Yeah, using Courier 10 courtesy of the font method."
  end

  move_down 10
  font("Helvetica", :size => 12)
  text "Back to normal"
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
prawn-2.1.0 manual/text/font_size.rb
prawn-git-2.0.1 manual/text/font_size.rb
prawn-2.0.2 manual/text/font_size.rb
prawn-2.0.1 manual/text/font_size.rb
prawn-2.0.0 manual/text/font_size.rb
prawn-1.3.0 manual/text/font_size.rb
prawn-1.2.1 manual/text/font_size.rb
prawn-1.1.0 manual/text/font_size.rb