feat(libSceFreeType): manage multiple size objects #9550
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/9550"
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 Ondra97 on 2026-10-22T01:54:54Z.
What
A face can have several independently configured pixel sizes, but the guest bridge previously had only one embedded size record and no size-object entry points. Add
FT_New_Size,FT_Activate_SizeandFT_Done_Size, with NIDszyezaHweY3U,EBvr2CZnjVoand-2rnxRCeHMs.Keep stable guest records for additional native sizes, retain the existing default record, and synchronize the active pointer and LP64 metrics without refreshing the glyph slot or overwriting guest outline edits. Deleting an active size selects the same surviving native size; deleting the last one clears
face->size. Size finalizers receive the corresponding record and observe the native active-size selection. Face/library teardown keeps those records alive through all size callbacks and clears the pointer before the face callback. The review follow-up pins this behavior with an active additional size destroyed before later size callbacks; each callback checks its owned guest record, complete current-size metrics and the active pointer against native FreeType.Preserve native error ordering, untouched outputs on precondition failures, output clearing on allocation failure, and the behavior of
FT_New_Size(face, &face->size). Allocate guest storage before native creation so a wrapper allocation failure cannot leak a native size. Native size/list/internal allocation failures are exercised through the public FreeType memory allocator.The names/NIDs match the pinned PS5 3.20 inventory. Contracts and destruction order follow bundled FreeType 2.13.3 ftobjs.c and ftsizes.h. Console ABI/version and finalizer equivalence remain unverified and are recorded in debt.
Depends on #9437 for the native face-lifetime fix; its implementation and regression coverage remain included, with the current #9437 head
60a0f0f5e2ef9ee462718108dd3a27a8a1c495bdused for comparison. #9437 declares #9419 for debt insertion order. #8286, #9545, #9574 and #9384 have merged; their bitmap, CID, trigonometry and strike-selection implementation/tests remain in this rebased tree, along with main's outline-copy/decomposition coverage. No title unblock or performance improvement is claimed.Tested
Rebased on upstream
main0119103fa9ed65a894a931da02b6510669991b45; tested PR head85e43880cf84adbd140203e09ff58e3a1b34d918. Windows 11 Pro 10.0.26300, Ryzen 9 7900X, 31.7 GiB RAM, WinLibs MinGW-w64 GCC 15.2.0 UCRT, Ninja, Release,BUILD_TESTING=ON, pinned bundled dependencies (FreeType 2.13.3). These tests used the CPU.cmake --build <build> --target libSceFreeType guest_freetype_tests guest_freetype_bitmap_tests guest_freetype_request_size_tests guest_freetype_outline_tests guest_freetype_outline_mutations_tests guest_freetype_charmap_tests guest_freetype_charmap_info_tests guest_freetype_face_info_tests guest_freetype_names_tests guest_freetype_sfnt_names_tests guest_freetype_list_tests guest_font_tests guest_system_font_tests guest_font_writing_line_tests font_face_lifetime_tests --parallel 8, followed bycmake --build <build> --target guest_font_metrics_tests guest_font_style_information_tests guest_font_outline_profile_tests --parallel 8: production FreeType and all focused fixtures built successfully without a source overlay.ctest --test-dir <build> -R '^(guest_freetype.*|guest_.*font.*|font_.*)$' -V --output-on-failure --no-tests=error: 20/20 passed, zero skips. Size regression: 24 lifecycles, 468 rendered glyphs and 48 injected allocation failures compared with native FreeType. Included #9437 regression: 28 retains, 24 non-final releases and eight finalized faces, including reentrant callbacks and owned file bytes. Main'sFT_Select_Sizeregression also passed (26 native request comparisons and 18 bitmap glyph comparisons), alongside its outline, CID and trigonometry coverage and the three new font tests.ctest --test-dir <build> -R '^public_headers($|_compile_)' -j 8 --output-on-failure --no-tests=error: 65/65 passed, zero skips. The conflict inApi.hppwas resolved by retaining both main'sFT_Select_Sizedeclaration and this PR's face-reference/size-object declarations.git range-diff 50a4f824fc3ee23177d8e1effbe306e50150187f..d32f20c97e5188902f77ff525303f7252e4071d0 0119103fa9ed65a894a931da02b6510669991b45..85e43880cf84adbd140203e09ff58e3a1b34d918: all three commits retained; changes are API declaration integration and surrounding context, with the teardown regression unchanged.python tools/check_conventions.py --base origin/main,python tools/check_main_sync.py --base origin/main --strict,git diff origin/main...HEAD --check, andpython tools/check_test_registration.py <build>passed.python tools/pr_overlap.py --branch codex/pr9550-rebase-20261024 --repo boykopovar/AnyPS5 --jobs 12completed against the same main. #9437 is the inherited face-reference implementation and #9419 its documentation-order predecessor; old #9550 is the expected self-match. Manual shared-file comparisons confirmed #10604 (FT_Open_Face), #10606 (library references), #10616 (FT_Attach_File), #9465 (glyph debt) and #9848 (macOS debt cleanup) change distinct behavior. Adjacent insertions must retain both changes during later rebases.The baseline lacks the guest size exports required by the size regression. Console ABI/version, title impact and generic-finalizer equivalence remain unverified as recorded in debt. The complete all-target build, patched-libraries loader, complete CTest suite and a title run were not performed on this rebased head; earlier full-build/loader results are historical evidence only.
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)Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-22T01:58:10Z.
Review: CHANGES_REQUESTED
The size creation and activation paths are narrowly scoped and have strong native-reference lifecycle coverage. The PR declares its #9437 and FreeType insertion-order dependencies, and the hosted eligibility, intake, labels and report checks pass. The convention check and product/relinker builds are still pending/skipped; I did not run local tests.
I’m requesting changes for one destruction-path issue in the submitted head:
FT_Done_FreeTypedestroys a face by callingFT_List_Finalizeonface->sizes_list. That routine savescur->next, invokes the size destructor, then proceeds to the saved node. InFinalizeSize, the adapter callsSyncSizePointer_nid_no_patch, which searchesface.sizesforhost->face->sizeand throws if it cannot find it. This makes library teardown depend on whether the active native size is still represented in the guest list at each callback. Please add a regression that forces library teardown with several guest sizes and the active size positioned so its guest owner is removed before later size callbacks, and make the callback/teardown path tolerate FreeType's list-finalization order while keeping every callback's guest size record valid. Also verify callbacks still see the expected active-size pointer and metrics where that state is available.This is based on the bundled FreeType 2.13.3
destroy_face/FT_List_Finalizeorder and the current callback's lookup/throw behavior; I have not run a local reproduction. Please report the focused test and rerun convention checks after fixing it.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-22T01:58:11Z.
The size creation and activation paths are narrowly scoped and have strong native-reference lifecycle coverage. The PR declares its #9437 and FreeType insertion-order dependencies, and the hosted eligibility, intake, labels and report checks pass. The convention check and product/relinker builds are still pending/skipped; I did not run local tests.
I’m requesting changes for one destruction-path issue in the submitted head:
FT_Done_FreeTypedestroys a face by callingFT_List_Finalizeonface->sizes_list. That routine savescur->next, invokes the size destructor, then proceeds to the saved node. InFinalizeSize, the adapter callsSyncSizePointer_nid_no_patch, which searchesface.sizesforhost->face->sizeand throws if it cannot find it. This makes library teardown depend on whether the active native size is still represented in the guest list at each callback. Please add a regression that forces library teardown with several guest sizes and the active size positioned so its guest owner is removed before later size callbacks, and make the callback/teardown path tolerate FreeType's list-finalization order while keeping every callback's guest size record valid. Also verify callbacks still see the expected active-size pointer and metrics where that state is available.This is based on the bundled FreeType 2.13.3
destroy_face/FT_List_Finalizeorder and the current callback's lookup/throw behavior; I have not run a local reproduction. Please report the focused test and rerun convention checks after fixing it.Imported from boykopovar/AnyPS5. Originally posted by Ondra97 on 2026-10-22T02:48:33Z.
I opened #9574 for FT_Cos, FT_Sin, FT_Tan, FT_Vector_Unit and FT_Angle_Diff. I declared #9550 for merge order because both patches add different FreeType API includes in GuestFreeType.cpp; its declared chain covers the earlier include insertions. Retain both FT_SIZES_H and FT_TRIGONOMETRY_H. The implementations are independent.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-22T11:27:41Z.
The new teardown-order regression in the description addresses the earlier review concern: the finalizer cases now check each owned guest size record, active pointer and metrics while earlier sizes are finalized. The reported full Windows build and focused native comparisons are detailed. I checked current upstream/main: diff-check and conventions pass, and the merge is clean. This head is 7 ahead/16 behind current main
4777caca34(merge based6732b51a); the reported full build used that older base. Please update from current main, rerun the focused FreeType tests/checks on the resulting head, and refresh the Tested commit. Preserve the declared #9437/#8286/#9329/#9545 dependency and #9574 insertion order. I did not run local C++ tests because the root filesystem is full; hosted product/relinker jobs are skipped.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-22T11:27:42Z.
Review: DISMISSED
The updated implementation and test description appear to resolve my earlier finalizer-order concern. I am retaining changes requested only for current-main freshness: this head is 7 ahead/16 behind upstream/main
4777caca34(merge based6732b51a), so update and rerun the focused FreeType suite and convention/overlap checks on the resulting head. The merge is clean and conventions pass on the present head. Keep the declared prerequisite chain (#9437, #8286, #9329, #9545) and #9574 insertion order intact. I did not run tests locally; the filesystem is full.