idml 0.2.2 → 0.2.3

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: 5f22227bbbc74fdbc901e8e7c8dc23c6f77f4a365cf9fc9c3e78d738d5bfdf04
4
- data.tar.gz: db2b6f2c4f5f95a392c163388837a1e4a975eee64606a7ab09a801c267160246
3
+ metadata.gz: 52c92d7618628647f3ad6a9a791f4e5236514463b25c860390a046b5538df11d
4
+ data.tar.gz: 16786debbbceae219fc8933d96ad06b02c73f2efae0f4f03162deefd4d98c112
5
5
  SHA512:
6
- metadata.gz: 7a0e4ec3b44a84801ec7cf7683643a092a4a41d279e68ef3c31591bfd7b21bdb64056d24e289071184ff0c86bf933bf0b855ddae2a5af7bcbc177104b9033f4e
7
- data.tar.gz: b1626fc2eb4deaf0ad1f235a15f8ccd34979ea523a6f7d4cbd60408ed82ce26d476c11715073f490127210f57c4f85768171b08d02d280a0c516b82cf00e89ee
6
+ metadata.gz: 10756f2694a6e5b7d6543552d03f33770bb43ceaf085f3365348f919ae7ba54b9f45f2073cfaadad96d3679d93a966a0e67e758e667f5999a810780756a0a15a
7
+ data.tar.gz: 8efeee5edb697daee0839492011ae90a28c0db9edf155ea417c75b58fe353105733d93c30a73a32e3d63e5442957198e3dccee2d6b3276f76d303bf5eac383da
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- idml (0.2.2)
4
+ idml (0.2.3)
5
5
  bigdecimal
6
6
  fontisan
7
7
  lutaml-model (~> 0.8.18)
@@ -204,7 +204,7 @@ CHECKSUMS
204
204
  ffi (1.17.4-x86_64-linux-gnu) sha256=9d3db14c2eae074b382fa9c083fe95aec6e0a1451da249eab096c34002bc752d
205
205
  ffi (1.17.4-x86_64-linux-musl) sha256=3fdf9888483de005f8ef8d1cf2d3b20d86626af206cbf780f6a6a12439a9c49e
206
206
  fontisan (0.4.45) sha256=2337ca0205f806647b24b8cac57aa34f3769473026ae6f52dc36bde0feed6c62
207
- idml (0.2.2)
207
+ idml (0.2.3)
208
208
  json (2.21.2) sha256=1f1d3b7cf2b3ba1a69beca0bb6db13d5438b80bff3cd54cdaaa620b9b07c1c6a
209
209
  language_server-protocol (3.17.0.6) sha256=5ef2c0c138f8267e1bc631d3328347d354f96724b0af22f2c79516120443b7f0
210
210
  lint_roller (1.1.0) sha256=2c0c845b632a7d172cb849cc90c1bce937a28c5c8ccccb50dfd46a485003cc87
@@ -0,0 +1,29 @@
1
+ # TODO PDF 65: pdfrb 0.19.0 feature integration
2
+
3
+ ## Status: PARTIALLY DONE
4
+
5
+ ## What was implemented
6
+
7
+ 1. **Canvas#text_lines**: TextFrameRenderer uses `canvas.text_lines`
8
+ instead of N separate `canvas.text` calls per line. Single batch
9
+ call for all lines within a run.
10
+
11
+ ## What remains (pdfrb bugs)
12
+
13
+ 2. **glyph_width for TTF**: pdfrb 0.19.0 has `Fonts#glyph_width` but
14
+ returns 0 for TrueType fonts (bug: "undefined method glyph_id_for
15
+ for String"). Standard 14 Type1 fonts work correctly. Cannot
16
+ replace FontMetrics/Fontisan until this is fixed.
17
+
18
+ 3. **Pdfrb::FontResolver**: Returns nil for common fonts (Helvetica.ttc
19
+ on macOS). Cannot replace Fontisan-based resolver yet.
20
+
21
+ 4. **Font subsetting**: `Fonts#add` accepts `**opts` but `subset: true`
22
+ behavior unverified. Standard 14 fonts don't need FontFile embedding.
23
+
24
+ ## Acceptance criteria
25
+
26
+ - [x] TextFrameRenderer uses canvas.text_lines
27
+ - [ ] FontMetrics replaced with pdfrb glyph_width (blocked by TTF bug)
28
+ - [ ] FontResolver replaced with Pdfrb::FontResolver (blocked by .ttc)
29
+ - [ ] Font subsetting verified
@@ -95,15 +95,21 @@ module Idml
95
95
  glyphs: glyphs, frame_width: box[:width],
96
96
  )
97
97
 
98
+ line_texts = []
98
99
  lines.each do |line|
99
100
  break if baseline_y < box[:y]
100
101
 
101
- line_text = line.glyphs.map { |g| [g.codepoint].pack("U") }.join
102
- canvas.text(line_text, at: [box[:x], baseline_y],
103
- font: context.font_ps_name,
104
- size: size)
102
+ line_texts << line.glyphs.map { |g| [g.codepoint].pack("U") }.join
105
103
  baseline_y -= size * LEADING_FACTOR
106
104
  end
105
+
106
+ if line_texts.any?
107
+ canvas.text_lines(line_texts,
108
+ font: context.font_ps_name,
109
+ size: size,
110
+ at: [box[:x], box[:y] + box[:height] - size],
111
+ leading: size * LEADING_FACTOR)
112
+ end
107
113
  baseline_y
108
114
  end
109
115
  private_class_method :render_run_lines
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.2.2"
4
+ VERSION = "0.2.3"
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.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose
@@ -205,6 +205,7 @@ files:
205
205
  - TODO.pdf/62-pdfrb-015-migration.md
206
206
  - TODO.pdf/63-replace-fontmetrics-with-pdfrb.md
207
207
  - TODO.pdf/64-pipeline-cli-optimizations.md
208
+ - TODO.pdf/65-pdfrb-019-integration.md
208
209
  - TODO.pdf/README.md
209
210
  - exe/idml
210
211
  - idml.gemspec