@@ -210,9 +210,10 @@ class Canvas {
210
210
export class Paint {
211
211
_native : android . graphics . Paint ;
212
212
fontInternal : Font ;
213
- _needsFontUpdate = true ;
213
+ _needsFontUpdate = false ;
214
+ handlesFont = false ;
214
215
getNative ( ) {
215
- if ( this . _needsFontUpdate ) {
216
+ if ( ! this . handlesFont && this . _needsFontUpdate ) {
216
217
this . _needsFontUpdate = false ;
217
218
const font = this . font ;
218
219
const nTypeface = font . getAndroidTypeface ( ) ;
@@ -255,11 +256,14 @@ export class Paint {
255
256
} else {
256
257
return Reflect . get ( target , name , receiver ) ;
257
258
}
258
- } ,
259
+ }
259
260
} ) ;
260
261
}
261
262
setFont ( font : Font ) {
262
263
this . fontInternal = font ;
264
+ if ( this . handlesFont ) {
265
+ return ;
266
+ }
263
267
this . _native . setTextSize ( font . fontSize ) ;
264
268
this . _needsFontUpdate = true ;
265
269
}
@@ -287,7 +291,9 @@ export class Paint {
287
291
setFontFamily ( familyName : string ) {
288
292
if ( this . font . fontFamily !== familyName ) {
289
293
this . fontInternal = this . font . withFontFamily ( familyName ) ;
290
- this . _needsFontUpdate = true ;
294
+ if ( ! this . handlesFont ) {
295
+ this . _needsFontUpdate = true ;
296
+ }
291
297
}
292
298
}
293
299
set fontWeight ( weight : FontWeight ) {
@@ -296,7 +302,9 @@ export class Paint {
296
302
setFontWeight ( weight : FontWeight ) {
297
303
if ( this . font . fontWeight !== weight ) {
298
304
this . fontInternal = this . font . withFontWeight ( weight ) ;
299
- this . _needsFontUpdate = true ;
305
+ if ( ! this . handlesFont ) {
306
+ this . _needsFontUpdate = true ;
307
+ }
300
308
}
301
309
}
302
310
set fontStyle ( style : FontStyle ) {
@@ -305,7 +313,9 @@ export class Paint {
305
313
setFontStyle ( style : FontStyle ) {
306
314
if ( this . font . fontStyle !== style ) {
307
315
this . fontInternal = this . font . withFontStyle ( style ) ;
308
- this . _needsFontUpdate = true ;
316
+ if ( ! this . handlesFont ) {
317
+ this . _needsFontUpdate = true ;
318
+ }
309
319
}
310
320
}
311
321
set color ( color ) {
@@ -335,13 +345,15 @@ export class Paint {
335
345
public setTypeface ( font : Font | android . graphics . Typeface ) : Font {
336
346
if ( font instanceof Font ) {
337
347
this . setFont ( font ) ;
338
- return this . fontInternal ; ;
348
+ return this . fontInternal ;
339
349
} else if ( font ) {
340
350
this . fontInternal [ '_typeface' ] = font ;
341
351
} else {
342
352
this . fontInternal = null ;
343
353
}
344
- this . _needsFontUpdate = true ;
354
+ if ( ! this . handlesFont ) {
355
+ this . _needsFontUpdate = true ;
356
+ }
345
357
return this . fontInternal ;
346
358
}
347
359
set typeface ( typeface ) {
0 commit comments