Skip to content

Commit

Permalink
Set path to null by default in TryGetPath() for consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
BobLd committed Jan 15, 2024
1 parent d6e3ddb commit bcb6a4e
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/UglyToad.PdfPig.Fonts/TrueType/TrueTypeFont.cs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ public bool TryGetBoundingBox(int characterCode, Func<int, int?> characterCodeTo
/// </summary>
public bool TryGetPath(int characterCode, Func<int, int?> characterCodeToGlyphId, out IReadOnlyList<PdfSubpath> path)
{
path = EmptyArray<PdfSubpath>.Instance;
path = null;

if (!TryGetGlyphIndex(characterCode, characterCodeToGlyphId, out var index)
|| TableRegister.GlyphTable == null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<SKPicture>(pageNo))
using (var image = SKImage.FromPicture(picture, size, ScaleMatrix))
using (var bmp = SKBitmap.FromImage(image))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ private CompactFontFormatFont GetFont()

public bool TryGetPath(int characterCode, out IReadOnlyList<PdfSubpath> path)
{
path = EmptyArray<PdfSubpath>.Instance;
path = null;

var font = GetFont();

Expand Down
2 changes: 1 addition & 1 deletion src/UglyToad.PdfPig/PdfFonts/Simple/TrueTypeSimpleFont.cs
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ public bool TryGetPath(int characterCode, out IReadOnlyList<PdfSubpath> path)
{
if (font == null)
{
path = EmptyArray<PdfSubpath>.Instance;
path = null;
return false;
}

Expand Down

0 comments on commit bcb6a4e

Please sign in to comment.