Resolves: RHEL-78531

Fix emoji rendering issue
Resolves: RHEL-76300
This commit is contained in:
Jan Grulich 2025-05-14 12:28:40 +02:00
parent c09d648656
commit da0fdcc89a
13 changed files with 79 additions and 26123 deletions

2
.gitignore vendored
View File

@ -28,3 +28,5 @@
/qtbase-everywhere-src-6.7.0.tar.xz
/qtbase-everywhere-src-6.7.1.tar.xz
/qtbase-everywhere-src-6.8.1.tar.xz
/qtbase-everywhere-src-6.9.0.tar.xz
/qtbase-everywhere-src-6.9.1.tar.xz

View File

@ -46,8 +46,8 @@ BuildRequires: pkgconfig(libsystemd)
Name: qt6-qtbase
Summary: Qt6 - QtBase components
Version: 6.8.1
Release: 8%{?dist}
Version: 6.9.1
Release: 1%{?dist}
License: LGPL-3.0-only OR GPL-3.0-only WITH Qt-GPL-exception-1.0
Url: http://qt-project.org/
@ -97,18 +97,6 @@ Patch56: qtbase-mysql.patch
Patch58: qtbase-libglvnd.patch
## upstream patches
Patch150: qtbase-extract-emoji-data-from-unicode-files.patch
Patch151: qtbase-introduce-emoji-segmenter-to-3rdparty-code.patch
Patch152: qtbase-use-emoji-segmenter-to-apply-emoji-fonts-automatically.patch
Patch153: qtbase-dont-support-subpixel-positioning-for-color-fonts.patch
Patch154: qtbase-fix-regression-when-looking-up-fallback-fonts.patch
Patch155: qtbase-skip-ad-hoc-handling-of-variation-selector-in-font-merging.patch
Patch156: qtbase-fontconfig-dont-register-hardcoded-fonts-as-color-fonts.patch
Patch157: qtbase-request-actual-font-family-request-in-final-color-font-fail-safe.patch
Patch158: qtbase-fontconfig-fix-detection-of-color-fonts.patch
## RHEL specific patches
# Patch300: qtbase-fix-tests.patch
# Do not check any files in %%{_qt6_plugindir}/platformthemes/ for requires.
# Those themes are there for platform integration. If the required libraries are
@ -134,12 +122,12 @@ BuildRequires: double-conversion-devel
%else
Provides: bundled(double-conversion)
%endif
Provides: bundled(emoji-segmenter)
%if 0%{?fedora} || 0%{?epel}
BuildRequires: libb2-devel
%else
Provides: bundled(libb2)
%endif
Provides: bundled(emoji-segmenter)
BuildRequires: libjpeg-devel
BuildRequires: libmng-devel
BuildRequires: libtiff-devel
@ -379,35 +367,35 @@ export LDFLAGS="$LDFLAGS $RPM_LD_FLAGS"
export MAKEFLAGS="%{?_smp_mflags}"
%cmake_qt6 \
-DQT_FEATURE_accessibility=ON \
-DQT_FEATURE_fontconfig=ON \
-DQT_FEATURE_glib=ON \
-DQT_FEATURE_sse2=%{?no_sse2:OFF}%{!?no_sse2:ON} \
-DQT_FEATURE_icu=ON \
-DQT_FEATURE_enable_new_dtags=ON \
-DQT_FEATURE_emojisegmenter=ON \
-DQT_FEATURE_journald=%{?journald:ON}%{!?journald:OFF} \
-DQT_FEATURE_openssl_linked=ON \
-DQT_FEATURE_openssl_hash=ON \
-DQT_FEATURE_libproxy=ON \
-DQT_FEATURE_sctp=ON \
-DQT_FEATURE_separate_debug_info=OFF \
-DQT_FEATURE_reduce_relocations=OFF \
-DQT_FEATURE_relocatable=OFF \
-DQT_FEATURE_system_jpeg=ON \
-DQT_FEATURE_system_png=ON \
-DQT_FEATURE_system_zlib=ON \
%{?ibase:-DQT_FEATURE_sql_ibase=ON} \
-DQT_FEATURE_sql_odbc=ON \
-DQT_FEATURE_sql_mysql=ON \
-DQT_FEATURE_sql_psql=ON \
-DQT_FEATURE_sql_sqlite=ON \
-DQT_FEATURE_rpath=OFF \
-DQT_FEATURE_zstd=ON \
-DQT_FEATURE_elf_private_full_version=ON \
%{?dbus_linked:-DQT_FEATURE_dbus_linked=ON} \
%{?pcre:-DQT_FEATURE_system_pcre2=ON} \
%{?sqlite:-DQT_FEATURE_system_sqlite=ON} \
-DFEATURE_accessibility=ON \
-DFEATURE_fontconfig=ON \
-DFEATURE_glib=ON \
-DFEATURE_sse2=%{?no_sse2:OFF}%{!?no_sse2:ON} \
-DFEATURE_icu=ON \
-DFEATURE_enable_new_dtags=ON \
-DFEATURE_emojisegmenter=ON \
-DFEATURE_journald=%{?journald:ON}%{!?journald:OFF} \
-DFEATURE_openssl_linked=ON \
-DFEATURE_openssl_hash=ON \
-DFEATURE_libproxy=ON \
-DFEATURE_sctp=ON \
-DFEATURE_separate_debug_info=OFF \
-DFEATURE_reduce_relocations=OFF \
-DFEATURE_relocatable=OFF \
-DFEATURE_system_jpeg=ON \
-DFEATURE_system_png=ON \
-DFEATURE_system_zlib=ON \
%{?ibase:-DFEATURE_sql_ibase=ON} \
-DFEATURE_sql_odbc=ON \
-DFEATURE_sql_mysql=ON \
-DFEATURE_sql_psql=ON \
-DFEATURE_sql_sqlite=ON \
-DFEATURE_rpath=OFF \
-DFEATURE_zstd=ON \
-DFEATURE_elf_private_full_version=ON \
%{?dbus_linked:-DFEATURE_dbus_linked=ON} \
%{?pcre:-DFEATURE_system_pcre2=ON} \
%{?sqlite:-DFEATURE_system_sqlite=ON} \
-DBUILD_SHARED_LIBS=ON \
-DQT_BUILD_EXAMPLES=%{?examples:ON}%{!?examples:OFF} \
-DQT_INSTALL_EXAMPLES_SOURCES=%{?examples:ON}%{!?examples:OFF} \
@ -454,7 +442,7 @@ translationdir=%{_qt6_translationdir}
Name: Qt6
Description: Qt6 Configuration
Version: 6.8.1
Version: 6.9.1
EOF
# rpm macros
@ -527,9 +515,16 @@ rm %{buildroot}%{_qt6_descriptionsdir}/ExamplesAssetDownloaderPrivate.json
rm %{buildroot}%{_qt6_libdir}/libQt6ExamplesAssetDownloader.*
rm %{buildroot}%{_qt6_libdir}/qt6/metatypes/qt6examplesassetdownloaderprivate_*_metatypes.json
# These shouldn't be probably installed
rm -r %{buildroot}%{_qt6_libdir}/cmake/Qt6/3rdparty/extra-cmake-modules/*.patch
# This is only for Apple platforms and has a python2 dep
rm -r %{buildroot}%{_qt6_mkspecsdir}/features/uikit
# Remove tests with space in its name, which seem to break debuginfo extraction
rm -r %{buildroot}%{_qt6_archdatadir}/tests/corelib/io/qprocess/testProcessSpacesArgs/*
rm -r "%{buildroot}%{_qt6_archdatadir}/tests/corelib/io/qprocess/test Space In Name/testSpaceInName"
%check
# verify Qt6.pc
export PKG_CONFIG_PATH=%{buildroot}%{_libdir}/pkgconfig
@ -696,6 +691,7 @@ make check -k ||:
%{_qt6_libdir}/libQt6Xml.so
%{_qt6_libdir}/cmake/Qt6/3rdparty/extra-cmake-modules/REUSE.toml
%{_qt6_libdir}/cmake/Qt6/3rdparty/kwin/REUSE.toml
%{_qt6_libdir}/cmake/Qt6/*.in
%{_qt6_libdir}/cmake/Qt6/*.h.in
%{_qt6_libdir}/cmake/Qt6/*.cmake
%{_qt6_libdir}/cmake/Qt6/*.cmake.in
@ -773,10 +769,38 @@ make check -k ||:
%{_qt6_headerdir}/QtEglFSDeviceIntegration
%{_qt6_headerdir}/QtEglFsKmsGbmSupport
%{_qt6_headerdir}/QtEglFsKmsSupport
%dir %{_qt6_libdir}/cmake/Qt6ConcurrentPrivate
%dir %{_qt6_libdir}/cmake/Qt6CorePrivate
%dir %{_qt6_libdir}/cmake/Qt6DBusPrivate
%dir %{_qt6_libdir}/cmake/Qt6GuiPrivate
%dir %{_qt6_libdir}/cmake/Qt6NetworkPrivate
%dir %{_qt6_libdir}/cmake/Qt6OpenGLPrivate
%dir %{_qt6_libdir}/cmake/Qt6OpenGLWidgetsPrivate
%dir %{_qt6_libdir}/cmake/Qt6PrintSupportPrivate
%dir %{_qt6_libdir}/cmake/Qt6SqlPrivate
%dir %{_qt6_libdir}/cmake/Qt6TestInternalsPrivate
%dir %{_qt6_libdir}/cmake/Qt6TestInternalsPrivate/3rdparty/cmake
%dir %{_qt6_libdir}/cmake/Qt6TestPrivate
%dir %{_qt6_libdir}/cmake/Qt6WidgetsPrivate
%dir %{_qt6_libdir}/cmake/Qt6XmlPrivate
%dir %{_qt6_libdir}/cmake/Qt6EglFSDeviceIntegrationPrivate
%dir %{_qt6_libdir}/cmake/Qt6EglFsKmsGbmSupportPrivate
%dir %{_qt6_libdir}/cmake/Qt6EglFsKmsSupportPrivate
%dir %{_qt6_libdir}/cmake/Qt6XcbQpaPrivate
%{_qt6_libdir}/cmake/Qt6ConcurrentPrivate/*.cmake
%{_qt6_libdir}/cmake/Qt6CorePrivate/*.cmake
%{_qt6_libdir}/cmake/Qt6DBusPrivate/*.cmake
%{_qt6_libdir}/cmake/Qt6GuiPrivate/*.cmake
%{_qt6_libdir}/cmake/Qt6NetworkPrivate/*.cmake
%{_qt6_libdir}/cmake/Qt6OpenGLPrivate/*.cmake
%{_qt6_libdir}/cmake/Qt6OpenGLWidgetsPrivate/*.cmake
%{_qt6_libdir}/cmake/Qt6PrintSupportPrivate/*.cmake
%{_qt6_libdir}/cmake/Qt6SqlPrivate/*.cmake
%{_qt6_libdir}/cmake/Qt6TestInternalsPrivate/*.cmake
%{_qt6_libdir}/cmake/Qt6TestInternalsPrivate/3rdparty/cmake/*.cmake
%{_qt6_libdir}/cmake/Qt6TestPrivate/*.cmake
%{_qt6_libdir}/cmake/Qt6WidgetsPrivate/*.cmake
%{_qt6_libdir}/cmake/Qt6XmlPrivate/*.cmake
%{_qt6_libdir}/cmake/Qt6EglFSDeviceIntegrationPrivate/*.cmake
%{_qt6_libdir}/cmake/Qt6EglFsKmsGbmSupportPrivate/*.cmake
%{_qt6_libdir}/cmake/Qt6EglFsKmsSupportPrivate/*.cmake
@ -798,6 +822,7 @@ make check -k ||:
%{_qt6_metatypesdir}/qt6eglfskmssupportprivate_*_metatypes.json
%{_qt6_metatypesdir}/qt6xcbqpaprivate_*_metatypes.json
%{_qt6_headerdir}/*/%{qt_version}/
%{_qt6_descriptionsdir}/TestInternalsPrivate.json
%files static
%dir %{_qt6_libdir}/cmake/Qt6ExampleIconsPrivate
@ -924,6 +949,12 @@ make check -k ||:
%endif
%changelog
* Wed May 14 2025 Jan Grulich <jgrulich@redhat.com> - 6.9.1-1
- 6.9.1
Resolves: RHEL-78531
- Fix emoji rendering issue
Resolves: RHEL-76300
* Thu Jan 16 2025 Jan Grulich <jgrulich@redhat.com> - 6.8.1-8
- Backport additional fixes for emoji support
Resolves: RHEL-4218

View File

@ -1,85 +0,0 @@
diff --git a/src/gui/text/unix/qfontconfigdatabase.cpp b/src/gui/text/unix/qfontconfigdatabase.cpp
index 474644b8..f61e6e83 100644
--- a/src/gui/text/unix/qfontconfigdatabase.cpp
+++ b/src/gui/text/unix/qfontconfigdatabase.cpp
@@ -592,6 +592,7 @@ void QFontconfigDatabase::populateFontDatabase()
++f;
}
+ cacheEmojiFontFamily();
//QPA has very lazy population of the font db. We want it to be initialized when
//QApplication is constructed, so that the population procedure can do something like this to
//set the default font
@@ -735,6 +736,9 @@ QStringList QFontconfigDatabase::fallbacksForFamily(const QString &family, QFont
if (!pattern)
return fallbackFamilies;
+ if (!m_cacheEmojiFontFamily.isEmpty())
+ fallbackFamilies << m_cacheEmojiFontFamily;
+
FcValue value;
value.type = FcTypeString;
const QByteArray cs = family.toUtf8();
@@ -1016,4 +1020,47 @@ void QFontconfigDatabase::setupFontEngine(QFontEngineFT *engine, const QFontDef
engine->glyphFormat = format;
}
+void QFontconfigDatabase::cacheEmojiFontFamily()
+{
+ FcPattern *pattern;
+ pattern = FcPatternCreate();
+
+ FcValue value;
+ value.type = FcTypeString;
+ value.u.s = (const FcChar8 *)"emoji";
+ FcPatternAdd(pattern,FC_FAMILY,value,true);
+
+ FcLangSet *ls = FcLangSetCreate();
+ FcLangSetAdd(ls, (const FcChar8*)"und-zsye");
+ FcPatternAddLangSet(pattern, FC_LANG, ls);
+
+ FcConfigSubstitute(nullptr, pattern, FcMatchPattern);
+ FcDefaultSubstitute(pattern);
+
+ FcResult result = FcResultMatch;
+ FcFontSet *fontSet = FcFontSort(nullptr,pattern,FcTrue,nullptr,&result);
+ FcPatternDestroy(pattern);
+
+ if (fontSet) {
+ for (int i = 0; i < fontSet->nfont; i++) {
+ FcChar8 *value = nullptr;
+ if (FcPatternGetString(fontSet->fonts[i], FC_FAMILY, 0, &value) != FcResultMatch)
+ continue;
+
+ FcLangSet *rls = nullptr;
+ if (FcPatternGetLangSet(fontSet->fonts[i], FC_LANG, 0, &rls) != FcResultMatch)
+ continue;
+
+ if (!FcLangSetContains(rls, ls))
+ continue;
+
+ m_cacheEmojiFontFamily = QString::fromUtf8((const char *)value);
+ break;
+ }
+ FcFontSetDestroy(fontSet);
+ }
+
+ FcLangSetDestroy(ls);
+}
+
QT_END_NAMESPACE
diff --git a/src/gui/text/unix/qfontconfigdatabase_p.h b/src/gui/text/unix/qfontconfigdatabase_p.h
index cf15306e..90b94087 100644
--- a/src/gui/text/unix/qfontconfigdatabase_p.h
+++ b/src/gui/text/unix/qfontconfigdatabase_p.h
@@ -37,7 +37,10 @@ public:
QFont defaultFont() const override;
private:
+ void cacheEmojiFontFamily();
void setupFontEngine(QFontEngineFT *engine, const QFontDef &fontDef) const;
+
+ QString m_cacheEmojiFontFamily;
};
QT_END_NAMESPACE

View File

@ -1,55 +0,0 @@
From fd9c9788f73cb088229701dd92443aa04005a4a3 Mon Sep 17 00:00:00 2001
From: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Date: Tue, 26 Nov 2024 10:47:30 +0100
Subject: Don't support subpixel positioning for color fonts
This comes at a price and it does not really make sense for
emojis.
Pick-to: 6.8
Change-Id: I57148bff48a48bb81a03203626df25646c9acb6a
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
diff --git a/src/gui/text/coretext/qfontengine_coretext_p.h b/src/gui/text/coretext/qfontengine_coretext_p.h
index 1b8a7e0d2a..726abd61d5 100644
--- a/src/gui/text/coretext/qfontengine_coretext_p.h
+++ b/src/gui/text/coretext/qfontengine_coretext_p.h
@@ -54,7 +54,7 @@ public:
bool canRender(const QChar *string, int len) const override;
int synthesized() const override { return synthesisFlags; }
- bool supportsHorizontalSubPixelPositions() const override { return true; }
+ bool supportsHorizontalSubPixelPositions() const override { return !isColorFont(); }
bool supportsVerticalSubPixelPositions() const override { return false; }
QFixed lineThickness() const override;
diff --git a/src/gui/text/freetype/qfontengine_ft_p.h b/src/gui/text/freetype/qfontengine_ft_p.h
index d2fa82b81d..924131699a 100644
--- a/src/gui/text/freetype/qfontengine_ft_p.h
+++ b/src/gui/text/freetype/qfontengine_ft_p.h
@@ -158,8 +158,9 @@ private:
QFixed emSquareSize() const override;
bool supportsHorizontalSubPixelPositions() const override
{
- return default_hint_style == HintLight ||
- default_hint_style == HintNone;
+ return !isColorFont()
+ && (default_hint_style == HintLight ||
+ default_hint_style == HintNone);
}
bool supportsVerticalSubPixelPositions() const override
diff --git a/src/gui/text/windows/qwindowsfontenginedirectwrite.cpp b/src/gui/text/windows/qwindowsfontenginedirectwrite.cpp
index 3ab6fe723d..049a3e5885 100644
--- a/src/gui/text/windows/qwindowsfontenginedirectwrite.cpp
+++ b/src/gui/text/windows/qwindowsfontenginedirectwrite.cpp
@@ -749,7 +749,8 @@ QImage QWindowsFontEngineDirectWrite::alphaMapForGlyph(glyph_t glyph,
bool QWindowsFontEngineDirectWrite::supportsHorizontalSubPixelPositions() const
{
DWRITE_RENDERING_MODE renderMode = hintingPreferenceToRenderingMode(fontDef);
- return (renderMode != DWRITE_RENDERING_MODE_GDI_CLASSIC
+ return (!isColorFont()
+ && renderMode != DWRITE_RENDERING_MODE_GDI_CLASSIC
&& renderMode != DWRITE_RENDERING_MODE_GDI_NATURAL
&& renderMode != DWRITE_RENDERING_MODE_ALIASED);
}

File diff suppressed because it is too large Load Diff

View File

@ -1,96 +0,0 @@
From 486bbc7a5bc4483ecc2a6b8927543725e3d38722 Mon Sep 17 00:00:00 2001
From: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Date: Tue, 26 Nov 2024 14:39:44 +0100
Subject: Fix regression when looking up fallback fonts
This amends 16850709306589a2433c0038605d365a6b6bedad.
In that change, the final pass for looking up fallback
fonts was turned into a lambda so that we could run it
an additional time at the very end. However, when making
a lambda from the code, some of the logic was accidentally
changed.
Specifically, for multi engines the original code would pass
Script_Common instead of the requested script to the match()
function, but it would still pass the actual script to
loadEngine() as well as store it in the key. In the changed
code, Script_Common would be used for all of these when multi
was true.
This change was not intentional and it caused us to fail to
load certain fallback fonts, for instance the Bengali font
on Windows.
Fixes: QTBUG-131632
Change-Id: Id215ee4dc2851e846be27a3a25a31cad57b8f67d
Reviewed-by: Lars Knoll <lars@knoll.priv.no>
diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp
index 96c2337e..0c2a4b66 100644
--- a/src/gui/text/qfontdatabase.cpp
+++ b/src/gui/text/qfontdatabase.cpp
@@ -2734,17 +2734,23 @@ QFontEngine *QFontDatabasePrivate::findFont(const QFontDef &req,
if (script > QChar::Script_Common)
fallbacks += QString(); // Find the first font matching the specified script.
- auto findMatchingFallback = [&](int xscript) {
+ auto findMatchingFallback = [&fallbacks,
+ &index,
+ &multi,
+ &fontCache,
+ &blackListed,
+ &request](int lookupScript, int cacheScript) {
+ QFontEngine *engine = nullptr;
for (int i = 0; !engine && i < fallbacks.size(); i++) {
QFontDef def = request;
def.families = QStringList(fallbacks.at(i));
- QFontCache::Key key(def, xscript, multi ? 1 : 0);
+ QFontCache::Key key(def, cacheScript, multi ? 1 : 0);
engine = fontCache->findEngine(key);
if (!engine) {
QtFontDesc desc;
do {
- index = match(xscript,
+ index = match(lookupScript,
def,
def.families.constFirst(),
""_L1,
@@ -2755,7 +2761,12 @@ QFontEngine *QFontDatabasePrivate::findFont(const QFontDef &req,
QFontDef loadDef = def;
if (loadDef.families.isEmpty())
loadDef.families = QStringList(desc.family->name);
- engine = loadEngine(xscript, loadDef, desc.family, desc.foundry, desc.style, desc.size);
+ engine = loadEngine(cacheScript,
+ loadDef,
+ desc.family,
+ desc.foundry,
+ desc.style,
+ desc.size);
if (engine)
initFontDef(desc, loadDef, &engine->fontDef, multi);
else
@@ -2764,15 +2775,20 @@ QFontEngine *QFontDatabasePrivate::findFont(const QFontDef &req,
} while (index >= 0 && !engine);
}
}
+
+ return engine;
};
- findMatchingFallback(multi && script != QFontDatabasePrivate::Script_Emoji ? QChar::Script_Common: script);
+ engine = findMatchingFallback(multi && script != QFontDatabasePrivate::Script_Emoji
+ ? QChar::Script_Common
+ : script,
+ script);
// If we are looking for a color font and there are no color fonts on the system,
// we will end up here, for one final pass. This is a rare occurrence so we accept
// and extra pass on the fallbacks for this.
if (!engine && script == QFontDatabasePrivate::Script_Emoji)
- findMatchingFallback(QChar::Script_Common);
+ engine = findMatchingFallback(QChar::Script_Common, script);
}
if (!engine)

View File

@ -1,34 +0,0 @@
From 83864f8682da73a062a3ca32b928377dfc333021 Mon Sep 17 00:00:00 2001
From: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Date: Wed, 15 Jan 2025 14:52:55 +0100
Subject: [PATCH] FontConfig: Don't register hardcoded fonts as color fonts
This amends 16850709306589a2433c0038605d365a6b6bedad. The patch
aimed to pass false for the color font parameter, but got it in
the wrong position, so it passed false for the pixel size instead.
The registerFont() function is a real mess, and it should be cleaned
up, but this at least fixes the immediate bug.
Pick-to: 6.9
Task-number: QTBUG-132821
Change-Id: Id54989960aa5f86d3c79423d004530bb6a4fa475
---
diff --git a/src/gui/text/unix/qfontconfigdatabase.cpp b/src/gui/text/unix/qfontconfigdatabase.cpp
index 7866e341..790316a6 100644
--- a/src/gui/text/unix/qfontconfigdatabase.cpp
+++ b/src/gui/text/unix/qfontconfigdatabase.cpp
@@ -622,9 +622,9 @@ void QFontconfigDatabase::populateFontDatabase()
while (f->qtname) {
QString familyQtName = QString::fromLatin1(f->qtname);
- registerFont(familyQtName,QString(),QString(),QFont::Normal,QFont::StyleNormal,QFont::Unstretched,true,true,false,0,f->fixed,ws,nullptr);
- registerFont(familyQtName,QString(),QString(),QFont::Normal,QFont::StyleItalic,QFont::Unstretched,true,true,false,0,f->fixed,ws,nullptr);
- registerFont(familyQtName,QString(),QString(),QFont::Normal,QFont::StyleOblique,QFont::Unstretched,true,true,false,0,f->fixed,ws,nullptr);
+ registerFont(familyQtName,QString(),QString(),QFont::Normal,QFont::StyleNormal,QFont::Unstretched,true,true,0,f->fixed,false,ws,nullptr);
+ registerFont(familyQtName,QString(),QString(),QFont::Normal,QFont::StyleItalic,QFont::Unstretched,true,true,0,f->fixed,false,ws,nullptr);
+ registerFont(familyQtName,QString(),QString(),QFont::Normal,QFont::StyleOblique,QFont::Unstretched,true,true,0,f->fixed,false,ws,nullptr);
++f;
}

View File

@ -1,43 +0,0 @@
From 2c309f71705449607592bb4588bcc56223da897b Mon Sep 17 00:00:00 2001
From: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Date: Wed, 15 Jan 2025 15:39:16 +0100
Subject: [PATCH] FontConfig: Fix detection of color fonts
There were two mistakes in the code that intended to detect
if a specific font was a color font in the FontConfig database.
1. The "int n" parameter in FcPatternGet*() is not an array size,
but an index, so it should be 0 and not 1.
2. We need to add FC_COLOR to the list of properties in our pattern
when populating the database, otherwise we will just fail to match
it and none of the system fonts will be listed as color.
Pick-to: 6.9
Fixes: QTBUG-132377
Change-Id: Ib3c112e8a354abacd05679c62283a1f1abfb40ee
---
diff --git a/src/gui/text/unix/qfontconfigdatabase.cpp b/src/gui/text/unix/qfontconfigdatabase.cpp
index de6618f..20794ed 100644
--- a/src/gui/text/unix/qfontconfigdatabase.cpp
+++ b/src/gui/text/unix/qfontconfigdatabase.cpp
@@ -478,7 +478,7 @@
FcBool colorFont = false;
#ifdef FC_COLOR
- FcPatternGetBool(pattern, FC_COLOR, 1, &colorFont);
+ FcPatternGetBool(pattern, FC_COLOR, 0, &colorFont);
#endif
// Note: stretch should really be an int but registerFont incorrectly uses an enum
@@ -577,6 +577,9 @@
#if FC_VERSION >= 20297
FC_CAPABILITY,
#endif
+#if defined(FC_COLOR)
+ FC_COLOR,
+#endif
(const char *)nullptr
};
const char **p = properties;

View File

@ -1,568 +0,0 @@
From aa7d479be0df3e118580e87f30e061445dfb37e3 Mon Sep 17 00:00:00 2001
From: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Date: Fri, 2 Feb 2024 15:45:20 +0100
Subject: Introduce emoji-segmenter to 3rdparty code
This is a parser for emoji sequences developed by Google
which is used in multiple other projects for parsing
sequences of characters to see if they should be represented
as color emojis or as monochrome text.
[ChangeLog][Third-Party Code] Added the emoji-segmenter to
third party code, for supporting complex emoji sequences.
This can be configured using the -emojisegmenter option.
Task-number: QTBUG-111801
Change-Id: I7f87b0751415024d29f074d133850027f0003e29
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
diff --git a/config_help.txt b/config_help.txt
index deb38c9c2f..09aebf2e65 100644
--- a/config_help.txt
+++ b/config_help.txt
@@ -298,6 +298,7 @@ Gui, printing, widget options:
-cups ................ Enable CUPS support [auto] (Unix only)
+ -emojisegmenter ...... Enable complex emoji sequences [yes]
-fontconfig .......... Enable Fontconfig support [auto] (Unix only)
-freetype ............ Select used FreeType [system/qt/no]
-harfbuzz ............ Select used HarfBuzz-NG [system/qt/no]
diff --git a/src/3rdparty/emoji-segmenter/CONTRIBUTING.md b/src/3rdparty/emoji-segmenter/CONTRIBUTING.md
new file mode 100644
index 0000000000..db177d4ac7
--- /dev/null
+++ b/src/3rdparty/emoji-segmenter/CONTRIBUTING.md
@@ -0,0 +1,28 @@
+# How to Contribute
+
+We'd love to accept your patches and contributions to this project. There are
+just a few small guidelines you need to follow.
+
+## Contributor License Agreement
+
+Contributions to this project must be accompanied by a Contributor License
+Agreement. You (or your employer) retain the copyright to your contribution;
+this simply gives us permission to use and redistribute your contributions as
+part of the project. Head over to <https://cla.developers.google.com/> to see
+your current agreements on file or to sign a new one.
+
+You generally only need to submit a CLA once, so if you've already submitted one
+(even if it was for a different project), you probably don't need to do it
+again.
+
+## Code reviews
+
+All submissions, including submissions by project members, require review. We
+use GitHub pull requests for this purpose. Consult
+[GitHub Help](https://help.github.com/articles/about-pull-requests/) for more
+information on using pull requests.
+
+## Community Guidelines
+
+This project follows
+[Google's Open Source Community Guidelines](https://opensource.google.com/conduct/).
diff --git a/src/3rdparty/emoji-segmenter/NEWS b/src/3rdparty/emoji-segmenter/NEWS
new file mode 100644
index 0000000000..3fd07f1ce2
--- /dev/null
+++ b/src/3rdparty/emoji-segmenter/NEWS
@@ -0,0 +1,28 @@
+Overview of changes leading to 0.4.0
+Friday, November 15, 2024
+====================================
+
+* Add `make size` targe to
+ determine binary size.
+* Set has_vs for
+ emoji_keycap_sequence
+
+Overview of changes leading to 0.3.0
+Tuesday, September 5, 2024
+====================================
+
+* Add segmentation for variation
+ selector pairs, VS15 and VS16,
+ needed for font-variant-emoji.
+
+Overview of changes leading to 0.2.0
+Tuesday, Februar 20, 2024
+====================================
+
+* Change Ragel mode to -F1
+
+Overview of changes leading to 0.1.0
+Tuesday, January 29, 2019
+====================================
+
+* Initial release
diff --git a/src/3rdparty/emoji-segmenter/README.md b/src/3rdparty/emoji-segmenter/README.md
new file mode 100644
index 0000000000..571a1a4515
--- /dev/null
+++ b/src/3rdparty/emoji-segmenter/README.md
@@ -0,0 +1,103 @@
+Emoji Segmenter
+===
+
+This repository contains a Ragel grammar and generated C code for segmenting
+runs of text into text-presentation and emoji-presentation runs. It is currently
+used in projects such as Chromium and Pango for deciding which preferred
+presentation, color or text, a run of text should have.
+
+The goal is to stay very close to the grammar definitions in [Unicode Technical
+Standard #51](http://www.unicode.org/reports/tr51/).
+
+API
+===
+
+By including the `emoji_presentation_scanner.c` file, you will be able to call
+the following API
+
+```
+scan_emoji_presentation (emoji_text_iter_t p,
+ const emoji_text_iter_t pe,
+ bool* is_emoji,
+ bool* has_vs)
+```
+
+This API call will scan `emoji_text_iter_t p` for the next grammar-token and
+return an iterator that points to the end of the next token. An end iterator
+needs be specified as `pe` so that the scanner can compare against this and
+knows where to stop. In the reference parameter `is_emoji` it returns whether
+this token has emoji-presentation text-presentation, `has_vs` is set to true
+if the token contains a variation selector.
+
+A grammar token is either a combination of an emoji plus variation selector 15
+for text presentation, an emoji presentation sequence (emoji + VS16), an emoji
+presentation emoji or emoji sequence, or a single text presentation character.
+
+`emoji_text_iter_t` is an iterator type over a buffer of the character classes
+that are defined at the beginning of the the Ragel file, e.g. `EMOJI`,
+`EMOJI_TEXT_PRESENTATION`, `REGIONAL_INDICATOR`, `KEYCAP_BASE`, etc.
+
+By typedef'ing `emoji_text_iter_t` to your own iterator type, you can implement
+an adapter class that iterates over an input text buffer in any encoding, and on
+dereferencing returns the correct Ragel class by implementing something similar
+to the following Unicode character class to Ragel class mapping, example taken
+from Chromium:
+
+```
+char EmojiSegmentationCategory(UChar32 codepoint) {
+ // Specific ones first.
+ if (codepoint == kCombiningEnclosingKeycapCharacter)
+ return COMBINING_ENCLOSING_KEYCAP;
+ if (codepoint == kCombiningEnclosingCircleBackslashCharacter)
+ return COMBINING_ENCLOSING_CIRCLE_BACKSLASH;
+ if (codepoint == kZeroWidthJoinerCharacter)
+ return ZWJ;
+ if (codepoint == kVariationSelector15Character)
+ return VS15;
+ if (codepoint == kVariationSelector16Character)
+ return VS16;
+ if (codepoint == 0x1F3F4)
+ return TAG_BASE;
+ if ((codepoint >= 0xE0030 && codepoint <= 0xE0039) ||
+ (codepoint >= 0xE0061 && codepoint <= 0xE007A))
+ return TAG_SEQUENCE;
+ if (codepoint == 0xE007F)
+ return TAG_TERM;
+ if (Character::IsEmojiModifierBase(codepoint))
+ return EMOJI_MODIFIER_BASE;
+ if (Character::IsModifier(codepoint))
+ return EMOJI_MODIFIER;
+ if (Character::IsRegionalIndicator(codepoint))
+ return REGIONAL_INDICATOR;
+ if (Character::IsEmojiKeycapBase(codepoint))
+ return KEYCAP_BASE;
+
+ if (Character::IsEmojiEmojiDefault(codepoint))
+ return EMOJI_EMOJI_PRESENTATION;
+ if (Character::IsEmojiTextDefault(codepoint))
+ return EMOJI_TEXT_PRESENTATION;
+ if (Character::IsEmoji(codepoint))
+ return EMOJI;
+
+ // Ragel state machine will interpret unknown category as "any".
+ return kMaxEmojiScannerCategory;
+}
+```
+
+Update/Build requisites
+===
+
+You need to have ragel installed if you want to modify the grammar and generate a new C file as output.
+
+`apt-get install ragel`
+
+then run
+
+`make`
+
+to update the `emoji_presentation_scanner.c` and `emoji_presentation_scanner_vs.c` output C source file.
+
+Contributing
+===
+
+See the CONTRIBUTING.md file for how to contribute.
diff --git a/src/3rdparty/emoji-segmenter/REUSE.toml b/src/3rdparty/emoji-segmenter/REUSE.toml
new file mode 100644
index 0000000000..53d2dc47c7
--- /dev/null
+++ b/src/3rdparty/emoji-segmenter/REUSE.toml
@@ -0,0 +1,7 @@
+version = 1
+
+[[annotations]]
+path = ["**"]
+precedence = "closest"
+SPDX-FileCopyrightText = "Copyright 2019 Google LLC"
+SPDX-License-Identifier = "Apache-2.0"
diff --git a/src/3rdparty/emoji-segmenter/emoji_presentation_scanner.c b/src/3rdparty/emoji-segmenter/emoji_presentation_scanner.c
new file mode 100644
index 0000000000..00b7700a9a
--- /dev/null
+++ b/src/3rdparty/emoji-segmenter/emoji_presentation_scanner.c
@@ -0,0 +1,251 @@
+
+#line 1 "emoji_presentation_scanner.rl"
+/* Copyright 2019 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdbool.h>
+
+#ifndef EMOJI_LINKAGE
+#define EMOJI_LINKAGE static
+#endif
+
+
+#line 23 "emoji_presentation_scanner.c"
+static const unsigned char _emoji_presentation_trans_keys[] = {
+ 0u, 13u, 14u, 15u, 0u, 13u, 9u, 12u, 10u, 12u, 10u, 10u, 4u, 12u, 4u, 12u,
+ 6u, 6u, 9u, 12u, 8u, 8u, 8u, 10u, 9u, 14u, 0
+};
+
+static const char _emoji_presentation_key_spans[] = {
+ 14, 2, 14, 4, 3, 1, 9, 9,
+ 1, 4, 1, 3, 6
+};
+
+static const char _emoji_presentation_index_offsets[] = {
+ 0, 15, 18, 33, 38, 42, 44, 54,
+ 64, 66, 71, 73, 77
+};
+
+static const char _emoji_presentation_indicies[] = {
+ 1, 1, 1, 2, 0, 0, 0, 1,
+ 0, 0, 0, 0, 0, 1, 0, 4,
+ 5, 3, 6, 6, 7, 8, 9, 9,
+ 10, 11, 9, 9, 9, 9, 9, 12,
+ 9, 5, 13, 14, 15, 0, 13, 16,
+ 17, 16, 13, 0, 17, 16, 16, 16,
+ 16, 16, 13, 16, 17, 16, 17, 16,
+ 16, 16, 16, 5, 13, 14, 15, 16,
+ 5, 18, 5, 13, 19, 20, 18, 14,
+ 21, 23, 22, 13, 22, 5, 13, 14,
+ 15, 16, 4, 16, 0
+};
+
+static const char _emoji_presentation_trans_targs[] = {
+ 2, 4, 6, 2, 1, 2, 3, 3,
+ 7, 2, 8, 9, 12, 0, 2, 5,
+ 2, 5, 2, 10, 11, 2, 2, 2
+};
+
+static const char _emoji_presentation_trans_actions[] = {
+ 1, 2, 2, 3, 0, 4, 7, 2,
+ 2, 8, 0, 7, 2, 0, 9, 10,
+ 11, 2, 12, 0, 10, 13, 14, 15
+};
+
+static const char _emoji_presentation_to_state_actions[] = {
+ 0, 0, 5, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0
+};
+
+static const char _emoji_presentation_from_state_actions[] = {
+ 0, 0, 6, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0
+};
+
+static const char _emoji_presentation_eof_trans[] = {
+ 1, 4, 0, 1, 17, 1, 17, 17,
+ 19, 19, 22, 23, 17
+};
+
+static const int emoji_presentation_start = 2;
+
+static const int emoji_presentation_en_text_and_emoji_run = 2;
+
+
+#line 26 "emoji_presentation_scanner.rl"
+
+
+
+#line 100 "emoji_presentation_scanner.rl"
+
+
+EMOJI_LINKAGE emoji_text_iter_t
+scan_emoji_presentation (emoji_text_iter_t p,
+ const emoji_text_iter_t pe,
+ bool* is_emoji,
+ bool* has_vs)
+{
+ emoji_text_iter_t ts;
+ emoji_text_iter_t te;
+ const emoji_text_iter_t eof = pe;
+
+ (void)ts;
+
+ unsigned act;
+ int cs;
+
+
+#line 100 "emoji_presentation_scanner.c"
+ {
+ cs = emoji_presentation_start;
+ ts = 0;
+ te = 0;
+ act = 0;
+ }
+
+#line 106 "emoji_presentation_scanner.c"
+ {
+ int _slen;
+ int _trans;
+ const unsigned char *_keys;
+ const char *_inds;
+ if ( p == pe )
+ goto _test_eof;
+_resume:
+ switch ( _emoji_presentation_from_state_actions[cs] ) {
+ case 6:
+#line 1 "NONE"
+ {ts = p;}
+ break;
+#line 118 "emoji_presentation_scanner.c"
+ }
+
+ _keys = _emoji_presentation_trans_keys + (cs<<1);
+ _inds = _emoji_presentation_indicies + _emoji_presentation_index_offsets[cs];
+
+ _slen = _emoji_presentation_key_spans[cs];
+ _trans = _inds[ _slen > 0 && _keys[0] <=(*p) &&
+ (*p) <= _keys[1] ?
+ (*p) - _keys[0] : _slen ];
+
+_eof_trans:
+ cs = _emoji_presentation_trans_targs[_trans];
+
+ if ( _emoji_presentation_trans_actions[_trans] == 0 )
+ goto _again;
+
+ switch ( _emoji_presentation_trans_actions[_trans] ) {
+ case 9:
+#line 94 "emoji_presentation_scanner.rl"
+ {te = p+1;{ *is_emoji = false; *has_vs = true; return te; }}
+ break;
+ case 15:
+#line 95 "emoji_presentation_scanner.rl"
+ {te = p+1;{ *is_emoji = true; *has_vs = true; return te; }}
+ break;
+ case 4:
+#line 96 "emoji_presentation_scanner.rl"
+ {te = p+1;{ *is_emoji = true; *has_vs = false; return te; }}
+ break;
+ case 8:
+#line 97 "emoji_presentation_scanner.rl"
+ {te = p+1;{ *is_emoji = false; *has_vs = false; return te; }}
+ break;
+ case 13:
+#line 94 "emoji_presentation_scanner.rl"
+ {te = p;p--;{ *is_emoji = false; *has_vs = true; return te; }}
+ break;
+ case 14:
+#line 95 "emoji_presentation_scanner.rl"
+ {te = p;p--;{ *is_emoji = true; *has_vs = true; return te; }}
+ break;
+ case 11:
+#line 96 "emoji_presentation_scanner.rl"
+ {te = p;p--;{ *is_emoji = true; *has_vs = false; return te; }}
+ break;
+ case 12:
+#line 97 "emoji_presentation_scanner.rl"
+ {te = p;p--;{ *is_emoji = false; *has_vs = false; return te; }}
+ break;
+ case 3:
+#line 96 "emoji_presentation_scanner.rl"
+ {{p = ((te))-1;}{ *is_emoji = true; *has_vs = false; return te; }}
+ break;
+ case 1:
+#line 1 "NONE"
+ { switch( act ) {
+ case 2:
+ {{p = ((te))-1;} *is_emoji = true; *has_vs = true; return te; }
+ break;
+ case 3:
+ {{p = ((te))-1;} *is_emoji = true; *has_vs = false; return te; }
+ break;
+ case 4:
+ {{p = ((te))-1;} *is_emoji = false; *has_vs = false; return te; }
+ break;
+ }
+ }
+ break;
+ case 10:
+#line 1 "NONE"
+ {te = p+1;}
+#line 95 "emoji_presentation_scanner.rl"
+ {act = 2;}
+ break;
+ case 2:
+#line 1 "NONE"
+ {te = p+1;}
+#line 96 "emoji_presentation_scanner.rl"
+ {act = 3;}
+ break;
+ case 7:
+#line 1 "NONE"
+ {te = p+1;}
+#line 97 "emoji_presentation_scanner.rl"
+ {act = 4;}
+ break;
+#line 188 "emoji_presentation_scanner.c"
+ }
+
+_again:
+ switch ( _emoji_presentation_to_state_actions[cs] ) {
+ case 5:
+#line 1 "NONE"
+ {ts = 0;}
+ break;
+#line 195 "emoji_presentation_scanner.c"
+ }
+
+ if ( ++p != pe )
+ goto _resume;
+ _test_eof: {}
+ if ( p == eof )
+ {
+ if ( _emoji_presentation_eof_trans[cs] > 0 ) {
+ _trans = _emoji_presentation_eof_trans[cs] - 1;
+ goto _eof_trans;
+ }
+ }
+
+ }
+
+#line 118 "emoji_presentation_scanner.rl"
+
+
+ /* Should not be reached. */
+ *is_emoji = false;
+ *has_vs = false;
+ return p;
+}
diff --git a/src/3rdparty/emoji-segmenter/patch/0001-Compile-with-warnings-are-errors.patch b/src/3rdparty/emoji-segmenter/patch/0001-Compile-with-warnings-are-errors.patch
new file mode 100644
index 0000000000..0cc1868ca7
--- /dev/null
+++ b/src/3rdparty/emoji-segmenter/patch/0001-Compile-with-warnings-are-errors.patch
@@ -0,0 +1,26 @@
+From 4ced1426e27320e00b0dd28693df5d95c648d230 Mon Sep 17 00:00:00 2001
+From: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
+Date: Thu, 14 Nov 2024 09:42:11 +0100
+Subject: [PATCH] Compile with warnings-are-errors
+
+Change-Id: Icea8febefc90f3f047143e5b76ff511145c0dcae
+---
+ src/3rdparty/emoji-segmenter/emoji_presentation_scanner.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/src/3rdparty/emoji-segmenter/emoji_presentation_scanner.c b/src/3rdparty/emoji-segmenter/emoji_presentation_scanner.c
+index 56e2e78033..ce7e01846c 100644
+--- a/src/3rdparty/emoji-segmenter/emoji_presentation_scanner.c
++++ b/src/3rdparty/emoji-segmenter/emoji_presentation_scanner.c
+@@ -101,6 +101,8 @@ scan_emoji_presentation (emoji_text_iter_t p,
+ emoji_text_iter_t te;
+ const emoji_text_iter_t eof = pe;
+
++ (void)ts;
++
+ unsigned act;
+ int cs;
+
+--
+2.40.0.windows.1
+
diff --git a/src/3rdparty/emoji-segmenter/qt_attribution.json b/src/3rdparty/emoji-segmenter/qt_attribution.json
new file mode 100644
index 0000000000..64083381d4
--- /dev/null
+++ b/src/3rdparty/emoji-segmenter/qt_attribution.json
@@ -0,0 +1,16 @@
+{
+ "Id": "emoji-segmenter",
+ "Name": "Emoji Segmenter",
+ "QDocModule": "qtgui",
+ "QtUsage": "Used in QtGui for parsing complex emoji sequences. Can be configured using the -emojisegmenter option.",
+ "SecurityCritical": true,
+
+ "Description": "A parser for emoji sequences.",
+ "Homepage": "https://github.com/google/emoji-segmenter",
+ "Version": "0.4.0",
+ "DownloadLocation": "https://github.com/google/emoji-segmenter/releases/tag/0.4.0",
+
+ "License": "Apache License 2.0",
+ "LicenseId": "Apache-2.0",
+ "Copyright": "Copyright 2019 Google LLC"
+}
diff --git a/src/gui/configure.cmake b/src/gui/configure.cmake
index b7c1e8e00c..7889445976 100644
--- a/src/gui/configure.cmake
+++ b/src/gui/configure.cmake
@@ -699,6 +699,12 @@ qt_feature("direct2d1_1" PRIVATE
LABEL "Direct 2D 1.1"
CONDITION QT_FEATURE_direct2d AND TEST_d2d1_1
)
+qt_feature("emojisegmenter" PUBLIC PRIVATE
+ SECTION "Fonts"
+ LABEL "Emoji Segmenter"
+ PURPOSE "Supports parsing complex emoji sequences for better font resolution."
+)
+qt_feature_definition("emojisegmenter" "QT_NO_EMOJISEGMENTER" NEGATE VALUE "1")
qt_feature("evdev" PRIVATE
LABEL "evdev"
CONDITION QT_FEATURE_thread AND TEST_evdev
@@ -1299,6 +1305,7 @@ qt_feature("wayland" PUBLIC
qt_configure_add_summary_section(NAME "Qt Gui")
qt_configure_add_summary_entry(ARGS "accessibility")
+qt_configure_add_summary_entry(ARGS "emojisegmenter")
qt_configure_add_summary_entry(ARGS "freetype")
qt_configure_add_summary_entry(ARGS "system-freetype")
qt_configure_add_summary_entry(ARGS "harfbuzz")
diff --git a/src/gui/qt_cmdline.cmake b/src/gui/qt_cmdline.cmake
index 446618ebc4..5465b2c63e 100644
--- a/src/gui/qt_cmdline.cmake
+++ b/src/gui/qt_cmdline.cmake
@@ -10,6 +10,7 @@ qt_commandline_option(eglfs TYPE boolean)
qt_commandline_option(evdev TYPE boolean)
qt_commandline_option(fontconfig TYPE boolean)
qt_commandline_option(freetype TYPE enum VALUES no qt system)
+qt_commandline_option(emojisegmenter TYPE boolean)
qt_commandline_option(gbm TYPE boolean)
qt_commandline_option(gif TYPE boolean)
qt_commandline_option(harfbuzz TYPE enum VALUES no qt system)

View File

@ -1,45 +0,0 @@
From 0acbd22508cb793461c01979d89c529f86a24bc3 Mon Sep 17 00:00:00 2001
From: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Date: Wed, 15 Jan 2025 15:12:41 +0100
Subject: [PATCH] Request actual font family request in final color font fail safe
When we're trying to resolve a font for color emojis, we will
prefer any color font over the selected font (since a normal
font may have monochrome glyphs for emoji characters and that's
not what we are after).
If there are no color fonts on the system at all, we need to do
a final match where we ignore whether the font is in color or
not and just return it anyway.
In this final pass we would find the first best match among the
fallbacks (typically the first one), but never actually check
the font that was requested in the first place. This was a
mistake. Unless it does not exist, we should just return the
requested font family.
Pick-to: 6.9
Task-number: QTBUG-132377
Change-Id: Ie53a6bd665ebdaaca92bf0c33fabf5195e1aa5fe
---
diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp
index 0c2a4b66..03f29009 100644
--- a/src/gui/text/qfontdatabase.cpp
+++ b/src/gui/text/qfontdatabase.cpp
@@ -2787,8 +2787,14 @@ QFontEngine *QFontDatabasePrivate::findFont(const QFontDef &req,
// If we are looking for a color font and there are no color fonts on the system,
// we will end up here, for one final pass. This is a rare occurrence so we accept
// and extra pass on the fallbacks for this.
- if (!engine && script == QFontDatabasePrivate::Script_Emoji)
+ if (!engine && script == QFontDatabasePrivate::Script_Emoji) {
engine = findMatchingFallback(QChar::Script_Common, script);
+
+ // Since we no longer require color fonts, we need to retry to check if the
+ // actual requested font is available as a non-color font.
+ if (!requestFamily.isEmpty())
+ fallbacks.prepend(requestFamily);
+ }
}
if (!engine)

View File

@ -1,55 +0,0 @@
From cb2633468413d8c2a9e28d4c4a10b25e90dd3116 Mon Sep 17 00:00:00 2001
From: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Date: Mon, 25 Nov 2024 16:05:09 +0100
Subject: Skip ad hoc handling of variation selector in font merging
Since we now support emoji parsing, there is no longer any need
for this ad hoc processing of VS-16. The exception is if Qt is
built without the emoji segmenter, in which case we should keep
it for consistency with previous versions.
Task-number: QTBUG-111801
Change-Id: I3e243b9610fe55dda26eba63ac849e6afa22a185
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp
index 02595b40c5..6be6a5aca2 100644
--- a/src/gui/text/qfontengine.cpp
+++ b/src/gui/text/qfontengine.cpp
@@ -1997,8 +1997,11 @@ int QFontEngineMulti::stringToCMap(const QChar *str, int len,
int glyph_pos = 0;
QStringIterator it(str, str + len);
- int lastFallback = -1;
+#if defined(QT_NO_EMOJISEGMENTER)
char32_t previousUcs4 = 0;
+#endif
+
+ int lastFallback = -1;
while (it.hasNext()) {
const char32_t ucs4 = it.peekNext();
@@ -2057,6 +2060,7 @@ int QFontEngineMulti::stringToCMap(const QChar *str, int len,
}
}
+#if defined(QT_NO_EMOJISEGMENTER)
// For variant-selectors, they are modifiers to the previous character. If we
// end up with different font selections for the selector and the character it
// modifies, we try applying the selector font to the preceding character as well
@@ -2095,11 +2099,15 @@ int QFontEngineMulti::stringToCMap(const QChar *str, int len,
}
}
}
+#endif
}
it.advance();
++glyph_pos;
+
+#if defined(QT_NO_EMOJISEGMENTER)
previousUcs4 = ucs4;
+#endif
}
*nglyphs = glyph_pos;

View File

@ -1 +1 @@
SHA512 (qtbase-everywhere-src-6.8.1.tar.xz) = 87b7df95a63f7c28bfc7659f19658e4151b9da55b0dc4d34dc0e04c5270254b01a72f8deac0b2fc5543fce8d7542128addb398833de9c3248196aa96b2dd1601
SHA512 (qtbase-everywhere-src-6.9.1.tar.xz) = f0fdf4e2c10db73d8036e4b1324f04f48eced78feeed450b0ffa1fac5574daa4173996a4d25da761f5eeaa6037eab02418a88a59fd760d96a08d813c9b8136ed