Backport additional fixes for emoji support

Resolves: RHEL-4218
This commit is contained in:
Jan Grulich 2025-01-16 13:33:02 +01:00
parent b91aad2add
commit c09d648656
4 changed files with 130 additions and 1 deletions

View File

@ -47,7 +47,7 @@ BuildRequires: pkgconfig(libsystemd)
Name: qt6-qtbase
Summary: Qt6 - QtBase components
Version: 6.8.1
Release: 7%{?dist}
Release: 8%{?dist}
License: LGPL-3.0-only OR GPL-3.0-only WITH Qt-GPL-exception-1.0
Url: http://qt-project.org/
@ -103,6 +103,9 @@ 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
@ -921,6 +924,10 @@ make check -k ||:
%endif
%changelog
* Thu Jan 16 2025 Jan Grulich <jgrulich@redhat.com> - 6.8.1-8
- Backport additional fixes for emoji support
Resolves: RHEL-4218
* Wed Jan 15 2025 Jan Grulich <jgrulich@redhat.com> - 6.8.1-7
- Sync with Fedora:
- fix directory ownership

View File

@ -0,0 +1,34 @@
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

@ -0,0 +1,43 @@
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

@ -0,0 +1,45 @@
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)