idml 0.5.3 → 0.5.4
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/Gemfile.lock +2 -2
- data/TODO.pdf/92-xref-entry-byte-count.md +1 -1
- data/TODO.pdf/93-per-run-font-resolution.md +67 -0
- data/lib/idml/render.rb +10 -0
- data/lib/idml/version.rb +1 -1
- data/lib/idml.rb +1 -0
- metadata +2 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3e04ef841e6a31cca3d3250835f8b9c7bbd985f9f3c101868258095a1191cb72
|
|
4
|
+
data.tar.gz: 131af1981ab67c2232024cc4eb7ddb912d7e7d813bd8fb144eecea303cc90af5
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5461d74817f4472d927fb5659cc2fe5bfc4c7cc623c20d41914314de432805e99c716d8ee32b09315785e1309c71a9bb1eeb17c507538fbd17897ba90ab5578b
|
|
7
|
+
data.tar.gz: 2d59931db19a7666eea95e73edc67a17a6a02951c06eb9e9c942aa5f8a59cef6699a77bdd56fd926b4a799909e246aa965c6b1293cdbf48e12c0d83652540a1f
|
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
idml (0.5.
|
|
4
|
+
idml (0.5.4)
|
|
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.
|
|
186
|
+
idml (0.5.4)
|
|
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
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# TODO PDF 93: Per-run font resolution from CharacterStyleRange
|
|
2
|
+
|
|
3
|
+
## Status: PLANNED (last major rendering fidelity gap)
|
|
4
|
+
|
|
5
|
+
## Problem
|
|
6
|
+
|
|
7
|
+
All text in the rendered PDF uses the same font (the document's
|
|
8
|
+
default Regular weight). Real IDML documents specify per-run fonts
|
|
9
|
+
via `CharacterStyleRange#AppliedCharacterStyle` → `CharacterStyle`
|
|
10
|
+
→ `Properties/AppliedFont` (family name) + style attributes.
|
|
11
|
+
|
|
12
|
+
For the `sample-with-table-more` fixture, all text happens to use
|
|
13
|
+
`[No character style]` with `NormalParagraphStyle`, so the default
|
|
14
|
+
Regular weight is correct. But other IDML documents have bold,
|
|
15
|
+
italic, and mixed-family text that our renderer can't express.
|
|
16
|
+
|
|
17
|
+
## What needs to happen
|
|
18
|
+
|
|
19
|
+
1. **StyleResolver enhancement**: extract `applied_font` from each
|
|
20
|
+
CSR via its `AppliedCharacterStyle` reference. The chain is:
|
|
21
|
+
- CSR `AppliedCharacterStyle="CharacterStyle/$ID/bold_text"`
|
|
22
|
+
- → CharacterStyle `Self="CharacterStyle/$ID/bold_text"`
|
|
23
|
+
- → CharacterStyle `Properties/AppliedFont` → family name
|
|
24
|
+
- → CharacterStyle `FontStyle` → style (Bold, Italic, etc.)
|
|
25
|
+
- → Fonts.xml lookup → PostScriptName
|
|
26
|
+
- → Pdfrb::FontResolver → file path → pdfrb font resource
|
|
27
|
+
|
|
28
|
+
2. **Multi-font registration**: FontSetup registers each distinct
|
|
29
|
+
font used by any CSR, not just the document default. Returns a
|
|
30
|
+
map of `applied_font_ref → pdfrb_symbol`.
|
|
31
|
+
|
|
32
|
+
3. **StyledRun enhancement**: carries the resolved pdfrb font
|
|
33
|
+
resource Symbol (not just the PS name string).
|
|
34
|
+
|
|
35
|
+
4. **TextFrameRenderer**: uses `run.font_resource` for each
|
|
36
|
+
`canvas.text` / `canvas.text_rich` call instead of the single
|
|
37
|
+
`context.font_ps_name`.
|
|
38
|
+
|
|
39
|
+
5. **TableRenderer**: same — per-cell font resolution from the
|
|
40
|
+
cell's CSR.
|
|
41
|
+
|
|
42
|
+
## Scope
|
|
43
|
+
|
|
44
|
+
- For documents with uniform styling (like the test fixture), no
|
|
45
|
+
visible change — the default Regular font is already correct.
|
|
46
|
+
- For documents with bold/italic/mixed-family runs, text would
|
|
47
|
+
render in the correct font per run.
|
|
48
|
+
- Font subsetting becomes per-font: each registered font gets its
|
|
49
|
+
own used-codepoint set and subset.
|
|
50
|
+
|
|
51
|
+
## Dependencies
|
|
52
|
+
|
|
53
|
+
- pdfrb 0.6.0 with IO-based font loading (DONE, v0.5.3).
|
|
54
|
+
- CharacterStyle element model (exists — verify AppliedFont
|
|
55
|
+
extraction from Properties).
|
|
56
|
+
- FontReferenceResolver (exists — already builds family → PSName
|
|
57
|
+
lookup from Fonts.xml).
|
|
58
|
+
|
|
59
|
+
## Acceptance criteria
|
|
60
|
+
|
|
61
|
+
- [ ] StyledRun carries a resolved pdfrb font resource Symbol.
|
|
62
|
+
- [ ] CSR with `AppliedCharacterStyle` referencing a bold style
|
|
63
|
+
renders in bold font.
|
|
64
|
+
- [ ] CSR with no applied style renders in the document default.
|
|
65
|
+
- [ ] Multiple fonts embedded when document uses multiple families.
|
|
66
|
+
- [ ] Font subsetting works per-font (each font subsetted to its
|
|
67
|
+
own used codepoints).
|
data/lib/idml/render.rb
CHANGED
|
@@ -2,6 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
require "pdfrb"
|
|
4
4
|
|
|
5
|
+
# pdfrb 0.6.0 autoloads OptContentUsage from opt_content_ext.rb but
|
|
6
|
+
# that file doesn't define it, causing eager_load! to crash.
|
|
7
|
+
# Trigger the autoload (catching the failure) then define a stub.
|
|
8
|
+
begin
|
|
9
|
+
Pdfrb::Model::Type::OptContentUsage
|
|
10
|
+
rescue NameError
|
|
11
|
+
Pdfrb::Model::Type.const_set(:OptContentUsage,
|
|
12
|
+
Class.new(Pdfrb::Model::Cos::Dictionary))
|
|
13
|
+
end
|
|
14
|
+
|
|
5
15
|
module Idml
|
|
6
16
|
module Render
|
|
7
17
|
autoload :ColorHelper, "#{__dir__}/render/color_helper"
|
data/lib/idml/version.rb
CHANGED
data/lib/idml.rb
CHANGED
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
|
+
version: 0.5.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose
|
|
@@ -218,6 +218,7 @@ files:
|
|
|
218
218
|
- TODO.pdf/90-per-run-font-resolution.md
|
|
219
219
|
- TODO.pdf/91-image-downsampling.md
|
|
220
220
|
- TODO.pdf/92-xref-entry-byte-count.md
|
|
221
|
+
- TODO.pdf/93-per-run-font-resolution.md
|
|
221
222
|
- TODO.pdf/README.md
|
|
222
223
|
- exe/idml
|
|
223
224
|
- idml.gemspec
|