prawn 2.1.0 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +2 -0
- data.tar.gz.sig +0 -0
- data/Gemfile +1 -9
- data/Rakefile +12 -22
- data/lib/prawn.rb +29 -48
- data/lib/prawn/document.rb +148 -123
- data/lib/prawn/document/bounding_box.rb +33 -26
- data/lib/prawn/document/column_box.rb +5 -7
- data/lib/prawn/document/internals.rb +6 -6
- data/lib/prawn/document/span.rb +20 -17
- data/lib/prawn/encoding.rb +65 -67
- data/lib/prawn/errors.rb +10 -7
- data/lib/prawn/font.rb +78 -62
- data/lib/prawn/font/afm.rb +93 -66
- data/lib/prawn/font/dfont.rb +2 -10
- data/lib/prawn/font/ttc.rb +34 -0
- data/lib/prawn/font/ttf.rb +73 -65
- data/lib/prawn/font_metric_cache.rb +9 -8
- data/lib/prawn/graphics.rb +110 -70
- data/lib/prawn/graphics/blend_mode.rb +7 -8
- data/lib/prawn/graphics/cap_style.rb +2 -4
- data/lib/prawn/graphics/color.rb +23 -26
- data/lib/prawn/graphics/dash.rb +22 -12
- data/lib/prawn/graphics/join_style.rb +8 -4
- data/lib/prawn/graphics/patterns.rb +185 -96
- data/lib/prawn/graphics/transformation.rb +11 -9
- data/lib/prawn/graphics/transparency.rb +15 -13
- data/lib/prawn/grid.rb +20 -20
- data/lib/prawn/image_handler.rb +4 -6
- data/lib/prawn/images.rb +22 -15
- data/lib/prawn/images/image.rb +0 -1
- data/lib/prawn/images/jpg.rb +26 -22
- data/lib/prawn/images/png.rb +60 -57
- data/lib/prawn/measurement_extensions.rb +8 -9
- data/lib/prawn/measurements.rb +14 -15
- data/lib/prawn/outline.rb +96 -78
- data/lib/prawn/repeater.rb +12 -10
- data/lib/prawn/security.rb +66 -48
- data/lib/prawn/security/arcfour.rb +1 -3
- data/lib/prawn/soft_mask.rb +23 -25
- data/lib/prawn/stamp.rb +16 -12
- data/lib/prawn/text.rb +59 -45
- data/lib/prawn/text/box.rb +9 -8
- data/lib/prawn/text/formatted.rb +4 -6
- data/lib/prawn/text/formatted/arranger.rb +51 -30
- data/lib/prawn/text/formatted/box.rb +112 -88
- data/lib/prawn/text/formatted/fragment.rb +10 -15
- data/lib/prawn/text/formatted/line_wrap.rb +118 -61
- data/lib/prawn/text/formatted/parser.rb +134 -110
- data/lib/prawn/text/formatted/wrap.rb +42 -32
- data/lib/prawn/transformation_stack.rb +3 -4
- data/lib/prawn/utilities.rb +6 -21
- data/lib/prawn/version.rb +1 -3
- data/lib/prawn/view.rb +4 -2
- data/manual/basic_concepts/adding_pages.rb +4 -7
- data/manual/basic_concepts/basic_concepts.rb +29 -22
- data/manual/basic_concepts/creation.rb +8 -11
- data/manual/basic_concepts/cursor.rb +2 -5
- data/manual/basic_concepts/measurement.rb +3 -6
- data/manual/basic_concepts/origin.rb +3 -6
- data/manual/basic_concepts/other_cursor_helpers.rb +9 -12
- data/manual/basic_concepts/view.rb +20 -16
- data/manual/bounding_box/bounding_box.rb +27 -24
- data/manual/bounding_box/bounds.rb +9 -12
- data/manual/bounding_box/canvas.rb +2 -5
- data/manual/bounding_box/creation.rb +4 -7
- data/manual/bounding_box/indentation.rb +12 -15
- data/manual/bounding_box/nesting.rb +22 -17
- data/manual/bounding_box/russian_boxes.rb +8 -9
- data/manual/bounding_box/stretchy.rb +10 -13
- data/manual/contents.rb +26 -22
- data/manual/cover.rb +22 -20
- data/manual/document_and_page_options/background.rb +9 -13
- data/manual/document_and_page_options/document_and_page_options.rb +23 -20
- data/manual/document_and_page_options/metadata.rb +16 -16
- data/manual/document_and_page_options/page_margins.rb +16 -20
- data/manual/document_and_page_options/page_size.rb +11 -12
- data/manual/document_and_page_options/print_scaling.rb +15 -15
- data/manual/example_helper.rb +2 -4
- data/manual/graphics/blend_mode.rb +10 -9
- data/manual/graphics/circle_and_ellipse.rb +2 -5
- data/manual/graphics/color.rb +5 -9
- data/manual/graphics/common_lines.rb +5 -8
- data/manual/graphics/fill_and_stroke.rb +2 -5
- data/manual/graphics/fill_rules.rb +7 -10
- data/manual/graphics/gradients.rb +25 -21
- data/manual/graphics/graphics.rb +49 -43
- data/manual/graphics/helper.rb +10 -9
- data/manual/graphics/line_width.rb +5 -7
- data/manual/graphics/lines_and_curves.rb +5 -8
- data/manual/graphics/polygon.rb +4 -8
- data/manual/graphics/rectangle.rb +2 -5
- data/manual/graphics/rotate.rb +4 -7
- data/manual/graphics/scale.rb +12 -15
- data/manual/graphics/soft_masks.rb +1 -4
- data/manual/graphics/stroke_cap.rb +3 -6
- data/manual/graphics/stroke_dash.rb +9 -12
- data/manual/graphics/stroke_join.rb +2 -5
- data/manual/graphics/translate.rb +7 -10
- data/manual/graphics/transparency.rb +5 -8
- data/manual/how_to_read_this_manual.rb +4 -6
- data/manual/images/absolute_position.rb +4 -7
- data/manual/images/fit.rb +5 -8
- data/manual/images/horizontal.rb +6 -9
- data/manual/images/images.rb +25 -23
- data/manual/images/plain_image.rb +3 -6
- data/manual/images/scale.rb +7 -10
- data/manual/images/vertical.rb +10 -13
- data/manual/images/width_and_height.rb +8 -11
- data/manual/layout/boxes.rb +3 -6
- data/manual/layout/content.rb +5 -8
- data/manual/layout/layout.rb +16 -16
- data/manual/layout/simple_grid.rb +4 -7
- data/manual/outline/add_subsection_to.rb +18 -21
- data/manual/outline/insert_section_after.rb +13 -16
- data/manual/outline/outline.rb +19 -17
- data/manual/outline/sections_and_pages.rb +15 -18
- data/manual/repeatable_content/alternate_page_numbering.rb +19 -17
- data/manual/repeatable_content/page_numbering.rb +15 -16
- data/manual/repeatable_content/repeatable_content.rb +23 -19
- data/manual/repeatable_content/repeater.rb +12 -15
- data/manual/repeatable_content/stamp.rb +12 -15
- data/manual/security/encryption.rb +7 -10
- data/manual/security/permissions.rb +17 -14
- data/manual/security/security.rb +17 -16
- data/manual/table.rb +2 -4
- data/manual/text/alignment.rb +14 -17
- data/manual/text/color.rb +10 -11
- data/manual/text/column_box.rb +5 -8
- data/manual/text/fallback_fonts.rb +23 -21
- data/manual/text/font.rb +9 -12
- data/manual/text/font_size.rb +11 -14
- data/manual/text/font_style.rb +4 -7
- data/manual/text/formatted_callbacks.rb +23 -21
- data/manual/text/formatted_text.rb +31 -25
- data/manual/text/free_flowing_text.rb +18 -21
- data/manual/text/inline.rb +16 -19
- data/manual/text/kerning_and_character_spacing.rb +12 -15
- data/manual/text/leading.rb +5 -8
- data/manual/text/line_wrapping.rb +33 -17
- data/manual/text/paragraph_indentation.rb +11 -14
- data/manual/text/positioned_text.rb +13 -16
- data/manual/text/registering_families.rb +16 -19
- data/manual/text/rendering_and_color.rb +7 -10
- data/manual/text/right_to_left_text.rb +24 -19
- data/manual/text/rotation.rb +26 -23
- data/manual/text/single_usage.rb +6 -9
- data/manual/text/text.rb +56 -52
- data/manual/text/text_box_excess.rb +18 -17
- data/manual/text/text_box_extensions.rb +16 -15
- data/manual/text/text_box_overflow.rb +15 -18
- data/manual/text/utf8.rb +9 -12
- data/manual/text/win_ansi_charset.rb +18 -19
- data/prawn.gemspec +37 -27
- data/spec/extensions/encoding_helpers.rb +0 -2
- data/spec/manual_spec.rb +33 -0
- data/spec/prawn/document/bounding_box_spec.rb +546 -0
- data/spec/prawn/document/column_box_spec.rb +73 -0
- data/spec/prawn/document/security_spec.rb +173 -0
- data/spec/prawn/document_annotations_spec.rb +74 -0
- data/spec/prawn/document_destinations_spec.rb +13 -0
- data/spec/prawn/document_grid_spec.rb +96 -0
- data/spec/prawn/document_reference_spec.rb +25 -0
- data/spec/prawn/document_span_spec.rb +34 -0
- data/spec/prawn/document_spec.rb +751 -0
- data/spec/prawn/font_metric_cache_spec.rb +52 -0
- data/spec/prawn/font_spec.rb +513 -0
- data/spec/prawn/graphics/blend_mode_spec.rb +61 -0
- data/spec/prawn/graphics/transparency_spec.rb +79 -0
- data/spec/prawn/graphics_spec.rb +817 -0
- data/spec/prawn/graphics_stroke_styles_spec.rb +227 -0
- data/spec/{image_handler_spec.rb → prawn/image_handler_spec.rb} +13 -15
- data/spec/prawn/images/jpg_spec.rb +18 -0
- data/spec/prawn/images/png_spec.rb +281 -0
- data/spec/prawn/images_spec.rb +170 -0
- data/spec/prawn/measurements_extensions_spec.rb +22 -0
- data/spec/prawn/outline_spec.rb +408 -0
- data/spec/prawn/repeater_spec.rb +163 -0
- data/spec/prawn/soft_mask_spec.rb +72 -0
- data/spec/prawn/stamp_spec.rb +168 -0
- data/spec/prawn/text/box_spec.rb +1113 -0
- data/spec/prawn/text/formatted/arranger_spec.rb +464 -0
- data/spec/prawn/text/formatted/box_spec.rb +825 -0
- data/spec/prawn/text/formatted/fragment_spec.rb +341 -0
- data/spec/prawn/text/formatted/line_wrap_spec.rb +491 -0
- data/spec/prawn/text/formatted/parser_spec.rb +667 -0
- data/spec/prawn/text_draw_text_spec.rb +147 -0
- data/spec/prawn/text_rendering_mode_spec.rb +42 -0
- data/spec/prawn/text_spacing_spec.rb +93 -0
- data/spec/prawn/text_spec.rb +601 -0
- data/spec/prawn/text_with_inline_formatting_spec.rb +33 -0
- data/spec/{transformation_stack_spec.rb → prawn/transformation_stack_spec.rb} +21 -20
- data/spec/prawn/view_spec.rb +45 -0
- data/spec/spec_helper.rb +16 -16
- metadata +96 -151
- metadata.gz.sig +1 -0
- data/data/images/16bit.alpha +0 -0
- data/data/images/16bit.color +0 -0
- data/data/images/16bit.png +0 -0
- data/data/images/arrow.png +0 -0
- data/data/images/arrow2.png +0 -0
- data/data/images/blend_modes_bottom_layer.jpg +0 -0
- data/data/images/blend_modes_top_layer.jpg +0 -0
- data/data/images/dice.alpha +0 -0
- data/data/images/dice.color +0 -0
- data/data/images/dice.png +0 -0
- data/data/images/dice_interlaced.png +0 -0
- data/data/images/fractal.jpg +0 -0
- data/data/images/indexed_color.dat +0 -0
- data/data/images/indexed_color.png +0 -0
- data/data/images/indexed_transparency.png +0 -0
- data/data/images/indexed_transparency_alpha.dat +0 -0
- data/data/images/indexed_transparency_color.dat +0 -0
- data/data/images/letterhead.jpg +0 -0
- data/data/images/license.md +0 -8
- data/data/images/page_white_text.alpha +0 -0
- data/data/images/page_white_text.color +0 -0
- data/data/images/page_white_text.png +0 -0
- data/data/images/pigs.jpg +0 -0
- data/data/images/prawn.png +0 -0
- data/data/images/ruport.png +0 -0
- data/data/images/ruport_data.dat +0 -0
- data/data/images/ruport_transparent.png +0 -0
- data/data/images/ruport_type0.png +0 -0
- data/data/images/stef.jpg +0 -0
- data/data/images/tru256.bmp +0 -0
- data/data/images/web-links.dat +0 -1
- data/data/images/web-links.png +0 -0
- data/data/pdfs/complex_template.pdf +0 -0
- data/data/pdfs/contains_ttf_font.pdf +0 -0
- data/data/pdfs/encrypted.pdf +0 -0
- data/data/pdfs/form.pdf +1 -819
- data/data/pdfs/hexagon.pdf +0 -61
- data/data/pdfs/indirect_reference.pdf +0 -86
- data/data/pdfs/multipage_template.pdf +0 -127
- data/data/pdfs/nested_pages.pdf +0 -118
- data/data/pdfs/page_without_mediabox.pdf +0 -193
- data/data/pdfs/resources_as_indirect_object.pdf +0 -83
- data/data/pdfs/two_hexagons.pdf +0 -90
- data/data/pdfs/version_1_6.pdf +0 -61
- data/data/shift_jis_text.txt +0 -1
- data/spec/acceptance/png_spec.rb +0 -35
- data/spec/annotations_spec.rb +0 -67
- data/spec/blend_mode_spec.rb +0 -71
- data/spec/bounding_box_spec.rb +0 -501
- data/spec/column_box_spec.rb +0 -59
- data/spec/destinations_spec.rb +0 -13
- data/spec/document_spec.rb +0 -738
- data/spec/font_metric_cache_spec.rb +0 -52
- data/spec/font_spec.rb +0 -475
- data/spec/formatted_text_arranger_spec.rb +0 -452
- data/spec/formatted_text_box_spec.rb +0 -716
- data/spec/formatted_text_fragment_spec.rb +0 -299
- data/spec/graphics_spec.rb +0 -705
- data/spec/grid_spec.rb +0 -95
- data/spec/images_spec.rb +0 -167
- data/spec/inline_formatted_text_parser_spec.rb +0 -568
- data/spec/jpg_spec.rb +0 -23
- data/spec/line_wrap_spec.rb +0 -366
- data/spec/measurement_units_spec.rb +0 -22
- data/spec/outline_spec.rb +0 -409
- data/spec/png_spec.rb +0 -257
- data/spec/reference_spec.rb +0 -25
- data/spec/repeater_spec.rb +0 -154
- data/spec/security_spec.rb +0 -151
- data/spec/soft_mask_spec.rb +0 -78
- data/spec/span_spec.rb +0 -43
- data/spec/stamp_spec.rb +0 -179
- data/spec/stroke_styles_spec.rb +0 -208
- data/spec/text_at_spec.rb +0 -142
- data/spec/text_box_spec.rb +0 -1042
- data/spec/text_rendering_mode_spec.rb +0 -45
- data/spec/text_spacing_spec.rb +0 -93
- data/spec/text_spec.rb +0 -543
- data/spec/text_with_inline_formatting_spec.rb +0 -35
- data/spec/transparency_spec.rb +0 -91
- data/spec/view_spec.rb +0 -42
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Prawn::Text do
|
4
|
+
let(:pdf) { create_pdf }
|
5
|
+
|
6
|
+
describe '#formatted_text' do
|
7
|
+
it 'draws text' do
|
8
|
+
string = 'hello world'
|
9
|
+
format_array = [text: string]
|
10
|
+
pdf.formatted_text(format_array)
|
11
|
+
# grab the text from the rendered PDF and ensure it matches
|
12
|
+
text = PDF::Inspector::Text.analyze(pdf.render)
|
13
|
+
expect(text.strings.first).to eq(string)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
describe '#text with inline styling' do
|
18
|
+
it 'should automatically move to a new page if the tallest fragment' \
|
19
|
+
" on the next line won't fit in the available space" do
|
20
|
+
pdf.move_cursor_to(pdf.font.height)
|
21
|
+
formatted = "this contains <font size='24'>sized</font> text"
|
22
|
+
pdf.text(formatted, inline_format: true)
|
23
|
+
pages = PDF::Inspector::Page.analyze(pdf.render).pages
|
24
|
+
expect(pages.size).to eq(2)
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'embeds links as literal strings' do
|
28
|
+
pdf.text "<link href='http://wiki.github.com/sandal/prawn/'>wiki</link>",
|
29
|
+
inline_format: true
|
30
|
+
expect(pdf.render).to match(%r{/URI\s+\(http://wiki\.github\.com})
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -1,22 +1,21 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
require File.join(File.expand_path(File.dirname(__FILE__)), "spec_helper")
|
1
|
+
require 'spec_helper'
|
4
2
|
|
5
3
|
describe Prawn::TransformationStack do
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
4
|
+
let(:pdf) do
|
5
|
+
create_pdf do |document|
|
6
|
+
document.add_to_transformation_stack(2, 0, 0, 2, 100, 100)
|
7
|
+
end
|
8
|
+
end
|
9
|
+
let(:stack) { pdf.instance_variable_get(:@transformation_stack) }
|
11
10
|
|
12
|
-
describe
|
13
|
-
it
|
11
|
+
describe '#add_to_transformation_stack' do
|
12
|
+
it 'creates and adds to the stack' do
|
14
13
|
pdf.add_to_transformation_stack(1, 0, 0, 1, 20, 20)
|
15
14
|
|
16
15
|
expect(stack).to eq [[[2, 0, 0, 2, 100, 100], [1, 0, 0, 1, 20, 20]]]
|
17
16
|
end
|
18
17
|
|
19
|
-
it
|
18
|
+
it 'adds to the last stack' do
|
20
19
|
pdf.save_transformation_stack
|
21
20
|
pdf.add_to_transformation_stack(1, 0, 0, 1, 20, 20)
|
22
21
|
|
@@ -27,8 +26,8 @@ describe Prawn::TransformationStack do
|
|
27
26
|
end
|
28
27
|
end
|
29
28
|
|
30
|
-
describe
|
31
|
-
it
|
29
|
+
describe '#save_transformation_stack' do
|
30
|
+
it 'clones the last stack' do
|
32
31
|
pdf.save_transformation_stack
|
33
32
|
|
34
33
|
expect(stack.length).to eq 2
|
@@ -37,8 +36,8 @@ describe Prawn::TransformationStack do
|
|
37
36
|
end
|
38
37
|
end
|
39
38
|
|
40
|
-
describe
|
41
|
-
it
|
39
|
+
describe '#restore_transformation_stack' do
|
40
|
+
it 'pops off the last stack' do
|
42
41
|
pdf.save_transformation_stack
|
43
42
|
pdf.add_to_transformation_stack(1, 0, 0, 1, 20, 20)
|
44
43
|
pdf.restore_transformation_stack
|
@@ -47,17 +46,19 @@ describe Prawn::TransformationStack do
|
|
47
46
|
end
|
48
47
|
end
|
49
48
|
|
50
|
-
describe
|
49
|
+
describe 'current_transformation_matrix_with_translation' do
|
51
50
|
before do
|
52
51
|
pdf.add_to_transformation_stack(1, 0, 0, 1, 20, 20)
|
53
52
|
end
|
54
53
|
|
55
|
-
it
|
56
|
-
expect(pdf.current_transformation_matrix_with_translation)
|
54
|
+
it 'calculates the last transformation' do
|
55
|
+
expect(pdf.current_transformation_matrix_with_translation)
|
56
|
+
.to eq [2, 0, 0, 2, 140, 140]
|
57
57
|
end
|
58
58
|
|
59
|
-
it
|
60
|
-
expect(pdf.current_transformation_matrix_with_translation(15, 15))
|
59
|
+
it 'adds the supplied x and y coordinates to the transformation stack' do
|
60
|
+
expect(pdf.current_transformation_matrix_with_translation(15, 15))
|
61
|
+
.to eq [2, 0, 0, 2, 170, 170]
|
61
62
|
end
|
62
63
|
end
|
63
64
|
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Prawn::View do
|
4
|
+
let(:view_object) { Object.new.tap { |o| o.extend(described_class) } }
|
5
|
+
|
6
|
+
it 'provides a Prawn::Document object by default' do
|
7
|
+
expect(view_object.document).to be_kind_of(Prawn::Document)
|
8
|
+
end
|
9
|
+
|
10
|
+
it 'delegates unhandled methods to object returned by document method' do
|
11
|
+
doc = instance_double('Document')
|
12
|
+
allow(view_object).to receive(:document).and_return(doc)
|
13
|
+
|
14
|
+
allow(doc).to receive(:some_delegated_method)
|
15
|
+
|
16
|
+
view_object.some_delegated_method
|
17
|
+
|
18
|
+
expect(doc).to have_received(:some_delegated_method)
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'allows a block-like DSL via the update method' do
|
22
|
+
doc = instance_double('Document')
|
23
|
+
allow(view_object).to receive(:document).and_return(doc)
|
24
|
+
|
25
|
+
allow(doc).to receive(:foo)
|
26
|
+
allow(doc).to receive(:bar)
|
27
|
+
|
28
|
+
view_object.update do
|
29
|
+
foo
|
30
|
+
bar
|
31
|
+
end
|
32
|
+
expect(doc).to have_received(:foo)
|
33
|
+
expect(doc).to have_received(:bar)
|
34
|
+
end
|
35
|
+
|
36
|
+
it 'aliases save_as() to document.render_file()' do
|
37
|
+
doc = instance_double('Document')
|
38
|
+
allow(doc).to receive(:render_file)
|
39
|
+
|
40
|
+
allow(view_object).to receive(:document).and_return(doc)
|
41
|
+
|
42
|
+
view_object.save_as('foo.pdf')
|
43
|
+
expect(doc).to have_received(:render_file)
|
44
|
+
end
|
45
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,41 +1,39 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
1
|
puts "Prawn specs: Running on Ruby Version: #{RUBY_VERSION}"
|
4
2
|
|
5
|
-
require
|
3
|
+
require 'bundler'
|
6
4
|
Bundler.setup
|
7
5
|
|
8
|
-
if ENV[
|
9
|
-
require
|
6
|
+
if ENV['COVERAGE']
|
7
|
+
require 'simplecov'
|
10
8
|
SimpleCov.start do
|
11
|
-
add_filter
|
9
|
+
add_filter '/spec/'
|
12
10
|
end
|
13
11
|
end
|
14
12
|
|
15
|
-
require_relative
|
13
|
+
require_relative '../lib/prawn'
|
16
14
|
|
17
15
|
Prawn.debug = true
|
18
16
|
Prawn::Font::AFM.hide_m17n_warning = true
|
19
17
|
|
20
|
-
require
|
21
|
-
require
|
22
|
-
require
|
18
|
+
require 'rspec'
|
19
|
+
require 'pdf/reader'
|
20
|
+
require 'pdf/inspector'
|
23
21
|
|
24
22
|
# Requires supporting ruby files with custom matchers and macros, etc,
|
25
23
|
# in spec/extensions/ and its subdirectories.
|
26
|
-
Dir[File.dirname(__FILE__) +
|
24
|
+
Dir[File.dirname(__FILE__) + '/extensions/**/*.rb'].each { |f| require f }
|
27
25
|
|
28
26
|
RSpec.configure do |config|
|
29
27
|
config.include EncodingHelpers
|
30
28
|
end
|
31
29
|
|
32
|
-
def create_pdf(klass = Prawn::Document)
|
33
|
-
|
30
|
+
def create_pdf(klass = Prawn::Document, &block)
|
31
|
+
klass.new(margin: 0, &block)
|
34
32
|
end
|
35
33
|
|
36
34
|
RSpec::Matchers.define :have_parseable_xobjects do
|
37
35
|
match do |actual|
|
38
|
-
expect { PDF::Inspector::XObject.analyze(actual.render) }.
|
36
|
+
expect { PDF::Inspector::XObject.analyze(actual.render) }.to_not raise_error
|
39
37
|
true
|
40
38
|
end
|
41
39
|
failure_message do |actual|
|
@@ -44,6 +42,8 @@ RSpec::Matchers.define :have_parseable_xobjects do
|
|
44
42
|
end
|
45
43
|
|
46
44
|
# Make some methods public to assist in testing
|
47
|
-
module Prawn
|
48
|
-
|
45
|
+
module Prawn
|
46
|
+
module Graphics
|
47
|
+
public :map_to_absolute
|
48
|
+
end
|
49
49
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: prawn
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gregory Brown
|
@@ -11,8 +11,30 @@ authors:
|
|
11
11
|
- James Healy
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
|
-
cert_chain:
|
15
|
-
|
14
|
+
cert_chain:
|
15
|
+
- |
|
16
|
+
-----BEGIN CERTIFICATE-----
|
17
|
+
MIIDcDCCAligAwIBAgIBATANBgkqhkiG9w0BAQUFADA/MQ0wCwYDVQQDDARhbGV4
|
18
|
+
MRkwFwYKCZImiZPyLGQBGRYJcG9pbnRsZXNzMRMwEQYKCZImiZPyLGQBGRYDb25l
|
19
|
+
MB4XDTE3MDEwNDExNDAzM1oXDTE4MDEwNDExNDAzM1owPzENMAsGA1UEAwwEYWxl
|
20
|
+
eDEZMBcGCgmSJomT8ixkARkWCXBvaW50bGVzczETMBEGCgmSJomT8ixkARkWA29u
|
21
|
+
ZTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAM85Us8YQr55o/rMl+J+
|
22
|
+
ula89ODiqjdc0kk+ibzRLCpfaFUJWxEMrhFiApRCopFDMeGXHXjBkfBYsRMFVs0M
|
23
|
+
Zfe6rIKdNZQlQqHfJ2JlKFek0ehX81buGERi82wNwECNhOZu9c6G5gKjRPP/Q3Y6
|
24
|
+
K6f/TAggK0+/K1j1NjT+WSVaMBuyomM067ejwhiQkEA3+tT3oT/paEXCOfEtxOdX
|
25
|
+
1F8VFd2MbmMK6CGgHbFLApfyDBtDx+ydplGZ3IMZg2nPqwYXTPJx+IuRO21ssDad
|
26
|
+
gBMIAvL3wIeezJk2xONvhYg0K5jbIQOPB6zD1/9E6Q0LrwSBDkz5oyOn4PRZxgZ/
|
27
|
+
OiMCAwEAAaN3MHUwCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAwHQYDVR0OBBYEFE+A
|
28
|
+
jBJVt6ie5r83L/znvqjF1RuuMB0GA1UdEQQWMBSBEmFsZXhAcG9pbnRsZXNzLm9u
|
29
|
+
ZTAdBgNVHRIEFjAUgRJhbGV4QHBvaW50bGVzcy5vbmUwDQYJKoZIhvcNAQEFBQAD
|
30
|
+
ggEBAEmhsdVfgxHfXtOG6AP3qe7/PBjJPdUzNOkE/elj6TgpdvvJkOZ6QNyyqvpl
|
31
|
+
CsoDWL0EXPM5pIETaj5z9iBRK9fAi8YNS3zckhBJwhR78cb4+MiCPIBC+iiGx5bw
|
32
|
+
BFER2ASPeeY4uC0AHWHnURDLdxyZr+xp6pb/TitTAaCm18Kvkk1u60lOa4Jtdb+9
|
33
|
+
2U1KICEBoX6UAzdT3N0nZ3VKq/vHVrvV2oePYCMIlNkghWp+VUE91OTBDMjnjjj8
|
34
|
+
wxx1aB3kGoI0T6JXywKpPnzUt/qji/qpzCNiVJ0RZxzDHyZuL8NEoA9ORZnAIGiW
|
35
|
+
5u3JK+T0toNEYkMuV6W8NU+gVyo=
|
36
|
+
-----END CERTIFICATE-----
|
37
|
+
date: 2017-03-11 00:00:00.000000000 Z
|
16
38
|
dependencies:
|
17
39
|
- !ruby/object:Gem::Dependency
|
18
40
|
name: ttfunk
|
@@ -20,28 +42,28 @@ dependencies:
|
|
20
42
|
requirements:
|
21
43
|
- - "~>"
|
22
44
|
- !ruby/object:Gem::Version
|
23
|
-
version: 1.
|
45
|
+
version: '1.5'
|
24
46
|
type: :runtime
|
25
47
|
prerelease: false
|
26
48
|
version_requirements: !ruby/object:Gem::Requirement
|
27
49
|
requirements:
|
28
50
|
- - "~>"
|
29
51
|
- !ruby/object:Gem::Version
|
30
|
-
version: 1.
|
52
|
+
version: '1.5'
|
31
53
|
- !ruby/object:Gem::Dependency
|
32
54
|
name: pdf-core
|
33
55
|
requirement: !ruby/object:Gem::Requirement
|
34
56
|
requirements:
|
35
57
|
- - "~>"
|
36
58
|
- !ruby/object:Gem::Version
|
37
|
-
version: 0.
|
59
|
+
version: 0.7.0
|
38
60
|
type: :runtime
|
39
61
|
prerelease: false
|
40
62
|
version_requirements: !ruby/object:Gem::Requirement
|
41
63
|
requirements:
|
42
64
|
- - "~>"
|
43
65
|
- !ruby/object:Gem::Version
|
44
|
-
version: 0.
|
66
|
+
version: 0.7.0
|
45
67
|
- !ruby/object:Gem::Dependency
|
46
68
|
name: pdf-inspector
|
47
69
|
requirement: !ruby/object:Gem::Requirement
|
@@ -88,16 +110,16 @@ dependencies:
|
|
88
110
|
name: rake
|
89
111
|
requirement: !ruby/object:Gem::Requirement
|
90
112
|
requirements:
|
91
|
-
- - "
|
113
|
+
- - "~>"
|
92
114
|
- !ruby/object:Gem::Version
|
93
|
-
version: '0'
|
115
|
+
version: '12.0'
|
94
116
|
type: :development
|
95
117
|
prerelease: false
|
96
118
|
version_requirements: !ruby/object:Gem::Requirement
|
97
119
|
requirements:
|
98
|
-
- - "
|
120
|
+
- - "~>"
|
99
121
|
- !ruby/object:Gem::Version
|
100
|
-
version: '0'
|
122
|
+
version: '12.0'
|
101
123
|
- !ruby/object:Gem::Dependency
|
102
124
|
name: simplecov
|
103
125
|
requirement: !ruby/object:Gem::Requirement
|
@@ -132,44 +154,49 @@ dependencies:
|
|
132
154
|
requirements:
|
133
155
|
- - "~>"
|
134
156
|
- !ruby/object:Gem::Version
|
135
|
-
version: '1.
|
157
|
+
version: '1.4'
|
158
|
+
- - ">="
|
159
|
+
- !ruby/object:Gem::Version
|
160
|
+
version: 1.4.1
|
136
161
|
type: :development
|
137
162
|
prerelease: false
|
138
163
|
version_requirements: !ruby/object:Gem::Requirement
|
139
164
|
requirements:
|
140
165
|
- - "~>"
|
141
166
|
- !ruby/object:Gem::Version
|
142
|
-
version: '1.
|
167
|
+
version: '1.4'
|
168
|
+
- - ">="
|
169
|
+
- !ruby/object:Gem::Version
|
170
|
+
version: 1.4.1
|
143
171
|
- !ruby/object:Gem::Dependency
|
144
172
|
name: rubocop
|
145
173
|
requirement: !ruby/object:Gem::Requirement
|
146
174
|
requirements:
|
147
|
-
- -
|
175
|
+
- - "~>"
|
148
176
|
- !ruby/object:Gem::Version
|
149
|
-
version: 0.
|
177
|
+
version: 0.47.1
|
150
178
|
type: :development
|
151
179
|
prerelease: false
|
152
180
|
version_requirements: !ruby/object:Gem::Requirement
|
153
181
|
requirements:
|
154
|
-
- -
|
182
|
+
- - "~>"
|
155
183
|
- !ruby/object:Gem::Version
|
156
|
-
version: 0.
|
184
|
+
version: 0.47.1
|
157
185
|
- !ruby/object:Gem::Dependency
|
158
|
-
name:
|
186
|
+
name: rubocop-rspec
|
159
187
|
requirement: !ruby/object:Gem::Requirement
|
160
188
|
requirements:
|
161
|
-
- -
|
189
|
+
- - "~>"
|
162
190
|
- !ruby/object:Gem::Version
|
163
|
-
version:
|
191
|
+
version: '1.10'
|
164
192
|
type: :development
|
165
193
|
prerelease: false
|
166
194
|
version_requirements: !ruby/object:Gem::Requirement
|
167
195
|
requirements:
|
168
|
-
- -
|
196
|
+
- - "~>"
|
169
197
|
- !ruby/object:Gem::Version
|
170
|
-
version:
|
171
|
-
description:
|
172
|
-
Prawn is a fast, tiny, and nimble PDF generator for Ruby
|
198
|
+
version: '1.10'
|
199
|
+
description: " Prawn is a fast, tiny, and nimble PDF generator for Ruby\n"
|
173
200
|
email:
|
174
201
|
- gregory.t.brown@gmail.com
|
175
202
|
- brad@bradediger.com
|
@@ -202,51 +229,6 @@ files:
|
|
202
229
|
- data/fonts/Times-Italic.afm
|
203
230
|
- data/fonts/Times-Roman.afm
|
204
231
|
- data/fonts/ZapfDingbats.afm
|
205
|
-
- data/images/16bit.alpha
|
206
|
-
- data/images/16bit.color
|
207
|
-
- data/images/16bit.png
|
208
|
-
- data/images/arrow.png
|
209
|
-
- data/images/arrow2.png
|
210
|
-
- data/images/blend_modes_bottom_layer.jpg
|
211
|
-
- data/images/blend_modes_top_layer.jpg
|
212
|
-
- data/images/dice.alpha
|
213
|
-
- data/images/dice.color
|
214
|
-
- data/images/dice.png
|
215
|
-
- data/images/dice_interlaced.png
|
216
|
-
- data/images/fractal.jpg
|
217
|
-
- data/images/indexed_color.dat
|
218
|
-
- data/images/indexed_color.png
|
219
|
-
- data/images/indexed_transparency.png
|
220
|
-
- data/images/indexed_transparency_alpha.dat
|
221
|
-
- data/images/indexed_transparency_color.dat
|
222
|
-
- data/images/letterhead.jpg
|
223
|
-
- data/images/license.md
|
224
|
-
- data/images/page_white_text.alpha
|
225
|
-
- data/images/page_white_text.color
|
226
|
-
- data/images/page_white_text.png
|
227
|
-
- data/images/pigs.jpg
|
228
|
-
- data/images/prawn.png
|
229
|
-
- data/images/ruport.png
|
230
|
-
- data/images/ruport_data.dat
|
231
|
-
- data/images/ruport_transparent.png
|
232
|
-
- data/images/ruport_type0.png
|
233
|
-
- data/images/stef.jpg
|
234
|
-
- data/images/tru256.bmp
|
235
|
-
- data/images/web-links.dat
|
236
|
-
- data/images/web-links.png
|
237
|
-
- data/pdfs/complex_template.pdf
|
238
|
-
- data/pdfs/contains_ttf_font.pdf
|
239
|
-
- data/pdfs/encrypted.pdf
|
240
|
-
- data/pdfs/form.pdf
|
241
|
-
- data/pdfs/hexagon.pdf
|
242
|
-
- data/pdfs/indirect_reference.pdf
|
243
|
-
- data/pdfs/multipage_template.pdf
|
244
|
-
- data/pdfs/nested_pages.pdf
|
245
|
-
- data/pdfs/page_without_mediabox.pdf
|
246
|
-
- data/pdfs/resources_as_indirect_object.pdf
|
247
|
-
- data/pdfs/two_hexagons.pdf
|
248
|
-
- data/pdfs/version_1_6.pdf
|
249
|
-
- data/shift_jis_text.txt
|
250
232
|
- lib/prawn.rb
|
251
233
|
- lib/prawn/document.rb
|
252
234
|
- lib/prawn/document/bounding_box.rb
|
@@ -258,6 +240,7 @@ files:
|
|
258
240
|
- lib/prawn/font.rb
|
259
241
|
- lib/prawn/font/afm.rb
|
260
242
|
- lib/prawn/font/dfont.rb
|
243
|
+
- lib/prawn/font/ttc.rb
|
261
244
|
- lib/prawn/font/ttf.rb
|
262
245
|
- lib/prawn/font_metric_cache.rb
|
263
246
|
- lib/prawn/graphics.rb
|
@@ -397,48 +380,48 @@ files:
|
|
397
380
|
- manual/text/utf8.rb
|
398
381
|
- manual/text/win_ansi_charset.rb
|
399
382
|
- prawn.gemspec
|
400
|
-
- spec/acceptance/png_spec.rb
|
401
|
-
- spec/annotations_spec.rb
|
402
|
-
- spec/blend_mode_spec.rb
|
403
|
-
- spec/bounding_box_spec.rb
|
404
|
-
- spec/column_box_spec.rb
|
405
383
|
- spec/data/curves.pdf
|
406
|
-
- spec/destinations_spec.rb
|
407
|
-
- spec/document_spec.rb
|
408
384
|
- spec/extensions/encoding_helpers.rb
|
409
|
-
- spec/
|
410
|
-
- spec/
|
411
|
-
- spec/
|
412
|
-
- spec/
|
413
|
-
- spec/
|
414
|
-
- spec/
|
415
|
-
- spec/
|
416
|
-
- spec/
|
417
|
-
- spec/
|
418
|
-
- spec/
|
419
|
-
- spec/
|
420
|
-
- spec/
|
421
|
-
- spec/
|
422
|
-
- spec/
|
423
|
-
- spec/
|
424
|
-
- spec/
|
425
|
-
- spec/
|
426
|
-
- spec/
|
427
|
-
- spec/
|
428
|
-
- spec/
|
385
|
+
- spec/manual_spec.rb
|
386
|
+
- spec/prawn/document/bounding_box_spec.rb
|
387
|
+
- spec/prawn/document/column_box_spec.rb
|
388
|
+
- spec/prawn/document/security_spec.rb
|
389
|
+
- spec/prawn/document_annotations_spec.rb
|
390
|
+
- spec/prawn/document_destinations_spec.rb
|
391
|
+
- spec/prawn/document_grid_spec.rb
|
392
|
+
- spec/prawn/document_reference_spec.rb
|
393
|
+
- spec/prawn/document_span_spec.rb
|
394
|
+
- spec/prawn/document_spec.rb
|
395
|
+
- spec/prawn/font_metric_cache_spec.rb
|
396
|
+
- spec/prawn/font_spec.rb
|
397
|
+
- spec/prawn/graphics/blend_mode_spec.rb
|
398
|
+
- spec/prawn/graphics/transparency_spec.rb
|
399
|
+
- spec/prawn/graphics_spec.rb
|
400
|
+
- spec/prawn/graphics_stroke_styles_spec.rb
|
401
|
+
- spec/prawn/image_handler_spec.rb
|
402
|
+
- spec/prawn/images/jpg_spec.rb
|
403
|
+
- spec/prawn/images/png_spec.rb
|
404
|
+
- spec/prawn/images_spec.rb
|
405
|
+
- spec/prawn/measurements_extensions_spec.rb
|
406
|
+
- spec/prawn/outline_spec.rb
|
407
|
+
- spec/prawn/repeater_spec.rb
|
408
|
+
- spec/prawn/soft_mask_spec.rb
|
409
|
+
- spec/prawn/stamp_spec.rb
|
410
|
+
- spec/prawn/text/box_spec.rb
|
411
|
+
- spec/prawn/text/formatted/arranger_spec.rb
|
412
|
+
- spec/prawn/text/formatted/box_spec.rb
|
413
|
+
- spec/prawn/text/formatted/fragment_spec.rb
|
414
|
+
- spec/prawn/text/formatted/line_wrap_spec.rb
|
415
|
+
- spec/prawn/text/formatted/parser_spec.rb
|
416
|
+
- spec/prawn/text_draw_text_spec.rb
|
417
|
+
- spec/prawn/text_rendering_mode_spec.rb
|
418
|
+
- spec/prawn/text_spacing_spec.rb
|
419
|
+
- spec/prawn/text_spec.rb
|
420
|
+
- spec/prawn/text_with_inline_formatting_spec.rb
|
421
|
+
- spec/prawn/transformation_stack_spec.rb
|
422
|
+
- spec/prawn/view_spec.rb
|
429
423
|
- spec/spec_helper.rb
|
430
|
-
|
431
|
-
- spec/stroke_styles_spec.rb
|
432
|
-
- spec/text_at_spec.rb
|
433
|
-
- spec/text_box_spec.rb
|
434
|
-
- spec/text_rendering_mode_spec.rb
|
435
|
-
- spec/text_spacing_spec.rb
|
436
|
-
- spec/text_spec.rb
|
437
|
-
- spec/text_with_inline_formatting_spec.rb
|
438
|
-
- spec/transformation_stack_spec.rb
|
439
|
-
- spec/transparency_spec.rb
|
440
|
-
- spec/view_spec.rb
|
441
|
-
homepage: http://prawn.majesticseacreature.com
|
424
|
+
homepage: http://prawnpdf.org
|
442
425
|
licenses:
|
443
426
|
- PRAWN
|
444
427
|
- GPL-2.0
|
@@ -450,56 +433,18 @@ require_paths:
|
|
450
433
|
- lib
|
451
434
|
required_ruby_version: !ruby/object:Gem::Requirement
|
452
435
|
requirements:
|
453
|
-
- - "
|
436
|
+
- - "~>"
|
454
437
|
- !ruby/object:Gem::Version
|
455
|
-
version: 2.
|
438
|
+
version: '2.1'
|
456
439
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
457
440
|
requirements:
|
458
441
|
- - ">="
|
459
442
|
- !ruby/object:Gem::Version
|
460
443
|
version: 1.3.6
|
461
444
|
requirements: []
|
462
|
-
rubyforge_project:
|
463
|
-
rubygems_version: 2.
|
445
|
+
rubyforge_project:
|
446
|
+
rubygems_version: 2.6.10
|
464
447
|
signing_key:
|
465
448
|
specification_version: 4
|
466
449
|
summary: A fast and nimble PDF generator for Ruby
|
467
|
-
test_files:
|
468
|
-
- spec/annotations_spec.rb
|
469
|
-
- spec/blend_mode_spec.rb
|
470
|
-
- spec/bounding_box_spec.rb
|
471
|
-
- spec/column_box_spec.rb
|
472
|
-
- spec/destinations_spec.rb
|
473
|
-
- spec/document_spec.rb
|
474
|
-
- spec/font_metric_cache_spec.rb
|
475
|
-
- spec/font_spec.rb
|
476
|
-
- spec/formatted_text_arranger_spec.rb
|
477
|
-
- spec/formatted_text_box_spec.rb
|
478
|
-
- spec/formatted_text_fragment_spec.rb
|
479
|
-
- spec/graphics_spec.rb
|
480
|
-
- spec/grid_spec.rb
|
481
|
-
- spec/image_handler_spec.rb
|
482
|
-
- spec/images_spec.rb
|
483
|
-
- spec/inline_formatted_text_parser_spec.rb
|
484
|
-
- spec/jpg_spec.rb
|
485
|
-
- spec/line_wrap_spec.rb
|
486
|
-
- spec/measurement_units_spec.rb
|
487
|
-
- spec/outline_spec.rb
|
488
|
-
- spec/png_spec.rb
|
489
|
-
- spec/reference_spec.rb
|
490
|
-
- spec/repeater_spec.rb
|
491
|
-
- spec/security_spec.rb
|
492
|
-
- spec/soft_mask_spec.rb
|
493
|
-
- spec/span_spec.rb
|
494
|
-
- spec/stamp_spec.rb
|
495
|
-
- spec/stroke_styles_spec.rb
|
496
|
-
- spec/text_at_spec.rb
|
497
|
-
- spec/text_box_spec.rb
|
498
|
-
- spec/text_rendering_mode_spec.rb
|
499
|
-
- spec/text_spacing_spec.rb
|
500
|
-
- spec/text_spec.rb
|
501
|
-
- spec/text_with_inline_formatting_spec.rb
|
502
|
-
- spec/transformation_stack_spec.rb
|
503
|
-
- spec/transparency_spec.rb
|
504
|
-
- spec/view_spec.rb
|
505
|
-
has_rdoc:
|
450
|
+
test_files: []
|