1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
use serde::Deserialize;
use crate::Coord;
/// Anchor data for glyphs.
///
/// See the [SMuFL documentation](https://w3c.github.io/smufl/latest/specification/glyphswithanchors.html).
#[derive(Clone, Copy, Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Anchors {
/// The exact position at which the bottom right-hand (south-east) corner of
/// an angled upward-pointing stem connecting the right-hand side of a
/// notehead to a vertical stem to its left should start, relative to the
/// glyph origin, expressed as Cartesian coordinates in staff spaces.
#[serde(rename = "splitStemUpSE")]
pub split_stem_up_se: Option<Coord>,
/// The exact position at which the bottom left-hand (south-west) corner of
/// an angled upward-pointing stem connecting the left-hand side of a
/// notehead to a vertical stem to its right should start, relative to the
/// glyph origin, expressed as Cartesian coordinates in staff spaces.
#[serde(rename = "splitStemUpSW")]
pub split_stem_up_sw: Option<Coord>,
/// The exact position at which the top right-hand (north-east) corner of an
/// angled downward-pointing stem connecting the right-hand side of a
/// notehead to a vertical stem to its left should start, relative to the
/// glyph origin, expressed as Cartesian coordinates in staff spaces.
#[serde(rename = "splitStemDownNE")]
pub split_stem_down_ne: Option<Coord>,
/// The exact position at which the top left-hand (north-west) corner of an
/// angled downward-pointing stem connecting the left-hand side of a
/// notehead to a vertical stem to its right should start, relative to the
/// glyph origin, expressed as Cartesian coordinates in staff spaces.
#[serde(rename = "splitStemDownNW")]
pub split_stem_down_nw: Option<Coord>,
/// The exact position at which the bottom right-hand (south-east) corner of
/// an upward-pointing stem rectangle should start, relative to the glyph
/// origin, expressed as Cartesian coordinates in staff spaces.
#[serde(rename = "stemUpSE")]
pub stem_up_se: Option<Coord>,
/// The exact position at which the top left-hand (north-west) corner of a
/// downward-pointing stem rectangle should start, relative to the glyph
/// origin, expressed as Cartesian coordinates in staff spaces.[^note]
///
/// [^note]: It is typical for noteheads and flags to be drawn using font
/// glyphs, while stems themselves are drawn using primitive lines or
/// rectangles. Flag glyphs in SMuFL-compliant fonts are registered such
/// that y=0 represents the end of a stem drawn at its normal length, i.e.
/// typically 3.5 staff spaces, so for simple drawing, any flag can be drawn
/// at the same position relative to the stem and give the correct visual
/// stem length. Modern drawing APIs typically provide sub-pixel RGB
/// anti-aliasing for font glyphs, but may only provide grayscale
/// anti-aliasing for primitive shapes. If the stem is drawn at its normal
/// length with a flag glyph continuing beyond the end of the stem, there
/// may be a poor visual appearance resulting from the primitive stem using
/// standard anti-aliasing and the flag glyph using sub-pixel anti-aliasing.
/// Therefore, it is recommended to extend the stem by the additional height
/// of the flag such that the primitive stem stops at the end (or just short
/// of the end) of the flag. Because the amount by which the stem should be
/// extended is highly dependent on the design of the flag in a particular
/// font, this value should be specified for each flag glyph in the metadata
/// JSON file.
#[serde(rename = "stemDownNW")]
pub stem_down_nw: Option<Coord>,
/// The amount by which an up-stem should be lengthened from its nominal
/// unmodified length in order to ensure a good connection with a flag, in
/// spaces.1
#[serde(rename = "stemUpNW")]
pub stem_up_nw: Option<Coord>,
/// The amount by which a down-stem should be lengthened from its nominal
/// unmodified length in order to ensure a good connection with a flag, in
/// spaces.
#[serde(rename = "stemDownSW")]
pub stem_down_sw: Option<Coord>,
/// The width in staff spaces of a given glyph that should be used for e.g.
/// positioning leger lines correctly.2
pub nominal_width: Option<Coord>,
/// The position in staff spaces that should be used to position numerals
/// relative to clefs with ligated numbers where those numbers hang from the
/// bottom of the clef, corresponding horizontally to the center of the
/// numeral’s bounding box.[^note]
///
/// [^note]: It is typical for noteheads and flags to be drawn using font
/// glyphs, while stems themselves are drawn using primitive lines or
/// rectangles. Flag glyphs in SMuFL-compliant fonts are registered such
/// that y=0 represents the end of a stem drawn at its normal length, i.e.
/// typically 3.5 staff spaces, so for simple drawing, any flag can be drawn
/// at the same position relative to the stem and give the correct visual
/// stem length. Modern drawing APIs typically provide sub-pixel RGB
/// anti-aliasing for font glyphs, but may only provide grayscale
/// anti-aliasing for primitive shapes. If the stem is drawn at its normal
/// length with a flag glyph continuing beyond the end of the stem, there
/// may be a poor visual appearance resulting from the primitive stem using
/// standard anti-aliasing and the flag glyph using sub-pixel anti-aliasing.
/// Therefore, it is recommended to extend the stem by the additional height
/// of the flag such that the primitive stem stops at the end (or just short
/// of the end) of the flag. Because the amount by which the stem should be
/// extended is highly dependent on the design of the flag in a particular
/// font, this value should be specified for each flag glyph in the metadata
/// JSON file.
pub numeral_top: Option<Coord>,
/// The position in staff spaces that should be used to position numerals
/// relative to clefs with ligatured numbers where those numbers sit on the
/// baseline or at the north-east corner of the G clef, corresponding
/// horizontally to the center of the numeral’s bounding box.
pub numeral_bottom: Option<Coord>,
/// The Cartesian coordinates in staff spaces of the bottom left corner of a
/// nominal rectangle that intersects the top right corner of the glyph’s
/// bounding box. This rectangle, together with those in the other four
/// corners of the glyph’s bounding box, can be cut out to produce a more
/// detailed bounding box (of abutting rectangles), useful for kerning or
/// interlocking symbols such as accidentals.
#[serde(rename = "cutOutNE")]
pub cut_out_ne: Option<Coord>,
/// The Cartesian coordinates in staff spaces of the top left corner of a
/// nominal rectangle that intersects the bottom right corner of the glyph’s
/// bounding box.
#[serde(rename = "cutOutSE")]
pub cut_out_se: Option<Coord>,
/// The Cartesian coordinates in staff spaces of the top right corner of a
/// nominal rectangle that intersects the bottom left corner of the glyph’s
/// bounding box.
#[serde(rename = "cutOutSW")]
pub cut_out_sw: Option<Coord>,
/// The Cartesian coordinates in staff spaces of the bottom right corner of
/// a nominal rectangle that intersects the top left corner of the glyph’s
/// bounding box.
#[serde(rename = "cutOutNW")]
pub cut_out_nw: Option<Coord>,
/// The Cartesian coordinates in staff spaces of the position at which the
/// glyph graceNoteSlashStemUp should be positioned relative to the stem-up
/// flag of an unbeamed grace note; alternatively, the bottom left corner of
/// a diagonal line drawn instead of using the above glyph.
#[serde(rename = "graceNoteSlashSW")]
pub grace_note_slash_sw: Option<Coord>,
/// The Cartesian coordinates in staff spaces of the top right corner of a
/// diagonal line drawn instead of using the glyph graceNoteSlashStemUp for
/// a stem-up flag of an unbeamed grace note.
#[serde(rename = "graceNoteSlashNE")]
pub grace_note_slash_ne: Option<Coord>,
/// The Cartesian coordinates in staff spaces of the position at which the
/// glyph graceNoteSlashStemDown should be positioned relative to the
/// stem-down flag of an unbeamed grace note; alternatively, the top left
/// corner of a diagonal line drawn instead of using the above glyph.
#[serde(rename = "graceNoteSlashNW")]
pub grace_note_slash_nw: Option<Coord>,
/// The Cartesian coordinates in staff spaces of the bottom right corner of
/// a diagonal line drawn instead of using the glyph graceNoteSlashStemDown
/// for a stem-down flag of an unbeamed grace note.
#[serde(rename = "graceNoteSlashSE")]
pub grace_note_slash_se: Option<Coord>,
/// The Cartesian coordinates in staff spaces of the horizontal position at
/// which a glyph repeats, i.e. the position at which the same glyph or
/// another of the same group should be positioned to ensure correct
/// tessellation. This is used for e.g. multi-segment lines and the
/// component glyphs that make up trills and mordents.
pub repeat_offset: Option<Coord>,
/// The Cartesian coordinates in staff spaces of the left-hand edge of a
/// notehead with a non-zero left-hand side bearing (e.g. a double whole, or
/// breve, notehead with two vertical lines at each side), to assist in the
/// correct horizontal alignment of these noteheads with other noteheads
/// with zero-width left-side bearings.
pub notehead_origin: Option<Coord>,
/// The Cartesian coordinates in staff spaces of the optical center of the
/// glyph, to assist in the correct horizontal alignment of the glyph
/// relative to a notehead or stem. Currently recommended for use with
/// glyphs in the *Dynamics* range.
pub optical_center: Option<Coord>,
}