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 +4 -4
- data/lib/ea/fonts/metrics.rb +30 -3
- data/lib/ea/svg/ea_emitter/elements.rb +8 -7
- data/lib/ea/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 30cdaecff7833cb3af1138d6ac1df0667dbdde2e3b6f109ae456cd6c3c5e1dab
|
|
4
|
+
data.tar.gz: 9d6fc9c8bd00571d092bcb8250260195758514e7edb62993a5e08c3a19ce0bde
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 04b411c70b7d59ec632737088134fdf6cb41205444aa754294f5b6e66406ff49cdcd08fbff7094ecfbd70f62559949255f30783dc1f481a104465e551ce8aabe
|
|
7
|
+
data.tar.gz: d06fa28bb5c00f669c4d6ac3b99abfc5f410680d1a0a9770ff9969b7ed2ad5dd7753b17964c2553189e217ce67f3ed6875fbaf7e404f3c11d813c7781951a8bb
|
data/lib/ea/fonts/metrics.rb
CHANGED
|
@@ -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
|
-
|
|
61
|
-
|
|
62
|
-
|
|
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
|
|
266
|
-
#
|
|
267
|
-
#
|
|
268
|
-
#
|
|
269
|
-
# carrying an explicit "interface"
|
|
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
|
-
|
|
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
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.
|
|
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-
|
|
11
|
+
date: 2026-10-08 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: lutaml-model
|