[DRE-commits] [SCM] ruby-prawn.git branch, master, updated. upstream/1.0.0_rc1-44-g6e97afc
Cédric Boutillier
cedric.boutillier at gmail.com
Thu Nov 24 23:12:00 UTC 2011
The following commit has been merged in the master branch:
commit 47756c248bffe70d2d65733c597187e6909ca825
Author: Cédric Boutillier <cedric.boutillier at gmail.com>
Date: Thu Nov 17 00:02:22 2011 +0100
patch: use system truetype fonts
diff --git a/debian/control b/debian/control
index 7172d3f..0087c54 100644
--- a/debian/control
+++ b/debian/control
@@ -4,7 +4,7 @@ Priority: optional
Maintainer: Debian Ruby Extras Maintainers <pkg-ruby-extras-maintainers at lists.alioth.debian.org>
Uploaders: Gunnar Wolf <gwolf at debian.org>, Cédric Boutillier <cedric.boutillier at gmail.com>
DM-Upload-Allowed: yes
-Build-Depends: debhelper (>= 7.0.50~), gem2deb (>= 0.2.10~), ruby-test-spec, ruby-pdf-inspector (>= 1.0.1~), ruby-mocha, ruby-ttfunk (>= 1.0.2)
+Build-Depends: debhelper (>= 7.0.50~), gem2deb (>= 0.2.10~), ruby-test-spec, ruby-pdf-inspector (>= 1.0.1~), ruby-mocha, ruby-ttfunk (>= 1.0.2), ttf-dejavu-core, fonts-arphic-gkai00mp
Standards-Version: 3.9.2
Vcs-Git: git://git.debian.org/pkg-ruby-extras/ruby-prawn.git
Vcs-Browser: http://git.debian.org/?p=pkg-ruby-extras/ruby-prawn.git;a=summary
@@ -15,6 +15,7 @@ Package: ruby-prawn
Architecture: all
XB-Ruby-Versions: ${ruby:Versions}
Depends: ${shlibs:Depends}, ${misc:Depends}, ruby | ruby-interpreter, ruby-pdf-reader (>= 0.9.0), ruby-ttfunk (>= 1.0.2), ruby-pdf-inspector (>= 1.0.1)
+Suggests: ttf-dejavu-core, fonts-arphic-gkai00mp
Replaces: libprawn-ruby1.8 (<< 1.0.0~rc1-1~), libprawn-ruby1.9.1 (<< 1.0.0~rc1-1~), libprawn-ruby (<< 1.0.0~rc1-1~), libprawn-ruby-common (<< 1.0.0~rc1-1~)
Breaks: libprawn-ruby1.8 (<< 1.0.0~rc1-1~), libprawn-ruby1.9.1 (<< 1.0.0~rc1-1~), libprawn-ruby (<< 1.0.0~rc1-1~), libprawn-ruby-common (<< 1.0.0~rc1-1~)
Provides: libprawn-ruby1.8, libprawn-ruby1.9.1, libprawn-ruby, libprawn-ruby-common
diff --git a/debian/patches/0400_use_system_fonts.patch b/debian/patches/0400_use_system_fonts.patch
new file mode 100644
index 0000000..c7b96b3
--- /dev/null
+++ b/debian/patches/0400_use_system_fonts.patch
@@ -0,0 +1,274 @@
+--- a/spec/line_wrap_spec.rb
++++ b/spec/line_wrap_spec.rb
+@@ -51,7 +51,7 @@
+ end
+
+ it "should break on zero-width space" do
+- @pdf.font("#{Prawn::DATADIR}/fonts/DejaVuSans.ttf")
++ @pdf.font("/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf")
+ array = [{ :text => "hello#{Prawn::Text::ZWSP}world" }]
+ @arranger.format_array = array
+ string = @line_wrap.wrap_line(:arranger => @arranger,
+@@ -61,7 +61,7 @@
+ end
+
+ it "should not display zero-width space" do
+- @pdf.font("#{Prawn::DATADIR}/fonts/DejaVuSans.ttf")
++ @pdf.font("/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf")
+ array = [{ :text => "hello#{Prawn::Text::ZWSP}world" }]
+ @arranger.format_array = array
+ string = @line_wrap.wrap_line(:arranger => @arranger,
+@@ -116,7 +116,7 @@
+ expected.force_encoding("utf-8") if "".respond_to?(:force_encoding)
+ string.should == expected
+
+- @pdf.font("#{Prawn::DATADIR}/fonts/DejaVuSans.ttf")
++ @pdf.font("/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf")
+ @line_wrap = Prawn::Core::Text::Formatted::LineWrap.new
+
+ string = "hello#{Prawn::Text::SHY}world"
+@@ -137,7 +137,7 @@
+ :document => @pdf)
+ string.should == "helloworld"
+
+- @pdf.font("#{Prawn::DATADIR}/fonts/DejaVuSans.ttf")
++ @pdf.font("/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf")
+ @line_wrap = Prawn::Core::Text::Formatted::LineWrap.new
+
+ string = "hello#{Prawn::Text::SHY}world"
+@@ -166,7 +166,7 @@
+ :document => @pdf)
+ string.should == "hello"
+
+- @pdf.font("#{Prawn::DATADIR}/fonts/DejaVuSans.ttf")
++ @pdf.font("/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf")
+ @line_wrap = Prawn::Core::Text::Formatted::LineWrap.new
+ enough_width_for_hello_world = 68
+
+@@ -205,7 +205,7 @@
+ expected.force_encoding("utf-8") if "".respond_to?(:force_encoding)
+ string.should == expected
+
+- @pdf.font("#{Prawn::DATADIR}/fonts/DejaVuSans.ttf")
++ @pdf.font("/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf")
+ @line_wrap = Prawn::Core::Text::Formatted::LineWrap.new
+
+ string = "hello#{Prawn::Text::SHY}-"
+--- a/spec/text_spec.rb
++++ b/spec/text_spec.rb
+@@ -257,9 +257,11 @@
+ lambda { @pdf.font "Pao bu" }.should.raise(Prawn::Errors::UnknownFont)
+ end
+
++ # replace non-free comicsans.ttf by system DejaVuSans.ttf (Debian patch)
+ it "should not raise an exception when providing Pathname instance as font" do
+ lambda {
+- @pdf.font Pathname.new("#{Prawn::DATADIR}/fonts/comicsans.ttf")
++ # @pdf.font Pathname.new("#{Prawn::DATADIR}/fonts/comicsans.ttf")
++ @pdf.font Pathname.new("/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf")
+ }.should.not.raise(Prawn::Errors::UnknownFont)
+ end
+
+@@ -274,7 +276,7 @@
+
+ it "should correctly render a utf-8 string when using a TTF font" do
+ str = "©" # copyright symbol
+- @pdf.font "#{Prawn::DATADIR}/fonts/DejaVuSans.ttf"
++ @pdf.font "/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf"
+ @pdf.text str
+
+ # grab the text from the rendered PDF and ensure it matches
+@@ -317,7 +319,7 @@
+ it "should not raise an exception when a shift-jis string is rendered" do
+ datafile = "#{Prawn::DATADIR}/shift_jis_text.txt"
+ sjis_str = File.open(datafile, "r:shift_jis") { |f| f.gets }
+- @pdf.font("#{Prawn::DATADIR}/fonts/gkai00mp.ttf")
++ @pdf.font("/usr/share/fonts/truetype/arphic-gkai00mp/gkai00mp.ttf")
+ lambda { @pdf.text sjis_str }.should.not.raise(
+ Prawn::Errors::IncompatibleStringEncoding)
+ end
+--- a/spec/text_spacing_spec.rb
++++ b/spec/text_spacing_spec.rb
+@@ -42,7 +42,7 @@
+ #
+ it "should calculate character spacing widths by characters, not bytes" do
+ create_pdf
+- @pdf.font("#{Prawn::DATADIR}/fonts/gkai00mp.ttf")
++ @pdf.font("/usr/share/fonts/truetype/arphic-gkai00mp/gkai00mp.ttf")
+
+ str = "こんにちは世界"
+ @pdf.character_spacing(0) do
+--- a/spec/formatted_text_box_spec.rb
++++ b/spec/formatted_text_box_spec.rb
+@@ -21,7 +21,7 @@
+ it "should not raise Encoding::CompatibilityError when keeping a TTF and an " +
+ "AFM font together" do
+ ruby_19 do
+- file = "#{Prawn::DATADIR}/fonts/gkai00mp.ttf"
++ file = "/usr/share/fonts/truetype/arphic-gkai00mp/gkai00mp.ttf"
+ @pdf.font_families["Kai"] = {
+ :normal => { :file => file, :font => "Kai" }
+ }
+@@ -121,7 +121,7 @@
+ "a Chinese font and set of Chinese glyphs not in the current font" do
+ it "should change the font to the Chinese font for the Chinese glyphs" do
+ create_pdf
+- file = "#{Prawn::DATADIR}/fonts/gkai00mp.ttf"
++ file = "/usr/share/fonts/truetype/arphic-gkai00mp/gkai00mp.ttf"
+ @pdf.font_families["Kai"] = {
+ :normal => { :file => file, :font => "Kai" }
+ }
+@@ -149,7 +149,7 @@
+ "an AFM font and Win-Ansi glyph not in the current Chinese font" do
+ it "should change the font to the AFM font for the Win-Ansi glyph" do
+ create_pdf
+- file = "#{Prawn::DATADIR}/fonts/gkai00mp.ttf"
++ file = "/usr/share/fonts/truetype/arphic-gkai00mp/gkai00mp.ttf"
+ @pdf.font_families["Kai"] = {
+ :normal => { :file => file, :font => "Kai" }
+ }
+@@ -178,7 +178,7 @@
+ "level font" do
+ it "should use the fragment level font except for glyphs not in that font" do
+ create_pdf
+- file = "#{Prawn::DATADIR}/fonts/gkai00mp.ttf"
++ file = "/usr/share/fonts/truetype/arphic-gkai00mp/gkai00mp.ttf"
+ @pdf.font_families["Kai"] = {
+ :normal => { :file => file, :font => "Kai" }
+ }
+@@ -205,7 +205,7 @@
+ describe "Text::Formatted::Box" do
+ before(:each) do
+ create_pdf
+- file = "#{Prawn::DATADIR}/fonts/gkai00mp.ttf"
++ file = "/usr/share/fonts/truetype/arphic-gkai00mp/gkai00mp.ttf"
+ @pdf.font_families["Kai"] = {
+ :normal => { :file => file, :font => "Kai" }
+ }
+--- a/spec/font_spec.rb
++++ b/spec/font_spec.rb
+@@ -24,7 +24,7 @@
+ it "should exclude newlines" do
+ create_pdf
+ # Use a TTF font that has a non-zero width for \n
+- @pdf.font("#{Prawn::DATADIR}/fonts/gkai00mp.ttf")
++ @pdf.font("/usr/share/fonts/truetype/arphic-gkai00mp/gkai00mp.ttf")
+
+ @pdf.width_of("\nhello world\n").should ==
+ @pdf.width_of("hello world")
+@@ -253,15 +253,19 @@
+ end
+
+ it "should return true when present in a TTF font" do
+- font = @pdf.find_font("#{Prawn::DATADIR}/fonts/Activa.ttf")
++ # replace non-free Activa.ttf by system DejaVuSans.ttf (Debian patch)
++ # font = @pdf.find_font("#{Prawn::DATADIR}/fonts/Activa.ttf")
++ font = @pdf.find_font("/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf")
+ font.glyph_present?("H").should.be true
+ end
+
+ it "should return false when absent in a TTF font" do
+- font = @pdf.find_font("#{Prawn::DATADIR}/fonts/Activa.ttf")
++ # replace non-free Activa.ttf by system DejaVuSans.ttf (Debian patch)
++ # font = @pdf.find_font("#{Prawn::DATADIR}/fonts/Activa.ttf")
++ font = @pdf.find_font("/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf")
+ font.glyph_present?("再").should.be false
+
+- font = @pdf.find_font("#{Prawn::DATADIR}/fonts/gkai00mp.ttf")
++ font = @pdf.find_font("/usr/share/fonts/truetype/arphic-gkai00mp/gkai00mp.ttf")
+ font.glyph_present?("€").should.be false
+ end
+ end
+@@ -270,7 +274,9 @@
+
+ setup do
+ create_pdf
+- @activa = @pdf.find_font "#{Prawn::DATADIR}/fonts/Activa.ttf"
++ # replace non-free Activa.ttf by system DejaVuSans.ttf (Debian patch)
++ # @activa = @pdf.find_font "#{Prawn::DATADIR}/fonts/Activa.ttf"
++ @activa = @pdf.find_font "/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf"
+ end
+
+ it "should calculate string width taking into account accented characters" do
+@@ -336,7 +342,7 @@
+ it "should allow TTF fonts to be used alongside document transactions" do
+ lambda {
+ Prawn::Document.new do
+- font "#{Prawn::DATADIR}/fonts/DejaVuSans.ttf"
++ font "/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf"
+ text "Hi there"
+ transaction { text "Nice, thank you" }
+ end
+@@ -346,7 +352,7 @@
+ it "should allow TTF fonts to be used inside transactions" do
+ pdf = Prawn::Document.new do
+ transaction do
+- font "#{Prawn::DATADIR}/fonts/DejaVuSans.ttf"
++ font "/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf"
+ text "Hi there"
+ end
+ end
+@@ -403,7 +409,7 @@
+ describe "#character_count(text)" do
+ it "should work on TTF fonts" do
+ create_pdf
+- @pdf.font("#{Prawn::DATADIR}/fonts/gkai00mp.ttf")
++ @pdf.font("/usr/share/fonts/truetype/arphic-gkai00mp/gkai00mp.ttf")
+ @pdf.font.character_count("こんにちは世界").should == 7
+ @pdf.font.character_count("Hello, world!").should == 13
+ end
+--- a/spec/text_box_spec.rb
++++ b/spec/text_box_spec.rb
+@@ -74,7 +74,7 @@
+ @pdf.text_direction(:rtl)
+ @pdf.text_direction = :rtl
+ @pdf.text_direction = :rtl
+- @pdf.font("#{Prawn::DATADIR}/fonts/gkai00mp.ttf", :size => 16) do
++ @pdf.font("/usr/share/fonts/truetype/arphic-gkai00mp/gkai00mp.ttf", :size => 16) do
+ @pdf.text "写个小"
+ end
+ text = PDF::Inspector::Text.analyze(@pdf.render)
+@@ -800,7 +800,7 @@
+ :height => 162.0,
+ :document => @pdf
+ }
+- @pdf.font "#{Prawn::DATADIR}/fonts/gkai00mp.ttf"
++ @pdf.font "/usr/share/fonts/truetype/arphic-gkai00mp/gkai00mp.ttf"
+ @options[:overflow] = :truncate
+ text_box = Prawn::Text::Box.new(@text, @options)
+ text_box.render
+--- a/spec/text_at_spec.rb
++++ b/spec/text_at_spec.rb
+@@ -109,7 +109,7 @@
+ it "should not raise an exception when a shift-jis string is rendered" do
+ datafile = "#{Prawn::DATADIR}/shift_jis_text.txt"
+ sjis_str = File.open(datafile, "r:shift_jis") { |f| f.gets }
+- @pdf.font("#{Prawn::DATADIR}/fonts/gkai00mp.ttf")
++ @pdf.font("/usr/share/fonts/truetype/arphic-gkai00mp/gkai00mp.ttf")
+ lambda { @pdf.draw_text(sjis_str, :at => [0, 0]) }.should.not.raise(
+ Prawn::Errors::IncompatibleStringEncoding)
+ end
+--- a/spec/template_spec.rb
++++ b/spec/template_spec.rb
+@@ -141,7 +141,9 @@
+ it "should correctly add a TTF font to a template that has existing fonts" do
+ filename = "#{Prawn::DATADIR}/pdfs/contains_ttf_font.pdf"
+ @pdf = Prawn::Document.new(:template => filename)
+- @pdf.font "#{Prawn::DATADIR}/fonts/Chalkboard.ttf"
++ # replace non-free Chalkboard.ttf by system DejaVuSans.ttf (Debian patch)
++ # @pdf.font "#{Prawn::DATADIR}/fonts/Chalkboard.ttf"
++ @pdf.font "/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf"
+ @pdf.move_down(40)
+ @pdf.text "Hi There"
+
+@@ -270,7 +272,9 @@
+ filename = "#{Prawn::DATADIR}/pdfs/contains_ttf_font.pdf"
+ @pdf = Prawn::Document.new()
+ @pdf.start_new_page(:template => filename)
+- @pdf.font "#{Prawn::DATADIR}/fonts/Chalkboard.ttf"
++ # replace non-free Chalkboard.ttf by system DejaVuSans.ttf (Debian patch)
++ # @pdf.font "#{Prawn::DATADIR}/fonts/Chalkboard.ttf"
++ @pdf.font "/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf"
+ @pdf.move_down(40)
+ @pdf.text "Hi There"
+
diff --git a/debian/patches/series b/debian/patches/series
index bc1aa2b..5fa1624 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -2,3 +2,4 @@
0200_replace_BASEDIR_data_by_DATADIR.patch
0210_change_spec_data_to_datadir_pdfs.patch
0300_fix_paths.patch
+0400_use_system_fonts.patch
--
ruby-prawn.git
More information about the Pkg-ruby-extras-commits
mailing list