MCPcopy Create free account
hub / github.com/MyGUI/mygui / setFontVariationAxis

Function setFontVariationAxis

MyGUIEngine/src/msdfgen/ext/import-font.cpp:269–292  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

267#ifndef MSDFGEN_DISABLE_VARIABLE_FONTS
268
269bool setFontVariationAxis(FreetypeHandle *library, FontHandle *font, const char *name, double coordinate) {
270 bool success = false;
271 if (font->face->face_flags&FT_FACE_FLAG_MULTIPLE_MASTERS) {
272 FT_MM_Var *master = NULL;
273 if (FT_Get_MM_Var(font->face, &master))
274 return false;
275 if (master && master->num_axis) {
276 std::vector<FT_Fixed> coords(master->num_axis);
277 if (!FT_Get_Var_Design_Coordinates(font->face, FT_UInt(coords.size()), &coords[0])) {
278 for (FT_UInt i = 0; i < master->num_axis; ++i) {
279 if (!strcmp(name, master->axis[i].name)) {
280 coords[i] = DOUBLE_TO_F16DOT16(coordinate);
281 success = true;
282 break;
283 }
284 }
285 }
286 if (FT_Set_Var_Design_Coordinates(font->face, FT_UInt(coords.size()), &coords[0]))
287 success = false;
288 }
289 FT_Done_MM_Var(library->library, master);
290 }
291 return success;
292}
293
294bool listFontVariationAxes(std::vector<FontVariationAxis> &axes, FreetypeHandle *library, FontHandle *font) {
295 if (font->face->face_flags&FT_FACE_FLAG_MULTIPLE_MASTERS) {

Callers 1

loadVarFontFunction · 0.85

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected