feat(libfreetype): implement LCD geometry and variation axis flags #16394
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/16394"
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 Noxy-HNR on 2026-11-06T16:00:42Z.
What
Two libfreetype exports currently throw:
FT_Library_SetLcdGeometry(Xxtq+Qr5lzI) andFT_Get_Var_Axis_Flags(+sDVkl3aAR8). They now call the bundled FreeType (3rdparty/freetype) through thin adapters insrc/LibraryHelpers.cpp, and the module gets its ownCMakeLists.txtto link it. The names come from the NID database already cited in the debt file. No FreeType logic is copied intocore/.FT_Library_SetLcdGeometrytakes the guest library handle fromlibSceFreeTypeand its three LP64FT_Vectorsubpixel offsets, converts them to hostFT_Vector, and sets them on the library's native handle. LaterFT_RENDER_MODE_LCDandFT_RENDER_MODE_LCD_Vrenders throughlibSceFreeTypeuse them. A null library or null array returns FreeType's own errors. On Windows, a coordinate that does not fit the 32-bit hostFT_Posthrows throughNotImplemented_nid_no_patch.FT_Get_Var_Axis_Flagspasses the guestFT_MM_Varrecord straight to FreeType. Its 32-byte layout is the same on the guest and on both hosts, and astatic_assertchecks it. FreeType reads the 16-bit flag array that follows the record. Before writing the flags output, the adapter opens a host write. A refused write returnsFT_Err_Invalid_Argumentand leaves it unchanged.The bundled FreeType is built without
FT_CONFIG_OPTION_SUBPIXEL_RENDERING, soFT_Library_SetLcdGeometrystores the geometry as FreeType's Harmony LCD renderer expects. A console build with that option would returnFT_Err_Unimplemented_Featureinstead. The console signatures and options are not measured, and the debt file records this. No title unblock is claimed.Tested
Current verification (2026-11-07), head
c5dfe3d648, merging main1b7fd528e9: Windows 11 x86-64, WinLibs MinGW GCC 15.2, Ninja, Release, full project configuration withBUILD_TESTING=ON,-j 18. Builtguest_legacy_freetype_library_fixtureand ran the focused raw and NID-patched tests matchingguest_legacy_freetype_library(_nid)?: 2/2 passed in each of three runs, none skipped. Test-private patched modules and executable keep validation independent of the global all-library target. Current conventions, whitespace and public-header checks passed. The fixture uses configuration-specific output directories and publishes patched files only after successful patching. No new Linux, macOS, console or title runtime result is claimed.Manual full-build dispatch for this head returned HTTP 403 (repository admin rights required). Automatic checks are tracked separately; a skipped job is not a pass.
Historical verification follows; results below retain their original heads and do not establish validation of the current head.
New
guest_legacy_freetype_libraryandguest_legacy_freetype_library_nidtests load the raw and NID-patchedlibfreetypeandlibSceFreeTypemodules and compare them with the bundled FreeType called directly:FT_Library_SetLcdGeometry: six geometries (FreeType's default, wider and vertical offsets, mixed signs, all zero, and large offsets) at 13 and 32 pixels in LCD and LCD_V modes. The guest render after each call matches FreeType's render with the same geometry, byte for byte, including size, pitch and bearings. The non-default geometries change the render. A second guest library keeps its own geometry. The input array is not modified. Null library and null array errors match FreeType.FT_Get_Var_Axis_Flags: records with 0, 1, 4 and 8 axes, indexes inside and outside the range up toUINT32_MAX. Each result and error matches FreeType, a failed call leaves the output unchanged, and the record is never modified. Null record and null output errors match FreeType.sceKernelMprotect(checked withVirtualQuery). A read-only flags output is refused without changing either page, a read-only record and geometry array still work, and the query succeeds once write access is restored.Results:
52d463737fon upstreamea3ae18716:ctest -R guest_legacy_freetype_library2/2 passed in each of 3 runs.52d463737fmerged with upstream82fcf46d25:ctest -R guest_legacy_freetype_library2/2 passed in each of 3 runs, including the read-only page checks, andctest -R guest_freetype61/61 passed.python tools/check_conventions.py --base origin/mainandpython core/libs/tests/test_public_headers.py --audit-only(406 libraries, 30,649 exports): passed.python tools/pr_overlap.py --branch claude/freetype-library-helpers(1,886 open PRs): no shared exports.core/libs/prx/libfreetype/CMakeLists.txtis also added by #15408 and by #15439, #15442, #15444, #15447 and #15468, which implement other libfreetype exports, so whichever lands later mergesmainand keeps every source and test. #15468 also rewrites the debt line that listsFT_Get_Var_Axis_Flagsamong the callable NIDs; the later of the two updates it. No open PR adds or removes these two functions or their NIDs.No console or retail-title test.
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)