feat(libSceFreeType): select and iterate character maps #8253

Merged
santhoshkumar-dev merged 1 commit from upstream-pr/8253 into main 2026-10-21 02:48:18 +00:00
santhoshkumar-dev commented 2026-10-20 07:08:05 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by santhoshkumar-dev on 2026-10-20T07:08:05Z.


What

Add FT_Select_Charmap, FT_Set_Charmap, FT_Get_First_Char and FT_Get_Next_Char to libSceFreeType. A title can select an exposed encoding map and enumerate its actual character-to-glyph entries instead of relying on the initially selected map and individual lookups.

Map selection translates a guest charmap pointer to the corresponding native object and updates only the selected guest pointer. It preserves the current glyph and guest outline edits. Foreign and fabricated charmap pointers are rejected. Iteration preserves the LP64 guest interface and the low-32-bit input conversion used inside bundled FreeType 2.13.3, with optional glyph-index outputs and native end-of-map behavior.

Move the existing generated-font fixture into a shared test header and add an optional symbol map, allowing the regression to switch between Unicode U+0041 and symbol U+F041. Console signatures and errors remain unverified and are recorded in the debt file.

Tested

Windows 11 x64, WinLibs MinGW-w64 GCC 15.2.0 r7, Release, full project configured with BUILD_TESTING=ON.

  • cmake --build build --target guest_freetype_tests guest_freetype_charmap_tests --parallel 8: passed.
  • ctest --test-dir build -R '^guest_freetype(_charmap)?$' --output-on-failure: both passed (0.02 s / 0.11 s).
  • Changed C++ sources: -std=c++20 -Wall -Wextra -Werror -fsyntax-only: passed.
  • python tools/check_conventions.py --base origin/main: passed.
  • git diff --cached --check: passed before committing.

The new test compares selection and iteration with native FreeType for both maps; checks the selected guest pointer and glyph lookup; tests null faces/outputs, missing encodings, foreign/fabricated maps, end-of-map, a real character at code zero and 64-bit input values; and verifies edited outline coordinates survive selection.

This is independent of #8247. A temporary local merge with that PR merged cleanly and passed both tests (0.06 s / 0.07 s); the merge was then aborted so this branch contains only the character-map feature. No title, Linux runtime or console hardware tested. The full suite was not run.

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:4932271757 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8253). Originally posted by [santhoshkumar-dev](https://github.com/santhoshkumar-dev) on 2026-10-20T07:08:05Z. --- ### What Add `FT_Select_Charmap`, `FT_Set_Charmap`, `FT_Get_First_Char` and `FT_Get_Next_Char` to `libSceFreeType`. A title can select an exposed encoding map and enumerate its actual character-to-glyph entries instead of relying on the initially selected map and individual lookups. Map selection translates a guest charmap pointer to the corresponding native object and updates only the selected guest pointer. It preserves the current glyph and guest outline edits. Foreign and fabricated charmap pointers are rejected. Iteration preserves the LP64 guest interface and the low-32-bit input conversion used inside bundled [FreeType 2.13.3](https://github.com/freetype/freetype/blob/42608f77f20749dd6ddc9e0536788eaad70ea4b5/src/base/ftobjs.c), with optional glyph-index outputs and native end-of-map behavior. Move the existing generated-font fixture into a shared test header and add an optional symbol map, allowing the regression to switch between Unicode U+0041 and symbol U+F041. Console signatures and errors remain unverified and are recorded in the debt file. ### Tested Windows 11 x64, WinLibs MinGW-w64 GCC 15.2.0 r7, Release, full project configured with `BUILD_TESTING=ON`. - `cmake --build build --target guest_freetype_tests guest_freetype_charmap_tests --parallel 8`: passed. - `ctest --test-dir build -R '^guest_freetype(_charmap)?$' --output-on-failure`: both passed (0.02 s / 0.11 s). - Changed C++ sources: `-std=c++20 -Wall -Wextra -Werror -fsyntax-only`: passed. - `python tools/check_conventions.py --base origin/main`: passed. - `git diff --cached --check`: passed before committing. The new test compares selection and iteration with native FreeType for both maps; checks the selected guest pointer and glyph lookup; tests null faces/outputs, missing encodings, foreign/fabricated maps, end-of-map, a real character at code zero and 64-bit input values; and verifies edited outline coordinates survive selection. This is independent of #8247. A temporary local merge with that PR merged cleanly and passed both tests (0.06 s / 0.07 s); the merge was then aborted so this branch contains only the character-map feature. No title, Linux runtime or console hardware tested. The full suite was not run. ### Checklist - [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 07:08:39 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-20T07:08:39Z.


Progress report (3fd1cc3 → c233067)

📈 System libraries: 66.71% (+0.02%, +4 implemented functions)

✅ 4 implemented
Library Name
libSceFreeType FT_Get_First_Char_nid_postfix
libSceFreeType FT_Get_Next_Char_nid_postfix
libSceFreeType FT_Select_Charmap_nid_postfix
libSceFreeType FT_Set_Charmap_nid_postfix
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6285436691 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8253#issuecomment-6285436691). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-20T07:08:39Z. --- <!-- progress-report --> ### Progress report (3fd1cc3 → c233067) 📈 **System libraries**: 66.71% (+0.02%, +4 implemented functions) <details> <summary>✅ 4 implemented</summary> | Library | Name | | - | - | | libSceFreeType | `FT_Get_First_Char_nid_postfix` | | libSceFreeType | `FT_Get_Next_Char_nid_postfix` | | libSceFreeType | `FT_Select_Charmap_nid_postfix` | | libSceFreeType | `FT_Set_Charmap_nid_postfix` | </details>
github-actions[bot] commented 2026-10-20 16:46:42 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-20T16:46:42Z.


Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
PR 8558 docs/dev/debt/libSceFreeType.md L4
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6296172024 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8253#issuecomment-6296172024). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-20T16:46:42Z. --- <!-- pr-overlap --> Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in **Depends on**. | Pull request | Conflicting files (lines on `main`) | Same exports | Same new files | |---|---|---|---| | [PR 8558](https://www.github.com/boykopovar/AnyPS5/pull/8558) | `docs/dev/debt/libSceFreeType.md` [L4](https://github.com/boykopovar/AnyPS5/blob/d0852defa2a5fbc7f64ab20abddb7e1c24733345/docs/dev/debt/libSceFreeType.md#L4) | | |
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!8253
No description provided.