summaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2017-12-11 11:28:11 +0100
committerLars Knoll <lars.knoll@qt.io>2017-12-13 19:14:49 +0000
commit59febb49e45b009b740ff8b67bba30c4a285a2f2 (patch)
treeeb3928e8568ee7c7f2e5f59fb4091efc63c7e5a1 /util
parent457fe3e8e2f27d773032f4406d5f933ae155e8ff (diff)
Fix a bug in the generation of the Unicode joining property data
The code that was supposed to initialize the joining property of characters to the correct defaults was actually applied after reading in the data from the Unicode file, and was in a couple of cases overwriting explicitly specified data in ArabicShaping.txt Task-number: QTBUG-63191 Change-Id: Ie35261039b2211a827322ca11afacd9555ccefc7 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Diffstat (limited to 'util')
-rw-r--r--util/unicode/main.cpp30
1 files changed, 16 insertions, 14 deletions
diff --git a/util/unicode/main.cpp b/util/unicode/main.cpp
index c995a40343..fe6d4fbca1 100644
--- a/util/unicode/main.cpp
+++ b/util/unicode/main.cpp
@@ -1293,6 +1293,18 @@ static void readArabicShaping()
{
qDebug("Reading ArabicShaping.txt");
+ // Initialize defaults:
+ // Code points that are not explicitly listed in ArabicShaping.txt are either of joining type T or U:
+ // - Those that not explicitly listed that are of General Category Mn, Me, or Cf have joining type T.
+ // - All others not explicitly listed have joining type U.
+ for (int codepoint = 0; codepoint <= QChar::LastValidCodePoint; ++codepoint) {
+ UnicodeData &d = UnicodeData::valueRef(codepoint);
+ if (d.p.joining == QChar::Joining_None) {
+ if (d.p.category == QChar::Mark_NonSpacing || d.p.category == QChar::Mark_Enclosing || d.p.category == QChar::Other_Format)
+ d.p.joining = QChar::Joining_Transparent;
+ }
+ }
+
QFile f("data/ArabicShaping.txt");
if (!f.exists())
qFatal("Couldn't find ArabicShaping.txt");
@@ -1338,17 +1350,6 @@ static void readArabicShaping()
break;
}
}
-
- // Code points that are not explicitly listed in ArabicShaping.txt are either of joining type T or U:
- // - Those that not explicitly listed that are of General Category Mn, Me, or Cf have joining type T.
- // - All others not explicitly listed have joining type U.
- for (int codepoint = 0; codepoint <= QChar::LastValidCodePoint; ++codepoint) {
- UnicodeData &d = UnicodeData::valueRef(codepoint);
- if (d.p.joining == QChar::Joining_None) {
- if (d.p.category == QChar::Mark_NonSpacing || d.p.category == QChar::Mark_Enclosing || d.p.category == QChar::Other_Format)
- d.p.joining = QChar::Joining_Transparent;
- }
- }
}
static void readDerivedAge()
@@ -2525,7 +2526,7 @@ static QByteArray createSpecialCaseMap()
out.chop(1);
out += "\n};\n\n";
- qDebug(" memory usage: %d bytes", specialCaseMap.size()*sizeof(unsigned short));
+ qDebug(" memory usage: %ld bytes", specialCaseMap.size()*sizeof(unsigned short));
return out;
}
@@ -3021,7 +3022,7 @@ int main(int, char **)
"****************************************************************************/\n\n";
QByteArray note =
- "/* This file is autogenerated from the Unicode "DATA_VERSION_S" database. Do not edit */\n\n";
+ "/* This file is autogenerated from the Unicode " DATA_VERSION_S " database. Do not edit */\n\n";
QByteArray warning =
"//\n"
@@ -3062,9 +3063,10 @@ int main(int, char **)
f.write(warning);
f.write("#ifndef QUNICODETABLES_P_H\n"
"#define QUNICODETABLES_P_H\n\n"
+ "#include <QtCore/private/qglobal_p.h>\n\n"
"#include <QtCore/qchar.h>\n\n"
"QT_BEGIN_NAMESPACE\n\n");
- f.write("#define UNICODE_DATA_VERSION "DATA_VERSION_STR"\n\n");
+ f.write("#define UNICODE_DATA_VERSION " DATA_VERSION_STR "\n\n");
f.write("namespace QUnicodeTables {\n\n");
f.write(property_string);
f.write(grapheme_break_class_string);