summaryrefslogtreecommitdiff
path: root/vcl/source/gdi/pdfwriter_impl.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'vcl/source/gdi/pdfwriter_impl.cxx')
-rw-r--r--vcl/source/gdi/pdfwriter_impl.cxx23
1 files changed, 23 insertions, 0 deletions
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index 1697cfd2354c..9e592a71b977 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -9424,6 +9424,29 @@ void PDFWriterImpl::drawLayout( SalLayout& rLayout, const OUString& rText, bool
}
}
+ if (m_aCurrentPDFState.m_aFont.GetFillColor() != Color(COL_TRANSPARENT))
+ {
+ // PDF doesn't have a text fill color, so draw a rectangle before
+ // drawing the actual text.
+ push(PushFlags::FILLCOLOR | PushFlags::LINECOLOR);
+ setFillColor(m_aCurrentPDFState.m_aFont.GetFillColor());
+ // Avoid border around the rectangle for Writer shape text.
+ setLineColor(Color(COL_TRANSPARENT));
+
+ // The rectangle is the bounding box of the text, but also includes
+ // ascent / descent to match the on-screen rendering.
+ Rectangle aRectangle;
+ // This is the top left of the text without ascent / descent.
+ aRectangle.SetPos(m_pReferenceDevice->PixelToLogic(rLayout.GetDrawPosition()));
+ aRectangle.setY(aRectangle.getY() - aRefDevFontMetric.GetAscent());
+ aRectangle.SetSize(m_pReferenceDevice->PixelToLogic(Size(rLayout.GetTextWidth(), 0)));
+ // This includes ascent / descent.
+ aRectangle.setHeight(aRefDevFontMetric.GetLineHeight());
+ drawRectangle(aRectangle);
+
+ pop();
+ }
+
Point aAlignOffset;
if ( eAlign == ALIGN_BOTTOM )
aAlignOffset.Y() -= aRefDevFontMetric.GetDescent();