Sha256: 2286c24df439c4cec9636a7cf71e62310cab36b7746349ba25f4d05f5c8f96e1
Contents?: true
Size: 1.15 KB
Versions: 1
Compression:
Stored size: 1.15 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, :overflow => :ellipses, :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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
davebenvenuti-prawn-0.11.1.pre | examples/text/hyphenation.rb |