From 521acaf459acae6ae8b4bfa5049d3c44ead86178 Mon Sep 17 00:00:00 2001 From: aryanrawlani28 Date: Mon, 22 Jun 2020 20:41:33 +0530 Subject: [PATCH] GUI: RTL: Fix 1-off issue for drawing u32 strings When RTL mode is on, previously it was fixed in a commit. This commit just reapplies that, for u32 string drawing. --- graphics/VectorRendererSpec.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/graphics/VectorRendererSpec.cpp b/graphics/VectorRendererSpec.cpp index d7eb9bf34ca..814150bdc41 100644 --- a/graphics/VectorRendererSpec.cpp +++ b/graphics/VectorRendererSpec.cpp @@ -1114,8 +1114,17 @@ drawString(const Graphics::Font *font, const Common::U32String &text, const Comm drawArea = drawArea.findIntersectingRect(Common::Rect(0, 0, _activeSurface->w, _activeSurface->h)); if (!drawArea.isEmpty()) { + Common::Rect textArea(area); + textArea.right -= deltax; + Surface textAreaSurface = _activeSurface->getSubArea(drawArea); - font->drawString(&textAreaSurface, text, area.left - drawArea.left, offset - drawArea.top, area.width() - deltax, _fgColor, alignH, deltax, ellipsis); + + if (deltax >= 0) { + textArea.left += deltax; + deltax = 0; + } + + font->drawString(&textAreaSurface, text, textArea.left - drawArea.left, offset - drawArea.top, textArea.width(), _fgColor, alignH, deltax, ellipsis); } }