@@ -850,7 +850,6 @@ export class Paint implements IPaint {
850850 _color : Color = new Color ( 'black' ) ;
851851 style : Style = Style . FILL ;
852852 align : Align = Align . LEFT ;
853- // _textSize = 16;
854853 _font : Font ;
855854 strokeWidth = 0 ;
856855 strokeMiter = 0 ;
@@ -963,13 +962,21 @@ export class Paint implements IPaint {
963962 constructor ( ) {
964963 // this.font = Font.default;
965964 }
966-
967- get font ( ) {
965+ setFont ( font : Font ) {
966+ this . _font = font ;
967+ }
968+ getFont ( ) {
968969 if ( ! this . _font ) {
969970 this . _font = Font . default ;
970971 }
971972 return this . _font ;
972973 }
974+ get font ( ) {
975+ return this . getFont ( ) ;
976+ }
977+ set font ( font : Font ) {
978+ this . setFont ( font ) ;
979+ }
973980
974981 setFontFamily ( familyName : string ) {
975982 this . _font = this . font . withFontFamily ( familyName ) ;
@@ -1008,23 +1015,26 @@ export class Paint implements IPaint {
10081015 }
10091016
10101017 public getTextSize ( ) : number {
1011- return this . textSize ;
1018+ return this . _font ? this . _font . fontSize : UIFont . labelFontSize ;
10121019 }
10131020
10141021 set textSize ( textSize ) {
1015- this . _font = this . font . withFontSize ( textSize ) ;
1016- this . _textAttribs = null ;
1022+ this . setTextSize ( textSize ) ;
10171023 }
10181024 get textSize ( ) {
1019- return this . _font ? this . _font . fontSize : UIFont . labelFontSize ;
1025+ return this . getTextSize ( ) ;
10201026 }
10211027 setTextSize ( textSize ) {
1022- this . textSize = textSize ;
1028+ this . _font = this . font . withFontSize ( textSize ) ;
1029+ this . _textAttribs = null ;
10231030 }
10241031 get color ( ) : Color | number | string {
10251032 return this . _color ;
10261033 }
10271034 set color ( color : Color | number | string ) {
1035+ this . setColor ( color ) ;
1036+ }
1037+ setColor ( color : Color | number | string ) {
10281038 if ( color instanceof Color ) {
10291039 this . _color = color ;
10301040 } else if ( ! ! color ) {
@@ -1035,6 +1045,7 @@ export class Paint implements IPaint {
10351045 }
10361046 setColor ( color : Color | number | string ) {
10371047 this . color = color as any ;
1048+
10381049 }
10391050 getColor ( ) : Color {
10401051 return this . _color ;
0 commit comments