Label.ts 1007 B

123456789101112131415161718192021222324252627282930
  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, font: Fonts = Fonts.TimesNewRoman) {
  11. this.text = text;
  12. this.textAlignment = alignment;
  13. this.font = font;
  14. }
  15. public text: string;
  16. public color: OSMDColor;
  17. public colorDefault: string; // TODO this is Vexflow format, convert to OSMDColor. for now convenient for default colors.
  18. public font: Fonts;
  19. public fontStyle: FontStyles;
  20. public fontHeight: number;
  21. public textAlignment: TextAlignmentEnum;
  22. public ToString(): string {
  23. return this.text;
  24. }
  25. }