Permalink
Browse files

replace Prawn::BASEDIR/data by Prawn::DATADIR

  • Loading branch information...
1 parent 0968057 commit 6bfe4ecc12cf2ef73c586f0eabf08c130cbcaafa @boutil boutil committed Nov 22, 2011
Showing with 130 additions and 128 deletions.
  1. +1 −1 bench/png_type_6.rb
  2. +1 −1 bench/ttf_text_bench.rb
  3. +1 −1 bugs/resolved/layout/cell_width_miscalculation.rb
  4. +1 −1 bugs/resolved/layout/table_row_background_color_issue.rb
  5. +1 −1 bugs/resolved/png_barcode_issue.rb
  6. +1 −1 bugs/resolved/ttf_fails_in_transactions.rb
  7. +3 −1 lib/prawn/core.rb
  8. +2 −2 lib/prawn/core/text.rb
  9. +1 −1 lib/prawn/document.rb
  10. +1 −1 lib/prawn/encoding.rb
  11. +1 −1 lib/prawn/font/afm.rb
  12. +2 −2 lib/prawn/images.rb
  13. +1 −1 manual/document_and_page_options/background.rb
  14. +2 −2 manual/example_helper.rb
  15. +1 −1 manual/images/absolute_position.rb
  16. +1 −1 manual/images/fit.rb
  17. +2 −2 manual/images/horizontal.rb
  18. +1 −1 manual/images/plain_image.rb
  19. +3 −3 manual/images/scale.rb
  20. +2 −2 manual/images/vertical.rb
  21. +3 −3 manual/images/width_and_height.rb
  22. +1 −1 manual/manual/cover.rb
  23. +1 −1 manual/table/image_cells.rb
  24. +1 −1 manual/templates/full_template.rb
  25. +1 −1 manual/templates/page_template.rb
  26. +2 −2 manual/text/fallback_fonts.rb
  27. +1 −1 manual/text/line_wrapping.rb
  28. +2 −2 manual/text/registering_families.rb
  29. +1 −1 manual/text/right_to_left_text.rb
  30. +2 −2 manual/text/single_usage.rb
  31. +1 −1 manual/text/utf8.rb
  32. +2 −2 spec/cell_spec.rb
  33. +2 −2 spec/document_spec.rb
  34. +10 −10 spec/font_spec.rb
  35. +5 −5 spec/formatted_text_box_spec.rb
  36. +5 −5 spec/images_spec.rb
  37. +1 −1 spec/jpg_spec.rb
  38. +6 −6 spec/line_wrap_spec.rb
  39. +9 −9 spec/object_store_spec.rb
  40. +17 −17 spec/png_spec.rb
  41. +16 −16 spec/template_spec.rb
  42. +3 −3 spec/text_at_spec.rb
  43. +3 −3 spec/text_box_spec.rb
  44. +1 −1 spec/text_spacing_spec.rb
  45. +5 −5 spec/text_spec.rb
View
@@ -8,7 +8,7 @@
x.report("PNG Type 6") do
N.times do
Prawn::Document.new do
- image "#{Prawn::BASEDIR}/data/images/dice.png"
+ image "#{Prawn::DATADIR}/images/dice.png"
end.render
end
end
View
@@ -7,7 +7,7 @@
Benchmark.bmbm do |x|
x.report("TTF text") do
Prawn::Document.new {
- font "#{Prawn::BASEDIR}/data/fonts/DejaVuSans.ttf"
+ font "#{Prawn::DATADIR}/fonts/DejaVuSans.ttf"
N.times do
(1..5).each do |i|
draw_text "Hello Prawn", :at => [200, i * 100]
@@ -12,7 +12,7 @@
require "prawn/layout"
Prawn::Document.generate("broken_table.pdf") do
- font "#{Prawn::BASEDIR}/data/fonts/comicsans.ttf"
+ font "#{Prawn::DATADIR}/fonts/comicsans.ttf"
table [["foo", "baaar", "1" ],
["This is","a sample", "2" ],
["Table", "dont\ncha\nknow?", "3" ]],
@@ -13,7 +13,7 @@
require "prawn/layout"
Prawn::Document.generate("table_with_background_color_problems.pdf") do
- font "#{Prawn::BASEDIR}/data/fonts/DejaVuSans.ttf"
+ font "#{Prawn::DATADIR}/fonts/DejaVuSans.ttf"
table [["ὕαλον ϕαγεῖν", "baaar", "1" ],
["This is","a sample", "2" ],
["Table", "dont\ncha\nknow?", "3" ],
@@ -7,5 +7,5 @@
require "prawn/core"
Prawn::Document.generate('png_barcode_issue.pdf') do
- image "#{Prawn::BASEDIR}/data/images/barcode_issue.png"
+ image "#{Prawn::DATADIR}/images/barcode_issue.png"
end
@@ -18,7 +18,7 @@
require 'prawn/core'
Prawn::Document.generate("err.pdf") do
- font "#{Prawn::BASEDIR}/data/fonts/DejaVuSans.ttf"
+ font "#{Prawn::DATADIR}/fonts/DejaVuSans.ttf"
text "Hi there"
transaction { text "Nice, thank you" }
end
View
@@ -29,7 +29,9 @@ module Prawn
# The base source directory for Prawn as installed on the system
#
- BASEDIR = File.expand_path(File.join(dir, '..', '..'))
+ #
+ BASEDIR = File.expand_path(File.join(dir, '..','..'))
+ DATADIR = File.expand_path(File.join(dir, '..', '..', 'data'))
# Whe set to true, Prawn will verify hash options to ensure only valid keys
# are used. Off by default.
View
@@ -131,11 +131,11 @@ def text_direction(direction=nil)
#
# Call with an empty array to turn off fallback fonts
#
- # file = "#{Prawn::BASEDIR}/data/fonts/gkai00mp.ttf"
+ # file = "#{Prawn::DATADIR}/fonts/gkai00mp.ttf"
# font_families["Kai"] = {
# :normal => { :file => file, :font => "Kai" }
# }
- # file = "#{Prawn::BASEDIR}/data/fonts/Action Man.dfont"
+ # file = "#{Prawn::DATADIR}/fonts/Action Man.dfont"
# font_families["Action Man"] = {
# :normal => { :file => file, :font => "ActionMan" },
# }
View
@@ -166,7 +166,7 @@ def self.generate(filename,options={},&block)
# pdf = Prawn::Document.new(:page_size => [200, 300])
#
# # New document, with background
- # pdf = Prawn::Document.new(:background => "#{Prawn::BASEDIR}/data/images/pigs.jpg")
+ # pdf = Prawn::Document.new(:background => "#{Prawn::DATADIR}/images/pigs.jpg")
#
def initialize(options={},&block)
options = options.dup
View
@@ -84,7 +84,7 @@ class WinAnsi #:nodoc:
]
def initialize
- @mapping_file = "#{Prawn::BASEDIR}/data/encodings/win_ansi.txt"
+ @mapping_file = "#{Prawn::DATADIR}/encodings/win_ansi.txt"
load_mapping if self.class.mapping.empty?
end
View
@@ -28,7 +28,7 @@ def self.metrics_path
".", "/usr/lib/afm",
"/usr/local/lib/afm",
"/usr/openwin/lib/fonts/afm/",
- Prawn::BASEDIR+'/data/fonts/']
+ Prawn::DATADIR+'/fonts/']
end
end
View
@@ -32,10 +32,10 @@ module Images
# <tt>:fit</tt>:: scale the dimensions of the image proportionally to fit inside [width,height]
#
# Prawn::Document.generate("image2.pdf", :page_layout => :landscape) do
- # pigs = "#{Prawn::BASEDIR}/data/images/pigs.jpg"
+ # pigs = "#{Prawn::DATADIR}/images/pigs.jpg"
# image pigs, :at => [50,450], :width => 450
#
- # dice = "#{Prawn::BASEDIR}/data/images/dice.png"
+ # dice = "#{Prawn::DATADIR}/images/dice.png"
# image dice, :at => [50, 450], :scale => 0.75
# end
#
@@ -7,7 +7,7 @@
require File.expand_path(File.join(File.dirname(__FILE__),
%w[.. example_helper]))
-img = "#{Prawn::BASEDIR}/data/images/letterhead.jpg"
+img = "#{Prawn::DATADIR}/images/letterhead.jpg"
Prawn::Document.generate("background.pdf",
:background => img,
View
@@ -143,11 +143,11 @@ def load_example(package, example, options={})
text(extract_introduction_text(data), :inline_format => true)
- kai_file = "#{Prawn::BASEDIR}/data/fonts/gkai00mp.ttf"
+ kai_file = "#{Prawn::DATADIR}/fonts/gkai00mp.ttf"
font_families["Kai"] = {
:normal => { :file => kai_file, :font => "Kai" }
}
- dejavu_file = "#{Prawn::BASEDIR}/data/fonts/DejaVuSans.ttf"
+ dejavu_file = "#{Prawn::DATADIR}/fonts/DejaVuSans.ttf"
font_families["DejaVu"] = {
:normal => { :file => dejavu_file, :font => "DejaVu" }
}
@@ -17,7 +17,7 @@
y_position = cursor
text "The image won't go below this line of text."
- image "#{Prawn::BASEDIR}/data/images/fractal.jpg", :at => [200, y_position]
+ image "#{Prawn::DATADIR}/images/fractal.jpg", :at => [200, y_position]
text "And this line of text will go just below the previous one."
end
View
@@ -15,7 +15,7 @@
text "Using the fit option"
bounding_box([0, cursor], :width => size, :height => size) do
- image "#{Prawn::BASEDIR}/data/images/pigs.jpg", :fit => [size, size]
+ image "#{Prawn::DATADIR}/images/pigs.jpg", :fit => [size, size]
stroke_bounds
end
end
@@ -16,10 +16,10 @@
[:left, :center, :right].each do |position|
text "Image aligned to the #{position}."
- image "#{Prawn::BASEDIR}/data/images/stef.jpg", :position => position
+ image "#{Prawn::DATADIR}/images/stef.jpg", :position => position
end
text "The next image has a 50 point offset from the left boundary"
- image "#{Prawn::BASEDIR}/data/images/stef.jpg", :position => 50
+ image "#{Prawn::DATADIR}/images/stef.jpg", :position => 50
end
end
@@ -14,5 +14,5 @@
filename = File.basename(__FILE__).gsub('.rb', '.pdf')
Prawn::Example.generate(filename) do
text "The image will go right below this line of text."
- image "#{Prawn::BASEDIR}/data/images/pigs.jpg"
+ image "#{Prawn::DATADIR}/images/pigs.jpg"
end
View
@@ -11,13 +11,13 @@
filename = File.basename(__FILE__).gsub('.rb', '.pdf')
Prawn::Example.generate(filename) do
text "Normal size"
- image "#{Prawn::BASEDIR}/data/images/stef.jpg"
+ image "#{Prawn::DATADIR}/images/stef.jpg"
move_down 10
text "Scaled to 50%"
- image "#{Prawn::BASEDIR}/data/images/stef.jpg", :scale => 0.5
+ image "#{Prawn::DATADIR}/images/stef.jpg", :scale => 0.5
move_down 10
text "Scaled to 200%"
- image "#{Prawn::BASEDIR}/data/images/stef.jpg", :scale => 2
+ image "#{Prawn::DATADIR}/images/stef.jpg", :scale => 2
end
@@ -15,13 +15,13 @@
[:top, :center, :bottom].each do |vposition|
text "Image vertically aligned to the #{vposition}.", :valign => vposition
- image "#{Prawn::BASEDIR}/data/images/stef.jpg", :position => 250,
+ image "#{Prawn::DATADIR}/images/stef.jpg", :position => 250,
:vposition => vposition
end
text_box "The next image has a 100 point offset from the top boundary",
:at => [bounds.width - 110, bounds.top - 10], :width => 100
- image "#{Prawn::BASEDIR}/data/images/stef.jpg", :position => :right,
+ image "#{Prawn::DATADIR}/images/stef.jpg", :position => :right,
:vposition => 100
end
end
@@ -13,13 +13,13 @@
filename = File.basename(__FILE__).gsub('.rb', '.pdf')
Prawn::Example.generate(filename) do
text "Scale by setting only the width"
- image "#{Prawn::BASEDIR}/data/images/pigs.jpg", :width => 150
+ image "#{Prawn::DATADIR}/images/pigs.jpg", :width => 150
move_down 10
text "Scale by setting only the height"
- image "#{Prawn::BASEDIR}/data/images/pigs.jpg", :height => 100
+ image "#{Prawn::DATADIR}/images/pigs.jpg", :height => 100
move_down 10
text "Stretch to fit the width and height provided"
- image "#{Prawn::BASEDIR}/data/images/pigs.jpg", :width => 500, :height => 100
+ image "#{Prawn::DATADIR}/images/pigs.jpg", :width => 500, :height => 100
end
View
@@ -9,7 +9,7 @@
Prawn::Example.generate(filename) do
move_down 200
- image "#{Prawn::BASEDIR}/data/images/prawn.png",
+ image "#{Prawn::DATADIR}/images/prawn.png",
:scale => 0.9,
:at => [10, cursor]
@@ -17,7 +17,7 @@
filename = File.basename(__FILE__).gsub('.rb', '.pdf')
Prawn::Example.generate(filename) do
- image = "#{Prawn::BASEDIR}/data/images/prawn.png"
+ image = "#{Prawn::DATADIR}/images/prawn.png"
table [
["Standard image cell", {:image => image}],
@@ -11,7 +11,7 @@
require File.expand_path(File.join(File.dirname(__FILE__),
%w[.. example_helper]))
-filename = "#{Prawn::BASEDIR}/data/pdfs/multipage_template.pdf"
+filename = "#{Prawn::DATADIR}/pdfs/multipage_template.pdf"
Prawn::Example.generate("full_template.pdf", :template => filename) do
go_to_page(page_count)
@@ -22,7 +22,7 @@
url = "https://github.com/sandal/prawn/raw/master/data/pdfs/form.pdf"
formatted_text [{:text => url, :link => url}]
- filename = "#{Prawn::BASEDIR}/data/pdfs/form.pdf"
+ filename = "#{Prawn::DATADIR}/pdfs/form.pdf"
start_new_page(:template => filename)
start_new_page(:template => filename, :template_page => 2)
@@ -9,11 +9,11 @@
filename = File.basename(__FILE__).gsub('.rb', '.pdf')
Prawn::Example.generate(filename) do
- file = "#{Prawn::BASEDIR}/data/fonts/gkai00mp.ttf"
+ file = "#{Prawn::DATADIR}/fonts/gkai00mp.ttf"
font_families["Kai"] = {
:normal => { :file => file, :font => "Kai" }
}
- file = "#{Prawn::BASEDIR}/data/fonts/Action Man.dfont"
+ file = "#{Prawn::DATADIR}/fonts/Action Man.dfont"
font_families["Action Man"] = {
:normal => { :file => file, :font => "ActionMan" },
}
@@ -29,7 +29,7 @@
"nearer your destination the more you're slip#{nbsp}sliding away."
move_down 20
- font("#{Prawn::BASEDIR}/data/fonts/gkai00mp.ttf", :size => 16) do
+ font("#{Prawn::DATADIR}/fonts/gkai00mp.ttf", :size => 16) do
long_text = "No word boundaries:\n更可怕的是,同质化竞争对手可以按照URL中后面这个ID来遍历您的DB中的内容,写个小爬虫把你的页面上的关键信息顺次爬下来也不是什么难事,这样的话,你就非常被动了。更可怕的是,同质化竞争对手可以按照URL中后面这个ID来遍历您的DB中的内容,写个小爬虫把你的页面上的关键信息顺次爬下来也不是什么难事,这样的话,你就非常被动了。"
text long_text
move_down 20
@@ -15,7 +15,7 @@
Prawn::Example.generate(filename) do
# Registering a single TTF font
font_families.update("Chalkboard" => {
- :normal => "#{Prawn::BASEDIR}/data/fonts/Chalkboard.ttf"
+ :normal => "#{Prawn::DATADIR}/fonts/Chalkboard.ttf"
})
font("Chalkboard") do
@@ -24,7 +24,7 @@
move_down 20
# Registering a DFONT package
- font_path = "#{Prawn::BASEDIR}/data/fonts/Action Man.dfont"
+ 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" },
@@ -16,7 +16,7 @@
# set the direction document-wide
self.text_direction = :rtl
- font("#{Prawn::BASEDIR}/data/fonts/gkai00mp.ttf", :size => 16) do
+ font("#{Prawn::DATADIR}/fonts/gkai00mp.ttf", :size => 16) do
long_text = "写个小爬虫把你的页面上的关键信息顺次爬下来也不是什么难事写个小爬虫把你的页面上的关键信息顺次爬下来也不是什么难事写个小爬虫把你的页面上的关键信息顺次爬下来也不是什么难事写个小"
text long_text
move_down 20
@@ -17,7 +17,7 @@
filename = File.basename(__FILE__).gsub('.rb', '.pdf')
Prawn::Example.generate(filename) do
# Using a TTF font file
- font "#{Prawn::BASEDIR}/data/fonts/Chalkboard.ttf" do
+ font "#{Prawn::DATADIR}/fonts/Chalkboard.ttf" do
text "Written with the Chalkboard TTF font."
end
move_down 20
@@ -26,7 +26,7 @@
move_down 20
# Using an DFONT font file
- font "#{Prawn::BASEDIR}/data/fonts/Action Man.dfont" do
+ font "#{Prawn::DATADIR}/fonts/Action Man.dfont" do
text "Written with the Action Man DFONT font"
end
move_down 20
View
@@ -21,7 +21,7 @@
text "Let's try them with another font."
move_down 20
- font("#{Prawn::BASEDIR}/data/fonts/DejaVuSans.ttf") do
+ font("#{Prawn::DATADIR}/fonts/DejaVuSans.ttf") do
text "ὕαλον ϕαγεῖν δύναμαι· τοῦτο οὔ με βλάπτει."
text "There you go."
end
View
@@ -509,7 +509,7 @@ def close?(actual, expected, epsilon=0.01)
describe "with default options" do
before(:each) do
@cell = Prawn::Table::Cell.make(@pdf,
- :image => "#{Prawn::BASEDIR}/data/images/prawn.png")
+ :image => "#{Prawn::DATADIR}/images/prawn.png")
end
it "should create a Cell::Image" do
@@ -525,7 +525,7 @@ def close?(actual, expected, epsilon=0.01)
describe "hash syntax" do
before(:each) do
@table = @pdf.make_table([[{
- :image => "#{Prawn::BASEDIR}/data/images/prawn.png",
+ :image => "#{Prawn::DATADIR}/images/prawn.png",
:scale => 2,
:fit => [100, 200],
:image_width => 123,
View
@@ -89,7 +89,7 @@
describe "Background template feature" do
before(:each) do
- @filename = "#{Prawn::BASEDIR}/data/images/pigs.jpg"
+ @filename = "#{Prawn::DATADIR}/images/pigs.jpg"
@pdf = Prawn::Document.new(:background => @filename)
end
it "should place a background image if it is in options block" do
@@ -235,7 +235,7 @@
doc_uncompressed = Prawn::Document.new
doc_compressed = Prawn::Document.new(:compress => true)
[doc_compressed, doc_uncompressed].each do |pdf|
- pdf.font "#{Prawn::BASEDIR}/data/fonts/gkai00mp.ttf"
+ pdf.font "#{Prawn::DATADIR}/fonts/gkai00mp.ttf"
pdf.text "更可怕的是,同质化竞争对手可以按照URL中后面这个ID来遍历" * 10
end
Oops, something went wrong.

0 comments on commit 6bfe4ec

Please sign in to comment.