Fix Qt not showing up emoji by handling emoji font family
This commit is contained in:
parent
c3d64d866e
commit
69a1492416
@ -57,7 +57,7 @@
|
|||||||
Name: qt5-qtbase
|
Name: qt5-qtbase
|
||||||
Summary: Qt5 - QtBase components
|
Summary: Qt5 - QtBase components
|
||||||
Version: 5.15.11
|
Version: 5.15.11
|
||||||
Release: 3%{?dist}
|
Release: 4%{?dist}
|
||||||
|
|
||||||
# See LGPL_EXCEPTIONS.txt, for exception details
|
# See LGPL_EXCEPTIONS.txt, for exception details
|
||||||
License: LGPL-3.0-only OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
License: LGPL-3.0-only OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||||
@ -139,6 +139,9 @@ Patch61: qtbase-5.15.10-work-around-pyside2-brokenness.patch
|
|||||||
# fix build against libxkbcommon 1.6.0
|
# fix build against libxkbcommon 1.6.0
|
||||||
Patch62: qtbase-libxkbcommon-1.6.0.patch
|
Patch62: qtbase-libxkbcommon-1.6.0.patch
|
||||||
|
|
||||||
|
# Bug 1954359 - Many emoji don't show up in Qt apps because qt does not handle 'emoji' font family
|
||||||
|
Patch63: qtbase-cache-emoji-font.patch
|
||||||
|
|
||||||
# gcc-11
|
# gcc-11
|
||||||
Patch90: %{name}-gcc11.patch
|
Patch90: %{name}-gcc11.patch
|
||||||
|
|
||||||
@ -457,6 +460,7 @@ Qt5 libraries used for drawing widgets and OpenGL items.
|
|||||||
%endif
|
%endif
|
||||||
%patch -P61 -p1
|
%patch -P61 -p1
|
||||||
%patch -P62 -p1 -b .libxkbcommon-1.6.0
|
%patch -P62 -p1 -b .libxkbcommon-1.6.0
|
||||||
|
%patch -P63 -p1 -b .cache-emoji-font
|
||||||
|
|
||||||
%patch -P90 -p1 -b .gcc11
|
%patch -P90 -p1 -b .gcc11
|
||||||
|
|
||||||
@ -1171,6 +1175,9 @@ fi
|
|||||||
|
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Tue Nov 07 2023 Jan Grulich <jgrulich@redhat.com> - 5.15.11-4
|
||||||
|
- Fix Qt not showing up emoji by handling emoji font family
|
||||||
|
|
||||||
* Mon Oct 16 2023 Jan Grulich <jgrulich@redhat.com> - 5.15.11-3
|
* Mon Oct 16 2023 Jan Grulich <jgrulich@redhat.com> - 5.15.11-3
|
||||||
- Fix build against libxkbcommon 1.6.0
|
- Fix build against libxkbcommon 1.6.0
|
||||||
|
|
||||||
|
85
qtbase-cache-emoji-font.patch
Normal file
85
qtbase-cache-emoji-font.patch
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
diff --git a/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp b/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp
|
||||||
|
index 0d4bc288ea..91df249778 100644
|
||||||
|
--- a/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp
|
||||||
|
+++ b/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp
|
||||||
|
@@ -593,6 +593,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
|
||||||
|
@@ -736,6 +737,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();
|
||||||
|
@@ -1015,4 +1019,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/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase_p.h b/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase_p.h
|
||||||
|
index a7257c2f98..13b182923e 100644
|
||||||
|
--- a/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase_p.h
|
||||||
|
+++ b/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase_p.h
|
||||||
|
@@ -72,7 +72,10 @@ public:
|
||||||
|
QFont defaultFont() const override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
+ void cacheEmojiFontFamily();
|
||||||
|
void setupFontEngine(QFontEngineFT *engine, const QFontDef &fontDef) const;
|
||||||
|
+
|
||||||
|
+ QString m_cacheEmojiFontFamily;
|
||||||
|
};
|
||||||
|
|
||||||
|
QT_END_NAMESPACE
|
Loading…
Reference in New Issue
Block a user