feat(libfreetype): implement the Multiple Masters setters #15447
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/15447"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by VakzOs on 2026-11-03T10:54:40Z.
What
The legacy
libfreetypeexportsOGVR5us9otUandV476bsxEylkthrew. The verified NID name database names themFT_Set_MM_WeightVectorandFT_Set_Named_Instance, andtools/nid_names.pycomputes the same NIDs for those names. They are now implemented next to the getters from #15442 insrc/MultipleMasters.cpp.Both call the bundled FreeType 2.15.0 on the host
FT_Facebehind the guest face, so their results are FreeType's own. Both setters change the face (face_flags,face_index, metrics throughMVAR), so the guestFT_FaceRec, its size and its glyph slot are then refreshed with libSceFreeType's existingSyncFace.The NID patcher strips C++ exports, so libSceFreeType now exports
FreeTypeSyncFace_nid_no_patch, a C wrapper aroundSyncFace. libSceFreeTypeOptOl already callsFreeTypePfr*_nid_no_patchthis way.libfreetypelinkslibSceFreeType, and the patched module imports only that helper from it.Weights cross as the console's 64-bit
FT_Fixed. On Windows, a weight outside 32 bits returnsInvalid_Argumentwithout calling FreeType. Only as many weights as the face has designs are read (the count comes fromFT_Get_MM_WeightVector), which is what FreeType's Type 1 driver reads, so a largelennever reads past the guest array.Tested
Linux, GCC 13, Release:
guest_legacy_freetype_multiple_masterspasses with the new cases. On FreeType'svarc-reset-only.ttf(variable) andvarc-static-gvar.ttf(nofvar), it compares results with native FreeType:FT_Set_Named_Instancefor instances 0, 1 and 2, after a blend has setFT_FACE_FLAG_VARIATION;FT_Set_MM_WeightVectorwith lengths 0, 2 andUINT32_MAX(on a two-entry array) and a null array;Before each call the test corrupts the guest record. It then checks that
face_flags,face_indexandascendermatch the host face again, and that a successful named instance clears the variation flag. Removing the refresh makes the test fail. All 52guest_freetype*andguest_legacy_freetype*tests pass.The patched
libfreetype.prxexportsOGVR5us9otUandV476bsxEylk, has noFT_*exports, and its only libSceFreeType import,FreeTypeSyncFace_nid_no_patch, is exported by the patchedlibSceFreeType.prx.python3 tools/check_conventions.py --base origin/mainpasses.FreeType has no TrueType weight vector setter and no Adobe Multiple Master font is available, so a successful
FT_Set_MM_WeightVectoris not exercised.docs/dev/debt/libfreetype.mdrecords this.tools/pr_overlap.py --branchreports:libSceFreeType/include/GuestObjects.hpp. That file merges cleanly with both; their remaining conflicts are in debt files this PR does not touch, and they already conflict withmain.Not tested on hardware or with a title.
Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)