feat(libSceFreeType): expose PostScript font information #9924

Merged
santhoshkumar-dev merged 12 commits from upstream-pr/9924 into main 2026-10-29 13:27:10 +00:00
santhoshkumar-dev commented 2026-10-22 22:00:37 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by santhoshkumar-dev on 2026-10-22T22:00:37Z.


What

Add FT_Get_PS_Font_Info (JQyLCevN3aM) and FT_Has_PS_Glyph_Names (x8y0qzLiYOU) to the guest FreeType bridge. Font information is copied field by field into an explicit 56-byte LP64 guest record; this preserves the 64-bit italic-angle field and the following byte/16-bit fields on Windows. Strings remain borrowed from the face. Errors preserve the output and neither query refreshes unrelated guest face/slot state. The reliability query uses the font driver's PostScript service, rather than the face flag for merely having glyph names.

Names/NIDs match the PS5 3.20 inventory. The record and behavior follow bundled FreeType 2.13.3 t1tables.h and fttype1.c. Console ABI/backend equivalence remains unverified and is recorded in debt.

Each implemented export is declared once in the canonical public API, included by the implementation and tests. The branch preserves the latest upstream PFR APIs and all merged FreeType features.

The named OT-provider import-resolution helpers also have one declaration each in the shared public API already reachable from the OT umbrella. Export.cpp includes that header. Their existing zero-argument placeholder signatures, explicit NID aliases and throwing behavior are unchanged; this does not establish the console prototypes.

The adapter belongs to physical libSceFreeType. Same-NID inventory stubs in the distinct physical libSceFreeTypeOl and libSceFreeTypeOt providers remain throwing helpers. The entries introduced by #9453/#9462 are those provider stubs, rather than another implementation of this adapter.

Tested

Submitted and tested head b2a5fccfb1f8748cd4ae155fcf7c7527796edff0, including upstream main 5d52b06ff3de0b2ce640dd296db465295c80e7fa.

Windows 11 x64 / WinLibs GCC 15.2.0 r7 and local Ubuntu 24.04.1 x86-64 under WSL2 / GCC 13.3.0 / glibc 2.39: Ninja Release, bundled dependencies, BUILD_TESTING=ON, ANYPS5_ENABLE_SPIRV_TOOLS=OFF. On each platform the complete libs target and selected test executables build, and 70/70 CTests pass, zero skips: the public-header audit, all 64 public-header compilation batches and 5 focused runtime tests. Dependencies use the pinned submodule revisions. The feature, existing base/charmap APIs and packaged-library loader are covered. Both normal-symbol and actual packaged-NID modes run for the feature.

Final upstream recheck: 801d5b9bc11049e6274daca09d70690bd5b8d0a9 merges cleanly, and no files changed by this contribution have changed after the tested base. Results remain pinned to the exact submitted head and its stated base.

Conventions, whitespace and all six pairwise merge checks across the four currently open contributions pass. Open/closed/merged history was rechecked; no replacement implementation was found. No title or physical-console execution is claimed.

The earlier macOS report by @jotitadev used Apple M2 Max, macOS 27.2, Xcode 27 and x86-64 under Rosetta on #8658 at fa063d8b07 plus the original diff and conditional libc-link fix. That host-support PR was closed for splitting. It remains attributed historical evidence; no fresh macOS runtime host is available here, so validation on the current macOS stack remains outstanding. No title or physical-console execution 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: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4974696497 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9924). Originally posted by [santhoshkumar-dev](https://github.com/santhoshkumar-dev) on 2026-10-22T22:00:37Z. --- ### What Add `FT_Get_PS_Font_Info` (`JQyLCevN3aM`) and `FT_Has_PS_Glyph_Names` (`x8y0qzLiYOU`) to the guest FreeType bridge. Font information is copied field by field into an explicit 56-byte LP64 guest record; this preserves the 64-bit italic-angle field and the following byte/16-bit fields on Windows. Strings remain borrowed from the face. Errors preserve the output and neither query refreshes unrelated guest face/slot state. The reliability query uses the font driver's PostScript service, rather than the face flag for merely having glyph names. Names/NIDs match the [PS5 3.20 inventory](https://github.com/DNNDHH/PS5-3.20_Libs/blob/b2a77c09cd71c01f34c790cfbe98c751a13262ad/libSceFreeTypeOt.c). The record and behavior follow bundled [FreeType 2.13.3 t1tables.h](https://github.com/freetype/freetype/blob/42608f77f20749dd6ddc9e0536788eaad70ea4b5/include/freetype/t1tables.h) and [fttype1.c](https://github.com/freetype/freetype/blob/42608f77f20749dd6ddc9e0536788eaad70ea4b5/src/base/fttype1.c). Console ABI/backend equivalence remains unverified and is recorded in debt. Each implemented export is declared once in the canonical public API, included by the implementation and tests. The branch preserves the latest upstream PFR APIs and all merged FreeType features. The named OT-provider import-resolution helpers also have one declaration each in the shared public API already reachable from the OT umbrella. Export.cpp includes that header. Their existing zero-argument placeholder signatures, explicit NID aliases and throwing behavior are unchanged; this does not establish the console prototypes. The adapter belongs to physical `libSceFreeType`. Same-NID inventory stubs in the distinct physical `libSceFreeTypeOl` and `libSceFreeTypeOt` providers remain throwing helpers. The entries introduced by #9453/#9462 are those provider stubs, rather than another implementation of this adapter. ### Tested Submitted and tested head `b2a5fccfb1f8748cd4ae155fcf7c7527796edff0`, including upstream main `5d52b06ff3de0b2ce640dd296db465295c80e7fa`. Windows 11 x64 / WinLibs GCC 15.2.0 r7 and local Ubuntu 24.04.1 x86-64 under WSL2 / GCC 13.3.0 / glibc 2.39: Ninja Release, bundled dependencies, `BUILD_TESTING=ON`, `ANYPS5_ENABLE_SPIRV_TOOLS=OFF`. On each platform the complete `libs` target and selected test executables build, and **70/70 CTests pass, zero skips**: the public-header audit, all 64 public-header compilation batches and 5 focused runtime tests. Dependencies use the pinned submodule revisions. The feature, existing base/charmap APIs and packaged-library loader are covered. Both normal-symbol and actual packaged-NID modes run for the feature. Final upstream recheck: `801d5b9bc11049e6274daca09d70690bd5b8d0a9` merges cleanly, and no files changed by this contribution have changed after the tested base. Results remain pinned to the exact submitted head and its stated base. Conventions, whitespace and all six pairwise merge checks across the four currently open contributions pass. Open/closed/merged history was rechecked; no replacement implementation was found. No title or physical-console execution is claimed. The earlier [macOS report by @jotitadev](https://github.com/boykopovar/AnyPS5/pull/9924#pullrequestreview-5624615549) used Apple M2 Max, macOS 27.2, Xcode 27 and x86-64 under Rosetta on #8658 at `fa063d8b07` plus the original diff and conditional libc-link fix. That host-support PR was [closed for splitting](https://github.com/boykopovar/AnyPS5/pull/8658#issuecomment-6376908709). It remains attributed historical evidence; no fresh macOS runtime host is available here, so validation on the current macOS stack remains outstanding. No title or physical-console execution 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: none <!-- #PR, or none --> - [x] Fixes: none <!-- issue it closes as Fixes #N, or none --> - [x] Unblocks: none <!-- title ID and Game bring-up discussion, e.g. PPSA01325 #3232, or none --> - [x] GPUs tested: n/a <!-- for AGC, shader recompiler or VideoOut changes: vendor, model, driver and OS of each GPU the GPU tests ran on; otherwise n/a --> - [x] AI-assisted: yes <!-- yes / no -->
MarcZX10 commented 2026-10-23 05:47:38 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-23T05:47:38Z.

Review: COMMENTED


The explicit guest record and field-by-field mapping are well tested against bundled FreeType; current-main conventions and whitespace pass. Current check_main_sync.py reports a conflict in docs/dev/debt/libSceFreeType.md plus shared core/libs/CMakeLists.txt, while the implementation/test paths remain unchanged since the base. Please refresh the debt/CMake changes and retain the documentation ordering with #9933 and the already-merged entries.\n\nThe live overlap checker also flags NIDs JQyLCevN3aM and x8y0qzLiYOU in open #9453/#9462. Those are pending declarations in libSceFreeTypeOl/libSceFreeTypeOt, whereas this PR implements in libSceFreeType; I found no duplicate implementation. Please mention that library-scoped distinction in the overlap notes so the checklist claim is unambiguous.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5624414569 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9924#pullrequestreview-5624414569). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-23T05:47:38Z. **Review:** COMMENTED --- The explicit guest record and field-by-field mapping are well tested against bundled FreeType; current-main conventions and whitespace pass. Current `check_main_sync.py` reports a conflict in `docs/dev/debt/libSceFreeType.md` plus shared `core/libs/CMakeLists.txt`, while the implementation/test paths remain unchanged since the base. Please refresh the debt/CMake changes and retain the documentation ordering with #9933 and the already-merged entries.\n\nThe live overlap checker also flags NIDs `JQyLCevN3aM` and `x8y0qzLiYOU` in open #9453/#9462. Those are pending declarations in `libSceFreeTypeOl`/`libSceFreeTypeOt`, whereas this PR implements in `libSceFreeType`; I found no duplicate implementation. Please mention that library-scoped distinction in the overlap notes so the checklist claim is unambiguous.
MarcZX10 commented 2026-10-23 05:47:40 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-23T05:47:40Z.

Review: CHANGES_REQUESTED


Please refresh onto current main and resolve the reported conflict in docs/dev/debt/libSceFreeType.md while preserving the shared core/libs/CMakeLists.txt registration and required debt ordering. The implementation/tests otherwise look sound, and the author-reported Windows build and 5/5 focused CTests are strong. Also clarify the overlap detector’s same-NID entries in open #9453/#9462: those are stubs in the distinct libSceFreeTypeOl/libSceFreeTypeOt modules, while this PR implements libSceFreeType; recording that module distinction makes the no-duplicate checklist auditable.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5624414742 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9924#pullrequestreview-5624414742). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-23T05:47:40Z. **Review:** CHANGES_REQUESTED --- Please refresh onto current main and resolve the reported conflict in `docs/dev/debt/libSceFreeType.md` while preserving the shared `core/libs/CMakeLists.txt` registration and required debt ordering. The implementation/tests otherwise look sound, and the author-reported Windows build and 5/5 focused CTests are strong. Also clarify the overlap detector’s same-NID entries in open #9453/#9462: those are stubs in the distinct `libSceFreeTypeOl`/`libSceFreeTypeOt` modules, while this PR implements `libSceFreeType`; recording that module distinction makes the no-duplicate checklist auditable.
jotitadev commented 2026-10-23 06:14:09 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-23T06:14:09Z.

Review: COMMENTED


macOS test: guest_freetype_postscript_info_nid loads the unpatched libc

Apple M2 Max, macOS 27.2, Apple clang (Xcode 27), x86-64 Release build under Rosetta 2, BUILD_TESTING=ON, full default build. Head 7f4475e595. main does not build on macOS, so the platform is #8658 (feat/macos-port) @ fa063d8b07 with this PR's diff applied (3-way, no conflicts there; GitHub reports a conflict with current main).

guest_freetype_postscript_info passes. guest_freetype_postscript_info_nid aborts:

dlopen(.../build/core/libs/libs/libSceFreeType.prx, 0x0006): Symbol not found: _QuRm8bUpMP0
  Referenced from: <...> .../build/core/libs/libs/libSceFreeType.prx
  Expected in:     <...> .../build/core/libs/libs/unpatched/libc.prx

guest_freetype_postscript_info_tests links libc on every platform, so the process starts with unpatched/libc.prx loaded. Both libc builds have the install name @rpath/libc.prx, so when the patched libSceFreeType.prx asks for @rpath/libc.prx, dyld reuses the unpatched image that is already loaded, and it has no NID exports.

Linking libc only on Windows in PostScriptInfo.cmake, as guest_jxr_lookup_tests in #9954 does, fixes it here:

    target_link_libraries(guest_freetype_postscript_info_tests PRIVATE freetype ${CMAKE_DL_LIBS})
    if(WIN32)
        target_link_libraries(guest_freetype_postscript_info_tests PRIVATE libc)
    endif()

With that change both tests pass 3/3 (--repeat until-fail:3). I did not run Linux here, but the same pattern failed on Linux in #9646 (patched tests could not resolve NIDs until libc was linked only on Windows), so this is likely not macOS-only. #9785 has the same pattern.

Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5624615549 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9924#pullrequestreview-5624615549). Originally posted by [jotitadev](https://github.com/jotitadev) on 2026-10-23T06:14:09Z. **Review:** COMMENTED --- ### macOS test: `guest_freetype_postscript_info_nid` loads the unpatched libc Apple M2 Max, macOS 27.2, Apple clang (Xcode 27), x86-64 Release build under Rosetta 2, `BUILD_TESTING=ON`, full default build. Head `7f4475e595`. `main` does not build on macOS, so the platform is #8658 (`feat/macos-port`) @ `fa063d8b07` with this PR's diff applied (3-way, no conflicts there; GitHub reports a conflict with current `main`). `guest_freetype_postscript_info` passes. `guest_freetype_postscript_info_nid` aborts: ``` dlopen(.../build/core/libs/libs/libSceFreeType.prx, 0x0006): Symbol not found: _QuRm8bUpMP0 Referenced from: <...> .../build/core/libs/libs/libSceFreeType.prx Expected in: <...> .../build/core/libs/libs/unpatched/libc.prx ``` `guest_freetype_postscript_info_tests` links `libc` on every platform, so the process starts with `unpatched/libc.prx` loaded. Both libc builds have the install name `@rpath/libc.prx`, so when the patched `libSceFreeType.prx` asks for `@rpath/libc.prx`, dyld reuses the unpatched image that is already loaded, and it has no NID exports. Linking `libc` only on Windows in `PostScriptInfo.cmake`, as `guest_jxr_lookup_tests` in #9954 does, fixes it here: ```cmake target_link_libraries(guest_freetype_postscript_info_tests PRIVATE freetype ${CMAKE_DL_LIBS}) if(WIN32) target_link_libraries(guest_freetype_postscript_info_tests PRIVATE libc) endif() ``` With that change both tests pass 3/3 (`--repeat until-fail:3`). I did not run Linux here, but the same pattern failed on Linux in #9646 (patched tests could not resolve NIDs until `libc` was linked only on Windows), so this is likely not macOS-only. #9785 has the same pattern. Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
MarcZX10 commented 2026-10-23 06:17:04 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-23T06:17:04Z.

Review: CHANGES_REQUESTED


Follow-up on exact head 7f4475e5952532219815234d8810f26cb9b42b5d: a focused Apple Clang/macOS run now confirms the new guest_freetype_postscript_info_nid test fails for the same loader collision found in #9933. PostScriptInfo.cmake links libc unconditionally, causing dyld to load unpatched libc.prx before the patched FreeType PRX resolves its libc dependency; _QuRm8bUpMP0 is then missing. Please link libc only for Windows (or provide another platform-correct patched-library resolution) and rerun both focused CTests on macOS. The reported conditional-link change passes 3/3. Current-main sync still reports the docs/dev/debt/libSceFreeType.md conflict and shared core/libs/CMakeLists.txt, so also retain the previously requested refresh and overlap distinction for #9453/#9462. The implementation tests reported on Windows do not cover this macOS test setup.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5624635820 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9924#pullrequestreview-5624635820). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-23T06:17:04Z. **Review:** CHANGES_REQUESTED --- Follow-up on exact head `7f4475e5952532219815234d8810f26cb9b42b5d`: a focused Apple Clang/macOS run now confirms the new `guest_freetype_postscript_info_nid` test fails for the same loader collision found in #9933. `PostScriptInfo.cmake` links `libc` unconditionally, causing dyld to load unpatched `libc.prx` before the patched FreeType PRX resolves its libc dependency; `_QuRm8bUpMP0` is then missing. Please link `libc` only for Windows (or provide another platform-correct patched-library resolution) and rerun both focused CTests on macOS. The reported conditional-link change passes 3/3. Current-main sync still reports the `docs/dev/debt/libSceFreeType.md` conflict and shared `core/libs/CMakeLists.txt`, so also retain the previously requested refresh and overlap distinction for #9453/#9462. The implementation tests reported on Windows do not cover this macOS test setup.
MarcZX10 commented 2026-10-29 11:27:13 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-29T11:27:13Z.

Review: CHANGES_REQUESTED


Re-reviewed exact submitted head b2a5fccfb1f8748cd4ae155fcf7c7527796edff0. The author’s Windows and WSL/Linux report is comprehensive: complete libs builds, public-header audit and 64 header batches, plus 5 focused runtime cases (70/70 selected CTests on each platform). The prior macOS loader issue is addressed in the test CMake by linking the unpatched libc only on Windows; the remaining Mac/console limits are stated. I independently checked the current-main merge preview (git merge-tree is clean), git diff --check and tools/check_conventions.py against live main ba5b5330b37724bca4b99f30faab504653635a04; both checks pass.

The tested base in the description is 5d52b06ff3, and the claimed final recheck 801d5b9bc1 predates live main. Since that base, main has changed this contribution’s shared integration paths: core/libs/CMakeLists.txt, the FreeType module CMake/API/guest headers, and libSceFreeTypeOt/Export.cpp. These affect target registration, public declarations and the corresponding same-NID throwing helper. Please merge live main while retaining the PostScript API and loader fix, then rerun the focused FreeType tests, public-header check and conventions on that integrated head. The current clean merge preview and the earlier 70-test report do not validate those later shared-path changes; I did not rerun the C++ suite locally.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5696922538 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9924#pullrequestreview-5696922538). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-29T11:27:13Z. **Review:** CHANGES_REQUESTED --- Re-reviewed exact submitted head `b2a5fccfb1f8748cd4ae155fcf7c7527796edff0`. The author’s Windows and WSL/Linux report is comprehensive: complete `libs` builds, public-header audit and 64 header batches, plus 5 focused runtime cases (70/70 selected CTests on each platform). The prior macOS loader issue is addressed in the test CMake by linking the unpatched `libc` only on Windows; the remaining Mac/console limits are stated. I independently checked the current-main merge preview (`git merge-tree` is clean), `git diff --check` and `tools/check_conventions.py` against live `main` `ba5b5330b37724bca4b99f30faab504653635a04`; both checks pass. The tested base in the description is `5d52b06ff3`, and the claimed final recheck `801d5b9bc1` predates live main. Since that base, main has changed this contribution’s shared integration paths: `core/libs/CMakeLists.txt`, the FreeType module CMake/API/guest headers, and `libSceFreeTypeOt/Export.cpp`. These affect target registration, public declarations and the corresponding same-NID throwing helper. Please merge live main while retaining the PostScript API and loader fix, then rerun the focused FreeType tests, public-header check and conventions on that integrated head. The current clean merge preview and the earlier 70-test report do not validate those later shared-path changes; I did not rerun the C++ suite locally.
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!9924
No description provided.