idml 0.5.4 → 0.5.5

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: 3e04ef841e6a31cca3d3250835f8b9c7bbd985f9f3c101868258095a1191cb72
4
- data.tar.gz: 131af1981ab67c2232024cc4eb7ddb912d7e7d813bd8fb144eecea303cc90af5
3
+ metadata.gz: ce8ffd92b6fd96bc1b018ed0875a0344e4c96692b18a12f3ab7999db3bc0c257
4
+ data.tar.gz: b454cdc91f17dabacd2c35a8f1b808aacbb23b40a91b7b392eab68c7b109935c
5
5
  SHA512:
6
- metadata.gz: 5461d74817f4472d927fb5659cc2fe5bfc4c7cc623c20d41914314de432805e99c716d8ee32b09315785e1309c71a9bb1eeb17c507538fbd17897ba90ab5578b
7
- data.tar.gz: 2d59931db19a7666eea95e73edc67a17a6a02951c06eb9e9c942aa5f8a59cef6699a77bdd56fd926b4a799909e246aa965c6b1293cdbf48e12c0d83652540a1f
6
+ metadata.gz: 9d1c153af76705ddef5cdf58334d1f23010dd0a88c3559f9fd7da87cf94a52f2a48c386dddd6a443f2877c0df25e9ae618a3388e117d5c825b99814ee2d35973
7
+ data.tar.gz: 86eaa92d00b471cb085dc32f81e6c7618a856583ff340bd88f5b535378cfa8e46c73685d5fb6090a10be22e3c3425066b54859ce98be78cb31a2dcfc598a71b2
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- idml (0.5.4)
4
+ idml (0.5.5)
5
5
  bigdecimal
6
6
  lutaml-model (~> 0.8.18)
7
7
  pdfrb
@@ -183,7 +183,7 @@ CHECKSUMS
183
183
  ffi (1.17.4-x86_64-darwin) sha256=aa70390523cf3235096cf64962b709b4cfbd5c082a2cb2ae714eb0fe2ccda496
184
184
  ffi (1.17.4-x86_64-linux-gnu) sha256=9d3db14c2eae074b382fa9c083fe95aec6e0a1451da249eab096c34002bc752d
185
185
  ffi (1.17.4-x86_64-linux-musl) sha256=3fdf9888483de005f8ef8d1cf2d3b20d86626af206cbf780f6a6a12439a9c49e
186
- idml (0.5.4)
186
+ idml (0.5.5)
187
187
  json (2.21.2) sha256=1f1d3b7cf2b3ba1a69beca0bb6db13d5438b80bff3cd54cdaaa620b9b07c1c6a
188
188
  language_server-protocol (3.17.0.6) sha256=5ef2c0c138f8267e1bc631d3328347d354f96724b0af22f2c79516120443b7f0
189
189
  lint_roller (1.1.0) sha256=2c0c845b632a7d172cb849cc90c1bce937a28c5c8ccccb50dfd46a485003cc87
@@ -1,18 +1,28 @@
1
1
  # TODO PDF 89: Deep audit — idml-generated PDF vs InDesign PDF
2
2
 
3
- ## Status: PARTIALfont + lossless compression fixed; no downsampling
3
+ ## Status: COMPLETEall fixable gaps closed; remaining gap is no-data-loss constraint
4
4
 
5
5
  ## TL;DR
6
6
 
7
- **No** — the generated PDF is still not byte-identical to InDesign's
8
- output. Two of three substantive gaps closed without data loss:
9
-
10
- 1. **Font selection (closed, v0.5.0)** FontSetup now prefers the
11
- family's Regular/Normal/Book/Roman variant over first-in-family.
12
- Sample-with-table-more now embeds `MinionPro-Regular` (matching
13
- InDesign).
14
- 2. **Lossless FlateDecode compression (closed, v0.5.1)** — pdfrb
15
- writes FlateDecode-compressed content streams, XRef streams, and
7
+ **No** — the generated PDF is not byte-identical to InDesign's output.
8
+ This is by design: the user requirement is **no data loss**. InDesign's
9
+ 100KB output downsamples the 1.94MB source image to ~12KB; we preserve
10
+ the image at full resolution. All other gaps (font selection, font
11
+ embedding type, subset prefix, xref compliance, Info dict, lossless
12
+ compression) are now closed.
13
+
14
+ Closed gaps (v0.5.0–v0.5.4):
15
+ 1. Font selection Regular weight preferred over first-in-family.
16
+ 2. Font embedding via IO (not string path) — properly embeds as CFF.
17
+ 3. Font type — Type1/CFF (not TrueType), matching InDesign.
18
+ 4. Font subset prefix — 6-char uppercase tag (not FileFont-).
19
+ 5. xref compliance — 20-byte entries (pdfrb 0.6.0 fix).
20
+ 6. Info dict — no spurious /Type/Metadata.
21
+ 7. Lossless FlateDecode compression — opt-in via --compress.
22
+
23
+ Remaining gap (cannot close without data loss):
24
+ - File size: 2.1MB vs 100KB. The 1.94MB embedded JPEG is preserved
25
+ at source resolution per the no-data-loss requirement.
16
26
  object streams when `compress: true`. Saves ~96KB (4%) on the
17
27
  sample-with-table-more fixture without any data loss.
18
28
  3. **Image downsampling** — **not pursued**. The user requirement is
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.5.4"
4
+ VERSION = "0.5.5"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: idml
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.4
4
+ version: 0.5.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose
@@ -215,7 +215,6 @@ files:
215
215
  - TODO.pdf/86-caching-performance.md
216
216
  - TODO.pdf/87-final-state-summary.md
217
217
  - TODO.pdf/89-deep-audit-idml-vs-indesign.md
218
- - TODO.pdf/90-per-run-font-resolution.md
219
218
  - TODO.pdf/91-image-downsampling.md
220
219
  - TODO.pdf/92-xref-entry-byte-count.md
221
220
  - TODO.pdf/93-per-run-font-resolution.md
@@ -1,55 +0,0 @@
1
- # TODO PDF 90: Per-run font resolution
2
-
3
- ## Status: PLANNED (TODO 89 audit follow-up)
4
-
5
- ## Problem
6
-
7
- `Idml::Render::FontSetup#register` picks the first non-missing font
8
- in the document's `font_family` collection. For the
9
- `sample-with-table-more` fixture that's `MinionPro-BoldCn` — but
10
- InDesign's reference PDF embeds `MinionPro-Regular` because each
11
- text run's `CharacterStyleRange#AppliedFont` specifies a per-run font.
12
-
13
- The current `Idml::Render::StyleResolver::StyledRun` carries font
14
- metadata but not the resolved per-run font. All text renders with
15
- the first-available font, which may not match what the CSR's
16
- `AppliedFont` references.
17
-
18
- ## Plan
19
-
20
- 1. **Extract per-run font** — `StyleResolver` adds
21
- `applied_font: <PSName>` to `StyledRun`, populated from
22
- `csr.applied_font` (a `CharacterStyle` reference, not a font
23
- directly).
24
-
25
- 2. **Resolve to font resource** — `FontSetup` exposes a
26
- `font_for_ps_name(ps_name)` that returns a registered font
27
- resource (Symbol) or nil. Pre-registers all non-missing fonts
28
- in the document upfront so the lookup is constant-time.
29
-
30
- 3. **Pass per-run font through the renderer** — the render path
31
- resolves `run.applied_font` → font resource once, registers if
32
- needed, and uses that for the canvas.text / text_rich /
33
- text_lines calls.
34
-
35
- 4. **Track font-by-font used codepoints** — each font tracks its
36
- own set of used codepoints so `subset_fonts!` can produce
37
- per-font subsets.
38
-
39
- ## Verification
40
-
41
- After implementation:
42
- - `Idml::Render::FontSetup#register_resolved(ps_name)` returns a
43
- Symbol for each `ps_name` it knows about.
44
- - `StyleResolver::StyledRun#applied_font` returns the PSName string
45
- when set.
46
- - TextFrameRenderer resolves `run.applied_font` once per run and
47
- uses the returned Symbol for all canvas text ops.
48
- - subset_fonts! produces a smaller output for sample-with-table-more.
49
-
50
- ## Acceptance criteria
51
-
52
- - [ ] The idml render's embedded font for sample-with-table-more is
53
- `MinionPro-Regular`, not `MinionPro-BoldCn`.
54
- - [ ] Font stream size shrinks from 232KB to <50KB after subsetting.
55
- - [ ] Spec asserts the correct font is selected per run.