@@ -210,9 +210,10 @@ class Canvas {
210210export class Paint {
211211 _native : android . graphics . Paint ;
212212 fontInternal : Font ;
213- _needsFontUpdate = true ;
213+ _needsFontUpdate = false ;
214+ handlesFont = false ;
214215 getNative ( ) {
215- if ( this . _needsFontUpdate ) {
216+ if ( ! this . handlesFont && this . _needsFontUpdate ) {
216217 this . _needsFontUpdate = false ;
217218 const font = this . font ;
218219 const nTypeface = font . getAndroidTypeface ( ) ;
@@ -255,11 +256,14 @@ export class Paint {
255256 } else {
256257 return Reflect . get ( target , name , receiver ) ;
257258 }
258- } ,
259+ }
259260 } ) ;
260261 }
261262 setFont ( font : Font ) {
262263 this . fontInternal = font ;
264+ if ( this . handlesFont ) {
265+ return ;
266+ }
263267 this . _native . setTextSize ( font . fontSize ) ;
264268 this . _needsFontUpdate = true ;
265269 }
@@ -287,7 +291,9 @@ export class Paint {
287291 setFontFamily ( familyName : string ) {
288292 if ( this . font . fontFamily !== familyName ) {
289293 this . fontInternal = this . font . withFontFamily ( familyName ) ;
290- this . _needsFontUpdate = true ;
294+ if ( ! this . handlesFont ) {
295+ this . _needsFontUpdate = true ;
296+ }
291297 }
292298 }
293299 set fontWeight ( weight : FontWeight ) {
@@ -296,7 +302,9 @@ export class Paint {
296302 setFontWeight ( weight : FontWeight ) {
297303 if ( this . font . fontWeight !== weight ) {
298304 this . fontInternal = this . font . withFontWeight ( weight ) ;
299- this . _needsFontUpdate = true ;
305+ if ( ! this . handlesFont ) {
306+ this . _needsFontUpdate = true ;
307+ }
300308 }
301309 }
302310 set fontStyle ( style : FontStyle ) {
@@ -305,7 +313,9 @@ export class Paint {
305313 setFontStyle ( style : FontStyle ) {
306314 if ( this . font . fontStyle !== style ) {
307315 this . fontInternal = this . font . withFontStyle ( style ) ;
308- this . _needsFontUpdate = true ;
316+ if ( ! this . handlesFont ) {
317+ this . _needsFontUpdate = true ;
318+ }
309319 }
310320 }
311321 set color ( color ) {
@@ -335,13 +345,15 @@ export class Paint {
335345 public setTypeface ( font : Font | android . graphics . Typeface ) : Font {
336346 if ( font instanceof Font ) {
337347 this . setFont ( font ) ;
338- return this . fontInternal ; ;
348+ return this . fontInternal ;
339349 } else if ( font ) {
340350 this . fontInternal [ '_typeface' ] = font ;
341351 } else {
342352 this . fontInternal = null ;
343353 }
344- this . _needsFontUpdate = true ;
354+ if ( ! this . handlesFont ) {
355+ this . _needsFontUpdate = true ;
356+ }
345357 return this . fontInternal ;
346358 }
347359 set typeface ( typeface ) {
0 commit comments