From b64537250370dd61e3d8ba037679bddbc0f79d61 Mon Sep 17 00:00:00 2001 From: Michele Calgaro Date: Wed, 29 Jan 2025 18:05:37 +0900 Subject: Add support for surrogate pairs to TQChar API. This relates to issue #162. The new code is partially taken from Qt4 but with some local rework. Signed-off-by: Michele Calgaro (cherry picked from commit c5cda03125a6d34c179d968011083bceb87976bd) --- src/kernel/qtextengine.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/kernel/qtextengine.cpp') diff --git a/src/kernel/qtextengine.cpp b/src/kernel/qtextengine.cpp index f527cd86a..7ada261e9 100644 --- a/src/kernel/qtextengine.cpp +++ b/src/kernel/qtextengine.cpp @@ -819,8 +819,7 @@ static void calcLineBreaks(const TQString &str, TQCharAttributes *charAttributes if (category == TQChar::Other_Surrogate) { // char stop only on first pair - if (uc[i].unicode() >= 0xd800 && uc[i].unicode() < 0xdc00 && i < len-1 - && uc[i+1].unicode() >= 0xdc00 && uc[i+1].unicode() < 0xe000) + if (uc[i].isHighSurrogate() && i < (len - 1) && uc[i + 1].isLowSurrogate()) goto nsm; // ### correctly handle second surrogate } -- cgit v1.2.3