|
@@ -16,6 +16,7 @@ import {PlacementEnum} from "../../VoiceData/Expressions/AbstractExpression";
|
|
|
import {TextAlignmentEnum} from "../../../Common/Enums/TextAlignment";
|
|
|
import {ITextTranslation} from "../../Interfaces/ITextTranslation";
|
|
|
import log from "loglevel";
|
|
|
+import { FontStyles } from "../../../Common/Enums/FontStyles";
|
|
|
|
|
|
export class ExpressionReader {
|
|
|
private musicSheet: MusicSheet;
|
|
@@ -350,6 +351,14 @@ export class ExpressionReader {
|
|
|
}
|
|
|
private interpretWords(wordsNode: IXmlElement, currentMeasure: SourceMeasure, inSourceMeasureCurrentFraction: Fraction): void {
|
|
|
const text: string = wordsNode.value;
|
|
|
+ let fontStyle: FontStyles;
|
|
|
+ const fontStyleAttr: Attr = wordsNode.attribute("font-style");
|
|
|
+ if (fontStyleAttr) {
|
|
|
+ const fontStyleText: string = fontStyleAttr.value;
|
|
|
+ if (fontStyleText === "italic") {
|
|
|
+ fontStyle = FontStyles.Italic;
|
|
|
+ }
|
|
|
+ }
|
|
|
if (text.length > 0) {
|
|
|
if (wordsNode.hasAttributes && wordsNode.attribute("default-x")) {
|
|
|
this.directionTimestamp = Fraction.createFromFraction(inSourceMeasureCurrentFraction);
|
|
@@ -357,7 +366,7 @@ export class ExpressionReader {
|
|
|
if (this.checkIfWordsNodeIsRepetitionInstruction(text)) {
|
|
|
return;
|
|
|
}
|
|
|
- this.fillMultiOrTempoExpression(text, currentMeasure);
|
|
|
+ this.fillMultiOrTempoExpression(text, currentMeasure, fontStyle);
|
|
|
this.initialize();
|
|
|
}
|
|
|
}
|
|
@@ -423,7 +432,7 @@ export class ExpressionReader {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- private fillMultiOrTempoExpression(inputString: string, currentMeasure: SourceMeasure): void {
|
|
|
+ private fillMultiOrTempoExpression(inputString: string, currentMeasure: SourceMeasure, fontStyle: FontStyles): void {
|
|
|
if (!inputString) {
|
|
|
return;
|
|
|
}
|
|
@@ -432,7 +441,7 @@ export class ExpressionReader {
|
|
|
//const splitStrings: string[] = tmpInputString.split(/([\s,\r\n]and[\s,\r\n]|[\s,\r\n]und[\s,\r\n]|[\s,\r\n]e[\s,\r\n]|[\s,\r\n])+/g);
|
|
|
|
|
|
//for (const splitStr of splitStrings) {
|
|
|
- this.createExpressionFromString("", tmpInputString, currentMeasure, inputString);
|
|
|
+ this.createExpressionFromString("", tmpInputString, currentMeasure, inputString, fontStyle);
|
|
|
//}
|
|
|
}
|
|
|
/*
|
|
@@ -464,7 +473,8 @@ export class ExpressionReader {
|
|
|
}
|
|
|
*/
|
|
|
private createExpressionFromString(prefix: string, stringTrimmed: string,
|
|
|
- currentMeasure: SourceMeasure, inputString: string): boolean {
|
|
|
+ currentMeasure: SourceMeasure, inputString: string,
|
|
|
+ fontStyle: FontStyles): boolean {
|
|
|
if (InstantaneousTempoExpression.isInputStringInstantaneousTempo(stringTrimmed) ||
|
|
|
ContinuousTempoExpression.isInputStringContinuousTempo(stringTrimmed)) {
|
|
|
// first check if there is already a tempo expression with the same function
|
|
@@ -478,7 +488,7 @@ export class ExpressionReader {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- this.createNewTempoExpressionIfNeeded(currentMeasure);
|
|
|
+ this.createNewTempoExpressionIfNeeded(currentMeasure); // TODO process fontStyle? (also for other expressions)
|
|
|
this.currentMultiTempoExpression.CombinedExpressionsText = inputString;
|
|
|
if (InstantaneousTempoExpression.isInputStringInstantaneousTempo(stringTrimmed)) {
|
|
|
const instantaneousTempoExpression: InstantaneousTempoExpression = new InstantaneousTempoExpression( stringTrimmed,
|
|
@@ -539,6 +549,7 @@ export class ExpressionReader {
|
|
|
this.createNewMultiExpressionIfNeeded(currentMeasure);
|
|
|
currentMeasure.hasMoodExpressions = true;
|
|
|
const moodExpression: MoodExpression = new MoodExpression(stringTrimmed, this.placement, this.staffNumber);
|
|
|
+ moodExpression.fontStyle = fontStyle;
|
|
|
this.getMultiExpression.addExpression(moodExpression, prefix);
|
|
|
return true;
|
|
|
}
|
|
@@ -571,6 +582,7 @@ export class ExpressionReader {
|
|
|
}
|
|
|
const unknownExpression: UnknownExpression = new UnknownExpression(
|
|
|
stringTrimmed, this.placement, textAlignment, this.staffNumber);
|
|
|
+ unknownExpression.fontStyle = fontStyle;
|
|
|
this.getMultiExpression.addExpression(unknownExpression, prefix);
|
|
|
|
|
|
return false;
|