feat(libharfbuzz): implement hb_ot_tag_to_script #15365
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/15365"
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 zzokm on 2026-11-03T03:12:19Z.
What
Align
hb_ot_tag_to_scriptinlibharfbuzzwith the reference HarfBuzz implementation and PS5 firmware 13.42 disassembly (libSceVshHarfBuzz.sprx):DFLTreturning 0 (HB_SCRIPT_INVALID);dfltfollows the general path returningDflt.mathtoZmth(0x5a6d7468).3tags to2before looking up the 10 Indic script tags (e.g.dev3->Deva).if(BUILD_TESTING)incore/libs/CMakeLists.txt.Tested
Windows 11 x86_64, built and tested with Clang 17 (
x86_64-w64-windows-gnu) against test suite covering all cases (DFLT, dflt, math, LATN, 1234, 10 Indic v2 tags, v3 folded tags, generic space padding rules, unknown tags).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)Imported from boykopovar/AnyPS5. Originally posted by BunnyFl on 2026-11-03T03:19:24Z.
Review: CHANGES_REQUESTED
I compared this against firmware 13.42's
system_ex/common_ex/lib/libSceVshHarfBuzz.sprx(sha25648cbea0616729b66473528b1b234595b4117781b76910ef0511bd4f9465e9717), which exports this NID (uKjh3hI1npw) at0x4a850. This is disassembly only, not measured on a console. I read every path to its return, including the helper at0x4a8d0. The table of ten Indic version-2 tags matches yours exactly. The rules around it don't:Differences from this PR (
core/libs/prx/libharfbuzz/Export.cpponca9a494d98):'dflt': the module special-cases only'DFLT'.'dflt'takes the general path and returns0x44666c74('Dflt'), not 0.'math': returns'Zmth'. The PR returns'Math'.'LATN'returns'LATN'(the PR gives'Latn'), and a non-letter tag such as'1234'returns0x11323334(the PR gives'Zzzz').'3'tags: a final'3'is folded to'2'before the table (at0x4a889,and $0xffffff32), so'dev3'returns'Deva'. The PR falls through to its letter check and returns'Zzzz'.'xy 'repeatsytwice and any'xyz 'repeatsz(0x4a89d-0x4a8c1), so'abc 'gives'Abcc'. The PR special-cases only four tags and returns'Zzzz'for the rest.These rules look like upstream HarfBuzz's
hb_ot_tag_to_scriptinhb-ot-tag.cc, but I haven't compared the source line by line; the disassembly above is the reference. Could you cover cases 1-5 inGuestHarfBuzz.cpp, withmainas the negative control?Separately: the body isn't the template that
AGENTS.mdasks for, and it opens with a shadPS4GPL-2.0-or-laterSPDX header. Is any of this code derived from shadPS4? If so, that needs saying.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-03T03:24:04Z.
Review: CHANGES_REQUESTED
Reviewed — changes requested
The implementation differs from HarfBuzz’s tag-conversion rules on several inputs, registers its test outside
BUILD_TESTING, and fails the repository’s PR-template check.What I ran
Reviewed head
ca9a494d983593a6293a039e01fccbb8f5784882against basef6232fcfda70644495273f6b8dd88cf0603463d6; the stack check reported a clean merge preview. Environment: Debian GNU/Linux x86_64, Python 3.11.2, Git 2.39.5, GCC 12.2.0. No product build or C++ tests were run.Commands and inspected sources:
The author reports running
ctest -R guest_harfbuzz -Von Windows 11 x86_64 with Clang 17; I did not independently run that command.Results
BUILD_TESTINGCommands and unedited check output
git diff --check ...:PR precheck summary (full report:
/tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-15365-ca9a494d9835/report.md):Unedited conventions output:
Unedited isolated-snapshot helper errors:
The ABI audit was rerun from the workspace against the same base/head and passed with 35 symbols and no findings. The precheck’s failed isolated helper launches are not evidence of an ABI or test-quality defect.
Negative control
Not run: the C++ test requires an exact-head build. The existing test does not currently assert the mismatching cases listed below, so there is no applicable no-build negative control.
Findings
Blocking
dfltas invalid, title-cases all tags, rejects non-letters, and handles only four padded tags. HarfBuzz’s implementation special-cases uppercaseDFLTandmath, otherwise applies its first-byte mask and generic padding rules; it also folds final2/3tags before looking up the Indic table. Concrete differences includedflt→Dflt,math→Zmth,LATN→LATN,1234→0x11323334,dev3→Deva, andabc→Abcc. Update the mapping and tests to match the intended firmware/API behavior. The current tests assert the opposite fordflt,LATN, and numeric tags.guest_harfbuzz_testsis added after the closingendif()forif(BUILD_TESTING), althoughBUILD_TESTINGdefaults toOFF. Move the target and its test registration inside the guard so ordinary builds do not add this test executable.### What,### Tested, and### Checklistheadings, and hosted conventions fails on these missing headings. Reformat the description using the current repository template and fill its checklist.Non-blocking
docs/dev/debt/libharfbuzz.mdto cleargit diff --check.Sources
df9e6d15140d6bc5e983dcb5508ad254e76c8a0eand final2/3handlingNot verified
To get this to a good state
Match the conversion semantics to the intended reference and add assertions for the discrepant cases; place the CTest target inside
if(BUILD_TESTING); restore the required PR template headings; and remove the trailing blank line. On the updated head I will rerun the precheck, whitespace check, ABI audit, source review, and inspect the updated hosted checks; a build remains outside this initial no-build review.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-03T03:45:06Z.
Review: COMMENTED
Re-checked — new head, no blocking findings
The new head resolves the earlier behavior, test-registration, and PR-template findings; approval is withheld only while the hosted Windows job is pending.
What I ran
Re-read all five changed files at head
9873d490ae2745d586bd0b2a8d2de810ffb5c9af, against basef6232fcfda70644495273f6b8dd88cf0603463d6. The stack preview is clean against that base. Environment: Linux x86_64, Python 3.11.2, GCC 12.2.0. I did not build or run CTest.I also compared the implementation with the pinned upstream HarfBuzz conversion source and manually verified the test target is inside
if(BUILD_TESTING).Results
guest_harfbuzzis underBUILD_TESTINGCommands and unedited output
git diff --check ...exited 0 with no output.Conventions output:
Test registration output:
ABI audit summary output:
Test-quality heuristic output:
The heuristic is a false positive:
core/libs/CMakeLists.txtregistersguest_harfbuzz_testsfromtests/GuestHarfBuzz.cppandguest_harfbuzzinside theBUILD_TESTINGblock.Precheck table copied from
report.md:The precheck's ABI and test-quality helper launches failed because those optional helper files are not in its isolated PR snapshot. The workspace ABI audit above ran successfully on the exact base/head.
Hosted checks at final refresh:
Negative control
I did not run a negative control. The updated test covers DFLT/dflt, math, upper/lower-case general tags, numeric tags, all ten version-2 Indic mappings, folded version-3 tags, generic space padding, and unknown digit tags; it has not been executed locally because that requires a build.
Findings
Blocking
None found in the source-level review.
Non-blocking
No additional non-blocking code findings. The workspace test-quality heuristic warning is resolved by the manual CMake registration check described above.
Sources
Not verified
I did not build AnyPS5 or execute
guest_harfbuzz; the Windows hosted job is pending. The precheck’s isolated helper invocations were unavailable, although the workspace ABI audit succeeded and the registration warning was checked against CMake.To get this to a good state
No code change is requested from this review. Let the Windows job finish. If the head changes, I will rerun the precheck, re-read the complete diff, and repeat the ABI and registration checks on the new SHA; after required CI passes, I can reconsider approval.
Imported from boykopovar/AnyPS5. Originally posted by BunnyFl on 2026-11-03T03:57:55Z.
Review: APPROVED
Re-review of
9873d490ae: all five points from my review are addressed.hb_ot_tag_to_scriptincore/libs/prx/libharfbuzz/Export.cppnow follows the firmware 13.42 body at0x4a850path for path: the'2'/'3'check with& 0xFFFFFF32folding before the ten-entry table (else'Zzzz'),'DFLT'only,'math'to'Zmth', generic space padding, andtag & ~0x20000000.The padding masks are
0xFF00/0xFFwhere the module uses0xdf00/0xdf(0x4a8a2,0x4a8b4). The result is identical: the target byte is a space (0x20) in both cases, and(c & 0xdf) | 0x20 == c | 0x20.Windows 11, WinLibs GCC, merged onto current
main:guest_harfbuzzpasses. It covers'dflt'→'Dflt','math'→'Zmth','LATN'unchanged,'1234'→0x11323334,'dev3'→'Deva','abc '→'Abcc'and unknown'2'/'3'tags→'Zzzz'. With main'sExport.cppandInventoryExports.hpprestored the test doesn't build (it calls the new signature), so there's no runtime negative control.