From bcb6a4e5321ca72600b91610556a5145330a0dfb Mon Sep 17 00:00:00 2001 From: BobLd <38405645+BobLd@users.noreply.github.com> Date: Mon, 15 Jan 2024 19:56:44 +0000 Subject: [PATCH] Set path to null by default in TryGetPath() for consistency --- src/UglyToad.PdfPig.Fonts/TrueType/TrueTypeFont.cs | 2 +- .../Integration/VisualVerification/GenerateLetterGlyphImages.cs | 2 -- .../PdfFonts/CidFonts/PdfCidCompactFontFormatFont.cs | 2 +- src/UglyToad.PdfPig/PdfFonts/Simple/TrueTypeSimpleFont.cs | 2 +- 4 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/UglyToad.PdfPig.Fonts/TrueType/TrueTypeFont.cs b/src/UglyToad.PdfPig.Fonts/TrueType/TrueTypeFont.cs index d6635310c..201b424c8 100644 --- a/src/UglyToad.PdfPig.Fonts/TrueType/TrueTypeFont.cs +++ b/src/UglyToad.PdfPig.Fonts/TrueType/TrueTypeFont.cs @@ -137,7 +137,7 @@ public bool TryGetBoundingBox(int characterCode, Func characterCodeTo /// public bool TryGetPath(int characterCode, Func characterCodeToGlyphId, out IReadOnlyList path) { - path = EmptyArray.Instance; + path = null; if (!TryGetGlyphIndex(characterCode, characterCodeToGlyphId, out var index) || TableRegister.GlyphTable == null) diff --git a/src/UglyToad.PdfPig.Tests/Integration/VisualVerification/GenerateLetterGlyphImages.cs b/src/UglyToad.PdfPig.Tests/Integration/VisualVerification/GenerateLetterGlyphImages.cs index edfc5851d..d6d32f0ad 100644 --- a/src/UglyToad.PdfPig.Tests/Integration/VisualVerification/GenerateLetterGlyphImages.cs +++ b/src/UglyToad.PdfPig.Tests/Integration/VisualVerification/GenerateLetterGlyphImages.cs @@ -64,8 +64,6 @@ private static void Run(string file, int pageNo = 1) var page = document.GetPage(pageNo); var size = new SKSizeI((int)(page.Width * Scale), (int)(page.Height * Scale)); - var annots = page.ExperimentalAccess.GetAnnotations().ToArray(); - using (var picture = document.GetPage(pageNo)) using (var image = SKImage.FromPicture(picture, size, ScaleMatrix)) using (var bmp = SKBitmap.FromImage(image)) diff --git a/src/UglyToad.PdfPig/PdfFonts/CidFonts/PdfCidCompactFontFormatFont.cs b/src/UglyToad.PdfPig/PdfFonts/CidFonts/PdfCidCompactFontFormatFont.cs index bd0ed0092..f492d94d1 100644 --- a/src/UglyToad.PdfPig/PdfFonts/CidFonts/PdfCidCompactFontFormatFont.cs +++ b/src/UglyToad.PdfPig/PdfFonts/CidFonts/PdfCidCompactFontFormatFont.cs @@ -120,7 +120,7 @@ private CompactFontFormatFont GetFont() public bool TryGetPath(int characterCode, out IReadOnlyList path) { - path = EmptyArray.Instance; + path = null; var font = GetFont(); diff --git a/src/UglyToad.PdfPig/PdfFonts/Simple/TrueTypeSimpleFont.cs b/src/UglyToad.PdfPig/PdfFonts/Simple/TrueTypeSimpleFont.cs index 7eacfbce8..bf7a87d69 100644 --- a/src/UglyToad.PdfPig/PdfFonts/Simple/TrueTypeSimpleFont.cs +++ b/src/UglyToad.PdfPig/PdfFonts/Simple/TrueTypeSimpleFont.cs @@ -328,7 +328,7 @@ public bool TryGetPath(int characterCode, out IReadOnlyList path) { if (font == null) { - path = EmptyArray.Instance; + path = null; return false; }