commit c1dedd62a0289369bbd869c781f0dc51b9e40c6f
Author: Jiayi Yin
Date: Sun May 18 18:23:32 2025 +0000
转换LFS仓库为普通仓库
diff --git a/10-qt5-check-opengl2.sh b/10-qt5-check-opengl2.sh
new file mode 100644
index 0000000..57071d4
--- /dev/null
+++ b/10-qt5-check-opengl2.sh
@@ -0,0 +1,14 @@
+#!/bin/bash
+
+if [ -z "$QT_XCB_FORCE_SOFTWARE_OPENGL" ]; then
+
+QT5_CHECK_OPENGL_VERSION=`LANG=C glxinfo 2> /dev/null | grep '^OpenGL version string: ' | head -n 1 | sed -e 's/^OpenGL version string: \([0-9]\).*$/\1/g'` ||:
+
+if [ "$QT5_CHECK_OPENGL_VERSION" == "1" ]; then
+ QT_XCB_FORCE_SOFTWARE_OPENGL=1
+ export QT_XCB_FORCE_SOFTWARE_OPENGL
+fi
+
+unset QT5_CHECK_OPENGL_VERSION
+
+fi
diff --git a/CVE-2023-37369.patch b/CVE-2023-37369.patch
new file mode 100644
index 0000000..ad2984f
--- /dev/null
+++ b/CVE-2023-37369.patch
@@ -0,0 +1,203 @@
+diff --git a/src/corelib/serialization/qxmlstream.cpp b/src/corelib/serialization/qxmlstream.cpp
+index 7cd457ba3a..11d162cb79 100644
+--- a/src/corelib/serialization/qxmlstream.cpp
++++ b/src/corelib/serialization/qxmlstream.cpp
+@@ -1302,15 +1302,18 @@ inline int QXmlStreamReaderPrivate::fastScanContentCharList()
+ return n;
+ }
+
+-inline int QXmlStreamReaderPrivate::fastScanName(int *prefix)
++// Fast scan an XML attribute name (e.g. "xml:lang").
++inline QXmlStreamReaderPrivate::FastScanNameResult
++QXmlStreamReaderPrivate::fastScanName(Value *val)
+ {
+ int n = 0;
+ uint c;
+ while ((c = getChar()) != StreamEOF) {
+ if (n >= 4096) {
+ // This is too long to be a sensible name, and
+- // can exhaust memory
+- return 0;
++ // can exhaust memory, or the range of decltype(*prefix)
++ raiseNamePrefixTooLongError();
++ return {};
+ }
+ switch (c) {
+ case '\n':
+@@ -1339,23 +1342,23 @@ inline int QXmlStreamReaderPrivate::fastScanName(int *prefix)
+ case '+':
+ case '*':
+ putChar(c);
+- if (prefix && *prefix == n+1) {
+- *prefix = 0;
++ if (val && val->prefix == n + 1) {
++ val->prefix = 0;
+ putChar(':');
+ --n;
+ }
+- return n;
++ return FastScanNameResult(n);
+ case ':':
+- if (prefix) {
+- if (*prefix == 0) {
+- *prefix = n+2;
++ if (val) {
++ if (val->prefix == 0) {
++ val->prefix = n + 2;
+ } else { // only one colon allowed according to the namespace spec.
+ putChar(c);
+- return n;
++ return FastScanNameResult(n);
+ }
+ } else {
+ putChar(c);
+- return n;
++ return FastScanNameResult(n);
+ }
+ Q_FALLTHROUGH();
+ default:
+@@ -1364,12 +1367,12 @@ inline int QXmlStreamReaderPrivate::fastScanName(int *prefix)
+ }
+ }
+
+- if (prefix)
+- *prefix = 0;
++ if (val)
++ val->prefix = 0;
+ int pos = textBuffer.size() - n;
+ putString(textBuffer, pos);
+ textBuffer.resize(pos);
+- return 0;
++ return FastScanNameResult(0);
+ }
+
+ enum NameChar { NameBeginning, NameNotBeginning, NotName };
+@@ -1878,6 +1881,14 @@ void QXmlStreamReaderPrivate::raiseWellFormedError(const QString &message)
+ raiseError(QXmlStreamReader::NotWellFormedError, message);
+ }
+
++void QXmlStreamReaderPrivate::raiseNamePrefixTooLongError()
++{
++ // TODO: add a ImplementationLimitsExceededError and use it instead
++ raiseError(QXmlStreamReader::NotWellFormedError,
++ QXmlStream::tr("Length of XML attribute name exceeds implemnetation limits (4KiB "
++ "characters)."));
++}
++
+ void QXmlStreamReaderPrivate::parseError()
+ {
+
+diff --git a/src/corelib/serialization/qxmlstream.g b/src/corelib/serialization/qxmlstream.g
+index 4321fed68a..8c6a1a5887 100644
+--- a/src/corelib/serialization/qxmlstream.g
++++ b/src/corelib/serialization/qxmlstream.g
+@@ -516,7 +516,16 @@ public:
+ int fastScanLiteralContent();
+ int fastScanSpace();
+ int fastScanContentCharList();
+- int fastScanName(int *prefix = nullptr);
++
++ struct FastScanNameResult {
++ FastScanNameResult() : ok(false) {}
++ explicit FastScanNameResult(int len) : addToLen(len), ok(true) { }
++ operator bool() { return ok; }
++ int operator*() { Q_ASSERT(ok); return addToLen; }
++ int addToLen;
++ bool ok;
++ };
++ FastScanNameResult fastScanName(Value *val = nullptr);
+ inline int fastScanNMTOKEN();
+
+
+@@ -525,6 +534,7 @@ public:
+
+ void raiseError(QXmlStreamReader::Error error, const QString& message = QString());
+ void raiseWellFormedError(const QString &message);
++ void raiseNamePrefixTooLongError();
+
+ QXmlStreamEntityResolver *entityResolver;
+
+@@ -1811,7 +1821,12 @@ space_opt ::= space;
+ qname ::= LETTER;
+ /.
+ case $rule_number: {
+- sym(1).len += fastScanName(&sym(1).prefix);
++ Value &val = sym(1);
++ if (auto res = fastScanName(&val))
++ val.len += *res;
++ else
++ return false;
++
+ if (atEnd) {
+ resume($rule_number);
+ return false;
+@@ -1822,7 +1837,11 @@ qname ::= LETTER;
+ name ::= LETTER;
+ /.
+ case $rule_number:
+- sym(1).len += fastScanName();
++ if (auto res = fastScanName())
++ sym(1).len += *res;
++ else
++ return false;
++
+ if (atEnd) {
+ resume($rule_number);
+ return false;
+diff --git a/src/corelib/serialization/qxmlstream_p.h b/src/corelib/serialization/qxmlstream_p.h
+index e5bde7b98e..b01484cac3 100644
+--- a/src/corelib/serialization/qxmlstream_p.h
++++ b/src/corelib/serialization/qxmlstream_p.h
+@@ -1005,7 +1005,16 @@ public:
+ int fastScanLiteralContent();
+ int fastScanSpace();
+ int fastScanContentCharList();
+- int fastScanName(int *prefix = nullptr);
++
++ struct FastScanNameResult {
++ FastScanNameResult() : ok(false) {}
++ explicit FastScanNameResult(int len) : addToLen(len), ok(true) { }
++ operator bool() { return ok; }
++ int operator*() { Q_ASSERT(ok); return addToLen; }
++ int addToLen;
++ bool ok;
++ };
++ FastScanNameResult fastScanName(Value *val = nullptr);
+ inline int fastScanNMTOKEN();
+
+
+@@ -1014,6 +1023,7 @@ public:
+
+ void raiseError(QXmlStreamReader::Error error, const QString& message = QString());
+ void raiseWellFormedError(const QString &message);
++ void raiseNamePrefixTooLongError();
+
+ QXmlStreamEntityResolver *entityResolver;
+
+@@ -1939,7 +1949,12 @@ bool QXmlStreamReaderPrivate::parse()
+ break;
+
+ case 262: {
+- sym(1).len += fastScanName(&sym(1).prefix);
++ Value &val = sym(1);
++ if (auto res = fastScanName(&val))
++ val.len += *res;
++ else
++ return false;
++
+ if (atEnd) {
+ resume(262);
+ return false;
+@@ -1947,7 +1962,11 @@ bool QXmlStreamReaderPrivate::parse()
+ } break;
+
+ case 263:
+- sym(1).len += fastScanName();
++ if (auto res = fastScanName())
++ sym(1).len += *res;
++ else
++ return false;
++
+ if (atEnd) {
+ resume(263);
+ return false;
diff --git a/CVE-2023-45935.patch b/CVE-2023-45935.patch
new file mode 100644
index 0000000..c8e87f8
--- /dev/null
+++ b/CVE-2023-45935.patch
@@ -0,0 +1,31 @@
+From 33f905df885041e97a465c3706046fa4378ea27f Mon Sep 17 00:00:00 2001
+From: Liang Qi
+Date: 2023-07-31 05:35:11 +0200
+Subject: [PATCH] CVE-2023-45935
+
+port invokeMethodImpl() from QScopeGuard to SlotObjUniquePtr
+
+---
+ src/plugins/platforms/xcb/qxcbatom.cpp | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/src/plugins/platforms/xcb/qxcbatom.cpp b/src/plugins/platforms/xcb/qxcbatom.cpp
+index a769ddad..a33b1b44 100644
+--- a/src/plugins/platforms/xcb/qxcbatom.cpp
++++ b/src/plugins/platforms/xcb/qxcbatom.cpp
+@@ -270,8 +270,10 @@ void QXcbAtom::initializeAllAtoms(xcb_connection_t *connection) {
+
+ for (i = 0; i < QXcbAtom::NAtoms; ++i) {
+ xcb_intern_atom_reply_t *reply = xcb_intern_atom_reply(connection, cookies[i], nullptr);
+- m_allAtoms[i] = reply->atom;
+- free(reply);
++ if (reply) {
++ m_allAtoms[i] = reply->atom;
++ free(reply);
++ }
+ }
+ }
+
+--
+2.27.0
+
diff --git a/CVE-2024-25580-qtbase-5.15.diff b/CVE-2024-25580-qtbase-5.15.diff
new file mode 100644
index 0000000..1628961
--- /dev/null
+++ b/CVE-2024-25580-qtbase-5.15.diff
@@ -0,0 +1,197 @@
+diff --git a/src/gui/util/qktxhandler.cpp b/src/gui/util/qktxhandler.cpp
+index 0d98e97453..6a79e55109 100644
+--- a/src/gui/util/qktxhandler.cpp
++++ b/src/gui/util/qktxhandler.cpp
+@@ -73,7 +73,7 @@ struct KTXHeader {
+ quint32 bytesOfKeyValueData;
+ };
+
+-static const quint32 headerSize = sizeof(KTXHeader);
++static constexpr quint32 qktxh_headerSize = sizeof(KTXHeader);
+
+ // Currently unused, declared for future reference
+ struct KTXKeyValuePairItem {
+@@ -103,11 +103,36 @@ struct KTXMipmapLevel {
+ */
+ };
+
+-bool QKtxHandler::canRead(const QByteArray &suffix, const QByteArray &block)
++static bool qAddOverflow(quint32 v1, quint32 v2, quint32 *r) {
++ // unsigned additions are well-defined
++ *r = v1 + v2;
++ return v1 > quint32(v1 + v2);
++}
++
++// Returns the nearest multiple of 4 greater than or equal to 'value'
++static bool nearestMultipleOf4(quint32 value, quint32 *result)
++{
++ constexpr quint32 rounding = 4;
++ *result = 0;
++ if (qAddOverflow(value, rounding - 1, result))
++ return true;
++ *result &= ~(rounding - 1);
++ return false;
++}
++
++// Returns a slice with prechecked bounds
++static QByteArray safeSlice(const QByteArray& array, quint32 start, quint32 length)
+ {
+- Q_UNUSED(suffix)
++ quint32 end = 0;
++ if (qAddOverflow(start, length, &end) || end > quint32(array.length()))
++ return {};
++ return QByteArray(array.data() + start, length);
++}
+
+- return (qstrncmp(block.constData(), ktxIdentifier, KTX_IDENTIFIER_LENGTH) == 0);
++bool QKtxHandler::canRead(const QByteArray &suffix, const QByteArray &block)
++{
++ Q_UNUSED(suffix);
++ return block.startsWith(QByteArray::fromRawData(ktxIdentifier, KTX_IDENTIFIER_LENGTH));
+ }
+
+ QTextureFileData QKtxHandler::read()
+@@ -115,42 +140,97 @@ QTextureFileData QKtxHandler::read()
+ if (!device())
+ return QTextureFileData();
+
+- QByteArray buf = device()->readAll();
+- const quint32 dataSize = quint32(buf.size());
+- if (dataSize < headerSize || !canRead(QByteArray(), buf)) {
+- qCDebug(lcQtGuiTextureIO, "Invalid KTX file %s", logName().constData());
++ const QByteArray buf = device()->readAll();
++ if (size_t(buf.size()) > std::numeric_limits::max()) {
++ qWarning(lcQtGuiTextureIO, "Too big KTX file %s", logName().constData());
++ return QTextureFileData();
++ }
++
++ if (!canRead(QByteArray(), buf)) {
++ qWarning(lcQtGuiTextureIO, "Invalid KTX file %s", logName().constData());
++ return QTextureFileData();
++ }
++
++ if (buf.size() < qsizetype(qktxh_headerSize)) {
++ qWarning(lcQtGuiTextureIO, "Invalid KTX header size in %s", logName().constData());
+ return QTextureFileData();
+ }
+
+- const KTXHeader *header = reinterpret_cast(buf.constData());
+- if (!checkHeader(*header)) {
+- qCDebug(lcQtGuiTextureIO, "Unsupported KTX file format in %s", logName().constData());
++ KTXHeader header;
++ memcpy(&header, buf.data(), qktxh_headerSize);
++ if (!checkHeader(header)) {
++ qWarning(lcQtGuiTextureIO, "Unsupported KTX file format in %s", logName().constData());
+ return QTextureFileData();
+ }
+
+ QTextureFileData texData;
+ texData.setData(buf);
+
+- texData.setSize(QSize(decode(header->pixelWidth), decode(header->pixelHeight)));
+- texData.setGLFormat(decode(header->glFormat));
+- texData.setGLInternalFormat(decode(header->glInternalFormat));
+- texData.setGLBaseInternalFormat(decode(header->glBaseInternalFormat));
+-
+- texData.setNumLevels(decode(header->numberOfMipmapLevels));
+- quint32 offset = headerSize + decode(header->bytesOfKeyValueData);
+- const int maxLevels = qMin(texData.numLevels(), 32); // Cap iterations in case of corrupt file.
+- for (int i = 0; i < maxLevels; i++) {
+- if (offset + sizeof(KTXMipmapLevel) > dataSize) // Corrupt file; avoid oob read
+- break;
+- const KTXMipmapLevel *level = reinterpret_cast(buf.constData() + offset);
+- quint32 levelLen = decode(level->imageSize);
+- texData.setDataOffset(offset + sizeof(KTXMipmapLevel::imageSize), i);
+- texData.setDataLength(levelLen, i);
+- offset += sizeof(KTXMipmapLevel::imageSize) + levelLen + (3 - ((levelLen + 3) % 4));
++ texData.setSize(QSize(decode(header.pixelWidth), decode(header.pixelHeight)));
++ texData.setGLFormat(decode(header.glFormat));
++ texData.setGLInternalFormat(decode(header.glInternalFormat));
++ texData.setGLBaseInternalFormat(decode(header.glBaseInternalFormat));
++
++ texData.setNumLevels(decode(header.numberOfMipmapLevels));
++
++ const quint32 bytesOfKeyValueData = decode(header.bytesOfKeyValueData);
++ quint32 headerKeyValueSize;
++ if (qAddOverflow(qktxh_headerSize, bytesOfKeyValueData, &headerKeyValueSize)) {
++ qWarning(lcQtGuiTextureIO, "Overflow in size of key value data in header of KTX file %s",
++ logName().constData());
++ return QTextureFileData();
++ }
++
++ if (headerKeyValueSize >= quint32(buf.size())) {
++ qWarning(lcQtGuiTextureIO, "OOB request in KTX file %s", logName().constData());
++ return QTextureFileData();
++ }
++
++ // Technically, any number of levels is allowed but if the value is bigger than
++ // what is possible in KTX V2 (and what makes sense) we return an error.
++ // maxLevels = log2(max(width, height, depth))
++ const int maxLevels = (sizeof(quint32) * 8)
++ - qCountLeadingZeroBits(std::max(
++ { header.pixelWidth, header.pixelHeight, header.pixelDepth }));
++
++ if (texData.numLevels() > maxLevels) {
++ qWarning(lcQtGuiTextureIO, "Too many levels in KTX file %s", logName().constData());
++ return QTextureFileData();
++ }
++
++ quint32 offset = headerKeyValueSize;
++ for (int level = 0; level < texData.numLevels(); level++) {
++ const auto imageSizeSlice = safeSlice(buf, offset, sizeof(quint32));
++ if (imageSizeSlice.isEmpty()) {
++ qWarning(lcQtGuiTextureIO, "OOB request in KTX file %s", logName().constData());
++ return QTextureFileData();
++ }
++
++ const quint32 imageSize = decode(qFromUnaligned(imageSizeSlice.data()));
++ offset += sizeof(quint32); // overflow checked indirectly above
++
++ texData.setDataOffset(offset, level);
++ texData.setDataLength(imageSize, level);
++
++ // Add image data and padding to offset
++ quint32 padded = 0;
++ if (nearestMultipleOf4(imageSize, &padded)) {
++ qWarning(lcQtGuiTextureIO, "Overflow in KTX file %s", logName().constData());
++ return QTextureFileData();
++ }
++
++ quint32 offsetNext;
++ if (qAddOverflow(offset, padded, &offsetNext)) {
++ qWarning(lcQtGuiTextureIO, "OOB request in KTX file %s", logName().constData());
++ return QTextureFileData();
++ }
++
++ offset = offsetNext;
+ }
+
+ if (!texData.isValid()) {
+- qCDebug(lcQtGuiTextureIO, "Invalid values in header of KTX file %s", logName().constData());
++ qWarning(lcQtGuiTextureIO, "Invalid values in header of KTX file %s",
++ logName().constData());
+ return QTextureFileData();
+ }
+
+@@ -191,7 +271,7 @@ bool QKtxHandler::checkHeader(const KTXHeader &header)
+ (decode(header.numberOfFaces) == 1));
+ }
+
+-quint32 QKtxHandler::decode(quint32 val)
++quint32 QKtxHandler::decode(quint32 val) const
+ {
+ return inverseEndian ? qbswap(val) : val;
+ }
+diff --git a/src/gui/util/qktxhandler_p.h b/src/gui/util/qktxhandler_p.h
+index f831e59d95..cdf1b2eaf8 100644
+--- a/src/gui/util/qktxhandler_p.h
++++ b/src/gui/util/qktxhandler_p.h
+@@ -68,7 +68,7 @@ public:
+
+ private:
+ bool checkHeader(const KTXHeader &header);
+- quint32 decode(quint32 val);
++ quint32 decode(quint32 val) const;
+
+ bool inverseEndian = false;
+ };
diff --git a/CVE-2025-30348.patch b/CVE-2025-30348.patch
new file mode 100644
index 0000000..bbc001a
--- /dev/null
+++ b/CVE-2025-30348.patch
@@ -0,0 +1,156 @@
+From 16918c1df3e709df2a97281e3825d94c84edb668 Mon Sep 17 00:00:00 2001
+From: Christian Ehrlicher
+Date: Tue, 06 Aug 2024 22:39:44 +0200
+Subject: [PATCH] XML/QDom: speedup encodeText()
+
+The code copied the whole string, then replaced parts inline, at
+the cost of relocating everything beyond, at each replacement.
+Instead, copy character by character (in chunks where possible)
+and append replacements as we skip what they replace.
+
+Manual conflict resolution for 6.5:
+- This is a manual cherry-pick. The original change was only
+ picked to 6.8, but the quadratic behavior is present in Qt 5, too.
+- Changed Task-number to Fixes: because this is the real fix;
+ the QString change, 315210de916d060c044c01e53ff249d676122b1b,
+ was unrelated to the original QTBUG-127549.
+
+Manual conflcit resolution for 5.15:
+- Kept/re-added QTextCodec::canEncode() check
+- Ported from Qt 6 to 5, to wit:
+ - qsizetype -> int
+ - QStringView::first/sliced(n) -> left/mid(n)
+ (these functions are clearly called in-range, so the widened
+ contract of the Qt 5 functions doesn't matter)
+- Ported from C++17- and C++14-isms to C++11:
+ - replaced polymorphic lambda with a normal one (this requires
+ rewriting the !canEncode() branch to use QByteArray/QLatin1String
+ instead of QString)
+- As a drive-by, corrected the indentation of the case labels to
+ horizontally align existing code (and follow Qt style)
+
+Fixes: QTBUG-127549
+Change-Id: I368482859ed0c4127f1eec2919183711b5488ada
+Reviewed-by: Edward Welbourne
+(cherry picked from commit 2ce08e3671b8d18b0284447e5908ce15e6e8f80f)
+Reviewed-by: Qt Cherry-pick Bot
+(cherry picked from commit 225e235cf966a44af23dbe9aaaa2fd20ab6430ee)
+Reviewed-by: Fabian Kosmale
+(cherry picked from commit 905a5bd421efff6a1d90b6140500d134d32ca745)
+---
+
+diff --git a/src/xml/dom/qdom.cpp b/src/xml/dom/qdom.cpp
+index 872221c..bf70477 100644
+--- a/src/xml/dom/qdom.cpp
++++ b/src/xml/dom/qdom.cpp
+@@ -3676,59 +3676,67 @@
+ const QTextCodec *const codec = s.codec();
+ Q_ASSERT(codec);
+ #endif
+- QString retval(str);
+- int len = retval.length();
+- int i = 0;
++ QString retval;
++ int start = 0;
++ auto appendToOutput = [&](int cur, QLatin1String replacement)
++ {
++ if (start < cur) {
++ retval.reserve(str.size() + replacement.size());
++ retval.append(QStringView(str).left(cur).mid(start));
++ }
++ // Skip over str[cur], replaced by replacement
++ start = cur + 1;
++ retval.append(replacement);
++ };
+
+- while (i < len) {
+- const QChar ati(retval.at(i));
+-
+- if (ati == QLatin1Char('<')) {
+- retval.replace(i, 1, QLatin1String("<"));
+- len += 3;
+- i += 4;
+- } else if (encodeQuotes && (ati == QLatin1Char('"'))) {
+- retval.replace(i, 1, QLatin1String("""));
+- len += 5;
+- i += 6;
+- } else if (ati == QLatin1Char('&')) {
+- retval.replace(i, 1, QLatin1String("&"));
+- len += 4;
+- i += 5;
+- } else if (ati == QLatin1Char('>') && i >= 2 && retval[i - 1] == QLatin1Char(']') && retval[i - 2] == QLatin1Char(']')) {
+- retval.replace(i, 1, QLatin1String(">"));
+- len += 3;
+- i += 4;
+- } else if (performAVN &&
+- (ati == QChar(0xA) ||
+- ati == QChar(0xD) ||
+- ati == QChar(0x9))) {
+- const QString replacement(QLatin1String("") + QString::number(ati.unicode(), 16) + QLatin1Char(';'));
+- retval.replace(i, 1, replacement);
+- i += replacement.length();
+- len += replacement.length() - 1;
+- } else if (encodeEOLs && ati == QChar(0xD)) {
+- retval.replace(i, 1, QLatin1String("
")); // Replace a single 0xD with a ref for 0xD
+- len += 4;
+- i += 5;
+- } else {
++ const int len = str.size();
++ for (int cur = 0; cur < len; ++cur) {
++ switch (const char16_t ati = str[cur].unicode()) {
++ case u'<':
++ appendToOutput(cur, QLatin1String("<"));
++ break;
++ case u'"':
++ if (encodeQuotes)
++ appendToOutput(cur, QLatin1String("""));
++ break;
++ case u'&':
++ appendToOutput(cur, QLatin1String("&"));
++ break;
++ case u'>':
++ if (cur >= 2 && str[cur - 1] == u']' && str[cur - 2] == u']')
++ appendToOutput(cur, QLatin1String(">"));
++ break;
++ case u'\r':
++ if (performAVN || encodeEOLs)
++ appendToOutput(cur, QLatin1String("
")); // \r == 0x0d
++ break;
++ case u'\n':
++ if (performAVN)
++ appendToOutput(cur, QLatin1String("
")); // \n == 0x0a
++ break;
++ case u'\t':
++ if (performAVN)
++ appendToOutput(cur, QLatin1String(" ")); // \t == 0x09
++ break;
++ default:
+ #if QT_CONFIG(textcodec)
+ if(codec->canEncode(ati))
+- ++i;
++ ; // continue
+ else
+ #endif
+ {
+ // We have to use a character reference to get it through.
+- const ushort codepoint(ati.unicode());
+- const QString replacement(QLatin1String("") + QString::number(codepoint, 16) + QLatin1Char(';'));
+- retval.replace(i, 1, replacement);
+- i += replacement.length();
+- len += replacement.length() - 1;
++ const QByteArray replacement = "" + QByteArray::number(uint{ati}, 16) + ';';
++ appendToOutput(cur, QLatin1String{replacement});
+ }
++ break;
+ }
+ }
+-
+- return retval;
++ if (start > 0) {
++ retval.append(QStringView(str).left(len).mid(start));
++ return retval;
++ }
++ return str;
+ }
+
+ void QDomAttrPrivate::save(QTextStream& s, int, int) const
diff --git a/Fix-lupdate-command-error-on-loongarch64.patch b/Fix-lupdate-command-error-on-loongarch64.patch
new file mode 100644
index 0000000..38b77c0
--- /dev/null
+++ b/Fix-lupdate-command-error-on-loongarch64.patch
@@ -0,0 +1,29 @@
+From 0621699a4b5f9bb74355eb106afb7fe68be6db2a Mon Sep 17 00:00:00 2001
+From: Jingyun Hua
+Date: Thu, 8 Jun 2023 06:23:44 +0000
+Subject: [PATCH] Fix lupdate command execution error on loongarch64
+
+Signed-off-by: Jingyun Hua
+---
+ src/corelib/global/qprocessordetection.h | 5 +++--
+ 1 files changed, 5 insertions(+), 2 deletions(-)
+
+diff --git a/src/corelib/global/qprocessordetection.h b/src/corelib/global/qprocessordetection.h
+index ca9d4080..6f0bc7e7 100644
+--- a/src/corelib/global/qprocessordetection.h
++++ b/src/corelib/global/qprocessordetection.h
+@@ -225,8 +225,9 @@
+ // Q_BYTE_ORDER not defined, use endianness auto-detection
+
+ #elif defined(__loongarch64)
+-# define Q_PROCESSOR_LOONGARCH_64
+-# define Q_PROCESSOR_WORDSIZE 8
++# define Q_PROCESSOR_LOONGARCH_64
++# define Q_PROCESSOR_WORDSIZE 8
++# define Q_BYTE_ORDER Q_LITTLE_ENDIAN
+
+ /*
+ MIPS family, known revisions: I, II, III, IV, 32, 64
+--
+2.33.0
+
diff --git a/add-loongarch64-support.patch b/add-loongarch64-support.patch
new file mode 100644
index 0000000..7f5bef0
--- /dev/null
+++ b/add-loongarch64-support.patch
@@ -0,0 +1,40 @@
+diff --git a/src/3rdparty/double-conversion/include/double-conversion/utils.h b/src/3rdparty/double-conversion/include/double-conversion/utils.h
+index 70e697ca..9be294a2 100644
+--- a/src/3rdparty/double-conversion/include/double-conversion/utils.h
++++ b/src/3rdparty/double-conversion/include/double-conversion/utils.h
+@@ -102,6 +102,7 @@ int main(int argc, char** argv) {
+ defined(__AARCH64EL__) || defined(__aarch64__) || defined(__AARCH64EB__) || \
+ defined(__riscv) || \
+ defined(__or1k__) || defined(__arc__) || \
++ defined(__loongarch64) || \
+ defined(__EMSCRIPTEN__)
+ #define DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS 1
+ #elif defined(__mc68000__) || \
+diff --git a/src/corelib/global/archdetect.cpp b/src/corelib/global/archdetect.cpp
+index 1d00b7f5..74f3c8fc 100644
+--- a/src/corelib/global/archdetect.cpp
++++ b/src/corelib/global/archdetect.cpp
+@@ -59,6 +59,8 @@
+ # define ARCH_PROCESSOR "x86_64"
+ #elif defined(Q_PROCESSOR_IA64)
+ # define ARCH_PROCESSOR "ia64"
++#elif defined(Q_PROCESSOR_LOONGARCH_64)
++# define ARCH_PROCESSOR "loongarch64"
+ #elif defined(Q_PROCESSOR_MIPS_64)
+ # define ARCH_PROCESSOR "mips64"
+ #elif defined(Q_PROCESSOR_MIPS)
+diff --git a/src/corelib/global/qprocessordetection.h b/src/corelib/global/qprocessordetection.h
+index 8d657208..69f84a15 100644
+--- a/src/corelib/global/qprocessordetection.h
++++ b/src/corelib/global/qprocessordetection.h
+@@ -223,6 +223,10 @@
+ # define Q_PROCESSOR_WORDSIZE 8
+ // Q_BYTE_ORDER not defined, use endianness auto-detection
+
++#elif defined(__loongarch64)
++# define Q_PROCESSOR_LOONGARCH_64
++# define Q_PROCESSOR_WORDSIZE 8
++
+ /*
+ MIPS family, known revisions: I, II, III, IV, 32, 64
+
diff --git a/add-sw_64-support-for-syscall_fork.patch b/add-sw_64-support-for-syscall_fork.patch
new file mode 100644
index 0000000..a4d029d
--- /dev/null
+++ b/add-sw_64-support-for-syscall_fork.patch
@@ -0,0 +1,25 @@
+From d6ee5ecb7bb9225787490268e887fc42f75092de Mon Sep 17 00:00:00 2001
+From: mahailiang
+Date: Thu, 31 Oct 2024 22:06:16 +0800
+Subject: [PATCH] add-sw_64-support-for-syscall_fork
+
+---
+ src/3rdparty/forkfd/forkfd_linux.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/3rdparty/forkfd/forkfd_linux.c b/src/3rdparty/forkfd/forkfd_linux.c
+index b1f5408d..642c007b 100644
+--- a/src/3rdparty/forkfd/forkfd_linux.c
++++ b/src/3rdparty/forkfd/forkfd_linux.c
+@@ -83,7 +83,7 @@ static int sys_clone(unsigned long cloneflags, int *ptid)
+ #elif defined(__arc__) || defined(__arm__) || defined(__aarch64__) || defined(__mips__) || \
+ defined(__nds32__) || defined(__hppa__) || defined(__powerpc__) || defined(__i386__) || \
+ defined(__x86_64__) || defined(__xtensa__) || defined(__alpha__) || defined(__riscv) || \
+- defined(__loongarch__)
++ defined(__loongarch__) || defined(__sw_64__)
+ /* ctid and newtls are inverted on CONFIG_CLONE_BACKWARDS architectures,
+ * but since both values are 0, there's no harm. */
+ return syscall(__NR_clone, cloneflags, child_stack, ptid, ctid, newtls);
+--
+2.20.1
+
diff --git a/fix-build-error-of-libxkbcommon-1.6.0.patch b/fix-build-error-of-libxkbcommon-1.6.0.patch
new file mode 100644
index 0000000..6ce5503
--- /dev/null
+++ b/fix-build-error-of-libxkbcommon-1.6.0.patch
@@ -0,0 +1,31 @@
+From cf3d8031ac756fb339658d1e9fabb9e7d254e66f Mon Sep 17 00:00:00 2001
+From: peijiankang
+Date: Mon, 29 Jan 2024 11:10:54 +0800
+Subject: [PATCH] fix build error of libxkbcommon 1.6.0
+
+---
+ src/platformsupport/input/xkbcommon/qxkbcommon.cpp | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/src/platformsupport/input/xkbcommon/qxkbcommon.cpp b/src/platformsupport/input/xkbcommon/qxkbcommon.cpp
+index b713c194..ecf02de6 100644
+--- a/src/platformsupport/input/xkbcommon/qxkbcommon.cpp
++++ b/src/platformsupport/input/xkbcommon/qxkbcommon.cpp
+@@ -273,10 +273,14 @@ static constexpr const auto KeyTbl = qMakeArray(
+ Xkb2Qt,
+ Xkb2Qt,
+ Xkb2Qt,
++/* The following four XKB_KEY_dead keys got removed in libxkbcommon 1.6.0
++ The define check is kind of version check here. */
++#ifdef XKB_KEY_dead_lowline
+ Xkb2Qt,
+ Xkb2Qt,
+ Xkb2Qt,
+ Xkb2Qt,
++#endif
+
+ // Special keys from X.org - This include multimedia keys,
+ // wireless/bluetooth/uwb keys, special launcher keys, etc.
+--
+2.41.0
+
diff --git a/kde-5.15-rollup-20230613.patch b/kde-5.15-rollup-20230613.patch
new file mode 100644
index 0000000..7df7ae3
--- /dev/null
+++ b/kde-5.15-rollup-20230613.patch
@@ -0,0 +1,105025 @@
+diff --git a/doc/global/html-footer.qdocconf b/doc/global/html-footer.qdocconf
+index 673e500291..f799534c58 100644
+--- a/doc/global/html-footer.qdocconf
++++ b/doc/global/html-footer.qdocconf
+@@ -14,7 +14,7 @@ HTML.footer = \
+ " The documentation provided herein is licensed under the terms of the" \
+ " GNU Free Documentation" \
+ " License version 1.3 as published by the Free Software Foundation.
" \
+- " Qt and respective logos are trademarks of The Qt Company Ltd. " \
+- " in Finland and/or other countries worldwide. All other trademarks are property\n" \
+- " of their respective owners.
\n" \
++ " Qt and respective logos are " \
++ " trademarks of The Qt Company Ltd. in Finland and/or other countries\n" \
++ " worldwide. All other trademarks are property of their respective owners. \n" \
+ "\n" \
+diff --git a/doc/global/qt-module-defaults-online.qdocconf b/doc/global/qt-module-defaults-online.qdocconf
+index 635caf0b94..b35790e2d8 100644
+--- a/doc/global/qt-module-defaults-online.qdocconf
++++ b/doc/global/qt-module-defaults-online.qdocconf
+@@ -11,9 +11,9 @@ HTML.footer = \
+ " The documentation provided herein is licensed under the terms of the" \
+ " GNU Free Documentation" \
+ " License version 1.3 as published by the Free Software Foundation. " \
+- " Qt and respective logos are trademarks of The Qt Company Ltd. " \
+- " in Finland and/or other countries worldwide. All other trademarks are property\n" \
+- " of their respective owners. \n"
++ " Qt and respective logos are " \
++ " trademarks of The Qt Company Ltd. in Finland and/or other countries\n" \
++ " worldwide. All other trademarks are property of their respective owners. \n"
+
+ #include standard set of macros and C++ defines and ignores
+ include(macros.qdocconf)
+diff --git a/mkspecs/common/android/qplatformdefs.h b/mkspecs/common/android/qplatformdefs.h
+index f75bc4093b..2bd59410d4 100644
+--- a/mkspecs/common/android/qplatformdefs.h
++++ b/mkspecs/common/android/qplatformdefs.h
+@@ -144,11 +144,7 @@
+ #define QT_SIGNAL_ARGS int
+ #define QT_SIGNAL_IGNORE SIG_IGN
+
+-#if defined(__GLIBC__) && (__GLIBC__ >= 2)
+ #define QT_SOCKLEN_T socklen_t
+-#else
+-#define QT_SOCKLEN_T int
+-#endif
+
+ #if defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE >= 500)
+ #define QT_SNPRINTF ::snprintf
+diff --git a/mkspecs/linux-clang/qplatformdefs.h b/mkspecs/linux-clang/qplatformdefs.h
+index a818d973f0..c1ab72fbc6 100644
+--- a/mkspecs/linux-clang/qplatformdefs.h
++++ b/mkspecs/linux-clang/qplatformdefs.h
+@@ -79,14 +79,6 @@
+ #define QT_USE_XOPEN_LFS_EXTENSIONS
+ #include "../common/posix/qplatformdefs.h"
+
+-#undef QT_SOCKLEN_T
+-
+-#if defined(__GLIBC__) && (__GLIBC__ >= 2)
+-#define QT_SOCKLEN_T socklen_t
+-#else
+-#define QT_SOCKLEN_T int
+-#endif
+-
+ #if defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE >= 500)
+ #define QT_SNPRINTF ::snprintf
+ #define QT_VSNPRINTF ::vsnprintf
+diff --git a/mkspecs/linux-g++/qplatformdefs.h b/mkspecs/linux-g++/qplatformdefs.h
+index 13523f0702..4d2750d9ec 100644
+--- a/mkspecs/linux-g++/qplatformdefs.h
++++ b/mkspecs/linux-g++/qplatformdefs.h
+@@ -79,14 +79,6 @@
+ #define QT_USE_XOPEN_LFS_EXTENSIONS
+ #include "../common/posix/qplatformdefs.h"
+
+-#undef QT_SOCKLEN_T
+-
+-#if defined(__GLIBC__) && (__GLIBC__ < 2)
+-#define QT_SOCKLEN_T int
+-#else
+-#define QT_SOCKLEN_T socklen_t
+-#endif
+-
+ #if defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE >= 500)
+ #define QT_SNPRINTF ::snprintf
+ #define QT_VSNPRINTF ::vsnprintf
+diff --git a/mkspecs/linux-llvm/qplatformdefs.h b/mkspecs/linux-llvm/qplatformdefs.h
+index dc750ab1ef..d3cc39b47f 100644
+--- a/mkspecs/linux-llvm/qplatformdefs.h
++++ b/mkspecs/linux-llvm/qplatformdefs.h
+@@ -80,14 +80,6 @@
+ #define QT_USE_XOPEN_LFS_EXTENSIONS
+ #include "../common/posix/qplatformdefs.h"
+
+-#undef QT_SOCKLEN_T
+-
+-#if defined(__GLIBC__) && (__GLIBC__ >= 2)
+-#define QT_SOCKLEN_T socklen_t
+-#else
+-#define QT_SOCKLEN_T int
+-#endif
+-
+ #if defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE >= 500)
+ #define QT_SNPRINTF ::snprintf
+ #define QT_VSNPRINTF ::vsnprintf
+diff --git a/mkspecs/linux-lsb-g++/qplatformdefs.h b/mkspecs/linux-lsb-g++/qplatformdefs.h
+index 4c4e53da2a..83baffb3e3 100644
+--- a/mkspecs/linux-lsb-g++/qplatformdefs.h
++++ b/mkspecs/linux-lsb-g++/qplatformdefs.h
+@@ -85,16 +85,9 @@
+ #include "../common/posix/qplatformdefs.h"
+
+ #undef QT_OPEN_LARGEFILE
+-#undef QT_SOCKLEN_T
+
+ #define QT_OPEN_LARGEFILE 0
+
+-#if defined(__GLIBC__) && (__GLIBC__ >= 2)
+-#define QT_SOCKLEN_T socklen_t
+-#else
+-#define QT_SOCKLEN_T int
+-#endif
+-
+ #ifndef SIOCGIFBRDADDR
+ # define SIOCGIFBRDADDR 0x8919
+ #endif
+diff --git a/mkspecs/lynxos-g++/qplatformdefs.h b/mkspecs/lynxos-g++/qplatformdefs.h
+index 4339ea2b23..6007af0055 100644
+--- a/mkspecs/lynxos-g++/qplatformdefs.h
++++ b/mkspecs/lynxos-g++/qplatformdefs.h
+@@ -72,14 +72,6 @@
+
+ #include "../common/posix/qplatformdefs.h"
+
+-#undef QT_SOCKLEN_T
+-
+-#if defined(__GLIBC__) && (__GLIBC__ >= 2)
+-#define QT_SOCKLEN_T socklen_t
+-#else
+-#define QT_SOCKLEN_T int
+-#endif
+-
+ #if defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE >= 500)
+ #define QT_SNPRINTF ::snprintf
+ #define QT_VSNPRINTF ::vsnprintf
+diff --git a/src/3rdparty/angle/src/libANGLE/HandleAllocator.cpp b/src/3rdparty/angle/src/libANGLE/HandleAllocator.cpp
+index c3c184258f..32af3f8f29 100644
+--- a/src/3rdparty/angle/src/libANGLE/HandleAllocator.cpp
++++ b/src/3rdparty/angle/src/libANGLE/HandleAllocator.cpp
+@@ -10,6 +10,7 @@
+ #include "libANGLE/HandleAllocator.h"
+
+ #include
++#include
+
+ #include "common/debug.h"
+
+diff --git a/src/3rdparty/forkfd/forkfd_linux.c b/src/3rdparty/forkfd/forkfd_linux.c
+index ffe0e9a5e2..b1f5408d11 100644
+--- a/src/3rdparty/forkfd/forkfd_linux.c
++++ b/src/3rdparty/forkfd/forkfd_linux.c
+@@ -82,7 +82,8 @@ static int sys_clone(unsigned long cloneflags, int *ptid)
+ return syscall(__NR_clone, cloneflags, child_stack, stack_size, ptid, newtls, ctid);
+ #elif defined(__arc__) || defined(__arm__) || defined(__aarch64__) || defined(__mips__) || \
+ defined(__nds32__) || defined(__hppa__) || defined(__powerpc__) || defined(__i386__) || \
+- defined(__x86_64__) || defined(__xtensa__) || defined(__alpha__) || defined(__riscv)
++ defined(__x86_64__) || defined(__xtensa__) || defined(__alpha__) || defined(__riscv) || \
++ defined(__loongarch__)
+ /* ctid and newtls are inverted on CONFIG_CLONE_BACKWARDS architectures,
+ * but since both values are 0, there's no harm. */
+ return syscall(__NR_clone, cloneflags, child_stack, ptid, ctid, newtls);
+diff --git a/src/3rdparty/freetype/LICENSE.txt b/src/3rdparty/freetype/LICENSE.txt
+index 1119880c09..824f5c6129 100644
+--- a/src/3rdparty/freetype/LICENSE.txt
++++ b/src/3rdparty/freetype/LICENSE.txt
+@@ -1,96 +1,101 @@
+-The FreeType 2 font engine is copyrighted work and cannot be used
+-legally without a software license. In order to make this project
+-usable to a vast majority of developers, we distribute it under two
++FREETYPE LICENSES
++-----------------
++
++The FreeType 2 font engine is copyrighted work and cannot be used
++legally without a software license. In order to make this project
++usable to a vast majority of developers, we distribute it under two
+ mutually exclusive open-source licenses.
+
+-This means that *you* must choose *one* of the two licenses described
+-below, then obey all its terms and conditions when using FreeType 2 in
++This means that *you* must choose *one* of the two licenses described
++below, then obey all its terms and conditions when using FreeType 2 in
+ any of your projects or products.
+
+- - The FreeType License, found in the file `FTL.TXT', which is similar
+- to the original BSD license *with* an advertising clause that forces
+- you to explicitly cite the FreeType project in your product's
+- documentation. All details are in the license file. This license
+- is suited to products which don't use the GNU General Public
+- License.
++ - The FreeType License, found in the file `docs/FTL.TXT`, which is
++ similar to the original BSD license *with* an advertising clause
++ that forces you to explicitly cite the FreeType project in your
++ product's documentation. All details are in the license file.
++ This license is suited to products which don't use the GNU General
++ Public License.
+
+- Note that this license is compatible to the GNU General Public
++ Note that this license is compatible to the GNU General Public
+ License version 3, but not version 2.
+
+- - The GNU General Public License version 2, found in `GPLv2.TXT' (any
+- later version can be used also), for programs which already use the
+- GPL. Note that the FTL is incompatible with GPLv2 due to its
+- advertisement clause.
++ - The GNU General Public License version 2, found in
++ `docs/GPLv2.TXT` (any later version can be used also), for
++ programs which already use the GPL. Note that the FTL is
++ incompatible with GPLv2 due to its advertisement clause.
+
+-The contributed BDF and PCF drivers come with a license similar to that
+-of the X Window System. It is compatible to the above two licenses (see
+-file src/bdf/README and src/pcf/README).
++The contributed BDF and PCF drivers come with a license similar to
++that of the X Window System. It is compatible to the above two
++licenses (see files `src/bdf/README` and `src/pcf/README`). The same
++holds for the source code files `src/base/fthash.c` and
++`include/freetype/internal/fthash.h`; they wer part of the BDF driver
++in earlier FreeType versions.
+
+-The gzip module uses the zlib license (see src/gzip/zlib.h) which too is
+-compatible to the above two licenses.
++The gzip module uses the zlib license (see `src/gzip/zlib.h`) which
++too is compatible to the above two licenses.
+
+-The MD5 checksum support (only used for debugging in development builds)
+-is in the public domain.
++The MD5 checksum support (only used for debugging in development
++builds) is in the public domain.
+
++-- FTL.TXT --
+
+---- FDL.TXT ---
++The FreeType Project LICENSE
++----------------------------
+
+- The FreeType Project LICENSE
+- ----------------------------
++ 2006-Jan-27
+
+- 2006-Jan-27
+-
+- Copyright 1996-2002, 2006 by
+- David Turner, Robert Wilhelm, and Werner Lemberg
++Copyright 1996-2002, 2006 by
++David Turner, Robert Wilhelm, and Werner Lemberg
+
+
+
+ Introduction
+ ============
+
+- The FreeType Project is distributed in several archive packages;
+- some of them may contain, in addition to the FreeType font engine,
+- various tools and contributions which rely on, or relate to, the
+- FreeType Project.
++The FreeType Project is distributed in several archive packages;
++some of them may contain, in addition to the FreeType font engine,
++various tools and contributions which rely on, or relate to, the
++FreeType Project.
+
+- This license applies to all files found in such packages, and
+- which do not fall under their own explicit license. The license
+- affects thus the FreeType font engine, the test programs,
+- documentation and makefiles, at the very least.
++This license applies to all files found in such packages, and
++which do not fall under their own explicit license. The license
++affects thus the FreeType font engine, the test programs,
++documentation and makefiles, at the very least.
+
+- This license was inspired by the BSD, Artistic, and IJG
+- (Independent JPEG Group) licenses, which all encourage inclusion
+- and use of free software in commercial and freeware products
+- alike. As a consequence, its main points are that:
++This license was inspired by the BSD, Artistic, and IJG
++(Independent JPEG Group) licenses, which all encourage inclusion
++and use of free software in commercial and freeware products
++alike. As a consequence, its main points are that:
+
+- o We don't promise that this software works. However, we will be
+- interested in any kind of bug reports. (`as is' distribution)
++o We don't promise that this software works. However, we will be
++interested in any kind of bug reports. (`as is' distribution)
+
+- o You can use this software for whatever you want, in parts or
+- full form, without having to pay us. (`royalty-free' usage)
++o You can use this software for whatever you want, in parts or
++full form, without having to pay us. (`royalty-free' usage)
+
+- o You may not pretend that you wrote this software. If you use
+- it, or only parts of it, in a program, you must acknowledge
+- somewhere in your documentation that you have used the
+- FreeType code. (`credits')
++o You may not pretend that you wrote this software. If you use
++it, or only parts of it, in a program, you must acknowledge
++somewhere in your documentation that you have used the
++FreeType code. (`credits')
+
+- We specifically permit and encourage the inclusion of this
+- software, with or without modifications, in commercial products.
+- We disclaim all warranties covering The FreeType Project and
+- assume no liability related to The FreeType Project.
++We specifically permit and encourage the inclusion of this
++software, with or without modifications, in commercial products.
++We disclaim all warranties covering The FreeType Project and
++assume no liability related to The FreeType Project.
+
+
+- Finally, many people asked us for a preferred form for a
+- credit/disclaimer to use in compliance with this license. We thus
+- encourage you to use the following text:
++Finally, many people asked us for a preferred form for a
++credit/disclaimer to use in compliance with this license. We thus
++encourage you to use the following text:
+
+- """
+- Portions of this software are copyright © The FreeType
+- Project (www.freetype.org). All rights reserved.
+- """
++"""
++Portions of this software are copyright © The FreeType
++Project (www.freetype.org). All rights reserved.
++"""
+
+- Please replace with the value from the FreeType version you
+- actually use.
++Please replace with the value from the FreeType version you
++actually use.
+
+
+ Legal Terms
+@@ -99,110 +104,111 @@ Legal Terms
+ 0. Definitions
+ --------------
+
+- Throughout this license, the terms `package', `FreeType Project',
+- and `FreeType archive' refer to the set of files originally
+- distributed by the authors (David Turner, Robert Wilhelm, and
+- Werner Lemberg) as the `FreeType Project', be they named as alpha,
+- beta or final release.
+-
+- `You' refers to the licensee, or person using the project, where
+- `using' is a generic term including compiling the project's source
+- code as well as linking it to form a `program' or `executable'.
+- This program is referred to as `a program using the FreeType
+- engine'.
+-
+- This license applies to all files distributed in the original
+- FreeType Project, including all source code, binaries and
+- documentation, unless otherwise stated in the file in its
+- original, unmodified form as distributed in the original archive.
+- If you are unsure whether or not a particular file is covered by
+- this license, you must contact us to verify this.
+-
+- The FreeType Project is copyright (C) 1996-2000 by David Turner,
+- Robert Wilhelm, and Werner Lemberg. All rights reserved except as
+- specified below.
++Throughout this license, the terms `package', `FreeType Project',
++and `FreeType archive' refer to the set of files originally
++distributed by the authors (David Turner, Robert Wilhelm, and
++Werner Lemberg) as the `FreeType Project', be they named as alpha,
++beta or final release.
++
++`You' refers to the licensee, or person using the project, where
++`using' is a generic term including compiling the project's source
++code as well as linking it to form a `program' or `executable'.
++This program is referred to as `a program using the FreeType
++engine'.
++
++This license applies to all files distributed in the original
++FreeType Project, including all source code, binaries and
++documentation, unless otherwise stated in the file in its
++original, unmodified form as distributed in the original archive.
++If you are unsure whether or not a particular file is covered by
++this license, you must contact us to verify this.
++
++The FreeType Project is copyright (C) 1996-2000 by David Turner,
++Robert Wilhelm, and Werner Lemberg. All rights reserved except as
++specified below.
+
+ 1. No Warranty
+ --------------
+
+- THE FREETYPE PROJECT IS PROVIDED `AS IS' WITHOUT WARRANTY OF ANY
+- KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+- PURPOSE. IN NO EVENT WILL ANY OF THE AUTHORS OR COPYRIGHT HOLDERS
+- BE LIABLE FOR ANY DAMAGES CAUSED BY THE USE OR THE INABILITY TO
+- USE, OF THE FREETYPE PROJECT.
++THE FREETYPE PROJECT IS PROVIDED `AS IS' WITHOUT WARRANTY OF ANY
++KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
++WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
++PURPOSE. IN NO EVENT WILL ANY OF THE AUTHORS OR COPYRIGHT HOLDERS
++BE LIABLE FOR ANY DAMAGES CAUSED BY THE USE OR THE INABILITY TO
++USE, OF THE FREETYPE PROJECT.
+
+ 2. Redistribution
+ -----------------
+
+- This license grants a worldwide, royalty-free, perpetual and
+- irrevocable right and license to use, execute, perform, compile,
+- display, copy, create derivative works of, distribute and
+- sublicense the FreeType Project (in both source and object code
+- forms) and derivative works thereof for any purpose; and to
+- authorize others to exercise some or all of the rights granted
+- herein, subject to the following conditions:
+-
+- o Redistribution of source code must retain this license file
+- (`FTL.TXT') unaltered; any additions, deletions or changes to
+- the original files must be clearly indicated in accompanying
+- documentation. The copyright notices of the unaltered,
+- original files must be preserved in all copies of source
+- files.
+-
+- o Redistribution in binary form must provide a disclaimer that
+- states that the software is based in part of the work of the
+- FreeType Team, in the distribution documentation. We also
+- encourage you to put an URL to the FreeType web page in your
+- documentation, though this isn't mandatory.
+-
+- These conditions apply to any software derived from or based on
+- the FreeType Project, not just the unmodified files. If you use
+- our work, you must acknowledge us. However, no fee need be paid
+- to us.
++This license grants a worldwide, royalty-free, perpetual and
++irrevocable right and license to use, execute, perform, compile,
++display, copy, create derivative works of, distribute and
++sublicense the FreeType Project (in both source and object code
++forms) and derivative works thereof for any purpose; and to
++authorize others to exercise some or all of the rights granted
++herein, subject to the following conditions:
++
++o Redistribution of source code must retain this license file
++(`FTL.TXT') unaltered; any additions, deletions or changes to
++the original files must be clearly indicated in accompanying
++documentation. The copyright notices of the unaltered,
++original files must be preserved in all copies of source
++files.
++
++o Redistribution in binary form must provide a disclaimer that
++states that the software is based in part of the work of the
++FreeType Team, in the distribution documentation. We also
++encourage you to put an URL to the FreeType web page in your
++documentation, though this isn't mandatory.
++
++These conditions apply to any software derived from or based on
++the FreeType Project, not just the unmodified files. If you use
++our work, you must acknowledge us. However, no fee need be paid
++to us.
+
+ 3. Advertising
+ --------------
+
+- Neither the FreeType authors and contributors nor you shall use
+- the name of the other for commercial, advertising, or promotional
+- purposes without specific prior written permission.
++Neither the FreeType authors and contributors nor you shall use
++the name of the other for commercial, advertising, or promotional
++purposes without specific prior written permission.
+
+- We suggest, but do not require, that you use one or more of the
+- following phrases to refer to this software in your documentation
+- or advertising materials: `FreeType Project', `FreeType Engine',
+- `FreeType library', or `FreeType Distribution'.
++We suggest, but do not require, that you use one or more of the
++following phrases to refer to this software in your documentation
++or advertising materials: `FreeType Project', `FreeType Engine',
++`FreeType library', or `FreeType Distribution'.
+
+- As you have not signed this license, you are not required to
+- accept it. However, as the FreeType Project is copyrighted
+- material, only this license, or another one contracted with the
+- authors, grants you the right to use, distribute, and modify it.
+- Therefore, by using, distributing, or modifying the FreeType
+- Project, you indicate that you understand and accept all the terms
+- of this license.
++As you have not signed this license, you are not required to
++accept it. However, as the FreeType Project is copyrighted
++material, only this license, or another one contracted with the
++authors, grants you the right to use, distribute, and modify it.
++Therefore, by using, distributing, or modifying the FreeType
++Project, you indicate that you understand and accept all the terms
++of this license.
+
+ 4. Contacts
+ -----------
+
+- There are two mailing lists related to FreeType:
++There are two mailing lists related to FreeType:
++
++o freetype@nongnu.org
+
+- o freetype@nongnu.org
++Discusses general use and applications of FreeType, as well as
++future and wanted additions to the library and distribution.
++If you are looking for support, start in this list if you
++haven't found anything to help you in the documentation.
+
+- Discusses general use and applications of FreeType, as well as
+- future and wanted additions to the library and distribution.
+- If you are looking for support, start in this list if you
+- haven't found anything to help you in the documentation.
++o freetype-devel@nongnu.org
+
+- o freetype-devel@nongnu.org
++Discusses bugs, as well as engine internals, design issues,
++specific licenses, porting, etc.
+
+- Discusses bugs, as well as engine internals, design issues,
+- specific licenses, porting, etc.
++Our home page can be found at
+
+- Our home page can be found at
++https://www.freetype.org
+
+- http://www.freetype.org
+
+---- end of FDL.TXT ---
++--- end of FTL.TXT ---
+
+ --- GPLv2.TXT ---
+
+diff --git a/src/3rdparty/freetype/PCF-LICENSE.txt b/src/3rdparty/freetype/PCF-LICENSE.txt
+index 3f3a3b3f0c..2668007a5c 100644
+--- a/src/3rdparty/freetype/PCF-LICENSE.txt
++++ b/src/3rdparty/freetype/PCF-LICENSE.txt
+@@ -18,3 +18,27 @@ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
++
++--
++
++Copyright 1990, 1994, 1998 The Open Group
++
++Permission to use, copy, modify, distribute, and sell this software and its
++documentation for any purpose is hereby granted without fee, provided that
++the above copyright notice appear in all copies and that both that
++copyright notice and this permission notice appear in supporting
++documentation.
++
++The above copyright notice and this permission notice shall be included in
++all copies or substantial portions of the Software.
++
++THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
++IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
++FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
++OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
++AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
++CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
++
++Except as contained in this notice, the name of The Open Group shall not be
++used in advertising or otherwise to promote the sale, use or other dealings
++in this Software without prior written authorization from The Open Group.
+diff --git a/src/3rdparty/freetype/README b/src/3rdparty/freetype/README
+index e4c8cf1c57..7a8a2dcedc 100644
+--- a/src/3rdparty/freetype/README
++++ b/src/3rdparty/freetype/README
+@@ -1,92 +1,98 @@
+- FreeType 2.10.4
+- ===============
++FreeType 2.12.1
++===============
+
+- Homepage: https://www.freetype.org
++Homepage: https://www.freetype.org
+
+- FreeType is a freely available software library to render fonts.
++FreeType is a freely available software library to render fonts.
+
+- It is written in C, designed to be small, efficient, highly
+- customizable, and portable while capable of producing high-quality
+- output (glyph images) of most vector and bitmap font formats.
++It is written in C, designed to be small, efficient, highly
++customizable, and portable while capable of producing high-quality
++output (glyph images) of most vector and bitmap font formats.
+
+- Please read the docs/CHANGES file, it contains IMPORTANT
+- INFORMATION.
++Please read the `docs/CHANGES` file, it contains IMPORTANT
++INFORMATION.
+
+- Read the files `docs/INSTALL*' for installation instructions; see
+- the file `docs/LICENSE.TXT' for the available licenses.
++Read the files `docs/INSTALL*` for installation instructions; see the
++file `docs/LICENSE.TXT` for the available licenses.
+
+- The FreeType 2 API reference is located in `docs/reference/site';
+- use the file `index.html' as the top entry point. [Please note that
+- currently the search function for locally installed documentation
+- doesn't work due to cross-site scripting issues.]
++For using FreeType's git repository instead of a distribution bundle,
++please read file `README.git`.
+
+- Additional documentation is available as a separate package from our
+- sites. Go to
++The FreeType 2 API reference is located in directory `docs/reference`;
++use the file `index.html` as the top entry point. [Please note that
++currently the search function for locally installed documentation
++doesn't work due to cross-site scripting issues.]
+
+- https://download.savannah.gnu.org/releases/freetype/
++Additional documentation is available as a separate package from our
++sites. Go to
+
+- and download one of the following files.
++ https://download.savannah.gnu.org/releases/freetype/
+
+- freetype-doc-2.10.4.tar.xz
+- freetype-doc-2.10.4.tar.gz
+- ftdoc2104.zip
++and download one of the following files.
+
+- To view the documentation online, go to
++ freetype-doc-2.12.1.tar.xz
++ freetype-doc-2.12.1.tar.gz
++ ftdoc2121.zip
+
+- https://www.freetype.org/freetype2/docs/
++To view the documentation online, go to
+
++ https://www.freetype.org/freetype2/docs/
+
+- Mailing Lists
+- =============
+
+- The preferred way of communication with the FreeType team is using
+- e-mail lists.
++Mailing Lists
++-------------
+
+- general use and discussion: freetype@nongnu.org
+- engine internals, porting, etc.: freetype-devel@nongnu.org
+- announcements: freetype-announce@nongnu.org
+- git repository tracker: freetype-commit@nongnu.org
++The preferred way of communication with the FreeType team is using
++e-mail lists.
+
+- The lists are moderated; see
++ general use and discussion: freetype@nongnu.org
++ engine internals, porting, etc.: freetype-devel@nongnu.org
++ announcements: freetype-announce@nongnu.org
++ git repository tracker: freetype-commit@nongnu.org
+
+- https://www.freetype.org/contact.html
++The lists are moderated; see
+
+- how to subscribe.
++ https://www.freetype.org/contact.html
+
++how to subscribe.
+
+- Bugs
+- ====
+
+- Please submit bug reports at
++Bugs
++----
+
+- https://savannah.nongnu.org/bugs/?group=freetype
++Please submit bug reports at
+
+- Alternatively, you might report bugs by e-mail to
+- `freetype-devel@nongnu.org'. Don't forget to send a detailed
+- explanation of the problem -- there is nothing worse than receiving
+- a terse message that only says `it doesn't work'.
++ https://gitlab.freedesktop.org/freetype/freetype/-/issues
+
++Alternatively, you might report bugs by e-mail to
++`freetype-devel@nongnu.org`. Don't forget to send a detailed
++explanation of the problem -- there is nothing worse than receiving a
++terse message that only says 'it doesn't work'.
+
+- Patches
+- =======
+
+- Please submit patches to the `freetype-devel@nongnu.org' mailing
+- list -- and thank you in advance for your work on improving
+- FreeType!
++Patches
++-------
+
+- Details on the process can be found here:
++For larger changes please provide merge requests at
+
+- https://www.freetype.org/developer.html#patches
++ https://gitlab.freedesktop.org/freetype/freetype/-/merge_requests
+
++Alternatively, you can send patches to the `freetype-devel@nongnu.org`
++mailing list -- and thank you in advance for your work on improving
++FreeType!
+
+- Enjoy!
++Details on the process can be found here:
+
++ https://www.freetype.org/developer.html#patches
+
+- The FreeType Team
++
++Enjoy!
++
++ The FreeType Team
+
+ ----------------------------------------------------------------------
+
+-Copyright (C) 2006-2020 by
++Copyright (C) 2006-2022 by
+ David Turner, Robert Wilhelm, and Werner Lemberg.
+
+ This file is part of the FreeType project, and may only be used,
+diff --git a/src/3rdparty/freetype/builds/unix/ftconfig.h b/src/3rdparty/freetype/builds/unix/ftconfig.h
+index 51cb796391..57911e2f71 100644
+--- a/src/3rdparty/freetype/builds/unix/ftconfig.h
++++ b/src/3rdparty/freetype/builds/unix/ftconfig.h
+@@ -5,7 +5,7 @@
+ *
+ * UNIX-specific configuration file (specification only).
+ *
+- * Copyright (C) 1996-2020 by
++ * Copyright (C) 1996-2022 by
+ * David Turner, Robert Wilhelm, and Werner Lemberg.
+ *
+ * This file is part of the FreeType project, and may only be used,
+diff --git a/src/3rdparty/freetype/builds/unix/ftsystem.c b/src/3rdparty/freetype/builds/unix/ftsystem.c
+index 22bb4dab9b..e238c6083d 100644
+--- a/src/3rdparty/freetype/builds/unix/ftsystem.c
++++ b/src/3rdparty/freetype/builds/unix/ftsystem.c
+@@ -1,19 +1,19 @@
+-/***************************************************************************/
+-/* */
+-/* ftsystem.c */
+-/* */
+-/* Unix-specific FreeType low-level system interface (body). */
+-/* */
+-/* Copyright (C) 1996-2020 by */
+-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
+-/* */
+-/* This file is part of the FreeType project, and may only be used, */
+-/* modified, and distributed under the terms of the FreeType project */
+-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
+-/* this file you indicate that you have read the license and */
+-/* understand and accept it fully. */
+-/* */
+-/***************************************************************************/
++/****************************************************************************
++ *
++ * ftsystem.c
++ *
++ * Unix-specific FreeType low-level system interface (body).
++ *
++ * Copyright (C) 1996-2022 by
++ * David Turner, Robert Wilhelm, and Werner Lemberg.
++ *
++ * This file is part of the FreeType project, and may only be used,
++ * modified, and distributed under the terms of the FreeType project
++ * license, LICENSE.TXT. By continuing to use, modify, or distribute
++ * this file you indicate that you have read the license and
++ * understand and accept it fully.
++ *
++ */
+
+
+ #include
+@@ -70,30 +70,40 @@
+ #include
+ #include
+
+-
+- /*************************************************************************/
+- /* */
+- /* MEMORY MANAGEMENT INTERFACE */
+- /* */
+- /*************************************************************************/
+-
+-
+- /*************************************************************************/
+- /* */
+- /* */
+- /* ft_alloc */
+- /* */
+- /* */
+- /* The memory allocation function. */
+- /* */
+- /* */
+- /* memory :: A pointer to the memory object. */
+- /* */
+- /* size :: The requested size in bytes. */
+- /* */
+- /* */
+- /* The address of newly allocated block. */
+- /* */
++ /**************************************************************************
++ *
++ * MEMORY MANAGEMENT INTERFACE
++ *
++ */
++
++
++ /**************************************************************************
++ *
++ * It is not necessary to do any error checking for the
++ * allocation-related functions. This will be done by the higher level
++ * routines like ft_mem_alloc() or ft_mem_realloc().
++ *
++ */
++
++
++ /**************************************************************************
++ *
++ * @Function:
++ * ft_alloc
++ *
++ * @Description:
++ * The memory allocation function.
++ *
++ * @Input:
++ * memory ::
++ * A pointer to the memory object.
++ *
++ * size ::
++ * The requested size in bytes.
++ *
++ * @Return:
++ * The address of newly allocated block.
++ */
+ FT_CALLBACK_DEF( void* )
+ ft_alloc( FT_Memory memory,
+ long size )
+@@ -104,26 +114,30 @@
+ }
+
+
+- /*************************************************************************/
+- /* */
+- /* */
+- /* ft_realloc */
+- /* */
+- /* */
+- /* The memory reallocation function. */
+- /* */
+- /* */
+- /* memory :: A pointer to the memory object. */
+- /* */
+- /* cur_size :: The current size of the allocated memory block. */
+- /* */
+- /* new_size :: The newly requested size in bytes. */
+- /* */
+- /* block :: The current address of the block in memory. */
+- /* */
+- /* */
+- /* The address of the reallocated memory block. */
+- /* */
++ /**************************************************************************
++ *
++ * @Function:
++ * ft_realloc
++ *
++ * @Description:
++ * The memory reallocation function.
++ *
++ * @Input:
++ * memory ::
++ * A pointer to the memory object.
++ *
++ * cur_size ::
++ * The current size of the allocated memory block.
++ *
++ * new_size ::
++ * The newly requested size in bytes.
++ *
++ * block ::
++ * The current address of the block in memory.
++ *
++ * @Return:
++ * The address of the reallocated memory block.
++ */
+ FT_CALLBACK_DEF( void* )
+ ft_realloc( FT_Memory memory,
+ long cur_size,
+@@ -137,19 +151,21 @@
+ }
+
+
+- /*************************************************************************/
+- /* */
+- /* */
+- /* ft_free */
+- /* */
+- /* */
+- /* The memory release function. */
+- /* */
+- /* */
+- /* memory :: A pointer to the memory object. */
+- /* */
+- /* block :: The address of block in memory to be freed. */
+- /* */
++ /**************************************************************************
++ *
++ * @Function:
++ * ft_free
++ *
++ * @Description:
++ * The memory release function.
++ *
++ * @Input:
++ * memory ::
++ * A pointer to the memory object.
++ *
++ * block ::
++ * The address of block in memory to be freed.
++ */
+ FT_CALLBACK_DEF( void )
+ ft_free( FT_Memory memory,
+ void* block )
+@@ -160,19 +176,19 @@
+ }
+
+
+- /*************************************************************************/
+- /* */
+- /* RESOURCE MANAGEMENT INTERFACE */
+- /* */
+- /*************************************************************************/
++ /**************************************************************************
++ *
++ * RESOURCE MANAGEMENT INTERFACE
++ *
++ */
+
+
+- /*************************************************************************/
+- /* */
+- /* The macro FT_COMPONENT is used in trace mode. It is an implicit */
+- /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
+- /* messages during execution. */
+- /* */
++ /**************************************************************************
++ *
++ * The macro FT_COMPONENT is used in trace mode. It is an implicit
++ * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log
++ * messages during execution.
++ */
+ #undef FT_COMPONENT
+ #define FT_COMPONENT io
+
+@@ -181,17 +197,17 @@
+ #define STREAM_FILE( stream ) ( (FILE*)stream->descriptor.pointer )
+
+
+- /*************************************************************************/
+- /* */
+- /* */
+- /* ft_close_stream_by_munmap */
+- /* */
+- /* */
+- /* The function to close a stream which is opened by mmap. */
+- /* */
+- /* */
+- /* stream :: A pointer to the stream object. */
+- /* */
++ /**************************************************************************
++ *
++ * @Function:
++ * ft_close_stream_by_munmap
++ *
++ * @Description:
++ * The function to close a stream which is opened by mmap.
++ *
++ * @Input:
++ * stream :: A pointer to the stream object.
++ */
+ FT_CALLBACK_DEF( void )
+ ft_close_stream_by_munmap( FT_Stream stream )
+ {
+@@ -199,29 +215,29 @@
+
+ stream->descriptor.pointer = NULL;
+ stream->size = 0;
+- stream->base = 0;
++ stream->base = NULL;
+ }
+
+
+- /*************************************************************************/
+- /* */
+- /* */
+- /* ft_close_stream_by_free */
+- /* */
+- /* */
+- /* The function to close a stream which is created by ft_alloc. */
+- /* */
+- /* */
+- /* stream :: A pointer to the stream object. */
+- /* */
++ /**************************************************************************
++ *
++ * @Function:
++ * ft_close_stream_by_free
++ *
++ * @Description:
++ * The function to close a stream which is created by ft_alloc.
++ *
++ * @Input:
++ * stream :: A pointer to the stream object.
++ */
+ FT_CALLBACK_DEF( void )
+ ft_close_stream_by_free( FT_Stream stream )
+ {
+- ft_free( NULL, stream->descriptor.pointer );
++ ft_free( stream->memory, stream->descriptor.pointer );
+
+ stream->descriptor.pointer = NULL;
+ stream->size = 0;
+- stream->base = 0;
++ stream->base = NULL;
+ }
+
+
+@@ -297,8 +313,7 @@
+ file,
+ 0 );
+
+- /* on some RTOS, mmap might return 0 */
+- if ( (long)stream->base != -1 && stream->base != NULL )
++ if ( stream->base != MAP_FAILED )
+ stream->close = ft_close_stream_by_munmap;
+ else
+ {
+@@ -308,7 +323,7 @@
+ FT_ERROR(( "FT_Stream_Open:" ));
+ FT_ERROR(( " could not `mmap' file `%s'\n", filepathname ));
+
+- stream->base = (unsigned char*)ft_alloc( NULL, stream->size );
++ stream->base = (unsigned char*)ft_alloc( stream->memory, stream->size );
+
+ if ( !stream->base )
+ {
+@@ -349,7 +364,7 @@
+ stream->descriptor.pointer = stream->base;
+ stream->pathname.pointer = (char*)filepathname;
+
+- stream->read = 0;
++ stream->read = NULL;
+
+ FT_TRACE1(( "FT_Stream_Open:" ));
+ FT_TRACE1(( " opened `%s' (%ld bytes) successfully\n",
+@@ -358,7 +373,7 @@
+ return FT_Err_Ok;
+
+ Fail_Read:
+- ft_free( NULL, stream->base );
++ ft_free( stream->memory, stream->base );
+
+ Fail_Map:
+ close( file );
+@@ -393,7 +408,7 @@
+ memory = (FT_Memory)malloc( sizeof ( *memory ) );
+ if ( memory )
+ {
+- memory->user = 0;
++ memory->user = NULL;
+ memory->alloc = ft_alloc;
+ memory->realloc = ft_realloc;
+ memory->free = ft_free;
+diff --git a/src/3rdparty/freetype/builds/windows/ftdebug.c b/src/3rdparty/freetype/builds/windows/ftdebug.c
+new file mode 100644
+index 0000000000..a65f544694
+--- /dev/null
++++ b/src/3rdparty/freetype/builds/windows/ftdebug.c
+@@ -0,0 +1,698 @@
++/****************************************************************************
++ *
++ * ftdebug.c
++ *
++ * Debugging and logging component for Win32 (body).
++ *
++ * Copyright (C) 1996-2022 by
++ * David Turner, Robert Wilhelm, and Werner Lemberg.
++ *
++ * This file is part of the FreeType project, and may only be used,
++ * modified, and distributed under the terms of the FreeType project
++ * license, LICENSE.TXT. By continuing to use, modify, or distribute
++ * this file you indicate that you have read the license and
++ * understand and accept it fully.
++ *
++ */
++
++
++ /**************************************************************************
++ *
++ * This component contains various macros and functions used to ease the
++ * debugging of the FreeType engine. Its main purpose is in assertion
++ * checking, tracing, and error detection.
++ *
++ * There are now three debugging modes:
++ *
++ * - trace mode
++ *
++ * Error and trace messages are sent to the log file (which can be the
++ * standard error output).
++ *
++ * - error mode
++ *
++ * Only error messages are generated.
++ *
++ * - release mode:
++ *
++ * No error message is sent or generated. The code is free from any
++ * debugging parts.
++ *
++ */
++
++
++#include
++#include
++#include
++#include
++
++
++#ifdef FT_DEBUG_LOGGING
++
++ /**************************************************************************
++ *
++ * Variables used to control logging.
++ *
++ * 1. `ft_default_trace_level` stores the value of trace levels, which are
++ * provided to FreeType using the `FT2_DEBUG` environment variable.
++ *
++ * 2. `ft_fileptr` stores the `FILE*` handle.
++ *
++ * 3. `ft_component` is a string that holds the name of `FT_COMPONENT`.
++ *
++ * 4. The flag `ft_component_flag` prints the name of `FT_COMPONENT` along
++ * with the actual log message if set to true.
++ *
++ * 5. The flag `ft_timestamp_flag` prints time along with the actual log
++ * message if set to ture.
++ *
++ * 6. `ft_have_newline_char` is used to differentiate between a log
++ * message with and without a trailing newline character.
++ *
++ * 7. `ft_custom_trace_level` stores the custom trace level value, which
++ * is provided by the user at run-time.
++ *
++ * We use `static` to avoid 'unused variable' warnings.
++ *
++ */
++ static const char* ft_default_trace_level = NULL;
++ static FILE* ft_fileptr = NULL;
++ static const char* ft_component = NULL;
++ static FT_Bool ft_component_flag = FALSE;
++ static FT_Bool ft_timestamp_flag = FALSE;
++ static FT_Bool ft_have_newline_char = TRUE;
++ static const char* ft_custom_trace_level = NULL;
++
++ /* declared in ftdebug.h */
++
++ dlg_handler ft_default_log_handler = NULL;
++ FT_Custom_Log_Handler custom_output_handler = NULL;
++
++#endif /* FT_DEBUG_LOGGING */
++
++
++#ifdef FT_DEBUG_LEVEL_ERROR
++
++#define WIN32_LEAN_AND_MEAN
++#include
++
++
++#ifdef _WIN32_WCE
++
++ FT_LOACAL_DEF( void )
++ OutputDebugStringA( LPCSTR lpOutputString )
++ {
++ int len;
++ LPWSTR lpOutputStringW;
++
++
++ /* allocate memory space for converted string */
++ len = MultiByteToWideChar( CP_ACP, MB_ERR_INVALID_CHARS,
++ lpOutputString, -1, NULL, 0 );
++
++ lpOutputStringW = (LPWSTR)_alloca( len * sizeof ( WCHAR ) );
++
++ if ( !len || !lpOutputStringW )
++ return;
++
++ /* now it is safe to do the translation */
++ MultiByteToWideChar( CP_ACP, MB_ERR_INVALID_CHARS,
++ lpOutputString, -1, lpOutputStringW, len );
++
++ OutputDebugStringW( lpOutputStringW );
++ }
++
++#endif /* _WIN32_WCE */
++
++
++ /* documentation is in ftdebug.h */
++
++ FT_BASE_DEF( void )
++ FT_Message( const char* fmt,
++ ... )
++ {
++ va_list ap;
++
++
++ va_start( ap, fmt );
++ vfprintf( stderr, fmt, ap );
++#if ( defined( _WIN32_WINNT ) && _WIN32_WINNT >= 0x0400 ) || \
++ ( defined( _WIN32_WCE ) && _WIN32_WCE >= 0x0600 )
++ if ( IsDebuggerPresent() )
++ {
++ static char buf[1024];
++
++
++ vsnprintf( buf, sizeof buf, fmt, ap );
++ OutputDebugStringA( buf );
++ }
++#endif
++ va_end( ap );
++ }
++
++
++ /* documentation is in ftdebug.h */
++
++ FT_BASE_DEF( void )
++ FT_Panic( const char* fmt,
++ ... )
++ {
++ va_list ap;
++
++
++ va_start( ap, fmt );
++ vfprintf( stderr, fmt, ap );
++#if ( defined( _WIN32_WINNT ) && _WIN32_WINNT >= 0x0400 ) || \
++ ( defined( _WIN32_WCE ) && _WIN32_WCE >= 0x0600 )
++ if ( IsDebuggerPresent() )
++ {
++ static char buf[1024];
++
++
++ vsnprintf( buf, sizeof buf, fmt, ap );
++ OutputDebugStringA( buf );
++ }
++#endif
++ va_end( ap );
++
++ exit( EXIT_FAILURE );
++ }
++
++
++ /* documentation is in ftdebug.h */
++
++ FT_BASE_DEF( int )
++ FT_Throw( FT_Error error,
++ int line,
++ const char* file )
++ {
++#if 0
++ /* activating the code in this block makes FreeType very chatty */
++ fprintf( stderr,
++ "%s:%d: error 0x%02x: %s\n",
++ file,
++ line,
++ error,
++ FT_Error_String( error ) );
++#else
++ FT_UNUSED( error );
++ FT_UNUSED( line );
++ FT_UNUSED( file );
++#endif
++
++ return 0;
++ }
++
++#endif /* FT_DEBUG_LEVEL_ERROR */
++
++
++#ifdef FT_DEBUG_LEVEL_TRACE
++
++ /* array of trace levels, initialized to 0; */
++ /* this gets adjusted at run-time */
++ static int ft_trace_levels_enabled[trace_count];
++
++ /* array of trace levels, always initialized to 0 */
++ static int ft_trace_levels_disabled[trace_count];
++
++ /* a pointer to either `ft_trace_levels_enabled' */
++ /* or `ft_trace_levels_disabled' */
++ int* ft_trace_levels;
++
++ /* define array of trace toggle names */
++#define FT_TRACE_DEF( x ) #x ,
++
++ static const char* ft_trace_toggles[trace_count + 1] =
++ {
++#include
++ NULL
++ };
++
++#undef FT_TRACE_DEF
++
++
++ /* documentation is in ftdebug.h */
++
++ FT_BASE_DEF( FT_Int )
++ FT_Trace_Get_Count( void )
++ {
++ return trace_count;
++ }
++
++
++ /* documentation is in ftdebug.h */
++
++ FT_BASE_DEF( const char * )
++ FT_Trace_Get_Name( FT_Int idx )
++ {
++ int max = FT_Trace_Get_Count();
++
++
++ if ( idx < max )
++ return ft_trace_toggles[idx];
++ else
++ return NULL;
++ }
++
++
++ /* documentation is in ftdebug.h */
++
++ FT_BASE_DEF( void )
++ FT_Trace_Disable( void )
++ {
++ ft_trace_levels = ft_trace_levels_disabled;
++ }
++
++
++ /* documentation is in ftdebug.h */
++
++ FT_BASE_DEF( void )
++ FT_Trace_Enable( void )
++ {
++ ft_trace_levels = ft_trace_levels_enabled;
++ }
++
++
++ /**************************************************************************
++ *
++ * Initialize the tracing sub-system. This is done by retrieving the
++ * value of the `FT2_DEBUG' environment variable. It must be a list of
++ * toggles, separated by spaces, `;', or `,'. Example:
++ *
++ * export FT2_DEBUG="any:3 memory:7 stream:5"
++ *
++ * This requests that all levels be set to 3, except the trace level for
++ * the memory and stream components which are set to 7 and 5,
++ * respectively.
++ *
++ * See the file `include/freetype/internal/fttrace.h' for details of
++ * the available toggle names.
++ *
++ * The level must be between 0 and 7; 0 means quiet (except for serious
++ * runtime errors), and 7 means _very_ verbose.
++ */
++ FT_BASE_DEF( void )
++ ft_debug_init( void )
++ {
++ const char* ft2_debug = NULL;
++
++
++#ifdef FT_DEBUG_LOGGING
++ if ( ft_custom_trace_level != NULL )
++ ft2_debug = ft_custom_trace_level;
++ else
++ ft2_debug = ft_default_trace_level;
++#else
++ ft2_debug = ft_getenv( "FT2_DEBUG" );
++#endif
++
++ if ( ft2_debug )
++ {
++ const char* p = ft2_debug;
++ const char* q;
++
++
++ for ( ; *p; p++ )
++ {
++ /* skip leading whitespace and separators */
++ if ( *p == ' ' || *p == '\t' || *p == ',' || *p == ';' || *p == '=' )
++ continue;
++
++#ifdef FT_DEBUG_LOGGING
++
++ /* check extra arguments for logging */
++ if ( *p == '-' )
++ {
++ const char* r = ++p;
++
++
++ if ( *r == 'v' )
++ {
++ const char* s = ++r;
++
++
++ ft_component_flag = TRUE;
++
++ if ( *s == 't' )
++ {
++ ft_timestamp_flag = TRUE;
++ p++;
++ }
++
++ p++;
++ }
++
++ else if ( *r == 't' )
++ {
++ const char* s = ++r;
++
++
++ ft_timestamp_flag = TRUE;
++
++ if ( *s == 'v' )
++ {
++ ft_component_flag = TRUE;
++ p++;
++ }
++
++ p++;
++ }
++ }
++
++#endif /* FT_DEBUG_LOGGING */
++
++ /* read toggle name, followed by ':' */
++ q = p;
++ while ( *p && *p != ':' )
++ p++;
++
++ if ( !*p )
++ break;
++
++ if ( *p == ':' && p > q )
++ {
++ FT_Int n, i, len = (FT_Int)( p - q );
++ FT_Int level = -1, found = -1;
++
++
++ for ( n = 0; n < trace_count; n++ )
++ {
++ const char* toggle = ft_trace_toggles[n];
++
++
++ for ( i = 0; i < len; i++ )
++ {
++ if ( toggle[i] != q[i] )
++ break;
++ }
++
++ if ( i == len && toggle[i] == 0 )
++ {
++ found = n;
++ break;
++ }
++ }
++
++ /* read level */
++ p++;
++ if ( *p )
++ {
++ level = *p - '0';
++ if ( level < 0 || level > 7 )
++ level = -1;
++ }
++
++ if ( found >= 0 && level >= 0 )
++ {
++ if ( found == trace_any )
++ {
++ /* special case for `any' */
++ for ( n = 0; n < trace_count; n++ )
++ ft_trace_levels_enabled[n] = level;
++ }
++ else
++ ft_trace_levels_enabled[found] = level;
++ }
++ }
++ }
++ }
++
++ ft_trace_levels = ft_trace_levels_enabled;
++ }
++
++
++#else /* !FT_DEBUG_LEVEL_TRACE */
++
++
++ FT_BASE_DEF( void )
++ ft_debug_init( void )
++ {
++ /* nothing */
++ }
++
++
++ FT_BASE_DEF( FT_Int )
++ FT_Trace_Get_Count( void )
++ {
++ return 0;
++ }
++
++
++ FT_BASE_DEF( const char * )
++ FT_Trace_Get_Name( FT_Int idx )
++ {
++ FT_UNUSED( idx );
++
++ return NULL;
++ }
++
++
++ FT_BASE_DEF( void )
++ FT_Trace_Disable( void )
++ {
++ /* nothing */
++ }
++
++
++ /* documentation is in ftdebug.h */
++
++ FT_BASE_DEF( void )
++ FT_Trace_Enable( void )
++ {
++ /* nothing */
++ }
++
++#endif /* !FT_DEBUG_LEVEL_TRACE */
++
++
++#ifdef FT_DEBUG_LOGGING
++
++ /**************************************************************************
++ *
++ * Initialize and de-initialize 'dlg' library.
++ *
++ */
++
++ FT_BASE_DEF( void )
++ ft_logging_init( void )
++ {
++ ft_default_log_handler = ft_log_handler;
++ ft_default_trace_level = ft_getenv( "FT2_DEBUG" );
++
++ if ( ft_getenv( "FT_LOGGING_FILE" ) )
++ ft_fileptr = ft_fopen( ft_getenv( "FT_LOGGING_FILE" ), "w" );
++ else
++ ft_fileptr = stderr;
++
++ ft_debug_init();
++
++ /* Set the default output handler for 'dlg'. */
++ dlg_set_handler( ft_default_log_handler, NULL );
++ }
++
++
++ FT_BASE_DEF( void )
++ ft_logging_deinit( void )
++ {
++ if ( ft_fileptr != stderr )
++ ft_fclose( ft_fileptr );
++ }
++
++
++ /**************************************************************************
++ *
++ * An output log handler for FreeType.
++ *
++ */
++ FT_BASE_DEF( void )
++ ft_log_handler( const struct dlg_origin* origin,
++ const char* string,
++ void* data )
++ {
++ char features_buf[128];
++ char* bufp = features_buf;
++
++ FT_UNUSED( data );
++
++
++ if ( ft_have_newline_char )
++ {
++ const char* features = NULL;
++ size_t features_length = 0;
++
++
++#define FEATURES_TIMESTAMP "[%h:%m] "
++#define FEATURES_COMPONENT "[%t] "
++#define FEATURES_TIMESTAMP_COMPONENT "[%h:%m %t] "
++
++ if ( ft_timestamp_flag && ft_component_flag )
++ {
++ features = FEATURES_TIMESTAMP_COMPONENT;
++ features_length = sizeof ( FEATURES_TIMESTAMP_COMPONENT );
++ }
++ else if ( ft_timestamp_flag )
++ {
++ features = FEATURES_TIMESTAMP;
++ features_length = sizeof ( FEATURES_TIMESTAMP );
++ }
++ else if ( ft_component_flag )
++ {
++ features = FEATURES_COMPONENT;
++ features_length = sizeof ( FEATURES_COMPONENT );
++ }
++
++ if ( ft_component_flag || ft_timestamp_flag )
++ {
++ ft_strncpy( features_buf, features, features_length );
++ bufp += features_length - 1;
++ }
++
++ if ( ft_component_flag )
++ {
++ size_t tag_length = ft_strlen( *origin->tags );
++ size_t i;
++
++
++ /* To vertically align tracing messages we compensate the */
++ /* different FT_COMPONENT string lengths by inserting an */
++ /* appropriate amount of space characters. */
++ for ( i = 0;
++ i < FT_MAX_TRACE_LEVEL_LENGTH - tag_length;
++ i++ )
++ *bufp++ = ' ';
++ }
++ }
++
++ /* Finally add the format string for the tracing message. */
++ *bufp++ = '%';
++ *bufp++ = 'c';
++ *bufp = '\0';
++
++ dlg_generic_outputf_stream( ft_fileptr,
++ (const char*)features_buf,
++ origin,
++ string,
++ dlg_default_output_styles,
++ true );
++
++ if ( ft_strrchr( string, '\n' ) )
++ ft_have_newline_char = TRUE;
++ else
++ ft_have_newline_char = FALSE;
++ }
++
++
++ /* documentation is in ftdebug.h */
++ FT_BASE_DEF( void )
++ ft_add_tag( const char* tag )
++ {
++ ft_component = tag;
++
++ dlg_add_tag( tag, NULL );
++ }
++
++
++ /* documentation is in ftdebug.h */
++ FT_BASE_DEF( void )
++ ft_remove_tag( const char* tag )
++ {
++ dlg_remove_tag( tag, NULL );
++ }
++
++
++ /* documentation is in ftlogging.h */
++
++ FT_EXPORT_DEF( void )
++ FT_Trace_Set_Level( const char* level )
++ {
++ ft_component_flag = FALSE;
++ ft_timestamp_flag = FALSE;
++ ft_custom_trace_level = level;
++
++ ft_debug_init();
++ }
++
++
++ /* documentation is in ftlogging.h */
++
++ FT_EXPORT_DEF( void )
++ FT_Trace_Set_Default_Level( void )
++ {
++ ft_component_flag = FALSE;
++ ft_timestamp_flag = FALSE;
++ ft_custom_trace_level = NULL;
++
++ ft_debug_init();
++ }
++
++
++ /**************************************************************************
++ *
++ * Functions to handle a custom log handler.
++ *
++ */
++
++ /* documentation is in ftlogging.h */
++
++ FT_EXPORT_DEF( void )
++ FT_Set_Log_Handler( FT_Custom_Log_Handler handler )
++ {
++ custom_output_handler = handler;
++ }
++
++
++ /* documentation is in ftlogging.h */
++
++ FT_EXPORT_DEF( void )
++ FT_Set_Default_Log_Handler( void )
++ {
++ custom_output_handler = NULL;
++ }
++
++
++ /* documentation is in ftdebug.h */
++ FT_BASE_DEF( void )
++ FT_Logging_Callback( const char* fmt,
++ ... )
++ {
++ va_list ap;
++
++
++ va_start( ap, fmt );
++ custom_output_handler( ft_component, fmt, ap );
++ va_end( ap );
++ }
++
++#else /* !FT_DEBUG_LOGGING */
++
++ FT_EXPORT_DEF( void )
++ FT_Trace_Set_Level( const char* level )
++ {
++ FT_UNUSED( level );
++ }
++
++
++ FT_EXPORT_DEF( void )
++ FT_Trace_Set_Default_Level( void )
++ {
++ /* nothing */
++ }
++
++
++ FT_EXPORT_DEF( void )
++ FT_Set_Log_Handler( FT_Custom_Log_Handler handler )
++ {
++ FT_UNUSED( handler );
++ }
++
++
++ FT_EXPORT_DEF( void )
++ FT_Set_Default_Log_Handler( void )
++ {
++ /* nothing */
++ }
++
++#endif /* !FT_DEBUG_LOGGING */
++
++
++/* END */
+diff --git a/src/3rdparty/freetype/docs/CHANGES b/src/3rdparty/freetype/docs/CHANGES
+index 3bd5291ae1..3ad7ec4333 100644
+--- a/src/3rdparty/freetype/docs/CHANGES
++++ b/src/3rdparty/freetype/docs/CHANGES
+@@ -1,4 +1,235 @@
+-CHANGES BETWEEN 2.10.3 and 2.10.4
++CHANGES BETWEEN 2.12.0 and 2.12.1
++
++ I. IMPORTANT BUG FIXES
++
++ - Loading CFF fonts sometimes made FreeType crash (bug introduced in
++ version 2.12.0)
++
++ - Loading a fully hinted TrueType glyph a second time (without
++ caching) sometimes yielded different rendering results if TrueType
++ hinting was active (bug introduced in version 2.12.0).
++
++ - The generation of the pkg-config file `freetype2.pc` was broken if
++ the build was done with cmake (bug introduced in version 2.12.0).
++
++
++ II. MISCELLANEOUS
++
++ - New option `--with-librsvg` for the `configure` script for better
++ FreeType demo support.
++
++ - The meson build no longer enforces both static and dynamic
++ versions of the library by default.
++
++ - The internal zlib library was updated to version 1.2.12. Note,
++ however, that FreeType is *not* affected by CVE-2018-25032 since
++ it only does decompression.
++
++
++======================================================================
++
++CHANGES BETWEEN 2.11.1 and 2.12.0
++
++ I. IMPORTANT CHANGES
++
++ - FreeType now handles OT-SVG fonts, to be controlled with
++ `FT_CONFIG_OPTION_SVG` configuration macro. By default, it can
++ only load the 'SVG ' table of an OpenType font. However, by using
++ the `svg-hooks` property of the new 'ot-svg' module it is possible
++ to register an external SVG rendering engine. The FreeType demo
++ programs have been set up to use 'librsvg' as the rendering
++ library.
++
++ This work was Moazin Khatti's GSoC 2019 project.
++
++
++ II. MISCELLANEOUS
++
++ - The handling of fonts with an 'sbix' table has been improved.
++
++ - Corrected bitmap offsets.
++
++ - A new tag `FT_PARAM_TAG_IGNORE_SBIX` for `FT_Open_Face` makes
++ FreeType ignore an 'sbix' table in a font, allowing applications
++ to access the font's outline glyphs.
++
++ - `FT_FACE_FLAG_SBIX` and `FT_FACE_FLAG_SBIX_OVERLAY` together
++ with their corresponding preprocessor macros `FT_HAS_SBIX` and
++ `FT_HAS_SBIX_OVERLAY` enable applications to treat 'sbix' tables
++ as described in the OpenType specification.
++
++ - The internal 'zlib' code has been updated to be in sync with the
++ current 'zlib' version (1.2.11).
++
++ - The previously internal load flag `FT_LOAD_SBITS_ONLY` is now
++ public.
++
++ - Some minor improvements of the building systems, in particular
++ handling of the 'zlib' library (internal vs. external).
++
++ - Support for non-desktop Universal Windows Platform.
++
++ - Various other minor bug and documentation fixes.
++
++ - The `ftdump` demo program shows more information for Type1 fonts
++ if option `-n` is given.
++
++ - `ftgrid` can now display embedded bitmap strikes.
++
++
++======================================================================
++
++CHANGES BETWEEN 2.11.0 and 2.11.1
++
++ I. IMPORTANT CHANGES
++
++ - Some fields in the `CID_FaceDictRec`, `CID_FaceInfoRec`, and
++ `FT_Data` structures have been changed from signed to unsigned
++ type, which better reflects the actual usage. It is also an
++ additional means to protect against malformed input.
++
++
++ II. MISCELLANEOUS
++
++ - Cmake support has been further improved. To do that various
++ backward-incompatible changes were necessary; please see file
++ `CMakeLists.txt` for more details.
++
++ - Since version 2.11.0, a C99 compiler is necessary to compile
++ FreeType.
++
++ - The experimental 'COLR' v1 API has been updated to the latest
++ OpenType standard 1.9.
++
++ - The `apinames` tool got a new option `-wV` to output an OpenVMS
++ Linker Option File.
++
++ - VMS support was updated.
++
++ - MS Visual Studio support was added to build the demo programs.
++
++
++======================================================================
++
++CHANGES BETWEEN 2.10.4 and 2.11.0
++
++ I. IMPORTANT CHANGES
++
++ - A new rendering module has been added to create 8-bit Signed
++ Distance Field (SDF) bitmaps for both outline and bitmap glyphs.
++ The new rendering mode is called `FT_RENDER_MODE_SDF`, the pixel
++ mode is `FT_PIXEL_MODE_GRAY8`, and the corresponding raster flag
++ is `FT_RASTER_FLAG_SDF`.
++
++ This work was Anuj Verma's GSoC 2020 project.
++
++ - A new, experimental API is now available for surfacing properties
++ of 'COLR' v1 color fonts (as the name says, this is an extension
++ to the 'COLR' table for outline color fonts using the SFNT
++ container format). 'COLR' v1 fonts are a recently proposed
++ addition to OFF and OpenType; specification work currently happens
++ in
++
++ https://github.com/googlefonts/colr-gradients-spec/
++
++ 'COLR' v1 is expected to be merged to OpenType; the ISO
++ standardisation process for adding 'COLR' v1 as an amendment to
++ OFF is underway.
++
++ Functions similar to the already existing 'COLR' API have been
++ added to access the corresponding data.
++
++ FT_Get_Color_Glyph_Paint
++ Retrieve the root paint for a given glyph ID.
++
++ FT_Get_Paint_Layers
++ Access the layers of a `PaintColrLayers` table.
++
++ FT_Get_Colorline_Stops
++ Retrieve the 'color stops' on a color line. As an input, a
++ color stop iterator gets used, which in turn is retrieved from
++ a paint.
++
++ FT_Get_Paint
++ Dereference an `FT_OpaquePaint` object and retrieve the
++ corresponding `FT_COLR_Paint` object, which contains details
++ on how to draw the respective 'COLR' v1 `Paint` table.
++
++
++ II. MISCELLANEOUS
++
++ - FreeType has moved its infrastructure to
++
++ https://gitlab.freedesktop.org/freetype
++
++ A side effect is that the git repositories are now called
++ `freetype.git` and `freetype-demos.git`, which by default expand
++ to the directories `freetype` and `freetype-demos`, respectively.
++ The documentation has been updated accordingly.
++
++ FreeType's Savannah repositories will stay; they are now mirrors
++ of the 'freedesktop.org' repositories.
++
++ - A new function `FT_Get_Transform` returns the values set by
++ `FT_Set_Transform`.
++
++ - A new configuration macro `FT_DEBUG_LOGGING` is available. It
++ provides extended debugging capabilities for FreeType, for example
++ showing a time stamp or displaying the component a tracing message
++ comes from. See file `docs/DEBUG` for more information.
++
++ This work was Priyesh Kumar's GSoC 2020 project.
++
++ - The legacy Type 1 and CFF engines are further demoted due to lack
++ of CFF2 charstring support. You now need to use `FT_Property_Set`
++ to enable them besides the `T1_CONFIG_OPTION_OLD_ENGINE` and
++ `CFF_CONFIG_OPTION_OLD_ENGINE` options, respectively.
++
++ - The experimental 'warp' mode (AF_CONFIG_OPTION_USE_WARPER) for the
++ auto-hinter has been removed.
++
++ - The smooth rasterizer performance has been improved by >10%. Note
++ that due to necessary code changes there might be very subtle
++ differences in rendering. They are not visible by the eye,
++ however.
++
++ - PCF bitmap fonts compressed with LZW (these are usually files with
++ the extension `.pcf.Z`) are now handled correctly.
++
++ - Improved Meson build files, including support to build the
++ FreeType demo programs.
++
++ - A new demo program `ftsdf` is available to display Signed Distance
++ Fields of glyphs.
++
++ - The `ftlint` demo program has been extended to do more testing of
++ its input. In particular, it can display horizontal and vertical
++ acutances for quality assessment, together with computing MD5
++ checksums of rendered glyphs.
++
++ [The acutance measures how sharply the pixel coverage changes at
++ glyph edges. For monochrome bitmaps, it is always 2.0 in either
++ X or Y direction. For anti-aliased bitmaps, it depends on the
++ hinting and the shape of a glyph and might approach or even reach
++ value 2.0 for glyphs like 'I', 'L', '+', '-', or '=', while it
++ might be lower for glyphs like 'O', 'S', or 'W'.]
++
++ - The `ttdebug` demo program didn't show changed point coordinates
++ (bug introduced in version 2.10.3).
++
++ - It is now possible to adjust the axis increment for variable fonts
++ in the `ftmulti` demo program.
++
++ - It is now possible to change the hinting engine in the `ftstring`
++ demo program.
++
++ - The graphical demo programs work better now in native color depth
++ on win32 and x11.
++
++
++======================================================================
++
++CHANGES BETWEEN 2.10.3 and 2.10.4 (2020-Oct-20)
+
+ I. IMPORTANT BUG FIXES
+
+@@ -13,7 +244,7 @@ CHANGES BETWEEN 2.10.3 and 2.10.4
+
+ ======================================================================
+
+-CHANGES BETWEEN 2.10.2 and 2.10.3
++CHANGES BETWEEN 2.10.2 and 2.10.3 (2020-Oct-10)
+
+ I. IMPORTANT CHANGES
+
+@@ -63,7 +294,7 @@ CHANGES BETWEEN 2.10.2 and 2.10.3
+
+ ======================================================================
+
+-CHANGES BETWEEN 2.10.1 and 2.10.2
++CHANGES BETWEEN 2.10.1 and 2.10.2 (2020-May-09)
+
+ I. IMPORTANT CHANGES
+
+@@ -100,7 +331,7 @@ CHANGES BETWEEN 2.10.1 and 2.10.2
+
+ ======================================================================
+
+-CHANGES BETWEEN 2.10.0 and 2.10.1
++CHANGES BETWEEN 2.10.0 and 2.10.1 (2019-Jul-01)
+
+ I. IMPORTANT BUG FIXES
+
+@@ -154,7 +385,7 @@ CHANGES BETWEEN 2.10.0 and 2.10.1
+
+ ======================================================================
+
+-CHANGES BETWEEN 2.9.1 and 2.10.0
++CHANGES BETWEEN 2.9.1 and 2.10.0 (2019-Mar-15)
+
+ I. IMPORTANT CHANGES
+
+@@ -280,7 +511,7 @@ CHANGES BETWEEN 2.9.1 and 2.10.0
+
+ ======================================================================
+
+-CHANGES BETWEEN 2.9 and 2.9.1
++CHANGES BETWEEN 2.9 and 2.9.1 (2019-May-01)
+
+ I. IMPORTANT BUG FIXES
+
+@@ -328,7 +559,7 @@ CHANGES BETWEEN 2.9 and 2.9.1
+
+ ======================================================================
+
+-CHANGES BETWEEN 2.8.1 and 2.9
++CHANGES BETWEEN 2.8.1 and 2.9 (2018-Jan-08)
+
+ I. IMPORTANT BUG FIXES
+
+@@ -418,7 +649,7 @@ CHANGES BETWEEN 2.8.1 and 2.9
+
+ ======================================================================
+
+-CHANGES BETWEEN 2.8 and 2.8.1
++CHANGES BETWEEN 2.8 and 2.8.1 (2017-Sep-16)
+
+ I. IMPORTANT BUG FIXES
+
+@@ -501,7 +732,7 @@ CHANGES BETWEEN 2.8 and 2.8.1
+
+ ======================================================================
+
+-CHANGES BETWEEN 2.7.1 and 2.8
++CHANGES BETWEEN 2.7.1 and 2.8 (2017-May-13)
+
+ I. IMPORTANT CHANGES
+
+@@ -622,7 +853,7 @@ CHANGES BETWEEN 2.7.1 and 2.8
+
+ ======================================================================
+
+-CHANGES BETWEEN 2.7 and 2.7.1
++CHANGES BETWEEN 2.7 and 2.7.1 (2016-Dec-30)
+
+ I. IMPORTANT CHANGES
+
+@@ -699,7 +930,7 @@ CHANGES BETWEEN 2.7 and 2.7.1
+
+ ======================================================================
+
+-CHANGES BETWEEN 2.6.5 and 2.7
++CHANGES BETWEEN 2.6.5 and 2.7 (2016-Sep-08)
+
+ I. IMPORTANT CHANGES
+
+@@ -763,7 +994,7 @@ CHANGES BETWEEN 2.6.5 and 2.7
+
+ ======================================================================
+
+-CHANGES BETWEEN 2.6.4 and 2.6.5
++CHANGES BETWEEN 2.6.4 and 2.6.5 (2016-Jul-12)
+
+ I. IMPORTANT BUG FIXES
+
+@@ -783,7 +1014,7 @@ CHANGES BETWEEN 2.6.4 and 2.6.5
+
+ ======================================================================
+
+-CHANGES BETWEEN 2.6.3 and 2.6.4
++CHANGES BETWEEN 2.6.3 and 2.6.4 (2016-Jul-05)
+
+ I. IMPORTANT CHANGES
+
+@@ -849,7 +1080,7 @@ CHANGES BETWEEN 2.6.3 and 2.6.4
+
+ ======================================================================
+
+-CHANGES BETWEEN 2.6.2 and 2.6.3
++CHANGES BETWEEN 2.6.2 and 2.6.3 (2016-Feb-08)
+
+ I. IMPORTANT CHANGES
+
+@@ -898,7 +1129,7 @@ CHANGES BETWEEN 2.6.2 and 2.6.3
+
+ ======================================================================
+
+-CHANGES BETWEEN 2.6.1 and 2.6.2
++CHANGES BETWEEN 2.6.1 and 2.6.2 (2015-Nov-28)
+
+ I. IMPORTANT CHANGES
+
+@@ -958,7 +1189,7 @@ CHANGES BETWEEN 2.6.1 and 2.6.2
+
+ ======================================================================
+
+-CHANGES BETWEEN 2.6 and 2.6.1
++CHANGES BETWEEN 2.6 and 2.6.1 (2015-Oct-04)
+
+ I. IMPORTANT BUG FIXES
+
+@@ -1039,7 +1270,7 @@ CHANGES BETWEEN 2.6 and 2.6.1
+
+ ======================================================================
+
+-CHANGES BETWEEN 2.5.5 and 2.6
++CHANGES BETWEEN 2.5.5 and 2.6 (2015-Jun-07)
+
+ I. IMPORTANT CHANGES
+
+@@ -1145,7 +1376,7 @@ CHANGES BETWEEN 2.5.5 and 2.6
+
+ ======================================================================
+
+-CHANGES BETWEEN 2.5.4 and 2.5.5
++CHANGES BETWEEN 2.5.4 and 2.5.5 (2014-Dec-30)
+
+ I. IMPORTANT BUG FIXES
+
+@@ -1155,7 +1386,7 @@ CHANGES BETWEEN 2.5.4 and 2.5.5
+
+ ======================================================================
+
+-CHANGES BETWEEN 2.5.3 and 2.5.4
++CHANGES BETWEEN 2.5.3 and 2.5.4 (2014-Dec-06)
+
+ I. IMPORTANT BUG FIXES
+
+@@ -1226,7 +1457,7 @@ CHANGES BETWEEN 2.5.3 and 2.5.4
+
+ ======================================================================
+
+-CHANGES BETWEEN 2.5.2 and 2.5.3
++CHANGES BETWEEN 2.5.2 and 2.5.3 (2014-Mar-06)
+
+ I. IMPORTANT BUG FIXES
+
+@@ -1294,7 +1525,7 @@ CHANGES BETWEEN 2.5.2 and 2.5.3
+
+ ======================================================================
+
+-CHANGES BETWEEN 2.5.1 and 2.5.2
++CHANGES BETWEEN 2.5.1 and 2.5.2 (2013-Dec-08)
+
+ I. IMPORTANT BUG FIXES
+
+@@ -1318,7 +1549,7 @@ CHANGES BETWEEN 2.5.1 and 2.5.2
+
+ ======================================================================
+
+-CHANGES BETWEEN 2.5 and 2.5.1
++CHANGES BETWEEN 2.5 and 2.5.1 (2013-Nov-25)
+
+ I. IMPORTANT BUG FIXES
+
+@@ -1422,7 +1653,7 @@ CHANGES BETWEEN 2.5 and 2.5.1
+
+ ======================================================================
+
+-CHANGES BETWEEN 2.4.12 and 2.5
++CHANGES BETWEEN 2.4.12 and 2.5 (2013-Jun-19)
+
+ I. IMPORTANT BUG FIXES
+
+@@ -1502,7 +1733,7 @@ CHANGES BETWEEN 2.4.12 and 2.5
+
+ ======================================================================
+
+-CHANGES BETWEEN 2.4.11 and 2.4.12
++CHANGES BETWEEN 2.4.11 and 2.4.12 (2013-May-08)
+
+ - We have another CFF parsing and hinting engine! Written by Dave
+ Arnold , this work has been contributed by
+@@ -1590,7 +1821,7 @@ index ebcf189..3f2ce6b 100644
+
+ ======================================================================
+
+-CHANGES BETWEEN 2.4.10 and 2.4.11
++CHANGES BETWEEN 2.4.10 and 2.4.11 (2012-Dec-20)
+
+ I. IMPORTANT BUG FIXES
+
+@@ -1650,7 +1881,7 @@ CHANGES BETWEEN 2.4.10 and 2.4.11
+
+ ======================================================================
+
+-CHANGES BETWEEN 2.4.9 and 2.4.10
++CHANGES BETWEEN 2.4.9 and 2.4.10 (2012-Jun-15)
+
+ I. IMPORTANT BUG FIXES
+
+@@ -1675,7 +1906,7 @@ CHANGES BETWEEN 2.4.9 and 2.4.10
+
+ ======================================================================
+
+-CHANGES BETWEEN 2.4.8 and 2.4.9
++CHANGES BETWEEN 2.4.8 and 2.4.9 (2012-Mar-08)
+
+ I. IMPORTANT BUG FIXES
+
+@@ -1703,7 +1934,7 @@ CHANGES BETWEEN 2.4.8 and 2.4.9
+
+ ======================================================================
+
+-CHANGES BETWEEN 2.4.7 and 2.4.8
++CHANGES BETWEEN 2.4.7 and 2.4.8 (2011-Nov-14)
+
+ I. IMPORTANT BUG FIXES
+
+@@ -1719,7 +1950,7 @@ CHANGES BETWEEN 2.4.7 and 2.4.8
+
+ ======================================================================
+
+-CHANGES BETWEEN 2.4.6 and 2.4.7
++CHANGES BETWEEN 2.4.6 and 2.4.7 (2011-Oct-18)
+
+ I. IMPORTANT BUG FIXES
+
+@@ -1736,7 +1967,7 @@ CHANGES BETWEEN 2.4.6 and 2.4.7
+
+ ======================================================================
+
+-CHANGES BETWEEN 2.4.5 and 2.4.6
++CHANGES BETWEEN 2.4.5 and 2.4.6 (2011-Jul-29)
+
+ I. IMPORTANT BUG FIXES
+
+@@ -1775,7 +2006,7 @@ CHANGES BETWEEN 2.4.5 and 2.4.6
+
+ ======================================================================
+
+-CHANGES BETWEEN 2.4.4 and 2.4.5
++CHANGES BETWEEN 2.4.4 and 2.4.5 (2011-Jun-25)
+
+ I. IMPORTANT BUG FIXES
+
+@@ -1822,7 +2053,7 @@ CHANGES BETWEEN 2.4.4 and 2.4.5
+
+ ======================================================================
+
+-CHANGES BETWEEN 2.4.3 and 2.4.4
++CHANGES BETWEEN 2.4.3 and 2.4.4 (2010-Nov-28)
+
+ I. IMPORTANT BUG FIXES
+
+@@ -1847,7 +2078,7 @@ CHANGES BETWEEN 2.4.3 and 2.4.4
+
+ ======================================================================
+
+-CHANGES BETWEEN 2.4.2 and 2.4.3
++CHANGES BETWEEN 2.4.2 and 2.4.3 (2010-Oct-03)
+
+ I. IMPORTANT BUG FIXES
+
+@@ -1866,7 +2097,7 @@ CHANGES BETWEEN 2.4.2 and 2.4.3
+
+ ======================================================================
+
+-CHANGES BETWEEN 2.4.1 and 2.4.2
++CHANGES BETWEEN 2.4.1 and 2.4.2 (2010-Aug-06)
+
+ I. IMPORTANT BUG FIXES
+
+@@ -1890,7 +2121,7 @@ CHANGES BETWEEN 2.4.1 and 2.4.2
+
+ ======================================================================
+
+-CHANGES BETWEEN 2.4.0 and 2.4.1
++CHANGES BETWEEN 2.4.0 and 2.4.1 (2010-Jul-18)
+
+ I. IMPORTANT CHANGES
+
+@@ -1900,7 +2131,7 @@ CHANGES BETWEEN 2.4.0 and 2.4.1
+
+ ======================================================================
+
+-CHANGES BETWEEN 2.3.12 and 2.4.0
++CHANGES BETWEEN 2.3.12 and 2.4.0 (2010-Jul-12)
+
+ I. IMPORTANT CHANGES
+
+@@ -5299,7 +5530,7 @@ Extensions support:
+
+ ------------------------------------------------------------------------
+
+-Copyright (C) 2000-2020 by
++Copyright (C) 2000-2022 by
+ David Turner, Robert Wilhelm, and Werner Lemberg.
+
+ This file is part of the FreeType project, and may only be used,
+diff --git a/src/3rdparty/freetype/docs/CUSTOMIZE b/src/3rdparty/freetype/docs/CUSTOMIZE
+index 0f92e70046..1a750825b2 100644
+--- a/src/3rdparty/freetype/docs/CUSTOMIZE
++++ b/src/3rdparty/freetype/docs/CUSTOMIZE
+@@ -139,7 +139,7 @@ IV. Overriding default configuration and module headers
+
+ ----------------------------------------------------------------------
+
+-Copyright (C) 2003-2020 by
++Copyright (C) 2003-2022 by
+ David Turner, Robert Wilhelm, and Werner Lemberg.
+
+ This file is part of the FreeType project, and may only be used,
+diff --git a/src/3rdparty/freetype/docs/DEBUG b/src/3rdparty/freetype/docs/DEBUG
+index a96b5e27b8..fd2de134d5 100644
+--- a/src/3rdparty/freetype/docs/DEBUG
++++ b/src/3rdparty/freetype/docs/DEBUG
+@@ -44,6 +44,21 @@ located in the file `ftoption.h'. The macros are:
+ When `FT2_DEBUG_MEMORY' isn't defined at runtime, the debugging
+ memory manager is ignored, and performance is unaffected.
+
++ FT_DEBUG_LOGGING
++
++ #define this macro for enhanced logging support; it automatically
++ sets `FT_DEBUG_LEVEL_TRACE' and `FT_DEBUG_LEVEL_ERROR'.
++
++ If defined, `FT_TRACE' and `FT_ERROR' can send tracing and
++ debugging messages to a file. The location of the log file has to
++ be set with the `FT_LOGGING_FILE' environment variable (more on
++ this later).
++
++ The main enhancements are the possibility of logging the time and
++ the name of the `FT_COMPONENT' macro together with the affected
++ `FT_TRACE' or `FT_ERROR' calls. See below how to activate this in
++ the `FT2_DEBUG' environment variable.
++
+
+ II. Debugging macros
+ --------------------
+@@ -150,6 +165,43 @@ behaviour of FreeType at runtime.
+ the memory and io components, which are set to the trace levels 5
+ and 4, respectively.
+
++ If `FT_DEBUG_LOGGING' is defined, two more options are available.
++
++ * -v: Print also the name of FreeType's component from which the
++ current log is produced, together with the tracing level.
++
++ * -t: Print also the time.
++
++ Here are some examples how the output might look like.
++
++ FT2_DEBUG="any:7 memory:5 -vt"
++
++ => [20:32:02:44969 ttload:2] table directory loaded
++
++ FT2_DEBUG="any:7 memory:5 -t"
++
++ => [20:32:02:44969] table directory loaded
++
++ FT2_DEBUG="any:7 memory:5 -v"
++
++ => [ttload:2] table directory loaded
++
++
++ FT_LOGGING_FILE
++
++ This variable is only used if FreeType is built with the
++ `FT_DEBUG_LOGGING' macro defined. It contains the path to the
++ file where the user wants to put his log file. If it is not set,
++ FreeType uses stderr.
++
++ Examples:
++
++ On UNIX-like systems with bash:
++ export FT_LOGGING_FILE="/tmp/freetype2.log"
++
++ On Windows:
++ set FT_LOGGING_FILE=C:\Users\AppData\Local\Temp\freetype2.log
++
+
+ FT2_DEBUG_MEMORY
+
+@@ -201,9 +253,51 @@ behaviour of FreeType at runtime.
+ If it is undefined, or if its value is not strictly positive,
+ freed blocks are released at runtime.
+
++
++IV. Additional Capabilities with `FT_DEBUG_LOGGING'
++---------------------------------------------------
++
++If `FT_DEBUG_LOGGING' is defined, four APIs are available to provide
++additional debugging support. Use
++
++ #include
++
++to access them.
++
++ FT_Trace_Set_Level( const char* level )
++
++ By default, FreeType uses the tracing levels set in the
++ `FT2_DEBUG' environment variable. Use this function to override
++ the value with `level'. Use value `NULL' to disable tracing.
++
++ FT_Trace_Set_Default_Level():
++
++ Reset the tracing levels to the default value, i.e., the value of
++ the `FT2_DEBUG' environment variable or no tracing if not set.
++
++ FT_Set_Log_Handler( ft_custom_log_handler handler ):
++
++ Use `handler' as a custom handler for formatting tracing and error
++ messages. The `ft_custom_log_handler' typedef has the following
++ prototype.
++
++ void
++ (*ft_custom_log_handler)( const char* ft_component,
++ const char* fmt,
++ va_list args );
++
++ `ft_component' is the current component like `ttload', `fmt' is the
++ first argument of `FT_TRACE' or `FT_ERROR', and `args' holds the
++ remaining arguments.
++
++ FT_Set_Default_Log_Handler():
++
++ Reset the log handler to the default version.
++
++
+ ------------------------------------------------------------------------
+
+-Copyright (C) 2002-2020 by
++Copyright (C) 2002-2022 by
+ David Turner, Robert Wilhelm, and Werner Lemberg.
+
+ This file is part of the FreeType project, and may only be used,
+diff --git a/src/3rdparty/freetype/docs/LICENSE.TXT b/src/3rdparty/freetype/docs/LICENSE.TXT
+deleted file mode 100644
+index af5a1c50f6..0000000000
+--- a/src/3rdparty/freetype/docs/LICENSE.TXT
++++ /dev/null
+@@ -1,39 +0,0 @@
+-
+-The FreeType 2 font engine is copyrighted work and cannot be used
+-legally without a software license. In order to make this project
+-usable to a vast majority of developers, we distribute it under two
+-mutually exclusive open-source licenses.
+-
+-This means that *you* must choose *one* of the two licenses described
+-below, then obey all its terms and conditions when using FreeType 2 in
+-any of your projects or products.
+-
+- - The FreeType License, found in the file `FTL.TXT', which is similar
+- to the original BSD license *with* an advertising clause that forces
+- you to explicitly cite the FreeType project in your product's
+- documentation. All details are in the license file. This license
+- is suited to products which don't use the GNU General Public
+- License.
+-
+- Note that this license is compatible to the GNU General Public
+- License version 3, but not version 2.
+-
+- - The GNU General Public License version 2, found in `GPLv2.TXT' (any
+- later version can be used also), for programs which already use the
+- GPL. Note that the FTL is incompatible with GPLv2 due to its
+- advertisement clause.
+-
+-The contributed BDF and PCF drivers come with a license similar to that
+-of the X Window System. It is compatible to the above two licenses (see
+-file src/bdf/README and src/pcf/README). The same holds for the files
+-`fthash.c' and `fthash.h'; their code was part of the BDF driver in
+-earlier FreeType versions.
+-
+-The gzip module uses the zlib license (see src/gzip/zlib.h) which too is
+-compatible to the above two licenses.
+-
+-The MD5 checksum support (only used for debugging in development builds)
+-is in the public domain.
+-
+-
+---- end of LICENSE.TXT ---
+diff --git a/src/3rdparty/freetype/docs/TODO b/src/3rdparty/freetype/docs/TODO
+index 8b27e269a3..623866eab9 100644
+--- a/src/3rdparty/freetype/docs/TODO
++++ b/src/3rdparty/freetype/docs/TODO
+@@ -27,7 +27,7 @@ Other bugs have been registered at the savannah bugzilla of FreeType.
+
+ ------------------------------------------------------------------------
+
+-Copyright (C) 2001-2020 by
++Copyright (C) 2001-2022 by
+ David Turner, Robert Wilhelm, and Werner Lemberg.
+
+ This file is part of the FreeType project, and may only be used,
+diff --git a/src/3rdparty/freetype/freetype.pro b/src/3rdparty/freetype/freetype.pro
+index 0b53c86591..e287222728 100644
+--- a/src/3rdparty/freetype/freetype.pro
++++ b/src/3rdparty/freetype/freetype.pro
+@@ -51,17 +51,24 @@ SOURCES += \
+ $$PWD/src/pshinter/pshinter.c \
+ $$PWD/src/psnames/psmodule.c \
+ $$PWD/src/raster/raster.c \
++ $$PWD/src/sdf/ftsdfrend.c \
++ $$PWD/src/sdf/ftbsdf.c \
++ $$PWD/src/sdf/ftsdf.c \
++ $$PWD/src/sdf/ftsdfcommon.c \
+ $$PWD/src/sfnt/sfnt.c \
+ $$PWD/src/smooth/smooth.c \
++ $$PWD/src/svg/ftsvg.c \
+ $$PWD/src/truetype/truetype.c \
+ $$PWD/src/type1/type1.c \
+ $$PWD/src/type42/type42.c \
+ $$PWD/src/winfonts/winfnt.c
+
+ win32 {
+- SOURCES += $$PWD/src/base/ftsystem.c
++ SOURCES += $$PWD/src/base/ftsystem.c \
++ $$PWD/builds/windows/ftdebug.c
+ } else {
+ SOURCES += $$PWD/builds/unix/ftsystem.c
++ $$PWD/src/base/ftdebug.c
+ INCLUDEPATH += $$PWD/builds/unix
+ }
+
+diff --git a/src/3rdparty/freetype/import_from_tarball.sh b/src/3rdparty/freetype/import_from_tarball.sh
+index df8717d68a..e7d1bb8c37 100644
+--- a/src/3rdparty/freetype/import_from_tarball.sh
++++ b/src/3rdparty/freetype/import_from_tarball.sh
+@@ -78,6 +78,7 @@ copy_file_or_dir() {
+ FILES="
+ README
+ builds/unix/ftsystem.c
++ builds/windows/ftdebug.c
+ docs/CHANGES
+ docs/CUSTOMIZE
+ docs/DEBUG
+@@ -85,7 +86,6 @@ FILES="
+ docs/TODO
+ docs/FTL.TXT
+ docs/GPLv2.TXT
+- docs/LICENSE.TXT
+ include/
+ src/
+ "
+diff --git a/src/3rdparty/freetype/include/freetype/config/ftconfig.h b/src/3rdparty/freetype/include/freetype/config/ftconfig.h
+index b464e0b789..c696e900a6 100644
+--- a/src/3rdparty/freetype/include/freetype/config/ftconfig.h
++++ b/src/3rdparty/freetype/include/freetype/config/ftconfig.h
+@@ -4,7 +4,7 @@
+ *
+ * ANSI-specific configuration file (specification only).
+ *
+- * Copyright (C) 1996-2020 by
++ * Copyright (C) 1996-2022 by
+ * David Turner, Robert Wilhelm, and Werner Lemberg.
+ *
+ * This file is part of the FreeType project, and may only be used,
+diff --git a/src/3rdparty/freetype/include/freetype/config/ftheader.h b/src/3rdparty/freetype/include/freetype/config/ftheader.h
+index 28b5cc60cf..a8c6833df7 100644
+--- a/src/3rdparty/freetype/include/freetype/config/ftheader.h
++++ b/src/3rdparty/freetype/include/freetype/config/ftheader.h
+@@ -4,7 +4,7 @@
+ *
+ * Build macros of the FreeType 2 library.
+ *
+- * Copyright (C) 1996-2020 by
++ * Copyright (C) 1996-2022 by
+ * David Turner, Robert Wilhelm, and Werner Lemberg.
+ *
+ * This file is part of the FreeType project, and may only be used,
+@@ -777,6 +777,18 @@
+ #define FT_COLOR_H
+
+
++ /**************************************************************************
++ *
++ * @macro:
++ * FT_OTSVG_H
++ *
++ * @description:
++ * A macro used in `#include` statements to name the file containing the
++ * FreeType~2 API which handles the OpenType 'SVG~' glyphs.
++ */
++#define FT_OTSVG_H
++
++
+ /* */
+
+ /* These header files don't need to be included by the user. */
+diff --git a/src/3rdparty/freetype/include/freetype/config/ftmodule.h b/src/3rdparty/freetype/include/freetype/config/ftmodule.h
+index b5c4b1ee58..b315baba8a 100644
+--- a/src/3rdparty/freetype/include/freetype/config/ftmodule.h
++++ b/src/3rdparty/freetype/include/freetype/config/ftmodule.h
+@@ -19,12 +19,15 @@ FT_USE_MODULE( FT_Driver_ClassRec, pfr_driver_class )
+ FT_USE_MODULE( FT_Driver_ClassRec, t42_driver_class )
+ FT_USE_MODULE( FT_Driver_ClassRec, winfnt_driver_class )
+ FT_USE_MODULE( FT_Driver_ClassRec, pcf_driver_class )
++FT_USE_MODULE( FT_Driver_ClassRec, bdf_driver_class )
+ FT_USE_MODULE( FT_Module_Class, psaux_module_class )
+ FT_USE_MODULE( FT_Module_Class, psnames_module_class )
+ FT_USE_MODULE( FT_Module_Class, pshinter_module_class )
+-FT_USE_MODULE( FT_Renderer_Class, ft_raster1_renderer_class )
+ FT_USE_MODULE( FT_Module_Class, sfnt_module_class )
+ FT_USE_MODULE( FT_Renderer_Class, ft_smooth_renderer_class )
+-FT_USE_MODULE( FT_Driver_ClassRec, bdf_driver_class )
++FT_USE_MODULE( FT_Renderer_Class, ft_raster1_renderer_class )
++FT_USE_MODULE( FT_Renderer_Class, ft_sdf_renderer_class )
++FT_USE_MODULE( FT_Renderer_Class, ft_bitmap_sdf_renderer_class )
++FT_USE_MODULE( FT_Renderer_Class, ft_svg_renderer_class )
+
+ /* EOF */
+diff --git a/src/3rdparty/freetype/include/freetype/config/ftoption.h b/src/3rdparty/freetype/include/freetype/config/ftoption.h
+index 097f19b8a5..c5bde243b1 100644
+--- a/src/3rdparty/freetype/include/freetype/config/ftoption.h
++++ b/src/3rdparty/freetype/include/freetype/config/ftoption.h
+@@ -4,7 +4,7 @@
+ *
+ * User-selectable configuration macros (specification only).
+ *
+- * Copyright (C) 1996-2020 by
++ * Copyright (C) 1996-2022 by
+ * David Turner, Robert Wilhelm, and Werner Lemberg.
+ *
+ * This file is part of the FreeType project, and may only be used,
+@@ -105,8 +105,7 @@ FT_BEGIN_HEADER
+ *
+ * ```
+ * FREETYPE_PROPERTIES=truetype:interpreter-version=35 \
+- * cff:no-stem-darkening=1 \
+- * autofitter:warping=1
++ * cff:no-stem-darkening=1
+ * ```
+ *
+ */
+@@ -220,6 +219,10 @@ FT_BEGIN_HEADER
+ * If you use a build system like cmake or the `configure` script,
+ * options set by those programs have precedence, overwriting the value
+ * here with the configured one.
++ *
++ * If you use the GNU make build system directly (that is, without the
++ * `configure` script) and you define this macro, you also have to pass
++ * `SYSTEM_ZLIB=yes` as an argument to make.
+ */
+ /* #define FT_CONFIG_OPTION_SYSTEM_ZLIB */
+
+@@ -431,6 +434,23 @@ FT_BEGIN_HEADER
+ /* #define FT_DEBUG_LEVEL_TRACE */
+
+
++ /**************************************************************************
++ *
++ * Logging
++ *
++ * Compiling FreeType in debug or trace mode makes FreeType write error
++ * and trace log messages to `stderr`. Enabling this macro
++ * automatically forces the `FT_DEBUG_LEVEL_ERROR` and
++ * `FT_DEBUG_LEVEL_TRACE` macros and allows FreeType to write error and
++ * trace log messages to a file instead of `stderr`. For writing logs
++ * to a file, FreeType uses an the external `dlg` library (the source
++ * code is in `src/dlg`).
++ *
++ * This option needs a C99 compiler.
++ */
++/* #define FT_DEBUG_LOGGING */
++
++
+ /**************************************************************************
+ *
+ * Autofitter debugging
+@@ -507,6 +527,20 @@ FT_BEGIN_HEADER
+ #undef FT_CONFIG_OPTION_USE_MODULE_ERRORS
+
+
++ /**************************************************************************
++ *
++ * OpenType SVG Glyph Support
++ *
++ * Setting this macro enables support for OpenType SVG glyphs. By
++ * default, FreeType can only fetch SVG documents. However, it can also
++ * render them if external rendering hook functions are plugged in at
++ * runtime.
++ *
++ * More details on the hooks can be found in file `otsvg.h`.
++ */
++#define FT_CONFIG_OPTION_SVG
++
++
+ /**************************************************************************
+ *
+ * Error Strings
+@@ -892,24 +926,6 @@ FT_BEGIN_HEADER
+ #endif
+
+
+- /**************************************************************************
+- *
+- * Compile 'autofit' module with warp hinting. The idea of the warping
+- * code is to slightly scale and shift a glyph within a single dimension so
+- * that as much of its segments are aligned (more or less) on the grid. To
+- * find out the optimal scaling and shifting value, various parameter
+- * combinations are tried and scored.
+- *
+- * You can switch warping on and off with the `warping` property of the
+- * auto-hinter (see file `ftdriver.h` for more information; by default it
+- * is switched off).
+- *
+- * This experimental option is not active if the rendering mode is
+- * `FT_RENDER_MODE_LIGHT`.
+- */
+-#define AF_CONFIG_OPTION_USE_WARPER
+-
+-
+ /**************************************************************************
+ *
+ * Use TrueType-like size metrics for 'light' auto-hinting.
+@@ -961,6 +977,21 @@ FT_BEGIN_HEADER
+ #endif
+
+
++ /*
++ * The TT_SUPPORT_COLRV1 macro is defined to indicate to clients that this
++ * version of FreeType has support for 'COLR' v1 API. This definition is
++ * useful to FreeType clients that want to build in support for 'COLR' v1
++ * depending on a tip-of-tree checkout before it is officially released in
++ * FreeType, and while the feature cannot yet be tested against using
++ * version macros. Don't change this macro. This may be removed once the
++ * feature is in a FreeType release version and version macros can be used
++ * to test for availability.
++ */
++#ifdef TT_CONFIG_OPTION_COLOR_LAYERS
++#define TT_SUPPORT_COLRV1
++#endif
++
++
+ /*
+ * Check CFF darkening parameters. The checks are the same as in function
+ * `cff_property_set` in file `cffdrivr.c`.
+@@ -989,8 +1020,8 @@ FT_BEGIN_HEADER
+ #error "Invalid CFF darkening parameters!"
+ #endif
+
+-FT_END_HEADER
+
++FT_END_HEADER
+
+ #endif /* FTOPTION_H_ */
+
+diff --git a/src/3rdparty/freetype/include/freetype/config/ftstdlib.h b/src/3rdparty/freetype/include/freetype/config/ftstdlib.h
+index d6091f8b3d..7958c2a5f7 100644
+--- a/src/3rdparty/freetype/include/freetype/config/ftstdlib.h
++++ b/src/3rdparty/freetype/include/freetype/config/ftstdlib.h
+@@ -5,7 +5,7 @@
+ * ANSI-specific library and header configuration file (specification
+ * only).
+ *
+- * Copyright (C) 2002-2020 by
++ * Copyright (C) 2002-2022 by
+ * David Turner, Robert Wilhelm, and Werner Lemberg.
+ *
+ * This file is part of the FreeType project, and may only be used,
+@@ -43,7 +43,8 @@
+ *
+ * `UINT_MAX` and `ULONG_MAX` are used to automatically compute the size of
+ * `int` and `long` in bytes at compile-time. So far, this works for all
+- * platforms the library has been tested on.
++ * platforms the library has been tested on. We also check `ULLONG_MAX`
++ * to see whether we can use 64-bit `long long` later on.
+ *
+ * Note that on the extremely rare platforms that do not provide integer
+ * types that are _exactly_ 16 and 32~bits wide (e.g., some old Crays where
+@@ -66,6 +67,15 @@
+ #define FT_LONG_MIN LONG_MIN
+ #define FT_LONG_MAX LONG_MAX
+ #define FT_ULONG_MAX ULONG_MAX
++#ifdef LLONG_MAX
++#define FT_LLONG_MAX LLONG_MAX
++#endif
++#ifdef LLONG_MIN
++#define FT_LLONG_MIN LLONG_MIN
++#endif
++#ifdef ULLONG_MAX
++#define FT_ULLONG_MAX ULLONG_MAX
++#endif
+
+
+ /**************************************************************************
+diff --git a/src/3rdparty/freetype/include/freetype/config/integer-types.h b/src/3rdparty/freetype/include/freetype/config/integer-types.h
+index a0ca0c95e2..d9d2638d1e 100644
+--- a/src/3rdparty/freetype/include/freetype/config/integer-types.h
++++ b/src/3rdparty/freetype/include/freetype/config/integer-types.h
+@@ -4,7 +4,7 @@
+ *
+ * FreeType integer types definitions.
+ *
+- * Copyright (C) 1996-2020 by
++ * Copyright (C) 1996-2022 by
+ * David Turner, Robert Wilhelm, and Werner Lemberg.
+ *
+ * This file is part of the FreeType project, and may only be used,
+@@ -60,6 +60,18 @@
+
+ #endif /* !defined(FT_SIZEOF_LONG) */
+
++#ifndef FT_SIZEOF_LONG_LONG
++
++ /* The size of a `long long` type if available */
++#if defined( FT_ULLONG_MAX ) && FT_ULLONG_MAX >= 0xFFFFFFFFFFFFFFFFULL
++#define FT_SIZEOF_LONG_LONG ( 64 / FT_CHAR_BIT )
++#else
++#define FT_SIZEOF_LONG_LONG 0
++#endif
++
++#endif /* !defined(FT_SIZEOF_LONG_LONG) */
++
++
+ /**************************************************************************
+ *
+ * @section:
+@@ -174,15 +186,17 @@
+ #endif
+
+
+- /* determine whether we have a 64-bit `int` type for platforms without */
+- /* Autoconf */
++ /* determine whether we have a 64-bit integer type */
+ #if FT_SIZEOF_LONG == ( 64 / FT_CHAR_BIT )
+
+- /* `FT_LONG64` must be defined if a 64-bit type is available */
+-#define FT_LONG64
+ #define FT_INT64 long
+ #define FT_UINT64 unsigned long
+
++#elif FT_SIZEOF_LONG_LONG >= ( 64 / FT_CHAR_BIT )
++
++#define FT_INT64 long long int
++#define FT_UINT64 unsigned long long int
++
+ /**************************************************************************
+ *
+ * A 64-bit data type may create compilation problems if you compile in
+@@ -192,16 +206,9 @@
+ */
+ #elif !defined( __STDC__ ) || defined( FT_CONFIG_OPTION_FORCE_INT64 )
+
+-#if defined( __STDC_VERSION__ ) && __STDC_VERSION__ >= 199901L
+-
+-#define FT_LONG64
+-#define FT_INT64 long long int
+-#define FT_UINT64 unsigned long long int
+-
+-#elif defined( _MSC_VER ) && _MSC_VER >= 900 /* Visual C++ (and Intel C++) */
++#if defined( _MSC_VER ) && _MSC_VER >= 900 /* Visual C++ (and Intel C++) */
+
+ /* this compiler provides the `__int64` type */
+-#define FT_LONG64
+ #define FT_INT64 __int64
+ #define FT_UINT64 unsigned __int64
+
+@@ -211,32 +218,30 @@
+ /* to test the compiler version. */
+
+ /* this compiler provides the `__int64` type */
+-#define FT_LONG64
+ #define FT_INT64 __int64
+ #define FT_UINT64 unsigned __int64
+
+-#elif defined( __WATCOMC__ ) /* Watcom C++ */
++#elif defined( __WATCOMC__ ) && __WATCOMC__ >= 1100 /* Watcom C++ */
+
+- /* Watcom doesn't provide 64-bit data types */
++#define FT_INT64 long long int
++#define FT_UINT64 unsigned long long int
+
+ #elif defined( __MWERKS__ ) /* Metrowerks CodeWarrior */
+
+-#define FT_LONG64
+ #define FT_INT64 long long int
+ #define FT_UINT64 unsigned long long int
+
+ #elif defined( __GNUC__ )
+
+ /* GCC provides the `long long` type */
+-#define FT_LONG64
+ #define FT_INT64 long long int
+ #define FT_UINT64 unsigned long long int
+
+-#endif /* __STDC_VERSION__ >= 199901L */
++#endif /* !__STDC__ */
+
+ #endif /* FT_SIZEOF_LONG == (64 / FT_CHAR_BIT) */
+
+-#ifdef FT_LONG64
++#ifdef FT_INT64
+ typedef FT_INT64 FT_Int64;
+ typedef FT_UINT64 FT_UInt64;
+ #endif
+diff --git a/src/3rdparty/freetype/include/freetype/config/mac-support.h b/src/3rdparty/freetype/include/freetype/config/mac-support.h
+index 94867088e9..e42c9fe410 100644
+--- a/src/3rdparty/freetype/include/freetype/config/mac-support.h
++++ b/src/3rdparty/freetype/include/freetype/config/mac-support.h
+@@ -4,7 +4,7 @@
+ *
+ * Mac/OS X support configuration header.
+ *
+- * Copyright (C) 1996-2020 by
++ * Copyright (C) 1996-2022 by
+ * David Turner, Robert Wilhelm, and Werner Lemberg.
+ *
+ * This file is part of the FreeType project, and may only be used,
+diff --git a/src/3rdparty/freetype/include/freetype/config/public-macros.h b/src/3rdparty/freetype/include/freetype/config/public-macros.h
+index 6aa673e807..0074134f1d 100644
+--- a/src/3rdparty/freetype/include/freetype/config/public-macros.h
++++ b/src/3rdparty/freetype/include/freetype/config/public-macros.h
+@@ -4,7 +4,7 @@
+ *
+ * Define a set of compiler macros used in public FreeType headers.
+ *
+- * Copyright (C) 2020 by
++ * Copyright (C) 2020-2022 by
+ * David Turner, Robert Wilhelm, and Werner Lemberg.
+ *
+ * This file is part of the FreeType project, and may only be used,
+@@ -103,6 +103,7 @@ FT_BEGIN_HEADER
+ */
+ #define FT_EXPORT( x ) FT_PUBLIC_FUNCTION_ATTRIBUTE extern x
+
++
+ /*
+ * `FT_UNUSED` indicates that a given parameter is not used -- this is
+ * only used to get rid of unpleasant compiler warnings.
+@@ -115,6 +116,23 @@ FT_BEGIN_HEADER
+ #endif
+
+
++ /*
++ * Support for casts in both C and C++.
++ */
++#ifdef __cplusplus
++#define FT_STATIC_CAST( type, var ) static_cast(var)
++#define FT_REINTERPRET_CAST( type, var ) reinterpret_cast(var)
++
++#define FT_STATIC_BYTE_CAST( type, var ) \
++ static_cast( static_cast( var ) )
++#else
++#define FT_STATIC_CAST( type, var ) (type)(var)
++#define FT_REINTERPRET_CAST( type, var ) (type)(var)
++
++#define FT_STATIC_BYTE_CAST( type, var ) (type)(unsigned char)(var)
++#endif
++
++
+ FT_END_HEADER
+
+ #endif /* FREETYPE_CONFIG_PUBLIC_MACROS_H_ */
+diff --git a/src/3rdparty/freetype/include/freetype/freetype.h b/src/3rdparty/freetype/include/freetype/freetype.h
+index be191f5aa0..aa1a4fe389 100644
+--- a/src/3rdparty/freetype/include/freetype/freetype.h
++++ b/src/3rdparty/freetype/include/freetype/freetype.h
+@@ -4,7 +4,7 @@
+ *
+ * FreeType high-level API and common types (specification only).
+ *
+- * Copyright (C) 1996-2020 by
++ * Copyright (C) 1996-2022 by
+ * David Turner, Robert Wilhelm, and Werner Lemberg.
+ *
+ * This file is part of the FreeType project, and may only be used,
+@@ -30,6 +30,34 @@ FT_BEGIN_HEADER
+
+
+
++ /**************************************************************************
++ *
++ * @section:
++ * preamble
++ *
++ * @title:
++ * Preamble
++ *
++ * @abstract:
++ * What FreeType is and isn't
++ *
++ * @description:
++ * FreeType is a library that provides access to glyphs in font files. It
++ * scales the glyph images and their metrics to a requested size, and it
++ * rasterizes the glyph images to produce pixel or subpixel alpha coverage
++ * bitmaps.
++ *
++ * Note that FreeType is _not_ a text layout engine. You have to use
++ * higher-level libraries like HarfBuzz, Pango, or ICU for that.
++ *
++ * Note also that FreeType does _not_ perform alpha blending or
++ * compositing the resulting bitmaps or pixmaps by itself. Use your
++ * favourite graphics library (for example, Cairo or Skia) to further
++ * process FreeType's output.
++ *
++ */
++
++
+ /**************************************************************************
+ *
+ * @section:
+@@ -125,6 +153,9 @@ FT_BEGIN_HEADER
+ * FT_FACE_FLAG_GLYPH_NAMES
+ * FT_FACE_FLAG_EXTERNAL_STREAM
+ * FT_FACE_FLAG_HINTER
++ * FT_FACE_FLAG_SVG
++ * FT_FACE_FLAG_SBIX
++ * FT_FACE_FLAG_SBIX_OVERLAY
+ *
+ * FT_HAS_HORIZONTAL
+ * FT_HAS_VERTICAL
+@@ -133,6 +164,9 @@ FT_BEGIN_HEADER
+ * FT_HAS_GLYPH_NAMES
+ * FT_HAS_COLOR
+ * FT_HAS_MULTIPLE_MASTERS
++ * FT_HAS_SVG
++ * FT_HAS_SBIX
++ * FT_HAS_SBIX_OVERLAY
+ *
+ * FT_IS_SFNT
+ * FT_IS_SCALABLE
+@@ -176,6 +210,7 @@ FT_BEGIN_HEADER
+ * FT_Size_RequestRec
+ * FT_Size_Request
+ * FT_Set_Transform
++ * FT_Get_Transform
+ * FT_Load_Glyph
+ * FT_Get_Char_Index
+ * FT_Get_First_Char
+@@ -196,6 +231,7 @@ FT_BEGIN_HEADER
+ * FT_LOAD_NO_SCALE
+ * FT_LOAD_NO_HINTING
+ * FT_LOAD_NO_BITMAP
++ * FT_LOAD_SBITS_ONLY
+ * FT_LOAD_NO_AUTOHINT
+ * FT_LOAD_COLOR
+ *
+@@ -493,13 +529,15 @@ FT_BEGIN_HEADER
+ * size.
+ *
+ * @note:
+- * An @FT_Face has one _active_ @FT_Size object that is used by functions
+- * like @FT_Load_Glyph to determine the scaling transformation that in
+- * turn is used to load and hint glyphs and metrics.
++ * An @FT_Face has one _active_ `FT_Size` object that is used by
++ * functions like @FT_Load_Glyph to determine the scaling transformation
++ * that in turn is used to load and hint glyphs and metrics.
+ *
+- * You can use @FT_Set_Char_Size, @FT_Set_Pixel_Sizes, @FT_Request_Size
++ * A newly created `FT_Size` object contains only meaningless zero values.
++ * You must use @FT_Set_Char_Size, @FT_Set_Pixel_Sizes, @FT_Request_Size
+ * or even @FT_Select_Size to change the content (i.e., the scaling
+- * values) of the active @FT_Size.
++ * values) of the active `FT_Size`. Otherwise, the scaling and hinting
++ * will not be performed.
+ *
+ * You can use @FT_New_Size to create additional size objects for a given
+ * @FT_Face, but they won't be used by other functions until you activate
+@@ -587,11 +625,12 @@ FT_BEGIN_HEADER
+ */
+
+ #ifndef FT_ENC_TAG
+-#define FT_ENC_TAG( value, a, b, c, d ) \
+- value = ( ( (FT_UInt32)(a) << 24 ) | \
+- ( (FT_UInt32)(b) << 16 ) | \
+- ( (FT_UInt32)(c) << 8 ) | \
+- (FT_UInt32)(d) )
++
++#define FT_ENC_TAG( value, a, b, c, d ) \
++ value = ( ( FT_STATIC_BYTE_CAST( FT_UInt32, a ) << 24 ) | \
++ ( FT_STATIC_BYTE_CAST( FT_UInt32, b ) << 16 ) | \
++ ( FT_STATIC_BYTE_CAST( FT_UInt32, c ) << 8 ) | \
++ FT_STATIC_BYTE_CAST( FT_UInt32, d ) )
+
+ #endif /* FT_ENC_TAG */
+
+@@ -701,11 +740,16 @@ FT_BEGIN_HEADER
+ * Same as FT_ENCODING_JOHAB. Deprecated.
+ *
+ * @note:
+- * By default, FreeType enables a Unicode charmap and tags it with
+- * `FT_ENCODING_UNICODE` when it is either provided or can be generated
+- * from PostScript glyph name dictionaries in the font file. All other
+- * encodings are considered legacy and tagged only if explicitly defined
+- * in the font file. Otherwise, `FT_ENCODING_NONE` is used.
++ * When loading a font, FreeType makes a Unicode charmap active if
++ * possible (either if the font provides such a charmap, or if FreeType
++ * can synthesize one from PostScript glyph name dictionaries; in either
++ * case, the charmap is tagged with `FT_ENCODING_UNICODE`). If such a
++ * charmap is synthesized, it is placed at the first position of the
++ * charmap array.
++ *
++ * All other encodings are considered legacy and tagged only if
++ * explicitly defined in the font file. Otherwise, `FT_ENCODING_NONE` is
++ * used.
+ *
+ * `FT_ENCODING_NONE` is set by the BDF and PCF drivers if the charmap is
+ * neither Unicode nor ISO-8859-1 (otherwise it is set to
+@@ -1193,6 +1237,19 @@ FT_BEGIN_HEADER
+ * altered with @FT_Set_MM_Design_Coordinates,
+ * @FT_Set_Var_Design_Coordinates, or @FT_Set_Var_Blend_Coordinates.
+ * This flag is unset by a call to @FT_Set_Named_Instance.
++ *
++ * FT_FACE_FLAG_SVG ::
++ * [Since 2.12] The face has an 'SVG~' OpenType table.
++ *
++ * FT_FACE_FLAG_SBIX ::
++ * [Since 2.12] The face has an 'sbix' OpenType table *and* outlines.
++ * For such fonts, @FT_FACE_FLAG_SCALABLE is not set by default to
++ * retain backward compatibility.
++ *
++ * FT_FACE_FLAG_SBIX_OVERLAY ::
++ * [Since 2.12] The face has an 'sbix' OpenType table where outlines
++ * should be drawn on top of bitmap strikes.
++ *
+ */
+ #define FT_FACE_FLAG_SCALABLE ( 1L << 0 )
+ #define FT_FACE_FLAG_FIXED_SIZES ( 1L << 1 )
+@@ -1210,6 +1267,9 @@ FT_BEGIN_HEADER
+ #define FT_FACE_FLAG_TRICKY ( 1L << 13 )
+ #define FT_FACE_FLAG_COLOR ( 1L << 14 )
+ #define FT_FACE_FLAG_VARIATION ( 1L << 15 )
++#define FT_FACE_FLAG_SVG ( 1L << 16 )
++#define FT_FACE_FLAG_SBIX ( 1L << 17 )
++#define FT_FACE_FLAG_SBIX_OVERLAY ( 1L << 18 )
+
+
+ /**************************************************************************
+@@ -1450,6 +1510,124 @@ FT_BEGIN_HEADER
+ ( !!( (face)->face_flags & FT_FACE_FLAG_COLOR ) )
+
+
++ /**************************************************************************
++ *
++ * @macro:
++ * FT_HAS_SVG
++ *
++ * @description:
++ * A macro that returns true whenever a face object contains an 'SVG~'
++ * OpenType table.
++ *
++ * @since:
++ * 2.12
++ */
++#define FT_HAS_SVG( face ) \
++ ( !!( (face)->face_flags & FT_FACE_FLAG_SVG ) )
++
++
++ /**************************************************************************
++ *
++ * @macro:
++ * FT_HAS_SBIX
++ *
++ * @description:
++ * A macro that returns true whenever a face object contains an 'sbix'
++ * OpenType table *and* outline glyphs.
++ *
++ * Currently, FreeType only supports bitmap glyphs in PNG format for this
++ * table (i.e., JPEG and TIFF formats are unsupported, as are
++ * Apple-specific formats not part of the OpenType specification).
++ *
++ * @note:
++ * For backward compatibility, a font with an 'sbix' table is treated as
++ * a bitmap-only face. Using @FT_Open_Face with
++ * @FT_PARAM_TAG_IGNORE_SBIX, an application can switch off 'sbix'
++ * handling so that the face is treated as an ordinary outline font with
++ * scalable outlines.
++ *
++ * Here is some pseudo code that roughly illustrates how to implement
++ * 'sbix' handling according to the OpenType specification.
++ *
++ * ```
++ * if ( FT_HAS_SBIX( face ) )
++ * {
++ * // open font as a scalable one without sbix handling
++ * FT_Face face2;
++ * FT_Parameter param = { FT_PARAM_TAG_IGNORE_SBIX, NULL };
++ * FT_Open_Args args = { FT_OPEN_PARAMS | ...,
++ * ...,
++ * 1, ¶m };
++ *
++ *
++ * FT_Open_Face( library, &args, 0, &face2 );
++ *
++ * available_size` as necessary into
++ * `preferred_sizes`[*]>
++ *
++ * for ( i = 0; i < face->num_fixed_sizes; i++ )
++ * {
++ * size = preferred_sizes[i].size;
++ *
++ * error = FT_Set_Pixel_Sizes( face, size, size );
++ *
++ *
++ * // check whether we have a glyph in a bitmap strike
++ * error = FT_Load_Glyph( face,
++ * glyph_index,
++ * FT_LOAD_SBITS_ONLY |
++ * FT_LOAD_BITMAP_METRICS_ONLY );
++ * if ( error == FT_Err_Invalid_Argument )
++ * continue;
++ * else if ( error )
++ *
++ * else
++ * break;
++ * }
++ *
++ * if ( i != face->num_fixed_sizes )
++ *
++ *
++ * if ( i == face->num_fixed_sizes ||
++ * FT_HAS_SBIX_OVERLAY( face ) )
++ *