Backport additional fixes for emoji support
Resolves: RHEL-4218
This commit is contained in:
parent
d1bd3b310e
commit
5a09932501
@ -47,7 +47,7 @@ BuildRequires: pkgconfig(libsystemd)
|
||||
Name: qt6-qtbase
|
||||
Summary: Qt6 - QtBase components
|
||||
Version: 6.8.1
|
||||
Release: 5%{?dist}
|
||||
Release: 6%{?dist}
|
||||
|
||||
License: LGPL-3.0-only OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
Url: http://qt-project.org/
|
||||
@ -100,6 +100,9 @@ Patch58: qtbase-libglvnd.patch
|
||||
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
|
||||
|
||||
## RHEL specific patches
|
||||
# Patch300: qtbase-fix-tests.patch
|
||||
@ -912,6 +915,10 @@ make check -k ||:
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
* Mon Dec 16 2024 Jan Grulich <jgrulich@redhat.com> - 6.8.1-6
|
||||
- Backport additional fixes for emoji support
|
||||
Resolves: RHEL-4218
|
||||
|
||||
* Wed Dec 11 2024 Jan Grulich <jgrulich@redhat.com> - 6.8.1-5
|
||||
- Move libcupsprintersupport back to -gui as it depends on gui libs
|
||||
Resolves: RHEL-53982
|
||||
|
@ -0,0 +1,55 @@
|
||||
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
96
qtbase-fix-regression-when-looking-up-fallback-fonts.patch
Normal file
96
qtbase-fix-regression-when-looking-up-fallback-fonts.patch
Normal file
@ -0,0 +1,96 @@
|
||||
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)
|
@ -1,7 +1,7 @@
|
||||
From aa7d479be0df3e118580e87f30e061445dfb37e3 Mon Sep 17 00:00:00 2001
|
||||
From: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
|
||||
Date: Fri, 02 Feb 2024 15:45:20 +0100
|
||||
Subject: [PATCH] Introduce emoji-segmenter to 3rdparty code
|
||||
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
|
||||
@ -15,13 +15,12 @@ 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 039582da..417c2067 100644
|
||||
index deb38c9c2f..09aebf2e65 100644
|
||||
--- a/config_help.txt
|
||||
+++ b/config_help.txt
|
||||
@@ -295,6 +295,7 @@ Gui, printing, widget options:
|
||||
@@ -298,6 +298,7 @@ Gui, printing, widget options:
|
||||
|
||||
-cups ................ Enable CUPS support [auto] (Unix only)
|
||||
|
||||
@ -31,7 +30,7 @@ index 039582da..417c2067 100644
|
||||
-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 00000000..db177d4a
|
||||
index 0000000000..db177d4ac7
|
||||
--- /dev/null
|
||||
+++ b/src/3rdparty/emoji-segmenter/CONTRIBUTING.md
|
||||
@@ -0,0 +1,28 @@
|
||||
@ -65,7 +64,7 @@ index 00000000..db177d4a
|
||||
+[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 00000000..3fd07f1c
|
||||
index 0000000000..3fd07f1ce2
|
||||
--- /dev/null
|
||||
+++ b/src/3rdparty/emoji-segmenter/NEWS
|
||||
@@ -0,0 +1,28 @@
|
||||
@ -99,7 +98,7 @@ index 00000000..3fd07f1c
|
||||
+* Initial release
|
||||
diff --git a/src/3rdparty/emoji-segmenter/README.md b/src/3rdparty/emoji-segmenter/README.md
|
||||
new file mode 100644
|
||||
index 00000000..571a1a45
|
||||
index 0000000000..571a1a4515
|
||||
--- /dev/null
|
||||
+++ b/src/3rdparty/emoji-segmenter/README.md
|
||||
@@ -0,0 +1,103 @@
|
||||
@ -208,7 +207,7 @@ index 00000000..571a1a45
|
||||
+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 00000000..53d2dc47
|
||||
index 0000000000..53d2dc47c7
|
||||
--- /dev/null
|
||||
+++ b/src/3rdparty/emoji-segmenter/REUSE.toml
|
||||
@@ -0,0 +1,7 @@
|
||||
@ -221,7 +220,7 @@ index 00000000..53d2dc47
|
||||
+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 00000000..00b7700a
|
||||
index 0000000000..00b7700a9a
|
||||
--- /dev/null
|
||||
+++ b/src/3rdparty/emoji-segmenter/emoji_presentation_scanner.c
|
||||
@@ -0,0 +1,251 @@
|
||||
@ -478,7 +477,7 @@ index 00000000..00b7700a
|
||||
+}
|
||||
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 00000000..0cc1868c
|
||||
index 0000000000..0cc1868ca7
|
||||
--- /dev/null
|
||||
+++ b/src/3rdparty/emoji-segmenter/patch/0001-Compile-with-warnings-are-errors.patch
|
||||
@@ -0,0 +1,26 @@
|
||||
@ -510,7 +509,7 @@ index 00000000..0cc1868c
|
||||
+
|
||||
diff --git a/src/3rdparty/emoji-segmenter/qt_attribution.json b/src/3rdparty/emoji-segmenter/qt_attribution.json
|
||||
new file mode 100644
|
||||
index 00000000..64083381
|
||||
index 0000000000..64083381d4
|
||||
--- /dev/null
|
||||
+++ b/src/3rdparty/emoji-segmenter/qt_attribution.json
|
||||
@@ -0,0 +1,16 @@
|
||||
@ -531,10 +530,10 @@ index 00000000..64083381
|
||||
+ "Copyright": "Copyright 2019 Google LLC"
|
||||
+}
|
||||
diff --git a/src/gui/configure.cmake b/src/gui/configure.cmake
|
||||
index 0e53f512..44bef7d3 100644
|
||||
index b7c1e8e00c..7889445976 100644
|
||||
--- a/src/gui/configure.cmake
|
||||
+++ b/src/gui/configure.cmake
|
||||
@@ -689,6 +689,12 @@ qt_feature("direct2d1_1" PRIVATE
|
||||
@@ -699,6 +699,12 @@ qt_feature("direct2d1_1" PRIVATE
|
||||
LABEL "Direct 2D 1.1"
|
||||
CONDITION QT_FEATURE_direct2d AND TEST_d2d1_1
|
||||
)
|
||||
@ -547,7 +546,7 @@ index 0e53f512..44bef7d3 100644
|
||||
qt_feature("evdev" PRIVATE
|
||||
LABEL "evdev"
|
||||
CONDITION QT_FEATURE_thread AND TEST_evdev
|
||||
@@ -1285,6 +1291,7 @@ qt_feature("wayland" PUBLIC
|
||||
@@ -1299,6 +1305,7 @@ qt_feature("wayland" PUBLIC
|
||||
|
||||
qt_configure_add_summary_section(NAME "Qt Gui")
|
||||
qt_configure_add_summary_entry(ARGS "accessibility")
|
||||
@ -556,7 +555,7 @@ index 0e53f512..44bef7d3 100644
|
||||
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 446618eb..5465b2c6 100644
|
||||
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)
|
||||
|
@ -0,0 +1,55 @@
|
||||
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;
|
@ -1,7 +1,7 @@
|
||||
From 16850709306589a2433c0038605d365a6b6bedad Mon Sep 17 00:00:00 2001
|
||||
From: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
|
||||
Date: Tue, 02 Apr 2024 13:20:34 +0200
|
||||
Subject: [PATCH] Use emoji segmenter to apply emoji fonts automatically
|
||||
Date: Tue, 2 Apr 2024 13:20:34 +0200
|
||||
Subject: Use emoji segmenter to apply emoji fonts automatically
|
||||
|
||||
Colorful emojis in Unicode are not isolated to specific ranges
|
||||
of code points like other writing systems. Instead, there are
|
||||
|
Loading…
Reference in New Issue
Block a user