ea 0.6.60 → 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: 74995f05048489005215ea547e1d10648ef1b4f17be970c6bceda2ff4ca139cf
4
- data.tar.gz: a2ec5ef474b301d6cdb7cf27794445d58f82d0d6f08cb4da4f66efbbc52ef822
3
+ metadata.gz: 30cdaecff7833cb3af1138d6ac1df0667dbdde2e3b6f109ae456cd6c3c5e1dab
4
+ data.tar.gz: 9d6fc9c8bd00571d092bcb8250260195758514e7edb62993a5e08c3a19ce0bde
5
5
  SHA512:
6
- metadata.gz: 6062986ad82080887177382bddda45367107116d79289ea5a1b1a4dfd0a5d1bc038185ada0dbaa41f25898469e954b5d48b129ae2e5f79cbbe7f0e202d7bc152
7
- data.tar.gz: 0d4310ae1e346347442604db6f92655ce95c3090e5dc287f9c5185f722c9b215df0d59432362af4a42280d3918bed016e0a3a166eaab8fd1e92634a3cea05349
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
@@ -262,18 +262,19 @@ module Ea
262
262
  # (+13). Corpus-verified by identity-matched elements:
263
263
  # Interface +13 x44 vs +16 x17, Enumeration +13 x13 vs +16
264
264
  # x3, Class/Object/DataType +16 x515.
265
- # True Interface-typed elements (fallback «interface» label,
266
- # no stored stereotype) track the divider at last header + 9
267
- # instead of +8: 96EFAA3B/936AA434 compartments sit one
268
- # pixel lower than the class rule, while Class-typed elements
269
- # carrying an explicit "interface" stereotype keep +8
270
- # (5EA23C08's CoordinateSet).
265
+ # True Interface-typed elements with no stored stereotype
266
+ # track the divider at last header + 9 instead of +8 - also
267
+ # when a parent GHOST leads the header (936AA434/Surface:
268
+ # ghost «interface» name, attrs at 152 not 151), while
269
+ # Class-typed elements carrying an explicit "interface"
270
+ # stereotype keep +8 (5EA23C08's CoordinateSet).
271
271
  def divider_offset_for(header_lines, classifier)
272
272
  first = header_lines.first
273
273
  return theme.compartments.divider_offset unless first
274
274
 
275
275
  if classifier.is_a?(Ea::Model::Interface) &&
276
- fallback_stereotype_label?(first.first, classifier)
276
+ !(classifier.respond_to?(:stereotype_refs) &&
277
+ classifier.stereotype_refs&.any?)
277
278
  9
278
279
  else
279
280
  theme.compartments.divider_offset
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.60"
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.60
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