feat(font): open system font sets from a font directory #461
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/461"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-03T13:52:14Z.
What
sceFontOpenFontSetfails 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:
ANYPS5_SYSTEM_FONTSif set (it must be a directory, otherwise the open throws), elseanyps5-fonts/beside the generated executable.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}.ttfand 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).SCE_FONT_ERROR_FONT_OPEN_FAILED, as now, and the title shows no text in that font.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 inTechnicalDebt.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
sceFontCreateRendererthen failed withALLOCATION_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:
Tested
BUILD_TESTING=ONandctestpass (318/318), rebased onmain2707b3a3c.guest_system_fonttest (core/libs/tests/GuestSystemFont.cpp, generated TrueType fonts in a temporary font directory): an empty directory givesFONT_OPEN_FAILEDand an unknown set typeNO_SUPPORT_FONTSET; a missingANYPS5_SYSTEM_FONTSdirectory 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. Againstmain's library it fails (the missing directory does not throw, and no set opens).Unimplemented.cpp.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)