Skip to content

feat(font): render generated glyph images - #2150

Closed
erick-dsnk wants to merge 1 commit into
boykopovar:mainfrom
erick-dsnk:feat/font-glyph-render-images
Closed

erick-dsnk wants to merge 1 commit into
boykopovar:mainfrom
erick-dsnk:feat/font-glyph-render-images

Conversation

@erick-dsnk

Copy link
Copy Markdown
Contributor

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

Implemented with AI assistance.
@erick-dsnk
erick-dsnk marked this pull request as ready for review October 9, 2026 10:21
@popcoder565

Copy link
Copy Markdown
Contributor

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 d70b899 in one build with 38 other PRs that had no Windows run.

No title was run.

🤖 Addressed by Claude Code

@oneandonlydean

Copy link
Copy Markdown
Collaborator

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

Copy link
Copy Markdown

Progress report (47d2544 → 3aa719e)

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

✅ 2 implemented
Library Name
libSceFont sceFontGlyphRenderImageHorizontal
libSceFont sceFontGlyphRenderImageVertical

@screamm

screamm commented Oct 10, 2026

Copy link
Copy Markdown
Contributor

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 adriadam10 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs needs rebase Conflicts with main, rebase needed prx

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants