@@ -334,33 +334,29 @@ public void Render(SKCanvas canvas, float canvasWidth, float canvasHeight)
334334 canvas . DrawLine ( rect . Right , rect . Top , rect . Left , rect . Bottom , paint ) ;
335335 }
336336 }
337-
338- var state = $ "Size: { width } x { height } Base Direction: { BaseDirection } Alignment: { TextAlignment } Content: { ContentMode } scale: { Scale } time: { elapsed } subpixel: { SubpixelPositioning } hinting: { Hinting } edging: { Edging } ";
339- canvas . DrawText ( state , margin , 20 , new SKPaint ( )
340- {
341- Typeface = SKTypeface . FromFamilyName ( "Arial" ) ,
342- TextSize = 12 ,
343- IsAntialias = true ,
344- } ) ;
345-
346- if ( options . Selection . HasValue )
347- state = $ "Selection: { options . Selection . Value . Start } -{ options . Selection . Value . End } Closest: { ( htr . HasValue ? htr . Value . ClosestCodePointIndex . ToString ( ) : "-" ) } ";
348- else
349- state = $ "Selection: none";
350- canvas . DrawText ( state , margin , 40 , new SKPaint ( )
337+ using ( var font = new SKFont ( SKTypeface . FromFamilyName ( "Arial" ) , 12 ) )
351338 {
352- Typeface = SKTypeface . FromFamilyName ( "Arial" ) ,
353- TextSize = 12 ,
354- IsAntialias = true ,
355- } ) ;
339+ var state = $ "Size: { width } x { height } Base Direction: { BaseDirection } Alignment: { TextAlignment } Content: { ContentMode } scale: { Scale } time: { elapsed } subpixel: { SubpixelPositioning } hinting: { Hinting } edging: { Edging } ";
340+ canvas . DrawText ( state , margin , 20 , font , new SKPaint ( )
341+ {
342+ IsAntialias = true ,
343+ } ) ;
356344
357- state = $ "Measured: { _textBlock . MeasuredWidth } x { _textBlock . MeasuredHeight } Lines: { _textBlock . Lines . Count } Truncated: { _textBlock . Truncated } ";
358- canvas . DrawText ( state , margin , 60 , new SKPaint ( )
359- {
360- Typeface = SKTypeface . FromFamilyName ( "Arial" ) ,
361- TextSize = 12 ,
362- IsAntialias = true ,
363- } ) ;
345+ if ( options . Selection . HasValue )
346+ state = $ "Selection: { options . Selection . Value . Start } -{ options . Selection . Value . End } Closest: { ( htr . HasValue ? htr . Value . ClosestCodePointIndex . ToString ( ) : "-" ) } ";
347+ else
348+ state = $ "Selection: none";
349+ canvas . DrawText ( state , margin , 40 , font , new SKPaint ( )
350+ {
351+ IsAntialias = true ,
352+ } ) ;
353+
354+ state = $ "Measured: { _textBlock . MeasuredWidth } x { _textBlock . MeasuredHeight } Lines: { _textBlock . Lines . Count } Truncated: { _textBlock . Truncated } ";
355+ canvas . DrawText ( state , margin , 60 , font , new SKPaint ( )
356+ {
357+ IsAntialias = true ,
358+ } ) ;
359+ }
364360 }
365361
366362 float _hitTestX ;
0 commit comments