From 8acf688f0fc297e350d3dd4eccbba19bbd20589f Mon Sep 17 00:00:00 2001 From: Jakub Melka Date: Mon, 1 May 2023 20:07:49 +0200 Subject: [PATCH] Issue #50: Type3 font advance fix --- Pdf4QtLib/sources/pdfpagecontentprocessor.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Pdf4QtLib/sources/pdfpagecontentprocessor.cpp b/Pdf4QtLib/sources/pdfpagecontentprocessor.cpp index e68cde8..1ff3c97 100644 --- a/Pdf4QtLib/sources/pdfpagecontentprocessor.cpp +++ b/Pdf4QtLib/sources/pdfpagecontentprocessor.cpp @@ -3250,7 +3250,7 @@ void PDFPageContentProcessor::drawText(const TextSequence& textSequence) } else if (item.isAdvance()) { - if (horizontalScaling) + if (isHorizontalWritingSystem) { displacementX = -item.advance * 0.001 * fontSize * horizontalScaling; } @@ -3293,7 +3293,11 @@ void PDFPageContentProcessor::drawText(const TextSequence& textSequence) // First, compute horizontal advance qreal displacementX = 0.0; - if (item.advance != 0.0) + if (!item.isContentStream()) + { + displacementX = -item.advance * 0.001 * fontSize * horizontalScaling; + } + else if (item.advance != 0.0) { qreal ry = 0.0; fontAdjustedMatrix.map(item.advance, 0.0, &displacementX, &ry);