| 267 | #ifndef MSDFGEN_DISABLE_VARIABLE_FONTS |
| 268 | |
| 269 | bool 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 | |
| 294 | bool listFontVariationAxes(std::vector<FontVariationAxis> &axes, FreetypeHandle *library, FontHandle *font) { |
| 295 | if (font->face->face_flags&FT_FACE_FLAG_MULTIPLE_MASTERS) { |