Description: use system fonts when possible
 Upstream ships embedded copies of several truetype fonts. Some of them are
 available in Debian. These copies have been removed from the Debian source
 package, and system fonts are used instead. 
Author: Cédric Boutillier <boutil@debian.org>
Last-Update: 2014-09-29

--- 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/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/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(Encoding::UTF_8)
     string.should == expected
 
-    @pdf.font("#{Prawn::DATADIR}/fonts/DejaVuSans.ttf")
+    @pdf.font("/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf")
     @line_wrap = Prawn::Text::Formatted::LineWrap.new
 
     string = "hello#{Prawn::Text::SHY}world"
@@ -139,7 +139,7 @@
                                   :document => @pdf)
     string.should == "helloworld hiearth"
 
-    @pdf.font("#{Prawn::DATADIR}/fonts/DejaVuSans.ttf")
+    @pdf.font("/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf")
     @line_wrap = Prawn::Text::Formatted::LineWrap.new
 
     string1 = "hello#{Prawn::Text::SHY}world "
@@ -169,7 +169,7 @@
                                   :document => @pdf)
     string.should == "hello"
 
-    @pdf.font("#{Prawn::DATADIR}/fonts/DejaVuSans.ttf")
+    @pdf.font("/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf")
     @line_wrap = Prawn::Text::Formatted::LineWrap.new
     enough_width_for_hello_world = 68
 
@@ -208,7 +208,7 @@
     expected.force_encoding(Encoding::UTF_8)
     string.should == expected
 
-    @pdf.font("#{Prawn::DATADIR}/fonts/DejaVuSans.ttf")
+    @pdf.font("/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf")
     @line_wrap = Prawn::Text::Formatted::LineWrap.new
 
     string = "hello#{Prawn::Text::SHY}-"
--- a/spec/text_spec.rb
+++ b/spec/text_spec.rb
@@ -257,7 +257,7 @@
   end
 
   it "should_not raise_error an exception when providing Pathname instance as font" do
-    @pdf.font Pathname.new("#{Prawn::DATADIR}/fonts/DejaVuSans.ttf")
+    @pdf.font Pathname.new("/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf")
   end
 
   it "should correctly render a utf-8 string when using a built-in font" do
@@ -271,7 +271,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/dejavu/DejaVuSans.ttf"
     @pdf.text str
 
     # grab the text from the rendered PDF and ensure it matches
@@ -282,7 +282,7 @@
   it "subsets mixed low-ASCII and non-ASCII characters when they can be " +
      "subsetted together" do
     str = "It’s super effective!"
-    @pdf.font "#{Prawn::DATADIR}/fonts/DejaVuSans.ttf"
+    @pdf.font "/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf"
     @pdf.text str
 
     text = PDF::Inspector::Text.analyze(@pdf.render)
@@ -323,7 +323,7 @@
   it "should_not raise_error 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")
 
     # Expect that the call to text will not raise an encoding error
     @pdf.text(sjis_str)
@@ -425,7 +425,7 @@
 
 
   def add_unicode_fonts(pdf)
-    dejavu = "#{::Prawn::BASEDIR}/data/fonts/DejaVuSans.ttf"
+    dejavu = "/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf"
     pdf.font_families.update("dejavu" => {
       :normal      => dejavu,
       :italic      => dejavu,
--- 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
@@ -20,7 +20,7 @@
 
   it "should not raise an Encoding::CompatibilityError when keeping a TTF and an " +
     "AFM font together" 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" }
     }
@@ -109,7 +109,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" }
     }
@@ -137,7 +137,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" }
     }
@@ -166,7 +166,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" }
     }
@@ -193,7 +193,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
@@ -50,7 +50,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")
@@ -146,7 +146,7 @@
   end
 
   it "should accept Pathname objects for font files" do
-    file = Pathname.new( "#{Prawn::DATADIR}/fonts/DejaVuSans.ttf" )
+    file = Pathname.new( "/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf" )
     @pdf.font_families["DejaVu Sans"] = {
       :normal => file
     }
@@ -161,7 +161,7 @@
   end
 
   it "should accept IO objects for font files" do
-    io = File.open "#{Prawn::DATADIR}/fonts/DejaVuSans.ttf"
+    io = File.open "/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf"
     @pdf.font_families["DejaVu Sans"] = {
       normal: Prawn::Font.load(@pdf, io)
     }
@@ -316,15 +316,15 @@
   end
 
   it "should return true when present in a TTF font" do
-    font = @pdf.find_font("#{Prawn::DATADIR}/fonts/DejaVuSans.ttf")
+    font = @pdf.find_font("/usr/share/fonts/truetype/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/DejaVuSans.ttf")
+    font = @pdf.find_font("/usr/share/fonts/truetype/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
@@ -333,7 +333,7 @@
 
   before do
     create_pdf
-    @font = @pdf.find_font "#{Prawn::DATADIR}/fonts/DejaVuSans.ttf"
+    @font = @pdf.find_font "/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf"
   end
 
   it "should calculate string width taking into account accented characters" do
@@ -437,7 +437,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)
@@ -832,7 +832,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/document_spec.rb
+++ b/spec/document_spec.rb
@@ -256,7 +256,7 @@
     doc_uncompressed = Prawn::Document.new
     doc_compressed   = Prawn::Document.new(:compress => true)
     [doc_compressed, doc_uncompressed].each do |pdf|
-       pdf.font "#{Prawn::DATADIR}/fonts/gkai00mp.ttf"
+       pdf.font "/usr/share/fonts/truetype/arphic-gkai00mp/gkai00mp.ttf"
        pdf.text "更可怕的是，同质化竞争对手可以按照URL中后面这个ID来遍历" * 10
     end
 
--- a/spec/text_at_spec.rb
+++ b/spec/text_at_spec.rb
@@ -108,7 +108,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")
 
     @pdf.draw_text(sjis_str, :at => [0, 0])
   end
