summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qunicodetools_p.h
diff options
context:
space:
mode:
authorKonstantin Ritt <ritt.ks@gmail.com>2012-09-25 23:55:54 +0300
committerThe Qt Project <gerrit-noreply@qt-project.org>2012-09-26 03:09:57 +0200
commita798b956b9786240a06142de078f56c28962a535 (patch)
tree2c96818276618e64fffda7e469ae54641c717a1b /src/corelib/tools/qunicodetools_p.h
parentaeb21c73c5e4fc585340145374800a5e285e7ab7 (diff)
QCharAttributes: add wordStart/wordEnd flags
A simple heuristic is used to detect the word beginning and ending by looking at the word break property value of surrounding characters. This behaves better than the white-spaces based implementation used before and makes it possible to tailor the default algorithm for complex scripts. BIG FAT WARNING: The QCharAttributes buffer now has to have a length of string length + 1 for the flags at end of text. Task-Id: QTBUG-6498 Change-Id: I5589b191ffde6a50d2af0c14a00430d3852c67b4 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Diffstat (limited to 'src/corelib/tools/qunicodetools_p.h')
-rw-r--r--src/corelib/tools/qunicodetools_p.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/corelib/tools/qunicodetools_p.h b/src/corelib/tools/qunicodetools_p.h
index 91028b6b51..b1e9127662 100644
--- a/src/corelib/tools/qunicodetools_p.h
+++ b/src/corelib/tools/qunicodetools_p.h
@@ -64,7 +64,9 @@ struct Q_PACKED QCharAttributes
uchar sentenceBoundary : 1;
uchar lineBreak : 1;
uchar whiteSpace : 1;
- uchar unused : 3;
+ uchar wordStart : 1;
+ uchar wordEnd : 1;
+ uchar unused : 1;
};
Q_DECLARE_TYPEINFO(QCharAttributes, Q_PRIMITIVE_TYPE);
@@ -89,6 +91,7 @@ enum CharAttributeOption {
};
Q_DECLARE_FLAGS(CharAttributeOptions, CharAttributeOption)
+// attributes buffer has to have a length of string length + 1
Q_CORE_EXPORT void initCharAttributes(const ushort *string, int length,
const ScriptItem *items, int numItems,
QCharAttributes *attributes, CharAttributeOptions options = DefaultOptionsCompat);