Skip to content

Commit 34e8f7f

Browse files
authored
fix(android,ui-canvas): trying to fix font cloning
1 parent 3d03004 commit 34e8f7f

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/ui-canvas/canvas.android.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,8 +193,12 @@ export class Paint extends ProxyClass<android.graphics.Paint> {
193193
if (paint) {
194194
this.mNative = new android.graphics.Paint(paint.getNative());
195195
//we need to clone the typeface or it is shared
196-
const nTypeface = paint.font.getAndroidTypeface();
197-
this.mNative.setTypeface(nTypeface);
196+
const original = this.mNative.getTypeface();
197+
if (original) {
198+
const style = original.getStyle();
199+
const cloned = android.graphics.Typeface.create(original, style);
200+
this.mNative.setTypeface(cloned);
201+
}
198202
} else {
199203
this.mNative = new android.graphics.Paint(1); //android.graphics.Paint.ANTI_ALIAS_FLAG
200204
}

0 commit comments

Comments
 (0)