diff options
| author | Michele Calgaro <michele.calgaro@yahoo.it> | 2025-02-04 17:59:57 +0900 |
|---|---|---|
| committer | Michele Calgaro <michele.calgaro@yahoo.it> | 2025-02-09 19:21:03 +0900 |
| commit | 486aa07930e7b6e900f77e64726c8cc4110511d8 (patch) | |
| tree | 8b8d515be0f9d860bd46d778977b6beab732120d /src/kernel/tqscriptengine.cpp | |
| parent | 46f42bcd5a6e2ad99fe842432279e529adce890a (diff) | |
| download | tqt-486aa07930e7b6e900f77e64726c8cc4110511d8.tar.gz tqt-486aa07930e7b6e900f77e64726c8cc4110511d8.zip | |
Extend work on supporting surrogate characters done in commit e0a38072
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
Diffstat (limited to 'src/kernel/tqscriptengine.cpp')
| -rw-r--r-- | src/kernel/tqscriptengine.cpp | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/src/kernel/tqscriptengine.cpp b/src/kernel/tqscriptengine.cpp index 588596716..36df1fa77 100644 --- a/src/kernel/tqscriptengine.cpp +++ b/src/kernel/tqscriptengine.cpp @@ -288,10 +288,21 @@ static void heuristicSetGlyphAttributes(TQShaperItem *item, const TQChar *uc, in Q_ASSERT(item->num_glyphs <= length); unsigned short *logClusters = item->log_clusters; - - int i; - for (i = 0; i < length; ++i) - logClusters[i] = i; + int glyph_pos = 0; + for (int i = 0; i < length; i++) + { + if (uc[i].isHighSurrogate() && i < (length - 1) && uc[i+1].isLowSurrogate()) + { + logClusters[i] = glyph_pos; + logClusters[++i] = glyph_pos; + } + else + { + logClusters[i] = glyph_pos; + } + ++glyph_pos; + } + Q_ASSERT(glyph_pos == item->num_glyphs); // first char in a run is never (treated as) a mark int cStart = 0; @@ -307,7 +318,7 @@ static void heuristicSetGlyphAttributes(TQShaperItem *item, const TQChar *uc, in } int lastCat = ::category(uc[0]); - for (i = 1; i < length; ++i) { + for (int i = 1; i < length; ++i) { int cat = ::category(uc[i]); if (qIsZeroWidthChar(uc[i].unicode())) { item->attributes[i].mark = FALSE; |
