UNPKG

@stringsync/vexml

Version:

MusicXML to Vexflow

35 lines (34 loc) 1.16 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Annotation = void 0; const textstatemachine_1 = require("./textstatemachine"); class Annotation { config; log; text; horizontalJustification; verticalJustification; constructor(config, log, text, horizontalJustification, verticalJustification) { this.config = config; this.log = log; this.text = text; this.horizontalJustification = horizontalJustification; this.verticalJustification = verticalJustification; } static fromLyric(config, log, musicXML) { const machine = new textstatemachine_1.TextStateMachine(); for (const component of musicXML.lyric.getComponents()) { machine.process(component); } return new Annotation(config, log, machine.getText(), 'center', 'bottom'); } parse() { return { type: 'annotation', text: this.text, horizontalJustification: this.horizontalJustification, verticalJustification: this.verticalJustification, }; } } exports.Annotation = Annotation;