Kaydet (Commit) e252ac07 authored tarafından Ahmad Harthi's avatar Ahmad Harthi

More fixes to fdo#57422

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

Change-Id: Ib89aee7c817811c7b3751dc6f941a34ed763d993
Reviewed-on: https://gerrit.libreoffice.org/1521Tested-by: 's avatarAhmad Harthi <aalharthi@kacst.edu.sa>
Reviewed-by: 's avatarAhmad Harthi <aalharthi@kacst.edu.sa>
üst 8c200d85
......@@ -413,29 +413,15 @@ void PresenterButton::RenderButton (
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)
......
......@@ -782,35 +782,18 @@ void PresenterSlideShowView::PaintEndSlide (const awt::Rectangle& rRepaintBox)
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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment