Sha256: 6f27055a86374eee6f924672f98a8ca7c17e6d10f8eb888f12c74c4818b65bc0
Contents?: true
Size: 1.12 KB
Versions: 2
Compression:
Stored size: 1.12 KB
Contents
# encoding: utf-8 # require File.expand_path(File.join(File.dirname(__FILE__), %w[.. example_helper])) Prawn::Document.generate("hyphenation.pdf") do def get_string(i) case i when 0 text = "thisissofthyphenatedtext" * 30 when 1 text = "this-is-hard-hyphenated-text-" * 30 when 2 text = "this-is-soft-hard-hyphenated-text-" * 30 end end options = { :width => bounds.width * 0.3, :height => bounds.width * 0.3, :at => [0, 0], :align => :left, :document => self } stroke_color("555555") 3.times do |i| options[:at][0] = (bounds.width - options[:width]) * 0.5 * i options[:at][1] = bounds.height * 0.5 + options[:height] + 50 box = Prawn::Text::Box.new(get_string(i), options) box.render end font("#{Prawn::BASEDIR}/data/fonts/DejaVuSans.ttf") stroke_color("555555") 3.times do |i| options[:at][0] = (bounds.width - options[:width]) * 0.5 * i options[:at][1] = bounds.height * 0.5 - 50 box = Prawn::Text::Box.new(get_string(i), options) box.render end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
prawn-0.12.0 | examples/text/hyphenation.rb |
prawn-0.11.1 | examples/text/hyphenation.rb |