feat(libSceFontFt): implement the font format support exports #6400

Merged
Capmare merged 2 commits from upstream-pr/6400 into main 2026-10-18 23:57:52 +00:00
Capmare commented 2026-10-15 14:03:33 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Capmare on 2026-10-15T14:03:33Z.


What

Implements 11 sceFontFtSupport* exports that threw NotImplemented_nid_no_patch: Bdf, Cid, OpenType, OpenTypeOtf, OpenTypeTtf, Pcf, Pfr, TrueType, Type1, Type42 and WinFonts. The FontFt library always registers FreeType's default modules, so each call returns 0 when the host FreeType has the matching module (bdf, t1cid, cff, truetype, pcf, pfr, type1, type42, winfonts; OpenType needs cff and truetype) and throws std::runtime_error when it does not. The signatures (no parameters, as declared), the format-to-module mapping and the return value are assumptions, recorded in the new docs/dev/debt/libSceFontFt.md; shadPS4 only logs these calls.

Why return 0 is not an invented success: the driver always calls FT_Add_Default_Modules, so each format is available when the host FreeType has its module, and the call returns 0 only then. It throws when the module is missing. No console measurement exists; the debt file lists the return value as unverified.

Left unimplemented because their meaning is unknown: sceFontFtSupportTrueTypeGx, sceFontFtSupportFontFormats, sceFontFtSupportSystemFonts, the alias calls and sceFontSelectGlyphsFt.

libraries progress: 3279/3696 (88.72%) to 3290/3696 (89.02%) with tools/progress.py on the main of the first push. A reviewer measured the merge into a newer main (6efb7261b): 3480/3853 (90.32%) to 3491/3853 (90.6%).

Tested

  • Linux x86-64, full build with BUILD_TESTING=ON: guest_font (extended with the 11 calls) and guest_font_writing_line pass. With one module name changed to a wrong one, guest_font aborts.
  • python3 tools/check_conventions.py --base origin/main passes.
  • A hand-written guest ELF (not committed) imports each function by NID, is converted with the relinker and run against the built libSceFontFt.prx: all 11 return 0, and sceFontFtSupportTrueTypeGx still throws.
  • Not tested: a console, a real title or homebrew, other operating systems, GPUs (not applicable). No title is known to call these functions.

Checklist

  • Based on current main; no other open PR implements the same functions (I checked the diffs of every open PR that touches Font files)
  • 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. Overlaps #6447, which makes all 19 FontFt stubs return 0 without a module check. This PR goes first; #6447 can drop these 11 exports when it rebases.
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes. The change was written with Claude Code; I reviewed it and am responsible for it.

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4874533956 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6400). Originally posted by [Capmare](https://github.com/Capmare) on 2026-10-15T14:03:33Z. --- ### What Implements 11 `sceFontFtSupport*` exports that threw `NotImplemented_nid_no_patch`: `Bdf`, `Cid`, `OpenType`, `OpenTypeOtf`, `OpenTypeTtf`, `Pcf`, `Pfr`, `TrueType`, `Type1`, `Type42` and `WinFonts`. The FontFt library always registers FreeType's default modules, so each call returns 0 when the host FreeType has the matching module (`bdf`, `t1cid`, `cff`, `truetype`, `pcf`, `pfr`, `type1`, `type42`, `winfonts`; `OpenType` needs `cff` and `truetype`) and throws `std::runtime_error` when it does not. The signatures (no parameters, as declared), the format-to-module mapping and the return value are assumptions, recorded in the new `docs/dev/debt/libSceFontFt.md`; shadPS4 only logs these calls. Why return 0 is not an invented success: the driver always calls `FT_Add_Default_Modules`, so each format is available when the host FreeType has its module, and the call returns 0 only then. It throws when the module is missing. No console measurement exists; the debt file lists the return value as unverified. Left unimplemented because their meaning is unknown: `sceFontFtSupportTrueTypeGx`, `sceFontFtSupportFontFormats`, `sceFontFtSupportSystemFonts`, the alias calls and `sceFontSelectGlyphsFt`. `libraries` progress: 3279/3696 (88.72%) to 3290/3696 (89.02%) with `tools/progress.py` on the `main` of the first push. A reviewer measured the merge into a newer `main` (6efb7261b): 3480/3853 (90.32%) to 3491/3853 (90.6%). ### Tested - Linux x86-64, full build with `BUILD_TESTING=ON`: `guest_font` (extended with the 11 calls) and `guest_font_writing_line` pass. With one module name changed to a wrong one, `guest_font` aborts. - `python3 tools/check_conventions.py --base origin/main` passes. - A hand-written guest ELF (not committed) imports each function by NID, is converted with the relinker and run against the built `libSceFontFt.prx`: all 11 return 0, and `sceFontFtSupportTrueTypeGx` still throws. - Not tested: a console, a real title or homebrew, other operating systems, GPUs (not applicable). No title is known to call these functions. ### Checklist - [x] Based on current `main`; no other open PR implements the same functions (I checked the diffs of every open PR that touches Font files) - [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. Overlaps #6447, which makes all 19 FontFt stubs return 0 without a module check. This PR goes first; #6447 can drop these 11 exports when it rebases. - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes. The change was written with Claude Code; I reviewed it and am responsible for it. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
github-actions[bot] commented 2026-10-15 14:23:24 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-15T14:23:24Z.


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 6447 docs/dev/debt/libSceFontFt.md

Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 6044 core/libs/tests/GuestFont.cpp
PR 6447 core/libs/prx/libSceFontFt/Export.cpp
docs/dev/debt/libSceFontFt.md
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6194384542 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6400#issuecomment-6194384542). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-15T14:23:24Z. --- <!-- 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 6447](https://www.github.com/boykopovar/AnyPS5/pull/6447) | | | `docs/dev/debt/libSceFontFt.md` | Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap. | Pull request | Shared files not compared | |---|---| | [PR 6044](https://www.github.com/boykopovar/AnyPS5/pull/6044) | `core/libs/tests/GuestFont.cpp` | | [PR 6447](https://www.github.com/boykopovar/AnyPS5/pull/6447) | `core/libs/prx/libSceFontFt/Export.cpp`<br>`docs/dev/debt/libSceFontFt.md` |
Aspct3434 commented 2026-10-18 12:47:10 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Aspct3434 on 2026-10-18T12:47:10Z.

Review: COMMENTED


Tested on Windows, since the PR was tested on Linux only.

Windows 11, WinLibs GCC 15.2.0 r7, full build with the Windows CI configure flags, this PR merged into main at 6efb7261b:

  • No warnings in the changed files.
  • guest_font, guest_system_font and guest_font_writing_line pass, so all 11 module names exist in the bundled FreeType on Windows as well.
  • python tools/select_tests.py ctest build --timeout 120: 1478 tests, 0 failed; 497 skipped, all expected by tools/check_skips.py --job windows.
  • tools/progress.py on the merge: 3480/3853 (90.32%) to 3491/3853 (90.6%). The figures in the description are from an older main.

Two points that may need addressing before merge:

  1. Source for the return value. The only reference for "no parameters, returns 0" is shadPS4, where these are explicit stubs: fontft.cpp logs (STUBBED) called and returns ORBIS_OK. The Orbital IDA type database cited in the font debt files has no sceFontFt* entries, and SharpProspero and KytyPS5 have none either. Since AGENTS.md says never to return a made-up success, it may help to state in the description why 0 is not made up here (each format really is available, because the driver always calls FT_Add_Default_Modules), or to back it with a console measurement like the one in #7463.

  2. Overlap with #6447. The overlap comment lists #6447 on the same lines. It removes the NotImplemented_nid_no_patch call from all 19 libSceFontFt exports and keeps the stubs' return 0, including the eight this PR leaves throwing. The checklist says no other open PR implements these functions, so it would help to mention #6447 and agree on which goes first (Depends on).

Nit: the new debt entry links shadPS4 at blob/main; other entries pin a commit, for example 7da7a8e1f98eca9d8f01f84d20681f8faa0bd8fd.

Tested and written with help from Claude Code.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5563046216 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6400#pullrequestreview-5563046216). Originally posted by [Aspct3434](https://github.com/Aspct3434) on 2026-10-18T12:47:10Z. **Review:** COMMENTED --- Tested on Windows, since the PR was tested on Linux only. Windows 11, WinLibs GCC 15.2.0 r7, full build with the Windows CI configure flags, this PR merged into `main` at 6efb7261b: - No warnings in the changed files. - `guest_font`, `guest_system_font` and `guest_font_writing_line` pass, so all 11 module names exist in the bundled FreeType on Windows as well. - `python tools/select_tests.py ctest build --timeout 120`: 1478 tests, 0 failed; 497 skipped, all expected by `tools/check_skips.py --job windows`. - `tools/progress.py` on the merge: 3480/3853 (90.32%) to 3491/3853 (90.6%). The figures in the description are from an older `main`. Two points that may need addressing before merge: 1. **Source for the return value.** The only reference for "no parameters, returns 0" is shadPS4, where these are explicit stubs: [`fontft.cpp`](https://github.com/shadps4-emu/shadPS4/blob/7da7a8e1f98eca9d8f01f84d20681f8faa0bd8fd/src/core/libraries/font/fontft.cpp#L74-L77) logs `(STUBBED) called` and returns `ORBIS_OK`. The Orbital IDA type database cited in the font debt files has no `sceFontFt*` entries, and SharpProspero and KytyPS5 have none either. Since AGENTS.md says never to return a made-up success, it may help to state in the description why 0 is not made up here (each format really is available, because the driver always calls `FT_Add_Default_Modules`), or to back it with a console measurement like the one in #7463. 2. **Overlap with #6447.** The overlap comment lists #6447 on the same lines. It removes the `NotImplemented_nid_no_patch` call from all 19 `libSceFontFt` exports and keeps the stubs' `return 0`, including the eight this PR leaves throwing. The checklist says no other open PR implements these functions, so it would help to mention #6447 and agree on which goes first (`Depends on`). Nit: the new debt entry links shadPS4 at `blob/main`; other entries pin a commit, for example `7da7a8e1f98eca9d8f01f84d20681f8faa0bd8fd`. Tested and written with help from Claude Code.
Capmare commented 2026-10-18 13:30:03 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Capmare on 2026-10-18T13:30:03Z.


Thank you for testing on Windows.

  1. Return value: the call returns 0 only if the host FreeType has the module. The driver always calls FT_Add_Default_Modules, so the format is available when the call returns 0. If a module is missing, the call throws. There is no console measurement; the debt file lists the return value as unverified. I added this reason to the description.
  2. #6447: it overlaps on the same lines. It makes all 19 FontFt stubs return 0 and keeps the eight that this PR leaves throwing. I suggest this PR goes first, so #6447 can drop these 11 exports when it rebases. I noted this under Depends on.
  3. The shadPS4 link in the debt file now uses commit 7da7a8e1f98eca9d8f01f84d20681f8faa0bd8fd.
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6250497383 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6400#issuecomment-6250497383). Originally posted by [Capmare](https://github.com/Capmare) on 2026-10-18T13:30:03Z. --- Thank you for testing on Windows. 1. Return value: the call returns 0 only if the host FreeType has the module. The driver always calls `FT_Add_Default_Modules`, so the format is available when the call returns 0. If a module is missing, the call throws. There is no console measurement; the debt file lists the return value as unverified. I added this reason to the description. 2. #6447: it overlaps on the same lines. It makes all 19 FontFt stubs return 0 and keeps the eight that this PR leaves throwing. I suggest this PR goes first, so #6447 can drop these 11 exports when it rebases. I noted this under `Depends on`. 3. The shadPS4 link in the debt file now uses commit `7da7a8e1f98eca9d8f01f84d20681f8faa0bd8fd`.
github-actions[bot] commented 2026-10-18 23:27:25 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-18T23:27:25Z.


Progress report (385ed71 → 8489e74)

📈 System libraries: 90.6% (+0.28%, +11 implemented functions)

✅ 11 implemented
Library Name
libSceFontFt sceFontFtSupportBdf
libSceFontFt sceFontFtSupportCid
libSceFontFt sceFontFtSupportOpenType
libSceFontFt sceFontFtSupportOpenTypeOtf
libSceFontFt sceFontFtSupportOpenTypeTtf
libSceFontFt sceFontFtSupportPcf
libSceFontFt sceFontFtSupportPfr
libSceFontFt sceFontFtSupportTrueType
libSceFontFt sceFontFtSupportType1
libSceFontFt sceFontFtSupportType42
libSceFontFt sceFontFtSupportWinFonts
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6256493699 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6400#issuecomment-6256493699). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-18T23:27:25Z. --- <!-- progress-report --> ### Progress report (385ed71 → 8489e74) 📈 **System libraries**: 90.6% (+0.28%, +11 implemented functions) <details> <summary>✅ 11 implemented</summary> | Library | Name | | - | - | | libSceFontFt | `sceFontFtSupportBdf` | | libSceFontFt | `sceFontFtSupportCid` | | libSceFontFt | `sceFontFtSupportOpenType` | | libSceFontFt | `sceFontFtSupportOpenTypeOtf` | | libSceFontFt | `sceFontFtSupportOpenTypeTtf` | | libSceFontFt | `sceFontFtSupportPcf` | | libSceFontFt | `sceFontFtSupportPfr` | | libSceFontFt | `sceFontFtSupportTrueType` | | libSceFontFt | `sceFontFtSupportType1` | | libSceFontFt | `sceFontFtSupportType42` | | libSceFontFt | `sceFontFtSupportWinFonts` | </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!6400
No description provided.