summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2023-01-13 17:00:40 +0000
committerAdolfo Jayme Barrientos <fitojb@ubuntu.com>2023-01-14 15:30:24 +0000
commitd5c8b38eab3d3766f403a33e11dffa498655be8f (patch)
tree9172233286fab1a51066ca13b4bd942f514707b0
parent57d1de08dee74b691b8686c8b35f3e61257b8107 (diff)
tdf#152990 set the font after the MapMode is (potentially) setco-23.05-branch-point
Change-Id: I64617a5c85e7e6b444aac705ebbfdd777b4ea55a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145442 Tested-by: Jenkins Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
-rw-r--r--drawinglayer/source/processor2d/vclprocessor2d.cxx5
-rw-r--r--sw/qa/extras/layout/layout2.cxx23
2 files changed, 10 insertions, 18 deletions
diff --git a/drawinglayer/source/processor2d/vclprocessor2d.cxx b/drawinglayer/source/processor2d/vclprocessor2d.cxx
index bd92921396ae..8bd9abadf15c 100644
--- a/drawinglayer/source/processor2d/vclprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclprocessor2d.cxx
@@ -306,7 +306,6 @@ void VclProcessor2D::RenderTextSimpleOrDecoratedPortionPrimitive2D(
mpOutputDevice->SetLayoutMode(nRTLLayoutMode);
}
- mpOutputDevice->SetFont(aFont);
mpOutputDevice->SetTextColor(Color(aRGBFontColor));
OUString aText(rTextCandidate.getText());
@@ -364,6 +363,10 @@ void VclProcessor2D::RenderTextSimpleOrDecoratedPortionPrimitive2D(
mpOutputDevice->SetMapMode(aMapMode);
}
+ // tdf#152990 set the font after the MapMode is (potentially) set so canvas uses the desired
+ // font size
+ mpOutputDevice->SetFont(aFont);
+
if (!aDXArray.empty())
{
const SalLayoutGlyphs* pGlyphs = SalLayoutGlyphsCache::self()->GetLayoutGlyphs(
diff --git a/sw/qa/extras/layout/layout2.cxx b/sw/qa/extras/layout/layout2.cxx
index b8ba46bebc20..33196e019d86 100644
--- a/sw/qa/extras/layout/layout2.cxx
+++ b/sw/qa/extras/layout/layout2.cxx
@@ -1278,19 +1278,13 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf126244)
xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile);
CPPUNIT_ASSERT(pXmlDoc);
// Test the first level of vertical category axis labels orientation. The first level orientation should be horizontal.
- assertXPath(pXmlDoc, "/metafile/push[1]/push[1]/push[1]/push[4]/push[1]/font[1]", "orientation",
- "0");
+ assertXPath(pXmlDoc, "(//font)[1]", "orientation", "0");
// Test the second level of vertical category axis labels orientation. The second level orientation should be vertical.
- sal_Int32 nRotation
- = getXPath(pXmlDoc, "/metafile/push[1]/push[1]/push[1]/push[4]/push[1]/font[5]",
- "orientation")
- .toInt32();
+ sal_Int32 nRotation = getXPath(pXmlDoc, "(//font)[5]", "orientation").toInt32();
CPPUNIT_ASSERT(nRotation >= 899);
CPPUNIT_ASSERT(nRotation <= 900);
// Test the third level of vertical category axis labels orientation. The third level orientation should be vertical.
- nRotation = getXPath(pXmlDoc, "/metafile/push[1]/push[1]/push[1]/push[4]/push[1]/font[7]",
- "orientation")
- .toInt32();
+ nRotation = getXPath(pXmlDoc, "(//font)[7]", "orientation").toInt32();
CPPUNIT_ASSERT(nRotation >= 899);
CPPUNIT_ASSERT(nRotation <= 900);
}
@@ -1307,18 +1301,13 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf127304)
xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile);
CPPUNIT_ASSERT(pXmlDoc);
// Test the first level of horizontal category axis labels orientation. The first level orientation should be vertical.
- sal_Int32 nRotation
- = getXPath(pXmlDoc, "/metafile/push[1]/push[1]/push[1]/push[3]/push[1]/font[1]",
- "orientation")
- .toInt32();
+ sal_Int32 nRotation = getXPath(pXmlDoc, "(//font)[1]", "orientation").toInt32();
CPPUNIT_ASSERT(nRotation >= 899);
CPPUNIT_ASSERT(nRotation <= 900);
// Test the second level of horizontal category axis labels orientation. The second level orientation should be horizontal.
- assertXPath(pXmlDoc, "/metafile/push[1]/push[1]/push[1]/push[3]/push[1]/font[5]", "orientation",
- "0");
+ assertXPath(pXmlDoc, "(//font)[5]", "orientation", "0");
// Test the third level of horizontal category axis labels orientation. The third level orientation should be horizontal.
- assertXPath(pXmlDoc, "/metafile/push[1]/push[1]/push[1]/push[3]/push[1]/font[7]", "orientation",
- "0");
+ assertXPath(pXmlDoc, "(//font)[7]", "orientation", "0");
}
CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testHorizontal_multilevel)