diff options
author | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> | 2023-10-03 08:51:06 +0200 |
---|---|---|
committer | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> | 2023-10-03 19:25:46 +0200 |
commit | a890df0283b8c36998d2d8edce341de81024fea9 (patch) | |
tree | 19967b5db14abacbfd2fddd0dde5acaf70ef23a7 /tests/auto/gui/text/qfontdatabase/tst_qfontdatabase.cpp | |
parent | 1aba24a2ed4b75551a900772320d5a0dc1960043 (diff) |
coretext: Support variable application fonts
Named instances of variable application fonts are exposed
automatically through CTFontManagerCreateFontDescriptorsFromData()
(and also for the URL equivalent).
The main change here is just to call this instead of the overload
which only returns the first font.
Note that this also updates the test: This is because the conversion
from CoreText normalized weight values to TTF values is not 100%.
In the CoreText code, we map Heavy (0.56) to ExtraBold, but ExtraBold
gets converted to 0.6, which is closer to the CoreText value for Black
(0.62).
To avoid hitting this inconsistency, the QtExtraBold has been changed
to Black weight instead, which resolves to the same on all platforms.
Task-number: QTBUG-108624
Change-Id: Ied6d42e9e3e1ba8b7102936c5be3d285b3d9e07f
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Diffstat (limited to 'tests/auto/gui/text/qfontdatabase/tst_qfontdatabase.cpp')
-rw-r--r-- | tests/auto/gui/text/qfontdatabase/tst_qfontdatabase.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/auto/gui/text/qfontdatabase/tst_qfontdatabase.cpp b/tests/auto/gui/text/qfontdatabase/tst_qfontdatabase.cpp index fb61037c95..3995f64e07 100644 --- a/tests/auto/gui/text/qfontdatabase/tst_qfontdatabase.cpp +++ b/tests/auto/gui/text/qfontdatabase/tst_qfontdatabase.cpp @@ -534,9 +534,9 @@ void tst_QFontDatabase::variableFont() { QFont font(family); - font.setWeight(QFont::ExtraBold); + font.setWeight(QFont::Black); QCOMPARE(QFontInfo(font).styleName(), u"QtExtraBold"_s); - QCOMPARE(QFontInfo(font).weight(), QFont::ExtraBold); + QCOMPARE(QFontInfo(font).weight(), int(QFont::Black)); } { |