Compare commits

...

2 Commits

Author SHA1 Message Date
Than Ngo 5df6fdd0ab - Fix bz#2179854, Qt 5 render the Bold style CJK character very thick
with Noto CJK variable fonts
2023-03-27 08:41:43 +02:00
Than Ngo 2d8ecc664f - Fix bz#2178389, Qt application render very thin fonts after
switch to VF version of Noto CJK fonts
2023-03-20 14:45:04 +01:00
3 changed files with 141 additions and 1 deletions

View File

@ -53,7 +53,7 @@
Name: qt5-qtbase
Summary: Qt5 - QtBase components
Version: 5.15.8
Release: 6%{?dist}
Release: 8%{?dist}
# See LGPL_EXCEPTIONS.txt, for exception details
License: LGPL-3.0-only OR GPL-3.0-only WITH Qt-GPL-exception-1.0
@ -141,6 +141,12 @@ Source100: kde-5.15-rollup-20230227.patch.gz
Patch101: qtbase-5.15.8-fix-missing-qtsan-include.patch
# Workaround for font rendering issue with cjk-vf-fonts
# https://bugreports.qt.io/browse/QTBUG-111994
# https://bugreports.qt.io/browse/QTBUG-112136
Patch102: qtbase-QTBUG-111994.patch
Patch103: qtbase-QTBUG-112136.patch
# Do not check any files in %%{_qt5_plugindir}/platformthemes/ for requires.
# Those themes are there for platform integration. If the required libraries are
# not there, the platform to integrate with isn't either. Then Qt will just
@ -416,6 +422,8 @@ Qt5 libraries used for drawing widgets and OpenGL items.
## upstream patches
%patch100 -p1
%patch101 -p1
%patch102 -p1
%patch103 -p1
# move some bundled libs to ensure they're not accidentally used
pushd src/3rdparty
@ -1095,6 +1103,14 @@ fi
%changelog
* Mon Mar 27 2023 Than Ngo <than@redhat.com> - 5.15.8-8
- Fix bz#2179854, Qt 5 render the Bold style CJK character very thick
with Noto CJK variable fonts
* Mon Mar 20 2023 Than Ngo <than@redhat.com> - 5.15.8-7
- Fix bz#2178389, Qt application render very thin fonts after
switch to VF version of Noto CJK fonts
* Mon Feb 27 2023 Jan Grulich <jgrulich@redhat.com> - 5.15.8-6
- refresh kde-5.15-rollup patch

11
qtbase-QTBUG-111994.patch Normal file
View File

@ -0,0 +1,11 @@
diff -pruN qtbase-everywhere-src-5.15.8.orig/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp qtbase-everywhere-src-5.15.8/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp
--- qtbase-everywhere-src-5.15.8.orig/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp 2023-03-16 16:21:48.574489839 +0900
+++ qtbase-everywhere-src-5.15.8/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp 2023-03-17 15:58:39.312498612 +0900
@@ -564,6 +564,7 @@ void QFontconfigDatabase::populateFontDa
FcObjectSetAdd(os, *p);
++p;
}
+ FcPatternAddBool(pattern, FC_VARIABLE, FcFalse);
fonts = FcFontList(nullptr, pattern, os);
FcObjectSetDestroy(os);
FcPatternDestroy(pattern);

113
qtbase-QTBUG-112136.patch Normal file
View File

@ -0,0 +1,113 @@
diff -pruN qtbase-everywhere-src-5.15.8.orig/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp qtbase-everywhere-src-5.15.8/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp
--- qtbase-everywhere-src-5.15.8.orig/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp 2023-03-24 14:40:24.844713011 +0900
+++ qtbase-everywhere-src-5.15.8/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp 2023-03-24 21:22:35.466115667 +0900
@@ -954,6 +954,7 @@ void QFontconfigDatabase::setupFontEngin
QFontEngine::GlyphFormat format;
// try and get the pattern
FcPattern *pattern = FcPatternCreate();
+ FcPattern *match = NULL;
FcValue value;
value.type = FcTypeString;
@@ -980,7 +981,41 @@ void QFontconfigDatabase::setupFontEngin
FcConfigSubstitute(nullptr, pattern, FcMatchPattern);
FcDefaultSubstitute(pattern);
- FcPattern *match = FcFontMatch(nullptr, pattern, &result);
+ if (!fid.filename.isEmpty()) {
+ // FC_INDEX is ignored during processing in FcFontMatch.
+ // So iterate FcPatterns directly and find it out.
+ FcFontSet *fcsets[2], *fcfs;
+
+ fcsets[0] = FcConfigGetFonts(nullptr, FcSetSystem);
+ fcsets[1] = FcConfigGetFonts(nullptr, FcSetApplication);
+ for (int nset = 0; nset < 2; nset++) {
+ fcfs = fcsets[nset];
+ for (int fnum = 0; fnum < fcfs->nfont; fnum++) {
+ FcPattern *fcpat = fcfs->fonts[fnum];
+ FcChar8 *fcfile;
+ FcBool variable;
+ int fcindex;
+
+ // FIXME: Ignore a FcPattern which has variable=true at this point.
+ if (FcPatternGetBool(fcpat, FC_VARIABLE, 0, &variable) == FcResultMatch &&
+ variable == FcTrue)
+ continue;
+ if (FcPatternGetString(fcpat, FC_FILE, 0, &fcfile) == FcResultMatch &&
+ FcPatternGetInteger(fcpat, FC_INDEX, 0, &fcindex) == FcResultMatch) {
+ QByteArray f = QByteArray::fromRawData((const char *)fcfile,
+ strlen((const char *)fcfile));
+ if (f == fid.filename && fcindex == fid.index) {
+ // We found it.
+ match = FcFontRenderPrepare(nullptr, pattern, fcpat);
+ goto bail;
+ }
+ }
+ }
+ }
+ }
+bail:
+ if (!match)
+ match = FcFontMatch(nullptr, pattern, &result);
if (match) {
engine->setDefaultHintStyle(defaultHintStyleFromMatch((QFont::HintingPreference)fontDef.hintingPreference, match, useXftConf));
diff -pruN qtbase-everywhere-src-5.15.8.orig/src/platformsupport/fontdatabases/freetype/qfontengine_ft.cpp qtbase-everywhere-src-5.15.8/src/platformsupport/fontdatabases/freetype/qfontengine_ft.cpp
--- qtbase-everywhere-src-5.15.8.orig/src/platformsupport/fontdatabases/freetype/qfontengine_ft.cpp 2022-11-11 16:29:17.000000000 +0900
+++ qtbase-everywhere-src-5.15.8/src/platformsupport/fontdatabases/freetype/qfontengine_ft.cpp 2023-03-24 23:03:02.165756803 +0900
@@ -68,6 +68,7 @@
#include FT_GLYPH_H
#include FT_MODULE_H
#include FT_LCD_FILTER_H
+#include FT_MULTIPLE_MASTERS_H
#if defined(FT_CONFIG_OPTIONS_H)
#include FT_CONFIG_OPTIONS_H
@@ -740,6 +741,29 @@ bool QFontEngineFT::init(FaceId faceId,
freetype->computeSize(fontDef, &xsize, &ysize, &defaultGlyphSet.outline_drawing, &scalableBitmapScaleFactor);
FT_Face face = lockFace();
+ FT_MM_Var *master = nullptr;
+ FT_Error ftresult;
+ double weight_mult = 1.0;
+
+ ftresult = FT_Get_MM_Var(face, &master);
+ if (face_id.index >> 16 && ftresult == FT_Err_Ok) {
+ if ((face_id.index >> 16) - 1 < master->num_namedstyles) {
+ // Pull out weight and width from named-instance.
+ FT_Var_Named_Style *instance = &master->namedstyle[(face_id.index >> 16) - 1];
+
+ for (unsigned int i = 0; i < master->num_axis; i++) {
+ double value = instance->coords[i] / (double) (1U << 16);
+ double default_value = master->axis[i].def / (double) (1U << 16);
+ double mult = default_value ? value / default_value : 1;
+
+ switch (master->axis[i].tag) {
+ case FT_MAKE_TAG('w', 'g', 'h', 't'):
+ weight_mult = mult;
+ break;
+ }
+ }
+ }
+ }
if (FT_IS_SCALABLE(face)) {
bool fake_oblique = (fontDef.style != QFont::StyleNormal) && !(face->style_flags & FT_STYLE_FLAG_ITALIC) && !qEnvironmentVariableIsSet("QT_NO_SYNTHESIZED_ITALIC");
@@ -750,7 +774,7 @@ bool QFontEngineFT::init(FaceId faceId,
// fake bold
if ((fontDef.weight >= QFont::Bold) && !(face->style_flags & FT_STYLE_FLAG_BOLD) && !FT_IS_FIXED_WIDTH(face) && !qEnvironmentVariableIsSet("QT_NO_SYNTHESIZED_BOLD")) {
if (const TT_OS2 *os2 = reinterpret_cast<const TT_OS2 *>(FT_Get_Sfnt_Table(face, ft_sfnt_os2))) {
- if (os2->usWeightClass < 700 && fontDef.pixelSize < 64)
+ if (os2->usWeightClass * weight_mult < 700 && fontDef.pixelSize < 64)
embolden = true;
}
}
@@ -829,6 +853,8 @@ bool QFontEngineFT::init(FaceId faceId,
} else {
Q_ASSERT(!face_);
}
+ if (master && face->glyph)
+ FT_Done_MM_Var(face->glyph->library, master);
// we share the HB face in QFreeTypeFace, so do not let ~QFontEngine() destroy it
face_ = Holder(freetype->hbFace.get(), dont_delete);