feat(libSceFreeTypeOt): implement FT_Render_Glyph_Internal #17779

Merged
zkiller1236 merged 2 commits from upstream-pr/17779 into main 2026-11-12 05:08:32 +00:00
zkiller1236 commented 2026-11-09 15:39:55 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by zkiller1236 on 2026-11-09T15:39:55Z.


What

libSceFreeTypeOt exported NID 8A0cAU4yBVY as an unnamed throwing placeholder. The pinned NID database (tools/nid_names.py) names it FT_Render_Glyph_Internal, FreeType's internal ftobjs.h function FT_Error FT_Render_Glyph_Internal(FT_Library, FT_GlyphSlot, FT_Render_Mode). It is now implemented in Export.cpp and declared in include/GlyphSlot.hpp, the module's copy of the ftobjs.h declarations.

In FreeType, the public FT_Render_Glyph(slot, mode) checks the slot and its face and then calls FT_Render_Glyph_Internal(FT_FACE_LIBRARY(slot->face), slot, mode) (ftobjs.c). So when the library passed in is the slot's own library, the two are the same call, and the new export returns the libSceFreeType FT_Render_Glyph wrapper's result. Everything else throws: a null library or slot, a slot without a face, a slot whose library is a different one, and a slot that is not the glyph slot of one of the library's faces. Rendering with another library's renderers is not modelled, and libSceFreeTypeOt's own glyph-slot helpers give slot->internal a different meaning from libSceFreeType's, so only slots that libSceFreeType created are accepted. A debt entry records this and that the prototype is unverified for the provider. The progress report counts the export as a stub because these unsupported inputs deliberately call NotImplemented_nid_no_patch; the supported case renders, as the test below shows.

Tested

Linux x86-64, GCC, Release with BUILD_TESTING=ON, on main ffe575754a.

  • New guest_freetype_ot_render_internal passes. It opens the SquareGlyphFont fixture, loads glyph 1 at 24 px, renders it through FT_Render_Glyph_Internal in FT_RENDER_MODE_NORMAL and FT_RENDER_MODE_MONO, and compares the result code, format, bitmap size, pitch, origin and every bitmap byte with host FreeType's FT_Render_Glyph. It renders the already-rendered slot again, and checks that a different library, a null library, a null slot and an unregistered copy of the slot each throw.
  • The patched libSceFreeTypeOt.prx exports 8A0cAU4yBVY at the new function's address (nm -D). On main the export is a placeholder that throws.
  • The 47 other guest_freetype* tests that were built pass.
  • check_conventions.py --base origin/main passes. pr_overlap.py reports no shared exports; #15052 and #16122 also append test registrations at the end of libSceFreeTypeOt/CMakeLists.txt, and ten PRs that conflict with main could not be compared; none of their diffs mention this NID or name. It merges cleanly with #17772 and #17776.
  • Reviewed before opening by a separate AI reviewer (Claude Sonnet), which checked the equivalence against FreeType 2.15.0's FT_Render_Glyph_Internal (including its colour-layer and bitmap-slot paths, which the wrapper reaches through host FT_Render_Glyph) and found nothing blocking.

Windows was not built here; PS5/title execution is untested.

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

Claude Code assisted with the investigation, implementation, tests and review.

🤖 Generated with Claude Code

https://claude.ai/code/session_0145C1bggApen1Stz87XDkXo

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5226578694 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/17779). Originally posted by [zkiller1236](https://github.com/zkiller1236) on 2026-11-09T15:39:55Z. --- ### What libSceFreeTypeOt exported NID `8A0cAU4yBVY` as an unnamed throwing placeholder. The pinned NID database (`tools/nid_names.py`) names it `FT_Render_Glyph_Internal`, FreeType's internal `ftobjs.h` function `FT_Error FT_Render_Glyph_Internal(FT_Library, FT_GlyphSlot, FT_Render_Mode)`. It is now implemented in `Export.cpp` and declared in `include/GlyphSlot.hpp`, the module's copy of the `ftobjs.h` declarations. In FreeType, the public `FT_Render_Glyph(slot, mode)` checks the slot and its face and then calls `FT_Render_Glyph_Internal(FT_FACE_LIBRARY(slot->face), slot, mode)` ([`ftobjs.c`](https://github.com/freetype/freetype/blob/VER-2-15-0/src/base/ftobjs.c)). So when the library passed in is the slot's own library, the two are the same call, and the new export returns the libSceFreeType `FT_Render_Glyph` wrapper's result. Everything else throws: a null library or slot, a slot without a face, a slot whose library is a different one, and a slot that is not the glyph slot of one of the library's faces. Rendering with another library's renderers is not modelled, and libSceFreeTypeOt's own glyph-slot helpers give `slot->internal` a different meaning from libSceFreeType's, so only slots that libSceFreeType created are accepted. A debt entry records this and that the prototype is unverified for the provider. The progress report counts the export as a stub because these unsupported inputs deliberately call `NotImplemented_nid_no_patch`; the supported case renders, as the test below shows. ### Tested Linux x86-64, GCC, Release with `BUILD_TESTING=ON`, on `main` ffe575754a. - New `guest_freetype_ot_render_internal` passes. It opens the `SquareGlyphFont` fixture, loads glyph 1 at 24 px, renders it through `FT_Render_Glyph_Internal` in `FT_RENDER_MODE_NORMAL` and `FT_RENDER_MODE_MONO`, and compares the result code, format, bitmap size, pitch, origin and every bitmap byte with host FreeType's `FT_Render_Glyph`. It renders the already-rendered slot again, and checks that a different library, a null library, a null slot and an unregistered copy of the slot each throw. - The patched `libSceFreeTypeOt.prx` exports `8A0cAU4yBVY` at the new function's address (`nm -D`). On `main` the export is a placeholder that throws. - The 47 other `guest_freetype*` tests that were built pass. - `check_conventions.py --base origin/main` passes. `pr_overlap.py` reports no shared exports; #15052 and #16122 also append test registrations at the end of `libSceFreeTypeOt/CMakeLists.txt`, and ten PRs that conflict with `main` could not be compared; none of their diffs mention this NID or name. It merges cleanly with #17772 and #17776. - Reviewed before opening by a separate AI reviewer (Claude Sonnet), which checked the equivalence against FreeType 2.15.0's `FT_Render_Glyph_Internal` (including its colour-layer and bitmap-slot paths, which the wrapper reaches through host `FT_Render_Glyph`) and found nothing blocking. Windows was not built here; PS5/title execution is untested. <!-- 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 - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes Claude Code assisted with the investigation, implementation, tests and review. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_0145C1bggApen1Stz87XDkXo
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!17779
No description provided.