summaryrefslogtreecommitdiffstats
path: root/src/kernel/qscriptengine.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/kernel/qscriptengine.cpp')
-rw-r--r--src/kernel/qscriptengine.cpp21
1 files changed, 16 insertions, 5 deletions
diff --git a/src/kernel/qscriptengine.cpp b/src/kernel/qscriptengine.cpp
index cc454d72f..93ffc0e7d 100644
--- a/src/kernel/qscriptengine.cpp
+++ b/src/kernel/qscriptengine.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;