feat(libSceFreeType): query glyph control boxes #9588
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/9588"
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 Ondra97 on 2026-10-22T03:30:49Z.
What
Add
FT_Glyph_Get_CBox(NIDavLzN0tTxLI) for registered bitmap and outline glyphs. Callers can query unscaled, grid-fitted, truncated and integer-pixel bounds, including after closing the original face or copying the glyph.Read the published guest geometry: outline queries reuse the existing LP64
FT_Outline_Get_CBoxadapter, while bitmap queries use the current bearings and dimensions. Preserve signed pixel shifts, modular ceiling and uint32 bitmap-dimension multiplication before widening. Null outputs do not inspect the glyph; null glyph/class inputs clear the output. Foreign storage/classes and unsupported overflowing bitmap bearings throw. Console ABI and rounding equivalence remain recorded in library debt.The name/NID follows the pinned PS5 3.20 inventory. The arithmetic follows FreeType 2.13.3 ftglyph.c and its pixel macros.
Rebased onto main
1da78eb048ddada5083efca424a4f7ed9728123a. Retain all current main APIs, declarations, build registration and tests.Glyph.cppandGuestFreeTypeGlyph.cppremain byte-identical to the previous submitted source. The diff contains six files. The OpenType provider alias keeps its NID and throws because its provider-specific ABI remains unverified; its debt lists all current provider names and 47 remaining unknown helpers, matching definitions and registrations.The implementation prerequisites and the former documentation-order dependencies #10582 and #10591 are merged into main. No open prerequisites remain.
Tested
November 6, 2026 (Europe/Prague): main base
1da78eb048ddada5083efca424a4f7ed9728123a, submitted head388ab70e2caaa1020b4d8cbac37bd5320daac3fc.Windows 11 Pro 10.0.26300; AMD Ryzen 9 7900X (AVX2); 31.7 GiB RAM; NVIDIA GeForce RTX 4070 Ti SUPER present, with no GPU qualification claimed. WinLibs GCC 15.2.0 r7 UCRT; Ninja Release;
BUILD_TESTING=ON,ANYPS5_ENABLE_SPIRV_TOOLS=ON, current main's pinned bundled dependencies, including native FreeType 2.15.0.The complete production relinker/libraries and all 67 selected fixture targets build successfully. All 154 selected CTests pass, with zero failures or skips: 89 font/FreeType/library cases and 65 public-header audit/compilation cases. Each test completes below 30 seconds.
guest_freetype_glyphexecutes 7,707 native CBox comparisons and 16 LP64 expectations. The public-header audit verifies 407 libraries and 30,744 exports with unique declarations and umbrella coverage; all 407 patched libraries load successfully.objdump -pconfirmsavLzN0tTxLIandDr3F3qrSQ2cin both packaged FreeType libraries. Unknown-provider definitions and registrations both equal 47, compared with 48 on main.Glyph.cppremains blob6c6f89bf5fde6a53e2e95b2779d2feb2d572237a;GuestFreeTypeGlyph.cppremains blob265ddf3d5eb1e18d8f192f61fbe131576479165a. The rebase retains current main's provider APIs and regressions. Conventions and current-main whitespace checks pass. No full CTest suite, Linux/macOS rerun, title or console run was performed for this revision.Reproduction commands from the PR checkout
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 MarcZX10 on 2026-10-22T03:43:37Z.
Review: CHANGES_REQUESTED
The new CBox calculation tracks the pinned FreeType 2.13.3 source for the registered outline and bitmap classes: it uses guest outline points, the bitmap bearing/dimension formulas, the same floor/ceiling and arithmetic-shift behavior, and leaves other modes unscaled. The tests exercise those formulas against the pinned implementation and add full-width LP64 cases. The limitations in the debt entry are appropriately explicit.
The merge-order checklist needs correction before approval. #9064 is explicitly listed as an implementation dependency, but its own checklist says it depends on #8286, while this PR only lists #9064. Please include the dependency chain (at least #8286, unless its relevant changes have already landed) so the PR cannot be merged before its prerequisite. The description also asks to merge after #8558 and #9090 but the checklist marks #8558 and #9090 as dependencies along with #9574; that is appropriate if they must land first, but please verify #9090's dependency chain is represented too (it depends on #9075, which in turn has its own chain). The stated shared insertions in CMake,
Outline.cpp, tests and debt should remain coordinated with those PRs during rebases.I reviewed the box calculation and direct tests but did not run this PR's local suite. Eligibility, conventions, intake, labels and report checks pass; hosted product build/test jobs are skipped. The focused Windows build, tests and 7,707 comparisons in the description are author-reported, including an overlay-qualified full build rather than a clean-main full build.
Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-22T03:50:10Z.
Review: COMMENTED
Linux run of this change, since the description lists only Windows 11.
Machine: Linux x86_64, i7-8700 (6 cores / 12 threads), Ubuntu 26.04, GCC 15.2, Release,
BUILD_TESTING=ON, bundled dependencies. Head3da7524c0merged--no-commitontomain6ef5a1c4c(clean); the #9465 dependency diff rides along in the aggregate until it merges.guest_freetype_glyph,guest_freetype_outline,guest_freetypeandguest_freetype_charmapall pass.python tools/check_conventions.py --base origin/mainreports no errors.FT_Outline_Get_CBox_nid_postfix(&owner.outline.outline, box)with*box = {}(keeping the test) abortsguest_freetype_glyphatFreeType glyph check failed at line 502, so the query really reads the published guest geometry and the test catches a wrong result, not just a missing symbol.guest_freetype_outlinestays green under that mutation since it checks the adapter directly, which lines up with the PR reusing #9064'sFT_Outline_Get_CBoxfor outline points.Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-22T04:10:41Z.
Review: CHANGES_REQUESTED
Thank you for adding the independent Linux red/green report; it corroborates the guest-geometry branch and its regression test. The merge-order issue remains in the current checklist: #9064 depends on #8286, but this PR lists #9064 without #8286. Please include the unresolved prerequisite chain (at least #8286, unless it has landed) and verify the other dependency chains are still accurate against current open/merged states before approval. This prevents merging the CBox adapter/query before the code it reuses is available. Current hosted policy checks pass; product build/test jobs remain skipped. I did not run local tests.
Imported from boykopovar/AnyPS5. Originally posted by fogydes on 2026-10-22T08:50:48Z.
Reviewed; verified the pieces that matter. The NID chain is correct:
compute_nid("FT_Glyph_Get_CBox")returnsavLzN0tTxLI, which is exactly the NID the PS5 3.20libSceFreeTypeOt.cstub binds toFT_Glyph_Get_CBox. The mode arithmetic matches the bundled 2.13.3 semantics claim by claim: bitmap bounds are(left * 64, left*64 + width*64, top*64, top*64 - rows*64)with the multiplication kept 32-bit-modular before widening (the unsigned-dimension wrap case is pinned in the tests),>> 6is arithmetic on the full 64-bit bounds for TRUNCATE/PIXELS, the GRIDFIT/PIXELS ceiling is the source's wrap-around floor/ceil grid fitting (the two-complement modular ceiling reproduces theFT_PIX_CEILoverflow case in ftobjs.h rather than diverging on huge negative coordinates), and any other mode value keeps unscaled bounds, which is what the outline/bitmap class implementations do for undocumented modes. Reading the bounds from the published guest geometry rather than the native backing glyph is the one non-obvious requirement here, and the body's negative-control (querying the native object fails the first nonempty outline comparison) proves the implementation actually does that. Null handling and the stricter Done/Copy checks line up with the debt entries, which are unusually complete about what's unverified (console ABI, rounding equivalence, the signed-multiply overflow throw where the bundled source is undefined).Notes:
FT_Get_Glyph/FT_Glyph_Copy/FT_Done_Glyphand the 707-line glyph test file) with original authorship — as the body says. Reviewers/mergers should treat the feature commit3da7524cas the actual scope: the new export, its test additions and the debt entry.FT_Outline_Check/FT_Outline_Get_CBoxlines appearing in this diff are inherited #9064 code, not a second implementation of the CBox query — worth remembering during rebase so the two debt entries stay distinct, as the body itself instructs.Export.cpp/CMake — the overlap analysis is present and matches.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-22T10:11:34Z.
Review: CHANGES_REQUESTED
The implementation review is encouraging: the feature commit uses the registered guest geometry, matches the pinned FreeType bounds arithmetic, and has substantive regression coverage. The dependency chain is now described and the checklist includes the immediate prerequisites. I did not find a feature-specific correctness issue in the code I reviewed. One repository requirement remains before merge: the base is stale. This head is 51 commits behind current
upstream/main. Please rebase or merge currentmainafter the prerequisite order is settled, then rerun the focused tests and checks. Checks run on exact headbd1500ab868bfbd92dc0db926cc15cfcd58b9849: -git diff --check upstream/main...HEAD: passed. -python tools/check_conventions.py --base upstream/main --head HEAD: passed. - Builtguest_freetype_glyph_tests,guest_freetype_outline_tests,guest_freetype_tests, andguest_freetype_charmap_testswith GCC 12.2 on Linux: passed. - Ran the four corresponding CTest cases: all four aborted duringlibkernelstatic initialization before reaching the test bodies because this host (Intel Xeon E5-1620 v2) lacks required PS5 instruction-set features, including AVX2. These are environment-blocked runs, not test assertion failures; I cannot report them as passing. - Hosted eligibility, labels, report and conventions checks pass on the latest run. Hosted Linux/Windows product build/test jobs are skipped, so no hosted product result is available. The earlier Windows results and independent Linux results in the description are useful author/reviewer reports. Please provide fresh focused test results after updating the base, on a host that meets the project's CPU requirements. I have left this as changes requested for the stale-base update and focused-test rerun only, not for a defect found in the CBox implementation. I withdraw the queue-based hold; it is fine to keep submitting PRs and they will be handled in due course.I’ve noticed that holding this PR because of #5239 isn’t necessary. It’s fine for PRs to keep coming in; they’ll be handled in due course. Please disregard my earlier request to hold or defer it.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-28T22:24:26Z.
Review: CHANGES_REQUESTED
The glyph bounds implementation and tests remain consistent with the pinned FreeType 2.13.3 arithmetic, and the PR records the unsupported inputs and console uncertainty. The author reports Windows 19/19 focused tests on the latest head; hosted Windows, eligibility, conventions, labels, and report checks pass, while Linux product jobs are skipped. I did not run a local build.
The current overlap report identifies #10582 and #10591 in the same
docs/dev/debt/libSceFreeTypeOt.mdsection. The checklist declares the implementation prerequisites #9465 and #9398, but it does not record an agreed landing order for those two current debt-file overlaps. Please compare the changes with both authors, agree which PR lands first, and add the order to the relevantDepends onchecklists (or update the overlap analysis if the exact current heads are now disjoint). The prerequisite chain in this PR is otherwise explicit: #9465's #9399 prerequisite has merged, and #9398 declares no further dependency.