From bbbb15c4bc87154db80dc4876e8e2a962a02113b Mon Sep 17 00:00:00 2001 From: Pk11 Date: Wed, 27 Jan 2021 23:48:49 -0600 Subject: [PATCH] Fix punctuation after LTR at end of line --- source/font.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/source/font.cpp b/source/font.cpp index 3893bc5..7668539 100644 --- a/source/font.cpp +++ b/source/font.cpp @@ -266,13 +266,14 @@ ITCM_CODE void Font::print(std::u16string_view text, int x, int y, bool top, int ltrBegin = it; // If on an RTL char right now, add one - if(*it >= 0x0590 && *it <= 0x05FF) { + if(*it >= 0x0590 && *it <= 0x05FF) it++; - // And skip all punctuation at the end if not at beginning - while(*it < '0' || (*it > '9' && *it < 'A') || (*it > 'Z' && *it < 'a') || (*it > 'z' && *it < 127)) { - it++; + + // Skip all punctuation at the end + while(*it < '0' || (*it > '9' && *it < 'A') || (*it > 'Z' && *it < 'a') || (*it > 'z' && *it < 127)) { + if(it != text.begin()) ltrBegin++; - } + it++; } rtl = false; }