Sha256: 5bb6b155d17ec7524bc1f7b18e5b80cc861f66c28359bff44173d7a85bffd983

Contents?: true

Size: 809 Bytes

Versions: 1

Compression:

Stored size: 809 Bytes

Contents

# frozen_string_literal: true

# Most font families come with some styles other than normal. Most common are
# <code>bold</code>, <code>italic</code> and <code>bold_italic</code>.
#
# The style can be set the using the <code>:style</code> option, with either the
# <code>font</code> method which will set the font and style for rest of the
# document, or with the inline text methods.

require_relative '../example_helper'

filename = File.basename(__FILE__).gsub('.rb', '.pdf')
Prawn::ManualBuilder::Example.generate(filename) do
  fonts = %w[Courier Helvetica Times-Roman]
  styles = %i[bold bold_italic italic normal]

  fonts.each do |example_font|
    move_down 20

    styles.each do |style|
      font example_font, style: style
      text "I'm writing in #{example_font} (#{style})"
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
prawn-2.4.0 manual/text/font_style.rb