jpfun 0.3.0 → 0.4.0
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/README.md +73 -1
- package/dist/converter/midi/convert.d.ts +50 -0
- package/dist/converter/midi/convert.js +700 -0
- package/dist/converter/midi/index.d.ts +5 -0
- package/dist/converter/midi/index.js +11 -0
- package/dist/converter/midi/json.d.ts +38 -0
- package/dist/converter/midi/json.js +1 -0
- package/dist/converter/midi/triplet.d.ts +30 -0
- package/dist/converter/midi/triplet.js +75 -0
- package/dist/converter/musicxml/dom.d.ts +25 -0
- package/dist/converter/musicxml/dom.js +65 -0
- package/dist/converter/musicxml/features.d.ts +51 -0
- package/dist/converter/musicxml/features.js +232 -0
- package/dist/converter/musicxml/index.d.ts +9 -0
- package/dist/converter/musicxml/index.js +1140 -0
- package/dist/converter/musicxml/model.d.ts +123 -0
- package/dist/converter/musicxml/model.js +1 -0
- package/dist/converter/source.d.ts +22 -0
- package/dist/converter/source.js +51 -0
- package/dist/core.d.ts +22 -0
- package/dist/core.js +22 -0
- package/dist/functions/ASTtypes.d.ts +28 -25
- package/dist/functions/ASTtypes.js +25 -23
- package/dist/functions/adjust/index.js +1 -1
- package/dist/functions/arpeggio/index.d.ts +2 -0
- package/dist/functions/arpeggio/index.js +180 -0
- package/dist/functions/arpeggio/shape.d.ts +7 -0
- package/dist/functions/arpeggio/shape.js +122 -0
- package/dist/functions/bar/index.js +23 -15
- package/dist/functions/beam/auto.d.ts +1 -1
- package/dist/functions/beam/auto.js +1 -1
- package/dist/functions/beam/layout.d.ts +2 -2
- package/dist/functions/beam/layout.js +1 -1
- package/dist/functions/box/index.js +2 -2
- package/dist/functions/br/index.js +1 -1
- package/dist/functions/dash/index.js +7 -6
- package/dist/functions/default.js +6 -2
- package/dist/functions/dot/index.js +12 -22
- package/dist/functions/dyn/index.d.ts +2 -0
- package/dist/functions/dyn/index.js +242 -0
- package/dist/functions/grace/index.d.ts +1 -1
- package/dist/functions/grace/index.js +2 -3
- package/dist/functions/head/index.js +149 -145
- package/dist/functions/key/index.js +5 -4
- package/dist/functions/meter/index.js +6 -5
- package/dist/functions/note/index.js +68 -21
- package/dist/functions/note/noteNameFSM.js +52 -63
- package/dist/functions/page/index.d.ts +2 -0
- package/dist/functions/page/index.js +22 -7
- package/dist/functions/program/index.d.ts +2 -0
- package/dist/functions/program/index.js +30 -0
- package/dist/functions/set/index.js +8 -5
- package/dist/functions/symbol/index.d.ts +13 -3
- package/dist/functions/symbol/index.js +61 -16
- package/dist/functions/symbol/shape.d.ts +2 -0
- package/dist/functions/symbol/shape.js +14 -10
- package/dist/functions/symbol/symbols/dc.d.ts +4 -0
- package/dist/functions/symbol/symbols/dc.js +82 -0
- package/dist/functions/symbol/symbols/{f.d.ts → ds.d.ts} +1 -1
- package/dist/functions/symbol/symbols/ds.js +93 -0
- package/dist/functions/symbol/symbols/dynamics.d.ts +3 -0
- package/dist/functions/symbol/symbols/dynamics.js +168 -0
- package/dist/functions/symbol/symbols/{p.d.ts → fine.d.ts} +1 -1
- package/dist/functions/symbol/symbols/fine.js +12 -0
- package/dist/functions/symbol/symbols/mordent.js +44 -31
- package/dist/functions/symbol/symbols/prall.d.ts +2 -0
- package/dist/functions/symbol/symbols/prall.js +42 -0
- package/dist/functions/symbol/symbols/segno.d.ts +4 -0
- package/dist/functions/symbol/symbols/segno.js +82 -0
- package/dist/functions/symbol/symbols/tr.js +0 -4
- package/dist/functions/tempo/index.js +5 -3
- package/dist/functions/temporal.d.ts +138 -0
- package/dist/functions/temporal.js +101 -0
- package/dist/functions/text/index.js +14 -7
- package/dist/functions/tie/index.js +37 -28
- package/dist/functions/tuplet/index.js +14 -7
- package/dist/functions/up/index.js +23 -21
- package/dist/functions/voice/index.js +121 -45
- package/dist/functions/volta/index.js +51 -48
- package/dist/iife/core.d.ts +1 -0
- package/dist/iife/core.js +3 -0
- package/dist/iife/from-midi.d.ts +1 -0
- package/dist/iife/from-midi.js +15 -0
- package/dist/iife/from-musicxml.d.ts +1 -0
- package/dist/iife/from-musicxml.js +3 -0
- package/dist/iife/full.d.ts +1 -0
- package/dist/iife/full.js +3 -0
- package/dist/index.d.ts +3 -21
- package/dist/index.js +3 -21
- package/dist/jpfun.core.min.js +153 -0
- package/dist/jpfun.from-midi.min.js +9 -0
- package/dist/jpfun.from-musicxml.min.js +12 -0
- package/dist/jpfun.min.js +71 -48
- package/dist/layout/default.js +2 -3
- package/dist/layout/engine.d.ts +2 -1
- package/dist/layout/engine.js +71 -26
- package/dist/layout/model.d.ts +4 -4
- package/dist/layout/model.js +15 -12
- package/dist/layout/page.js +5 -4
- package/dist/layout/path.js +3 -3
- package/dist/layout/types.d.ts +20 -2
- package/dist/lowering/loweringContext.d.ts +3 -1
- package/dist/lowering/loweringContext.js +28 -14
- package/dist/lowering/track.d.ts +4 -8
- package/dist/lowering/track.js +6 -1
- package/dist/lowering/types.d.ts +5 -128
- package/dist/lowering/types.js +1 -98
- package/dist/parser/parse-utils/string-utils.d.ts +2 -0
- package/dist/parser/parse-utils/string-utils.js +4 -0
- package/dist/parser/parserContext.d.ts +7 -8
- package/dist/parser/parserContext.js +41 -36
- package/dist/pipeline.d.ts +6 -5
- package/dist/pipeline.js +4 -5
- package/dist/playback/compile.d.ts +1 -1
- package/dist/playback/compile.js +15 -2
- package/dist/playback/event.d.ts +17 -3
- package/dist/playback/event.js +30 -12
- package/dist/playback/time.js +1 -1
- package/dist/playback/types.d.ts +5 -4
- package/dist/render/text.d.ts +6 -1
- package/dist/render/text.js +8 -1
- package/grammar.md +44 -8
- package/package.json +11 -2
- package/dist/functions/symbol/symbols/f.js +0 -55
- package/dist/functions/symbol/symbols/p.js +0 -61
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type TimeState } from "
|
|
2
|
-
import type { PlaybackEmitter } from "../../playback/types.js";
|
|
1
|
+
import { type TimeState } from "../temporal.js";
|
|
2
|
+
import type { PlaybackCursor, PlaybackEmitter, PlaybackFlowAction } from "../../playback/types.js";
|
|
3
3
|
import { type ASTFunctionClass } from "../ASTtypes.js";
|
|
4
4
|
import { type SymbolShape } from "./shape.js";
|
|
5
5
|
/**
|
|
@@ -10,12 +10,22 @@ import { type SymbolShape } from "./shape.js";
|
|
|
10
10
|
export interface SymbolDefinition {
|
|
11
11
|
readonly name: string;
|
|
12
12
|
readonly description: string;
|
|
13
|
-
|
|
13
|
+
/** 固定图形;文字记号改用 text */
|
|
14
|
+
readonly shapes?: readonly SymbolShape[];
|
|
15
|
+
/** 交给宿主字体绘制的文字记号,与 shapes 二选一 */
|
|
16
|
+
readonly text?: {
|
|
17
|
+
readonly content: string;
|
|
18
|
+
readonly fontFamily: string;
|
|
19
|
+
};
|
|
14
20
|
/** 符号高度 = size × weight,用来修正宽扁字形的视觉重量;默认 1 */
|
|
15
21
|
readonly weight?: number;
|
|
16
22
|
/** 写入本位置之后持续生效的状态,例如力度记号的 velocity */
|
|
17
23
|
readonly onTimeState?: (state: TimeState) => void;
|
|
18
24
|
/** 发布系统控制,或注册对同一折叠序列后续音符的局部变换 */
|
|
19
25
|
readonly emitPlayback?: (emitter: PlaybackEmitter) => void;
|
|
26
|
+
/** 贴在所在列上的标记,供 D.S. 这类跳转回查 */
|
|
27
|
+
readonly playbackMarks?: () => readonly string[];
|
|
28
|
+
/** 播放到达本符号所在列时决定去留;符号恒占一列,所以生效范围不由符号自己声明 */
|
|
29
|
+
readonly onVisit?: (cursor: PlaybackCursor, at: number) => PlaybackFlowAction | undefined;
|
|
20
30
|
}
|
|
21
31
|
export declare const SymbolNode: ASTFunctionClass;
|
|
@@ -1,14 +1,19 @@
|
|
|
1
|
-
import { ErrorDiagnostic } from "../../diagnostic.js";
|
|
2
|
-
import { DEFAULT_KEY, TemporalNodeBase } from "
|
|
1
|
+
import { ErrorDiagnostic, WarningDiagnostic } from "../../diagnostic.js";
|
|
2
|
+
import { DEFAULT_KEY, TemporalNodeBase } from "../temporal.js";
|
|
3
3
|
import { ASTFunctionNode, } from "../ASTtypes.js";
|
|
4
4
|
import { paintSymbol, symbolBounds } from "./shape.js";
|
|
5
5
|
import { accentSymbol } from "./symbols/accent.js";
|
|
6
|
+
import { dcSymbol } from "./symbols/dc.js";
|
|
7
|
+
import { dsSymbol } from "./symbols/ds.js";
|
|
8
|
+
import { dynamicSymbols } from "./symbols/dynamics.js";
|
|
6
9
|
import { fermataSymbol } from "./symbols/fermata.js";
|
|
7
|
-
import {
|
|
10
|
+
import { fineSymbol } from "./symbols/fine.js";
|
|
8
11
|
import { mordentSymbol } from "./symbols/mordent.js";
|
|
9
|
-
import {
|
|
12
|
+
import { prallSymbol } from "./symbols/prall.js";
|
|
13
|
+
import { segnoSymbol } from "./symbols/segno.js";
|
|
10
14
|
import { trSymbol } from "./symbols/tr.js";
|
|
11
|
-
const symbolTable = new Map([trSymbol,
|
|
15
|
+
const symbolTable = new Map([trSymbol, fermataSymbol, prallSymbol, mordentSymbol, accentSymbol, ...dynamicSymbols,
|
|
16
|
+
dcSymbol, dsSymbol, segnoSymbol, fineSymbol]
|
|
12
17
|
.map(definition => [definition.name.toLowerCase(), definition]));
|
|
13
18
|
class SymbolFunction extends ASTFunctionNode {
|
|
14
19
|
static def = {
|
|
@@ -59,36 +64,76 @@ class SymbolFunction extends ASTFunctionNode {
|
|
|
59
64
|
this.size = ctx.length2px(size);
|
|
60
65
|
const definition = symbolTable.get(name.toLowerCase());
|
|
61
66
|
if (!definition) {
|
|
62
|
-
|
|
67
|
+
const message = `@symbol: 未知符号: $${name}`;
|
|
68
|
+
if (ctx.variables.strict)
|
|
69
|
+
throw new ErrorDiagnostic("E_UNKNOWN_SYMBOL", message, sourceSpan);
|
|
70
|
+
ctx.diagnostics.push(new WarningDiagnostic("W_UNKNOWN_SYMBOL", message, sourceSpan));
|
|
71
|
+
return;
|
|
63
72
|
}
|
|
64
73
|
this.definition = definition;
|
|
65
74
|
}
|
|
66
|
-
loweringEnter() {
|
|
67
|
-
|
|
75
|
+
loweringEnter() {
|
|
76
|
+
return [this.definition
|
|
77
|
+
? new SymbolTemporal(this)
|
|
78
|
+
: new TemporalNodeBase()];
|
|
79
|
+
}
|
|
80
|
+
toString(source) {
|
|
81
|
+
return this.definition ? `@symbol(${this.definition.name})` : super.toString(source);
|
|
82
|
+
}
|
|
68
83
|
}
|
|
69
84
|
export const SymbolNode = SymbolFunction;
|
|
70
85
|
class SymbolTemporal extends TemporalNodeBase {
|
|
71
86
|
/** 符号自身坐标系里的固有包围盒,与布局轮次无关 */
|
|
72
87
|
bounds;
|
|
88
|
+
height;
|
|
89
|
+
/** 文字记号的内容与字号,图形记号为空 */
|
|
90
|
+
label;
|
|
73
91
|
scale = 1;
|
|
92
|
+
baseline = 0;
|
|
74
93
|
constructor(ast) {
|
|
75
94
|
super();
|
|
76
95
|
this.ast = ast;
|
|
77
96
|
this.mergeKey = DEFAULT_KEY;
|
|
78
97
|
this.onTimeState = ast.definition.onTimeState;
|
|
79
98
|
this.emitPlayback = ast.definition.emitPlayback;
|
|
80
|
-
this.
|
|
99
|
+
this.playbackMarks = ast.definition.playbackMarks;
|
|
100
|
+
this.bounds = symbolBounds(ast.definition.shapes ?? []);
|
|
101
|
+
this.height = ast.size * (ast.definition.weight ?? 1);
|
|
102
|
+
const text = ast.definition.text;
|
|
103
|
+
// 文字记号的字号也是 size × weight,所以与图形记号视觉等高
|
|
104
|
+
this.label = text && {
|
|
105
|
+
content: text.content,
|
|
106
|
+
style: { fontSize: this.height, fontFamily: text.fontFamily },
|
|
107
|
+
};
|
|
81
108
|
this.initLayoutBox();
|
|
82
109
|
}
|
|
83
|
-
prepareLayout() {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
110
|
+
prepareLayout(context) {
|
|
111
|
+
if (this.label) {
|
|
112
|
+
const metrics = context.textMeasurer.measureText(this.label.content, this.label.style);
|
|
113
|
+
this.box.w = metrics.w;
|
|
114
|
+
this.box.h = metrics.h;
|
|
115
|
+
this.baseline = metrics.baseline;
|
|
116
|
+
}
|
|
117
|
+
else {
|
|
118
|
+
this.scale = this.height / this.bounds.h;
|
|
119
|
+
this.box.w = this.bounds.w * this.scale;
|
|
120
|
+
this.box.h = this.height;
|
|
121
|
+
}
|
|
88
122
|
this.box.anchor = this.box.w / 2;
|
|
89
|
-
this.box.visualAxis =
|
|
123
|
+
this.box.visualAxis = this.box.h / 2;
|
|
90
124
|
}
|
|
91
125
|
paint(painter) {
|
|
92
|
-
|
|
126
|
+
if (this.label)
|
|
127
|
+
painter.drawText(this.label.content, this.box.x, this.box.y + this.baseline, this.label.style);
|
|
128
|
+
else
|
|
129
|
+
paintSymbol(painter, this.ast.definition.shapes ?? [], this.bounds, this.box, this.scale);
|
|
130
|
+
}
|
|
131
|
+
/** 控制流在生成事件之前展开,emitPlayback 够不到,所以单独接一次 */
|
|
132
|
+
playbackFlow(columnOf) {
|
|
133
|
+
const onVisit = this.ast.definition.onVisit;
|
|
134
|
+
if (!onVisit)
|
|
135
|
+
return;
|
|
136
|
+
const at = columnOf(this);
|
|
137
|
+
return at === undefined ? undefined : { range: [at, at], run: cursor => onVisit(cursor, at) };
|
|
93
138
|
}
|
|
94
139
|
}
|
|
@@ -12,19 +12,22 @@ export function symbolBounds(shapes) {
|
|
|
12
12
|
let top = Infinity;
|
|
13
13
|
let right = -Infinity;
|
|
14
14
|
let bottom = -Infinity;
|
|
15
|
-
const merge = (
|
|
16
|
-
left = Math.min(left,
|
|
17
|
-
top = Math.min(top,
|
|
18
|
-
right = Math.max(right,
|
|
19
|
-
bottom = Math.max(bottom,
|
|
15
|
+
const merge = (x, y, w, h) => {
|
|
16
|
+
left = Math.min(left, x);
|
|
17
|
+
top = Math.min(top, y);
|
|
18
|
+
right = Math.max(right, x + w);
|
|
19
|
+
bottom = Math.max(bottom, y + h);
|
|
20
20
|
};
|
|
21
21
|
for (const shape of shapes) {
|
|
22
|
+
const dx = shape.dx ?? 0;
|
|
22
23
|
if (shape.circle) {
|
|
23
24
|
const { cx, cy, r } = shape.circle;
|
|
24
|
-
merge(
|
|
25
|
+
merge(cx + dx - r, cy - r, 2 * r, 2 * r);
|
|
26
|
+
}
|
|
27
|
+
if (shape.path?.length) {
|
|
28
|
+
const rect = pathBounds(shape.path);
|
|
29
|
+
merge(rect.x + dx, rect.y, rect.w, rect.h);
|
|
25
30
|
}
|
|
26
|
-
if (shape.path?.length)
|
|
27
|
-
merge(pathBounds(shape.path));
|
|
28
31
|
}
|
|
29
32
|
return Number.isFinite(left)
|
|
30
33
|
? { x: left, y: top, w: Math.max(1e-9, right - left), h: Math.max(1e-9, bottom - top) }
|
|
@@ -38,11 +41,12 @@ export function paintSymbol(painter, shapes, bounds, box, scale) {
|
|
|
38
41
|
const scaled = style.strokeWidth === undefined
|
|
39
42
|
? style
|
|
40
43
|
: { ...style, strokeWidth: style.strokeWidth * scale };
|
|
44
|
+
const x = originX + (shape.dx ?? 0) * scale;
|
|
41
45
|
if (shape.path) {
|
|
42
|
-
painter.drawPath(shape.path, scaled, { x
|
|
46
|
+
painter.drawPath(shape.path, scaled, { x, y: originY, scaleX: scale, scaleY: scale });
|
|
43
47
|
}
|
|
44
48
|
if (shape.circle) {
|
|
45
|
-
painter.drawCircle(
|
|
49
|
+
painter.drawCircle(x + shape.circle.cx * scale, originY + shape.circle.cy * scale, shape.circle.r * scale, scaled);
|
|
46
50
|
}
|
|
47
51
|
}
|
|
48
52
|
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/** 回跳点;`$fine` 靠它判断整曲是否已经回过一次头 */
|
|
2
|
+
export const JUMP_MARK = "repeat.jump";
|
|
3
|
+
export const dcSymbol = {
|
|
4
|
+
name: "dc",
|
|
5
|
+
description: "从头反复:跳回曲首再演一遍",
|
|
6
|
+
weight: 0.9,
|
|
7
|
+
shapes: [
|
|
8
|
+
{
|
|
9
|
+
path: [
|
|
10
|
+
{ op: "M", x: 1.06974, y: 7.0752 },
|
|
11
|
+
{ op: "L", x: 2.69184, y: 1.21499 },
|
|
12
|
+
{ op: "C", cx1: 2.69184, cy1: 1.1221, cx2: 2.73825, cy2: 0.93022, x: 2.73825, y: 0.86039 },
|
|
13
|
+
{ op: "C", cx1: 2.73825, cy1: 0.48248, cx2: 2.4825, cy2: 0.33152, x: 1.7614, y: 0.23838 },
|
|
14
|
+
{ op: "L", x: 1.7614, y: 0.04641 },
|
|
15
|
+
{ op: "L", x: 4.88344, y: 0.04641 },
|
|
16
|
+
{ op: "C", cx1: 7.64477, cy1: 0.04641, cx2: 9.02278, cy2: 1.18018, x: 9.02278, y: 3.45323 },
|
|
17
|
+
{ op: "C", cx1: 9.02278, cy1: 4.47649, cx2: 8.74941, cy2: 5.36592, x: 8.20888, y: 6.11596 },
|
|
18
|
+
{ op: "C", cx1: 7.6681, cy1: 6.86578, cx2: 6.95303, cy2: 7.4297, x: 6.05765, y: 7.81334 },
|
|
19
|
+
{ op: "C", cx1: 5.16823, cy1: 8.19125, cx2: 4.22074, cy2: 8.38316, x: 3.21493, y: 8.38316 },
|
|
20
|
+
{ op: "L", x: 0, y: 8.38316 },
|
|
21
|
+
{ op: "L", x: 0, y: 8.19119 },
|
|
22
|
+
{ op: "C", cx1: 0.64542, cy1: 8.19126, cx2: 0.91275, cy2: 7.81343, x: 1.06974, y: 7.07521 },
|
|
23
|
+
{ op: "L", x: 1.06974, y: 7.0752 },
|
|
24
|
+
{ op: "Z" },
|
|
25
|
+
{ op: "M", x: 4.09864, y: 0.66867 },
|
|
26
|
+
{ op: "L", x: 2.2848, y: 7.35998 },
|
|
27
|
+
{ op: "C", cx1: 2.2848, cy1: 7.42409, cx2: 2.26718, cy2: 7.48786, x: 2.23815, y: 7.55197 },
|
|
28
|
+
{ op: "C", cx1: 2.29051, cy1: 7.84841, cx2: 2.58133, cy2: 7.99961, x: 3.12179, y: 7.99961 },
|
|
29
|
+
{ op: "C", cx1: 3.97639, cy1: 7.99961, cx2: 4.74389, cy2: 7.79034, x: 5.42397, y: 7.37165 },
|
|
30
|
+
{ op: "C", cx1: 6.10429, cy1: 6.94733, cx2: 6.62746, cy2: 6.37751, x: 7.00538, y: 5.65666 },
|
|
31
|
+
{ op: "C", cx1: 7.3833, cy1: 4.92994, cx2: 7.5752, cy2: 4.1334, x: 7.5752, y: 3.26134 },
|
|
32
|
+
{ op: "C", cx1: 7.5752, cy1: 1.372, cx2: 6.69156, cy2: 0.43029, x: 4.92984, y: 0.43029 },
|
|
33
|
+
{ op: "C", cx1: 4.53471, cy1: 0.43029, cx2: 4.25555, cy2: 0.51151, x: 4.09864, y: 0.66869 },
|
|
34
|
+
{ op: "L", x: 4.09864, y: 0.66867 },
|
|
35
|
+
{ op: "Z" },
|
|
36
|
+
{ op: "M", x: 18.35961, y: 0.04641 },
|
|
37
|
+
{ op: "L", x: 17.90593, y: 2.62204 },
|
|
38
|
+
{ op: "L", x: 17.66755, y: 2.62204 },
|
|
39
|
+
{ op: "C", cx1: 17.563, cy1: 1.19183, cx2: 16.91187, cy2: 0.47678, x: 15.71418, y: 0.47678 },
|
|
40
|
+
{ op: "C", cx1: 14.96437, cy1: 0.47678, cx2: 14.29564, cy2: 0.73848, x: 13.70274, y: 1.26165 },
|
|
41
|
+
{ op: "C", cx1: 13.11556, cy1: 1.77911, cx2: 12.65617, cy2: 2.43578, x: 12.33664, y: 3.22668 },
|
|
42
|
+
{ op: "C", cx1: 12.01679, cy1: 4.01155, cx2: 11.85988, cy2: 4.77302, x: 11.85988, y: 5.49984 },
|
|
43
|
+
{ op: "C", cx1: 11.85988, cy1: 6.26131, cx2: 12.03424, cy2: 6.90076, x: 12.37734, y: 7.41814 },
|
|
44
|
+
{ op: "C", cx1: 12.72598, cy1: 7.9356, cx2: 13.24931, cy2: 8.19126, x: 13.95279, y: 8.19126 },
|
|
45
|
+
{ op: "C", cx1: 15.08622, cy1: 8.19126, cx2: 16.11543, cy2: 7.68548, x: 17.02818, y: 6.66825 },
|
|
46
|
+
{ op: "L", x: 17.21412, y: 6.86023 },
|
|
47
|
+
{ op: "C", cx1: 16.26663, cy1: 8.16232, cx2: 15.08051, cy2: 8.81352, x: 13.66775, y: 8.81352 },
|
|
48
|
+
{ op: "C", cx1: 13.034, cy1: 8.81352, cx2: 12.47014, cy2: 8.65637, x: 11.97608, y: 8.34254 },
|
|
49
|
+
{ op: "C", cx1: 11.48195, cy1: 8.02864, cx2: 11.10411, cy2: 7.60432, x: 10.83074, y: 7.06925 },
|
|
50
|
+
{ op: "C", cx1: 10.56333, cy1: 6.53442, cx2: 10.42974, cy2: 5.94748, x: 10.42974, y: 5.31357 },
|
|
51
|
+
{ op: "C", cx1: 10.42974, cy1: 4.43581, cx2: 10.67383, cy2: 3.58692, x: 11.15655, y: 2.7616 },
|
|
52
|
+
{ op: "C", cx1: 11.63894, cy1: 1.93602, cx2: 12.28427, cy2: 1.26738, x: 13.09223, y: 0.76158 },
|
|
53
|
+
{ op: "C", cx1: 13.90042, cy1: 0.25578, cx2: 14.74336, cy2: 0.00003, x: 15.62137, y: 0.00003 },
|
|
54
|
+
{ op: "C", cx1: 15.88283, cy1: 0.00003, cx2: 16.12121, cy2: 0.0174, x: 16.33651, y: 0.0581 },
|
|
55
|
+
{ op: "C", cx1: 16.55157, cy1: 0.09886, cx2: 16.79557, cy2: 0.15122, x: 17.05729, y: 0.21501 },
|
|
56
|
+
{ op: "C", cx1: 17.31875, cy1: 0.2791, cx2: 17.51072, cy2: 0.31979, x: 17.62123, y: 0.33717 },
|
|
57
|
+
{ op: "C", cx1: 17.85961, cy1: 0.2557, cx2: 18.03389, cy2: 0.15694, x: 18.14432, y: 0.04643 },
|
|
58
|
+
{ op: "L", x: 18.35962, y: 0.04643 },
|
|
59
|
+
{ op: "L", x: 18.35961, y: 0.04644 },
|
|
60
|
+
{ op: "Z" },
|
|
61
|
+
{ op: "M", x: 8.19134, y: 7.69151 },
|
|
62
|
+
{ op: "C", cx1: 8.19134, cy1: 7.5169, cx2: 8.25544, cy2: 7.36596, x: 8.38894, y: 7.2322 },
|
|
63
|
+
{ op: "C", cx1: 8.52277, cy1: 7.09838, cx2: 8.69134, cy2: 7.0288, x: 8.88332, y: 7.0288 },
|
|
64
|
+
{ op: "C", cx1: 9.0519, cy1: 7.0288, cx2: 9.19722, cy2: 7.09838, x: 9.3251, y: 7.2322 },
|
|
65
|
+
{ op: "C", cx1: 9.45893, cy1: 7.36603, cx2: 9.5227, cy2: 7.52294, x: 9.5227, y: 7.69151 },
|
|
66
|
+
{ op: "C", cx1: 9.5227, cy1: 8.0925, cx2: 9.23221, cy2: 8.38324, x: 8.88332, y: 8.38324 },
|
|
67
|
+
{ op: "C", cx1: 8.48803, cy1: 8.38324, cx2: 8.19134, cy2: 8.10416, x: 8.19134, y: 7.69151 },
|
|
68
|
+
{ op: "Z" },
|
|
69
|
+
{ op: "M", x: 18.00469, y: 7.79028 },
|
|
70
|
+
{ op: "C", cx1: 18.00469, cy1: 7.40068, cx2: 18.27814, cy2: 7.12162, x: 18.64432, y: 7.12162 },
|
|
71
|
+
{ op: "C", cx1: 19.03969, cy1: 7.12162, cx2: 19.31298, cy2: 7.39507, x: 19.31298, y: 7.79028 },
|
|
72
|
+
{ op: "C", cx1: 19.31298, cy1: 8.15653, cx2: 19.0339, cy2: 8.42965, x: 18.64432, y: 8.42965 },
|
|
73
|
+
{ op: "C", cx1: 18.28972, cy1: 8.42965, cx2: 18.00469, cy2: 8.14486, x: 18.00469, y: 7.79028 },
|
|
74
|
+
{ op: "Z" },
|
|
75
|
+
],
|
|
76
|
+
style: { fill: "#000" },
|
|
77
|
+
},
|
|
78
|
+
],
|
|
79
|
+
// 只在第一次到达时回跳,第二次经过就正常收尾,所以整首曲子恰好演两遍
|
|
80
|
+
playbackMarks: () => [JUMP_MARK],
|
|
81
|
+
onVisit: (cursor, at) => cursor.visits(at) > 1 ? undefined : { kind: "jump", column: 0 },
|
|
82
|
+
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { SymbolDefinition } from "../index.js";
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const dsSymbol: SymbolDefinition;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { JUMP_MARK } from "./dc.js";
|
|
2
|
+
import { SEGNO_MARK } from "./segno.js";
|
|
3
|
+
export const dsSymbol = {
|
|
4
|
+
name: "ds",
|
|
5
|
+
description: "从记号处反复:跳回最近的 $segno",
|
|
6
|
+
weight: 0.9,
|
|
7
|
+
shapes: [
|
|
8
|
+
{
|
|
9
|
+
path: [
|
|
10
|
+
{ op: "M", x: 3.30971, y: 8.58253 },
|
|
11
|
+
{ op: "L", x: 0, y: 8.58253 },
|
|
12
|
+
{ op: "L", x: 0, y: 8.38492 },
|
|
13
|
+
{ op: "C", cx1: 0.66434, cy1: 8.38492, cx2: 0.93964, cy2: 7.9959, x: 1.10119, y: 7.23595 },
|
|
14
|
+
{ op: "L", x: 2.77112, y: 1.20293 },
|
|
15
|
+
{ op: "C", cx1: 2.77112, cy1: 1.10732, cx2: 2.81892, cy2: 0.90973, x: 2.81892, y: 0.83791 },
|
|
16
|
+
{ op: "C", cx1: 2.81892, cy1: 0.44886, cx2: 2.55564, cy2: 0.29345, x: 1.81333, y: 0.19758 },
|
|
17
|
+
{ op: "L", x: 1.81333, y: 0 },
|
|
18
|
+
{ op: "L", x: 5.02743, y: 0 },
|
|
19
|
+
{ op: "C", cx1: 7.87013, cy1: 0, cx2: 9.28879, cy2: 1.16713, x: 9.28879, y: 3.50729 },
|
|
20
|
+
{ op: "C", cx1: 9.28879, cy1: 4.56066, cx2: 9.00736, cy2: 5.47632, x: 8.45088, y: 6.24853 },
|
|
21
|
+
{ op: "C", cx1: 7.89416, cy1: 7.02049, cx2: 7.15799, cy2: 7.60099, x: 6.23624, y: 7.9959 },
|
|
22
|
+
{ op: "C", cx1: 5.32063, cy1: 8.38492, cx2: 4.34519, cy2: 8.58253, x: 3.3097, y: 8.58253 },
|
|
23
|
+
{ op: "L", x: 3.30971, y: 8.58253 },
|
|
24
|
+
{ op: "Z" },
|
|
25
|
+
{ op: "M", x: 4.21944, y: 0.64057 },
|
|
26
|
+
{ op: "L", x: 2.35218, y: 7.52917 },
|
|
27
|
+
{ op: "C", cx1: 2.35218, cy1: 7.59509, cx2: 2.33403, cy2: 7.66079, x: 2.30413, y: 7.72673 },
|
|
28
|
+
{ op: "C", cx1: 2.35806, cy1: 8.03196, cx2: 2.65738, cy2: 8.18763, x: 3.21387, y: 8.18763 },
|
|
29
|
+
{ op: "C", cx1: 4.71023, cy1: 8.18763, cx2: 5.84745, cy2: 7.75053, x: 6.6253, y: 6.88271 },
|
|
30
|
+
{ op: "C", cx1: 7.40952, cy1: 6.00899, cx2: 7.79857, cy2: 4.81807, x: 7.79857, y: 3.30973 },
|
|
31
|
+
{ op: "C", cx1: 7.79857, cy1: 1.36475, cx2: 6.88883, cy2: 0.39519, x: 5.07525, y: 0.39519 },
|
|
32
|
+
{ op: "C", cx1: 4.66831, cy1: 0.39517, cx2: 4.38101, cy2: 0.47876, x: 4.21945, y: 0.64056 },
|
|
33
|
+
{ op: "L", x: 4.21944, y: 0.64056 },
|
|
34
|
+
{ op: "Z" },
|
|
35
|
+
{ op: "M", x: 17.3325, y: 0.00001 },
|
|
36
|
+
{ op: "L", x: 16.81794, y: 2.54976 },
|
|
37
|
+
{ op: "L", x: 16.57254, y: 2.54976 },
|
|
38
|
+
{ op: "C", cx1: 16.57254, cy1: 1.14312, cx2: 16.03984, cy2: 0.44299, x: 14.98033, y: 0.44299 },
|
|
39
|
+
{ op: "C", cx1: 14.57337, cy1: 0.44299, cx2: 14.24416, cy2: 0.56262, x: 13.98698, y: 0.80212 },
|
|
40
|
+
{ op: "C", cx1: 13.72958, cy1: 1.04139, cx2: 13.60383, cy2: 1.35272, x: 13.60383, y: 1.74176 },
|
|
41
|
+
{ op: "C", cx1: 13.60383, cy1: 2.10677, cx2: 13.70556, cy2: 2.424, x: 13.91516, y: 2.70518 },
|
|
42
|
+
{ op: "C", cx1: 14.12452, cy1: 2.98048, cx2: 14.45375, cy2: 3.34575, x: 14.91464, y: 3.7946 },
|
|
43
|
+
{ op: "C", cx1: 15.37551, cy1: 4.24346, cx2: 15.72261, cy2: 4.65626, x: 15.9619, y: 5.03332 },
|
|
44
|
+
{ op: "C", cx1: 16.20729, cy1: 5.40444, cx2: 16.32715, cy2: 5.83541, x: 16.32715, y: 6.32621 },
|
|
45
|
+
{ op: "C", cx1: 16.35708, cy1: 7.82844, cx2: 15.01635, cy2: 8.89386, x: 13.70558, y: 8.87572 },
|
|
46
|
+
{ op: "C", cx1: 13.47219, cy1: 8.87572, cx2: 13.12508, cy2: 8.79188, x: 12.65219, y: 8.63033 },
|
|
47
|
+
{ op: "C", cx1: 12.17955, cy1: 8.46874, cx2: 11.86231, cy2: 8.38489, x: 11.69463, y: 8.38489 },
|
|
48
|
+
{ op: "C", cx1: 11.45538, cy1: 8.38489, cx2: 11.25778, cy2: 8.60652, x: 11.20385, y: 8.82787 },
|
|
49
|
+
{ op: "L", x: 10.95848, y: 8.82787 },
|
|
50
|
+
{ op: "L", x: 11.40145, y: 6.00895 },
|
|
51
|
+
{ op: "L", x: 11.69464, y: 6.00895 },
|
|
52
|
+
{ op: "C", cx1: 11.69464, cy1: 6.12272, cx2: 11.67678, cy2: 6.24847, x: 11.64684, y: 6.374 },
|
|
53
|
+
{ op: "C", cx1: 11.67065, cy1: 6.93075, cx2: 11.85619, cy2: 7.40948, x: 12.20332, y: 7.82232 },
|
|
54
|
+
{ op: "C", cx1: 12.55657, cy1: 8.22948, cx2: 13.00544, cy2: 8.43297, x: 13.55603, y: 8.43297 },
|
|
55
|
+
{ op: "C", cx1: 14.02891, cy1: 8.43297, cx2: 14.42384, cy2: 8.26529, x: 14.74108, y: 7.92405 },
|
|
56
|
+
{ op: "C", cx1: 15.06418, cy1: 7.58305, cx2: 15.22573, cy2: 7.18198, x: 15.22573, y: 6.72112 },
|
|
57
|
+
{ op: "C", cx1: 15.22573, cy1: 6.34406, cx2: 15.11223, cy2: 6.00313, x: 14.89062, y: 5.69764 },
|
|
58
|
+
{ op: "C", cx1: 14.66925, cy1: 5.39246, cx2: 14.32802, cy2: 5.00951, x: 13.85538, y: 4.54279 },
|
|
59
|
+
{ op: "C", cx1: 13.38247, cy1: 4.07579, cx2: 13.03535, cy2: 3.67473, x: 12.80197, y: 3.33374 },
|
|
60
|
+
{ op: "C", cx1: 12.56858, cy1: 2.99248, cx2: 12.45484, cy2: 2.59756, x: 12.45484, y: 2.16072 },
|
|
61
|
+
{ op: "C", cx1: 12.45484, cy1: 1.53216, cx2: 12.67621, cy2: 1.01761, x: 13.12509, y: 0.61042 },
|
|
62
|
+
{ op: "C", cx1: 13.57395, cy1: 0.20348, cx2: 14.11864, cy2: 0.00002, x: 14.75896, y: 0.00002 },
|
|
63
|
+
{ op: "C", cx1: 15.18993, cy1: 0.00002, cx2: 15.55495, cy2: 0.05983, x: 15.86016, y: 0.17358 },
|
|
64
|
+
{ op: "C", cx1: 16.16536, cy1: 0.28733, cx2: 16.38697, cy2: 0.34714, x: 16.52452, y: 0.34714 },
|
|
65
|
+
{ op: "C", cx1: 16.6922, cy1: 0.34714, cx2: 16.86576, cy2: 0.23339, x: 17.03932, y: 0.00002 },
|
|
66
|
+
{ op: "L", x: 17.33249, y: 0.00002 },
|
|
67
|
+
{ op: "L", x: 17.3325, y: 0.00001 },
|
|
68
|
+
{ op: "Z" },
|
|
69
|
+
{ op: "M", x: 8.43275, y: 7.87042 },
|
|
70
|
+
{ op: "C", cx1: 8.43275, cy1: 7.69072, cx2: 8.4987, cy2: 7.5353, x: 8.63622, y: 7.3975 },
|
|
71
|
+
{ op: "C", cx1: 8.774, cy1: 7.25976, cx2: 8.94755, cy2: 7.18816, x: 9.14514, y: 7.18816 },
|
|
72
|
+
{ op: "C", cx1: 9.3187, cy1: 7.18816, cx2: 9.46824, cy2: 7.25975, x: 9.59988, y: 7.3975 },
|
|
73
|
+
{ op: "C", cx1: 9.73766, cy1: 7.53529, cx2: 9.80338, cy2: 7.69685, x: 9.80338, y: 7.87042 },
|
|
74
|
+
{ op: "C", cx1: 9.80338, cy1: 8.28325, cx2: 9.5043, cy2: 8.58254, x: 9.14514, y: 8.58254 },
|
|
75
|
+
{ op: "C", cx1: 8.7382, cy1: 8.58254, cx2: 8.43275, cy2: 8.29521, x: 8.43275, y: 7.87042 },
|
|
76
|
+
{ op: "Z" },
|
|
77
|
+
{ op: "M", x: 16.88952, y: 7.9721 },
|
|
78
|
+
{ op: "C", cx1: 16.88952, cy1: 7.57106, cx2: 17.21875, cy2: 7.28373, x: 17.62569, y: 7.28373 },
|
|
79
|
+
{ op: "C", cx1: 18.00297, cy1: 7.28373, cx2: 18.29003, cy2: 7.56516, x: 18.29003, y: 7.9721 },
|
|
80
|
+
{ op: "C", cx1: 18.29003, cy1: 8.34914, cx2: 17.99096, cy2: 8.63036, x: 17.62569, y: 8.63036 },
|
|
81
|
+
{ op: "C", cx1: 17.42219, cy1: 8.63036, cx2: 17.24863, cy2: 8.56461, x: 17.105, y: 8.43887 },
|
|
82
|
+
{ op: "C", cx1: 16.96135, cy1: 8.31309, cx2: 16.88952, cy2: 8.1577, x: 16.88952, y: 7.9721 },
|
|
83
|
+
{ op: "Z" },
|
|
84
|
+
],
|
|
85
|
+
style: { fill: "#000" },
|
|
86
|
+
},
|
|
87
|
+
],
|
|
88
|
+
// 只在第一次到达时回跳;没有 $segno 时退回曲首,与 D.C. 一致
|
|
89
|
+
playbackMarks: () => [JUMP_MARK],
|
|
90
|
+
onVisit: (cursor, at) => cursor.visits(at) > 1
|
|
91
|
+
? undefined
|
|
92
|
+
: { kind: "jump", column: cursor.seek(SEGNO_MARK, at, -1) ?? 0 },
|
|
93
|
+
};
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 力度记号族:八个记号由 m / f / p 三个字母横向拼接而成
|
|
3
|
+
*
|
|
4
|
+
* 三个字母抠自同一套字体的 mp / mf 连字,坐标同属一套字体坐标系(共基线、同字号),
|
|
5
|
+
* 所以拼接只需要横向位移,字距也是从连字上量出来的。
|
|
6
|
+
*/
|
|
7
|
+
const GLYPHS = {
|
|
8
|
+
m: [
|
|
9
|
+
{ op: "M", x: 1.13, y: 10.3672 },
|
|
10
|
+
{ op: "L", x: 2.9911, y: 5.3125 },
|
|
11
|
+
{ op: "C", cx1: 3.0585, cy1: 5.0607, cx2: 3.0955, cy2: 4.8889, x: 3.0955, y: 4.8089 },
|
|
12
|
+
{ op: "C", cx1: 3.0955, cy1: 4.6248, cx2: 2.9972, cy2: 4.5327, x: 2.7944, y: 4.5327 },
|
|
13
|
+
{ op: "C", cx1: 2.5489, cy1: 4.5327, cx2: 2.217, cy2: 4.7782, x: 1.7994, y: 5.2758 },
|
|
14
|
+
{ op: "C", cx1: 1.3881, cy1: 5.7671, cx2: 0.9766, cy2: 6.4856, x: 0.5774, y: 7.4254 },
|
|
15
|
+
{ op: "L", x: 0, y: 7.4254 },
|
|
16
|
+
{ op: "C", cx1: 0.4976, cy1: 6.3628, cx2: 1.0133, cy2: 5.4783, x: 1.5476, y: 4.7782 },
|
|
17
|
+
{ op: "C", cx1: 2.0882, cy1: 4.0781, cx2: 2.7576, cy2: 3.7279, x: 3.5498, y: 3.7279 },
|
|
18
|
+
{ op: "C", cx1: 4.1518, cy1: 3.7279, cx2: 4.4773, cy2: 4.0534, x: 4.5264, y: 4.7045 },
|
|
19
|
+
{ op: "C", cx1: 5.2818, cy1: 4.0167, cx2: 5.9512, cy2: 3.6728, x: 6.5409, y: 3.6728 },
|
|
20
|
+
{ op: "C", cx1: 7.1796, cy1: 3.6728, cx2: 7.5235, cy2: 4.0167, x: 7.5728, y: 4.7045 },
|
|
21
|
+
{ op: "C", cx1: 7.8797, cy1: 4.3976, cx2: 8.2483, cy2: 4.1518, x: 8.6843, y: 3.9614 },
|
|
22
|
+
{ op: "C", cx1: 9.1205, cy1: 3.7709, cx2: 9.5197, cy2: 3.6728, x: 9.8882, y: 3.6728 },
|
|
23
|
+
{ op: "C", cx1: 10.5393, cy1: 3.6728, cx2: 10.8645, cy2: 3.943, x: 10.8645, y: 4.4834 },
|
|
24
|
+
{ op: "C", cx1: 10.8645, cy1: 4.6001, cx2: 10.8339, cy2: 4.7905, x: 10.7664, y: 5.0607 },
|
|
25
|
+
{ op: "L", x: 9.3846, y: 9.0345 },
|
|
26
|
+
{ op: "C", cx1: 9.3109, cy1: 9.3353, cx2: 9.2616, cy2: 9.4951, x: 9.2309, y: 9.6364 },
|
|
27
|
+
{ op: "C", cx1: 9.2309, cy1: 9.7959, cx2: 9.3169, cy2: 9.9066, x: 9.4827, y: 9.9619 },
|
|
28
|
+
{ op: "C", cx1: 10.011, cy1: 9.8943, cx2: 10.6988, cy2: 9.1512, x: 11.5463, y: 7.7263 },
|
|
29
|
+
{ op: "L", x: 12.0499, y: 7.7263 },
|
|
30
|
+
{ op: "C", cx1: 11.7981, cy1: 8.1502, cx2: 11.5279, cy2: 8.6045, x: 11.227, y: 9.0958 },
|
|
31
|
+
{ op: "C", cx1: 10.9322, cy1: 9.5811, cx2: 10.6006, cy2: 9.9864, x: 10.2381, y: 10.2996 },
|
|
32
|
+
{ op: "C", cx1: 9.8759, cy1: 10.613, cx2: 9.4583, cy2: 10.7725, x: 8.9791, y: 10.7725 },
|
|
33
|
+
{ op: "C", cx1: 8.1499, cy1: 10.7725, cx2: 7.6279, cy2: 10.3919, x: 7.4191, y: 9.6365 },
|
|
34
|
+
{ op: "C", cx1: 7.4437, cy1: 9.397, cx2: 7.5235, cy2: 9.0775, x: 7.6649, y: 8.6783 },
|
|
35
|
+
{ op: "C", cx1: 7.806, cy1: 8.279, cx2: 7.8797, cy2: 8.0395, x: 7.8981, y: 7.9535 },
|
|
36
|
+
{ op: "L", x: 8.9054, y: 5.3619 },
|
|
37
|
+
{ op: "C", cx1: 8.924, cy1: 5.2572, cx2: 8.9791, cy2: 5.0117, x: 8.9791, y: 4.9073 },
|
|
38
|
+
{ op: "C", cx1: 8.9791, cy1: 4.6922, cx2: 8.887, cy2: 4.5818, x: 8.7028, y: 4.5818 },
|
|
39
|
+
{ op: "C", cx1: 8.1992, cy1: 4.5818, cx2: 7.8246, cy2: 4.9257, x: 7.5728, y: 5.6137 },
|
|
40
|
+
{ op: "L", x: 5.8838, y: 10.3673 },
|
|
41
|
+
{ op: "L", x: 4.0781, y: 10.3673 },
|
|
42
|
+
{ op: "L", x: 5.9389, y: 5.2635 },
|
|
43
|
+
{ op: "C", cx1: 5.9696, cy1: 5.1591, cx2: 5.9882, cy2: 5.0424, x: 5.9882, y: 4.9073 },
|
|
44
|
+
{ op: "C", cx1: 5.9882, cy1: 4.6922, cx2: 5.8592, cy2: 4.5818, x: 5.6073, y: 4.5818 },
|
|
45
|
+
{ op: "C", cx1: 5.159, cy1: 4.6002, cx2: 4.8335, cy2: 4.944, x: 4.6308, y: 5.6137 },
|
|
46
|
+
{ op: "L", x: 2.8927, y: 10.3673 },
|
|
47
|
+
{ op: "L", x: 1.13, y: 10.3673 },
|
|
48
|
+
{ op: "L", x: 1.13, y: 10.3672 },
|
|
49
|
+
{ op: "Z" },
|
|
50
|
+
],
|
|
51
|
+
f: [
|
|
52
|
+
{ op: "M", x: 6.1601, y: 4.0781 },
|
|
53
|
+
{ op: "C", cx1: 6.4302, cy1: 3.3717, cx2: 6.8234, cy2: 2.7086, x: 7.3391, y: 2.0882 },
|
|
54
|
+
{ op: "C", cx1: 7.8551, cy1: 1.4679, cx2: 8.4754, cy2: 0.9642, x: 9.2062, y: 0.5773 },
|
|
55
|
+
{ op: "C", cx1: 9.937, cy1: 0.1904, cx2: 10.7355, cy2: 0, x: 11.5953, y: 0 },
|
|
56
|
+
{ op: "C", cx1: 12.0559, cy1: 0.043, cx2: 12.4061, cy2: 0.2088, x: 12.6333, y: 0.4913 },
|
|
57
|
+
{ op: "C", cx1: 12.8607, cy1: 0.7678, cx2: 12.9772, cy2: 1.1117, x: 12.9772, y: 1.5109 },
|
|
58
|
+
{ op: "C", cx1: 12.9772, cy1: 1.9345, cx2: 12.8421, cy2: 2.3154, x: 12.5659, y: 2.6472 },
|
|
59
|
+
{ op: "C", cx1: 12.2954, cy1: 2.9788, cx2: 11.9578, cy2: 3.1446, x: 11.5463, y: 3.1446 },
|
|
60
|
+
{ op: "C", cx1: 11.0487, cy1: 3.1446, cx2: 10.7662, cy2: 2.9174, x: 10.7111, y: 2.4691 },
|
|
61
|
+
{ op: "C", cx1: 10.7418, cy1: 2.1743, cx2: 10.8522, cy2: 1.8918, x: 11.0427, y: 1.6276 },
|
|
62
|
+
{ op: "C", cx1: 11.2331, cy1: 1.3635, cx2: 11.4666, cy2: 1.1793, x: 11.7428, y: 1.087 },
|
|
63
|
+
{ op: "C", cx1: 11.8472, cy1: 1.087, cx2: 11.8965, cy2: 1.0379, x: 11.8965, y: 0.9335 },
|
|
64
|
+
{ op: "C", cx1: 11.8965, cy1: 0.8108, cx2: 11.614, cy2: 0.6327, x: 11.2147, y: 0.6327 },
|
|
65
|
+
{ op: "C", cx1: 10.0908, cy1: 0.6327, cx2: 9.237, cy2: 1.7811, x: 8.6535, y: 4.0781 },
|
|
66
|
+
{ op: "L", x: 10.8646, y: 4.0781 },
|
|
67
|
+
{ op: "L", x: 10.8646, y: 4.9073 },
|
|
68
|
+
{ op: "L", x: 8.4508, y: 4.9073 },
|
|
69
|
+
{ op: "C", cx1: 8.2483, cy1: 5.7918, cx2: 7.9902, cy2: 6.6944, x: 7.671, y: 7.6156 },
|
|
70
|
+
{ op: "C", cx1: 7.3577, cy1: 8.5308, cx2: 7.026, cy2: 9.3723, x: 6.676, y: 10.1401 },
|
|
71
|
+
{ op: "C", cx1: 6.3319, cy1: 10.9076, cx2: 6.0064, cy2: 11.5156, x: 5.7055, y: 11.9762 },
|
|
72
|
+
{ op: "C", cx1: 5.2632, cy1: 12.658, cx2: 4.7966, cy2: 13.2353, x: 4.299, y: 13.7145 },
|
|
73
|
+
{ op: "C", cx1: 3.8016, cy1: 14.1995, cx2: 3.206, cy2: 14.5067, x: 2.5119, y: 14.6418 },
|
|
74
|
+
{ op: "C", cx1: 2.211, cy1: 14.6788, cx2: 2.0266, cy2: 14.6972, x: 1.9592, y: 14.6972 },
|
|
75
|
+
{ op: "C", cx1: 1.3632, cy1: 14.6972, cx2: 0.8905, cy2: 14.5128, x: 0.5527, y: 14.1382 },
|
|
76
|
+
{ op: "C", cx1: 0.2149, cy1: 13.7636, cx2: 0.0307, cy2: 13.3276, x: 0, y: 12.83 },
|
|
77
|
+
{ op: "C", cx1: 0.0428, cy1: 12.3941, cx2: 0.1718, cy2: 12.0623, x: 0.3869, y: 11.8351 },
|
|
78
|
+
{ op: "C", cx1: 0.6017, cy1: 11.6079, cx2: 0.9149, cy2: 11.4298, x: 1.3326, y: 11.3008 },
|
|
79
|
+
{ op: "C", cx1: 1.6458, cy1: 11.3254, cx2: 1.9039, cy2: 11.4359, x: 2.1066, y: 11.6324 },
|
|
80
|
+
{ op: "C", cx1: 2.3091, cy1: 11.8352, cx2: 2.4135, cy2: 12.0809, x: 2.4135, y: 12.3818 },
|
|
81
|
+
{ op: "C", cx1: 2.4135, cy1: 12.9405, cx2: 1.8548, cy2: 13.4134, x: 1.4309, y: 13.8127 },
|
|
82
|
+
{ op: "C", cx1: 1.4309, cy1: 13.9171, cx2: 1.5476, cy2: 13.9664, x: 1.7811, y: 13.9664 },
|
|
83
|
+
{ op: "C", cx1: 2.7453, cy1: 13.9664, cx2: 3.5129, cy2: 12.9405, x: 4.0718, y: 10.8955 },
|
|
84
|
+
{ op: "C", cx1: 4.2683, cy1: 10.3426, cx2: 4.4404, cy2: 9.8083, x: 4.5938, y: 9.2926 },
|
|
85
|
+
{ op: "C", cx1: 4.7475, cy1: 8.7703, cx2: 4.9624, cy2: 8.0028, x: 5.2449, y: 6.9832 },
|
|
86
|
+
{ op: "C", cx1: 5.5337, cy1: 5.9575, cx2: 5.7362, cy2: 5.2695, x: 5.8592, y: 4.9073 },
|
|
87
|
+
{ op: "L", x: 4.1702, y: 4.9073 },
|
|
88
|
+
{ op: "L", x: 4.1702, y: 4.0781 },
|
|
89
|
+
{ op: "L", x: 6.1601, y: 4.0781 },
|
|
90
|
+
{ op: "Z" },
|
|
91
|
+
],
|
|
92
|
+
p: [
|
|
93
|
+
{ op: "M", x: 3.767, y: 8.5573 },
|
|
94
|
+
{ op: "L", x: 5.0097, y: 5.0738 },
|
|
95
|
+
{ op: "C", cx1: 5.0804, cy1: 4.7969, cx2: 5.1126, cy2: 4.5909, x: 5.1126, y: 4.443 },
|
|
96
|
+
{ op: "C", cx1: 5.1126, cy1: 4.2497, cx2: 5.0224, cy2: 4.1531, x: 4.8486, y: 4.1531 },
|
|
97
|
+
{ op: "C", cx1: 4.7262, cy1: 4.1531, cx2: 4.5653, cy2: 4.2497, x: 4.3786, y: 4.443 },
|
|
98
|
+
{ op: "C", cx1: 3.9471, cy1: 4.9001, cx2: 3.6059, cy2: 5.383, x: 3.3484, y: 5.8917 },
|
|
99
|
+
{ op: "L", x: 2.6851, y: 5.8917 },
|
|
100
|
+
{ op: "C", cx1: 2.8138, cy1: 5.5117, cx2: 3.0264, cy2: 5.1126, x: 3.3163, y: 4.7004 },
|
|
101
|
+
{ op: "C", cx1: 3.6059, cy1: 4.2818, cx2: 3.9471, cy2: 3.9406, x: 4.3335, y: 3.6702 },
|
|
102
|
+
{ op: "C", cx1: 4.7262, cy1: 3.3933, cx2: 5.1192, cy2: 3.258, x: 5.5119, y: 3.258 },
|
|
103
|
+
{ op: "C", cx1: 6.1623, cy1: 3.258, cx2: 6.613, cy2: 3.5671, x: 6.8575, y: 4.179 },
|
|
104
|
+
{ op: "C", cx1: 7.1987, cy1: 3.8891, cx2: 7.6044, cy2: 3.6444, x: 8.0617, y: 3.4447 },
|
|
105
|
+
{ op: "C", cx1: 8.5188, cy1: 3.2454, cx2: 8.9632, cy2: 3.1486, x: 9.388, y: 3.1486 },
|
|
106
|
+
{ op: "C", cx1: 10.1286, cy1: 3.1486, cx2: 10.7017, cy2: 3.4447, x: 11.1008, y: 4.0437 },
|
|
107
|
+
{ op: "C", cx1: 11.5064, cy1: 4.636, cx2: 11.706, cy2: 5.3249, x: 11.706, y: 6.104 },
|
|
108
|
+
{ op: "C", cx1: 11.706, cy1: 6.8187, cx2: 11.5322, cy2: 7.5464, x: 11.178, y: 8.274 },
|
|
109
|
+
{ op: "C", cx1: 10.8304, cy1: 9.0017, cx2: 10.3538, cy2: 9.6004, x: 9.7422, y: 10.0704 },
|
|
110
|
+
{ op: "C", cx1: 9.1306, cy1: 10.5406, cx2: 8.4607, cy2: 10.7724, x: 7.7267, y: 10.7724 },
|
|
111
|
+
{ op: "C", cx1: 7.0442, cy1: 10.7724, cx2: 6.4133, cy2: 10.5148, x: 5.8273, y: 10.006 },
|
|
112
|
+
{ op: "L", x: 4.7972, y: 12.9614 },
|
|
113
|
+
{ op: "C", cx1: 4.765, cy1: 13.0453, cx2: 4.7133, cy2: 13.1998, x: 4.6426, y: 13.4122 },
|
|
114
|
+
{ op: "C", cx1: 4.6684, cy1: 13.6377, cx2: 4.7842, cy2: 13.7922, x: 4.9902, y: 13.8695 },
|
|
115
|
+
{ op: "C", cx1: 5.2028, cy1: 13.9531, cx2: 5.5504, cy2: 13.9919, x: 6.0399, y: 13.9919 },
|
|
116
|
+
{ op: "L", x: 6.0399, y: 14.8095 },
|
|
117
|
+
{ op: "L", x: 0, y: 14.8095 },
|
|
118
|
+
{ op: "L", x: 0, y: 13.9919 },
|
|
119
|
+
{ op: "C", cx1: 0.7469, cy1: 13.9919, cx2: 1.2815, cy2: 13.8759, x: 1.5969, y: 13.6506 },
|
|
120
|
+
{ op: "C", cx1: 1.9124, cy1: 13.4251, cx2: 2.1379, cy2: 13.1289, x: 2.2666, y: 12.7491 },
|
|
121
|
+
{ op: "L", x: 3.767, y: 8.5573 },
|
|
122
|
+
{ op: "Z" },
|
|
123
|
+
{ op: "M", x: 7.0637, y: 6.3166 },
|
|
124
|
+
{ op: "C", cx1: 6.7802, cy1: 6.9604, cx2: 6.6064, cy2: 7.8104, x: 6.5357, y: 8.8727 },
|
|
125
|
+
{ op: "C", cx1: 6.6064, cy1: 9.5619, cx2: 6.7609, cy2: 9.9031, x: 7.012, y: 9.9031 },
|
|
126
|
+
{ op: "C", cx1: 7.8879, cy1: 9.7356, cx2: 8.609, cy2: 8.7248, x: 9.1755, y: 6.8704 },
|
|
127
|
+
{ op: "C", cx1: 9.3495, cy1: 6.2071, cx2: 9.4395, cy2: 5.6084, x: 9.4395, y: 5.0738 },
|
|
128
|
+
{ op: "C", cx1: 9.4395, cy1: 4.4108, cx2: 9.2657, cy2: 4.05, x: 8.9115, y: 3.9923 },
|
|
129
|
+
{ op: "C", cx1: 8.332, cy1: 3.9923, cx2: 7.7139, cy2: 4.7647, x: 7.0637, y: 6.3166 },
|
|
130
|
+
{ op: "Z" },
|
|
131
|
+
],
|
|
132
|
+
};
|
|
133
|
+
/** 相邻字母墨迹左边界之间的距离;斜体字母互相交错,所以比前一个字母窄 */
|
|
134
|
+
const ADVANCE = {
|
|
135
|
+
mf: 8.0028,
|
|
136
|
+
mp: 9.523,
|
|
137
|
+
ff: 6.67866,
|
|
138
|
+
pp: 8.8083, // 没有 pp 连字可量,沿用 m 与 p 的墨迹重叠量
|
|
139
|
+
};
|
|
140
|
+
const INK = { fill: "#000" };
|
|
141
|
+
/** size 是 f 的全高;p 系没有升部、盒子只有 f 的这么高,不按此缩小就会被放大 1.26 倍 */
|
|
142
|
+
const P_WEIGHT = 0.79341;
|
|
143
|
+
function dynamic(name, velocity, description) {
|
|
144
|
+
let dx = 0;
|
|
145
|
+
const shapes = Array.from(name, (letter, index) => {
|
|
146
|
+
const shape = { path: GLYPHS[letter], style: INK, dx };
|
|
147
|
+
dx += ADVANCE[letter + name[index + 1]] ?? 0;
|
|
148
|
+
return shape;
|
|
149
|
+
});
|
|
150
|
+
return {
|
|
151
|
+
name,
|
|
152
|
+
description,
|
|
153
|
+
shapes,
|
|
154
|
+
weight: name.includes("f") ? 1 : P_WEIGHT,
|
|
155
|
+
onTimeState: state => { state.velocity = velocity; },
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
/** 力度阶梯是 16 的整数倍,末级钳到 127;mf 恰好等于 DEFAULT_VELOCITY */
|
|
159
|
+
export const dynamicSymbols = [
|
|
160
|
+
dynamic("ppp", 16, "极弱"),
|
|
161
|
+
dynamic("pp", 32, "很弱"),
|
|
162
|
+
dynamic("p", 48, "弱"),
|
|
163
|
+
dynamic("mp", 64, "中弱"),
|
|
164
|
+
dynamic("mf", 80, "中强"),
|
|
165
|
+
dynamic("f", 96, "强"),
|
|
166
|
+
dynamic("ff", 112, "很强"),
|
|
167
|
+
dynamic("fff", 127, "极强"),
|
|
168
|
+
];
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { SymbolDefinition } from "../index.js";
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const fineSymbol: SymbolDefinition;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { JUMP_MARK } from "./dc.js";
|
|
2
|
+
export const fineSymbol = {
|
|
3
|
+
name: "fine",
|
|
4
|
+
description: "终止记号:回跳之后经过这里就结束乐曲",
|
|
5
|
+
weight: 1.4,
|
|
6
|
+
text: { content: "Fine.", fontFamily: '"Times New Roman", serif' },
|
|
7
|
+
// 判据是回跳已经发生,不是“第二次经过”;否则写在 |: :| 里会被反复线提前触发
|
|
8
|
+
onVisit: (cursor, at) => {
|
|
9
|
+
const jump = cursor.seek(JUMP_MARK, at, 1);
|
|
10
|
+
return jump !== undefined && cursor.visits(jump) > 0 ? { kind: "stop" } : undefined;
|
|
11
|
+
},
|
|
12
|
+
};
|