feat(libSceFreeType): reverse and translate guest outlines #9075

Merged
santhoshkumar-dev merged 3 commits from upstream-pr/9075 into main 2026-10-23 06:25:15 +00:00
santhoshkumar-dev commented 2026-10-21 11:49:29 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by santhoshkumar-dev on 2026-10-21T11:49:29Z.


What

Implement FT_Outline_Reverse and FT_Outline_Translate over the existing guest outline arrays. Reversal preserves each contour's first point, reverses the remaining points and corresponding tags, and toggles the reverse-fill flag. Translation uses defined unsigned addition and bit-preserving conversion for the guest's 64-bit coordinates, including wrap at the signed limits.

The exports are present in the PS5 3.20 inventory. Behavior follows bundled FreeType 2.13.3's outline routines and its ADD_LONG definition. Console signatures, unsigned count assumptions and overflow compatibility remain unverified and are recorded in debt.

This is a follow-up to #9069 and its #9064 parent; merge #9069 first. #8247 is merged; the remaining shared CMake edits with #8286 follow that dependency order. Open, closed and merged PR searches found no implementation of these two functions.

Tested

Windows 11 x64, WinLibs MinGW-w64 GCC 15.2.0 r7, Release, BUILD_TESTING=ON, main 3e91c8edf5 plus #9069.

  • All system libraries and five FreeType test targets built. ctest --test-dir build --output-on-failure -R '^guest_freetype(_charmap|_outline|_charmap_info|_outline_mutations)?$': 5 passed (0.05 / 0.06 / 0.06 / 0.06 / 0.06 s).
  • The new test compares reversal against native permutations for every contour partition through eight points, keeps full-width guest coordinate payloads, checks point/tag guards, and verifies that reversing twice restores the outline. Maximum 65,535-point and 65,535-contour cases are covered.
  • Translation compares native results for safe-range inputs and checks positive/negative 64-bit offsets, signed-limit wrap, inverse translations, null/empty outlines and 65,535 points.
  • A generated glyph is reversed and translated through guest calls, then rendered through the existing guest bridge. Bitmap pixels, dimensions, pitch, grayscale/pixel mode and bearings match native FreeType.
  • Compiled mutations that reverse a contour's first point or narrow offsets to signed 32 bits fail the regression. Strict -Wall -Wextra -Werror checks and conventions passed. The packaged PRX contains bH12z-W8uIM and 7HoSJ30RWXk.

Latest main 47fa6eecf8 was checked before publication; its newer changes do not touch FreeType or libc.

Historical build limitation (2026-10-21): the default Windows build on the stated base failed at ImageArrayWindowPastLayerLimit.cpp because static alignment 65536 exceeded MinGW COFF's maximum 8192. Merged #8310 fixes that declaration; this is no longer a current-main blocker. The library/test results above retain their stated PR head and base.

No title, PS5 hardware or Linux runtime was tested.

Rebase audit (2026-10-21): rebased onto main d099bc6cd8, including the now-merged #8247 and #8289. All system libraries built. A temporary combination of the seven remaining FreeType branches passed all nine tests (0.07 / 0.07 / 0.06 / 0.06 / 0.16 / 0.04 / 0.06 / 0.06 / 0.05 s); all seven branches passed conventions. Temporary integration commits were not published.

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: #9069
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4951052891 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9075). Originally posted by [santhoshkumar-dev](https://github.com/santhoshkumar-dev) on 2026-10-21T11:49:29Z. --- ### What Implement `FT_Outline_Reverse` and `FT_Outline_Translate` over the existing guest outline arrays. Reversal preserves each contour's first point, reverses the remaining points and corresponding tags, and toggles the reverse-fill flag. Translation uses defined unsigned addition and bit-preserving conversion for the guest's 64-bit coordinates, including wrap at the signed limits. The exports are present in the [PS5 3.20 inventory](https://github.com/DNNDHH/PS5-3.20_Libs/blob/b2a77c09cd71c01f34c790cfbe98c751a13262ad/libSceFreeTypeOt.c). Behavior follows [bundled FreeType 2.13.3's outline routines](https://github.com/freetype/freetype/blob/42608f77f20749dd6ddc9e0536788eaad70ea4b5/src/base/ftoutln.c) and its [ADD_LONG definition](https://github.com/freetype/freetype/blob/42608f77f20749dd6ddc9e0536788eaad70ea4b5/include/freetype/internal/ftcalc.h). Console signatures, unsigned count assumptions and overflow compatibility remain unverified and are recorded in debt. This is a follow-up to #9069 and its #9064 parent; merge #9069 first. #8247 is merged; the remaining shared CMake edits with #8286 follow that dependency order. Open, closed and merged PR searches found no implementation of these two functions. ### Tested Windows 11 x64, WinLibs MinGW-w64 GCC 15.2.0 r7, Release, `BUILD_TESTING=ON`, main `3e91c8edf5` plus #9069. - All system libraries and five FreeType test targets built. `ctest --test-dir build --output-on-failure -R '^guest_freetype(_charmap|_outline|_charmap_info|_outline_mutations)?$'`: 5 passed (0.05 / 0.06 / 0.06 / 0.06 / 0.06 s). - The new test compares reversal against native permutations for every contour partition through eight points, keeps full-width guest coordinate payloads, checks point/tag guards, and verifies that reversing twice restores the outline. Maximum 65,535-point and 65,535-contour cases are covered. - Translation compares native results for safe-range inputs and checks positive/negative 64-bit offsets, signed-limit wrap, inverse translations, null/empty outlines and 65,535 points. - A generated glyph is reversed and translated through guest calls, then rendered through the existing guest bridge. Bitmap pixels, dimensions, pitch, grayscale/pixel mode and bearings match native FreeType. - Compiled mutations that reverse a contour's first point or narrow offsets to signed 32 bits fail the regression. Strict `-Wall -Wextra -Werror` checks and conventions passed. The packaged PRX contains `bH12z-W8uIM` and `7HoSJ30RWXk`. Latest main `47fa6eecf8` was checked before publication; its newer changes do not touch FreeType or libc. Historical build limitation (2026-10-21): the default Windows build on the stated base failed at `ImageArrayWindowPastLayerLimit.cpp` because static alignment 65536 exceeded MinGW COFF's maximum 8192. Merged #8310 fixes that declaration; this is no longer a current-main blocker. The library/test results above retain their stated PR head and base. No title, PS5 hardware or Linux runtime was tested. <!-- 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. --> Rebase audit (2026-10-21): rebased onto main `d099bc6cd8`, including the now-merged #8247 and #8289. All system libraries built. A temporary combination of the seven remaining FreeType branches passed all nine tests (0.07 / 0.07 / 0.06 / 0.06 / 0.16 / 0.04 / 0.06 / 0.06 / 0.05 s); all seven branches passed conventions. Temporary integration commits were not published. ### 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: <!-- #PR, or none --> #9069 - [x] Fixes: <!-- issue it closes as Fixes #N, or none --> none - [x] Unblocks: <!-- title ID and Game bring-up discussion, e.g. PPSA01325 #3232, or none --> none - [x] GPUs tested: <!-- for AGC, shader recompiler or VideoOut changes: vendor, model, driver and OS of each GPU the GPU tests ran on; otherwise n/a --> n/a - [x] AI-assisted: <!-- yes / no --> yes
github-actions[bot] commented 2026-10-21 11:50:21 +00:00 (Migrated from github.com)

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


Progress report (2f161d4 → a5b7e4d)

📈 System libraries: 42.45% (+0.03%, +7 implemented functions)

✅ 7 implemented
Library Name
libSceFreeType FT_Get_CMap_Format_nid_postfix
libSceFreeType FT_Get_CMap_Language_ID_nid_postfix
libSceFreeType FT_Get_Charmap_Index_nid_postfix
libSceFreeType FT_Outline_Check_nid_postfix
libSceFreeType FT_Outline_Get_CBox_nid_postfix
libSceFreeType FT_Outline_Reverse_nid_postfix
libSceFreeType FT_Outline_Translate_nid_postfix
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6315192811 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9075#issuecomment-6315192811). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-21T11:50:21Z. --- <!-- progress-report --> ### Progress report (2f161d4 → a5b7e4d) 📈 **System libraries**: 42.45% (+0.03%, +7 implemented functions) <details> <summary>✅ 7 implemented</summary> | Library | Name | | - | - | | libSceFreeType | `FT_Get_CMap_Format_nid_postfix` | | libSceFreeType | `FT_Get_CMap_Language_ID_nid_postfix` | | libSceFreeType | `FT_Get_Charmap_Index_nid_postfix` | | libSceFreeType | `FT_Outline_Check_nid_postfix` | | libSceFreeType | `FT_Outline_Get_CBox_nid_postfix` | | libSceFreeType | `FT_Outline_Reverse_nid_postfix` | | libSceFreeType | `FT_Outline_Translate_nid_postfix` | </details>
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!9075
No description provided.