From a36f5a3af3c2a084e866485acbcea978d667da5c Mon Sep 17 00:00:00 2001 From: Eliot Jones Date: Tue, 14 Jan 2020 14:52:51 +0000 Subject: [PATCH] handle missing embedded cid font for type 0 fonts all font file entries in the font descriptor for type 0 fonts are optional. if the font is missing we default to returning the default bounding box. --- src/UglyToad.PdfPig/PdfFonts/CidFonts/Type0CidFont.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/UglyToad.PdfPig/PdfFonts/CidFonts/Type0CidFont.cs b/src/UglyToad.PdfPig/PdfFonts/CidFonts/Type0CidFont.cs index a8324b45..a6a282d8 100644 --- a/src/UglyToad.PdfPig/PdfFonts/CidFonts/Type0CidFont.cs +++ b/src/UglyToad.PdfPig/PdfFonts/CidFonts/Type0CidFont.cs @@ -90,6 +90,11 @@ { throw new ArgumentException($"The provided character identifier was negative: {characterIdentifier}."); } + + if (fontProgram == null) + { + return Descriptor?.BoundingBox ?? new PdfRectangle(0, 0, 1000, 0); + } if (fontProgram.TryGetBoundingBox(characterIdentifier, out var boundingBox)) {