From f18bc0766a15e8b23ed05a303851b60e11715d25 Mon Sep 17 00:00:00 2001 From: Eliot Jones Date: Sun, 19 Apr 2020 10:28:11 +0100 Subject: [PATCH] #161 handle zero point size by using rotated matrix --- src/UglyToad.PdfPig/Graphics/ContentStreamProcessor.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/UglyToad.PdfPig/Graphics/ContentStreamProcessor.cs b/src/UglyToad.PdfPig/Graphics/ContentStreamProcessor.cs index 3eaafab0..55bad920 100644 --- a/src/UglyToad.PdfPig/Graphics/ContentStreamProcessor.cs +++ b/src/UglyToad.PdfPig/Graphics/ContentStreamProcessor.cs @@ -178,7 +178,13 @@ // TODO: this does not seem correct, produces the correct result for now but we need to revisit. // see: https://stackoverflow.com/questions/48010235/pdf-specification-get-font-size-in-points - var pointSize = Math.Round(transformationMatrix.Multiply(TextMatrices.TextMatrix).Multiply(fontSize).A, 2); + var fontSizeMatrix = transformationMatrix.Multiply(TextMatrices.TextMatrix).Multiply(fontSize); + var pointSize = Math.Round(fontSizeMatrix.A, 2); + // Assume a rotated letter + if (pointSize == 0) + { + pointSize = Math.Round(fontSizeMatrix.B, 2); + } if (pointSize < 0) {