Repository navigation
feat(libSceFont): open the other script files of a system font set - #8058
Conversation
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
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.
|
rahul05ranjan
left a comment
There was a problem hiding this comment.
This fills in a real gap in a careful way. Things I traced in the diff and confirmed:
FallbackFamiliesbit logic matches the tests exactly:0x1807A444(scripts0xA4) gets Japanese before ChineseGb while0x1807AC44(scripts0xAC, hitting the0x88case) puts ChineseGb first, and theaddlambda's dedupe means the later bare-0x80addis a no-op rather than a duplicate. The Korean-face substitution index (substituteSubFont: 1for Hangul) picking Noto Sans CJK's Korean face is the detail that makes the substitute path actually work.- The candidate dedupe via
opened()is load-bearing: a Latin-primary set that fell back toNotoSans-Regular.ttfwould otherwise re-open the same file as its Vietnamese fallback. sceFontOpenFontInstancere-creating each fallback face per instance is the right ownership call — it keeps every handle with its own mutableFT_Face, so theFT_Set_Char_Sizetraffic inRenderCharGlyphImageCorecan't stomp another handle's sizing. AndFontObj fallback = *objwithsetCharSize(&fallback)is a neat way to reuse the whole render path without touching the primary face's state.- Kerning across files returning 0 (same-face-only rule in the new
LoadKerning) matches what a console would do between two different font files, and the tests pin it. - The debt-file honesty is good: the script bits are SDK-set-name-derived, not measured, and the primary-only answers of
sceFontGetCharGlyphCode/sceFontGetFontGlyphsCountare recorded.
One thing to keep an eye on, no change requested: SystemFontBytes(fallback.path) is re-read from disk for every opened set, so a title that opens several multi-script sets loads one copy of each fallback file per set — the CJK .ttc substitutes are the heavy ones. The primary file already behaved this way, so it's consistent, but if a memory report ever comes in from a font-heavy title, a process-wide bytes cache keyed by path would be the lever.
The test coverage is the strong part: metrics, instances, kerning across files, rendered pixels for each script, and the no-Hangul-in-JP_AR negative case, with the fail-on-main check to prove the tests actually exercise the new behavior.
|
Manual check of the files the overlap report could not compare. #6044 moves |
|
Windows 11, Ryzen 5 9600X, WinLibs GCC 15.2.0 (UCRT), Release,
I compared the code with the shadPS4 file the debt cites. It links
AI-assisted: yes (Claude Code); results above were run on this machine. |
|
@wachi35676 @HQasper Thank you for the review and implementation. HQasper/AnyPS5#5 corrects the Hangul Light mapping and debt attribution, with a regression test. All six focused Font tests pass locally with zero skips. Ready for your review and integration. |
What
sceFontOpenFontSetopened only a set's primary file, so a set that covers several scripts (..._JP_AR,..._JPCJK_TH,..._GBCJK, ...) reported its other scripts' characters as unsupported glyphs. A set now also opens the files of the scripts its type names (Vietnamese, Thai, Japanese, simplified Chinese, Hangul, Arabic), or their Noto substitutes, and a character the primary file lacks is measured, rendered, outlined and kerned with the first of them that has it. The script bits and the file order follow the SDK set names as shadPS4 lists them, not a console measurement; this is recorded indocs/dev/debt/libSceFont.md.docs/user/USAGE.mdlists the extra files and the Noto Sans Arabic and Korean substitutes.Tested
Linux (gcc, Release):
guest_system_font,guest_font,guest_font_writing_lineand the threefont_face_lifetimetests pass. The new checks inguest_system_fontopen sets with Japanese, Chinese-first CJK, Hangul, Arabic and Vietnamese files and check metrics, an instance, kerning across files and rendered pixels; on unchangedmainthe test aborts at the first of them (line 132). No title was run.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)