@@ -430,8 +430,7 @@ private static double GetRotatedContentHeight(ICell cell, string stringValue, SK
430430 var angle = cell . CellStyle . Rotation * 2.0 * Math . PI / 360.0 ;
431431 try
432432 {
433- using var paint = new SKPaint { Typeface = windowsFont . Typeface , TextSize = windowsFont . Size } ;
434- float textWidth = paint . MeasureText ( stringValue ) ;
433+ float textWidth = windowsFont . MeasureText ( stringValue ) ;
435434 // Use the em-square height (font size in pixels) for the vertical component,
436435 // consistent with GetContentHeight and SixLabors.Fonts MeasureAdvance.
437436 float textHeight = windowsFont . Size ;
@@ -558,9 +557,8 @@ private static double GetCellWidth(int defaultCharWidth, int colspan,
558557 double actualWidth ;
559558 try
560559 {
561- using var paint = new SKPaint { Typeface = windowsFont . Typeface , TextSize = windowsFont . Size } ;
562- float textWidth = paint . MeasureText ( str ) ;
563- paint . GetFontMetrics ( out SKFontMetrics metrics ) ;
560+ float textWidth = windowsFont . MeasureText ( str ) ;
561+ windowsFont . GetFontMetrics ( out SKFontMetrics metrics ) ;
564562 float textHeight = metrics . Descent - metrics . Ascent ;
565563
566564 if ( style . Rotation != 0 )
@@ -666,8 +664,7 @@ public static int GetDefaultCharWidth(IWorkbook wb)
666664
667665 try
668666 {
669- using var paint = new SKPaint { Typeface = font . Typeface , TextSize = font . Size } ;
670- return ( int ) Math . Ceiling ( paint . MeasureText ( new string ( defaultChar , 1 ) ) ) ;
667+ return ( int ) Math . Ceiling ( font . MeasureText ( new string ( defaultChar , 1 ) ) ) ;
671668 }
672669 catch ( Exception )
673670 {
0 commit comments