Label.ts 1.3 KB

12345678910111213141516171819202122232425262728293031323334
  1. import {TextAlignmentEnum} from "../Common/Enums/TextAlignment";
  2. import {OSMDColor} from "../Common/DataObjects/OSMDColor";
  3. import {Fonts} from "../Common/Enums/Fonts";
  4. import {FontStyles} from "../Common/Enums/FontStyles";
  5. /**
  6. * A text label on the graphical music sheet.
  7. * It is used e.g. for titles, composer names, instrument names and dynamic instructions.
  8. */
  9. export class Label {
  10. constructor(text: string = "", alignment: TextAlignmentEnum = TextAlignmentEnum.CenterBottom,
  11. font: Fonts = undefined, print: boolean = true) {
  12. this.text = text;
  13. this.print = print;
  14. this.textAlignment = alignment;
  15. this.font = font;
  16. this.fontFamily = undefined; // default value, will use EngravingRules.DefaultFontFamily at rendering
  17. }
  18. public text: string;
  19. public print: boolean;
  20. public color: OSMDColor;
  21. public colorDefault: string; // TODO this is Vexflow format, convert to OSMDColor. for now convenient for default colors.
  22. public font: Fonts;
  23. public fontFamily: string; // default undefined: will use EngravingRules.DefaultFontFamily at rendering
  24. public fontStyle: FontStyles;
  25. public fontHeight: number;
  26. public textAlignment: TextAlignmentEnum;
  27. public ToString(): string {
  28. return this.text;
  29. }
  30. }