Fix setting variable axes on Freetype

Amends 7bc6f4ae8e.

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 <volker.hilsheimer@qt.io>
bb10
Eskil Abrahamsen Blomfeldt 2023-12-07 10:43:20 +01:00
parent 2e3b4fc53e
commit 2e154ac020
1 changed files with 5 additions and 2 deletions

View File

@ -303,8 +303,11 @@ QFreetypeFace *QFreetypeFace::getFace(const QFontEngine::FaceId &face_id,
QVarLengthArray<FT_Fixed, 16> 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);