Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Prawn is copyrighted free software produced by Gregory Brown along with
Prawn is copyrighted free software produced by Gregory Brown along with
community contributions. See git log for authorship information.

Licensing terms follow (License of Ruby):
Expand Down Expand Up @@ -42,11 +42,11 @@ or GPLv3 (see GPLv2 and GPLv3 files), or the conditions below:
d) make other distribution arrangements with the author.

4. You may modify and include the part of the software into any other
software (possibly commercial).
software (possibly commercial).

5. The scripts and library files supplied as input to or produced as
5. The scripts and library files supplied as input to or produced as
output from the software do not automatically fall under the
copyright of the software, but belong to whomever generated them,
copyright of the software, but belong to whomever generated them,
and may be sold commercially, and may be aggregated with this
software.

Expand Down
10 changes: 5 additions & 5 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ Bundler.setup
require 'rake'
require 'rake/testtask'
require "rake/rdoctask"
require "rake/gempackagetask"
require "rake/gempackagetask"

task :default => [:test]

desc "Run all tests, test-spec, mocha, and pdf-reader required"
Rake::TestTask.new do |test|
# test.ruby_opts << "-w" # .should == true triggers a lot of warnings
Expand All @@ -20,16 +20,16 @@ end
desc "Show library's code statistics"
task :stats do
require 'code_statistics'
CodeStatistics::TEST_TYPES << "Specs"
CodeStatistics.new( ["Prawn", "lib"],
CodeStatistics::TEST_TYPES << "Specs"
CodeStatistics.new( ["Prawn", "lib"],
["Specs", "spec"] ).to_s
end

desc "genrates documentation"
Rake::RDocTask.new do |rdoc|
rdoc.rdoc_files.include( "README",
"COPYING",
"LICENSE",
"LICENSE",
"HACKING", "lib/" )
rdoc.main = "README"
rdoc.rdoc_dir = "doc/html"
Expand Down
22 changes: 11 additions & 11 deletions bench/afm_text_bench.rb
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
require "prawn"
require "benchmark"
require "prawn"
require "benchmark"

N=2000
Benchmark.bmbm do |x|

Benchmark.bmbm do |x|
x.report("AFM text") do
Prawn::Document.new {
N.times do
Prawn::Document.new {
N.times do
(1..5).each do |i|
draw_text "Hello Prawn", :at => [200, i * 100]
end
start_new_page
end
}.render
end
end
start_new_page
end
}.render
end
end
20 changes: 10 additions & 10 deletions bench/png_type_6.rb
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
require "prawn"
require "benchmark"
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
require "prawn"
require "benchmark"

N=5
Benchmark.bmbm do |x|
x.report("PNG Type 6") do

Benchmark.bmbm do |x|
x.report("PNG Type 6") do
N.times do
Prawn::Document.new do
Prawn::Document.new do
image "#{Prawn::DATADIR}/images/dice.png"
end.render
end
end
end
end
end
end
26 changes: 13 additions & 13 deletions bench/ttf_text_bench.rb
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
require "prawn"
require "benchmark"
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
require "prawn"
require "benchmark"

N=2000
Benchmark.bmbm do |x|

Benchmark.bmbm do |x|
x.report("TTF text") do
Prawn::Document.new {
font "#{Prawn::DATADIR}/fonts/DejaVuSans.ttf"
N.times do
Prawn::Document.new {
font "#{Prawn::DATADIR}/fonts/DejaVuSans.ttf"
N.times do
(1..5).each do |i|
draw_text "Hello Prawn", :at => [200, i * 100]
end
start_new_page
end
}.render
end
end
start_new_page
end
}.render
end
end
2 changes: 1 addition & 1 deletion bugs/indentation_across_pagebreaks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
end
end
end

6 changes: 3 additions & 3 deletions bugs/resolved/canvas_sets_y_to_0.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# As of 7e94d25828021732f7872934cb91430ef798cd86, Document#canvas
# sets pdf.y to 0 after executing a block, which is probably not useful for
# sets pdf.y to 0 after executing a block, which is probably not useful for
# anyone. It should retain the y position present at the end of the block.
#
# This was resolved in 998a5c3fad40c9e0a79e1468e3a83815ed948a74 [#88]
Expand All @@ -8,8 +8,8 @@
require "prawn/core"

Prawn::Document.generate("canvas_sets_y_to_0.pdf") do

canvas { text "blah" }

text "Here's my sentence. by satoko"
end
3 changes: 1 addition & 2 deletions bugs/resolved/color_space_issues.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
require 'prawn'

##
# This bug is simplification of issue #183.
# This bug is simplification of issue #183.
# When the bug is fixed then a rectangle should show on both pages in Acrobat Reader.

pdf = Prawn::Document.generate("color_space_issues.pdf", :page_layout => :landscape) do
Expand All @@ -16,4 +16,3 @@
stroke_color "000000"
stroke { rectangle([10, bounds.top], 10, 10) }
end

10 changes: 5 additions & 5 deletions bugs/resolved/layout/cell_width_miscalculation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@
require "prawn"
require "prawn/layout"

Prawn::Document.generate("broken_table.pdf") do
Prawn::Document.generate("broken_table.pdf") do
font "#{Prawn::DATADIR}/fonts/comicsans.ttf"
table [["foo", "baaar", "1" ],
["This is","a sample", "2" ],
["Table", "dont\ncha\nknow?", "3" ]],
:font_size => 30,
:padding => 10,
:border => 2,
:font_size => 30,
:padding => 10,
:border => 2,
:position => :center
end

2 changes: 1 addition & 1 deletion bugs/resolved/layout/fill_color.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@

Prawn::Document.generate("fill_color.pdf") do
fill_color "ff0000"
table [%w[1 2 3],%w[4 5 6],%w[7 8 9]],
table [%w[1 2 3],%w[4 5 6],%w[7 8 9]],
end

10 changes: 5 additions & 5 deletions bugs/resolved/layout/table_header_overrun.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Text was overflowing into following cells because of some issues with
# Text was overflowing into following cells because of some issues with
# floating point numbers in naive wrap.
#
# Resolved in: 9c357bc488d26e7bbc2e442606106106d349e232
Expand All @@ -15,7 +15,7 @@
:top_margin => 36,
:bottom_margin => 36}

Prawn::Document.generate("table_header_overrun.pdf", @prawn_document_options) do
Prawn::Document.generate("table_header_overrun.pdf", @prawn_document_options) do

headers = [ "Customer", "Grand\nHijynx", "Kh", "Red\nCorvette", "Rushmore", "bPnr", "lGh", "retail\nPantaloons", "sRsm", "Total\nBoxes"]
data = [[1,0,1,0,1,0,1,0,1,0], [0,1,0,1,0,1,0,1,0,1]]
Expand All @@ -26,10 +26,10 @@
:horizontal_padding => 5,
:vertical_padding => 3,
:border => 2,
:position => :center)
:position => :center)

start_new_page

table [['MyString']], :headers=>['Field1']

end
8 changes: 4 additions & 4 deletions bugs/resolved/layout/table_ignores_align_headers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
# Prawn ignores :align_headers property in tables
# when :border_style => :grid is present (Lighthouse issue #119).
#
# NOTES:
#
# NOTES:
#
# * This issue can only be reproduced when :border_style => :grid is used
#
# Resolved as of 47297900dcf3f16c4765ca817f17c53fb0a5a079
Expand All @@ -21,8 +21,8 @@
left = "Left justified"
left2 = "left"
center = "centered"
table [[left, left], [left2, left2]], :headers => [center, center],
:align => :left,
table [[left, left], [left2, left2]], :headers => [center, center],
:align => :left,
:align_headers => :center,
:border_style => :grid
end
8 changes: 4 additions & 4 deletions bugs/resolved/layout/table_in_bounding_box_without_height.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# encoding: utf-8
# encoding: utf-8
#
# Issue with tables within stretchy bounding boxes. Changes to the way
# bounding boxes work caused tables to not properly render within stretchy
# bounding boxes.
# bounding boxes.
#
# A fix in 200fc36455fa3bee0e1e3bb25d1b5bf73dbf3b52 makes it so the bottom
# of the margin_box will be used as the page boundary in stretchy bounding
# of the margin_box will be used as the page boundary in stretchy bounding
# boxes. Ideally, this would instead use the nesting bounding box dimensions
# [#80] , but this works for now.
#
Expand All @@ -14,7 +14,7 @@
require "prawn"
require "prawn/layout"

Prawn::Document.generate("table_in_bounding_box_without_height.pdf") do
Prawn::Document.generate("table_in_bounding_box_without_height.pdf") do
bounding_box bounds.top_left, :width => 200 do
table [%w(These should all be), %w(on the same page)]
end
Expand Down
48 changes: 24 additions & 24 deletions bugs/resolved/layout/table_row_background_color_issue.rb
Original file line number Diff line number Diff line change
@@ -1,43 +1,43 @@
# As of 96f660660345c7c22923ba51d0124022a3a189ab, table is currently not taking
# in account border widths when filling in rows with background coloring. This
# means the larger the border, the larger the visible gap between rows.
# means the larger the border, the larger the visible gap between rows.
#
# This problem was fixed in 97d9bf083fd9423d17fd1efca36ea675ff34a6d7, but
# there remains a very minor issue when the border size is 1 for the headers.
# Because this almost appears to be a feature display-wise, we will leave it
# Because this almost appears to be a feature display-wise, we will leave it
# alone for now.
#
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', '..', 'lib')
require "rubygems"
require "prawn"
require "prawn/layout"

Prawn::Document.generate("table_with_background_color_problems.pdf") do
Prawn::Document.generate("table_with_background_color_problems.pdf") do
font "#{Prawn::DATADIR}/fonts/DejaVuSans.ttf"
table [["ὕαλον ϕαγεῖν", "baaar", "1" ],
["This is","a sample", "2" ],
["Table", "dont\ncha\nknow?", "3" ],
[ "It", "Rules", "4" ],
[ "It", "Rules", "4" ],
[ "It", "Rules", "4" ],
[ "It", "Rules", "4" ],
[ "It", "Rules", "4" ],
[ "It", "Rules", "4" ],
[ "It", "Rules", "4" ],
[ "It", "Rules", "4" ],
[ "It", "Rules", "4" ],
[ "It", "Rules\nwith an iron fist", "x" ],
[ "It", "Rules", "4" ],
[ "It", "Rules", "4" ],
[ "It", "Rules", "4" ],
[ "It", "Rules", "4" ],
[ "It", "Rules", "4" ],
[ "It", "Rules", "4" ],
[ "It", "Rules", "4" ],
[ "It", "Rules", "4" ],
[ "It", "Rules", "4" ]],
[ "It", "Rules", "4" ],
[ "It", "Rules", "4" ],
[ "It", "Rules", "4" ],
[ "It", "Rules", "4" ],
[ "It", "Rules", "4" ],
[ "It", "Rules", "4" ],
[ "It", "Rules", "4" ],
[ "It", "Rules", "4" ],
[ "It", "Rules", "4" ],
[ "It", "Rules\nwith an iron fist", "x" ],
[ "It", "Rules", "4" ],
[ "It", "Rules", "4" ],
[ "It", "Rules", "4" ],
[ "It", "Rules", "4" ],
[ "It", "Rules", "4" ],
[ "It", "Rules", "4" ],
[ "It", "Rules", "4" ],
[ "It", "Rules", "4" ],
[ "It", "Rules", "4" ]],

:font_size => 10,
:font_size => 10,
:horizontal_padding => 10,
:vertical_padding => 3,
:border => 1,
Expand All @@ -49,7 +49,7 @@
text "This should appear in the original font size"
end

table [[ "Wide", "columns", "streeetch"],
table [[ "Wide", "columns", "streeetch"],
["are","mighty fine", "streeeeeeeech"]],
:column_widths => { 0 => 200, 1 => 250 }, :position => 5

Expand Down
2 changes: 1 addition & 1 deletion bugs/resolved/layout/table_suppress_newline.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
Prawn::Document.generate("table_supresses_newlines.pdf") do
table [["test\n\naaaa","test\n\nbbbb"],
["test\n\ncccc", "test\n\ndddd"]], :border_style => :grid

cell [100,100], :text => "test\n\naaaa"
end
4 changes: 2 additions & 2 deletions bugs/resolved/save_graphics_state.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
require 'prawn'

##
# This bug is taken from issue #102 including the comments.
# This bug is taken from issue #102 including the comments.
# When the bug is fixed then the third rectangle should be yellow and not green.

pdf = Prawn::Document.generate("graphics_state.pdf", :page_layout => :landscape) do
fill_color '000000' # Prawn thinks color space is RGB
fill { rectangle([10, bounds.top], 10, 10) }
save_graphics_state
fill_color 0, 0, 0, 0 # Prawn thinks color space is CMYK
fill_color 0, 0, 0, 0 # Prawn thinks color space is CMYK
fill { rectangle([20, bounds.top], 10, 10) }
restore_graphics_state # Oops, now PDF thinks color space is RGB again
fill_color 0, 0, 100, 0 # This won't work!
Expand Down
2 changes: 1 addition & 1 deletion bugs/resolved/stamp_color_issues.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
require 'prawn'

##
# This bug was reported in comments in issue #200
# This bug was reported in comments in issue #200
# When the bug is fixed the stamp text and shape color should be set to a blue CMYK color

pdf = Prawn::Document.generate("stamp_color_issues.pdf", :margin => [40, 45, 50, 45]) do
Expand Down
Loading