drawinglayer/source/processor2d/vclprocessor2d.cxx |    5 +++-
 sw/qa/extras/layout/layout2.cxx                    |   23 +++++----------------
 2 files changed, 10 insertions(+), 18 deletions(-)

New commits:
commit a4a31e6a7b6e84689ff5dbafbd0baf1992729495
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Fri Jan 13 17:00:40 2023 +0000
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Tue Jan 17 10:29:17 2023 +0000

    tdf#152990 set the font after the MapMode is (potentially) set
    
    Change-Id: I64617a5c85e7e6b444aac705ebbfdd777b4ea55a
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145442
    Tested-by: Jenkins
    Reviewed-by: Adolfo Jayme Barrientos <fit...@ubuntu.com>
    (cherry picked from commit d5c8b38eab3d3766f403a33e11dffa498655be8f)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145453
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>
    Reviewed-by: Caolán McNamara <caol...@redhat.com>
    Tested-by: Caolán McNamara <caol...@redhat.com>

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)

Reply via email to