Skip to content

feat(libSceFont): implement sceFontGlyphRenderImage, Horizontal and Vertical - #7797

Closed
root-over wants to merge 1 commit into
boykopovar:mainfrom
root-over:feat/libscefont-glyph-render-image
Closed

root-over wants to merge 1 commit into
boykopovar:mainfrom
root-over:feat/libscefont-glyph-render-image

Conversation

@root-over

Copy link
Copy Markdown
Contributor

What

Implements sceFontGlyphRenderImage, sceFontGlyphRenderImageHorizontal and sceFontGlyphRenderImageVertical (libSceFont, +3 implemented functions).

  • A glyph from sceFontGenerateCharGlyph is drawn as its font draws the same character with sceFontRenderCharGlyphImage and its Horizontal and Vertical forms, at the pixel scale the glyph was generated with rather than the font's render scale. A style frame on the surface, then the one passed in, override that scale and add their slant and weight.
  • The renderer passed in is checked (SCE_FONT_ERROR_INVALID_RENDERER) and need not be bound to the font. Deleted or foreign glyphs, invalid style frames, null outputs and glyphs whose font was closed return the codes the library's other glyph and render calls return.
  • RenderCharGlyphImageCore keeps its checks and now draws through RenderCharGlyphImageStyled, which takes an explicit style; the style frame fields move from ResolveSurfaceStyleState to ApplyStyleFrame. Existing behaviour is unchanged.
  • Sources: signatures from SharpProspero. No title is known to call these; shadPS4, KytyPS5 and RPCS3's PS3 cellFontGlyphRenderImage leave them unimplemented. The model and the unconfirmed parts are recorded in docs/dev/debt/libSceFont.md.

FontFixture::BuildFont now accepts glyf and loca tables, so guest_font can open a font with a real square glyph. No test in the repository rendered a glyph before.

Overlap: #6581 also changes Render.cpp and GuestFont.cpp, in other functions (glyph attributes); whichever lands second has a trivial rebase.

Tested

Linux (Ubuntu, GCC 15.2.0, Release, BUILD_TESTING=ON):

  • guest_font compares each glyph call with the matching character call pixel for pixel, with metrics and update rectangle, with and without a style frame, on the surface and passed in, plus the error paths. Removing the glyph scale or the passed-in frame from the implementation makes it fail.
  • Font tests (guest_font, guest_system_font, guest_font_writing_line, font_face_lifetime*) pass. Full suite: the only failures are agc_driver_image_table_vouched_lookups and agc_driver_pixel_sample_iteration, which fail the same way on main on this machine (AMD Radeon Vega iGPU, RADV) and do not involve libSceFont.
  • tools/progress.py --compare: libraries 91.51% → 91.59%, +3 implemented.
  • tools/check_conventions.py --base origin/main passes.

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
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes

…ertical

The three calls draw a glyph from sceFontGenerateCharGlyph as its font
draws the same character with sceFontRenderCharGlyphImage and its
Horizontal and Vertical forms, at the pixel scale the glyph was generated
with. A style frame on the surface, then the one passed in, override the
scale and add slant and weight. The renderer passed in is checked and
need not be bound to the font. The signatures follow SharpProspero; the
model is recorded in the libSceFont technical debt.

RenderCharGlyphImageCore keeps its checks and now draws through
RenderCharGlyphImageStyled with an explicit style, and the style frame
fields move from ResolveSurfaceStyleState to ApplyStyleFrame. The font
fixture accepts glyf and loca tables, and guest_font renders a square
glyph to compare the glyph calls with the character calls pixel for
pixel.
@github-actions

Copy link
Copy Markdown

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 6581 core/libs/prx/libSceFont/src/Unimplemented.cpp L81-100

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

@root-over

Copy link
Copy Markdown
Contributor Author

Closing: this is the same set of calls as #2150, which was closed because no title is known to reach sceFontGlyphRenderImage* on main. I'll reopen it with the title ID and the log line if one turns up. The square-glyph fixture and the pixel comparison in guest_font are on the branch if that work is picked up again.

@root-over root-over closed this Oct 19, 2026
@root-over
root-over deleted the feat/libscefont-glyph-render-image branch October 19, 2026 10:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant