feat(libSceFreeType): implement FT_Set_Transform #9329

Merged
Ondra97 merged 1 commit from upstream-pr/9329 into main 2026-10-23 02:32:48 +00:00
Ondra97 commented 2026-10-21 18:35:40 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Ondra97 on 2026-10-21T18:35:40Z.


What

Add FT_Set_Transform to the existing LP64 FreeType guest bridge. A caller can set a matrix and translation for subsequent glyph loads, including rotations, reflections, scaling, shear and reset through null arguments. The setter copies inputs without refreshing the already published glyph or size records.

I translate the guest's 32-byte matrix and 16-byte vector into native FreeType records. The name/NID bcM5xfX2SeA comes from the PS5 3.20 inventory; the signature and behavior follow bundled FreeType 2.13.3.

All components are checked before the native call. On Windows, values outside signed 32-bit FT_Long throw and leave the previous transform intact. Console ABI, arithmetic and FreeType-version equivalence remain unverified and are recorded in debt. This PR is independent of #9309 and changes no existing sizing API.

Merge after #9802 for documentation insertion order only. Both PRs add separate entries under Functional in docs/dev/debt/libSceFreeType.md; #9802 implements FT_Outline_Get_BBox, while this PR implements FT_Set_Transform. After #9802 lands, I will retain both debt entries when rebasing this PR. The implementations and test registrations are independent.

Tested

Windows 11 Pro, Ryzen 9 7900X, 32 GB RAM, NVIDIA RTX 4070 Ti SUPER. WinLibs MinGW-w64 GCC 15.2.0 r7, Release, BUILD_TESTING=ON.

Base: ea241c01b388b20b22d4586dfeaacef9675704d7. Change: c11623c211420d47bed53c26133979e2bbf7547d.

  • Baseline negative control on initial base b00235dda0bdf5101c6af181416e57529e5fa2ba: the expanded guest_freetype_tests target fails to link against the unchanged implementation with undefined reference to FT_Set_Transform_nid_postfix. The base FreeType implementation did not change during rebase. This establishes the missing provider; it is not a baseline runtime result.
  • A temporary no-op transform implementation fails the regression while comparing the loaded glyph's advance. I restored the implementation before the final build and tests.
  • cmake --build build --parallel 8 passed. As a validation-only prerequisite, the build temporarily included the reviewed test alignment fix from #8310 at ca55e46f98ad85861dd7567abad0c028274daca1. Its source was restored byte-for-byte afterward and is absent from this PR. The full build validates this feature together with that test-only prerequisite.
  • ctest --test-dir build -R '^(guest_font|guest_system_font|guest_font_writing_line|font_face_lifetime(_replace|_churn)?|guest_freetype(_charmap)?|patched_libraries)$' -V: 9/9 passed, no skips; 360 patched libraries loaded, 0 failed.
  • Forty matrix/translation combinations produce 240 direct native glyph and bitmap comparisons, covering two glyphs and default, ignore-transform and render load flags. Checks include null resets, degenerate matrices, input ownership, unchanged published records and independent faces. Thirty out-of-range matrix/vector cases check rejection without changing the prior transform, and null-face calls ignore their input values.
  • python tools/check_conventions.py --base origin/main: passed.
  • python tools/check_test_registration.py build: 1165 test executable(s), 0 built and not run as recorded, none new
  • At the recorded test checkpoint, python tools/pr_overlap.py --repo boykopovar/AnyPS5 --branch codex/feat-freetype-transform reported no overlap. The later #9802 debt insertion is ordered above; its production and test changes are separate.
  • git diff --check: passed. The patched library exports NID bcM5xfX2SeA.

No console or title was run; no title unblock or performance gain is claimed.

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: #9802
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4956517796 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9329). Originally posted by [Ondra97](https://github.com/Ondra97) on 2026-10-21T18:35:40Z. --- ### What Add `FT_Set_Transform` to the existing LP64 FreeType guest bridge. A caller can set a matrix and translation for subsequent glyph loads, including rotations, reflections, scaling, shear and reset through null arguments. The setter copies inputs without refreshing the already published glyph or size records. I translate the guest's 32-byte matrix and 16-byte vector into native FreeType records. The name/NID `bcM5xfX2SeA` comes from the [PS5 3.20 inventory](https://github.com/DNNDHH/PS5-3.20_Libs/blob/b2a77c09cd71c01f34c790cfbe98c751a13262ad/libSceFreeTypeOt.c); the signature and behavior follow bundled [FreeType 2.13.3](https://github.com/freetype/freetype/blob/42608f77f20749dd6ddc9e0536788eaad70ea4b5/src/base/ftobjs.c#L768-L814). All components are checked before the native call. On Windows, values outside signed 32-bit `FT_Long` throw and leave the previous transform intact. Console ABI, arithmetic and FreeType-version equivalence remain unverified and are recorded in debt. This PR is independent of #9309 and changes no existing sizing API. Merge after #9802 for documentation insertion order only. Both PRs add separate entries under `Functional` in `docs/dev/debt/libSceFreeType.md`; #9802 implements `FT_Outline_Get_BBox`, while this PR implements `FT_Set_Transform`. After #9802 lands, I will retain both debt entries when rebasing this PR. The implementations and test registrations are independent. ### Tested Windows 11 Pro, Ryzen 9 7900X, 32 GB RAM, NVIDIA RTX 4070 Ti SUPER. WinLibs MinGW-w64 GCC 15.2.0 r7, Release, `BUILD_TESTING=ON`. Base: `ea241c01b388b20b22d4586dfeaacef9675704d7`. Change: `c11623c211420d47bed53c26133979e2bbf7547d`. - Baseline negative control on initial base `b00235dda0bdf5101c6af181416e57529e5fa2ba`: the expanded `guest_freetype_tests` target fails to link against the unchanged implementation with `undefined reference to FT_Set_Transform_nid_postfix`. The base FreeType implementation did not change during rebase. This establishes the missing provider; it is not a baseline runtime result. - A temporary no-op transform implementation fails the regression while comparing the loaded glyph's advance. I restored the implementation before the final build and tests. - `cmake --build build --parallel 8` passed. As a validation-only prerequisite, the build temporarily included the reviewed test alignment fix from #8310 at `ca55e46f98ad85861dd7567abad0c028274daca1`. Its source was restored byte-for-byte afterward and is absent from this PR. The full build validates this feature together with that test-only prerequisite. - `ctest --test-dir build -R '^(guest_font|guest_system_font|guest_font_writing_line|font_face_lifetime(_replace|_churn)?|guest_freetype(_charmap)?|patched_libraries)$' -V`: 9/9 passed, no skips; 360 patched libraries loaded, 0 failed. - Forty matrix/translation combinations produce 240 direct native glyph and bitmap comparisons, covering two glyphs and default, ignore-transform and render load flags. Checks include null resets, degenerate matrices, input ownership, unchanged published records and independent faces. Thirty out-of-range matrix/vector cases check rejection without changing the prior transform, and null-face calls ignore their input values. - `python tools/check_conventions.py --base origin/main`: passed. - `python tools/check_test_registration.py build`: 1165 test executable(s), 0 built and not run as recorded, none new - At the recorded test checkpoint, `python tools/pr_overlap.py --repo boykopovar/AnyPS5 --branch codex/feat-freetype-transform` reported no overlap. The later #9802 debt insertion is ordered above; its production and test changes are separate. - `git diff --check`: passed. The patched library exports NID `bcM5xfX2SeA`. No console or title was run; no title unblock or performance gain is claimed. <!-- OS, title or homebrew, what was checked. "Not tested" is a valid answer. A performance change: the summary lines of main and of this PR from the same machine and scene, with the traces attached, captured as the Performance report issue form describes. --> ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: #9802 - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
github-actions[bot] commented 2026-10-21 18:36:20 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-21T18:36:20Z.


Progress report (ee67ebc → c11623c)

📈 System libraries: 42.11% (+0.01%, +1 implemented functions)

✅ 1 implemented
Library Name
libSceFreeType FT_Set_Transform_nid_postfix
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6323635026 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9329#issuecomment-6323635026). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-21T18:36:20Z. --- <!-- progress-report --> ### Progress report (ee67ebc → c11623c) 📈 **System libraries**: 42.11% (+0.01%, +1 implemented functions) <details> <summary>✅ 1 implemented</summary> | Library | Name | | - | - | | libSceFreeType | `FT_Set_Transform_nid_postfix` | </details>
Ondra97 commented 2026-10-22 01:56:21 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Ondra97 on 2026-10-22T01:56:21Z.


I opened #9550 to add FT_New_Size, FT_Activate_Size and FT_Done_Size. I declared #9329 for merge order because both patches add independent regression helpers before main in GuestFreeType.cpp. Retain both transform and size-object tests when resolving that insertion.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6330815250 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9329#issuecomment-6330815250). Originally posted by [Ondra97](https://github.com/Ondra97) on 2026-10-22T01:56:21Z. --- I opened #9550 to add FT_New_Size, FT_Activate_Size and FT_Done_Size. I declared #9329 for merge order because both patches add independent regression helpers before main in GuestFreeType.cpp. Retain both transform and size-object tests when resolving that insertion.
Ondra97 commented 2026-10-22 02:20:29 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Ondra97 on 2026-10-22T02:20:29Z.


I opened #9560, which adds FT_Outline_Decompose. I declared #9329 for merge order because both patches add different function declarations at the same extern-C insertion in GuestFreeType.cpp. Retain both prototypes. The implementations are independent.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6331121847 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9329#issuecomment-6331121847). Originally posted by [Ondra97](https://github.com/Ondra97) on 2026-10-22T02:20:29Z. --- I opened #9560, which adds FT_Outline_Decompose. I declared #9329 for merge order because both patches add different function declarations at the same extern-C insertion in GuestFreeType.cpp. Retain both prototypes. The implementations are independent.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!9329
No description provided.