prawn 2.0.1 → 2.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +7 -5
- data/lib/prawn.rb +4 -4
- data/lib/prawn/document.rb +47 -46
- data/lib/prawn/document/bounding_box.rb +13 -19
- data/lib/prawn/document/column_box.rb +3 -5
- data/lib/prawn/document/internals.rb +0 -1
- data/lib/prawn/document/span.rb +12 -12
- data/lib/prawn/errors.rb +32 -33
- data/lib/prawn/font.rb +29 -36
- data/lib/prawn/font/afm.rb +20 -20
- data/lib/prawn/font/dfont.rb +0 -1
- data/lib/prawn/font/ttf.rb +30 -27
- data/lib/prawn/font_metric_cache.rb +4 -8
- data/lib/prawn/graphics.rb +37 -42
- data/lib/prawn/graphics/cap_style.rb +1 -1
- data/lib/prawn/graphics/color.rb +21 -23
- data/lib/prawn/graphics/dash.rb +5 -6
- data/lib/prawn/graphics/join_style.rb +1 -2
- data/lib/prawn/graphics/patterns.rb +25 -21
- data/lib/prawn/graphics/transformation.rb +4 -5
- data/lib/prawn/graphics/transparency.rb +6 -8
- data/lib/prawn/grid.rb +21 -14
- data/lib/prawn/image_handler.rb +2 -2
- data/lib/prawn/images.rb +29 -31
- data/lib/prawn/images/image.rb +1 -1
- data/lib/prawn/images/jpg.rb +10 -12
- data/lib/prawn/images/png.rb +13 -13
- data/lib/prawn/measurements.rb +7 -14
- data/lib/prawn/outline.rb +6 -6
- data/lib/prawn/repeater.rb +1 -5
- data/lib/prawn/security.rb +17 -25
- data/lib/prawn/security/arcfour.rb +1 -1
- data/lib/prawn/soft_mask.rb +11 -12
- data/lib/prawn/stamp.rb +16 -8
- data/lib/prawn/text.rb +23 -20
- data/lib/prawn/text/box.rb +3 -6
- data/lib/prawn/text/formatted/arranger.rb +9 -12
- data/lib/prawn/text/formatted/box.rb +23 -22
- data/lib/prawn/text/formatted/fragment.rb +0 -4
- data/lib/prawn/text/formatted/line_wrap.rb +13 -24
- data/lib/prawn/text/formatted/parser.rb +16 -20
- data/lib/prawn/text/formatted/wrap.rb +2 -7
- data/lib/prawn/utilities.rb +6 -3
- data/lib/prawn/version.rb +1 -1
- data/manual/basic_concepts/basic_concepts.rb +0 -2
- data/manual/basic_concepts/view.rb +1 -1
- data/manual/bounding_box/bounding_box.rb +0 -3
- data/manual/bounding_box/russian_boxes.rb +7 -8
- data/manual/bounding_box/stretchy.rb +0 -1
- data/manual/contents.rb +2 -2
- data/manual/cover.rb +11 -12
- data/manual/document_and_page_options/document_and_page_options.rb +2 -5
- data/manual/document_and_page_options/metadata.rb +10 -10
- data/manual/document_and_page_options/page_size.rb +0 -1
- data/manual/graphics/fill_rules.rb +5 -4
- data/manual/graphics/graphics.rb +0 -3
- data/manual/graphics/lines_and_curves.rb +1 -1
- data/manual/graphics/rotate.rb +0 -2
- data/manual/graphics/scale.rb +4 -2
- data/manual/graphics/soft_masks.rb +0 -1
- data/manual/graphics/stroke_cap.rb +1 -1
- data/manual/graphics/stroke_join.rb +1 -1
- data/manual/graphics/translate.rb +3 -3
- data/manual/graphics/transparency.rb +0 -1
- data/manual/how_to_read_this_manual.rb +0 -1
- data/manual/images/images.rb +0 -3
- data/manual/layout/boxes.rb +5 -5
- data/manual/layout/content.rb +2 -2
- data/manual/layout/layout.rb +0 -3
- data/manual/outline/outline.rb +0 -3
- data/manual/repeatable_content/page_numbering.rb +1 -1
- data/manual/repeatable_content/repeatable_content.rb +0 -3
- data/manual/repeatable_content/repeater.rb +6 -6
- data/manual/security/encryption.rb +0 -2
- data/manual/security/permissions.rb +0 -2
- data/manual/security/security.rb +0 -3
- data/manual/text/alignment.rb +3 -3
- data/manual/text/color.rb +0 -1
- data/manual/text/column_box.rb +0 -1
- data/manual/text/fallback_fonts.rb +2 -2
- data/manual/text/formatted_callbacks.rb +3 -2
- data/manual/text/paragraph_indentation.rb +2 -3
- data/manual/text/registering_families.rb +13 -9
- data/manual/text/rotation.rb +0 -1
- data/manual/text/text.rb +0 -3
- data/manual/text/text_box_overflow.rb +7 -5
- data/manual/text/utf8.rb +1 -1
- data/manual/text/win_ansi_charset.rb +2 -2
- data/prawn.gemspec +4 -4
- data/spec/acceptance/png.rb +6 -7
- data/spec/annotations_spec.rb +21 -28
- data/spec/bounding_box_spec.rb +100 -109
- data/spec/column_box_spec.rb +26 -32
- data/spec/destinations_spec.rb +2 -4
- data/spec/document_spec.rb +145 -151
- data/spec/extensions/mocha.rb +0 -1
- data/spec/font_metric_cache_spec.rb +7 -7
- data/spec/font_spec.rb +103 -102
- data/spec/formatted_text_arranger_spec.rb +76 -74
- data/spec/formatted_text_box_spec.rb +170 -159
- data/spec/formatted_text_fragment_spec.rb +57 -56
- data/spec/graphics_spec.rb +158 -175
- data/spec/grid_spec.rb +28 -29
- data/spec/image_handler_spec.rb +4 -5
- data/spec/images_spec.rb +50 -36
- data/spec/inline_formatted_text_parser_spec.rb +397 -393
- data/spec/jpg_spec.rb +4 -6
- data/spec/line_wrap_spec.rb +54 -55
- data/spec/measurement_units_spec.rb +12 -15
- data/spec/outline_spec.rb +77 -98
- data/spec/png_spec.rb +55 -65
- data/spec/reference_spec.rb +3 -3
- data/spec/repeater_spec.rb +20 -26
- data/spec/security_spec.rb +42 -49
- data/spec/soft_mask_spec.rb +4 -5
- data/spec/span_spec.rb +5 -6
- data/spec/spec_helper.rb +2 -4
- data/spec/stamp_spec.rb +41 -22
- data/spec/stroke_styles_spec.rb +36 -39
- data/spec/text_at_spec.rb +28 -29
- data/spec/text_box_spec.rb +160 -165
- data/spec/text_rendering_mode_spec.rb +9 -9
- data/spec/text_spacing_spec.rb +13 -13
- data/spec/text_spec.rb +116 -124
- data/spec/text_with_inline_formatting_spec.rb +5 -5
- data/spec/transparency_spec.rb +20 -20
- data/spec/view_spec.rb +0 -1
- metadata +7 -7
@@ -10,26 +10,26 @@ describe "#formatted_text" do
|
|
10
10
|
@pdf.formatted_text(format_array)
|
11
11
|
# grab the text from the rendered PDF and ensure it matches
|
12
12
|
text = PDF::Inspector::Text.analyze(@pdf.render)
|
13
|
-
text.strings.first.
|
13
|
+
expect(text.strings.first).to eq(string)
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
17
|
describe "#text with inline styling" do
|
18
18
|
before(:each) { create_pdf }
|
19
19
|
|
20
|
-
it "should automatically move to a new page if the tallest fragment"
|
20
|
+
it "should automatically move to a new page if the tallest fragment" \
|
21
21
|
" on the next line won't fit in the available space" do
|
22
22
|
create_pdf
|
23
23
|
@pdf.move_cursor_to(@pdf.font.height)
|
24
24
|
formatted = "this contains <font size='24'>sized</font> text"
|
25
25
|
@pdf.text(formatted, :inline_format => true)
|
26
26
|
pages = PDF::Inspector::Page.analyze(@pdf.render).pages
|
27
|
-
pages.size.
|
27
|
+
expect(pages.size).to eq(2)
|
28
28
|
end
|
29
29
|
|
30
30
|
it "should embed links as literal strings" do
|
31
31
|
@pdf.text "<link href='http://wiki.github.com/sandal/prawn/'>wiki</link>",
|
32
|
-
|
33
|
-
@pdf.render.
|
32
|
+
:inline_format => true
|
33
|
+
expect(@pdf.render).to match(%r{/URI\s+\(http://wiki\.github\.com})
|
34
34
|
end
|
35
35
|
end
|
data/spec/transparency_spec.rb
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
require File.join(File.expand_path(File.dirname(__FILE__)), "spec_helper")
|
4
4
|
|
5
5
|
module TransparencyHelper
|
6
|
-
def make_transparent(opacity, stroke_opacity=opacity)
|
6
|
+
def make_transparent(opacity, stroke_opacity = opacity)
|
7
7
|
@pdf.transparent(opacity, stroke_opacity) do
|
8
8
|
yield if block_given?
|
9
9
|
end
|
@@ -17,60 +17,60 @@ describe "Document with transparency" do
|
|
17
17
|
create_pdf
|
18
18
|
make_transparent(0.5)
|
19
19
|
str = @pdf.render
|
20
|
-
str[0,8].
|
20
|
+
expect(str[0, 8]).to eq("%PDF-1.4")
|
21
21
|
end
|
22
22
|
|
23
|
-
it "a new extended graphics state should be created for "
|
23
|
+
it "a new extended graphics state should be created for " \
|
24
24
|
"each unique transparency setting" do
|
25
25
|
create_pdf
|
26
26
|
make_transparent(0.5, 0.2) do
|
27
27
|
make_transparent(0.5, 0.75)
|
28
28
|
end
|
29
29
|
extgstates = PDF::Inspector::ExtGState.analyze(@pdf.render).extgstates
|
30
|
-
extgstates.length.
|
30
|
+
expect(extgstates.length).to eq(2)
|
31
31
|
end
|
32
32
|
|
33
|
-
it "a new extended graphics state should not be created for "
|
33
|
+
it "a new extended graphics state should not be created for " \
|
34
34
|
"each duplicate transparency setting" do
|
35
35
|
create_pdf
|
36
36
|
make_transparent(0.5, 0.75) do
|
37
37
|
make_transparent(0.5, 0.75)
|
38
38
|
end
|
39
39
|
extgstates = PDF::Inspector::ExtGState.analyze(@pdf.render).extgstates
|
40
|
-
extgstates.length.
|
40
|
+
expect(extgstates.length).to eq(1)
|
41
41
|
end
|
42
42
|
|
43
|
-
it "setting the transparency with only one parameter sets the transparency"
|
43
|
+
it "setting the transparency with only one parameter sets the transparency" \
|
44
44
|
" for both the fill and the stroke" do
|
45
45
|
create_pdf
|
46
46
|
make_transparent(0.5)
|
47
47
|
extgstate = PDF::Inspector::ExtGState.analyze(@pdf.render).extgstates[0]
|
48
|
-
extgstate[:opacity].
|
49
|
-
extgstate[:stroke_opacity].
|
48
|
+
expect(extgstate[:opacity]).to eq(0.5)
|
49
|
+
expect(extgstate[:stroke_opacity]).to eq(0.5)
|
50
50
|
end
|
51
51
|
|
52
|
-
it "setting the transparency with a numerical parameter and "
|
53
|
-
"a :stroke should set the fill transparency to the numerical parameter "
|
52
|
+
it "setting the transparency with a numerical parameter and " \
|
53
|
+
"a :stroke should set the fill transparency to the numerical parameter " \
|
54
54
|
"and the stroke transparency to the option" do
|
55
55
|
create_pdf
|
56
56
|
make_transparent(0.5, 0.2)
|
57
57
|
extgstate = PDF::Inspector::ExtGState.analyze(@pdf.render).extgstates[0]
|
58
|
-
extgstate[:opacity].
|
59
|
-
extgstate[:stroke_opacity].
|
58
|
+
expect(extgstate[:opacity]).to eq(0.5)
|
59
|
+
expect(extgstate[:stroke_opacity]).to eq(0.2)
|
60
60
|
end
|
61
61
|
|
62
62
|
it "should enforce the valid range of 0.0 to 1.0" do
|
63
63
|
create_pdf
|
64
64
|
make_transparent(-0.5, -0.2)
|
65
65
|
extgstate = PDF::Inspector::ExtGState.analyze(@pdf.render).extgstates[0]
|
66
|
-
extgstate[:opacity].
|
67
|
-
extgstate[:stroke_opacity].
|
66
|
+
expect(extgstate[:opacity]).to eq(0.0)
|
67
|
+
expect(extgstate[:stroke_opacity]).to eq(0.0)
|
68
68
|
|
69
69
|
create_pdf
|
70
70
|
make_transparent(2.0, 3.0)
|
71
71
|
extgstate = PDF::Inspector::ExtGState.analyze(@pdf.render).extgstates[0]
|
72
|
-
extgstate[:opacity].
|
73
|
-
extgstate[:stroke_opacity].
|
72
|
+
expect(extgstate[:opacity]).to eq(1.0)
|
73
|
+
expect(extgstate[:stroke_opacity]).to eq(1.0)
|
74
74
|
end
|
75
75
|
|
76
76
|
describe "with more than one page" do
|
@@ -83,9 +83,9 @@ describe "Document with transparency" do
|
|
83
83
|
make_transparent(0.5, 0.2)
|
84
84
|
extgstates = PDF::Inspector::ExtGState.analyze(@pdf.render).extgstates
|
85
85
|
extgstate = extgstates[0]
|
86
|
-
extgstates.length.
|
87
|
-
extgstate[:opacity].
|
88
|
-
extgstate[:stroke_opacity].
|
86
|
+
expect(extgstates.length).to eq(2)
|
87
|
+
expect(extgstate[:opacity]).to eq(0.5)
|
88
|
+
expect(extgstate[:stroke_opacity]).to eq(0.2)
|
89
89
|
end
|
90
90
|
end
|
91
91
|
end
|
data/spec/view_spec.rb
CHANGED
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.0.
|
4
|
+
version: 2.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gregory Brown
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2015-
|
15
|
+
date: 2015-07-16 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: ttfunk
|
@@ -34,14 +34,14 @@ dependencies:
|
|
34
34
|
requirements:
|
35
35
|
- - "~>"
|
36
36
|
- !ruby/object:Gem::Version
|
37
|
-
version: 0.
|
37
|
+
version: 0.6.0
|
38
38
|
type: :runtime
|
39
39
|
prerelease: false
|
40
40
|
version_requirements: !ruby/object:Gem::Requirement
|
41
41
|
requirements:
|
42
42
|
- - "~>"
|
43
43
|
- !ruby/object:Gem::Version
|
44
|
-
version: 0.
|
44
|
+
version: 0.6.0
|
45
45
|
- !ruby/object:Gem::Dependency
|
46
46
|
name: pdf-inspector
|
47
47
|
requirement: !ruby/object:Gem::Requirement
|
@@ -160,14 +160,14 @@ dependencies:
|
|
160
160
|
requirements:
|
161
161
|
- - '='
|
162
162
|
- !ruby/object:Gem::Version
|
163
|
-
version: 0.
|
163
|
+
version: 0.30.1
|
164
164
|
type: :development
|
165
165
|
prerelease: false
|
166
166
|
version_requirements: !ruby/object:Gem::Requirement
|
167
167
|
requirements:
|
168
168
|
- - '='
|
169
169
|
- !ruby/object:Gem::Version
|
170
|
-
version: 0.
|
170
|
+
version: 0.30.1
|
171
171
|
- !ruby/object:Gem::Dependency
|
172
172
|
name: code_statistics
|
173
173
|
requirement: !ruby/object:Gem::Requirement
|
@@ -466,7 +466,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
466
466
|
version: 1.3.6
|
467
467
|
requirements: []
|
468
468
|
rubyforge_project: prawn
|
469
|
-
rubygems_version: 2.
|
469
|
+
rubygems_version: 2.4.5
|
470
470
|
signing_key:
|
471
471
|
specification_version: 4
|
472
472
|
summary: A fast and nimble PDF generator for Ruby
|