Description: use system fonts when possible
 Upstream ships embedded copies of several truetype fonts. Some are available in Debian.
 These copies have been removed from the Debian source package, and system
 fonts are used instead.
Author: Cédric Boutillier <cedric.boutillier@gmail.com>
Last-Update: 2011-11-21

--- a/manual/text/single_usage.rb
+++ b/manual/text/single_usage.rb
@@ -17,19 +17,21 @@
 filename = File.basename(__FILE__).gsub('.rb', '.pdf')
 Prawn::Example.generate(filename) do
   # Using a TTF font file
-  font "#{Prawn::DATADIR}/fonts/Chalkboard.ttf" do
-    text "Written with the Chalkboard TTF font."
+  # Debian: non-free Chalkboard replaced by system DejaVuSans"
+  font "/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf" do
+    text "Written with the DejaVuSans TTF font."
   end
   move_down 20
   
   text "Written with the default font."
   move_down 20
   
-  # Using an DFONT font file
-  font "#{Prawn::DATADIR}/fonts/Action Man.dfont" do
-    text "Written with the Action Man DFONT font"
-  end
-  move_down 20
+# # Using an DFONT font file
+# # Debian: deactivated, because using non-free font removed from the Debian package
+# font "#{Prawn::DATADIR}/fonts/Action Man.dfont" do
+#   text "Written with the Action Man DFONT font"
+# end
+# move_down 20
 
   text "Written with the default font once more."
 end
--- a/manual/text/utf8.rb
+++ b/manual/text/utf8.rb
@@ -21,7 +21,7 @@
   text "Let's try them with another font."
   move_down 20
   
-  font("#{Prawn::DATADIR}/fonts/DejaVuSans.ttf") do
+  font("/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf") do
     text "ὕαλον ϕαγεῖν δύναμαι· τοῦτο οὔ με βλάπτει."
     text "There you go."
   end
--- a/manual/text/line_wrapping.rb
+++ b/manual/text/line_wrapping.rb
@@ -29,7 +29,7 @@
     "nearer your destination the more you're slip#{nbsp}sliding away."
   move_down 20
 
-  font("#{Prawn::DATADIR}/fonts/gkai00mp.ttf", :size => 16) do
+  font("/usr/share/fonts/truetype/arphic-gkai00mp/gkai00mp.ttf", :size => 16) do
     long_text = "No word boundaries:\n更可怕的是，同质化竞争对手可以按照URL中后面这个ID来遍历您的DB中的内容，写个小爬虫把你的页面上的关键信息顺次爬下来也不是什么难事，这样的话，你就非常被动了。更可怕的是，同质化竞争对手可以按照URL中后面这个ID来遍历您的DB中的内容，写个小爬虫把你的页面上的关键信息顺次爬下来也不是什么难事，这样的话，你就非常被动了。"
     text long_text
     move_down 20
--- a/manual/example_helper.rb
+++ b/manual/example_helper.rb
@@ -143,11 +143,11 @@
   
       text(extract_introduction_text(data), :inline_format => true)
 
-      kai_file = "#{Prawn::DATADIR}/fonts/gkai00mp.ttf"
+      kai_file = "/usr/share/fonts/truetype/arphic-gkai00mp/gkai00mp.ttf"
       font_families["Kai"] = {
         :normal => { :file => kai_file, :font => "Kai" }
       }
-      dejavu_file = "#{Prawn::DATADIR}/fonts/DejaVuSans.ttf"
+      dejavu_file = "/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf"
       font_families["DejaVu"] = {
         :normal => { :file => dejavu_file, :font => "DejaVu" }
       }
--- a/manual/text/fallback_fonts.rb
+++ b/manual/text/fallback_fonts.rb
@@ -4,32 +4,35 @@
 # be present in the desired font. Use the :fallback_fonts option with any of the
 # text or text box methods, or set fallback_fonts document-wide.
 #
+# The result of this example is not included because requires non-free fonts,
+# removed from the Debian package.
+
 require File.expand_path(File.join(File.dirname(__FILE__),
                                    %w[.. example_helper]))
 
 filename = File.basename(__FILE__).gsub('.rb', '.pdf')
 Prawn::Example.generate(filename) do
-  file = "#{Prawn::DATADIR}/fonts/gkai00mp.ttf"
-  font_families["Kai"] = {
-    :normal => { :file => file, :font => "Kai" }
-  }
-  file = "#{Prawn::DATADIR}/fonts/Action Man.dfont"
-  font_families["Action Man"] = {
-    :normal      => { :file => file, :font => "ActionMan" },
-  }
-  font("Action Man") do
-    text("When fallback fonts are included, each glyph will be rendered using " +
-         "the first font that includes the glyph, starting with the current " +
-         "font and then moving through the fallback fonts from left to right." +
-         "\n\n" +
-         "hello ƒ 你好\n再见 ƒ goodbye",
-         :fallback_fonts => ["Times-Roman", "Kai"])
-  end
-  move_down 20
-
-  formatted_text([
-                  { :text => "Fallback fonts can even override" },
-                  { :text => "fragment fonts (你好)", :font => "Times-Roman" },
-                 ],
-                 :fallback_fonts => ["Times-Roman", "Kai"])
+#  file = "usr/share/fonts/truetype/arphic-gkai00mp/gkai00mp.ttf"
+#  font_families["Kai"] = {
+#    :normal => { :file => file, :font => "Kai" }
+#  }
+#  file = "#{Prawn::DATADIR}/fonts/Action Man.dfont"
+#  font_families["Action Man"] = {
+#    :normal      => { :file => file, :font => "ActionMan" },
+#  }
+#  font("Action Man") do
+#    text("When fallback fonts are included, each glyph will be rendered using " +
+#         "the first font that includes the glyph, starting with the current " +
+#         "font and then moving through the fallback fonts from left to right." +
+#         "\n\n" +
+#         "hello ƒ 你好\n再见 ƒ goodbye",
+#         :fallback_fonts => ["Times-Roman", "Kai"])
+#  end
+#  move_down 20
+#
+#  formatted_text([
+#                  { :text => "Fallback fonts can even override" },
+#                  { :text => "fragment fonts (你好)", :font => "Times-Roman" },
+#                 ],
+#                 :fallback_fonts => ["Times-Roman", "Kai"])
 end
--- a/manual/text/right_to_left_text.rb
+++ b/manual/text/right_to_left_text.rb
@@ -16,7 +16,7 @@
   # set the direction document-wide
   self.text_direction = :rtl
 
-  font("#{Prawn::DATADIR}/fonts/gkai00mp.ttf", :size => 16) do
+  font("/usr/share/fonts/truetype/arphic-gkai00mp/gkai00mp.ttf", :size => 16) do
     long_text = "写个小爬虫把你的页面上的关键信息顺次爬下来也不是什么难事写个小爬虫把你的页面上的关键信息顺次爬下来也不是什么难事写个小爬虫把你的页面上的关键信息顺次爬下来也不是什么难事写个小"
     text long_text
     move_down 20
--- a/manual/text/registering_families.rb
+++ b/manual/text/registering_families.rb
@@ -8,43 +8,46 @@
 # To register a font family update the <code>font_families</code>
 # hash with the font path for each style you want to use.
 #
+# The result of this example is not included because requires non-free fonts,
+# removed from the Debian package.
+
 require File.expand_path(File.join(File.dirname(__FILE__),
                                    %w[.. example_helper]))
 
 filename = File.basename(__FILE__).gsub('.rb', '.pdf')
 Prawn::Example.generate(filename) do
-  # Registering a single TTF font
-  font_families.update("Chalkboard" => {
-    :normal => "#{Prawn::DATADIR}/fonts/Chalkboard.ttf"
-  })
-  
-  font("Chalkboard") do
-    text "Using the Chalkboard font providing only its name to the font method"
-  end
-  move_down 20
-  
-  # Registering a DFONT package
-  font_path = "#{Prawn::DATADIR}/fonts/Action Man.dfont"
-  font_families.update("Action Man" => {
-    :normal      => { :file => font_path, :font => "ActionMan" },
-    :italic      => { :file => font_path, :font => "ActionMan-Italic" },
-    :bold        => { :file => font_path, :font => "ActionMan-Bold" },
-    :bold_italic => { :file => font_path, :font => "ActionMan-BoldItalic" }
-  })
-  
-  font "Action Man"
-  text "Also using the Action Man by providing only its name"
-  move_down 20
-  
-  text "Taking <b>advantage</b> of the <i>inline formatting</i>",
-       :inline_format => true
-  move_down 20
-  
-  [:bold, :bold_italic, :italic, :normal].each do |style|
-    text "Using the #{style} style option.",
-         :style => style
-    move_down 10
-  end
-  
-  font "Helvetica"  # Back to normal
+#  # Registering a single TTF font
+#  font_families.update("Chalkboard" => {
+#    :normal => "#{Prawn::DATADIR}/fonts/Chalkboard.ttf"
+#  })
+#
+#  font("Chalkboard") do
+#    text "Using the Chalkboard font providing only its name to the font method"
+#  end
+#  move_down 20
+#
+#  # Registering a DFONT package
+#  font_path = "#{Prawn::DATADIR}/fonts/Action Man.dfont"
+#  font_families.update("Action Man" => {
+#    :normal      => { :file => font_path, :font => "ActionMan" },
+#    :italic      => { :file => font_path, :font => "ActionMan-Italic" },
+#    :bold        => { :file => font_path, :font => "ActionMan-Bold" },
+#    :bold_italic => { :file => font_path, :font => "ActionMan-BoldItalic" }
+#  })
+#
+#  font "Action Man"
+#  text "Also using the Action Man by providing only its name"
+#  move_down 20
+#
+#  text "Taking <b>advantage</b> of the <i>inline formatting</i>",
+#       :inline_format => true
+#  move_down 20
+#
+#  [:bold, :bold_italic, :italic, :normal].each do |style|
+#    text "Using the #{style} style option.",
+#         :style => style
+#    move_down 10
+#  end
+#
+#  font "Helvetica"  # Back to normal
 end
