From 2e154ac0202f20c56ab221b3f333a00f7134a032 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Thu, 7 Dec 2023 10:43:20 +0100 Subject: [PATCH] Fix setting variable axes on Freetype Amends 7bc6f4ae8edc5758af567d8326cb798d423c3982. Some refactoring caused a bug in the conversion from floating point to the 16.16 fixed point values expected in Freetype. We now need to do this conversion when passing the value to Freetype. Task-number: QTBUG-117839 Change-Id: Iebec81adc26b27adf0661422a3f0534e6766d683 Reviewed-by: Volker Hilsheimer --- src/gui/text/freetype/qfontengine_ft.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/gui/text/freetype/qfontengine_ft.cpp b/src/gui/text/freetype/qfontengine_ft.cpp index 33b73e49d8..44027c23a9 100644 --- a/src/gui/text/freetype/qfontengine_ft.cpp +++ b/src/gui/text/freetype/qfontengine_ft.cpp @@ -303,8 +303,11 @@ QFreetypeFace *QFreetypeFace::getFace(const QFontEngine::FaceId &face_id, QVarLengthArray coords(var->num_axis); FT_Get_Var_Design_Coordinates(face, var->num_axis, coords.data()); for (FT_UInt i = 0; i < var->num_axis; ++i) { - if (const auto tag = QFont::Tag::fromValue(var->axis[i].tag)) - coords[i] = FT_Fixed(face_id.variableAxes.value(*tag, coords[i])); + if (const auto tag = QFont::Tag::fromValue(var->axis[i].tag)) { + const auto it = face_id.variableAxes.constFind(*tag); + if (it != face_id.variableAxes.constEnd()) + coords[i] = FT_Fixed(*it * 65536); + } } FT_Set_Var_Design_Coordinates(face, var->num_axis, coords.data()); FT_Done_MM_Var(qt_getFreetype(), var);