idml 0.10.11 → 0.10.12

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ea3cefcb949b7fd6399d850354df7fe37e6f822e766994522b9df4ceaa13cfd7
4
- data.tar.gz: 531db1a6a0d5ccb32cd7f3fddd751b99d140a5504a3ab7645913167e34fdeb7e
3
+ metadata.gz: 49122b9c9f5974361567afb8fc2e063602e370141f0d5990f8de156275c312c4
4
+ data.tar.gz: c4f21424d6cd5d2f9345801aeb53be0b78d26f3d0c423b8ad20b179dff4ef38f
5
5
  SHA512:
6
- metadata.gz: 6659beee3fa4e1d325bed4d0ed86a4a1db4c2944010d8a3deffbe3bf029df137187cb3b34fa064b5feecd000abad671fd712fb083caae837796339157bde9e25
7
- data.tar.gz: d225c68cea43b34da224e37809cbfa5c0be3abc8775c7f10baee3d1756c69c325a002562070a54a5994ecc7da3883f58bbd407b337b66d9994a99b3532436049
6
+ metadata.gz: 6c06eb1149c2fed295382a4ce65504d12c821d884ffa6cd145f9ac96e0837c82b1dbfdd16abd082e84366dd6c0bfd6edc8670e187d71785f1de0e7a415cc9892
7
+ data.tar.gz: 12352d559b36427ec1be4ce71e31cfc149e24ec52a1fe70b65c3ecc720575c1a4f7a9aab8b96e67329747f33bc2005494c6f0c2034508b642edf37ba917a45ca
@@ -0,0 +1,41 @@
1
+ # TODO PDF 150: Architecture review round three — seam repairs
2
+
3
+ ## Status: COMPLETE — implemented 2026-08-30
4
+
5
+ ## Problem
6
+
7
+ Round-three review findings (after TODOs 148-149):
8
+
9
+ 1. **Page-dimensions seam leak (bug)**: `ImageCollector` and
10
+ `HyperlinkEmitter` received a hardcoded `DEFAULT_HEIGHT = 792`
11
+ while pages rendered at per-page dimensions — both use the
12
+ height for the IDML→PDF y-flip, so images and link rectangles
13
+ misplaced on any non-letter page.
14
+ 2. **Dead interface kept alive by its tests**:
15
+ `TextWrapResolver#overlap_width` (+ `line_overlap`) had zero
16
+ lib callers since TODO 138 — only its own spec — and encoded
17
+ sum-semantics for multiple contours where the real interface
18
+ (`wrap_adjustment`) uses max. The spec suite asserted behavior
19
+ the renderer no longer had.
20
+ 3. **Thirteen copies of the synthetic-package triplet**: every
21
+ engine-path spec repeated `Dir.mktmpdir → Package.write →
22
+ Package.new`, with drifting names and inconsistent part sets.
23
+
24
+ ## Solution
25
+
26
+ - Pipeline threads per-page `dims[:height]` into both consumers;
27
+ the constants stay only as `page_dimensions_for` fallbacks.
28
+ - `overlap_width` / `line_overlap` deleted; all 15 spec call
29
+ sites migrated to `wrap_adjustment` (the "sums contours" spec
30
+ now documents max-combination honestly). The polygon variant
31
+ `WrapContour.overlap_width` stays — it is load-bearing.
32
+ - `build_package(parts, name)` helper in spec_helper; thirteen
33
+ triplet copies replaced; three local helpers that shadowed the
34
+ global renamed (`anchored_fixture`, `decorated_fixture`,
35
+ `footnote_fixture`, `endnote_fixture`, `footnote_package`).
36
+
37
+ ## Files
38
+
39
+ - `lib/idml/render/pipeline.rb`
40
+ - `lib/idml/render/text_wrap_resolver.rb`
41
+ - `spec/spec_helper.rb` + 13 spec files
@@ -96,9 +96,6 @@ module Idml
96
96
  position_tracker, condition_filter, style_lookup,
97
97
  page_offset)
98
98
  pages = spread.spread.flat_map(&:page)
99
- image_refs = ImageCollector.new(writer: writer,
100
- base_dir: File.dirname(@package.path),
101
- page_height: DEFAULT_HEIGHT).collect(spread)
102
99
  renderer = build_renderer(layer_filter, font_ref_resolver,
103
100
  font_resource, font_metrics, font_map,
104
101
  structure, position_tracker, condition_filter,
@@ -108,21 +105,26 @@ module Idml
108
105
  pages.each do |page|
109
106
  current += 1
110
107
  dims = page_dimensions_for(page)
108
+ image_refs = ImageCollector.new(
109
+ writer: writer,
110
+ base_dir: File.dirname(@package.path),
111
+ page_height: dims[:height],
112
+ ).collect(spread)
111
113
  canvas = writer.add_page(width: dims[:width], height: dims[:height])
112
114
  renderer.render(canvas, spread, page_width: dims[:width],
113
115
  page_height: dims[:height],
114
116
  image_refs: image_refs,
115
117
  page_index: current)
116
- emit_hyperlinks(writer, spread, current, layer_filter,
117
- position_tracker)
118
+ emit_hyperlinks(writer, spread, current, dims[:height],
119
+ layer_filter, position_tracker)
118
120
  end
119
121
  current
120
122
  end
121
123
 
122
- def emit_hyperlinks(writer, spread, page_index, layer_filter,
123
- position_tracker)
124
+ def emit_hyperlinks(writer, spread, page_index, page_height,
125
+ layer_filter, position_tracker)
124
126
  HyperlinkEmitter.new(writer: writer, package: @package,
125
- page_height: DEFAULT_HEIGHT,
127
+ page_height: page_height,
126
128
  layer_filter: layer_filter,
127
129
  position_tracker: position_tracker)
128
130
  .emit_for(spread, page_index)
@@ -159,28 +159,6 @@ module Idml
159
159
  end
160
160
  private :interval_side_adjustment
161
161
 
162
- # Returns the total horizontal overlap of all contours with a
163
- # text line at the given y range within the given x range.
164
- # Sum, not max — multiple overlapping contours compound.
165
- # Returns 0.0 when there's no overlap. Inverse contours
166
- # reduce by the frame width minus their own width (text may
167
- # only flow inside).
168
- def overlap_width(line_y, line_height, frame_x, frame_right)
169
- @contours.sum do |contour|
170
- width = if contour.is_a?(WrapContour::Shape)
171
- WrapContour.overlap_width(contour, line_y,
172
- line_height, frame_x,
173
- frame_right)
174
- else
175
- line_overlap(contour, line_y, line_height,
176
- frame_x, frame_right)[:width]
177
- end
178
- next width unless contour.inverse
179
-
180
- (frame_right - frame_x) - width
181
- end
182
- end
183
-
184
162
  # The wrap shape for an item: a bounding-box rectangle
185
163
  # (BoundingBoxTextWrap — the legacy "BoundingBox" spelling is
186
164
  # also accepted from early synthetic fixtures) or a flattened
@@ -250,13 +228,6 @@ module Idml
250
228
  end
251
229
  private_class_method :contour_mode?
252
230
 
253
- def line_overlap(contour, line_y, line_height, frame_x, frame_right)
254
- return { width: 0.0 } unless y_overlap?(contour, line_y, line_height)
255
- return { width: 0.0 } unless x_overlap?(contour, frame_x, frame_right)
256
-
257
- { width: x_overlap_width(contour, frame_x, frame_right) }
258
- end
259
-
260
231
  def y_overlap?(contour, line_y, line_height)
261
232
  line_top = line_y + line_height
262
233
  line_bottom = line_y
data/lib/idml/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Idml
4
- VERSION = "0.10.11"
4
+ VERSION = "0.10.12"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: idml
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.11
4
+ version: 0.10.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-08-29 00:00:00.000000000 Z
11
+ date: 2026-08-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bigdecimal
@@ -214,6 +214,7 @@ files:
214
214
  - TODO.pdf/148-architecture-improvements.md
215
215
  - TODO.pdf/149-architecture-round-two.md
216
216
  - TODO.pdf/15-wire-spread-children.md
217
+ - TODO.pdf/150-architecture-round-three.md
217
218
  - TODO.pdf/16-typed-model-pipeline.md
218
219
  - TODO.pdf/17-shape-rendering.md
219
220
  - TODO.pdf/18-text-rendering.md