From 9a7e94a64ccd498f0745f383e4de78a9ac518c38 Mon Sep 17 00:00:00 2001 From: Jakub Melka Date: Wed, 3 Jul 2024 13:11:46 +0200 Subject: [PATCH] Issue #184: Invalid text painting --- Pdf4QtLibCore/sources/pdfblpainter.cpp | 25 +++---------------------- 1 file changed, 3 insertions(+), 22 deletions(-) diff --git a/Pdf4QtLibCore/sources/pdfblpainter.cpp b/Pdf4QtLibCore/sources/pdfblpainter.cpp index 567a076..a8b3e85 100644 --- a/Pdf4QtLibCore/sources/pdfblpainter.cpp +++ b/Pdf4QtLibCore/sources/pdfblpainter.cpp @@ -693,28 +693,9 @@ void PDFBLPaintEngine::drawPixmap(const QRectF& r, const QPixmap& pm, const QRec void PDFBLPaintEngine::drawTextItem(const QPointF& p, const QTextItem& textItem) { - if (m_currentRawFont.isValid()) - { - QString text = textItem.text(); - QList glyphIndices = m_currentRawFont.glyphIndexesForString(text); - QList glyphPositions = m_currentRawFont.advancesForGlyphIndexes(glyphIndices); - - QPointF currentPosition = p; - QPainterPath path; - for (int i = 0; i < glyphIndices.size(); ++i) - { - QPainterPath glyphPath = m_currentRawFont.pathForGlyph(glyphIndices[i]); - glyphPath.translate(currentPosition); - path.addPath(glyphPath); - currentPosition += glyphPositions[i]; - } - - m_blContext->save(); - setFillRule(path.fillRule()); - m_blContext->setFillStyle(BLRgba32(m_currentPen.color().rgba())); - drawPathImpl(path, false, true, true); - m_blContext->restore(); - } + // We will call the base implementation, which will + // create paths from text and draw these paths. + QPaintEngine::drawTextItem(p, textItem); } void PDFBLPaintEngine::drawTiledPixmap(const QRectF& r, const QPixmap& pixmap, const QPointF& s)