hexapdf 0.35.0 → 0.36.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +37 -0
- data/lib/hexapdf/composer.rb +2 -1
- data/lib/hexapdf/configuration.rb +1 -0
- data/lib/hexapdf/content/canvas_composer.rb +1 -1
- data/lib/hexapdf/content/graphic_object/endpoint_arc.rb +2 -8
- data/lib/hexapdf/document/layout.rb +15 -6
- data/lib/hexapdf/document.rb +1 -0
- data/lib/hexapdf/layout/box.rb +107 -31
- data/lib/hexapdf/layout/container_box.rb +159 -0
- data/lib/hexapdf/layout/frame.rb +8 -5
- data/lib/hexapdf/layout/list_box.rb +2 -1
- data/lib/hexapdf/layout/width_from_polygon.rb +1 -1
- data/lib/hexapdf/layout.rb +1 -0
- data/lib/hexapdf/type/font_simple.rb +2 -1
- data/lib/hexapdf/type/icon_fit.rb +2 -2
- data/lib/hexapdf/type/page.rb +35 -35
- data/lib/hexapdf/utils.rb +66 -0
- data/lib/hexapdf/version.rb +1 -1
- data/test/hexapdf/content/test_canvas_composer.rb +5 -5
- data/test/hexapdf/document/test_layout.rb +6 -0
- data/test/hexapdf/document/test_pages.rb +5 -5
- data/test/hexapdf/layout/test_box.rb +46 -13
- data/test/hexapdf/layout/test_column_box.rb +4 -4
- data/test/hexapdf/layout/test_container_box.rb +84 -0
- data/test/hexapdf/layout/test_frame.rb +3 -2
- data/test/hexapdf/layout/test_page_style.rb +5 -5
- data/test/hexapdf/test_composer.rb +13 -13
- data/test/hexapdf/test_utils.rb +20 -0
- data/test/hexapdf/test_writer.rb +3 -3
- data/test/hexapdf/type/test_font_simple.rb +9 -1
- data/test/hexapdf/type/test_page.rb +3 -3
- data/test/hexapdf/type/test_page_tree_node.rb +1 -1
- metadata +6 -2
@@ -116,9 +116,17 @@ describe HexaPDF::Type::FontSimple do
|
|
116
116
|
assert_equal(" ", @font.to_utf8(32))
|
117
117
|
end
|
118
118
|
|
119
|
+
it "swallows errors during retrieving the font's encoding" do
|
120
|
+
@font.delete(:ToUnicode)
|
121
|
+
@font.delete(:Encoding)
|
122
|
+
err = assert_raises(HexaPDF::Error) { @font.to_utf8(32) }
|
123
|
+
assert_match(/No Unicode mapping/, err.message)
|
124
|
+
end
|
125
|
+
|
119
126
|
it "calls the configured proc if no correct mapping could be found" do
|
120
127
|
@font.delete(:ToUnicode)
|
121
|
-
assert_raises(HexaPDF::Error) { @font.to_utf8(0) }
|
128
|
+
err = assert_raises(HexaPDF::Error) { @font.to_utf8(0) }
|
129
|
+
assert_match(/No Unicode mapping/, err.message)
|
122
130
|
end
|
123
131
|
end
|
124
132
|
|
@@ -12,11 +12,11 @@ describe HexaPDF::Type::Page do
|
|
12
12
|
|
13
13
|
describe "::media_box" do
|
14
14
|
it "returns the media box for a given paper size" do
|
15
|
-
assert_equal([0, 0, 595,
|
15
|
+
assert_equal([0, 0, 595.275591, 841.889764], HexaPDF::Type::Page.media_box(:A4))
|
16
16
|
end
|
17
17
|
|
18
18
|
it "respects the orientation key" do
|
19
|
-
assert_equal([0, 0,
|
19
|
+
assert_equal([0, 0, 841.889764, 595.275591], HexaPDF::Type::Page.media_box(:A4, orientation: :landscape))
|
20
20
|
end
|
21
21
|
|
22
22
|
it "works with a paper size array" do
|
@@ -116,7 +116,7 @@ describe HexaPDF::Type::Page do
|
|
116
116
|
page1[:MediaBox] = [0, 0, 1, 1]
|
117
117
|
refute(page2.validate(auto_correct: false))
|
118
118
|
assert(page2.validate)
|
119
|
-
assert_equal([0, 0, 595,
|
119
|
+
assert_equal([0, 0, 595.275591, 841.889764], page2[:MediaBox])
|
120
120
|
end
|
121
121
|
end
|
122
122
|
|
@@ -89,7 +89,7 @@ describe HexaPDF::Type::PageTreeNode do
|
|
89
89
|
assert_equal(:Page, page[:Type])
|
90
90
|
assert_equal(@root, page[:Parent])
|
91
91
|
assert_kind_of(HexaPDF::Rectangle, page[:MediaBox])
|
92
|
-
assert_equal([0, 0,
|
92
|
+
assert_equal([0, 0, 841.889764, 595.275591], page[:MediaBox].value)
|
93
93
|
assert_equal({}, page[:Resources].value)
|
94
94
|
refute(@root.value.key?(:Parent))
|
95
95
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hexapdf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.36.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thomas Leitner
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-01-
|
11
|
+
date: 2024-01-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cmdparse
|
@@ -434,6 +434,7 @@ files:
|
|
434
434
|
- lib/hexapdf/layout/box.rb
|
435
435
|
- lib/hexapdf/layout/box_fitter.rb
|
436
436
|
- lib/hexapdf/layout/column_box.rb
|
437
|
+
- lib/hexapdf/layout/container_box.rb
|
437
438
|
- lib/hexapdf/layout/frame.rb
|
438
439
|
- lib/hexapdf/layout/image_box.rb
|
439
440
|
- lib/hexapdf/layout/inline_box.rb
|
@@ -519,6 +520,7 @@ files:
|
|
519
520
|
- lib/hexapdf/type/trailer.rb
|
520
521
|
- lib/hexapdf/type/viewer_preferences.rb
|
521
522
|
- lib/hexapdf/type/xref_stream.rb
|
523
|
+
- lib/hexapdf/utils.rb
|
522
524
|
- lib/hexapdf/utils/bit_field.rb
|
523
525
|
- lib/hexapdf/utils/bit_stream.rb
|
524
526
|
- lib/hexapdf/utils/graphics_helpers.rb
|
@@ -694,6 +696,7 @@ files:
|
|
694
696
|
- test/hexapdf/layout/test_box.rb
|
695
697
|
- test/hexapdf/layout/test_box_fitter.rb
|
696
698
|
- test/hexapdf/layout/test_column_box.rb
|
699
|
+
- test/hexapdf/layout/test_container_box.rb
|
697
700
|
- test/hexapdf/layout/test_frame.rb
|
698
701
|
- test/hexapdf/layout/test_image_box.rb
|
699
702
|
- test/hexapdf/layout/test_inline_box.rb
|
@@ -728,6 +731,7 @@ files:
|
|
728
731
|
- test/hexapdf/test_stream.rb
|
729
732
|
- test/hexapdf/test_tokenizer.rb
|
730
733
|
- test/hexapdf/test_type.rb
|
734
|
+
- test/hexapdf/test_utils.rb
|
731
735
|
- test/hexapdf/test_writer.rb
|
732
736
|
- test/hexapdf/test_xref_section.rb
|
733
737
|
- test/hexapdf/type/acro_form/test_appearance_generator.rb
|