Skip to content

Commit 87cfe4f

Browse files
authored
Merge pull request #1719 from nissl-lab/copilot/upgrade-skia-sharp-to-3-119-2
Upgrade SkiaSharp to 3.119.2
2 parents 2d0e8c8 + 8664142 commit 87cfe4f

File tree

3 files changed

+7
-11
lines changed

3 files changed

+7
-11
lines changed

Directory.Packages.props

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
<PackageVersion Include="NUnit" Version="4.3.2" />
2020
<PackageVersion Include="NUnit3TestAdapter" Version="5.0.0" />
2121
<PackageVersion Include="SharpZipLib" Version="1.4.2" />
22-
<PackageVersion Include="SkiaSharp" Version="2.88.9" />
23-
<PackageVersion Include="SkiaSharp.NativeAssets.Linux.NoDependencies" Version="2.88.9" />
22+
<PackageVersion Include="SkiaSharp" Version="3.119.2" />
23+
<PackageVersion Include="SkiaSharp.NativeAssets.Linux.NoDependencies" Version="3.119.2" />
2424
<PackageVersion Include="System.Configuration.ConfigurationManager" Version="8.0.1" />
2525
<PackageVersion Include="System.Formats.Asn1" Version="8.0.1" />
2626
<PackageVersion Include="System.Security.Cryptography.Xml" Version="8.0.2" />

main/HSSF/UserModel/EscherGraphics.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -301,8 +301,7 @@ public void DrawString(String str, int x, int y)
301301
string fontName = font.Typeface.FamilyName.Equals("SansSerif", StringComparison.OrdinalIgnoreCase) ? "Arial" : font.Typeface.FamilyName;
302302
using SKFont excelFont = CreateFont(fontName, (int)(fontSizeInPoints / verticalPixelsPerPoint));
303303
{
304-
using var paint = new SKPaint { Typeface = excelFont.Typeface, TextSize = excelFont.Size };
305-
int width = (int)((paint.MeasureText(str) * 8) + 12);
304+
int width = (int)((excelFont.MeasureText(str) * 8) + 12);
306305
int height = (int)((font.Size / verticalPixelsPerPoint) + 6) * 2;
307306
y -= Convert.ToInt32((font.Size / verticalPixelsPerPoint) + 2 * verticalPixelsPerPoint); // we want to Draw the shape from the top-left
308307
HSSFTextbox textbox = escherGroup.CreateTextbox(new HSSFChildAnchor(x, y, x + width, y + height));

main/SS/Util/SheetUtil.cs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)