Sha256: 25e20b9bd391f2b6e6d839bf70b5445212f72ab8ccf2c5567b9278b7dcd436ce

Contents?: true

Size: 878 Bytes

Versions: 21

Compression:

Stored size: 878 Bytes

Contents

# encoding: utf-8
#
# FIXME: Introducing TTFunk into Prawn broke this example and a cooresponding
# test.  Ticket: #139
#
# Tests passing non utf-8 data into Prawns text function. Should
# be transparently converted to utf-8 and rendered as usual.
# 
# NOTE: only works on ruby1.9 compatible VMs, and requires the current
#       font to include japanese glyphs. On 1.8.x comaptible VMs, an exception
#       will be raised.

require "#{File.dirname(__FILE__)}/../example_helper.rb"

begin
  ruby_19 do  
    datafile = File.join(File.dirname(__FILE__), "..", "..", "data", 
      "shift_jis_text.txt")
    sjis_str = File.open(datafile, "r:shift_jis") { |f| f.gets }

    Prawn::Document.generate("sjis.pdf") do
      font "#{Prawn::BASEDIR}/data/fonts/gkai00mp.ttf"
      text sjis_str
    end       
  end
rescue
  puts "\n FIXME: SJIS Broken due to TTFunk integration."
end

Version data entries

21 entries across 21 versions & 7 rubygems

Version Path
piglop-prawn-0.10.2.3 examples/m17n/sjis.rb
piglop-prawn-0.10.2.2 examples/m17n/sjis.rb
piglop-prawn-0.10.2.1 examples/m17n/sjis.rb
prawn-0.11.1.pre examples/m17n/sjis.rb
goodwill-prawn-edge-0.10.0 examples/m17n/sjis.rb
alphasights-prawn-0.10.4 examples/m17n/sjis.rb
alphasights-prawn-0.10.3 examples/m17n/sjis.rb
alphasights-prawn-0.10.2 examples/m17n/sjis.rb
alphasights-prawn-0.10.1 examples/m17n/sjis.rb
alphasights-prawn-0.10.0 examples/m17n/sjis.rb
prawn-core-0.8.4 examples/m17n/sjis.rb
prawn-graph-0.0.2 vendor/prawn-core/examples/m17n/sjis.rb
prawn-graph-0.0.1 vendor/prawn-core/examples/m17n/sjis.rb
prawn-core-0.7.2 examples/m17n/sjis.rb
prawn-core-0.7.1 examples/m17n/sjis.rb
prawn-layout-0.3.2 vendor/prawn-core/examples/m17n/sjis.rb
prawn-core-0.6.3 examples/m17n/sjis.rb
prawn-core-0.6.2 examples/m17n/sjis.rb
prawn-layout-0.3.1 vendor/prawn-core/examples/m17n/sjis.rb
prawn-core-0.6.1 examples/m17n/sjis.rb