From 819156106d26b3ef3bba7da05c4a699860641edd Mon Sep 17 00:00:00 2001 From: Flakebi Date: Fri, 24 Apr 2015 03:45:05 +0200 Subject: [PATCH] Mark text as RTL when at least one character is RTL --- src/utils/translation.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/utils/translation.cpp b/src/utils/translation.cpp index da9139bbb..cb62a58f1 100644 --- a/src/utils/translation.cpp +++ b/src/utils/translation.cpp @@ -422,9 +422,17 @@ bool Translations::isRTLText(const wchar_t *in_ptr) fribidi_get_bidi_types(fribidiInput, length, types); freeFribidiChar(fribidiInput); - FriBidiParType type = fribidi_get_par_direction(types, length); + // Declare as RTL if one character is RTL + for (std::size_t i = 0; i < length; i++) + { + if (types[i] == FRIBIDI_TYPE_RTL || + types[i] == FRIBIDI_TYPE_RLO) + { + delete[] types; + return true; + } + } delete[] types; - return type == FRIBIDI_PAR_RTL; } return false; #else