feat(libSceFreeType): implement outline orientation #9538
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/9538"
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-22T00:49:59Z.
What
Implement
FT_Outline_Get_Orientation(weVsBCT+TTQ) for the existing LP64 guest outline. Compute the bounding box, apply the bundled FreeType coordinate limits and normalization shifts, and integrate the control-point polygons with a signed 64-bit area accumulator. The query leaves points, tags, contours, flags and descriptor pointers unchanged.The name/NID matches the pinned PS5 3.20 inventory. Behavior follows bundled FreeType 2.13.3 ftoutln.c and the bridge's existing 64-bit coordinates and unsigned counts. Console ABI/version and large-outline equivalence remain unverified and are recorded in debt.
Delegating directly to the Windows native routine would use its 32-bit
FT_Posarea: two equally oriented 32767-by-32767 rectangles produce a negative wrapped sum there, while the LP64 sum is positive. The adapter preserves the LP64 result. After the reference normalization, each edge contribution is bounded by 2^31; at most 65,535 points fit comfortably in the 64-bit accumulator. Valid outline arrays and contour indices remain the caller's precondition, as in native FreeType.Merge after #9530 for the shared include/debt insertions; #9530 already declares #9309. These are merge-order dependencies, not shared implementations or runtime requirements. No title unblock or performance improvement is claimed.
Tested
Windows 11 Pro 10.0.26300, WinLibs MinGW-w64 GCC 15.2.0 r7 UCRT, Release,
BUILD_TESTING=ON, bundled dependencies. CPU: AMD Ryzen 9 7900X; RAM: 32 GB; GPU: NVIDIA GeForce RTX 4070 Ti SUPER. Font rendering is on the CPU; GPUs tested: n/a.Base:
a6dcea9279b53b3a39c13695eac66f7c8b5b503c. Head:29eab421d93bf3383b7385940d9f5e21e731867b.cmake --build build --parallel 10: full all-target integration build passed with the previously reviewed temporary test-only #8310 source atca55e46f98ad85861dd7567abad0c028274daca1. That source was restored byte-for-byte and is excluded from this PR. This is an overlay-qualified build, not a standalone clean-main all-target pass.cmake --build build --target libs guest_freetype_tests guest_freetype_charmap_tests patched_libraries_tests --parallel 8: passed with submitted sources.ctest --test-dir build -R '^(guest_freetype(_charmap)?|patched_libraries)$' -V: 3/3 passed, no skips, 0.26 s. 360 patched libraries loaded, 0 failed.guest_freetypetest now checks 1,555 polygon cases, null/empty/degenerate inputs, holes and cancellation between contours, reversal/translation properties, coordinate-limit boundaries, normalization collapse, 64-bit extreme coordinates, 65,535 points and 65,535 contours, descriptor/input preservation, and 2 subsequently rendered glyphs with matching native bitmap pixels and bearings.weVsBCT+TTQis present.g++ -std=c++20 -Wall -Wextra -Werror -fno-asynchronous-unwind-tables -fsyntax-only -Icore/libs -I3rdparty/freetype/include core/libs/prx/libSceFreeType/Export.cpp core/libs/tests/GuestFreeType.cpp: passed.python tools/check_conventions.py --base origin/main,python tools/check_test_registration.py buildandgit diff origin/main HEAD --check: passed. Registration audit: 1,167 executables, none unregistered.No title, PS5 hardware, Linux or macOS runtime was tested.
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-22T00:55:21Z.
Review: APPROVED
Reviewed the adapter against the pinned FreeType 2.13.3 implementation and the current
GuestOutlinerepresentation. The collapsed/large-coordinate guards, independent x/y normalization shifts, contour closure, winding-sign mapping and degenerate result match the source algorithm; using a 64-bit accumulator addresses the LP64 result the PR documents. The expanded tests cover native-comparable inputs, geometry properties, contour cancellation, coordinate limits and rendered glyph output without mutating the guest outline.The PR reports 1,555 polygon cases, two rendered-glyph comparisons, a strict syntax check, the focused 3/3 CTest selection and a 360-library patching check. Those runs are author-reported; I did not rerun a local build. Hosted eligibility, conventions, intake, labels and report checks pass; product jobs are skipped. The #9530 overlap is explicitly ordered in
Depends on, and its author confirmed this PR should land afterward.Approved.
Imported from boykopovar/AnyPS5. Originally posted by Ondra97 on 2026-10-22T01:16:03Z.
I am preparing the three
FT_Get_CID_*metadata queries as an independent follow-up. The shared insertions in Export.cpp and the debt file will go after #9538, which already orders #9530 and #9309. I will declare that merge-order dependency and rebase those insertions after this PR merges. No changes to this branch are needed.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-22T01:17:01Z.
Review: APPROVED
Re-reviewed the current head after #9545 declared this PR as its shared-insertion predecessor. The author has updated the branch to current main, the stated order is represented in
Depends on, and the existing review of the outline algorithm and tests remains applicable. Hosted eligibility, conventions, intake, labels and report checks pass; platform builds are skipped by path policy. The Windows tests are author-reported; I did not run a local build.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-22T01:59:42Z.
Review: APPROVED
Rechecked the unchanged implementation and its #9530 merge-order prerequisite. The adapter follows bundled FreeType’s coordinate bounding and normalization logic while retaining the LP64 accumulator; the tests cover degenerate, nested, cancellation, boundary and large-coordinate outlines plus rendered glyphs. Eligibility, conventions, intake, labels and report checks pass; build jobs were skipped. I did not run local tests. Approval stands with #9530 first as declared.
Imported from boykopovar/AnyPS5. Originally posted by fogydes on 2026-10-22T08:41:12Z.
Reviewed; verified the implementation against the pinned
ftoutln.corientation routine. Each branch is a faithful port: null/empty →TRUETYPEand the degenerate-bounds box check match the source's opening; the ±0x1000000 range gate is taken verbatim; the shift math is the source'sFT_MSB(abs) - 14recomputed asbit_width(|x|) - 15(same exponent, sign-safe with the unsigned OR of the two absolute extremes); the(y - prevY) * (x + prevX)accumulation runs the same order and sign — so the result isPOSTSCRIPTfor a positive signed area,TRUETYPEfor negative,NONEfor zero, exactly as freetype maps it. The deliberate divergence the body documents (64-bit accumulator instead of a 32-bitFT_Poswrap) is the right call on LP64 and is covered by the two-extreme-rectangle special case in the tests. Guest buffers stay untouched (const query, no adapter state), the debt entry links the pinned source and scopes the unverified console ABI part, and the tests cover degenerate outlines, boundary coordinates both inside and outside the range gate, the LP64 extemes, random polygons cross-checked against an independent shoelace oracle, and rendered glyphs with the x-reflection flipping orientation. Nothing invented anywhere in the answer space.