From 249442f44ac5ffabc91276307f8ae7a749f74eb1 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Mon, 14 Jun 2010 14:45:01 +0200 Subject: Fix issues with thai line breaking Merge latest harfbuzz: commit cce760d41f115fecd5b9b6b20b62883b10a9c204 Author: Lars Knoll Date: Mon Jun 14 14:14:59 2010 +0200 Fixes for thai linebreaking * Load libthai.so.0 since libthai.so is not there on all systems * Remove dependency on codecs. Unicode->TIS620 is so simple we can simply hardcode it in harbuzz-thai.c * Speed up detection of word boundaries * Falback when libthai is not found is now to not break instead of breaking after every character (in line with recommendations from unicode.org linebreaking algorithm) Reviewed-by: Simon Hausmann Adapt qharfbuzz.cpp to the changes in harfbuzz. Reviewed-by: Simon Hausmann --- src/3rdparty/harfbuzz/src/harfbuzz-external.h | 6 +- src/3rdparty/harfbuzz/src/harfbuzz-shaper.cpp | 13 ++--- src/3rdparty/harfbuzz/src/harfbuzz-thai.c | 64 +++++++++++++++------- .../harfbuzz/tests/linebreaking/harfbuzz-qt.cpp | 25 +-------- src/corelib/tools/qharfbuzz.cpp | 34 +----------- 5 files changed, 53 insertions(+), 89 deletions(-) diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-external.h b/src/3rdparty/harfbuzz/src/harfbuzz-external.h index 760749b..7644f0d 100644 --- a/src/3rdparty/harfbuzz/src/harfbuzz-external.h +++ b/src/3rdparty/harfbuzz/src/harfbuzz-external.h @@ -146,11 +146,7 @@ HB_CharCategory HB_GetUnicodeCharCategory(HB_UChar32 ch); int HB_GetUnicodeCharCombiningClass(HB_UChar32 ch); HB_UChar16 HB_GetMirroredChar(HB_UChar16 ch); -void *HB_Library_Resolve(const char *library, const char *symbol); - -void *HB_TextCodecForMib(int mib); -char *HB_TextCodec_ConvertFromUnicode(void *codec, const HB_UChar16 *unicode, hb_uint32 length, hb_uint32 *outputLength); -void HB_TextCodec_FreeResult(char *); +void *HB_Library_Resolve(const char *library, int version, const char *symbol); HB_END_HEADER diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-shaper.cpp b/src/3rdparty/harfbuzz/src/harfbuzz-shaper.cpp index bfc7bd4..ff69304 100644 --- a/src/3rdparty/harfbuzz/src/harfbuzz-shaper.cpp +++ b/src/3rdparty/harfbuzz/src/harfbuzz-shaper.cpp @@ -183,18 +183,15 @@ static void calcLineBreaks(const HB_UChar16 *uc, hb_uint32 len, HB_CharAttribute if (ncls >= HB_LineBreak_CR) goto next; - // two complex chars (thai or lao), thai_attributes might override, but here we do a best guess - if (cls == HB_LineBreak_SA && ncls == HB_LineBreak_SA) { - lineBreakType = HB_Break; - goto next; - } - { int tcls = ncls; + // for south east asian chars that require a complex (dictionary analysis), the unicode + // standard recommends to treat them as AL. thai_attributes and other attribute methods that + // do dictionary analysis can override if (tcls >= HB_LineBreak_SA) - tcls = HB_LineBreak_ID; + tcls = HB_LineBreak_AL; if (cls >= HB_LineBreak_SA) - cls = HB_LineBreak_ID; + cls = HB_LineBreak_AL; int brk = breakTable[cls][tcls]; switch (brk) { diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-thai.c b/src/3rdparty/harfbuzz/src/harfbuzz-thai.c index 1d1aa2f..fc2bdbf 100644 --- a/src/3rdparty/harfbuzz/src/harfbuzz-thai.c +++ b/src/3rdparty/harfbuzz/src/harfbuzz-thai.c @@ -27,57 +27,79 @@ #include "harfbuzz-external.h" #include +#include + +typedef int (*th_brk_def)(const char*, int[], int); +static th_brk_def th_brk = 0; +static int libthai_resolved = 0; + +static void resolve_libthai() +{ + if (!th_brk) + th_brk = (th_brk_def)HB_Library_Resolve("thai", 0, "th_brk"); + libthai_resolved = 1; +} + +static void to_tis620(const HB_UChar16 *string, hb_uint32 len, const char *cstr) +{ + hb_uint32 i; + unsigned char *result = (unsigned char *)cstr; + + for (i = 0; i < len; ++i) { + if (string[i] <= 0xa0) + result[i] = (unsigned char)string[i]; + if (string[i] >= 0xe01 && string[i] <= 0xe5b) + result[i] = (unsigned char)(string[i] - 0xe00 + 0xa0); + else + result[i] = '?'; + } +} static void thaiWordBreaks(const HB_UChar16 *string, hb_uint32 len, HB_CharAttributes *attributes) { - typedef int (*th_brk_def)(const char*, int[], int); - static void *thaiCodec = 0; - static th_brk_def th_brk = 0; - char *cstr = 0; + char s[128]; + char *cstr = s; int brp[128]; int *break_positions = brp; hb_uint32 numbreaks; hb_uint32 i; - if (!thaiCodec) - thaiCodec = HB_TextCodecForMib(2259); - - /* load libthai dynamically */ - if (!th_brk && thaiCodec) { - th_brk = (th_brk_def)HB_Library_Resolve("thai", "th_brk"); - if (!th_brk) - thaiCodec = 0; - } + if (!libthai_resolved) + resolve_libthai(); if (!th_brk) return; - cstr = HB_TextCodec_ConvertFromUnicode(thaiCodec, string, len, 0); - if (!cstr) - return; + if (len > 128) + cstr = (char *)malloc(len*sizeof(char)); + + to_tis620(string, len, cstr); - break_positions = brp; numbreaks = th_brk(cstr, break_positions, 128); if (numbreaks > 128) { break_positions = (int *)malloc(numbreaks * sizeof(int)); numbreaks = th_brk(cstr, break_positions, numbreaks); } - for (i = 0; i < len; ++i) + for (i = 0; i < len; ++i) { attributes[i].lineBreakType = HB_NoBreak; + attributes[i].wordBoundary = FALSE; + } for (i = 0; i < numbreaks; ++i) { - if (break_positions[i] > 0) + if (break_positions[i] > 0) { attributes[break_positions[i]-1].lineBreakType = HB_Break; + attributes[i].wordBoundary = TRUE; + } } if (break_positions != brp) free(break_positions); - HB_TextCodec_FreeResult(cstr); + if (len > 128) + free(cstr); } - void HB_ThaiAttributes(HB_Script script, const HB_UChar16 *text, hb_uint32 from, hb_uint32 len, HB_CharAttributes *attributes) { assert(script == HB_Script_Thai); diff --git a/src/3rdparty/harfbuzz/tests/linebreaking/harfbuzz-qt.cpp b/src/3rdparty/harfbuzz/tests/linebreaking/harfbuzz-qt.cpp index ea03052..f0048b7 100644 --- a/src/3rdparty/harfbuzz/tests/linebreaking/harfbuzz-qt.cpp +++ b/src/3rdparty/harfbuzz/tests/linebreaking/harfbuzz-qt.cpp @@ -79,30 +79,9 @@ void HB_GetGraphemeAndLineBreakClass(HB_UChar32 ch, HB_GraphemeClass *grapheme, *lineBreak = (HB_LineBreakClass) prop->line_break_class; } -void *HB_Library_Resolve(const char *library, const char *symbol) +void *HB_Library_Resolve(const char *library, int version, const char *symbol) { - return QLibrary::resolve(library, symbol); -} - -void *HB_TextCodecForMib(int mib) -{ - return QTextCodec::codecForMib(mib); -} - -char *HB_TextCodec_ConvertFromUnicode(void *codec, const HB_UChar16 *unicode, hb_uint32 length, hb_uint32 *outputLength) -{ - QByteArray data = reinterpret_cast(codec)->fromUnicode((const QChar *)unicode, length); - // ### suboptimal - char *output = (char *)malloc(data.length() + 1); - memcpy(output, data.constData(), data.length() + 1); - if (outputLength) - *outputLength = data.length(); - return output; -} - -void HB_TextCodec_FreeResult(char *string) -{ - free(string); + return QLibrary::resolve(library, version, symbol); } } diff --git a/src/corelib/tools/qharfbuzz.cpp b/src/corelib/tools/qharfbuzz.cpp index 1b6d334..9166a14 100644 --- a/src/corelib/tools/qharfbuzz.cpp +++ b/src/corelib/tools/qharfbuzz.cpp @@ -102,45 +102,15 @@ HB_UChar16 HB_GetMirroredChar(HB_UChar16 ch) return QChar::mirroredChar(ch); } -void *HB_Library_Resolve(const char *library, const char *symbol) +void *HB_Library_Resolve(const char *library, int version, const char *symbol) { #ifdef QT_NO_LIBRARY return 0; #else - return QLibrary::resolve(QLatin1String(library), symbol); + return QLibrary::resolve(QLatin1String(library), version, symbol); #endif } -void *HB_TextCodecForMib(int mib) -{ -#ifndef QT_NO_TEXTCODEC - return QTextCodec::codecForMib(mib); -#else - return 0; -#endif -} - -char *HB_TextCodec_ConvertFromUnicode(void *codec, const HB_UChar16 *unicode, hb_uint32 length, hb_uint32 *outputLength) -{ -#ifndef QT_NO_TEXTCODEC - QByteArray data = reinterpret_cast(codec)->fromUnicode((const QChar *)unicode, length); - // ### suboptimal - char *output = (char *)malloc(data.length() + 1); - Q_CHECK_PTR(output); - memcpy(output, data.constData(), data.length() + 1); - if (outputLength) - *outputLength = data.length(); - return output; -#else - return 0; -#endif -} - -void HB_TextCodec_FreeResult(char *string) -{ - free(string); -} - } // extern "C" QT_BEGIN_NAMESPACE -- cgit v0.12 From d3cd976b8eb3de15a07b0ca9280731958a0147d8 Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Tue, 15 Jun 2010 14:44:51 +1000 Subject: Bump version number after 4.6.3 release. Reviewed-by: Trust Me --- src/corelib/global/qglobal.h | 4 ++-- src/plugins/qpluginbase.pri | 2 +- src/qbase.pri | 2 +- tests/auto/mediaobject/dummy/dummy.pro | 2 +- tests/auto/selftests/expected_badxml.txt | 2 +- tests/auto/selftests/expected_cmptest.txt | 2 +- tests/auto/selftests/expected_crashes_3.txt | 2 +- tests/auto/selftests/expected_longstring.txt | 2 +- tests/auto/selftests/expected_maxwarnings.txt | 2 +- tests/auto/selftests/expected_skip.txt | 2 +- tests/auto/selftests/expected_xunit.txt | 2 +- tests/auto/uic/baseline/config_fromuic3.ui.h | 2 +- tools/assistant/tools/assistant/doc/assistant.qdocconf | 2 +- tools/qdoc3/test/assistant.qdocconf | 2 +- tools/qdoc3/test/designer.qdocconf | 2 +- tools/qdoc3/test/linguist.qdocconf | 2 +- tools/qdoc3/test/qmake.qdocconf | 2 +- tools/qdoc3/test/qt-build-docs.qdocconf | 6 +++--- tools/qdoc3/test/qt.qdocconf | 6 +++--- 19 files changed, 24 insertions(+), 24 deletions(-) diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index 7825f82..ef82b3f 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -44,11 +44,11 @@ #include -#define QT_VERSION_STR "4.6.3" +#define QT_VERSION_STR "4.6.4" /* QT_VERSION is (major << 16) + (minor << 8) + patch. */ -#define QT_VERSION 0x040603 +#define QT_VERSION 0x040604 /* can be used like #if (QT_VERSION >= QT_VERSION_CHECK(4, 4, 0)) */ diff --git a/src/plugins/qpluginbase.pri b/src/plugins/qpluginbase.pri index f6a8f87..7eecf03 100644 --- a/src/plugins/qpluginbase.pri +++ b/src/plugins/qpluginbase.pri @@ -1,6 +1,6 @@ TEMPLATE = lib isEmpty(QT_MAJOR_VERSION) { - VERSION=4.6.3 + VERSION=4.6.4 } else { VERSION=$${QT_MAJOR_VERSION}.$${QT_MINOR_VERSION}.$${QT_PATCH_VERSION} } diff --git a/src/qbase.pri b/src/qbase.pri index 59beaab..0452dc9 100644 --- a/src/qbase.pri +++ b/src/qbase.pri @@ -4,7 +4,7 @@ INCLUDEPATH *= $$QMAKE_INCDIR_QT/$$TARGET #just for today to have some compat isEmpty(QT_ARCH):!isEmpty(ARCH):QT_ARCH=$$ARCH #another compat that will rot for change #215700 TEMPLATE = lib isEmpty(QT_MAJOR_VERSION) { - VERSION=4.6.3 + VERSION=4.6.4 } else { VERSION=$${QT_MAJOR_VERSION}.$${QT_MINOR_VERSION}.$${QT_PATCH_VERSION} } diff --git a/tests/auto/mediaobject/dummy/dummy.pro b/tests/auto/mediaobject/dummy/dummy.pro index cf1010e..88b864b 100644 --- a/tests/auto/mediaobject/dummy/dummy.pro +++ b/tests/auto/mediaobject/dummy/dummy.pro @@ -1,7 +1,7 @@ TEMPLATE = lib isEmpty(QT_MAJOR_VERSION) { - VERSION=4.6.3 + VERSION=4.6.4 } else { VERSION=$${QT_MAJOR_VERSION}.$${QT_MINOR_VERSION}.$${QT_PATCH_VERSION} } diff --git a/tests/auto/selftests/expected_badxml.txt b/tests/auto/selftests/expected_badxml.txt index 046f1b2..bc9d203 100644 --- a/tests/auto/selftests/expected_badxml.txt +++ b/tests/auto/selftests/expected_badxml.txt @@ -1,5 +1,5 @@ ********* Start testing of tst_BadXml ********* -Config: Using QTest library 4.6.3, Qt 4.6.3 +Config: Using QTest library 4.6.4, Qt 4.6.4 PASS : tst_BadXml::initTestCase() QDEBUG : tst_BadXml::badDataTag(end cdata ]]> text ]]> more text) a message FAIL! : tst_BadXml::badDataTag(end cdata ]]> text ]]> more text) a failure diff --git a/tests/auto/selftests/expected_cmptest.txt b/tests/auto/selftests/expected_cmptest.txt index 18d4cce..2ee3005 100644 --- a/tests/auto/selftests/expected_cmptest.txt +++ b/tests/auto/selftests/expected_cmptest.txt @@ -1,5 +1,5 @@ ********* Start testing of tst_Cmptest ********* -Config: Using QTest library 4.6.3, Qt 4.6.3 +Config: Using QTest library 4.6.4, Qt 4.6.4 PASS : tst_Cmptest::initTestCase() PASS : tst_Cmptest::compare_boolfuncs() PASS : tst_Cmptest::compare_pointerfuncs() diff --git a/tests/auto/selftests/expected_crashes_3.txt b/tests/auto/selftests/expected_crashes_3.txt index 71d79ca..60914f8 100644 --- a/tests/auto/selftests/expected_crashes_3.txt +++ b/tests/auto/selftests/expected_crashes_3.txt @@ -1,5 +1,5 @@ ********* Start testing of tst_Crashes ********* -Config: Using QTest library 4.6.3, Qt 4.6.3 +Config: Using QTest library 4.6.4, Qt 4.6.4 PASS : tst_Crashes::initTestCase() QFATAL : tst_Crashes::crash() Received signal 11 FAIL! : tst_Crashes::crash() Received a fatal error. diff --git a/tests/auto/selftests/expected_longstring.txt b/tests/auto/selftests/expected_longstring.txt index c451daf..566e43f 100644 --- a/tests/auto/selftests/expected_longstring.txt +++ b/tests/auto/selftests/expected_longstring.txt @@ -1,5 +1,5 @@ ********* Start testing of tst_LongString ********* -Config: Using QTest library 4.6.3, Qt 4.6.3 +Config: Using QTest library 4.6.4, Qt 4.6.4 PASS : tst_LongString::initTestCase() FAIL! : tst_LongString::failWithLongString() Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi. Aenean vulputate eleifend tellus. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra quis, feugiat a, tellus. Phasellus viverra nulla ut metus varius laoreet. Quisque rutrum. Aenean imperdiet. Etiam ultricies nisi vel augue. Curabitur ullamcorper ultricies nisi. Nam eget dui. diff --git a/tests/auto/selftests/expected_maxwarnings.txt b/tests/auto/selftests/expected_maxwarnings.txt index 0da1799..5fb7f58 100644 --- a/tests/auto/selftests/expected_maxwarnings.txt +++ b/tests/auto/selftests/expected_maxwarnings.txt @@ -1,5 +1,5 @@ ********* Start testing of MaxWarnings ********* -Config: Using QTest library 4.6.3, Qt 4.6.3 +Config: Using QTest library 4.6.4, Qt 4.6.4 PASS : MaxWarnings::initTestCase() QWARN : MaxWarnings::warn() 0 QWARN : MaxWarnings::warn() 1 diff --git a/tests/auto/selftests/expected_skip.txt b/tests/auto/selftests/expected_skip.txt index 32247e6..650d816 100644 --- a/tests/auto/selftests/expected_skip.txt +++ b/tests/auto/selftests/expected_skip.txt @@ -1,5 +1,5 @@ ********* Start testing of tst_Skip ********* -Config: Using QTest library 4.6.3, Qt 4.6.3 +Config: Using QTest library 4.6.4, Qt 4.6.4 PASS : tst_Skip::initTestCase() SKIP : tst_Skip::test() skipping all Loc: [/home/user/depot/qt-git/mainline/tests/auto/selftests/skip/tst_skip.cpp(68)] diff --git a/tests/auto/selftests/expected_xunit.txt b/tests/auto/selftests/expected_xunit.txt index 02cfa6f..ac8c0db 100644 --- a/tests/auto/selftests/expected_xunit.txt +++ b/tests/auto/selftests/expected_xunit.txt @@ -1,5 +1,5 @@ ********* Start testing of tst_Xunit ********* -Config: Using QTest library 4.6.3, Qt 4.6.3 +Config: Using QTest library 4.6.4, Qt 4.6.4 PASS : tst_Xunit::initTestCase() WARNING: tst_Xunit::testFunc1() just a QWARN() ! PASS : tst_Xunit::testFunc1() diff --git a/tests/auto/uic/baseline/config_fromuic3.ui.h b/tests/auto/uic/baseline/config_fromuic3.ui.h index c77b303..5df45e6 100644 --- a/tests/auto/uic/baseline/config_fromuic3.ui.h +++ b/tests/auto/uic/baseline/config_fromuic3.ui.h @@ -45,7 +45,7 @@ ** Form generated from reading UI file 'config_fromuic3.ui' ** ** Created: Thu Dec 17 12:48:42 2009 -** by: Qt User Interface Compiler version 4.6.3 +** by: Qt User Interface Compiler version 4.6.4 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ diff --git a/tools/assistant/tools/assistant/doc/assistant.qdocconf b/tools/assistant/tools/assistant/doc/assistant.qdocconf index 365613b..3f192c0 100644 --- a/tools/assistant/tools/assistant/doc/assistant.qdocconf +++ b/tools/assistant/tools/assistant/doc/assistant.qdocconf @@ -12,5 +12,5 @@ HTML.footer = "


\n" \ "\n" \ "\n" \ "\n" \ - "\n" \ + "\n" \ "
Copyright © 2010 Nokia Corporation and/or its subsidiary(-ies)Trademarks
Qt 4.6.3
Qt 4.6.4
" diff --git a/tools/qdoc3/test/assistant.qdocconf b/tools/qdoc3/test/assistant.qdocconf index f03d970..91c7cd4 100644 --- a/tools/qdoc3/test/assistant.qdocconf +++ b/tools/qdoc3/test/assistant.qdocconf @@ -17,7 +17,7 @@ qhp.Assistant.namespace = com.trolltech.assistant.460 qhp.Assistant.virtualFolder = qdoc qhp.Assistant.indexTitle = Qt Assistant Manual qhp.Assistant.extraFiles = classic.css images/qt-logo.png images/trolltech-logo.png -qhp.Assistant.filterAttributes = qt 4.6.3 tools assistant +qhp.Assistant.filterAttributes = qt 4.6.4 tools assistant qhp.Assistant.customFilters.Assistant.name = Qt Assistant Manual qhp.Assistant.customFilters.Assistant.filterAttributes = qt tools assistant qhp.Assistant.subprojects = manual examples diff --git a/tools/qdoc3/test/designer.qdocconf b/tools/qdoc3/test/designer.qdocconf index 0c3e05b..69024d1 100644 --- a/tools/qdoc3/test/designer.qdocconf +++ b/tools/qdoc3/test/designer.qdocconf @@ -17,7 +17,7 @@ qhp.Designer.namespace = com.trolltech.designer.460 qhp.Designer.virtualFolder = qdoc qhp.Designer.indexTitle = Qt Designer Manual qhp.Designer.extraFiles = classic.css images/qt-logo.png images/trolltech-logo.png -qhp.Designer.filterAttributes = qt 4.6.3 tools designer +qhp.Designer.filterAttributes = qt 4.6.4 tools designer qhp.Designer.customFilters.Designer.name = Qt Designer Manual qhp.Designer.customFilters.Designer.filterAttributes = qt tools designer qhp.Designer.subprojects = manual examples diff --git a/tools/qdoc3/test/linguist.qdocconf b/tools/qdoc3/test/linguist.qdocconf index 739f4af..d8b90a7 100644 --- a/tools/qdoc3/test/linguist.qdocconf +++ b/tools/qdoc3/test/linguist.qdocconf @@ -17,7 +17,7 @@ qhp.Linguist.namespace = com.trolltech.linguist.460 qhp.Linguist.virtualFolder = qdoc qhp.Linguist.indexTitle = Qt Linguist Manual qhp.Linguist.extraFiles = classic.css images/qt-logo.png images/trolltech-logo.png -qhp.Linguist.filterAttributes = qt 4.6.3 tools linguist +qhp.Linguist.filterAttributes = qt 4.6.4 tools linguist qhp.Linguist.customFilters.Linguist.name = Qt Linguist Manual qhp.Linguist.customFilters.Linguist.filterAttributes = qt tools linguist qhp.Linguist.subprojects = manual examples diff --git a/tools/qdoc3/test/qmake.qdocconf b/tools/qdoc3/test/qmake.qdocconf index 696949e..28fc49a 100644 --- a/tools/qdoc3/test/qmake.qdocconf +++ b/tools/qdoc3/test/qmake.qdocconf @@ -17,7 +17,7 @@ qhp.qmake.namespace = com.trolltech.qmake.460 qhp.qmake.virtualFolder = qdoc qhp.qmake.indexTitle = QMake Manual qhp.qmake.extraFiles = classic.css images/qt-logo.png images/trolltech-logo.png -qhp.qmake.filterAttributes = qt 4.6.3 tools qmake +qhp.qmake.filterAttributes = qt 4.6.4 tools qmake qhp.qmake.customFilters.qmake.name = qmake Manual qhp.qmake.customFilters.qmake.filterAttributes = qt tools qmake qhp.qmake.subprojects = manual diff --git a/tools/qdoc3/test/qt-build-docs.qdocconf b/tools/qdoc3/test/qt-build-docs.qdocconf index d7a06b8..3570816 100644 --- a/tools/qdoc3/test/qt-build-docs.qdocconf +++ b/tools/qdoc3/test/qt-build-docs.qdocconf @@ -32,9 +32,9 @@ qhp.Qt.extraFiles = classic.css \ images/dynamiclayouts-example.png \ images/stylesheet-coffee-plastique.png -qhp.Qt.filterAttributes = qt 4.6.3 qtrefdoc -qhp.Qt.customFilters.Qt.name = Qt 4.6.3 -qhp.Qt.customFilters.Qt.filterAttributes = qt 4.6.3 +qhp.Qt.filterAttributes = qt 4.6.4 qtrefdoc +qhp.Qt.customFilters.Qt.name = Qt 4.6.4 +qhp.Qt.customFilters.Qt.filterAttributes = qt 4.6.4 qhp.Qt.subprojects = classes overviews examples qhp.Qt.subprojects.classes.title = Classes qhp.Qt.subprojects.classes.indexTitle = Qt's Classes diff --git a/tools/qdoc3/test/qt.qdocconf b/tools/qdoc3/test/qt.qdocconf index d5a2995..b8dbcd1 100644 --- a/tools/qdoc3/test/qt.qdocconf +++ b/tools/qdoc3/test/qt.qdocconf @@ -34,9 +34,9 @@ qhp.Qt.extraFiles = classic.css \ images/dynamiclayouts-example.png \ images/stylesheet-coffee-plastique.png -qhp.Qt.filterAttributes = qt 4.6.3 qtrefdoc -qhp.Qt.customFilters.Qt.name = Qt 4.6.3 -qhp.Qt.customFilters.Qt.filterAttributes = qt 4.6.3 +qhp.Qt.filterAttributes = qt 4.6.4 qtrefdoc +qhp.Qt.customFilters.Qt.name = Qt 4.6.4 +qhp.Qt.customFilters.Qt.filterAttributes = qt 4.6.4 qhp.Qt.subprojects = classes overviews examples qhp.Qt.subprojects.classes.title = Classes qhp.Qt.subprojects.classes.indexTitle = Qt's Classes -- cgit v0.12 From a8e6efd6086e3c7f2d88d22c9e4b1cd7e02a8d8f Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Tue, 15 Jun 2010 16:42:26 +1000 Subject: Add skeleton changes files for 4.6.4. Reviewed-by: Trust Me --- dist/changes-4.6.4 | 158 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 158 insertions(+) create mode 100644 dist/changes-4.6.4 diff --git a/dist/changes-4.6.4 b/dist/changes-4.6.4 new file mode 100644 index 0000000..381023f --- /dev/null +++ b/dist/changes-4.6.4 @@ -0,0 +1,158 @@ +Qt 4.6.4 is a bug-fix release. It maintains both forward and backward +compatibility (source and binary) with Qt 4.6.0. For more details, +refer to the online documentation included in this distribution. The +documentation is also available online: + + http://qt.nokia.com/doc/4.6 + +The Qt version 4.6 series is binary compatible with the 4.5.x series. +Applications compiled for 4.5 will continue to run with 4.6. + +Some of the changes listed in this file include issue tracking numbers +corresponding to tasks in the Qt Bug Tracker or the Merge Request queue +of the public source repository. + +Qt Bug Tracker: http://bugreports.qt.nokia.com +Merge Request: http://qt.gitorious.org + +**************************************************************************** +* General * +**************************************************************************** + +New features +------------ + + - SomeClass, SomeOtherClass + * New classes for foo, bar and baz + +Optimizations +------------- + + - Optimized foo in QSomeClass + * See list of Important Behavior Changes below + + +**************************************************************************** +* Library * +**************************************************************************** + +QtCore +------ + + - foo + * bar + +QtGui +----- + + - foo + * bar + +QtDBus +------ + + - foo + * bar + +QtNetwork +--------- + + - foo + * bar + +QtOpenGL +-------- + + - foo + * bar + +QtScript +-------- + + - foo + * bar + +QtSql +----- + + - foo + * bar + +QtXml +----- + + - foo + * bar + +Qt Plugins +---------- + + - foo + * bar + +Third party components +---------------------- + + - Updated foo to version 2.3.9. + + - Updated bar to the latest version from baz.org. + + +**************************************************************************** +* Platform Specific Changes * +**************************************************************************** + +Qt for Unix (X11 and Mac OS X) +------------------------------ + + - + +Qt for Linux/X11 +---------------- + + - + +Qt for Windows +-------------- + + - + +Qt for Mac OS X +--------------- + + - + +Qt for Embedded Linux +--------------------- + + - + +DirectFB +-------- + + - + +Qt for Windows CE +----------------- + + - + +**************************************************************************** +* Tools * +**************************************************************************** + + - Designer + * foo + + - qdoc3 + * bar + + - Linguist + * baz + +**************************************************************************** +* Important Behavior Changes * +**************************************************************************** + + - + -- cgit v0.12 From 6d9374686d8c41b89ce74836b76e157629c2f531 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Tue, 15 Jun 2010 16:23:50 +0200 Subject: Updated Harfbuzz from git+ssh://git.freedesktop.org/git/harfbuzz to 1313dc84678c74f1c24f910f702d7ed27a417607 This includes Andreas' changes to reduce the memory usage by packing and re-odering data structures as well as Lars' greek shaper. --- src/3rdparty/harfbuzz/src/Makefile.am | 3 +- src/3rdparty/harfbuzz/src/harfbuzz-buffer.h | 16 +- src/3rdparty/harfbuzz/src/harfbuzz-dump.c | 10 +- src/3rdparty/harfbuzz/src/harfbuzz-gdef-private.h | 25 +- src/3rdparty/harfbuzz/src/harfbuzz-gdef.c | 4 + src/3rdparty/harfbuzz/src/harfbuzz-gdef.h | 21 +- src/3rdparty/harfbuzz/src/harfbuzz-global.h | 4 + src/3rdparty/harfbuzz/src/harfbuzz-gpos-private.h | 35 +- src/3rdparty/harfbuzz/src/harfbuzz-gpos.c | 73 +++- src/3rdparty/harfbuzz/src/harfbuzz-gpos.h | 6 + src/3rdparty/harfbuzz/src/harfbuzz-greek.c | 447 +++++++++++++++++++++ src/3rdparty/harfbuzz/src/harfbuzz-gsub-private.h | 151 +++---- src/3rdparty/harfbuzz/src/harfbuzz-gsub.h | 23 +- src/3rdparty/harfbuzz/src/harfbuzz-hangul.c | 2 +- src/3rdparty/harfbuzz/src/harfbuzz-open-private.h | 6 +- src/3rdparty/harfbuzz/src/harfbuzz-open.c | 36 +- src/3rdparty/harfbuzz/src/harfbuzz-open.h | 48 ++- src/3rdparty/harfbuzz/src/harfbuzz-shaper-all.cpp | 1 + .../harfbuzz/src/harfbuzz-shaper-private.h | 1 + src/3rdparty/harfbuzz/src/harfbuzz-shaper.cpp | 2 +- src/3rdparty/harfbuzz/src/harfbuzz-shaper.h | 44 +- src/3rdparty/harfbuzz/src/harfbuzz-stream.h | 10 +- src/3rdparty/harfbuzz/tests/fuzzing/fuzz.cc | 124 ++++++ 23 files changed, 912 insertions(+), 180 deletions(-) create mode 100644 src/3rdparty/harfbuzz/src/harfbuzz-greek.c create mode 100644 src/3rdparty/harfbuzz/tests/fuzzing/fuzz.cc diff --git a/src/3rdparty/harfbuzz/src/Makefile.am b/src/3rdparty/harfbuzz/src/Makefile.am index 2b0fb1d..51d0652 100644 --- a/src/3rdparty/harfbuzz/src/Makefile.am +++ b/src/3rdparty/harfbuzz/src/Makefile.am @@ -12,7 +12,8 @@ MAINSOURCES = \ harfbuzz-impl.c \ harfbuzz-open.c \ harfbuzz-shaper.cpp \ - harfbuzz-tibetan.c \ + harfbuzz-greek.c \ + harfbuzz-tibetan.c \ harfbuzz-khmer.c \ harfbuzz-indic.cpp \ harfbuzz-hebrew.c \ diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-buffer.h b/src/3rdparty/harfbuzz/src/harfbuzz-buffer.h index b134407..0d7c2c2 100644 --- a/src/3rdparty/harfbuzz/src/harfbuzz-buffer.h +++ b/src/3rdparty/harfbuzz/src/harfbuzz-buffer.h @@ -32,6 +32,10 @@ HB_BEGIN_HEADER +#ifdef HB_USE_PACKED_STRUCTS +#pragma pack(push, 1) +#endif + typedef struct HB_GlyphItemRec_ { HB_UInt gindex; HB_UInt properties; @@ -48,13 +52,13 @@ typedef struct HB_PositionRec_ { HB_Fixed y_advance; HB_UShort back; /* number of glyphs to go back for drawing current glyph */ + HB_Short cursive_chain; /* character to which this connects, + may be positive or negative; used + only internally */ HB_Bool new_advance; /* if set, the advance width values are absolute, i.e., they won't be added to the original glyph's value but rather replace them. */ - HB_Short cursive_chain; /* character to which this connects, - may be positive or negative; used - only internally */ } HB_PositionRec, *HB_Position; @@ -66,12 +70,12 @@ typedef struct HB_BufferRec_{ HB_UInt in_pos; HB_UInt out_pos; - HB_Bool separate_out; HB_GlyphItem in_string; HB_GlyphItem out_string; HB_GlyphItem alt_string; HB_Position positions; HB_UShort max_ligID; + HB_Bool separate_out; } HB_BufferRec, *HB_Buffer; HB_Error @@ -89,6 +93,10 @@ hb_buffer_add_glyph( HB_Buffer buffer, HB_UInt properties, HB_UInt cluster ); +#ifdef HB_USE_PACKED_STRUCTS +#pragma pack(pop) +#endif + HB_END_HEADER #endif /* HARFBUZZ_BUFFER_H */ diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-dump.c b/src/3rdparty/harfbuzz/src/harfbuzz-dump.c index 8c81da1..a1ef6b6 100644 --- a/src/3rdparty/harfbuzz/src/harfbuzz-dump.c +++ b/src/3rdparty/harfbuzz/src/harfbuzz-dump.c @@ -519,13 +519,14 @@ Dump_ValueRecord (HB_ValueRecord *ValueRecord, FILE *stream, int indent, HB_Type if (value_format & HB_GPOS_FORMAT_HAVE_Y_ADVANCE) DUMP_FINT (ValueRecord, XAdvance); if (value_format & HB_GPOS_FORMAT_HAVE_X_PLACEMENT_DEVICE) - RECURSE (Device, Device, &ValueRecord->XPlacementDevice); + RECURSE (Device, Device, &*ValueRecord->XPlacementDevice); if (value_format & HB_GPOS_FORMAT_HAVE_Y_PLACEMENT_DEVICE) - RECURSE (Device, Device, &ValueRecord->YPlacementDevice); + RECURSE (Device, Device, &*ValueRecord->YPlacementDevice); if (value_format & HB_GPOS_FORMAT_HAVE_X_ADVANCE_DEVICE) - RECURSE (Device, Device, &ValueRecord->XAdvanceDevice); + RECURSE (Device, Device, &*ValueRecord->XAdvanceDevice); if (value_format & HB_GPOS_FORMAT_HAVE_Y_ADVANCE_DEVICE) - RECURSE (Device, Device, &ValueRecord->YAdvanceDevice); + RECURSE (Device, Device, &*ValueRecord->YAdvanceDevice); +#ifdef HB_SUPPORT_MULTIPLE_MASTER if (value_format & HB_GPOS_FORMAT_HAVE_X_ID_PLACEMENT) DUMP_FUINT (ValueRecord, XIdPlacement); if (value_format & HB_GPOS_FORMAT_HAVE_Y_ID_PLACEMENT) @@ -534,6 +535,7 @@ Dump_ValueRecord (HB_ValueRecord *ValueRecord, FILE *stream, int indent, HB_Type DUMP_FUINT (ValueRecord, XIdAdvance); if (value_format & HB_GPOS_FORMAT_HAVE_Y_ID_ADVANCE) DUMP_FUINT (ValueRecord, XIdAdvance); +#endif } static void diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-gdef-private.h b/src/3rdparty/harfbuzz/src/harfbuzz-gdef-private.h index da06b6f..2a6d958 100644 --- a/src/3rdparty/harfbuzz/src/harfbuzz-gdef-private.h +++ b/src/3rdparty/harfbuzz/src/harfbuzz-gdef-private.h @@ -34,12 +34,16 @@ HB_BEGIN_HEADER +#ifdef HB_USE_PACKED_STRUCTS +#pragma pack(push, 1) +#endif + /* Attachment related structures */ struct HB_AttachPoint_ { - HB_UShort PointCount; /* size of the PointIndex array */ HB_UShort* PointIndex; /* array of contour points */ + HB_UShort PointCount; /* size of the PointIndex array */ }; /* Ligature Caret related structures */ @@ -62,32 +66,36 @@ typedef struct HB_CaretValueFormat2_ HB_CaretValueFormat2; struct HB_CaretValueFormat3_ { + HB_Device* Device; /* Device table for x or y value */ HB_Short Coordinate; /* x or y value (in design units) */ - HB_Device Device; /* Device table for x or y value */ }; typedef struct HB_CaretValueFormat3_ HB_CaretValueFormat3; +#ifdef HB_SUPPORT_MULTIPLE_MASTER struct HB_CaretValueFormat4_ { HB_UShort IdCaretValue; /* metric ID */ }; typedef struct HB_CaretValueFormat4_ HB_CaretValueFormat4; +#endif struct HB_CaretValue_ { - HB_UShort CaretValueFormat; /* 1, 2, 3, or 4 */ - union { HB_CaretValueFormat1 cvf1; HB_CaretValueFormat2 cvf2; HB_CaretValueFormat3 cvf3; +#ifdef HB_SUPPORT_MULTIPLE_MASTER HB_CaretValueFormat4 cvf4; +#endif } cvf; + + HB_Byte CaretValueFormat; /* 1, 2, 3, or 4 */ }; typedef struct HB_CaretValue_ HB_CaretValue; @@ -95,10 +103,9 @@ typedef struct HB_CaretValue_ HB_CaretValue; struct HB_LigGlyph_ { - HB_Bool loaded; - - HB_UShort CaretCount; /* number of caret values */ HB_CaretValue* CaretValue; /* array of caret values */ + HB_UShort CaretCount; /* number of caret values */ + HB_Bool loaded; }; @@ -119,6 +126,10 @@ _HB_GDEF_LoadMarkAttachClassDef_From_LookupFlags( HB_GDEFHeader* gdef, HB_Lookup* lo, HB_UShort num_lookups ); +#ifdef HB_USE_PACKED_STRUCTS +#pragma pack(pop) +#endif + HB_END_HEADER #endif /* HARFBUZZ_GDEF_PRIVATE_H */ diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-gdef.c b/src/3rdparty/harfbuzz/src/harfbuzz-gdef.c index ff3a1f4..c0c6f2c 100644 --- a/src/3rdparty/harfbuzz/src/harfbuzz-gdef.c +++ b/src/3rdparty/harfbuzz/src/harfbuzz-gdef.c @@ -442,7 +442,11 @@ static HB_Error Load_CaretValue( HB_CaretValue* cv, if ( ACCESS_Frame( 2L ) ) return error; +#ifdef HB_SUPPORT_MULTIPLE_MASTER cv->cvf.cvf4.IdCaretValue = GET_UShort(); +#else + (void) GET_UShort(); +#endif FORGET_Frame(); break; diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-gdef.h b/src/3rdparty/harfbuzz/src/harfbuzz-gdef.h index b6dcadc..f9a03dd 100644 --- a/src/3rdparty/harfbuzz/src/harfbuzz-gdef.h +++ b/src/3rdparty/harfbuzz/src/harfbuzz-gdef.h @@ -31,6 +31,10 @@ HB_BEGIN_HEADER +#ifdef HB_USE_PACKED_STRUCTS +#pragma pack(push, 1) +#endif + /* GDEF glyph properties. Note that HB_GDEF_COMPONENT has no corresponding * flag in the LookupFlag field. */ #define HB_GDEF_BASE_GLYPH 0x0002 @@ -44,12 +48,11 @@ typedef struct HB_AttachPoint_ HB_AttachPoint; struct HB_AttachList_ { - HB_Bool loaded; - + HB_AttachPoint* AttachPoint; /* array of AttachPoint tables */ HB_Coverage Coverage; /* Coverage table */ HB_UShort GlyphCount; /* number of glyphs with attachments */ - HB_AttachPoint* AttachPoint; /* array of AttachPoint tables */ + HB_Bool loaded; }; typedef struct HB_AttachList_ HB_AttachList; @@ -58,11 +61,10 @@ typedef struct HB_LigGlyph_ HB_LigGlyph; struct HB_LigCaretList_ { - HB_Bool loaded; - + HB_LigGlyph* LigGlyph; /* array of LigGlyph tables */ HB_Coverage Coverage; /* Coverage table */ HB_UShort LigGlyphCount; /* number of ligature glyphs */ - HB_LigGlyph* LigGlyph; /* array of LigGlyph tables */ + HB_Bool loaded; }; typedef struct HB_LigCaretList_ HB_LigCaretList; @@ -91,18 +93,18 @@ typedef struct HB_LigCaretList_ HB_LigCaretList; struct HB_GDEFHeader_ { + HB_UShort** NewGlyphClasses; HB_UInt offset; + HB_UInt MarkAttachClassDef_offset; HB_16Dot16 Version; HB_ClassDefinition GlyphClassDef; HB_AttachList AttachList; HB_LigCaretList LigCaretList; - HB_UInt MarkAttachClassDef_offset; HB_ClassDefinition MarkAttachClassDef; /* new in OT 1.2 */ HB_UShort LastGlyph; - HB_UShort** NewGlyphClasses; }; typedef struct HB_GDEFHeader_ HB_GDEFHeader; @@ -129,6 +131,9 @@ HB_Error HB_GDEF_Build_ClassDefinition( HB_GDEFHeader* gdef, HB_UShort* glyph_array, HB_UShort* class_array ); +#ifdef HB_USE_PACKED_STRUCTS +#pragma pack(pop) +#endif HB_END_HEADER diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-global.h b/src/3rdparty/harfbuzz/src/harfbuzz-global.h index d4e6b46..5b2b679 100644 --- a/src/3rdparty/harfbuzz/src/harfbuzz-global.h +++ b/src/3rdparty/harfbuzz/src/harfbuzz-global.h @@ -39,6 +39,10 @@ #define HB_END_HEADER /* nothing */ #endif +#if defined(__GNUC__) || defined(__ARMCC__) || defined(__CC_ARM) || defined(_MSC_VER) +#define HB_USE_PACKED_STRUCTS +#endif + HB_BEGIN_HEADER #ifndef FALSE diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-gpos-private.h b/src/3rdparty/harfbuzz/src/harfbuzz-gpos-private.h index 4110700..d513c27 100644 --- a/src/3rdparty/harfbuzz/src/harfbuzz-gpos-private.h +++ b/src/3rdparty/harfbuzz/src/harfbuzz-gpos-private.h @@ -32,6 +32,9 @@ HB_BEGIN_HEADER +#ifdef HB_USE_PACKED_STRUCTS +#pragma pack(push, 1) +#endif /* shared tables */ @@ -45,18 +48,20 @@ struct HB_ValueRecord_ advance */ HB_Short YAdvance; /* vertical adjustment for advance */ - HB_Device XPlacementDevice; /* device table for horizontal + HB_Device* XPlacementDevice; /* device table for horizontal placement */ - HB_Device YPlacementDevice; /* device table for vertical + HB_Device* YPlacementDevice; /* device table for vertical placement */ - HB_Device XAdvanceDevice; /* device table for horizontal + HB_Device* XAdvanceDevice; /* device table for horizontal advance */ - HB_Device YAdvanceDevice; /* device table for vertical + HB_Device* YAdvanceDevice; /* device table for vertical advance */ +#ifdef HB_SUPPORT_MULTIPLE_MASTER HB_UShort XIdPlacement; /* horizontal placement metric ID */ HB_UShort YIdPlacement; /* vertical placement metric ID */ HB_UShort XIdAdvance; /* horizontal advance metric ID */ HB_UShort YIdAdvance; /* vertical advance metric ID */ +#endif }; typedef struct HB_ValueRecord_ HB_ValueRecord; @@ -102,13 +107,14 @@ struct HB_AnchorFormat3_ { HB_Short XCoordinate; /* horizontal value */ HB_Short YCoordinate; /* vertical value */ - HB_Device XDeviceTable; /* device table for X coordinate */ - HB_Device YDeviceTable; /* device table for Y coordinate */ + HB_Device* XDeviceTable; /* device table for X coordinate */ + HB_Device* YDeviceTable; /* device table for Y coordinate */ }; typedef struct HB_AnchorFormat3_ HB_AnchorFormat3; +#ifdef HB_SUPPORT_MULTIPLE_MASTER struct HB_AnchorFormat4_ { HB_UShort XIdAnchor; /* horizontal metric ID */ @@ -116,11 +122,12 @@ struct HB_AnchorFormat4_ }; typedef struct HB_AnchorFormat4_ HB_AnchorFormat4; +#endif struct HB_Anchor_ { - HB_UShort PosFormat; /* 1, 2, 3, or 4 -- 0 indicates + HB_Byte PosFormat; /* 1, 2, 3, or 4 -- 0 indicates that there is no Anchor table */ union @@ -128,7 +135,9 @@ struct HB_Anchor_ HB_AnchorFormat1 af1; HB_AnchorFormat2 af2; HB_AnchorFormat3 af3; +#ifdef HB_SUPPORT_MULTIPLE_MASTER HB_AnchorFormat4 af4; +#endif } af; }; @@ -175,7 +184,7 @@ typedef struct HB_SinglePosFormat2_ HB_SinglePosFormat2; struct HB_SinglePos_ { - HB_UShort PosFormat; /* 1 or 2 */ + HB_Byte PosFormat; /* 1 or 2 */ HB_Coverage Coverage; /* Coverage table */ HB_UShort ValueFormat; /* format of ValueRecord table */ @@ -255,7 +264,7 @@ typedef struct HB_PairPosFormat2_ HB_PairPosFormat2; struct HB_PairPos_ { - HB_UShort PosFormat; /* 1 or 2 */ + HB_Byte PosFormat; /* 1 or 2 */ HB_Coverage Coverage; /* Coverage table */ HB_UShort ValueFormat1; /* format of ValueRecord table for first glyph */ @@ -507,7 +516,7 @@ typedef struct HB_ContextPosFormat3_ HB_ContextPosFormat3; struct HB_ContextPos_ { - HB_UShort PosFormat; /* 1, 2, or 3 */ + HB_Byte PosFormat; /* 1, 2, or 3 */ union { @@ -656,7 +665,7 @@ typedef struct HB_ChainContextPosFormat3_ HB_ChainContextPosFormat3; struct HB_ChainContextPos_ { - HB_UShort PosFormat; /* 1, 2, or 3 */ + HB_Byte PosFormat; /* 1, 2, or 3 */ union { @@ -707,6 +716,10 @@ HB_INTERNAL void _HB_GPOS_Free_SubTable( HB_GPOS_SubTable* st, HB_UShort lookup_type ); +#ifdef HB_USE_PACKED_STRUCTS +#pragma pack(pop) +#endif + HB_END_HEADER #endif /* HARFBUZZ_GPOS_PRIVATE_H */ diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-gpos.c b/src/3rdparty/harfbuzz/src/harfbuzz-gpos.c index 356dc01..61e42fd 100644 --- a/src/3rdparty/harfbuzz/src/harfbuzz-gpos.c +++ b/src/3rdparty/harfbuzz/src/harfbuzz-gpos.c @@ -57,6 +57,7 @@ static HB_Error GPOS_Do_Glyph_Lookup( GPOS_Instance* gpi, +#ifdef HB_SUPPORT_MULTIPLE_MASTER /* the client application must replace this with something more meaningful if multiple master fonts are to be supported. */ @@ -71,6 +72,7 @@ static HB_Error default_mmfunc( HB_Font font, HB_UNUSED(data); return ERR(HB_Err_Not_Covered); /* ERR() call intended */ } +#endif @@ -97,7 +99,9 @@ HB_Error HB_Load_GPOS_Table( HB_Stream stream, if ( ALLOC ( gpos, sizeof( *gpos ) ) ) return error; +#ifdef HB_SUPPORT_MULTIPLE_MASTER gpos->mmfunc = default_mmfunc; +#endif /* skip version */ @@ -278,9 +282,7 @@ static HB_Error Load_ValueRecord( HB_ValueRecord* vr, else { empty1: - vr->XPlacementDevice.StartSize = 0; - vr->XPlacementDevice.EndSize = 0; - vr->XPlacementDevice.DeltaValue = NULL; + vr->XPlacementDevice = 0; } if ( format & HB_GPOS_FORMAT_HAVE_Y_PLACEMENT_DEVICE ) @@ -309,9 +311,7 @@ static HB_Error Load_ValueRecord( HB_ValueRecord* vr, else { empty2: - vr->YPlacementDevice.StartSize = 0; - vr->YPlacementDevice.EndSize = 0; - vr->YPlacementDevice.DeltaValue = NULL; + vr->YPlacementDevice = 0; } if ( format & HB_GPOS_FORMAT_HAVE_X_ADVANCE_DEVICE ) @@ -340,9 +340,7 @@ static HB_Error Load_ValueRecord( HB_ValueRecord* vr, else { empty3: - vr->XAdvanceDevice.StartSize = 0; - vr->XAdvanceDevice.EndSize = 0; - vr->XAdvanceDevice.DeltaValue = NULL; + vr->XAdvanceDevice = 0; } if ( format & HB_GPOS_FORMAT_HAVE_Y_ADVANCE_DEVICE ) @@ -371,9 +369,7 @@ static HB_Error Load_ValueRecord( HB_ValueRecord* vr, else { empty4: - vr->YAdvanceDevice.StartSize = 0; - vr->YAdvanceDevice.EndSize = 0; - vr->YAdvanceDevice.DeltaValue = NULL; + vr->YAdvanceDevice = 0; } if ( format & HB_GPOS_FORMAT_HAVE_X_ID_PLACEMENT ) @@ -381,48 +377,72 @@ static HB_Error Load_ValueRecord( HB_ValueRecord* vr, if ( ACCESS_Frame( 2L ) ) goto Fail1; +#ifdef HB_SUPPORT_MULTIPLE_MASTER vr->XIdPlacement = GET_UShort(); +#else + (void) GET_UShort(); +#endif FORGET_Frame(); } +#ifdef HB_SUPPORT_MULTIPLE_MASTER else vr->XIdPlacement = 0; +#endif if ( format & HB_GPOS_FORMAT_HAVE_Y_ID_PLACEMENT ) { if ( ACCESS_Frame( 2L ) ) goto Fail1; +#ifdef HB_SUPPORT_MULTIPLE_MASTER vr->YIdPlacement = GET_UShort(); +#else + (void) GET_UShort(); +#endif FORGET_Frame(); } +#ifdef HB_SUPPORT_MULTIPLE_MASTER else vr->YIdPlacement = 0; +#endif if ( format & HB_GPOS_FORMAT_HAVE_X_ID_ADVANCE ) { if ( ACCESS_Frame( 2L ) ) goto Fail1; +#ifdef HB_SUPPORT_MULTIPLE_MASTER vr->XIdAdvance = GET_UShort(); +#else + (void) GET_UShort(); +#endif FORGET_Frame(); } +#ifdef HB_SUPPORT_MULTIPLE_MASTER else vr->XIdAdvance = 0; +#endif if ( format & HB_GPOS_FORMAT_HAVE_Y_ID_ADVANCE ) { if ( ACCESS_Frame( 2L ) ) goto Fail1; +#ifdef HB_SUPPORT_MULTIPLE_MASTER vr->YIdAdvance = GET_UShort(); +#else + (void) GET_UShort(); +#endif FORGET_Frame(); } +#ifdef HB_SUPPORT_MULTIPLE_MASTER else vr->YIdAdvance = 0; +#endif return HB_Err_Ok; @@ -457,10 +477,12 @@ static HB_Error Get_ValueRecord( GPOS_Instance* gpi, HB_UShort format, HB_Position gd ) { - HB_Fixed value; HB_Short pixel_value; HB_Error error = HB_Err_Ok; +#ifdef HB_SUPPORT_MULTIPLE_MASTER HB_GPOSHeader* gpos = gpi->gpos; + HB_Fixed value; +#endif HB_UShort x_ppem, y_ppem; HB_16Dot16 x_scale, y_scale; @@ -511,6 +533,7 @@ static HB_Error Get_ValueRecord( GPOS_Instance* gpi, } } +#ifdef HB_SUPPORT_MULTIPLE_MASTER /* values returned from mmfunc() are already in fractional pixels */ if ( format & HB_GPOS_FORMAT_HAVE_X_ID_PLACEMENT ) @@ -545,6 +568,7 @@ static HB_Error Get_ValueRecord( GPOS_Instance* gpi, return error; gd->y_advance += value; } +#endif return error; } @@ -619,9 +643,7 @@ static HB_Error Load_Anchor( HB_Anchor* an, } else { - an->af.af3.XDeviceTable.StartSize = 0; - an->af.af3.XDeviceTable.EndSize = 0; - an->af.af3.XDeviceTable.DeltaValue = NULL; + an->af.af3.XDeviceTable = 0; } if ( ACCESS_Frame( 2L ) ) @@ -644,9 +666,7 @@ static HB_Error Load_Anchor( HB_Anchor* an, } else { - an->af.af3.YDeviceTable.StartSize = 0; - an->af.af3.YDeviceTable.EndSize = 0; - an->af.af3.YDeviceTable.DeltaValue = NULL; + an->af.af3.YDeviceTable = 0; } break; @@ -654,8 +674,13 @@ static HB_Error Load_Anchor( HB_Anchor* an, if ( ACCESS_Frame( 4L ) ) return error; +#ifdef HB_SUPPORT_MULTIPLE_MASTER an->af.af4.XIdAnchor = GET_UShort(); an->af.af4.YIdAnchor = GET_UShort(); +#else + (void) GET_UShort(); + (void) GET_UShort(); +#endif FORGET_Frame(); break; @@ -690,7 +715,9 @@ static HB_Error Get_Anchor( GPOS_Instance* gpi, { HB_Error error = HB_Err_Ok; +#ifdef HB_SUPPORT_MULTIPLE_MASTER HB_GPOSHeader* gpos = gpi->gpos; +#endif HB_UShort ap; HB_Short pixel_value; @@ -756,6 +783,7 @@ static HB_Error Get_Anchor( GPOS_Instance* gpi, break; case 4: +#ifdef HB_SUPPORT_MULTIPLE_MASTER error = (gpos->mmfunc)( gpi->font, an->af.af4.XIdAnchor, x_value, gpos->data ); if ( error ) @@ -766,6 +794,9 @@ static HB_Error Get_Anchor( GPOS_Instance* gpi, if ( error ) return error; break; +#else + return ERR(HB_Err_Not_Covered); +#endif } return error; @@ -5966,8 +5997,7 @@ HB_Error HB_GPOS_Clear_Features( HB_GPOSHeader* gpos ) return HB_Err_Ok; } - - +#ifdef HB_SUPPORT_MULTIPLE_MASTER HB_Error HB_GPOS_Register_MM_Function( HB_GPOSHeader* gpos, HB_MMFunction mmfunc, void* data ) @@ -5980,6 +6010,7 @@ HB_Error HB_GPOS_Register_MM_Function( HB_GPOSHeader* gpos, return HB_Err_Ok; } +#endif /* If `dvi' is TRUE, glyph contour points for anchor points and device tables are ignored -- you will get device independent values. */ diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-gpos.h b/src/3rdparty/harfbuzz/src/harfbuzz-gpos.h index 2840dae..92bff84 100644 --- a/src/3rdparty/harfbuzz/src/harfbuzz-gpos.h +++ b/src/3rdparty/harfbuzz/src/harfbuzz-gpos.h @@ -44,6 +44,7 @@ HB_BEGIN_HEADER #define HB_GPOS_LOOKUP_CHAIN 8 #define HB_GPOS_LOOKUP_EXTENSION 9 +#ifdef HB_SUPPORT_MULTIPLE_MASTER /* A pointer to a function which accesses the PostScript interpreter. Multiple Master fonts need this interface to convert a metric ID (as stored in an OpenType font version 1.2 or higher) `metric_id' @@ -59,6 +60,7 @@ typedef HB_Error (*HB_MMFunction)(HB_Font font, HB_UShort metric_id, HB_Fixed* metric_value, void* data ); +#endif struct HB_GPOSHeader_ @@ -71,12 +73,14 @@ struct HB_GPOSHeader_ HB_GDEFHeader* gdef; +#ifdef HB_SUPPORT_MULTIPLE_MASTER /* this is OpenType 1.2 -- Multiple Master fonts need this callback function to get various metric values from the PostScript interpreter. */ HB_MMFunction mmfunc; void* data; +#endif }; typedef struct HB_GPOSHeader_ HB_GPOSHeader; @@ -129,9 +133,11 @@ HB_Error HB_GPOS_Add_Feature( HB_GPOSHeader* gpos, HB_Error HB_GPOS_Clear_Features( HB_GPOSHeader* gpos ); +#ifdef HB_SUPPORT_MULTIPLE_MASTER HB_Error HB_GPOS_Register_MM_Function( HB_GPOSHeader* gpos, HB_MMFunction mmfunc, void* data ); +#endif /* If `dvi' is TRUE, glyph contour points for anchor points and device tables are ignored -- you will get device independent values. */ diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-greek.c b/src/3rdparty/harfbuzz/src/harfbuzz-greek.c new file mode 100644 index 0000000..2e9b858 --- /dev/null +++ b/src/3rdparty/harfbuzz/src/harfbuzz-greek.c @@ -0,0 +1,447 @@ +/* + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) + * + * This is part of HarfBuzz, an OpenType Layout engine library. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES + * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN + * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * + * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, + * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + */ + +#include "harfbuzz-shaper.h" +#include "harfbuzz-shaper-private.h" +#include + +#ifndef NO_OPENTYPE +static const HB_OpenTypeFeature greek_features[] = { + { HB_MAKE_TAG('c', 'c', 'm', 'p'), CcmpProperty }, + { HB_MAKE_TAG('l', 'i', 'g', 'a'), CcmpProperty }, + { HB_MAKE_TAG('c', 'l', 'i', 'g'), CcmpProperty }, + {0, 0} +}; +#endif + +/* + Greek decompositions +*/ + + +typedef struct _hb_greek_decomposition { + HB_UChar16 composed; + HB_UChar16 base; +} hb_greek_decomposition; + +static const hb_greek_decomposition decompose_0x300[] = { + { 0x1FBA, 0x0391 }, + { 0x1FC8, 0x0395 }, + { 0x1FCA, 0x0397 }, + { 0x1FDA, 0x0399 }, + { 0x1FF8, 0x039F }, + { 0x1FEA, 0x03A5 }, + { 0x1FFA, 0x03A9 }, + { 0x1F70, 0x03B1 }, + { 0x1F72, 0x03B5 }, + { 0x1F74, 0x03B7 }, + { 0x1F76, 0x03B9 }, + { 0x1F78, 0x03BF }, + { 0x1F7A, 0x03C5 }, + { 0x1F7C, 0x03C9 }, + { 0x1FD2, 0x03CA }, + { 0x1FE2, 0x03CB }, + { 0x1F02, 0x1F00 }, + { 0, 0 } +}; + +static HB_UChar16 compose_0x300(HB_UChar16 base) +{ + if ((base ^ 0x1f00) < 0x100) { + if (base <= 0x1f69 && !(base & 0x6)) + return base + 2; + if (base == 0x1fbf) + return 0x1fcd; + if (base == 0x1ffe) + return 0x1fdd; + return 0; + } + { + const hb_greek_decomposition *d = decompose_0x300; + while (d->base && d->base != base) + ++d; + return d->composed; + } +} + +static const hb_greek_decomposition decompose_0x301[] = { + { 0x0386, 0x0391 }, + { 0x0388, 0x0395 }, + { 0x0389, 0x0397 }, + { 0x038A, 0x0399 }, + { 0x038C, 0x039F }, + { 0x038E, 0x03A5 }, + { 0x038F, 0x03A9 }, + { 0x03AC, 0x03B1 }, + { 0x03AD, 0x03B5 }, + { 0x03AE, 0x03B7 }, + { 0x03AF, 0x03B9 }, + { 0x03CC, 0x03BF }, + { 0x03CD, 0x03C5 }, + { 0x03CE, 0x03C9 }, + { 0x0390, 0x03CA }, + { 0x03B0, 0x03CB }, + { 0x03D3, 0x03D2 }, + { 0, 0 } +}; + + +static HB_UChar16 compose_0x301(HB_UChar16 base) +{ + if ((base ^ 0x1f00) < 0x100) { + if (base <= 0x1f69 && !(base & 0x6)) + return base + 4; + if (base == 0x1fbf) + return 0x1fce; + if (base == 0x1ffe) + return 0x1fde; + } + { + const hb_greek_decomposition *d = decompose_0x301; + while (d->base && d->base != base) + ++d; + return d->composed; + } +} + +static const hb_greek_decomposition decompose_0x304[] = { + { 0x1FB9, 0x0391 }, + { 0x1FD9, 0x0399 }, + { 0x1FE9, 0x03A5 }, + { 0x1FB1, 0x03B1 }, + { 0x1FD1, 0x03B9 }, + { 0x1FE1, 0x03C5 }, + { 0, 0 } +}; + +static HB_UChar16 compose_0x304(HB_UChar16 base) +{ + const hb_greek_decomposition *d = decompose_0x304; + while (d->base && d->base != base) + ++d; + return d->composed; +} + +static const hb_greek_decomposition decompose_0x306[] = { + { 0x1FB8, 0x0391 }, + { 0x1FD8, 0x0399 }, + { 0x1FE8, 0x03A5 }, + { 0x1FB0, 0x03B1 }, + { 0x1FD0, 0x03B9 }, + { 0x1FE0, 0x03C5 }, + { 0, 0 } +}; + +static HB_UChar16 compose_0x306(HB_UChar16 base) +{ + const hb_greek_decomposition *d = decompose_0x306; + while (d->base && d->base != base) + ++d; + return d->composed; +} + +static const hb_greek_decomposition decompose_0x308[] = { + { 0x03AA, 0x0399 }, + { 0x03AB, 0x03A5 }, + { 0x03CA, 0x03B9 }, + { 0x03CB, 0x03C5 }, + { 0x03D4, 0x03D2 }, + { 0, 0 } +}; + +static HB_UChar16 compose_0x308(HB_UChar16 base) +{ + const hb_greek_decomposition *d = decompose_0x308; + while (d->base && d->base != base) + ++d; + return d->composed; +} + + +static const hb_greek_decomposition decompose_0x313[] = { + { 0x1F08, 0x0391 }, + { 0x1F18, 0x0395 }, + { 0x1F28, 0x0397 }, + { 0x1F38, 0x0399 }, + { 0x1F48, 0x039F }, + { 0x1F68, 0x03A9 }, + { 0x1F00, 0x03B1 }, + { 0x1F10, 0x03B5 }, + { 0x1F20, 0x03B7 }, + { 0x1F30, 0x03B9 }, + { 0x1F40, 0x03BF }, + { 0x1FE4, 0x03C1 }, + { 0x1F50, 0x03C5 }, + { 0x1F60, 0x03C9 }, + { 0, 0 } +}; + +static HB_UChar16 compose_0x313(HB_UChar16 base) +{ + const hb_greek_decomposition *d = decompose_0x313; + while (d->base && d->base != base) + ++d; + return d->composed; +} + +static const hb_greek_decomposition decompose_0x314[] = { + { 0x1F09, 0x0391 }, + { 0x1F19, 0x0395 }, + { 0x1F29, 0x0397 }, + { 0x1F39, 0x0399 }, + { 0x1F49, 0x039F }, + { 0x1FEC, 0x03A1 }, + { 0x1F59, 0x03A5 }, + { 0x1F69, 0x03A9 }, + { 0x1F01, 0x03B1 }, + { 0x1F11, 0x03B5 }, + { 0x1F21, 0x03B7 }, + { 0x1F31, 0x03B9 }, + { 0x1F41, 0x03BF }, + { 0x1FE5, 0x03C1 }, + { 0x1F51, 0x03C5 }, + { 0x1F61, 0x03C9 }, + { 0, 0 } +}; + +static HB_UChar16 compose_0x314(HB_UChar16 base) +{ + const hb_greek_decomposition *d = decompose_0x314; + while (d->base && d->base != base) + ++d; + return d->composed; +} + +static const hb_greek_decomposition decompose_0x342[] = { + { 0x1FB6, 0x03B1 }, + { 0x1FC6, 0x03B7 }, + { 0x1FD6, 0x03B9 }, + { 0x1FE6, 0x03C5 }, + { 0x1FF6, 0x03C9 }, + { 0x1FD7, 0x03CA }, + { 0x1FE7, 0x03CB }, + { 0x1F06, 0x1F00 }, + { 0x1F07, 0x1F01 }, + { 0x1F0E, 0x1F08 }, + { 0x1F0F, 0x1F09 }, + { 0x1F26, 0x1F20 }, + { 0x1F27, 0x1F21 }, + { 0x1F2E, 0x1F28 }, + { 0x1F2F, 0x1F29 }, + { 0x1F36, 0x1F30 }, + { 0x1F37, 0x1F31 }, + { 0x1F3E, 0x1F38 }, + { 0x1F3F, 0x1F39 }, + { 0x1F56, 0x1F50 }, + { 0x1F57, 0x1F51 }, + { 0x1F5F, 0x1F59 }, + { 0x1F66, 0x1F60 }, + { 0x1F67, 0x1F61 }, + { 0x1F6E, 0x1F68 }, + { 0x1F6F, 0x1F69 }, + { 0x1FCF, 0x1FBF }, + { 0x1FDF, 0x1FFE }, + { 0, 0 } +}; + +static HB_UChar16 compose_0x342(HB_UChar16 base) +{ + const hb_greek_decomposition *d = decompose_0x342; + while (d->base && d->base != base) + ++d; + return d->composed; +} + +static const hb_greek_decomposition decompose_0x345[] = { + { 0x1FBC, 0x0391 }, + { 0x1FCC, 0x0397 }, + { 0x1FFC, 0x03A9 }, + { 0x1FB4, 0x03AC }, + { 0x1FC4, 0x03AE }, + { 0x1FB3, 0x03B1 }, + { 0x1FC3, 0x03B7 }, + { 0x1FF3, 0x03C9 }, + { 0x1FF4, 0x03CE }, + { 0x1F80, 0x1F00 }, + { 0x1F81, 0x1F01 }, + { 0x1F82, 0x1F02 }, + { 0x1F83, 0x1F03 }, + { 0x1F84, 0x1F04 }, + { 0x1F85, 0x1F05 }, + { 0x1F86, 0x1F06 }, + { 0x1F87, 0x1F07 }, + { 0x1F88, 0x1F08 }, + { 0x1F89, 0x1F09 }, + { 0x1F8A, 0x1F0A }, + { 0x1F8B, 0x1F0B }, + { 0x1F8C, 0x1F0C }, + { 0x1F8D, 0x1F0D }, + { 0x1F8E, 0x1F0E }, + { 0x1F8F, 0x1F0F }, + { 0x1F90, 0x1F20 }, + { 0x1F91, 0x1F21 }, + { 0x1F92, 0x1F22 }, + { 0x1F93, 0x1F23 }, + { 0x1F94, 0x1F24 }, + { 0x1F95, 0x1F25 }, + { 0x1F96, 0x1F26 }, + { 0x1F97, 0x1F27 }, + { 0x1F98, 0x1F28 }, + { 0x1F99, 0x1F29 }, + { 0x1F9A, 0x1F2A }, + { 0x1F9B, 0x1F2B }, + { 0x1F9C, 0x1F2C }, + { 0x1F9D, 0x1F2D }, + { 0x1F9E, 0x1F2E }, + { 0x1F9F, 0x1F2F }, + { 0x1FA0, 0x1F60 }, + { 0x1FA1, 0x1F61 }, + { 0x1FA2, 0x1F62 }, + { 0x1FA3, 0x1F63 }, + { 0x1FA4, 0x1F64 }, + { 0x1FA5, 0x1F65 }, + { 0x1FA6, 0x1F66 }, + { 0x1FA7, 0x1F67 }, + { 0x1FA8, 0x1F68 }, + { 0x1FA9, 0x1F69 }, + { 0x1FAA, 0x1F6A }, + { 0x1FAB, 0x1F6B }, + { 0x1FAC, 0x1F6C }, + { 0x1FAD, 0x1F6D }, + { 0x1FAE, 0x1F6E }, + { 0x1FAF, 0x1F6F }, + { 0x1FB2, 0x1F70 }, + { 0x1FC2, 0x1F74 }, + { 0x1FF2, 0x1F7C }, + { 0x1FB7, 0x1FB6 }, + { 0x1FC7, 0x1FC6 }, + { 0x1FF7, 0x1FF6 }, + { 0, 0 } +}; + +static HB_UChar16 compose_0x345(HB_UChar16 base) +{ + const hb_greek_decomposition *d = decompose_0x345; + while (d->base && d->base != base) + ++d; + return d->composed; +} + +/* + Greek shaping. Heuristic positioning can't render polytonic greek correctly. We're a lot + better off mapping greek chars with diacritics to the characters in the extended greek + region in Unicode if possible. +*/ +HB_Bool HB_GreekShape(HB_ShaperItem *shaper_item) +{ + const int availableGlyphs = shaper_item->num_glyphs; + const HB_UChar16 *uc = shaper_item->string + shaper_item->item.pos; + unsigned short *logClusters = shaper_item->log_clusters; + HB_GlyphAttributes *attributes = shaper_item->attributes; + + HB_Bool haveGlyphs; + int slen = 1; + int cluster_start = 0; + hb_uint32 i; + + HB_STACKARRAY(HB_UChar16, shapedChars, 2 * shaper_item->item.length); + + assert(shaper_item->item.script == HB_Script_Greek); + + *shapedChars = *uc; + logClusters[0] = 0; + + for (i = 1; i < shaper_item->item.length; ++i) { + hb_uint16 base = shapedChars[slen-1]; + hb_uint16 shaped = 0; + if (uc[i] == 0x300) + shaped = compose_0x300(base); + else if (uc[i] == 0x301) + shaped = compose_0x301(base); + else if (uc[i] == 0x304) + shaped = compose_0x304(base); + else if (uc[i] == 0x306) + shaped = compose_0x306(base); + else if (uc[i] == 0x308) + shaped = compose_0x308(base); + else if (uc[i] == 0x313) + shaped = compose_0x313(base); + else if (uc[i] == 0x314) + shaped = compose_0x314(base); + else if (uc[i] == 0x342) + shaped = compose_0x342(base); + else if (uc[i] == 0x345) + shaped = compose_0x345(base); + + if (shaped) { + if (shaper_item->font->klass->canRender(shaper_item->font, (HB_UChar16 *)&shaped, 1)) { + shapedChars[slen-1] = shaped; + } else { + shaped = 0; + } + } + + if (!shaped) { + HB_CharCategory category; + int cmb; + shapedChars[slen] = uc[i]; + HB_GetUnicodeCharProperties(uc[i], &category, &cmb); + if (category != HB_Mark_NonSpacing) { + attributes[slen].clusterStart = TRUE; + attributes[slen].mark = FALSE; + attributes[slen].combiningClass = 0; + attributes[slen].dontPrint = HB_IsControlChar(uc[i]); + cluster_start = slen; + } else { + attributes[slen].clusterStart = FALSE; + attributes[slen].mark = TRUE; + attributes[slen].combiningClass = cmb; + } + ++slen; + } + logClusters[i] = cluster_start; + } + + haveGlyphs = shaper_item->font->klass + ->convertStringToGlyphIndices(shaper_item->font, + shapedChars, slen, + shaper_item->glyphs, &shaper_item->num_glyphs, + shaper_item->item.bidiLevel % 2); + + HB_FREE_STACKARRAY(shapedChars); + + if (!haveGlyphs) + return FALSE; + +#ifndef NO_OPENTYPE + if (HB_SelectScript(shaper_item, greek_features)) { + HB_OpenTypeShape(shaper_item, /*properties*/0); + return HB_OpenTypePosition(shaper_item, availableGlyphs, /*doLogClusters*/TRUE); + } +#endif + HB_HeuristicPosition(shaper_item); + + return TRUE; +} + diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-gsub-private.h b/src/3rdparty/harfbuzz/src/harfbuzz-gsub-private.h index dd5ffdf..7eb329e 100644 --- a/src/3rdparty/harfbuzz/src/harfbuzz-gsub-private.h +++ b/src/3rdparty/harfbuzz/src/harfbuzz-gsub-private.h @@ -32,6 +32,9 @@ HB_BEGIN_HEADER +#ifdef HB_USE_PACKED_STRUCTS +#pragma pack(push, 1) +#endif typedef union HB_GSUB_SubTable_ HB_GSUB_SubTable; @@ -48,9 +51,9 @@ typedef struct HB_SingleSubstFormat1_ HB_SingleSubstFormat1; struct HB_SingleSubstFormat2_ { + HB_UShort* Substitute; /* array of substitute glyph IDs */ HB_UShort GlyphCount; /* number of glyph IDs in Substitute array */ - HB_UShort* Substitute; /* array of substitute glyph IDs */ }; typedef struct HB_SingleSubstFormat2_ HB_SingleSubstFormat2; @@ -58,14 +61,14 @@ typedef struct HB_SingleSubstFormat2_ HB_SingleSubstFormat2; struct HB_SingleSubst_ { - HB_UShort SubstFormat; /* 1 or 2 */ - HB_Coverage Coverage; /* Coverage table */ - union { HB_SingleSubstFormat1 ssf1; HB_SingleSubstFormat2 ssf2; } ssf; + + HB_Coverage Coverage; /* Coverage table */ + HB_Byte SubstFormat; /* 1 or 2 */ }; typedef struct HB_SingleSubst_ HB_SingleSubst; @@ -75,10 +78,10 @@ typedef struct HB_SingleSubst_ HB_SingleSubst; struct HB_Sequence_ { - HB_UShort GlyphCount; /* number of glyph IDs in the - Substitute array */ HB_UShort* Substitute; /* string of glyph IDs to substitute */ + HB_UShort GlyphCount; /* number of glyph IDs in the + Substitute array */ }; typedef struct HB_Sequence_ HB_Sequence; @@ -86,10 +89,10 @@ typedef struct HB_Sequence_ HB_Sequence; struct HB_MultipleSubst_ { - HB_UShort SubstFormat; /* always 1 */ + HB_Sequence* Sequence; /* array of Sequence tables */ HB_Coverage Coverage; /* Coverage table */ + HB_UShort SubstFormat; /* always 1 */ HB_UShort SequenceCount; /* number of Sequence tables */ - HB_Sequence* Sequence; /* array of Sequence tables */ }; typedef struct HB_MultipleSubst_ HB_MultipleSubst; @@ -99,9 +102,9 @@ typedef struct HB_MultipleSubst_ HB_MultipleSubst; struct HB_AlternateSet_ { + HB_UShort* Alternate; /* array of alternate glyph IDs */ HB_UShort GlyphCount; /* number of glyph IDs in the Alternate array */ - HB_UShort* Alternate; /* array of alternate glyph IDs */ }; typedef struct HB_AlternateSet_ HB_AlternateSet; @@ -109,11 +112,11 @@ typedef struct HB_AlternateSet_ HB_AlternateSet; struct HB_AlternateSubst_ { - HB_UShort SubstFormat; /* always 1 */ + HB_AlternateSet* AlternateSet; /* array of AlternateSet tables */ HB_Coverage Coverage; /* Coverage table */ + HB_UShort SubstFormat; /* always 1 */ HB_UShort AlternateSetCount; /* number of AlternateSet tables */ - HB_AlternateSet* AlternateSet; /* array of AlternateSet tables */ }; typedef struct HB_AlternateSubst_ HB_AlternateSubst; @@ -123,10 +126,10 @@ typedef struct HB_AlternateSubst_ HB_AlternateSubst; struct HB_Ligature_ { + HB_UShort* Component; /* array of component glyph IDs */ HB_UShort LigGlyph; /* glyphID of ligature to substitute */ HB_UShort ComponentCount; /* number of components in ligature */ - HB_UShort* Component; /* array of component glyph IDs */ }; typedef struct HB_Ligature_ HB_Ligature; @@ -134,8 +137,8 @@ typedef struct HB_Ligature_ HB_Ligature; struct HB_LigatureSet_ { - HB_UShort LigatureCount; /* number of Ligature tables */ HB_Ligature* Ligature; /* array of Ligature tables */ + HB_UShort LigatureCount; /* number of Ligature tables */ }; typedef struct HB_LigatureSet_ HB_LigatureSet; @@ -143,10 +146,10 @@ typedef struct HB_LigatureSet_ HB_LigatureSet; struct HB_LigatureSubst_ { - HB_UShort SubstFormat; /* always 1 */ + HB_LigatureSet* LigatureSet; /* array of LigatureSet tables */ HB_Coverage Coverage; /* Coverage table */ + HB_UShort SubstFormat; /* always 1 */ HB_UShort LigatureSetCount; /* number of LigatureSet tables */ - HB_LigatureSet* LigatureSet; /* array of LigatureSet tables */ }; typedef struct HB_LigatureSubst_ HB_LigatureSubst; @@ -168,13 +171,13 @@ typedef struct HB_SubstLookupRecord_ HB_SubstLookupRecord; struct HB_SubRule_ { - HB_UShort GlyphCount; /* total number of input glyphs */ - HB_UShort SubstCount; /* number of SubstLookupRecord - tables */ HB_UShort* Input; /* array of input glyph IDs */ HB_SubstLookupRecord* SubstLookupRecord; /* array of SubstLookupRecord tables */ + HB_UShort GlyphCount; /* total number of input glyphs */ + HB_UShort SubstCount; /* number of SubstLookupRecord + tables */ }; typedef struct HB_SubRule_ HB_SubRule; @@ -182,8 +185,8 @@ typedef struct HB_SubRule_ HB_SubRule; struct HB_SubRuleSet_ { - HB_UShort SubRuleCount; /* number of SubRule tables */ HB_SubRule* SubRule; /* array of SubRule tables */ + HB_UShort SubRuleCount; /* number of SubRule tables */ }; typedef struct HB_SubRuleSet_ HB_SubRuleSet; @@ -191,9 +194,9 @@ typedef struct HB_SubRuleSet_ HB_SubRuleSet; struct HB_ContextSubstFormat1_ { + HB_SubRuleSet* SubRuleSet; /* array of SubRuleSet tables */ HB_Coverage Coverage; /* Coverage table */ HB_UShort SubRuleSetCount; /* number of SubRuleSet tables */ - HB_SubRuleSet* SubRuleSet; /* array of SubRuleSet tables */ }; typedef struct HB_ContextSubstFormat1_ HB_ContextSubstFormat1; @@ -201,13 +204,13 @@ typedef struct HB_ContextSubstFormat1_ HB_ContextSubstFormat1; struct HB_SubClassRule_ { - HB_UShort GlyphCount; /* total number of context classes */ - HB_UShort SubstCount; /* number of SubstLookupRecord - tables */ HB_UShort* Class; /* array of classes */ HB_SubstLookupRecord* SubstLookupRecord; /* array of SubstLookupRecord tables */ + HB_UShort GlyphCount; /* total number of context classes */ + HB_UShort SubstCount; /* number of SubstLookupRecord + tables */ }; typedef struct HB_SubClassRule_ HB_SubClassRule; @@ -215,9 +218,9 @@ typedef struct HB_SubClassRule_ HB_SubClassRule; struct HB_SubClassSet_ { + HB_SubClassRule* SubClassRule; /* array of SubClassRule tables */ HB_UShort SubClassRuleCount; /* number of SubClassRule tables */ - HB_SubClassRule* SubClassRule; /* array of SubClassRule tables */ }; typedef struct HB_SubClassSet_ HB_SubClassSet; @@ -229,13 +232,13 @@ typedef struct HB_SubClassSet_ HB_SubClassSet; struct HB_ContextSubstFormat2_ { - HB_UShort MaxContextLength; - /* maximal context length */ + HB_SubClassSet* SubClassSet; /* array of SubClassSet tables */ HB_Coverage Coverage; /* Coverage table */ HB_ClassDefinition ClassDef; /* ClassDef table */ HB_UShort SubClassSetCount; /* number of SubClassSet tables */ - HB_SubClassSet* SubClassSet; /* array of SubClassSet tables */ + HB_UShort MaxContextLength; + /* maximal context length */ }; typedef struct HB_ContextSubstFormat2_ HB_ContextSubstFormat2; @@ -243,11 +246,11 @@ typedef struct HB_ContextSubstFormat2_ HB_ContextSubstFormat2; struct HB_ContextSubstFormat3_ { - HB_UShort GlyphCount; /* number of input glyphs */ - HB_UShort SubstCount; /* number of SubstLookupRecords */ HB_Coverage* Coverage; /* array of Coverage tables */ HB_SubstLookupRecord* SubstLookupRecord; /* array of substitution lookups */ + HB_UShort GlyphCount; /* number of input glyphs */ + HB_UShort SubstCount; /* number of SubstLookupRecords */ }; typedef struct HB_ContextSubstFormat3_ HB_ContextSubstFormat3; @@ -255,14 +258,14 @@ typedef struct HB_ContextSubstFormat3_ HB_ContextSubstFormat3; struct HB_ContextSubst_ { - HB_UShort SubstFormat; /* 1, 2, or 3 */ - union { HB_ContextSubstFormat1 csf1; HB_ContextSubstFormat2 csf2; HB_ContextSubstFormat3 csf3; } csf; + + HB_Byte SubstFormat; /* 1, 2, or 3 */ }; typedef struct HB_ContextSubst_ HB_ContextSubst; @@ -272,18 +275,18 @@ typedef struct HB_ContextSubst_ HB_ContextSubst; struct HB_ChainSubRule_ { + HB_UShort* Backtrack; /* array of backtrack glyph IDs */ + HB_UShort* Input; /* array of input glyph IDs */ + HB_UShort* Lookahead; /* array of lookahead glyph IDs */ + HB_SubstLookupRecord* SubstLookupRecord; + /* array of SubstLookupRecords */ HB_UShort BacktrackGlyphCount; /* total number of backtrack glyphs */ - HB_UShort* Backtrack; /* array of backtrack glyph IDs */ HB_UShort InputGlyphCount; /* total number of input glyphs */ - HB_UShort* Input; /* array of input glyph IDs */ HB_UShort LookaheadGlyphCount; /* total number of lookahead glyphs */ - HB_UShort* Lookahead; /* array of lookahead glyph IDs */ HB_UShort SubstCount; /* number of SubstLookupRecords */ - HB_SubstLookupRecord* SubstLookupRecord; - /* array of SubstLookupRecords */ }; typedef struct HB_ChainSubRule_ HB_ChainSubRule; @@ -291,9 +294,9 @@ typedef struct HB_ChainSubRule_ HB_ChainSubRule; struct HB_ChainSubRuleSet_ { + HB_ChainSubRule* ChainSubRule; /* array of ChainSubRule tables */ HB_UShort ChainSubRuleCount; /* number of ChainSubRule tables */ - HB_ChainSubRule* ChainSubRule; /* array of ChainSubRule tables */ }; typedef struct HB_ChainSubRuleSet_ HB_ChainSubRuleSet; @@ -301,11 +304,11 @@ typedef struct HB_ChainSubRuleSet_ HB_ChainSubRuleSet; struct HB_ChainContextSubstFormat1_ { + HB_ChainSubRuleSet* ChainSubRuleSet; + /* array of ChainSubRuleSet tables */ HB_Coverage Coverage; /* Coverage table */ HB_UShort ChainSubRuleSetCount; /* number of ChainSubRuleSet tables */ - HB_ChainSubRuleSet* ChainSubRuleSet; - /* array of ChainSubRuleSet tables */ }; typedef struct HB_ChainContextSubstFormat1_ HB_ChainContextSubstFormat1; @@ -313,20 +316,20 @@ typedef struct HB_ChainContextSubstFormat1_ HB_ChainContextSubstFormat1; struct HB_ChainSubClassRule_ { + HB_UShort* Backtrack; /* array of backtrack classes */ + HB_UShort* Input; /* array of context classes */ + HB_UShort* Lookahead; /* array of lookahead classes */ + HB_SubstLookupRecord* SubstLookupRecord; + /* array of substitution lookups */ HB_UShort BacktrackGlyphCount; /* total number of backtrack classes */ - HB_UShort* Backtrack; /* array of backtrack classes */ HB_UShort InputGlyphCount; /* total number of context classes */ - HB_UShort* Input; /* array of context classes */ HB_UShort LookaheadGlyphCount; /* total number of lookahead classes */ - HB_UShort* Lookahead; /* array of lookahead classes */ HB_UShort SubstCount; /* number of SubstLookupRecords */ - HB_SubstLookupRecord* SubstLookupRecord; - /* array of substitution lookups */ }; typedef struct HB_ChainSubClassRule_ HB_ChainSubClassRule; @@ -334,12 +337,12 @@ typedef struct HB_ChainSubClassRule_ HB_ChainSubClassRule; struct HB_ChainSubClassSet_ { - HB_UShort ChainSubClassRuleCount; - /* number of ChainSubClassRule - tables */ HB_ChainSubClassRule* ChainSubClassRule; /* array of ChainSubClassRule tables */ + HB_UShort ChainSubClassRuleCount; + /* number of ChainSubClassRule + tables */ }; typedef struct HB_ChainSubClassSet_ HB_ChainSubClassSet; @@ -351,27 +354,27 @@ typedef struct HB_ChainSubClassSet_ HB_ChainSubClassSet; struct HB_ChainContextSubstFormat2_ { + HB_ChainSubClassSet* ChainSubClassSet; + /* array of ChainSubClassSet + tables */ HB_Coverage Coverage; /* Coverage table */ - HB_UShort MaxBacktrackLength; - /* maximal backtrack length */ HB_ClassDefinition BacktrackClassDef; /* BacktrackClassDef table */ - HB_UShort MaxInputLength; - /* maximal input length */ HB_ClassDefinition InputClassDef; /* InputClassDef table */ - HB_UShort MaxLookaheadLength; - /* maximal lookahead length */ HB_ClassDefinition LookaheadClassDef; /* LookaheadClassDef table */ HB_UShort ChainSubClassSetCount; /* number of ChainSubClassSet tables */ - HB_ChainSubClassSet* ChainSubClassSet; - /* array of ChainSubClassSet - tables */ + HB_UShort MaxBacktrackLength; + /* maximal backtrack length */ + HB_UShort MaxLookaheadLength; + /* maximal lookahead length */ + HB_UShort MaxInputLength; + /* maximal input length */ }; typedef struct HB_ChainContextSubstFormat2_ HB_ChainContextSubstFormat2; @@ -379,24 +382,24 @@ typedef struct HB_ChainContextSubstFormat2_ HB_ChainContextSubstFormat2; struct HB_ChainContextSubstFormat3_ { - HB_UShort BacktrackGlyphCount; - /* number of backtrack glyphs */ HB_Coverage* BacktrackCoverage; /* array of backtrack Coverage tables */ - HB_UShort InputGlyphCount; - /* number of input glyphs */ HB_Coverage* InputCoverage; /* array of input coverage tables */ - HB_UShort LookaheadGlyphCount; - /* number of lookahead glyphs */ HB_Coverage* LookaheadCoverage; /* array of lookahead coverage tables */ - HB_UShort SubstCount; /* number of SubstLookupRecords */ HB_SubstLookupRecord* SubstLookupRecord; /* array of substitution lookups */ + HB_UShort BacktrackGlyphCount; + /* number of backtrack glyphs */ + HB_UShort InputGlyphCount; + /* number of input glyphs */ + HB_UShort LookaheadGlyphCount; + /* number of lookahead glyphs */ + HB_UShort SubstCount; /* number of SubstLookupRecords */ }; typedef struct HB_ChainContextSubstFormat3_ HB_ChainContextSubstFormat3; @@ -404,14 +407,14 @@ typedef struct HB_ChainContextSubstFormat3_ HB_ChainContextSubstFormat3; struct HB_ChainContextSubst_ { - HB_UShort SubstFormat; /* 1, 2, or 3 */ - union { HB_ChainContextSubstFormat1 ccsf1; HB_ChainContextSubstFormat2 ccsf2; HB_ChainContextSubstFormat3 ccsf3; } ccsf; + + HB_Byte SubstFormat; /* 1, 2, or 3 */ }; typedef struct HB_ChainContextSubst_ HB_ChainContextSubst; @@ -421,9 +424,9 @@ typedef struct HB_ChainContextSubst_ HB_ChainContextSubst; /* LookupType 7 */ struct HB_ExtensionSubst_ { + HB_GSUB_SubTable *subtable; /* referenced subtable */ HB_UShort SubstFormat; /* always 1 */ HB_UShort LookuptType; /* lookup-type of referenced subtable */ - HB_GSUB_SubTable *subtable; /* referenced subtable */ }; typedef struct HB_ExtensionSubst_ HB_ExtensionSubst; @@ -433,16 +436,16 @@ typedef struct HB_ExtensionSubst_ HB_ExtensionSubst; /* LookupType 8 */ struct HB_ReverseChainContextSubst_ { - HB_UShort SubstFormat; /* always 1 */ - HB_Coverage Coverage; /* coverage table for input glyphs */ - HB_UShort BacktrackGlyphCount; /* number of backtrack glyphs */ + HB_Coverage* LookaheadCoverage; /* array of lookahead Coverage + tables */ + HB_UShort* Substitute; /* array of substitute Glyph ID */ HB_Coverage* BacktrackCoverage; /* array of backtrack Coverage tables */ + HB_Coverage Coverage; /* coverage table for input glyphs */ + HB_UShort SubstFormat; /* always 1 */ + HB_UShort BacktrackGlyphCount; /* number of backtrack glyphs */ HB_UShort LookaheadGlyphCount; /* number of lookahead glyphs */ - HB_Coverage* LookaheadCoverage; /* array of lookahead Coverage - tables */ HB_UShort GlyphCount; /* number of Glyph IDs */ - HB_UShort* Substitute; /* array of substitute Glyph ID */ }; typedef struct HB_ReverseChainContextSubst_ HB_ReverseChainContextSubst; @@ -471,6 +474,10 @@ HB_INTERNAL void _HB_GSUB_Free_SubTable( HB_GSUB_SubTable* st, HB_UShort lookup_type ); +#ifdef HB_USE_PACKED_STRUCTS +#pragma pack(pop) +#endif + HB_END_HEADER #endif /* HARFBUZZ_GSUB_PRIVATE_H */ diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-gsub.h b/src/3rdparty/harfbuzz/src/harfbuzz-gsub.h index 1ca3f0c..b00df44 100644 --- a/src/3rdparty/harfbuzz/src/harfbuzz-gsub.h +++ b/src/3rdparty/harfbuzz/src/harfbuzz-gsub.h @@ -32,6 +32,10 @@ HB_BEGIN_HEADER +#ifdef HB_USE_PACKED_STRUCTS +#pragma pack(push, 1) +#endif + /* Lookup types for glyph substitution */ #define HB_GSUB_LOOKUP_SINGLE 1 @@ -60,6 +64,14 @@ typedef HB_UShort (*HB_AltFunction)(HB_UInt pos, struct HB_GSUBHeader_ { + HB_GDEFHeader* gdef; + + /* the next two fields are used for an alternate substitution callback + function to select the proper alternate glyph. */ + + void* data; + HB_AltFunction altfunc; + HB_UInt offset; HB_16Dot16 Version; @@ -67,14 +79,6 @@ struct HB_GSUBHeader_ HB_ScriptList ScriptList; HB_FeatureList FeatureList; HB_LookupList LookupList; - - HB_GDEFHeader* gdef; - - /* the next two fields are used for an alternate substitution callback - function to select the proper alternate glyph. */ - - HB_AltFunction altfunc; - void* data; }; typedef struct HB_GSUBHeader_ HB_GSUBHeader; @@ -135,6 +139,9 @@ HB_Error HB_GSUB_Register_Alternate_Function( HB_GSUBHeader* gsub, HB_Error HB_GSUB_Apply_String( HB_GSUBHeader* gsub, HB_Buffer buffer ); +#ifdef HB_USE_PACKED_STRUCTS +#pragma pack(pop) +#endif HB_END_HEADER diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-hangul.c b/src/3rdparty/harfbuzz/src/harfbuzz-hangul.c index a819dac..6f89ed6 100644 --- a/src/3rdparty/harfbuzz/src/harfbuzz-hangul.c +++ b/src/3rdparty/harfbuzz/src/harfbuzz-hangul.c @@ -130,7 +130,7 @@ static int hangul_nextSyllableBoundary(const HB_UChar16 *s, int start, int end) static const HB_OpenTypeFeature hangul_features [] = { { HB_MAKE_TAG('c', 'c', 'm', 'p'), CcmpProperty }, { HB_MAKE_TAG('l', 'j', 'm', 'o'), CcmpProperty }, - { HB_MAKE_TAG('j', 'j', 'm', 'o'), CcmpProperty }, + { HB_MAKE_TAG('v', 'j', 'm', 'o'), CcmpProperty }, { HB_MAKE_TAG('t', 'j', 'm', 'o'), CcmpProperty }, { 0, 0 } }; diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-open-private.h b/src/3rdparty/harfbuzz/src/harfbuzz-open-private.h index 73dd383..1f7b353 100644 --- a/src/3rdparty/harfbuzz/src/harfbuzz-open-private.h +++ b/src/3rdparty/harfbuzz/src/harfbuzz-open-private.h @@ -69,7 +69,7 @@ _HB_OPEN_Load_EmptyOrClassDefinition( HB_ClassDefinition* cd, HB_UInt base_offset, HB_Stream input ); HB_INTERNAL HB_Error -_HB_OPEN_Load_Device( HB_Device* d, +_HB_OPEN_Load_Device( HB_Device** d, HB_Stream input ); HB_INTERNAL void _HB_OPEN_Free_ScriptList( HB_ScriptList* sl ); @@ -79,7 +79,7 @@ HB_INTERNAL void _HB_OPEN_Free_LookupList( HB_LookupList* ll, HB_INTERNAL void _HB_OPEN_Free_Coverage( HB_Coverage* c ); HB_INTERNAL void _HB_OPEN_Free_ClassDefinition( HB_ClassDefinition* cd ); -HB_INTERNAL void _HB_OPEN_Free_Device( HB_Device* d ); +HB_INTERNAL void _HB_OPEN_Free_Device( HB_Device** d ); @@ -93,7 +93,7 @@ _HB_OPEN_Get_Class( HB_ClassDefinition* cd, HB_UShort* klass, HB_UShort* index ); HB_INTERNAL HB_Error -_HB_OPEN_Get_Device( HB_Device* d, +_HB_OPEN_Get_Device( HB_Device** d, HB_UShort size, HB_Short* value ); diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-open.c b/src/3rdparty/harfbuzz/src/harfbuzz-open.c index 0fe1e4d..4fc6ed1 100644 --- a/src/3rdparty/harfbuzz/src/harfbuzz-open.c +++ b/src/3rdparty/harfbuzz/src/harfbuzz-open.c @@ -1282,7 +1282,7 @@ _HB_OPEN_Get_Class( HB_ClassDefinition* cd, HB_INTERNAL HB_Error -_HB_OPEN_Load_Device( HB_Device* d, +_HB_OPEN_Load_Device( HB_Device** device, HB_Stream stream ) { HB_Error error; @@ -1295,6 +1295,14 @@ _HB_OPEN_Load_Device( HB_Device* d, if ( ACCESS_Frame( 6L ) ) return error; + if ( ALLOC( *device, sizeof(HB_Device)) ) + { + *device = 0; + return error; + } + + HB_Device* d = *device; + d->StartSize = GET_UShort(); d->EndSize = GET_UShort(); d->DeltaFormat = GET_UShort(); @@ -1318,11 +1326,17 @@ _HB_OPEN_Load_Device( HB_Device* d, ( 4 - d->DeltaFormat ) ) + 1; if ( ALLOC_ARRAY( d->DeltaValue, count, HB_UShort ) ) + { + FREE( *device ); + *device = 0; return error; + } if ( ACCESS_Frame( count * 2L ) ) { FREE( d->DeltaValue ); + FREE( *device ); + *device = 0; return error; } @@ -1338,9 +1352,13 @@ _HB_OPEN_Load_Device( HB_Device* d, HB_INTERNAL void -_HB_OPEN_Free_Device( HB_Device* d ) +_HB_OPEN_Free_Device( HB_Device** d ) { - FREE( d->DeltaValue ); + if ( *d ) + { + FREE( (*d)->DeltaValue ); + FREE( *d ); + } } @@ -1380,12 +1398,20 @@ _HB_OPEN_Free_Device( HB_Device* d ) mask = 0x00FF */ HB_INTERNAL HB_Error -_HB_OPEN_Get_Device( HB_Device* d, +_HB_OPEN_Get_Device( HB_Device** device, HB_UShort size, HB_Short* value ) { HB_UShort byte, bits, mask, f, s; + HB_Error error; + + if ( ALLOC( *device, sizeof(HB_Device)) ) + { + *device = 0; + return error; + } + HB_Device* d = *device; f = d->DeltaFormat; @@ -1408,6 +1434,8 @@ _HB_OPEN_Get_Device( HB_Device* d, else { *value = 0; + FREE( *device ); + *device = 0; return HB_Err_Not_Covered; } } diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-open.h b/src/3rdparty/harfbuzz/src/harfbuzz-open.h index bdc6358..4ba6cf5 100644 --- a/src/3rdparty/harfbuzz/src/harfbuzz-open.h +++ b/src/3rdparty/harfbuzz/src/harfbuzz-open.h @@ -30,6 +30,10 @@ HB_BEGIN_HEADER +#ifdef HB_USE_PACKED_STRUCTS +#pragma pack(push, 1) +#endif + /* Use this if a feature applies to all glyphs */ #define HB_ALL_GLYPHS 0xFFFF @@ -42,10 +46,10 @@ HB_BEGIN_HEADER struct HB_LangSys_ { + HB_UShort* FeatureIndex; /* array of Feature indices */ HB_UShort LookupOrderOffset; /* always 0 for TT Open 1.0 */ HB_UShort ReqFeatureIndex; /* required FeatureIndex */ HB_UShort FeatureCount; /* number of Feature indices */ - HB_UShort* FeatureIndex; /* array of Feature indices */ }; typedef struct HB_LangSys_ HB_LangSys; @@ -53,8 +57,8 @@ typedef struct HB_LangSys_ HB_LangSys; struct HB_LangSysRecord_ { - HB_UInt LangSysTag; /* LangSysTag identifier */ HB_LangSys LangSys; /* LangSys table */ + HB_UInt LangSysTag; /* LangSysTag identifier */ }; typedef struct HB_LangSysRecord_ HB_LangSysRecord; @@ -62,9 +66,9 @@ typedef struct HB_LangSysRecord_ HB_LangSysRecord; struct HB_ScriptTable_ { + HB_LangSysRecord* LangSysRecord; /* array of LangSysRecords */ HB_LangSys DefaultLangSys; /* DefaultLangSys table */ HB_UShort LangSysCount; /* number of LangSysRecords */ - HB_LangSysRecord* LangSysRecord; /* array of LangSysRecords */ }; typedef struct HB_ScriptTable_ HB_ScriptTable; @@ -81,8 +85,8 @@ typedef struct HB_ScriptRecord_ HB_ScriptRecord; struct HB_ScriptList_ { - HB_UShort ScriptCount; /* number of ScriptRecords */ HB_ScriptRecord* ScriptRecord; /* array of ScriptRecords */ + HB_UShort ScriptCount; /* number of ScriptRecords */ }; typedef struct HB_ScriptList_ HB_ScriptList; @@ -92,9 +96,9 @@ typedef struct HB_ScriptList_ HB_ScriptList; struct HB_Feature_ { + HB_UShort* LookupListIndex; /* array of LookupList indices */ HB_UShort FeatureParams; /* always 0 for TT Open 1.0 */ HB_UShort LookupListCount; /* number of LookupList indices */ - HB_UShort* LookupListIndex; /* array of LookupList indices */ }; typedef struct HB_Feature_ HB_Feature; @@ -111,9 +115,9 @@ typedef struct HB_FeatureRecord_ HB_FeatureRecord; struct HB_FeatureList_ { - HB_UShort FeatureCount; /* number of FeatureRecords */ - HB_FeatureRecord* FeatureRecord; /* array of FeatureRecords */ HB_UShort* ApplyOrder; /* order to apply features */ + HB_FeatureRecord* FeatureRecord; /* array of FeatureRecords */ + HB_UShort FeatureCount; /* number of FeatureRecords */ HB_UShort ApplyCount; /* number of elements in ApplyOrder */ }; @@ -127,10 +131,10 @@ typedef struct HB_SubTable_ HB_SubTable; struct HB_Lookup_ { + HB_SubTable* SubTable; /* array of SubTables */ HB_UShort LookupType; /* Lookup type */ HB_UShort LookupFlag; /* Lookup qualifiers */ HB_UShort SubTableCount; /* number of SubTables */ - HB_SubTable* SubTable; /* array of SubTables */ }; typedef struct HB_Lookup_ HB_Lookup; @@ -144,9 +148,9 @@ typedef struct HB_Lookup_ HB_Lookup; struct HB_LookupList_ { - HB_UShort LookupCount; /* number of Lookups */ HB_Lookup* Lookup; /* array of Lookup records */ HB_UInt* Properties; /* array of flags */ + HB_UShort LookupCount; /* number of Lookups */ }; typedef struct HB_LookupList_ HB_LookupList; @@ -167,8 +171,8 @@ typedef struct HB_LookupList_ HB_LookupList; struct HB_CoverageFormat1_ { - HB_UShort GlyphCount; /* number of glyphs in GlyphArray */ HB_UShort* GlyphArray; /* array of glyph IDs */ + HB_UShort GlyphCount; /* number of glyphs in GlyphArray */ }; typedef struct HB_CoverageFormat1_ HB_CoverageFormat1; @@ -187,8 +191,8 @@ typedef struct HB_RangeRecord_ HB_RangeRecord; struct HB_CoverageFormat2_ { - HB_UShort RangeCount; /* number of RangeRecords */ HB_RangeRecord* RangeRecord; /* array of RangeRecords */ + HB_UShort RangeCount; /* number of RangeRecords */ }; typedef struct HB_CoverageFormat2_ HB_CoverageFormat2; @@ -196,7 +200,7 @@ typedef struct HB_CoverageFormat2_ HB_CoverageFormat2; struct HB_Coverage_ { - HB_UShort CoverageFormat; /* 1 or 2 */ + HB_Byte CoverageFormat; /* 1 or 2 */ union { @@ -210,10 +214,10 @@ typedef struct HB_Coverage_ HB_Coverage; struct HB_ClassDefFormat1_ { + HB_UShort* ClassValueArray; /* array of class values */ HB_UShort StartGlyph; /* first glyph ID of the ClassValueArray */ HB_UShort GlyphCount; /* size of the ClassValueArray */ - HB_UShort* ClassValueArray; /* array of class values */ }; typedef struct HB_ClassDefFormat1_ HB_ClassDefFormat1; @@ -231,10 +235,10 @@ typedef struct HB_ClassRangeRecord_ HB_ClassRangeRecord; struct HB_ClassDefFormat2_ { - HB_UShort ClassRangeCount; - /* number of ClassRangeRecords */ HB_ClassRangeRecord* ClassRangeRecord; /* array of ClassRangeRecords */ + HB_UShort ClassRangeCount; + /* number of ClassRangeRecords */ }; typedef struct HB_ClassDefFormat2_ HB_ClassDefFormat2; @@ -242,15 +246,14 @@ typedef struct HB_ClassDefFormat2_ HB_ClassDefFormat2; struct HB_ClassDefinition_ { - HB_Bool loaded; - - HB_UShort ClassFormat; /* 1 or 2 */ - union { HB_ClassDefFormat1 cd1; HB_ClassDefFormat2 cd2; } cd; + + HB_Byte ClassFormat; /* 1 or 2 */ + HB_Bool loaded; }; typedef struct HB_ClassDefinition_ HB_ClassDefinition; @@ -258,11 +261,11 @@ typedef struct HB_ClassDefinition_ HB_ClassDefinition; struct HB_Device_ { + HB_UShort* DeltaValue; /* array of compressed data */ HB_UShort StartSize; /* smallest size to correct */ HB_UShort EndSize; /* largest size to correct */ - HB_UShort DeltaFormat; /* DeltaValue array data format: + HB_Byte DeltaFormat; /* DeltaValue array data format: 1, 2, or 3 */ - HB_UShort* DeltaValue; /* array of compressed data */ }; typedef struct HB_Device_ HB_Device; @@ -276,6 +279,9 @@ enum HB_Type_ typedef enum HB_Type_ HB_Type; +#ifdef HB_USE_PACKED_STRUCTS +#pragma pack(pop) +#endif HB_END_HEADER diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-shaper-all.cpp b/src/3rdparty/harfbuzz/src/harfbuzz-shaper-all.cpp index d2f902f..2dae501 100644 --- a/src/3rdparty/harfbuzz/src/harfbuzz-shaper-all.cpp +++ b/src/3rdparty/harfbuzz/src/harfbuzz-shaper-all.cpp @@ -25,6 +25,7 @@ #include "harfbuzz-shaper.cpp" #include "harfbuzz-indic.cpp" extern "C" { +#include "harfbuzz-greek.c" #include "harfbuzz-tibetan.c" #include "harfbuzz-khmer.c" #include "harfbuzz-hebrew.c" diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-shaper-private.h b/src/3rdparty/harfbuzz/src/harfbuzz-shaper-private.h index 2fce7df..e1360c7 100644 --- a/src/3rdparty/harfbuzz/src/harfbuzz-shaper-private.h +++ b/src/3rdparty/harfbuzz/src/harfbuzz-shaper-private.h @@ -103,6 +103,7 @@ typedef struct { extern const HB_ScriptEngine hb_scriptEngines[]; extern HB_Bool HB_BasicShape(HB_ShaperItem *shaper_item); +extern HB_Bool HB_GreekShape(HB_ShaperItem *shaper_item); extern HB_Bool HB_TibetanShape(HB_ShaperItem *shaper_item); extern HB_Bool HB_HebrewShape(HB_ShaperItem *shaper_item); extern HB_Bool HB_ArabicShape(HB_ShaperItem *shaper_item); diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-shaper.cpp b/src/3rdparty/harfbuzz/src/harfbuzz-shaper.cpp index ff69304..ce4d4ac 100644 --- a/src/3rdparty/harfbuzz/src/harfbuzz-shaper.cpp +++ b/src/3rdparty/harfbuzz/src/harfbuzz-shaper.cpp @@ -584,7 +584,7 @@ const HB_ScriptEngine HB_ScriptEngines[] = { // Common { HB_BasicShape, 0}, // Greek - { HB_BasicShape, 0}, + { HB_GreekShape, 0}, // Cyrillic { HB_BasicShape, 0}, // Armenian diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-shaper.h b/src/3rdparty/harfbuzz/src/harfbuzz-shaper.h index f7c7714..32f5781 100644 --- a/src/3rdparty/harfbuzz/src/harfbuzz-shaper.h +++ b/src/3rdparty/harfbuzz/src/harfbuzz-shaper.h @@ -34,6 +34,22 @@ HB_BEGIN_HEADER +#ifdef HB_USE_PACKED_STRUCTS +#pragma pack(push, 1) +#endif + +/* + using anything else than signed or unsigned for bitfields in C is non standard, + but accepted by almost all compilers. And it gives a significant reduction in + memory consumption as HB_CharAttributes and HB_GlyphAttributes will not have + a 4 byte alignment +*/ +#ifdef __xlC__ +typedef unsigned hb_bitfield; +#else +typedef hb_uint8 hb_bitfield; +#endif + typedef enum { HB_Script_Common, HB_Script_Greek, @@ -123,12 +139,12 @@ typedef enum { typedef struct { - /*HB_LineBreakType*/ unsigned lineBreakType :2; - /*HB_Bool*/ unsigned whiteSpace :1; /* A unicode whitespace character, except NBSP, ZWNBSP */ - /*HB_Bool*/ unsigned charStop :1; /* Valid cursor position (for left/right arrow) */ - /*HB_Bool*/ unsigned wordBoundary :1; - /*HB_Bool*/ unsigned sentenceBoundary :1; - unsigned unused :2; + /*HB_LineBreakType*/ hb_bitfield lineBreakType :2; + /*HB_Bool*/ hb_bitfield whiteSpace :1; /* A unicode whitespace character, except NBSP, ZWNBSP */ + /*HB_Bool*/ hb_bitfield charStop :1; /* Valid cursor position (for left/right arrow) */ + /*HB_Bool*/ hb_bitfield wordBoundary :1; + /*HB_Bool*/ hb_bitfield sentenceBoundary :1; + hb_bitfield unused :2; } HB_CharAttributes; void HB_GetCharAttributes(const HB_UChar16 *string, hb_uint32 stringLength, @@ -181,12 +197,12 @@ typedef enum { * it like that. If this is a problem please tell Trolltech :) */ typedef struct { - unsigned justification :4; /* Justification class */ - unsigned clusterStart :1; /* First glyph of representation of cluster */ - unsigned mark :1; /* needs to be positioned around base char */ - unsigned zeroWidth :1; /* ZWJ, ZWNJ etc, with no width */ - unsigned dontPrint :1; - unsigned combiningClass :8; + hb_bitfield justification :4; /* Justification class */ + hb_bitfield clusterStart :1; /* First glyph of representation of cluster */ + hb_bitfield mark :1; /* needs to be positioned around base char */ + hb_bitfield zeroWidth :1; /* ZWJ, ZWNJ etc, with no width */ + hb_bitfield dontPrint :1; + hb_bitfield combiningClass :8; } HB_GlyphAttributes; typedef struct HB_FaceRec_ { @@ -269,6 +285,10 @@ struct HB_ShaperItem_ { HB_Bool HB_ShapeItem(HB_ShaperItem *item); +#ifdef HB_USE_PACKED_STRUCTS +#pragma pack(pop) +#endif + HB_END_HEADER #endif diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-stream.h b/src/3rdparty/harfbuzz/src/harfbuzz-stream.h index 9991936..a155cc2 100644 --- a/src/3rdparty/harfbuzz/src/harfbuzz-stream.h +++ b/src/3rdparty/harfbuzz/src/harfbuzz-stream.h @@ -30,15 +30,21 @@ HB_BEGIN_HEADER +#ifdef HB_USE_PACKED_STRUCTS +#pragma pack(push, 1) +#endif + typedef struct HB_StreamRec_ { HB_Byte* base; + HB_Byte* cursor; HB_UInt size; HB_UInt pos; - - HB_Byte* cursor; } HB_StreamRec; +#ifdef HB_USE_PACKED_STRUCTS +#pragma pack(pop) +#endif HB_END_HEADER diff --git a/src/3rdparty/harfbuzz/tests/fuzzing/fuzz.cc b/src/3rdparty/harfbuzz/tests/fuzzing/fuzz.cc new file mode 100644 index 0000000..133577a --- /dev/null +++ b/src/3rdparty/harfbuzz/tests/fuzzing/fuzz.cc @@ -0,0 +1,124 @@ +// This is a fuzzing harness for Harfbuzz. Since Harfbuzz's input is generally +// expected to be controlled by a remote party it's a possible vector for +// security issues. +// +// Fuzzing is a black-box testing scheme where the black-box (Harfbuzz's shaping +// engine in this case) is fed random input to see if it will misbehave. +// Misbehaviours can often be turned into security or crash issues. +// +// It's expected that one will generally run this under valgrind in order to get +// better detection of problems. + +#include +#include + +#include +#include FT_FREETYPE_H + +#include "../../src/harfbuzz-shaper.h" +#include "../../src/harfbuzz-global.h" +#include "../../src/harfbuzz-gpos.h" + +extern "C" { +#include "../../contrib/harfbuzz-unicode.h" +#include "../../contrib/harfbuzz-freetype.h" +} + +static FT_Library freetype; + +static FT_Face loadFace(const char *path) +{ + FT_Face face; + + if (FT_New_Face(freetype, path, /* index */ 0, &face)) + return 0; + return face; +} + +static const int kWidth = 100; +static const int kHeight = 100; + +static int +usage(const char *argv0) { + fprintf(stderr, "Usage: %s \n", argv0); + return 1; +} + +int +main(int argc, char **argv) { + FT_Init_FreeType(&freetype); + + if (argc != 2) + return usage(argv[0]); + + FT_Face face; + if (FT_New_Face(freetype, argv[1], 0 /* face index */, &face)) { + fprintf(stderr, "Failed to load font file\n"); + return 1; + } + + HB_Face hbFace = HB_NewFace(face, hb_freetype_table_sfnt_get); + + HB_FontRec hbFont; + hbFont.klass = &hb_freetype_class; + hbFont.userData = face; + hbFont.x_ppem = face->size->metrics.x_ppem; + hbFont.y_ppem = face->size->metrics.y_ppem; + hbFont.x_scale = face->size->metrics.x_scale; + hbFont.y_scale = face->size->metrics.y_scale; + + // This is the maximum number of bytes of input which we'll feed to Harfbuzz + // in one shot. We also overload it and make it the size of the output arrays + // as well. (Must be a power of two.) + static const unsigned kMaxInputBytes = 1024; + uint8_t str[kMaxInputBytes]; + + HB_ShaperItem shaper_item; + shaper_item.kerning_applied = false; + shaper_item.string = (HB_UChar16 *) str; + shaper_item.stringLength = 0; + shaper_item.item.bidiLevel = 0; + shaper_item.shaperFlags = 0; + shaper_item.font = &hbFont; + shaper_item.face = hbFace; + shaper_item.glyphIndicesPresent = false; + shaper_item.initialGlyphCount = 0; + + HB_Glyph out_glyphs[kMaxInputBytes]; + HB_GlyphAttributes out_attrs[kMaxInputBytes]; + HB_Fixed out_advs[kMaxInputBytes]; + HB_FixedPoint out_offsets[kMaxInputBytes]; + unsigned short out_logClusters[kMaxInputBytes]; + + shaper_item.glyphs = out_glyphs; + shaper_item.attributes = out_attrs; + shaper_item.advances = out_advs; + shaper_item.offsets = out_offsets; + shaper_item.log_clusters = out_logClusters; + shaper_item.num_glyphs = kMaxInputBytes; + + FILE *urandom = fopen("/dev/urandom", "rb"); + if (!urandom) { + fprintf(stderr, "Cannot open /dev/urandom\n"); + return 1; + } + + for (;;) { + uint16_t len; + fread(&len, sizeof(len), 1, urandom); + len &= (kMaxInputBytes - 1); + len &= ~1; + fread(str, len, 1, urandom); + + ssize_t iterator = 0; + + for (;;) { + if (!hb_utf16_script_run_next(NULL, &shaper_item.item, (uint16_t *) str, len >> 1, &iterator)) + break; + + HB_ShapeItem(&shaper_item); + } + } + + HB_FreeFace(hbFace); +} -- cgit v0.12 From 277339cdcb5e0adac6ff669745a5390f2bf089b2 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Wed, 16 Jun 2010 00:05:29 +0200 Subject: Buildfix for MSVC2008 (C90 violation) --- src/3rdparty/harfbuzz/src/harfbuzz-open.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-open.c b/src/3rdparty/harfbuzz/src/harfbuzz-open.c index 4fc6ed1..255b7e6 100644 --- a/src/3rdparty/harfbuzz/src/harfbuzz-open.c +++ b/src/3rdparty/harfbuzz/src/harfbuzz-open.c @@ -1285,6 +1285,7 @@ HB_INTERNAL HB_Error _HB_OPEN_Load_Device( HB_Device** device, HB_Stream stream ) { + HB_Device* d; HB_Error error; HB_UShort n, count; @@ -1301,7 +1302,7 @@ _HB_OPEN_Load_Device( HB_Device** device, return error; } - HB_Device* d = *device; + d = *device; d->StartSize = GET_UShort(); d->EndSize = GET_UShort(); @@ -1402,6 +1403,7 @@ _HB_OPEN_Get_Device( HB_Device** device, HB_UShort size, HB_Short* value ) { + HB_Device* d; HB_UShort byte, bits, mask, f, s; HB_Error error; @@ -1411,7 +1413,7 @@ _HB_OPEN_Get_Device( HB_Device** device, return error; } - HB_Device* d = *device; + d = *device; f = d->DeltaFormat; -- cgit v0.12 From f2e1860147eaf42f82feeb4316f083ca0de879c9 Mon Sep 17 00:00:00 2001 From: Kurt Korbatits Date: Wed, 16 Jun 2010 15:08:43 +1000 Subject: VideoWidget example Added file filters to videowidget and videographicsitem examples to only allow supported file formats to be opened. Task-number:QTBUG-702 Reviewed-by:Andrew den Exter --- examples/multimedia/videographicsitem/videoplayer.cpp | 15 ++++++++++++++- examples/multimedia/videowidget/videoplayer.cpp | 15 ++++++++++++++- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/examples/multimedia/videographicsitem/videoplayer.cpp b/examples/multimedia/videographicsitem/videoplayer.cpp index 4e1f5ca..a08cc57 100644 --- a/examples/multimedia/videographicsitem/videoplayer.cpp +++ b/examples/multimedia/videographicsitem/videoplayer.cpp @@ -116,7 +116,20 @@ VideoPlayer::~VideoPlayer() void VideoPlayer::openFile() { - QString fileName = QFileDialog::getOpenFileName(this, tr("Open Movie")); + QStringList supportedFormats; + foreach (QString fmt, QMovie::supportedFormats()) + supportedFormats << fmt; + foreach (QString fmt, QImageReader::supportedImageFormats()) + supportedFormats << fmt; + + QString filter = "Images ("; + foreach ( QString fmt, supportedFormats) { + filter.append(QString("*.%1 ").arg(fmt)); + } + filter.append(")"); + + QString fileName = QFileDialog::getOpenFileName(this, tr("Open Movie"), + QDir::homePath(), filter); if (!fileName.isEmpty()) { videoItem->stop(); diff --git a/examples/multimedia/videowidget/videoplayer.cpp b/examples/multimedia/videowidget/videoplayer.cpp index 12d17cf..9d79b70 100644 --- a/examples/multimedia/videowidget/videoplayer.cpp +++ b/examples/multimedia/videowidget/videoplayer.cpp @@ -97,7 +97,20 @@ VideoPlayer::~VideoPlayer() void VideoPlayer::openFile() { - QString fileName = QFileDialog::getOpenFileName(this, tr("Open Movie")); + QStringList supportedFormats; + foreach (QString fmt, QMovie::supportedFormats()) + supportedFormats << fmt; + foreach (QString fmt, QImageReader::supportedImageFormats()) + supportedFormats << fmt; + + QString filter = "Images ("; + foreach ( QString fmt, supportedFormats) { + filter.append(QString("*.%1 ").arg(fmt)); + } + filter.append(")"); + + QString fileName = QFileDialog::getOpenFileName(this, tr("Open Movie"), + QDir::homePath(), filter); if (!fileName.isEmpty()) { surface->stop(); -- cgit v0.12 From 07a902000950a4aa6eebf2072afb83eee3eb3d5f Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Wed, 16 Jun 2010 09:57:24 +0200 Subject: Updated Harfbuzz from git+ssh://git.freedesktop.org/git/harfbuzz to 5e9b2a88688f6e360d7db00bc86a45bf2cf86e52 Includes Andreas' MSVC fix and fixes the RVCT build by temporarily disabling the structure packing. --- src/3rdparty/harfbuzz/src/harfbuzz-global.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-global.h b/src/3rdparty/harfbuzz/src/harfbuzz-global.h index 5b2b679..bccd6a2 100644 --- a/src/3rdparty/harfbuzz/src/harfbuzz-global.h +++ b/src/3rdparty/harfbuzz/src/harfbuzz-global.h @@ -39,7 +39,7 @@ #define HB_END_HEADER /* nothing */ #endif -#if defined(__GNUC__) || defined(__ARMCC__) || defined(__CC_ARM) || defined(_MSC_VER) +#if defined(__GNUC__) || defined(_MSC_VER) #define HB_USE_PACKED_STRUCTS #endif -- cgit v0.12 From e32635b46b2f2b78eb18c5b195e0bdaf8c7f9b71 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Wed, 16 Jun 2010 10:22:47 +0200 Subject: Updated WebKit from /home/shausman/src/webkit/trunk to qtwebkit/qtwebkit-4.6 ( 7932e8da6bfdeff653c572c22aed879c8c308829 ) Changes in WebKit/qt since the last update: * https://bugs.webkit.org/show_bug.cgi?id=39857 -- GIFs loop one time too few --- src/3rdparty/webkit/VERSION | 2 +- src/3rdparty/webkit/WebCore/ChangeLog | 31 ++++++++++++++++++++++ .../WebCore/platform/graphics/BitmapImage.cpp | 4 ++- .../webkit/WebCore/platform/graphics/ImageSource.h | 17 +++++++++++- .../platform/graphics/qt/ImageDecoderQt.cpp | 18 +------------ 5 files changed, 52 insertions(+), 20 deletions(-) diff --git a/src/3rdparty/webkit/VERSION b/src/3rdparty/webkit/VERSION index b92486d..4c895fb 100644 --- a/src/3rdparty/webkit/VERSION +++ b/src/3rdparty/webkit/VERSION @@ -8,4 +8,4 @@ The commit imported was from the and has the sha1 checksum - d8a9d09376a47b92ea49f1a078c392cbfdbc0ed6 + 7932e8da6bfdeff653c572c22aed879c8c308829 diff --git a/src/3rdparty/webkit/WebCore/ChangeLog b/src/3rdparty/webkit/WebCore/ChangeLog index bf8b745..09b8598 100644 --- a/src/3rdparty/webkit/WebCore/ChangeLog +++ b/src/3rdparty/webkit/WebCore/ChangeLog @@ -1,3 +1,34 @@ +2010-05-28 Peter Kasting + + Reviewed by Darin Adler. + + https://bugs.webkit.org/show_bug.cgi?id=39857 + Make GIFs loop the correct number of times. Previously, everyone looped + one time too few for non-infinitely-looping GIFs. + + Modified a Qt manual test to be correct and moved it to the general + manual test directory. + + * manual-tests/animated-gif-looping.html: Copied from WebCore/manual-tests/qt/qt-gif-test.html. + * manual-tests/qt/qt-10loop-anim.gif: Removed. + * manual-tests/qt/qt-anim.gif: Removed. + * manual-tests/qt/qt-gif-test.html: Removed. + * manual-tests/qt/qt-noanim.gif: Removed. + * manual-tests/resources/animated-10x.gif: Copied from WebCore/manual-tests/qt/qt-10loop-anim.gif and modified. + * manual-tests/resources/animated-infinite.gif: Copied from WebCore/manual-tests/qt/qt-anim.gif. + * manual-tests/resources/non-animated.gif: Copied from WebCore/manual-tests/qt/qt-noanim.gif. + * platform/graphics/BitmapImage.cpp: + (WebCore::BitmapImage::internalAdvanceAnimation): For a loop count of n, show a total of n + 1 animation cycles. + * platform/graphics/ImageSource.h: + * platform/graphics/cg/ImageSourceCG.cpp: + (WebCore::ImageSource::repetitionCount): + * platform/graphics/qt/ImageDecoderQt.cpp: + (WebCore::ImageDecoderQt::repetitionCount): Remove translation code now that WebCore matches Qt's internal handling of the loop count. Qt itself may still have a bug here. + * platform/image-decoders/gif/GIFImageDecoder.cpp: + (WebCore::GIFImageDecoder::repetitionCount): + * platform/image-decoders/gif/GIFImageReader.cpp: + (GIFImageReader::read): Translate loop count 0 to "loop infinitely" (by restoring one piece of the Mozilla code we'd removed). + 2010-06-08 Kenneth Rohde Christiansen Unreviewed Buildbot fix. diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/BitmapImage.cpp b/src/3rdparty/webkit/WebCore/platform/graphics/BitmapImage.cpp index 32aefc9..4faf19d 100644 --- a/src/3rdparty/webkit/WebCore/platform/graphics/BitmapImage.cpp +++ b/src/3rdparty/webkit/WebCore/platform/graphics/BitmapImage.cpp @@ -404,7 +404,9 @@ bool BitmapImage::internalAdvanceAnimation(bool skippingFrames) // Get the repetition count again. If we weren't able to get a // repetition count before, we should have decoded the whole image by // now, so it should now be available. - if (repetitionCount(true) && m_repetitionsComplete >= m_repetitionCount) { + // Note that we don't need to special-case cAnimationLoopOnce here + // because it is 0 (see comments on its declaration in ImageSource.h). + if (repetitionCount(true) != cAnimationLoopInfinite && m_repetitionsComplete > m_repetitionCount) { m_animationFinished = true; m_desiredFrameStartTime = 0; --m_currentFrame; diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/ImageSource.h b/src/3rdparty/webkit/WebCore/platform/graphics/ImageSource.h index 3559abe..d7b8a64 100644 --- a/src/3rdparty/webkit/WebCore/platform/graphics/ImageSource.h +++ b/src/3rdparty/webkit/WebCore/platform/graphics/ImageSource.h @@ -86,7 +86,22 @@ typedef RefPtr NativeImagePtr; #endif #endif -const int cAnimationLoopOnce = -1; +// Right now GIFs are the only recognized image format that supports animation. +// The animation system and the constants below are designed with this in mind. +// GIFs have an optional 16-bit unsigned loop count that describes how an +// animated GIF should be cycled. If the loop count is absent, the animation +// cycles once; if it is 0, the animation cycles infinitely; otherwise the +// animation plays n + 1 cycles (where n is the specified loop count). If the +// GIF decoder defaults to cAnimationLoopOnce in the absence of any loop count +// and translates an explicit "0" loop count to cAnimationLoopInfinite, then we +// get a couple of nice side effects: +// * By making cAnimationLoopOnce be 0, we allow the animation cycling code in +// BitmapImage.cpp to avoid special-casing it, and simply treat all +// non-negative loop counts identically. +// * By making the other two constants negative, we avoid conflicts with any +// real loop count values. +const int cAnimationLoopOnce = 0; +const int cAnimationLoopInfinite = -1; const int cAnimationNone = -2; class ImageSource : public Noncopyable { diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/qt/ImageDecoderQt.cpp b/src/3rdparty/webkit/WebCore/platform/graphics/qt/ImageDecoderQt.cpp index 764b240..53f0c6b 100644 --- a/src/3rdparty/webkit/WebCore/platform/graphics/qt/ImageDecoderQt.cpp +++ b/src/3rdparty/webkit/WebCore/platform/graphics/qt/ImageDecoderQt.cpp @@ -114,24 +114,8 @@ size_t ImageDecoderQt::frameCount() int ImageDecoderQt::repetitionCount() const { - if (m_reader && m_reader->supportsAnimation()) { + if (m_reader && m_reader->supportsAnimation()) m_repetitionCount = m_reader->loopCount(); - - // Qt and WebCore have a incompatible understanding of - // the loop count and we can not completely map everything. - // Qt | WebCore | description - // -1 | 0 | infinite animation - // 0 | cAnimationLoopOnce | show every frame once - // n | n+1 | Qt returns the # of iterations - 1 - // n/a | cAnimationNone | show only the first frame - if (m_repetitionCount == -1) - m_repetitionCount = 0; - else if (m_repetitionCount == 0) - m_repetitionCount = cAnimationLoopOnce; - else - ++m_repetitionCount; - } - return m_repetitionCount; } -- cgit v0.12