feat(libSceFreeTypeOt): manage glyph slot bitmaps and implement FT_GlyphSlot_Own_Bitmap #16120
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/16120"
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 noamroger on 2026-11-05T17:50:07Z.
What
Implements the glyph slot bitmap ownership calls of libSceFreeTypeOt, which were
sceFreeTypeOtUnknown_*stubs:ft_glyphslot_alloc_bitmap(Ln9I6YfmYJU),ft_glyphslot_free_bitmap(7cVMwHmN308),ft_glyphslot_set_bitmap(AEU2tkjdZ2w) andFT_GlyphSlot_Own_Bitmap(nSIux4OQyJM). The first three follow FreeType 2.4.12src/base/ftobjs.c,FT_GlyphSlot_Own_Bitmapfollows 2.4.12src/base/ftbitmap.c(with theFT_Bitmap_Copyit calls). They work on the existing LP64GuestGlyphSlotRec, read theFT_GLYPH_OWN_BITMAPflag at offset 8 of the slot's internal record (FT_Slot_InternalRec, 72 bytes, layout checked withstatic_assert), and allocate through the Otft_mem_*calls, so the guest memory callbacks see the same allocations as in FreeType (face memory for the slot calls, library memory forOwn_Bitmap).2.4.12 is the version already used for the other Ot exports (
FT_Sqrt32,FT_Property_Setdate it to 2.4.11-2.4.12); #15865 reportsFT_Library_Version2.4.11 measured on a console, and these four functions,FT_Bitmap_CopyandFT_Slot_InternalRecare identical in 2.4.11 (c6a66b49e64e). Inputs where that source dereferences a null pointer, theintoverflow of|pitch| * rowsinFT_Bitmap_Copyand a pitch ofINT_MINthrow; this and the remaining unverified points (console prototypes, theFT_ULongsize passed asFT_Long) are recorded indocs/dev/debt/libSceFreeTypeOt.md. ThesceFreeTypeOtUnknown_*count there goes from 61 to 57.#15687 only renames these four stubs and #10591 implements
FT_GlyphSlot_Own_Bitmapin libSceFreeType (another module) while renaming the Ot stub, so both overlap this PR in text only.FT_GlyphSlot_ObliqueandFT_GlyphSlot_Emboldenstay stubbed and will come in a follow-up PR.Tested
Linux (Ubuntu 24.04, g++ 13), full CMake build of the FreeTypeOt targets: the new
guest_freetype_ot_glyph_slottest and the existingguest_freetype_ot*andguest_freetype_cornertests pass (ctest -R guest_freetype). The new test was also run with-fsanitize=address,undefined. It covers: allocation into a slot that borrows its buffer (no free, owned flag set, other flags kept, cleared buffer), reallocation of an owned buffer (old block freed), 0 bytes (null buffer, flag kept), a size aboveLONG_MAX(Invalid_Argument) and a failing allocator (Out_Of_Memory, flag stays set as in FreeType);free_bitmapof an owned buffer, of a borrowed one and without internal record;set_bitmapover owned and borrowed buffers;Own_Bitmapcopying a negative-pitch bitmap with its geometry and palette, leaving an owned bitmap and an outline slot alone, accepting a null buffer, and leaving the slot unchanged on Out_Of_Memory and on a negativeintsize.tools/check_conventions.py --base upstream/mainpasses.tools/pr_overlap.pycannot reach the GitHub API from my environment; I checked by NID that no open pull request implementsLn9I6YfmYJU,7cVMwHmN308,AEU2tkjdZ2wornSIux4OQyJMin libSceFreeTypeOt.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)Generated with Claude Code