From 35b6c4f0eba1b89d50065ec1897f2dbb067f7005 Mon Sep 17 00:00:00 2001 From: Eliot Jones Date: Wed, 19 Jun 2019 18:47:50 +0100 Subject: [PATCH] handle case where font metrics do not declare width or height #35 --- .../Fonts/Simple/Type1Standard14Font.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/UglyToad.PdfPig/Fonts/Simple/Type1Standard14Font.cs b/src/UglyToad.PdfPig/Fonts/Simple/Type1Standard14Font.cs index f72a45b3..3b1ab639 100644 --- a/src/UglyToad.PdfPig/Fonts/Simple/Type1Standard14Font.cs +++ b/src/UglyToad.PdfPig/Fonts/Simple/Type1Standard14Font.cs @@ -64,7 +64,17 @@ { return new PdfRectangle(0, 0, 250, 0); } + + if (metrics.WidthX == 0 && metrics.BoundingBox.Width > 0) + { + metrics.WidthX = metrics.BoundingBox.Width; + } + if (metrics.WidthY == 0 && metrics.BoundingBox.Height > 0) + { + metrics.WidthY = metrics.BoundingBox.Height; + } + return new PdfRectangle(0, 0, metrics.WidthX, metrics.WidthY); }