feat(libSceFreeType): load glyphs by character code #8289

Merged
santhoshkumar-dev merged 2 commits from upstream-pr/8289 into main 2026-10-21 12:02:11 +00:00
santhoshkumar-dev commented 2026-10-20 09:02:43 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by santhoshkumar-dev on 2026-10-20T09:02:43Z.


What

Add FT_Load_Char to the existing libSceFreeType guest bridge. It delegates character lookup, the direct glyph-index fallback for faces without a charmap, and load/render flags to bundled FreeType, then refreshes the guest glyph slot on success or error. Its LP64 character argument uses the same low-32-bit conversion as the existing FT_Get_Char_Index adapter.

The name/NID wPQ0rMK4-JU is present in the PS5 3.20 inventory. Behavior follows bundled FreeType 2.13.3 FT_Load_Char. Console-version and ABI uncertainty remains as recorded in the existing library debt.

Tested

Windows 11 x64, WinLibs MinGW-w64 GCC 15.2.0 r7, Release, BUILD_TESTING=ON, based on upstream 35fa2bdd82.

  • Full project build passed; registered guest_freetype passed (0.07 s).
  • The existing regression compares all mirrored slot fields, outline points, metrics and bitmap bytes with native FreeType. New cases cover mapped and missing characters, high character-code bits, unscaled/unhinted/render loads, a null face, and a font whose cmap directory entry is renamed to make it absent. Without a charmap, glyph 1 loads directly and out-of-range glyph 2 returns the native error and slot state.
  • A compiled source mutation that always performs a charmap lookup fails the new no-charmap case.
  • Strict -Wall -Wextra -Werror syntax checks and conventions passed.
  • Temporarily merged #8247, #8253 and #8286 without committing; all FreeType targets built and guest_freetype_bitmap, guest_freetype and guest_freetype_charmap passed (0.06 s / 0.08 s / 0.07 s). Aborted the merge afterward.
  • Restored and rebuilt the independent branch: guest_freetype passed again (0.09 s), and the patched PRX exports wPQ0rMK4-JU.
  • Final open-PR overlap check: No overlap with open pull requests. Open, closed and merged FreeType history was reviewed before implementation.

Latest main e9a5a0c849 was checked before publication; it changes no FreeType or libc dependency source.

No title, PS5 hardware or Linux runtime was tested.

Refresh on 2026-10-21: rebased onto upstream 1381826358, rebuilt the FreeType library and both current test targets, and reran guest_freetype and guest_freetype_charmap (0.08 s / 0.07 s). Conventions passed. Production behavior is unchanged.

Compatibility validation (2026-10-21): temporarily combined this PR with #8247, #8286, #9045, #9054, #9064 and the charmap-metadata follow-up on main 3e91c8edf5. All system libraries built and all seven FreeType tests passed. The C++ changes merged cleanly; temporary CMake/debt resolutions were used only for this local compatibility check and are 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: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4933492320 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8289). Originally posted by [santhoshkumar-dev](https://github.com/santhoshkumar-dev) on 2026-10-20T09:02:43Z. --- ### What Add `FT_Load_Char` to the existing `libSceFreeType` guest bridge. It delegates character lookup, the direct glyph-index fallback for faces without a charmap, and load/render flags to bundled FreeType, then refreshes the guest glyph slot on success or error. Its LP64 character argument uses the same low-32-bit conversion as the existing `FT_Get_Char_Index` adapter. The name/NID `wPQ0rMK4-JU` is 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 `FT_Load_Char`](https://github.com/freetype/freetype/blob/42608f77f20749dd6ddc9e0536788eaad70ea4b5/src/base/ftobjs.c). Console-version and ABI uncertainty remains as recorded in the [existing library debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/debt/libSceFreeType.md). ### Tested Windows 11 x64, WinLibs MinGW-w64 GCC 15.2.0 r7, Release, `BUILD_TESTING=ON`, based on upstream `35fa2bdd82`. - Full project build passed; registered `guest_freetype` passed (0.07 s). - The existing regression compares all mirrored slot fields, outline points, metrics and bitmap bytes with native FreeType. New cases cover mapped and missing characters, high character-code bits, unscaled/unhinted/render loads, a null face, and a font whose cmap directory entry is renamed to make it absent. Without a charmap, glyph 1 loads directly and out-of-range glyph 2 returns the native error and slot state. - A compiled source mutation that always performs a charmap lookup fails the new no-charmap case. - Strict `-Wall -Wextra -Werror` syntax checks and conventions passed. - Temporarily merged #8247, #8253 and #8286 without committing; all FreeType targets built and `guest_freetype_bitmap`, `guest_freetype` and `guest_freetype_charmap` passed (0.06 s / 0.08 s / 0.07 s). Aborted the merge afterward. - Restored and rebuilt the independent branch: `guest_freetype` passed again (0.09 s), and the patched PRX exports `wPQ0rMK4-JU`. - Final open-PR overlap check: `No overlap with open pull requests`. Open, closed and merged FreeType history was reviewed before implementation. Latest main `e9a5a0c849` was checked before publication; it changes no FreeType or libc dependency source. 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. --> Refresh on 2026-10-21: rebased onto upstream `1381826358`, rebuilt the FreeType library and both current test targets, and reran `guest_freetype` and `guest_freetype_charmap` (0.08 s / 0.07 s). Conventions passed. Production behavior is unchanged. Compatibility validation (2026-10-21): temporarily combined this PR with #8247, #8286, #9045, #9054, #9064 and the charmap-metadata follow-up on main `3e91c8edf5`. All system libraries built and all seven FreeType tests passed. The C++ changes merged cleanly; temporary CMake/debt resolutions were used only for this local compatibility check and are 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: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
github-actions[bot] commented 2026-10-20 09:03:31 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-20T09:03:31Z.


Progress report (b6fe513 → f43de1f)

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

✅ 1 implemented
Library Name
libSceFreeType FT_Load_Char_nid_postfix
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6287417299 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8289#issuecomment-6287417299). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-20T09:03:31Z. --- <!-- progress-report --> ### Progress report (b6fe513 → f43de1f) 📈 **System libraries**: 50.59% (+0.01%, +1 implemented functions) <details> <summary>✅ 1 implemented</summary> | Library | Name | | - | - | | libSceFreeType | `FT_Load_Char_nid_postfix` | </details>
adriadam10 commented 2026-10-21 12:02:42 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-21T12:02:42Z.


Checked the FT_Load_Char adapter against FreeType 2.13.3 (low-32-bit charcode, slot sync on error, null face), and that guest_freetype compares slot, outline and bitmap with native FreeType, including the no-cmap case and high character-code bits; merged.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6315416541 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8289#issuecomment-6315416541). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-21T12:02:42Z. --- Checked the `FT_Load_Char` adapter against FreeType 2.13.3 (low-32-bit charcode, slot sync on error, null face), and that `guest_freetype` compares slot, outline and bitmap with native FreeType, including the no-cmap case and high character-code bits; merged.
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!8289
No description provided.