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.
 Skip a test expecting to not find € in gkai00mp.ttf
Author: Cédric Boutillier <boutil@debian.org>
Last-Update: 2016-06-07

--- 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)
     expect(string).to eq(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"
@@ -154,7 +154,7 @@
 
   it "should not display soft hyphens except at the end of a line " \
      "for more than one element in format_array", :issue => 347 do
-    @pdf.font("#{Prawn::DATADIR}/fonts/DejaVuSans.ttf")
+    @pdf.font("/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf")
     @line_wrap = Prawn::Text::Formatted::LineWrap.new
 
     string1 = @pdf.font.normalize_encoding("hello#{Prawn::Text::SHY}world ")
@@ -184,7 +184,7 @@
                                   :document => @pdf)
     expect(string).to eq("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
 
@@ -223,7 +223,7 @@
     expected.force_encoding(Encoding::UTF_8)
     expect(string).to eq(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
@@ -253,7 +253,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
@@ -267,7 +267,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
@@ -277,7 +277,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)
@@ -316,7 +316,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)
@@ -511,7 +511,7 @@
   end
 
   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,
--- 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
@@ -19,7 +19,7 @@
   end
 
   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" }
@@ -89,7 +89,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" }
     }
@@ -117,7 +117,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" }
     }
@@ -146,7 +146,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" }
     }
@@ -179,7 +179,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" }
     }
@@ -244,7 +244,7 @@
 describe "Text::Formatted::Box with :fallback_fonts option " \
   "with glyphs not in the primary or the fallback fonts" do
   it "should raise an exception" do
-    file = "#{Prawn::DATADIR}/fonts/gkai00mp.ttf"
+    file = "/usr/share/fonts/truetype/arphic-gkai00mp/gkai00mp.ttf"
     create_pdf
     formatted_text = [{ :text => "hello world. 世界你好。" }]
 
--- a/spec/font_spec.rb
+++ b/spec/font_spec.rb
@@ -46,7 +46,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")
 
     expect(@pdf.width_of("\nhello world\n")).to eq(
       @pdf.width_of("hello world")
@@ -82,8 +82,8 @@
 
     @pdf.font_families.update(
       'DejaVu Sans' => {
-        :normal => "#{Prawn::DATADIR}/fonts/DejaVuSans.ttf",
-        :bold => "#{Prawn::DATADIR}/fonts/DejaVuSans-Bold.ttf"
+        :normal => "/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf",
+        :bold => "/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf"
       }
     )
     @pdf.font("DejaVu Sans") {
@@ -171,7 +171,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
     }
@@ -186,7 +186,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)
     }
@@ -344,23 +344,23 @@
   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")
     expect(font.glyph_present?("H")).to eq 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")
     expect(font.glyph_present?("再")).to eq false
 
-    font = @pdf.find_font("#{Prawn::DATADIR}/fonts/gkai00mp.ttf")
-    expect(font.glyph_present?("€")).to eq false
+    @pdf.font("/usr/share/fonts/truetype/arphic-gkai00mp/gkai00mp.ttf")
+    #expect(font.glyph_present?("€")).to eq false
   end
 end
 
 describe "TTF fonts" do
   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
@@ -463,7 +463,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")
     expect(@pdf.font.character_count("こんにちは世界")).to eq(7)
     expect(@pdf.font.character_count("Hello, world!")).to eq(13)
   end
--- a/spec/text_box_spec.rb
+++ b/spec/text_box_spec.rb
@@ -76,7 +76,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)
@@ -815,7 +815,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
@@ -135,7 +135,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
--- a/spec/document_spec.rb
+++ b/spec/document_spec.rb
@@ -251,7 +251,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
 
