Label.ts 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. export class Label {
  2. constructor(arg1: any, alignment?: PSTextAlignment) {
  3. if (arg1 instanceof string) {
  4. this.text = <string>arg1;
  5. } else if (arg1 instanceof FontInfo.MusicFontSymbol) {
  6. this.font = PSFonts.PhonicScore;
  7. let symbolInfo: FontInfo.SymbolInfo = FontInfo.Info.getSymbolInfo(<FontInfo.MusicFontSymbol>arg1);
  8. this.text = symbolInfo.symbol;
  9. }
  10. if (alignment !== undefined) {
  11. this.textAlignment = alignment;
  12. }
  13. }
  14. private text: string;
  15. private color: PSColor = PSColor.Black;
  16. private font: PSFonts = PSFonts.TimesNewRoman;
  17. private fontStyle: PSFontStyles = PSFontStyles.Regular;
  18. private textAlignment: PSTextAlignment = PSTextAlignment.LeftBottom;
  19. private fontHeight: number = 2;
  20. public get Text(): string {
  21. return this.text;
  22. }
  23. public set Text(value: string) {
  24. this.text = value;
  25. }
  26. public get Color(): PSColor {
  27. return this.color;
  28. }
  29. public set Color(value: PSColor) {
  30. this.color = value;
  31. }
  32. public get Font(): PSFonts {
  33. return this.font;
  34. }
  35. public set Font(value: PSFonts) {
  36. this.font = value;
  37. }
  38. public get FontStyle(): PSFontStyles {
  39. return this.fontStyle;
  40. }
  41. public set FontStyle(value: PSFontStyles) {
  42. this.fontStyle = value;
  43. }
  44. public get FontHeight(): number {
  45. return this.fontHeight;
  46. }
  47. public set FontHeight(value: number) {
  48. this.fontHeight = value;
  49. }
  50. public get TextAlignment(): PSTextAlignment {
  51. return this.textAlignment;
  52. }
  53. public set TextAlignment(value: PSTextAlignment) {
  54. this.textAlignment = value;
  55. }
  56. public ToString(): string {
  57. return this.Text;
  58. }
  59. }