[PATCH] More fixes to fdo#57422

Ahmad Harthi (via Code Review) gerrit at gerrit.libreoffice.org
Sun Dec 30 23:14:24 PST 2012


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/1521

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/21/1521/1

More fixes to fdo#57422

* Code cleanup + replacing drawText() with drawTextLayout().
This solves mirrored LTR text in an RTL ui

Change-Id: Ib89aee7c817811c7b3751dc6f941a34ed763d993
---
M sdext/source/presenter/PresenterButton.cxx
M sdext/source/presenter/PresenterSlideShowView.cxx
2 files changed, 20 insertions(+), 51 deletions(-)



diff --git a/sdext/source/presenter/PresenterButton.cxx b/sdext/source/presenter/PresenterButton.cxx
index ac8e813..b7415a5 100644
--- a/sdext/source/presenter/PresenterButton.cxx
+++ b/sdext/source/presenter/PresenterButton.cxx
@@ -413,29 +413,15 @@
     rendering::RenderState aRenderState (geometry::AffineMatrix2D(1,0,0, 0,1,0), NULL,
         Sequence<double>(4), rendering::CompositeOperation::SOURCE);
     PresenterCanvasHelper::SetDeviceColor(aRenderState, rpFont->mnColor);
+
+    aRenderState.AffineTransform.m02 = (rSize.Width - aTextBBox.X2 + aTextBBox.X1)/2;
+    aRenderState.AffineTransform.m12 = (rSize.Height - aTextBBox.Y2 + aTextBBox.Y1)/2 - aTextBBox.Y1;
+
     /// this is responsible of the close button
-    /// check whether RTL interface or not
-    if(!Application::GetSettings().GetLayoutRTL()){
-        aRenderState.AffineTransform.m02 = (rSize.Width - aTextBBox.X2 + aTextBBox.X1)/2;
-        aRenderState.AffineTransform.m12 = (rSize.Height - aTextBBox.Y2 + aTextBBox.Y1)/2 - aTextBBox.Y1;
-
-        rxCanvas->drawText(
-            aContext,
-            rpFont->mxFont,
-            rendering::ViewState(geometry::AffineMatrix2D(1,0,0, 0,1,0), NULL),
-            aRenderState,
-            rendering::TextDirection::WEAK_LEFT_TO_RIGHT);
-    }else{
-        aRenderState.AffineTransform.m02 = (rSize.Width + aTextBBox.X2 - aTextBBox.X1)/2;
-        aRenderState.AffineTransform.m12 = (rSize.Height - aTextBBox.Y2 + aTextBBox.Y1)/2 - aTextBBox.Y1;
-
-        rxCanvas->drawText(
-            aContext,
-            rpFont->mxFont,
-            rendering::ViewState(geometry::AffineMatrix2D(1,0,0, 0,1,0), NULL),
-            aRenderState,
-            rendering::TextDirection::WEAK_RIGHT_TO_LEFT);
-    }
+    rxCanvas->drawTextLayout(
+        xLayout,
+        rendering::ViewState(geometry::AffineMatrix2D(1,0,0, 0,1,0), NULL),
+        aRenderState);
 }
 
 void PresenterButton::Invalidate (void)
diff --git a/sdext/source/presenter/PresenterSlideShowView.cxx b/sdext/source/presenter/PresenterSlideShowView.cxx
index 894e6d8..be99fa5 100644
--- a/sdext/source/presenter/PresenterSlideShowView.cxx
+++ b/sdext/source/presenter/PresenterSlideShowView.cxx
@@ -782,35 +782,18 @@
             break;
 
         /// this is responsible of the " presentation exit " text inside the slide windows
-        /// check whether RTL interface or not
-        if(!Application::GetSettings().GetLayoutRTL()){
-            PresenterCanvasHelper::SetDeviceColor(aRenderState, util::Color(0x00ffffff));
-            aRenderState.AffineTransform.m02 = 20;
-            aRenderState.AffineTransform.m12 = 40;
-            const rendering::StringContext aContext (
-                msClickToExitPresentationText, 0, msClickToExitPresentationText.getLength());
-            pFont->PrepareFont(mxCanvas);
-            mxCanvas->drawText(
-                aContext,
-                pFont->mxFont,
-                aViewState,
-                aRenderState,
-                rendering::TextDirection::WEAK_LEFT_TO_RIGHT);
-        }
-        else{
-            PresenterCanvasHelper::SetDeviceColor(aRenderState, util::Color(0x00ffffff));
-            aRenderState.AffineTransform.m02 = rRepaintBox.Width-20;
-            aRenderState.AffineTransform.m12 = 40;
-            const rendering::StringContext aContext (
-                msClickToExitPresentationText, 0, msClickToExitPresentationText.getLength());
-            pFont->PrepareFont(mxCanvas);
-            mxCanvas->drawText(
-                aContext,
-                pFont->mxFont,
-                aViewState,
-                aRenderState,
-                rendering::TextDirection::WEAK_RIGHT_TO_LEFT);
-        }
+        PresenterCanvasHelper::SetDeviceColor(aRenderState, util::Color(0x00ffffff));
+        aRenderState.AffineTransform.m02 = 20;
+        aRenderState.AffineTransform.m12 = 40;
+        const rendering::StringContext aContext (
+            msClickToExitPresentationText, 0, msClickToExitPresentationText.getLength());
+        pFont->PrepareFont(mxCanvas);
+        const Reference<rendering::XTextLayout> xLayout (
+            pFont->mxFont->createTextLayout(aContext,rendering::TextDirection::WEAK_LEFT_TO_RIGHT,0));
+        mxCanvas->drawTextLayout(
+            xLayout,
+            aViewState,
+            aRenderState);
     }
     while (false);
 

-- 
To view, visit https://gerrit.libreoffice.org/1521
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib89aee7c817811c7b3751dc6f941a34ed763d993
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Ahmad Harthi <aalharthi at kacst.edu.sa>



More information about the LibreOffice mailing list