diff --git a/src/UglyToad.PdfPig.Fonts/Type1/Type1FontProgram.cs b/src/UglyToad.PdfPig.Fonts/Type1/Type1FontProgram.cs index ef97627c..701ea029 100644 --- a/src/UglyToad.PdfPig.Fonts/Type1/Type1FontProgram.cs +++ b/src/UglyToad.PdfPig.Fonts/Type1/Type1FontProgram.cs @@ -62,6 +62,11 @@ internal Type1Font(string name, IReadOnlyDictionary encoding, Array /// public PdfRectangle? GetCharacterBoundingBox(string characterName) { + if (string.Equals(characterName, GlyphList.NotDefined, StringComparison.OrdinalIgnoreCase)) + { + return null; + } + var glyph = GetCharacterPath(characterName); return PdfSubpath.GetBoundingRectangle(glyph); } @@ -94,8 +99,13 @@ private static TransformationMatrix GetFontTransformationMatrix(ArrayToken array /// /// Get the pdfpath for the character with the given name. /// - public IReadOnlyList GetCharacterPath(string characterName) + public IReadOnlyList? GetCharacterPath(string characterName) { + if (string.Equals(characterName, GlyphList.NotDefined, StringComparison.OrdinalIgnoreCase)) + { + return null; + } + if (!CharStrings.TryGenerate(characterName, out var glyph)) { return null;