Skip to content

Commit 8704a44

Browse files
committed
chore: refactoring
1 parent 242bc26 commit 8704a44

File tree

2 files changed

+24
-15
lines changed

2 files changed

+24
-15
lines changed

src/canvas.android.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,9 +328,16 @@ export class Paint {
328328
set textSize(value: number) {
329329
this._native.setTextSize(value);
330330
}
331+
get textSize() {
332+
return this.getTextSize();
333+
}
334+
public getTextSize(): number {
335+
return this._native.getTextSize();
336+
}
331337
public setTypeface(font: Font | android.graphics.Typeface): Font {
332338
if (font instanceof Font) {
333-
this.fontInternal = font;
339+
this.setFont(font);
340+
return this.fontInternal;;
334341
} else if (font) {
335342
this.fontInternal['_typeface'] = font;
336343
} else {

src/canvas.ios.ts

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -829,20 +829,7 @@ export class Paint implements IPaint {
829829
// path._path = bPath.CGPath;
830830
}
831831
public setFilterBitmap(param0: boolean) {}
832-
public setTypeface(font: Font | UIFont): Font {
833-
if (this.font === font) {
834-
return this._font;
835-
}
836-
if (font instanceof Font) {
837-
this._font = font;
838-
} else if (font) {
839-
this._font['_uiFont'] = font;
840-
} else {
841-
this._font = null;
842-
}
843-
this._textAttribs = null;
844-
return this._font;
845-
}
832+
846833
public setTextAlign(align: Align): void {
847834
this.align = align;
848835
this._textAttribs = null;
@@ -972,6 +959,21 @@ export class Paint implements IPaint {
972959
this._font = font;
973960
this._textAttribs = null;
974961
}
962+
public setTypeface(font: Font | UIFont): Font {
963+
if (this.font === font) {
964+
return this._font;
965+
}
966+
if (font instanceof Font) {
967+
this.setFont(font);
968+
return this._font;
969+
} else if (font) {
970+
this._font['_uiFont'] = font;
971+
} else {
972+
this._font = null;
973+
}
974+
this._textAttribs = null;
975+
return this._font;
976+
}
975977
getFont() {
976978
if (!this._font) {
977979
this._font = Font.default;

0 commit comments

Comments
 (0)