vexflow 5.0.0-alpha.2 → 5.0.0-alpha.3
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.
- package/build/cjs/vexflow-bravura.js +2 -2
- package/build/cjs/vexflow-bravura.js.map +1 -1
- package/build/cjs/vexflow-core.js +2 -2
- package/build/cjs/vexflow-core.js.map +1 -1
- package/build/cjs/vexflow-debug-with-tests.js +4 -4
- package/build/cjs/vexflow-debug-with-tests.js.map +1 -1
- package/build/cjs/vexflow-debug.js +4 -4
- package/build/cjs/vexflow-debug.js.map +1 -1
- package/build/cjs/vexflow.js +2 -2
- package/build/cjs/vexflow.js.map +1 -1
- package/build/esm/src/version.js +3 -3
- package/package.json +1 -3
- package/entry/vexflow-bravura.ts +0 -25
- package/entry/vexflow-core.ts +0 -16
- package/entry/vexflow-debug-with-tests.ts +0 -64
- package/entry/vexflow-debug.ts +0 -54
- package/entry/vexflow.ts +0 -47
- package/src/accidental.ts +0 -570
- package/src/annotation.ts +0 -294
- package/src/articulation.ts +0 -383
- package/src/barnote.ts +0 -95
- package/src/beam.ts +0 -999
- package/src/bend.ts +0 -268
- package/src/boundingbox.ts +0 -108
- package/src/canvascontext.ts +0 -348
- package/src/chordsymbol.ts +0 -473
- package/src/clef.ts +0 -164
- package/src/clefnote.ts +0 -50
- package/src/crescendo.ts +0 -132
- package/src/curve.ts +0 -195
- package/src/dot.ts +0 -171
- package/src/easyscore.ts +0 -538
- package/src/element.ts +0 -692
- package/src/factory.ts +0 -694
- package/src/font.ts +0 -343
- package/src/fonts/academico.ts +0 -2
- package/src/fonts/academicobold.ts +0 -2
- package/src/fonts/bravura.ts +0 -2
- package/src/fonts/gonville.ts +0 -2
- package/src/fonts/petaluma.ts +0 -2
- package/src/fonts/petalumascript.ts +0 -2
- package/src/formatter.ts +0 -1107
- package/src/fraction.ts +0 -245
- package/src/frethandfinger.ts +0 -180
- package/src/ghostnote.ts +0 -75
- package/src/glyphnote.ts +0 -68
- package/src/glyphs.ts +0 -5880
- package/src/gracenote.ts +0 -146
- package/src/gracenotegroup.ts +0 -194
- package/src/gracetabnote.ts +0 -30
- package/src/index.ts +0 -90
- package/src/keymanager.ts +0 -153
- package/src/keysignature.ts +0 -272
- package/src/keysignote.ts +0 -46
- package/src/metrics.ts +0 -222
- package/src/modifier.ts +0 -216
- package/src/modifiercontext.ts +0 -177
- package/src/multimeasurerest.ts +0 -229
- package/src/music.ts +0 -443
- package/src/note.ts +0 -690
- package/src/notehead.ts +0 -158
- package/src/notesubgroup.ts +0 -88
- package/src/ornament.ts +0 -301
- package/src/parenthesis.ts +0 -89
- package/src/parser.ts +0 -263
- package/src/pedalmarking.ts +0 -273
- package/src/registry.ts +0 -146
- package/src/rendercontext.ts +0 -98
- package/src/renderer.ts +0 -166
- package/src/repeatnote.ts +0 -25
- package/src/stave.ts +0 -885
- package/src/stavebarline.ts +0 -231
- package/src/staveconnector.ts +0 -281
- package/src/stavehairpin.ts +0 -209
- package/src/staveline.ts +0 -343
- package/src/stavemodifier.ts +0 -93
- package/src/stavenote.ts +0 -1230
- package/src/staverepetition.ts +0 -148
- package/src/stavesection.ts +0 -54
- package/src/stavetempo.ts +0 -162
- package/src/stavetext.ts +0 -69
- package/src/stavetie.ts +0 -235
- package/src/stavevolta.ts +0 -66
- package/src/stem.ts +0 -225
- package/src/stemmablenote.ts +0 -248
- package/src/stringnumber.ts +0 -286
- package/src/strokes.ts +0 -214
- package/src/svgcontext.ts +0 -639
- package/src/system.ts +0 -327
- package/src/tables.ts +0 -796
- package/src/tabnote.ts +0 -449
- package/src/tabslide.ts +0 -115
- package/src/tabstave.ts +0 -31
- package/src/tabtie.ts +0 -44
- package/src/textbracket.ts +0 -231
- package/src/textdynamics.ts +0 -101
- package/src/textnote.ts +0 -175
- package/src/tickable.ts +0 -374
- package/src/tickcontext.ts +0 -280
- package/src/timesignature.ts +0 -229
- package/src/timesignote.ts +0 -45
- package/src/tremolo.ts +0 -51
- package/src/tuning.ts +0 -90
- package/src/tuplet.ts +0 -349
- package/src/typeguard.ts +0 -136
- package/src/util.ts +0 -169
- package/src/version.ts +0 -4
- package/src/vexflow.ts +0 -378
- package/src/vibrato.ts +0 -99
- package/src/vibratobracket.ts +0 -81
- package/src/voice.ts +0 -302
- package/src/web.ts +0 -35
package/src/keysignature.ts
DELETED
|
@@ -1,272 +0,0 @@
|
|
|
1
|
-
// Copyright (c) 2023-present VexFlow contributors: https://github.com/vexflow/vexflow/graphs/contributors
|
|
2
|
-
// @author Cyril Silverman
|
|
3
|
-
//
|
|
4
|
-
// ## Description
|
|
5
|
-
//
|
|
6
|
-
// This file implements key signatures. A key signature sits on a stave
|
|
7
|
-
// and indicates the notes with implicit accidentals.
|
|
8
|
-
|
|
9
|
-
import { Element } from './element';
|
|
10
|
-
import { Stave } from './stave';
|
|
11
|
-
import { StaveModifier, StaveModifierPosition } from './stavemodifier';
|
|
12
|
-
import { Tables } from './tables';
|
|
13
|
-
import { Category } from './typeguard';
|
|
14
|
-
import { defined } from './util';
|
|
15
|
-
|
|
16
|
-
export class KeySignature extends StaveModifier {
|
|
17
|
-
static get CATEGORY(): string {
|
|
18
|
-
return Category.KeySignature;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
protected glyphs: Element[];
|
|
22
|
-
protected paddingForced: boolean;
|
|
23
|
-
protected formatted?: boolean;
|
|
24
|
-
protected cancelKeySpec?: string;
|
|
25
|
-
protected accList: { type: string; line: number }[] = [];
|
|
26
|
-
protected keySpec?: string;
|
|
27
|
-
protected alterKeySpec?: string[];
|
|
28
|
-
|
|
29
|
-
// Create a new Key Signature based on a `keySpec`
|
|
30
|
-
constructor(keySpec: string, cancelKeySpec?: string, alterKeySpec?: string[]) {
|
|
31
|
-
super();
|
|
32
|
-
|
|
33
|
-
this.setKeySig(keySpec, cancelKeySpec, alterKeySpec);
|
|
34
|
-
this.setPosition(StaveModifierPosition.BEGIN);
|
|
35
|
-
this.glyphs = [];
|
|
36
|
-
this.paddingForced = false;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
// Add an accidental glyph to the `KeySignature` instance which represents
|
|
40
|
-
// the provided `acc`. If `nextAcc` is also provided, the appropriate
|
|
41
|
-
// spacing will be included in the glyph's position
|
|
42
|
-
convertToGlyph(acc: { type: string; line: number }, nextAcc: { type: string; line: number }, stave: Stave): void {
|
|
43
|
-
const code = Tables.accidentalCodes(acc.type);
|
|
44
|
-
const glyph = new Element(Category.KeySignature);
|
|
45
|
-
glyph.setText(code);
|
|
46
|
-
|
|
47
|
-
// Determine spacing between current accidental and the next accidental
|
|
48
|
-
const extraWidth = 1;
|
|
49
|
-
// Place the glyph on the stave
|
|
50
|
-
glyph.setYShift(stave.getYForLine(acc.line));
|
|
51
|
-
if (this.glyphs.length > 0) {
|
|
52
|
-
const prevGlyph = this.glyphs[this.glyphs.length - 1];
|
|
53
|
-
glyph.setXShift(prevGlyph.getXShift() + prevGlyph.getWidth() + extraWidth);
|
|
54
|
-
}
|
|
55
|
-
this.glyphs.push(glyph);
|
|
56
|
-
|
|
57
|
-
// Expand size of key signature
|
|
58
|
-
this.width += glyph.getWidth() + extraWidth;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
// Cancel out a key signature provided in the `spec` parameter. This will
|
|
62
|
-
// place appropriate natural accidentals before the key signature.
|
|
63
|
-
cancelKey(spec: string): this {
|
|
64
|
-
this.formatted = false;
|
|
65
|
-
this.cancelKeySpec = spec;
|
|
66
|
-
|
|
67
|
-
return this;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
convertToCancelAccList(spec: string): { type: string; accList: { type: string; line: number }[] } | undefined {
|
|
71
|
-
// Get the accidental list for the cancelled key signature
|
|
72
|
-
const cancelAccList = Tables.keySignature(spec);
|
|
73
|
-
|
|
74
|
-
// If the cancelled key has a different accidental type, ie: # vs b
|
|
75
|
-
const differentTypes =
|
|
76
|
-
this.accList.length > 0 && cancelAccList.length > 0 && cancelAccList[0].type !== this.accList[0].type;
|
|
77
|
-
|
|
78
|
-
// Determine how many naturals needed to add
|
|
79
|
-
const naturals = differentTypes ? cancelAccList.length : cancelAccList.length - this.accList.length;
|
|
80
|
-
|
|
81
|
-
// Return if no naturals needed
|
|
82
|
-
if (naturals < 1) return undefined;
|
|
83
|
-
|
|
84
|
-
// Get the line position for each natural
|
|
85
|
-
const cancelled: { type: string; line: number }[] = [];
|
|
86
|
-
for (let i = 0; i < naturals; i++) {
|
|
87
|
-
let index = i;
|
|
88
|
-
if (!differentTypes) {
|
|
89
|
-
index = cancelAccList.length - naturals + i;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
const acc = cancelAccList[index];
|
|
93
|
-
cancelled.push({ type: 'n', line: acc.line });
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
// Combine naturals with main accidental list for the key signature
|
|
97
|
-
this.accList = cancelled.concat(this.accList);
|
|
98
|
-
|
|
99
|
-
return {
|
|
100
|
-
accList: cancelled,
|
|
101
|
-
type: cancelAccList[0].type,
|
|
102
|
-
};
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
addToStave(stave: Stave): this {
|
|
106
|
-
this.paddingForced = true;
|
|
107
|
-
stave.addModifier(this);
|
|
108
|
-
|
|
109
|
-
return this;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
// Apply the accidental staff line placement based on the `clef` and
|
|
113
|
-
// the accidental `type` for the key signature ('# or 'b').
|
|
114
|
-
convertAccLines(clef: string, type?: string, accList = this.accList): void {
|
|
115
|
-
let offset = 0.0; // if clef === "treble"
|
|
116
|
-
let customLines; // when clef doesn't follow treble key sig shape
|
|
117
|
-
|
|
118
|
-
switch (clef) {
|
|
119
|
-
// Treble & Subbass both have offsets of 0, so are not included.
|
|
120
|
-
case 'soprano':
|
|
121
|
-
if (type === '#') customLines = [2.5, 0.5, 2, 0, 1.5, -0.5, 1];
|
|
122
|
-
else offset = -1;
|
|
123
|
-
break;
|
|
124
|
-
case 'mezzo-soprano':
|
|
125
|
-
if (type === 'b') customLines = [0, 2, 0.5, 2.5, 1, 3, 1.5];
|
|
126
|
-
else offset = 1.5;
|
|
127
|
-
break;
|
|
128
|
-
case 'alto':
|
|
129
|
-
offset = 0.5;
|
|
130
|
-
break;
|
|
131
|
-
case 'tenor':
|
|
132
|
-
if (type === '#') customLines = [3, 1, 2.5, 0.5, 2, 0, 1.5];
|
|
133
|
-
else offset = -0.5;
|
|
134
|
-
break;
|
|
135
|
-
case 'baritone-f':
|
|
136
|
-
case 'baritone-c':
|
|
137
|
-
if (type === 'b') customLines = [0.5, 2.5, 1, 3, 1.5, 3.5, 2];
|
|
138
|
-
else offset = 2;
|
|
139
|
-
break;
|
|
140
|
-
case 'bass':
|
|
141
|
-
case 'french':
|
|
142
|
-
offset = 1;
|
|
143
|
-
break;
|
|
144
|
-
default:
|
|
145
|
-
break;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
// If there's a special case, assign those lines/spaces:
|
|
149
|
-
let i;
|
|
150
|
-
if (typeof customLines !== 'undefined') {
|
|
151
|
-
for (i = 0; i < accList.length; ++i) {
|
|
152
|
-
accList[i].line = customLines[i];
|
|
153
|
-
}
|
|
154
|
-
} else if (offset !== 0) {
|
|
155
|
-
for (i = 0; i < accList.length; ++i) {
|
|
156
|
-
accList[i].line += offset;
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
getPadding(index: number): number {
|
|
162
|
-
if (!this.formatted) this.format();
|
|
163
|
-
|
|
164
|
-
return this.glyphs.length === 0 || (!this.paddingForced && index < 2) ? 0 : this.padding;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
getWidth(): number {
|
|
168
|
-
if (!this.formatted) this.calculateWidth();
|
|
169
|
-
|
|
170
|
-
return this.width;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
setKeySig(keySpec: string, cancelKeySpec?: string, alterKeySpec?: string[]): this {
|
|
174
|
-
this.formatted = false;
|
|
175
|
-
this.keySpec = keySpec;
|
|
176
|
-
this.cancelKeySpec = cancelKeySpec;
|
|
177
|
-
this.alterKeySpec = alterKeySpec;
|
|
178
|
-
|
|
179
|
-
return this;
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
// Alter the accidentals of a key spec one by one.
|
|
183
|
-
// Each alteration is a new accidental that replaces the
|
|
184
|
-
// original accidental (or the canceled one).
|
|
185
|
-
alterKey(alterKeySpec: string[]): this {
|
|
186
|
-
this.formatted = false;
|
|
187
|
-
this.alterKeySpec = alterKeySpec;
|
|
188
|
-
|
|
189
|
-
return this;
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
convertToAlterAccList(alterKeySpec: string[]): void {
|
|
193
|
-
const max = Math.min(alterKeySpec.length, this.accList.length);
|
|
194
|
-
for (let i = 0; i < max; ++i) {
|
|
195
|
-
if (alterKeySpec[i]) {
|
|
196
|
-
this.accList[i].type = alterKeySpec[i];
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
format(): void {
|
|
202
|
-
const stave = this.checkStave();
|
|
203
|
-
|
|
204
|
-
this.width = 0;
|
|
205
|
-
this.glyphs = [];
|
|
206
|
-
this.accList = Tables.keySignature(defined(this.keySpec));
|
|
207
|
-
const accList = this.accList;
|
|
208
|
-
const firstAccidentalType = accList.length > 0 ? accList[0].type : undefined;
|
|
209
|
-
let cancelAccList;
|
|
210
|
-
if (this.cancelKeySpec) {
|
|
211
|
-
cancelAccList = this.convertToCancelAccList(this.cancelKeySpec);
|
|
212
|
-
}
|
|
213
|
-
if (this.alterKeySpec) {
|
|
214
|
-
this.convertToAlterAccList(this.alterKeySpec);
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
if (this.accList.length > 0) {
|
|
218
|
-
const clef =
|
|
219
|
-
(this.position === StaveModifierPosition.END ? stave.getEndClef() : stave.getClef()) || stave.getClef();
|
|
220
|
-
if (cancelAccList) {
|
|
221
|
-
this.convertAccLines(clef, cancelAccList.type, cancelAccList.accList);
|
|
222
|
-
}
|
|
223
|
-
this.convertAccLines(clef, firstAccidentalType, accList);
|
|
224
|
-
for (let i = 0; i < this.accList.length; ++i) {
|
|
225
|
-
this.convertToGlyph(this.accList[i], this.accList[i + 1], stave);
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
this.formatted = true;
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
protected calculateWidth(): void {
|
|
233
|
-
this.width = 0;
|
|
234
|
-
this.accList = Tables.keySignature(defined(this.keySpec));
|
|
235
|
-
if (this.cancelKeySpec) {
|
|
236
|
-
this.convertToCancelAccList(this.cancelKeySpec);
|
|
237
|
-
}
|
|
238
|
-
if (this.alterKeySpec) {
|
|
239
|
-
this.convertToAlterAccList(this.alterKeySpec);
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
if (this.accList.length > 0) {
|
|
243
|
-
for (let i = 0; i < this.accList.length; ++i) {
|
|
244
|
-
const code = Tables.accidentalCodes(this.accList[i].type);
|
|
245
|
-
const glyph = new Element(Category.KeySignature);
|
|
246
|
-
glyph.setText(code);
|
|
247
|
-
// Determine spacing between current accidental and the next accidental
|
|
248
|
-
const extraWidth = 1;
|
|
249
|
-
|
|
250
|
-
// Expand size of key signature
|
|
251
|
-
this.width += glyph.getWidth() + extraWidth;
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
draw(): void {
|
|
257
|
-
const stave = this.checkStave();
|
|
258
|
-
const ctx = stave.checkContext();
|
|
259
|
-
|
|
260
|
-
if (!this.formatted) this.format();
|
|
261
|
-
this.setRendered();
|
|
262
|
-
|
|
263
|
-
this.applyStyle(ctx);
|
|
264
|
-
ctx.openGroup('keysignature', this.getAttribute('id'));
|
|
265
|
-
for (let i = 0; i < this.glyphs.length; i++) {
|
|
266
|
-
const glyph = this.glyphs[i];
|
|
267
|
-
glyph.renderText(ctx, this.x, 0);
|
|
268
|
-
}
|
|
269
|
-
ctx.closeGroup();
|
|
270
|
-
this.restoreStyle(ctx);
|
|
271
|
-
}
|
|
272
|
-
}
|
package/src/keysignote.ts
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
// Copyright (c) 2023-present VexFlow contributors: https://github.com/vexflow/vexflow/graphs/contributors
|
|
2
|
-
// @author: Mark Meeus 2019
|
|
3
|
-
|
|
4
|
-
import { KeySignature } from './keysignature';
|
|
5
|
-
import { ModifierContext } from './modifiercontext';
|
|
6
|
-
import { Note } from './note';
|
|
7
|
-
import { Category } from './typeguard';
|
|
8
|
-
|
|
9
|
-
export class KeySigNote extends Note {
|
|
10
|
-
static get CATEGORY(): string {
|
|
11
|
-
return Category.KeySigNote;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
protected keySignature: KeySignature;
|
|
15
|
-
|
|
16
|
-
constructor(keySpec: string, cancelKeySpec?: string, alterKeySpec?: string[]) {
|
|
17
|
-
super({ duration: 'b' });
|
|
18
|
-
|
|
19
|
-
this.keySignature = new KeySignature(keySpec, cancelKeySpec, alterKeySpec);
|
|
20
|
-
|
|
21
|
-
// Note properties
|
|
22
|
-
this.ignoreTicks = true;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/* Overridden to ignore */
|
|
26
|
-
// eslint-disable-next-line
|
|
27
|
-
addToModifierContext(mc: ModifierContext): this {
|
|
28
|
-
// DO NOTHING.
|
|
29
|
-
return this;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
preFormat(): this {
|
|
33
|
-
this.preFormatted = true;
|
|
34
|
-
this.keySignature.setStave(this.checkStave());
|
|
35
|
-
this.setWidth(this.keySignature.getWidth());
|
|
36
|
-
return this;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
draw(): void {
|
|
40
|
-
const ctx = this.checkStave().checkContext();
|
|
41
|
-
this.setRendered();
|
|
42
|
-
this.keySignature.setX(this.getAbsoluteX());
|
|
43
|
-
this.keySignature.setContext(ctx);
|
|
44
|
-
this.keySignature.draw();
|
|
45
|
-
}
|
|
46
|
-
}
|
package/src/metrics.ts
DELETED
|
@@ -1,222 +0,0 @@
|
|
|
1
|
-
// Copyright (c) 2023-present VexFlow contributors: https://github.com/vexflow/vexflow/graphs/contributors
|
|
2
|
-
|
|
3
|
-
import { FontInfo } from './font';
|
|
4
|
-
|
|
5
|
-
export class Metrics {
|
|
6
|
-
/** Use the provided key to look up a FontInfo in CommonMetrics. **/
|
|
7
|
-
static getFontInfo(key: string): Required<FontInfo> {
|
|
8
|
-
return {
|
|
9
|
-
family: Metrics.get(`${key}.fontFamily`),
|
|
10
|
-
size: Metrics.get(`${key}.fontSize`) * Metrics.get(`${key}.fontScale`),
|
|
11
|
-
weight: Metrics.get(`${key}.fontWeight`),
|
|
12
|
-
style: Metrics.get(`${key}.fontStyle`),
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Use the provided key to look up a value in CommonMetrics.
|
|
18
|
-
*
|
|
19
|
-
* @param key is a string separated by periods (e.g., `Stroke.text.fontFamily`).
|
|
20
|
-
* @param defaultValue is returned if the lookup fails.
|
|
21
|
-
* @returns the retrieved value (or `defaultValue` if the lookup fails).
|
|
22
|
-
*
|
|
23
|
-
* For the key `Stroke.text.fontFamily`, check all of the following in order:
|
|
24
|
-
* 1) CommonMetrics.fontFamily
|
|
25
|
-
* 2) CommonMetrics.Stroke.fontFamily
|
|
26
|
-
* 3) CommonMetrics.Stroke.text.fontFamily
|
|
27
|
-
* Retrieve the value from the most specific key (i.e., prefer #3 over #2 over #1 in the above example).
|
|
28
|
-
*/
|
|
29
|
-
// eslint-disable-next-line
|
|
30
|
-
static get(key: string, defaultValue?: any): any {
|
|
31
|
-
const keyParts = key.split('.');
|
|
32
|
-
const lastKeyPart = keyParts.pop()!; // Use ! because keyParts is not empty, since ''.split('.') still returns [''].
|
|
33
|
-
|
|
34
|
-
// Start from root of CommonMetrics and go down as far as possible.
|
|
35
|
-
let curr = MetricsDefaults;
|
|
36
|
-
let retVal = defaultValue;
|
|
37
|
-
|
|
38
|
-
while (curr) {
|
|
39
|
-
// Update retVal whenever we find a value assigned to a more specific key.
|
|
40
|
-
retVal = curr[lastKeyPart] ?? retVal;
|
|
41
|
-
const keyPart = keyParts.shift();
|
|
42
|
-
if (keyPart) {
|
|
43
|
-
curr = curr[keyPart]; // Go down one level.
|
|
44
|
-
} else {
|
|
45
|
-
break;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
return retVal;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
// eslint-disable-next-line
|
|
54
|
-
export const MetricsDefaults: Record<string, any> = {
|
|
55
|
-
fontFamily: 'Bravura,Academico',
|
|
56
|
-
fontSize: 30,
|
|
57
|
-
fontScale: 1.0,
|
|
58
|
-
fontWeight: 'normal',
|
|
59
|
-
fontStyle: 'normal',
|
|
60
|
-
|
|
61
|
-
Accidental: {
|
|
62
|
-
cautionary: {
|
|
63
|
-
fontSize: 20,
|
|
64
|
-
},
|
|
65
|
-
grace: {
|
|
66
|
-
fontSize: 25,
|
|
67
|
-
},
|
|
68
|
-
noteheadAccidentalPadding: 1,
|
|
69
|
-
leftPadding: 2,
|
|
70
|
-
accidentalSpacing: 3,
|
|
71
|
-
},
|
|
72
|
-
|
|
73
|
-
Annotation: {
|
|
74
|
-
fontSize: 10,
|
|
75
|
-
},
|
|
76
|
-
|
|
77
|
-
Bend: {
|
|
78
|
-
fontSize: 10,
|
|
79
|
-
},
|
|
80
|
-
|
|
81
|
-
ChordSymbol: {
|
|
82
|
-
fontSize: 12,
|
|
83
|
-
spacing: 0.05,
|
|
84
|
-
subscriptOffset: 0.2,
|
|
85
|
-
superscriptOffset: -0.4,
|
|
86
|
-
superSubRatio: 0.6,
|
|
87
|
-
},
|
|
88
|
-
|
|
89
|
-
FretHandFinger: {
|
|
90
|
-
fontSize: 9,
|
|
91
|
-
fontWeight: 'bold',
|
|
92
|
-
},
|
|
93
|
-
|
|
94
|
-
GraceNote: {
|
|
95
|
-
fontScale: 2 / 3,
|
|
96
|
-
},
|
|
97
|
-
|
|
98
|
-
GraceTabNote: {
|
|
99
|
-
fontScale: 2 / 3,
|
|
100
|
-
},
|
|
101
|
-
|
|
102
|
-
NoteHead: {
|
|
103
|
-
minPadding: 2,
|
|
104
|
-
},
|
|
105
|
-
|
|
106
|
-
PedalMarking: {
|
|
107
|
-
text: {
|
|
108
|
-
fontSize: 12,
|
|
109
|
-
fontStyle: 'italic',
|
|
110
|
-
},
|
|
111
|
-
},
|
|
112
|
-
|
|
113
|
-
Repetition: {
|
|
114
|
-
text: {
|
|
115
|
-
fontSize: 12,
|
|
116
|
-
fontWeight: 'bold',
|
|
117
|
-
offsetX: 12,
|
|
118
|
-
offsetY: 25,
|
|
119
|
-
spacing: 5,
|
|
120
|
-
},
|
|
121
|
-
coda: {
|
|
122
|
-
offsetY: 25,
|
|
123
|
-
},
|
|
124
|
-
segno: {
|
|
125
|
-
offsetY: 10,
|
|
126
|
-
},
|
|
127
|
-
},
|
|
128
|
-
|
|
129
|
-
Stave: {
|
|
130
|
-
fontSize: 8,
|
|
131
|
-
padding: 12,
|
|
132
|
-
endPaddingMax: 10,
|
|
133
|
-
endPaddingMin: 5,
|
|
134
|
-
unalignedNotePadding: 10,
|
|
135
|
-
},
|
|
136
|
-
|
|
137
|
-
StaveConnector: {
|
|
138
|
-
text: {
|
|
139
|
-
fontSize: 16,
|
|
140
|
-
},
|
|
141
|
-
},
|
|
142
|
-
|
|
143
|
-
StaveLine: {
|
|
144
|
-
fontSize: 10,
|
|
145
|
-
},
|
|
146
|
-
|
|
147
|
-
StaveSection: {
|
|
148
|
-
fontSize: 10,
|
|
149
|
-
fontWeight: 'bold',
|
|
150
|
-
},
|
|
151
|
-
|
|
152
|
-
StaveTempo: {
|
|
153
|
-
fontSize: 14,
|
|
154
|
-
glyph: {
|
|
155
|
-
fontSize: 25,
|
|
156
|
-
},
|
|
157
|
-
name: {
|
|
158
|
-
fontWeight: 'bold',
|
|
159
|
-
},
|
|
160
|
-
},
|
|
161
|
-
|
|
162
|
-
StaveText: {
|
|
163
|
-
fontSize: 16,
|
|
164
|
-
},
|
|
165
|
-
|
|
166
|
-
StaveTie: {
|
|
167
|
-
fontSize: 10,
|
|
168
|
-
},
|
|
169
|
-
|
|
170
|
-
StringNumber: {
|
|
171
|
-
fontSize: 10,
|
|
172
|
-
fontWeight: 'bold',
|
|
173
|
-
verticalPadding: 8,
|
|
174
|
-
stemPadding: 2,
|
|
175
|
-
leftPadding: 5,
|
|
176
|
-
rightPadding: 6,
|
|
177
|
-
},
|
|
178
|
-
|
|
179
|
-
Stroke: {
|
|
180
|
-
text: {
|
|
181
|
-
fontSize: 10,
|
|
182
|
-
fontStyle: 'italic',
|
|
183
|
-
fontWeight: 'bold',
|
|
184
|
-
},
|
|
185
|
-
},
|
|
186
|
-
|
|
187
|
-
TabNote: {
|
|
188
|
-
text: {
|
|
189
|
-
fontSize: 9,
|
|
190
|
-
},
|
|
191
|
-
},
|
|
192
|
-
|
|
193
|
-
TabSlide: {
|
|
194
|
-
fontSize: 10,
|
|
195
|
-
fontStyle: 'italic',
|
|
196
|
-
fontWeight: 'bold',
|
|
197
|
-
},
|
|
198
|
-
|
|
199
|
-
TabTie: {
|
|
200
|
-
fontSize: 10,
|
|
201
|
-
},
|
|
202
|
-
|
|
203
|
-
TextBracket: {
|
|
204
|
-
fontSize: 15,
|
|
205
|
-
fontStyle: 'italic',
|
|
206
|
-
},
|
|
207
|
-
|
|
208
|
-
TextNote: {
|
|
209
|
-
text: {
|
|
210
|
-
fontSize: 12,
|
|
211
|
-
},
|
|
212
|
-
},
|
|
213
|
-
|
|
214
|
-
Tremolo: {
|
|
215
|
-
spacing: 7,
|
|
216
|
-
},
|
|
217
|
-
|
|
218
|
-
Volta: {
|
|
219
|
-
fontSize: 9,
|
|
220
|
-
fontWeight: 'bold',
|
|
221
|
-
},
|
|
222
|
-
};
|