ea 0.6.61 → 0.6.62

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: cb774d8053e789ef6200fc5c77c811166ce44308cbfe52c31255ab6c7f404c1d
4
- data.tar.gz: 15e26d6ecded00bea2bcedf20a03ac6ce94f3fdfd63dbba6f5357e85aae09969
3
+ metadata.gz: 30cdaecff7833cb3af1138d6ac1df0667dbdde2e3b6f109ae456cd6c3c5e1dab
4
+ data.tar.gz: 9d6fc9c8bd00571d092bcb8250260195758514e7edb62993a5e08c3a19ce0bde
5
5
  SHA512:
6
- metadata.gz: d33ce1e55c5904c77871d2cb2805e21f0326457b77ef567f73952dab004d92fd10692b547e61bf9c63fff7d35e619ce68dfc5646c22cf5e5a732fc76c7bfc00c
7
- data.tar.gz: 5ccac30a04cbeb1e4792473e6a674865d5bb1d1ffa56a271f9709c35d0bdd9488dd1dff5540ed6fc65bda57e175f42618d5dd3cf6521068f05fad5479a7520b0
6
+ metadata.gz: 04b411c70b7d59ec632737088134fdf6cb41205444aa754294f5b6e66406ff49cdcd08fbff7094ecfbd70f62559949255f30783dc1f481a104465e551ce8aabe
7
+ data.tar.gz: d06fa28bb5c00f669c4d6ac3b99abfc5f410680d1a0a9770ff9969b7ed2ad5dd7753b17964c2553189e217ce67f3ed6875fbaf7e404f3c11d813c7781951a8bb
@@ -53,16 +53,43 @@ module Ea
53
53
 
54
54
  # Width of `text` in EA's exported SVG units for the given pt
55
55
  # size, or nil when the family is not metric-compatible.
56
+ #
57
+ # EA's GDI driver quantizes each glyph advance to an integer
58
+ # pixel count at the logical font height H = round(pt * 10/7)
59
+ # (Carlito: 7pt -> H10, 9pt -> H13) and the published
60
+ # textLength is the SUM of those per-glyph integers - corpus
61
+ # fitted to 97-100% exact on 10k Carlito texts (bold 7pt
62
+ # 1666/1671). The legacy sum-then-round model matched only 27%.
56
63
  def text_length(text, size_pt, family: nil, weight: nil, style: nil)
57
64
  return nil unless supported_family?(family)
58
65
  return nil if text.nil? || text.empty?
59
66
 
60
- latin, cjk_count = split_advance(text, family: family,
61
- weight: weight, style: style)
62
- (latin * size_pt.to_f * factor_for(family, size_pt, weight, style) +
67
+ resolved = resolve_family(family)
68
+ if GDI_HEIGHT_FAMILIES.include?(resolved)
69
+ height = (size_pt.to_f * 10 / 7).round
70
+ table = table_for(family, weight, style)
71
+ latin = 0
72
+ cjk_count = 0
73
+ text.each_char do |ch|
74
+ if cjk?(ch.ord)
75
+ cjk_count += 1
76
+ else
77
+ latin += ((table[cp_key(ch)] || DEFAULT_ADVANCE) * height).round
78
+ end
79
+ end
80
+ return latin + cjk_count * CJK_ADVANCE * size_pt.to_f
81
+ end
82
+
83
+ _latin, cjk_count = split_advance(text, family: family,
84
+ weight: weight, style: style)
85
+ (_latin * size_pt.to_f * factor_for(family, size_pt, weight, style) +
63
86
  cjk_count * CJK_ADVANCE * size_pt.to_f).round(3)
64
87
  end
65
88
 
89
+ # Families whose EA driver quantizes per-glyph advances
90
+ # (fitted from published textLengths).
91
+ GDI_HEIGHT_FAMILIES = %w[Carlito].freeze
92
+
66
93
  def supported_family?(family)
67
94
  !resolve_family(family).nil?
68
95
  end
data/lib/ea/version.rb CHANGED
@@ -4,5 +4,5 @@ module Ea
4
4
  # Gem release version. Extracted to its own file so the
5
5
  # `gem-release` tool's `gem bump` can find and update it via the
6
6
  # standard `lib/<gem>/version.rb` convention.
7
- VERSION = "0.6.61"
7
+ VERSION = "0.6.62"
8
8
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ea
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.61
4
+ version: 0.6.62
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-10-07 00:00:00.000000000 Z
11
+ date: 2026-10-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: lutaml-model