feat(font): render generated glyph images #2150

Closed
erick-dsnk wants to merge 1 commit from upstream-pr/2150 into main
erick-dsnk commented 2026-10-09 10:06:47 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by erick-dsnk on 2026-10-09T10:06:47Z.


What

Implements sceFontGlyphRenderImage, sceFontGlyphRenderImageHorizontal, and sceFontGlyphRenderImageVertical for generated glyphs using the FreeType renderer. The renderer retains font bytes, face/glyph indices, and creation scale so glyph rendering survives source-font closure and later owner-scale changes. It handles horizontal and vertical placement, clipping, 1-byte and 4-byte surfaces, and rejects unsupported style/effect/renderer cases with NotImplemented_nid_no_patch.

The export signatures are independently declared by Orbital's IDA type database and SharpProspero bindings. Console rendering semantics have not been confirmed with a title; the supported model and inferred behavior are recorded in TechnicalDebt. This implementation rasterizes the retained source glyph, so mutable outline edits and later glyph attributes are not applied. Creation slant/weight effects, nonzero form options, non-FreeType renderers, and unresolved style modes remain unsupported.

Tested

  • Linux: cmake --build build --target libs --parallel 2
  • Linux: cmake --build build --target guest_font_tests guest_font_writing_line_tests --parallel 2
  • Linux: ctest --test-dir build --output-on-failure -R '^(guest_font|guest_font_writing_line)$' (2 passed)
  • Linux: python3 tools/check_conventions.py --base 3bd74c155db06c4dba07441b28f570121475b9b1
  • Synthetic in-repo outline tests check exact pixels and rectangles, DPI/point-scale snapshots, horizontal and vertical placement, clipping, padded 4-byte rows, source-font close, invalid/deleted glyphs, and overflow/empty clipping.
  • No PS5 title run; console behavior remains unverified.

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 in TechnicalDebt
  • No notes, investigation .md files or images added to the repository
  • New third-party code is a submodule built from source (no third-party code added)
  • Generic behaviour, not specific to one title
  • Depends on: none
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4798973594 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2150). Originally posted by [erick-dsnk](https://github.com/erick-dsnk) on 2026-10-09T10:06:47Z. --- ### What Implements `sceFontGlyphRenderImage`, `sceFontGlyphRenderImageHorizontal`, and `sceFontGlyphRenderImageVertical` for generated glyphs using the FreeType renderer. The renderer retains font bytes, face/glyph indices, and creation scale so glyph rendering survives source-font closure and later owner-scale changes. It handles horizontal and vertical placement, clipping, 1-byte and 4-byte surfaces, and rejects unsupported style/effect/renderer cases with `NotImplemented_nid_no_patch`. The export signatures are independently declared by Orbital's IDA type database and SharpProspero bindings. Console rendering semantics have not been confirmed with a title; the supported model and inferred behavior are recorded in TechnicalDebt. This implementation rasterizes the retained source glyph, so mutable outline edits and later glyph attributes are not applied. Creation slant/weight effects, nonzero form options, non-FreeType renderers, and unresolved style modes remain unsupported. ### Tested - Linux: `cmake --build build --target libs --parallel 2` - Linux: `cmake --build build --target guest_font_tests guest_font_writing_line_tests --parallel 2` - Linux: `ctest --test-dir build --output-on-failure -R '^(guest_font|guest_font_writing_line)$'` (2 passed) - Linux: `python3 tools/check_conventions.py --base 3bd74c155db06c4dba07441b28f570121475b9b1` - Synthetic in-repo outline tests check exact pixels and rectangles, DPI/point-scale snapshots, horizontal and vertical placement, clipping, padded 4-byte rows, source-font close, invalid/deleted glyphs, and overflow/empty clipping. - No PS5 title run; console behavior remains unverified. ### 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 - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed in TechnicalDebt - [x] No notes, investigation `.md` files or images added to the repository - [x] New third-party code is a submodule built from source (no third-party code added) - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] AI-assisted: yes
popcoder565 commented 2026-10-09 15:46:47 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by popcoder565 on 2026-10-09T15:46:47Z.


Native Windows run, since no Windows results were posted. Setup: Windows 10 (19045), MinGW-w64 GCC 15.2.0 (WinLibs r7), Release. Head 3aa719ec, merged onto main d70b8998 in one build with 38 other PRs that had no Windows run.

  • This PR's tests pass: guest_font. None of them reported skipping a case.
  • Full ctest in that build: 519 of 519. That needed local fixes to three other PRs in the batch that don't build or pass on Windows: #1611, #1796 and #1824 (reported there).

No title was run.

🤖 Addressed by Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6084277387 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2150#issuecomment-6084277387). Originally posted by [popcoder565](https://github.com/popcoder565) on 2026-10-09T15:46:47Z. --- Native Windows run, since no Windows results were posted. Setup: Windows 10 (19045), MinGW-w64 GCC 15.2.0 (WinLibs r7), Release. Head `3aa719ec`, merged onto `main` d70b8998 in one build with 38 other PRs that had no Windows run. - This PR's tests pass: `guest_font`. None of them reported skipping a case. - Full ctest in that build: 519 of 519. That needed local fixes to three other PRs in the batch that don't build or pass on Windows: #1611, #1796 and #1824 (reported there). No title was run. _🤖 Addressed by [Claude Code](https://claude.com/claude-code)_
oneandonlydean commented 2026-10-09 20:15:11 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-09T20:15:11Z.


Which title reaches sceFontGlyphRenderImage (or the horizontal/vertical variants) on main? With the ID and the log line this can go in; otherwise I will close it until one does.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6088516932 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2150#issuecomment-6088516932). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-09T20:15:11Z. --- Which title reaches `sceFontGlyphRenderImage` (or the horizontal/vertical variants) on main? With the ID and the log line this can go in; otherwise I will close it until one does.
github-actions[bot] commented 2026-10-10 08:01:06 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-10T08:01:06Z.


Progress report (47d2544 → 3aa719e)

📈 System libraries: 84.76% (+0.07%, +2 implemented functions)

✅ 2 implemented
Library Name
libSceFont sceFontGlyphRenderImageHorizontal
libSceFont sceFontGlyphRenderImageVertical
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6095430589 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2150#issuecomment-6095430589). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-10T08:01:06Z. --- <!-- progress-report --> ### Progress report (47d2544 → 3aa719e) 📈 **System libraries**: 84.76% (+0.07%, +2 implemented functions) <details> <summary>✅ 2 implemented</summary> | Library | Name | | - | - | | libSceFont | `sceFontGlyphRenderImageHorizontal` | | libSceFont | `sceFontGlyphRenderImageVertical` | </details>
screamm commented 2026-10-10 22:11:32 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by screamm on 2026-10-10T22:11:32Z.


Windows validation of the current head 3aa719ec merged onto main 262c0316.

Windows 11 Pro 26220, WinLibs MinGW-w64 GCC 15.2.0 r7, Ninja, Release, BUILD_TESTING=ON, full build including the libs target.

  • guest_font, guest_font_writing_line and guest_system_font pass 3/3 (--repeat until-fail:3).
  • ctest -j8 -E "^agc_|video_out" passes 388/388.
  • With main's libSceFont/src/Render.cpp and this PR's tests, guest_font fails, so the coverage detects the previous behaviour.

Validation run with Claude Code assistance.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6102721480 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2150#issuecomment-6102721480). Originally posted by [screamm](https://github.com/screamm) on 2026-10-10T22:11:32Z. --- Windows validation of the current head `3aa719ec` merged onto `main` `262c0316`. Windows 11 Pro 26220, WinLibs MinGW-w64 GCC 15.2.0 r7, Ninja, Release, `BUILD_TESTING=ON`, full build including the `libs` target. - `guest_font`, `guest_font_writing_line` and `guest_system_font` pass 3/3 (`--repeat until-fail:3`). - `ctest -j8 -E "^agc_|video_out"` passes 388/388. - With `main`'s `libSceFont/src/Render.cpp` and this PR's tests, `guest_font` fails, so the coverage detects the previous behaviour. Validation run with Claude Code assistance.
adriadam10 commented 2026-10-11 00:08:46 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T00:08:46Z.

Review: CHANGES_REQUESTED


Checked on Linux with the PR merged onto main: guest_font and guest_font_writing_line pass, and guest_font fails with the non-test changes reverted. Windows runs by @popcoder565 and @screamm also pass.

Two things block merging:

  • Dean's question above is still open: which title calls sceFontGlyphRenderImage, sceFontGlyphRenderImageHorizontal or sceFontGlyphRenderImageVertical? A title ID and the log line are needed.
  • The output is inferred rather than known, and a plausible-but-wrong result is worse than a throw. FillGeneratedImageMetrics (Render.cpp:283: the floor/ceil rounding of left/top/right/bottom and the stride formula), the vertical placement (Render.cpp:170-183, bearingY sums and shifting by the vertical bearings) and rendering at 72 DPI after converting the point scale are not backed by any reference: shadPS4 only stubs the export and SharpProspero gives the signature only. TechnicalDebt says the same ("need title verification"). Either measure/cite where each of these comes from, or throw for the cases not known (for example keep only the horizontal export with the metrics a title is shown to need) and list the rest as unimplemented.

Minor: Render.cpp:123-125 checks flags & ~0x11 and then flags & 0x11, so the first check is redundant with the second for the flag part.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5481280576 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2150#pullrequestreview-5481280576). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-11T00:08:46Z. **Review:** CHANGES_REQUESTED --- Checked on Linux with the PR merged onto main: `guest_font` and `guest_font_writing_line` pass, and `guest_font` fails with the non-test changes reverted. Windows runs by @popcoder565 and @screamm also pass. Two things block merging: - Dean's question above is still open: which title calls `sceFontGlyphRenderImage`, `sceFontGlyphRenderImageHorizontal` or `sceFontGlyphRenderImageVertical`? A title ID and the log line are needed. - The output is inferred rather than known, and a plausible-but-wrong result is worse than a throw. `FillGeneratedImageMetrics` (`Render.cpp:283`: the `floor`/`ceil` rounding of left/top/right/bottom and the `stride` formula), the vertical placement (`Render.cpp:170-183`, `bearingY` sums and shifting by the vertical bearings) and rendering at 72 DPI after converting the point scale are not backed by any reference: shadPS4 only stubs the export and SharpProspero gives the signature only. TechnicalDebt says the same ("need title verification"). Either measure/cite where each of these comes from, or throw for the cases not known (for example keep only the horizontal export with the metrics a title is shown to need) and list the rest as unimplemented. Minor: `Render.cpp:123-125` checks `flags & ~0x11` and then `flags & 0x11`, so the first check is redundant with the second for the flag part.
oneandonlydean commented 2026-10-14 02:24:22 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-14T02:24:22Z.


Closing: the title question from 2026-10-09 (which title reaches sceFontGlyphRenderImage on main, with the log line) and the 2026-10-11 review have had no reply or push.
Reopen it, or comment here, when it's addressed; it can be picked up again then.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6159489376 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2150#issuecomment-6159489376). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-14T02:24:22Z. --- Closing: the title question from 2026-10-09 (which title reaches `sceFontGlyphRenderImage` on main, with the log line) and the 2026-10-11 review have had no reply or push. Reopen it, or comment here, when it's addressed; it can be picked up again then.

Pull request closed

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!2150
No description provided.