ea 0.6.46 → 0.6.47
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/svg/ea_emitter/compartment/note_body.rb +27 -19
- data/lib/ea/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 883c961d3fd0e63b7d48117b76db47d79e90a62ed1027ad2cf4aa55082ee5132
|
|
4
|
+
data.tar.gz: d499d2e8b9376a7b79004f7da6c82ed8558cbebaca22fe7b9b83f4e3f534df87
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f056a65fa2b30039c1602d38e90b775f0fd712be85f36774ddbb068c74649bd47f756eb7aa67c45124fbe698c64119849d468d3b29f527ceb113ce4707ea1b96
|
|
7
|
+
data.tar.gz: 8dc93dcf117c9ba1cfaff73a4f521f6c1e9ca8189173f992dbd3e7b15cd43712c843f3b9a80b8d668b3d9ca79043a462cffd2404936d441e09202d1c6f9a5c04
|
|
@@ -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
|
-
|
|
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
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
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
|
|
data/lib/ea/version.rb
CHANGED