ea 0.6.46 → 0.6.48

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: 5c75b8ba9d59e1d04e015a9daacbc50ee2494e41f6a92d3338e204842df32198
4
- data.tar.gz: 30d44ea4fbac3e6f7566dd9e1a4b353f306faca1190690a8756da6f828f5bb6b
3
+ metadata.gz: 2849c4fcd1a87fd920fd29fa74dd2bd7cdec74bdebc514f84153de46fb9ca0a9
4
+ data.tar.gz: 0a6bd43f0e3e174964d071ea4451cdc0ab2e8c1da69dd734e5293aa04637d764
5
5
  SHA512:
6
- metadata.gz: 86964ae657e21e80eede2a3579ebd0c07070bb4f4d16a7d388e267a4ab883c81969ef08c936c373606b3cc76ee3bce2dcb15b9678306936eefbcd9e822f94330
7
- data.tar.gz: 0aac4dde65b4fe80813fb8ef1d813b5487159bf0a77160e9ff00e49a70f2490bee5f1c224dae9ccf7ba99337288ecbec3fd7c13bd70d283d6b5f2b78119e5bb5
6
+ metadata.gz: 85d3e1fab3fb06c9545f40377460e4e493befab70c82aad96905b556c8fb2e2d5d384f31b49465892a3a49dd5d6c0d932b8eff0c666e34503cf7da2ba722faf1
7
+ data.tar.gz: 10f16708d46732be552481c56386f97df796edb6a779fe50c76ba5a76204f156759c35c15e0763eef88f768627cccc2374d7ac1629c24dcb607351db8046f918
@@ -26,27 +26,35 @@ module Ea
26
26
  # cumulative integer textLength fits bounds.width - 15.
27
27
  # Verified against EA-published reference SVGs.
28
28
  def wrapped_lines(context, body)
29
- usable = context.bounds.width - 15
29
+ # EA's note wrap padding is 4: lines fit bounds.width - 4
30
+ # (9BA1CE54: width 214, longest line tl 210). Pitch and
31
+ # first-line offset scale with the note font (9pt: pitch
32
+ # 16 = size+7, first line at bounds.y + 18 = size+9), and
33
+ # each paragraph break adds one blank pitch row
34
+ # (paragraph 2 starts 32 after the last line of
35
+ # paragraph 1).
36
+ usable = context.bounds.width - 4
30
37
  size = context.size
31
38
  family = context.family
32
- # EA's note body pitch and first-line offset scale with
33
- # the note font (9pt notes: pitch 16 = size+7, first line
34
- # at bounds.y + 18 = size+9 - 9BA1CE54).
35
- pitch = context.size + 7
36
- first_offset = context.size + 9
37
- body.to_s.split(/\n/).flat_map do |para|
38
- wrap_paragraph(para, usable, size, context.family)
39
- end.each_with_index.map do |line, idx|
40
- y = context.bounds.y + first_offset + (idx * pitch)
41
- TextRenderer.new(
42
- content: line,
43
- x: context.bounds.x + context.theme.note.text_x_offset,
44
- y: y,
45
- family: context.family, size: context.size, size_unit: context.size_unit,
46
- fill: context.theme.text_color,
47
- stroke_in_text: context.theme.stroke_in_text_color,
48
- width_factor: context.theme.text_width_factor
49
- ).to_svg
39
+ pitch = size + 7
40
+ first_offset = size + 9
41
+ y_index = 0
42
+ paragraphs = body.to_s.split(/\n/).reject { |p| p.strip.empty? }
43
+ paragraphs.flat_map do |para|
44
+ lines = wrap_paragraph(para, usable, size, context.family)
45
+ lines.each_with_index.map do |line, i|
46
+ y = context.bounds.y + first_offset + ((y_index + i) * pitch)
47
+ TextRenderer.new(
48
+ content: line,
49
+ x: context.bounds.x + context.theme.note.text_x_offset,
50
+ y: y,
51
+ family: context.family, size: context.size,
52
+ size_unit: context.size_unit,
53
+ fill: context.theme.text_color,
54
+ stroke_in_text: context.theme.stroke_in_text_color,
55
+ width_factor: context.theme.text_width_factor
56
+ ).to_svg
57
+ end.tap { y_index += lines.size + 1 }
50
58
  end
51
59
  end
52
60
 
@@ -104,16 +104,19 @@ module Ea
104
104
  attr_bottom_y + size + 5
105
105
  end
106
106
 
107
+ # EA's op block: first row 21 below the last attribute row
108
+ # (9pt... 7pt: attr_bottom + 21), uniform 13px pitch across
109
+ # attrs AND ops (6D4C665D: attrs ..520, ops 541..658 step 13).
107
110
  def op_first_y
108
111
  return nil unless op_lines_count&.positive?
109
112
 
110
- op_divider_y + size + 5
113
+ attr_bottom_y + size + 14
111
114
  end
112
115
 
113
116
  def op_bottom_y
114
117
  return op_divider_y unless op_lines_count&.positive?
115
118
 
116
- op_first_y + (op_lines_count - 1) * (size + 4)
119
+ op_first_y + (op_lines_count - 1) * (size + 6)
117
120
  end
118
121
 
119
122
  # EA draws a single divider under the header and seats
@@ -17,7 +17,9 @@ module Ea
17
17
  CONTENT_X_OFFSET = 20
18
18
 
19
19
  def self.render(operations, bounds:, first_y:, family:, size:)
20
- line_h = size + 4
20
+ # EA's op rows pitch 13 (size + 6), same as attribute
21
+ # rows (6D4C665D: ops 541..658 step 13).
22
+ line_h = size + 6
21
23
  text_blocks = []
22
24
  has_receptions = operations.any?(&:is_reception)
23
25
  if has_receptions
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.46"
7
+ VERSION = "0.6.48"
8
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ea
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.46
4
+ version: 0.6.48
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.