Skip to content

feat(libSceFreeType): manage multiple size objects - #9550

Merged
adriadam10 merged 4 commits into
boykopovar:mainfrom
Ondra97:codex/feat-freetype-size-objects
Oct 25, 2026
Merged

adriadam10 merged 4 commits into
boykopovar:mainfrom
Ondra97:codex/feat-freetype-size-objects

Conversation

@Ondra97

@Ondra97 Ondra97 commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

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_Size and FT_Done_Size, with NIDs zyezaHweY3U, EBvr2CZnjVo and -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 60a0f0f5e2ef9ee462718108dd3a27a8a1c495bd used 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 main 0119103fa9ed65a894a931da02b6510669991b45; tested PR head 85e43880cf84adbd140203e09ff58e3a1b34d918. 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 by cmake --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 fix(libSceFreeType): preserve referenced face lifetimes #9437 regression: 28 retains, 24 non-final releases and eight finalized faces, including reentrant callbacks and owned file bytes. Main's FT_Select_Size regression 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 in Api.hpp was resolved by retaining both main's FT_Select_Size declaration 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, and python tools/check_test_registration.py <build> passed.
  • python tools/pr_overlap.py --branch codex/pr9550-rebase-20261024 --repo boykopovar/AnyPS5 --jobs 12 completed against the same main. fix(libSceFreeType): preserve referenced face lifetimes #9437 is the inherited face-reference implementation and feat(libSceFreeType): implement vector and matrix geometry #9419 its documentation-order predecessor; old feat(libSceFreeType): manage multiple size objects #9550 is the expected self-match. Manual shared-file comparisons confirmed feat(libSceFreeType): implement FT_Open_Face for memory and path sources #10604 (FT_Open_Face), feat(libSceFreeType): implement FT_Done_Library and FT_Reference_Library #10606 (library references), feat(libSceFreeType): implement FT_Get_PS_Font_Value and FT_Attach_File #10616 (FT_Attach_File), feat(libSceFreeType): add partial bitmap and outline glyph ownership #9465 (glyph debt) and fix(libSceFreeType): preserve helpers through NID patching #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

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: fix(libSceFreeType): preserve referenced face lifetimes #9437
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes

@github-actions

github-actions Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Progress report (58c9977 → ad2b085)

📈 System libraries: 49.94% (+0.01%, +3 implemented functions)

✅ 3 implemented
Library Name
libSceFreeType FT_Activate_Size_nid_postfix
libSceFreeType FT_Done_Size_nid_postfix
libSceFreeType FT_New_Size_nid_postfix

Changed libraries (implemented exports)

Library Before After Change
libSceFreeType 56/57 (98.25%) 59/60 (98.33%) +0.09 pp

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_FreeType destroys a face by calling FT_List_Finalize on face->sizes_list. That routine saves cur->next, invokes the size destructor, then proceeds to the saved node. In FinalizeSize, the adapter calls SyncSizePointer_nid_no_patch, which searches face.sizes for host->face->size and 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_Finalize order 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.

@MarcZX10

Copy link
Copy Markdown
Contributor

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_FreeType destroys a face by calling FT_List_Finalize on face->sizes_list. That routine saves cur->next, invokes the size destructor, then proceeds to the saved node. In FinalizeSize, the adapter calls SyncSizePointer_nid_no_patch, which searches face.sizes for host->face->size and 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_Finalize order 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.

@Ondra97

Ondra97 commented Oct 22, 2026

Copy link
Copy Markdown
Contributor Author

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.

@MarcZX10

Copy link
Copy Markdown
Contributor

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 4777cac (merge base d6732b5); 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.

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 4777cac (merge base d6732b5), 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.

@github-actions github-actions Bot added libkernel build shader core/shader agc libSceAgc* labels Oct 22, 2026
@github-actions

github-actions Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 9419 core/libs/prx/libSceFreeType/include/Api.hpp
docs/dev/debt/libSceFreeType.md
PR 9465 docs/dev/debt/libSceFreeType.md
PR 9848 docs/dev/debt/libSceFreeType.md
PR 10604 core/libs/prx/libSceFreeType/Export.cpp
docs/dev/debt/libSceFreeType.md
PR 10606 core/libs/prx/libSceFreeType/Export.cpp
core/libs/prx/libSceFreeType/include/GuestObjects.hpp
docs/dev/debt/libSceFreeType.md
PR 10616 core/libs/prx/libSceFreeType/Export.cpp
docs/dev/debt/libSceFreeType.md

@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Oct 23, 2026
@Ondra97
Ondra97 force-pushed the codex/feat-freetype-size-objects branch from a2f3057 to 65e79d6 Compare October 23, 2026 03:13
@github-actions github-actions Bot added needs rebase Conflicts with main, rebase needed and removed needs rebase Conflicts with main, rebase needed labels Oct 23, 2026
@Ondra97 Ondra97 mentioned this pull request Oct 23, 2026
12 tasks done
@Ondra97
Ondra97 force-pushed the codex/feat-freetype-size-objects branch from 65e79d6 to c799c39 Compare October 23, 2026 05:58
@github-actions github-actions Bot added needs rebase Conflicts with main, rebase needed and removed needs rebase Conflicts with main, rebase needed labels Oct 23, 2026
@Ondra97
Ondra97 force-pushed the codex/feat-freetype-size-objects branch from c799c39 to 9369ba8 Compare October 23, 2026 14:42
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Oct 23, 2026
@adriadam10 adriadam10 self-assigned this Oct 24, 2026
@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Oct 24, 2026
@Ondra97
Ondra97 force-pushed the codex/feat-freetype-size-objects branch from 9369ba8 to 44eed61 Compare October 24, 2026 14:56
@github-actions github-actions Bot added needs rebase Conflicts with main, rebase needed and removed needs rebase Conflicts with main, rebase needed labels Oct 24, 2026
@Ondra97
Ondra97 force-pushed the codex/feat-freetype-size-objects branch from 44eed61 to 09ac3a8 Compare October 24, 2026 16:34
@github-actions github-actions Bot added needs rebase Conflicts with main, rebase needed and removed needs rebase Conflicts with main, rebase needed labels Oct 24, 2026
@Ondra97
Ondra97 force-pushed the codex/feat-freetype-size-objects branch from 09ac3a8 to ba7d970 Compare October 24, 2026 19:34
@github-actions github-actions Bot added needs rebase Conflicts with main, rebase needed and removed needs rebase Conflicts with main, rebase needed labels Oct 24, 2026
@Ondra97
Ondra97 force-pushed the codex/feat-freetype-size-objects branch from ba7d970 to d32f20c Compare October 25, 2026 01:25
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Oct 25, 2026
@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Oct 25, 2026
@Ondra97
Ondra97 force-pushed the codex/feat-freetype-size-objects branch from d32f20c to 85e4388 Compare October 25, 2026 16:31
@github-actions github-actions Bot added needs rebase Conflicts with main, rebase needed and removed needs rebase Conflicts with main, rebase needed labels Oct 25, 2026
@adriadam10
adriadam10 force-pushed the codex/feat-freetype-size-objects branch from 85e4388 to ad2b085 Compare October 25, 2026 18:48
@adriadam10
adriadam10 dismissed MarcZX10’s stale review October 25, 2026 18:51

Dismissing a stale review: the requested changes were addressed after it (new head) and the merge queue blocks on it. Please request changes again if anything is still open.

@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Oct 25, 2026
@adriadam10
adriadam10 merged commit e82b11d into boykopovar:main Oct 25, 2026
10 checks passed
@adriadam10

Copy link
Copy Markdown
Collaborator

Rebased onto current main (conflict in GuestFreeType.cpp with the already merged face-reference change) and dropped a duplicated FT_Reference_Face_nid_postfix declaration in Api.hpp as a separate commit. The size-object checks from the earlier review still hold against the interdiff (only the tests' GuestLibrary* typing changed); the affected libSceFreeType tests pass; merged.

@Ondra97
Ondra97 deleted the codex/feat-freetype-size-objects branch October 27, 2026 21:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants