Skip to content

feat(font): open system font sets from a font directory - #461

Merged
oneandonlydean merged 1 commit into
boykopovar:mainfrom
oneandonlydean:feat/font-system-font-sets
Oct 5, 2026
Merged

oneandonlydean merged 1 commit into
boykopovar:mainfrom
oneandonlydean:feat/font-system-font-sets

Conversation

@oneandonlydean

@oneandonlydean oneandonlydean commented Oct 3, 2026 •

Copy link
Copy Markdown
Collaborator

What

sceFontOpenFontSet fails for every set type, so titles draw no text in the system fonts. In PPSA21564 that is the copyright line on the title screen, the credits and the button guides.

It now loads the set's primary font file from a font directory and opens it like a font file the title passes in:

  • Where: ANYPS5_SYSTEM_FONTS if set (it must be a directory, otherwise the open throws), else anyps5-fonts/ beside the generated executable.
  • What: the console's own file for the set under its own name first (SST-Roman.otf, SST-Bold.otf, SSTJpPro-Regular.otf, DFHEI5-SONY.ttf, ...), then an openly licensed substitute when that file is absent: Noto Sans for Latin and Vietnamese (NotoSans-{Light,Regular,Medium,Bold}.ttf and their italics), Noto Sans Mono for the typewriter sets, Noto Sans Thai for Thai, and Noto Sans CJK (NotoSansCJK-{Light,Regular,Medium,Bold}.ttc; the JP face for Japanese, SC for Chinese GB).
  • Without either: the open fails with SCE_FONT_ERROR_FONT_OPEN_FAILED, as now, and the title shows no text in that font.
  • The PS5-only JG2 set types (0x1A......) are accepted; their console file names are unknown, so they use the SSTJpPro files.

No font files are added to the repository; the user provides them. The file list is in docs/user/USAGE.md (Runtime layout, System fonts), and the gaps are in TechnicalDebt.md: only the set's primary file is opened, so characters the console takes from the set's other files are reported as unsupported glyphs, and a substitute's metrics differ from the console's.

System font handles use the system font context. Their faces are loaded by FreeType in host memory: about 1 MiB per CJK face does not fit the font memory a title sizes for the console's fonts, and sceFontCreateRenderer then failed with ALLOCATION_FAILED. Handles of the same font file share one copy of its bytes.

Why Noto

The Noto set is under the SIL Open Font License and covers every script the system sets need (Latin, Vietnamese, Thai, Japanese, Chinese) in the four weights they use. It is not the system font, so widths, line height and wrapping differ from the console, as the technical debt entry says. I also tried Source Sans 3, which is close for Latin text but has no Thai or CJK.

Title screen of PPSA21564, left: PS5 (phone photo), middle: Source Sans 3, right: Noto Sans. The copyright line along the bottom is the system font text:

PS5, Source Sans 3 and Noto Sans on the PPSA21564 title screen

Tested

  • Linux (CachyOS, x86-64): full build with BUILD_TESTING=ON and ctest pass (318/318), rebased on main 2707b3a.
  • New guest_system_font test (core/libs/tests/GuestSystemFont.cpp, generated TrueType fonts in a temporary font directory): an empty directory gives FONT_OPEN_FAILED and an unknown set type NO_SUPPORT_FONTSET; a missing ANYPS5_SYSTEM_FONTS directory throws; the console file is preferred, and once it is removed the substitute opens while an open handle keeps its face; each set type picks its family and weight (light, italic, Thai, Vietnamese, JG2 Japanese from the CJK file); a set with no file fails to open; glyph metrics and the horizontal layout come from the loaded face; font instances and memory fonts keep working; everything allocated is freed. Against main's library it fails (the missing directory does not throw, and no set opens).
  • PPSA21564: the title-screen copyright line, credits and button guides draw (image above); on my integration branch since 2026-10-03 through repeated passes of my visual regression check (checkpoint frames, flicker, shimmer, video tearing, FPS).
  • The only other open PR touching libSceFont is feat(libs): add exports imported by PPSA12544 #699, which adds two unrelated stubs to Unimplemented.cpp.

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 (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
  • AI-assisted: yes

sceFontOpenFontSet failed for every set type, so PPSA21564 drew no text
in system fonts (the title screen copyright line, credits, button
guides). It now loads the set's primary font file from
ANYPS5_SYSTEM_FONTS, or anyps5-fonts beside the executable: console
files under their own names first, then openly licensed substitutes
(Noto Sans, Noto Sans Mono, Noto Sans Thai, Noto Sans CJK). The
PS5-only JG2 set types are accepted.

System font handles use the system font context. Their faces are
loaded by FreeType in host memory: about 1 MiB per CJK face does not
fit the font memory the title sizes for the console's fonts, and
sceFontCreateRenderer then failed with ALLOCATION_FAILED. Handles of
the same font file share one copy of its bytes.
@oneandonlydean
oneandonlydean force-pushed the feat/font-system-font-sets branch from a13642d to 9d4e6d2 Compare October 5, 2026 21:29
@oneandonlydean
oneandonlydean merged commit f00750e into boykopovar:main Oct 5, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build docs needs rebase Conflicts with main, rebase needed prx

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant