feat(libSceFreeType): expose Unicode variation selectors #9404

Merged
Ondra97 merged 6 commits from upstream-pr/9404 into main 2026-11-05 08:24:35 +00:00
Ondra97 commented 2026-10-21 20:52:41 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Ondra97 on 2026-10-21T20:52:41Z.


What

Expose the five Unicode variation-selector queries in the guest FreeType bridge: FT_Face_GetCharVariantIndex, FT_Face_GetCharVariantIsDefault, FT_Face_GetVariantSelectors, FT_Face_GetVariantsOfChar and FT_Face_GetCharsOfVariant. The adapter delegates to the bundled FreeType backend, preserves signed default-status results and native-owned, zero-terminated lists, and uses the low 32 bits of the LP64 character/selector arguments. The public umbrella header declares every export exactly once.

Merge main through b611e634f7fc024f0c13e342d96de744448ef1d9 and update the synthetic regression for bundled FreeType 2.15.0. Upstream ba4ee6c6bd excludes supplemental format-14/15 charmaps from automatic Unicode selection. A face containing only format 14 therefore has no active charmap in both guest and native FreeType. Its GetCharVariantIndex queries return 0; GetCharVariantIsDefault('A', 0xFE0F) remains 1 because that query reads the variation table independently of the active charmap. The regression checks the retained platform-0/encoding-5 subtable, both null active maps, and native parity. No export implementation changes or guest-specific fallback are needed for this review correction.

The original PR cites the PS5 3.20 inventory for names/NIDs; I did not repeat that inventory audit in this correction. Console signatures, errors and FreeType-version equivalence remain unverified in the debt entry. Native-backend agreement is not console verification.

Tested

Automated hosted Windows validation: submitted head 90c70685ec6aaa5dcddb9f40cd5ac082e6cdf191 merged into main c3a5290c7de9ae867676ffdc9c3b5442b34f6150 passed the changed-guest-test CI job: 2184 passed, 1024 skipped, 0 failed across 3,208 selected CTest registrations. guest_freetype_variant executed and passed. This is the automatic changed-guest-test selection; the skipped GPU paths supply no additional GPU qualification.

Windows 11 Pro 10.0.26300 x64, AMD Ryzen 9 7900X, 31.7 GiB RAM, NVIDIA RTX 4070 Ti SUPER; these tests use the CPU. WinLibs MinGW-w64 GCC 15.2.0 UCRT POSIX SEH r7, CMake 4.3.1, Python 3.14.7, Ninja, Release, BUILD_TESTING=ON, bundled pinned submodules. Base b611e634f7fc024f0c13e342d96de744448ef1d9, merged pre-fix baseline 46ff75e9bf9ccb72025cfcd76a4ee1f77dd37cce, final head 90c70685ec6aaa5dcddb9f40cd5ac082e6cdf191.

The original regression on the merged baseline failed at line 175 on this Windows host, reproducing the stale active-charmap assumption. After the test correction, guest_freetype_variant passed with 1,344 scalar and 147 terminated-list comparisons, including the variant-only fixture. The reviewer's Linux batch failure is an external report; I did not reproduce it on Linux or rerun the old 2.13.3 branch.

  • Complete default all-target Windows build: passed (cmake --build ../b --parallel 10), including the runtime libraries and test targets, with no source overlay.
  • Focused CTest: 139/139 passed, zero skips, 45.22 s. This includes 74 font/FreeType/library runtime tests and all 65 public-header audit/compilation tests. The audit verified 406 libraries and 28,361 exports; all 406 patched libraries loaded successfully.
  • Registration audit: 1,959 test executables, none newly unregistered; every PRX source defining an export is compiled.
  • Conventions, strict main-sync and git diff origin/main HEAD --check: passed. The branch is 0 commits behind the stated main and merges cleanly.

Reproduction commands, from the isolated source worktree (the selected compiler is on PATH):

cmake -S . -B ../b -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DPython3_EXECUTABLE=C:/Python314/python.exe -DFFMPEG_PREBUILT_DIR=D:/Github/AnyPS5/build-runtime/externals/ffmpeg-9ac4cfd195f1
cmake --build ../b --parallel 10
ctest --test-dir ../b -R '^(guest_freetype.*|guest_.*font.*|font_.*|patched_libraries|public_headers.*)$' -j 4 -V --output-on-failure --no-tests=error
python tools/check_test_registration.py ../b
python tools/check_conventions.py --base origin/main
python tools/check_main_sync.py --base origin/main --strict
git diff origin/main HEAD --check
python tools/pr_overlap.py --repo boykopovar/AnyPS5 --branch codex/pr9404-review-20261104

The overlap scan examined 1,865 open PRs and found no conflicting lines or duplicate exports among comparable branches. It exited 2 because 17 other branches conflict with main: #10582, #10591, #10593, #10594, #10600, #10601, #10602, #10604, #10606, #10609, #10611, #10613, #10616, #12004, #12373, #13486 and #14212. I manually compared every reported shared file: those changes add separate APIs/tests, unrelated debt entries or blank lines; none implements these five queries or changes GuestFreeTypeVariants.cpp. The final test/debt correction retains the scanned file/export scope. No dependency on those PRs is needed.

No title, PS5 hardware, native Linux run of this head, or complete CTest suite is claimed. Earlier contributor/reviewer results apply only to their stated revisions and environments.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4958202659 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9404). Originally posted by [Ondra97](https://github.com/Ondra97) on 2026-10-21T20:52:41Z. --- ### What Expose the five Unicode variation-selector queries in the guest FreeType bridge: `FT_Face_GetCharVariantIndex`, `FT_Face_GetCharVariantIsDefault`, `FT_Face_GetVariantSelectors`, `FT_Face_GetVariantsOfChar` and `FT_Face_GetCharsOfVariant`. The adapter delegates to the bundled FreeType backend, preserves signed default-status results and native-owned, zero-terminated lists, and uses the low 32 bits of the LP64 character/selector arguments. The public umbrella header declares every export exactly once. Merge `main` through `b611e634f7fc024f0c13e342d96de744448ef1d9` and update the synthetic regression for bundled [FreeType 2.15.0](https://github.com/freetype/freetype/blob/37515cf56ba3349656049edbed89ffc6f6466f2d/src/base/ftobjs.c). Upstream [ba4ee6c6bd](https://github.com/freetype/freetype/commit/ba4ee6c6bdd3d842e11810bbe3234748cbc587ee) excludes supplemental format-14/15 charmaps from automatic Unicode selection. A face containing only format 14 therefore has no active charmap in both guest and native FreeType. Its `GetCharVariantIndex` queries return 0; `GetCharVariantIsDefault('A', 0xFE0F)` remains 1 because that query reads the variation table independently of the active charmap. The regression checks the retained platform-0/encoding-5 subtable, both null active maps, and native parity. No export implementation changes or guest-specific fallback are needed for this review correction. The original PR cites the [PS5 3.20 inventory](https://github.com/DNNDHH/PS5-3.20_Libs/blob/b2a77c09cd71c01f34c790cfbe98c751a13262ad/libSceFreeTypeOt.c) for names/NIDs; I did not repeat that inventory audit in this correction. Console signatures, errors and FreeType-version equivalence remain unverified in the debt entry. Native-backend agreement is not console verification. ### Tested Automated hosted Windows validation: submitted head `90c70685ec6aaa5dcddb9f40cd5ac082e6cdf191` merged into main `c3a5290c7de9ae867676ffdc9c3b5442b34f6150` passed the [changed-guest-test CI job](https://github.com/boykopovar/AnyPS5/actions/runs/41920123406/job/126902361191): **2184 passed, 1024 skipped, 0 failed** across 3,208 selected CTest registrations. `guest_freetype_variant` executed and passed. This is the automatic changed-guest-test selection; the skipped GPU paths supply no additional GPU qualification. Windows 11 Pro 10.0.26300 x64, AMD Ryzen 9 7900X, 31.7 GiB RAM, NVIDIA RTX 4070 Ti SUPER; these tests use the CPU. WinLibs MinGW-w64 GCC 15.2.0 UCRT POSIX SEH r7, CMake 4.3.1, Python 3.14.7, Ninja, Release, `BUILD_TESTING=ON`, bundled pinned submodules. Base `b611e634f7fc024f0c13e342d96de744448ef1d9`, merged pre-fix baseline `46ff75e9bf9ccb72025cfcd76a4ee1f77dd37cce`, final head `90c70685ec6aaa5dcddb9f40cd5ac082e6cdf191`. The original regression on the merged baseline failed at line 175 on this Windows host, reproducing the stale active-charmap assumption. After the test correction, `guest_freetype_variant` passed with 1,344 scalar and 147 terminated-list comparisons, including the variant-only fixture. The reviewer's Linux batch failure is an external report; I did not reproduce it on Linux or rerun the old 2.13.3 branch. - Complete default all-target Windows build: passed (`cmake --build ../b --parallel 10`), including the runtime libraries and test targets, with no source overlay. - Focused CTest: **139/139 passed, zero skips**, 45.22 s. This includes 74 font/FreeType/library runtime tests and all 65 public-header audit/compilation tests. The audit verified 406 libraries and 28,361 exports; all 406 patched libraries loaded successfully. - Registration audit: 1,959 test executables, none newly unregistered; every PRX source defining an export is compiled. - Conventions, strict main-sync and `git diff origin/main HEAD --check`: passed. The branch is 0 commits behind the stated main and merges cleanly. Reproduction commands, from the isolated source worktree (the selected compiler is on `PATH`): ```sh cmake -S . -B ../b -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DPython3_EXECUTABLE=C:/Python314/python.exe -DFFMPEG_PREBUILT_DIR=D:/Github/AnyPS5/build-runtime/externals/ffmpeg-9ac4cfd195f1 cmake --build ../b --parallel 10 ctest --test-dir ../b -R '^(guest_freetype.*|guest_.*font.*|font_.*|patched_libraries|public_headers.*)$' -j 4 -V --output-on-failure --no-tests=error python tools/check_test_registration.py ../b python tools/check_conventions.py --base origin/main python tools/check_main_sync.py --base origin/main --strict git diff origin/main HEAD --check python tools/pr_overlap.py --repo boykopovar/AnyPS5 --branch codex/pr9404-review-20261104 ``` The overlap scan examined 1,865 open PRs and found no conflicting lines or duplicate exports among comparable branches. It exited 2 because 17 other branches conflict with `main`: #10582, #10591, #10593, #10594, #10600, #10601, #10602, #10604, #10606, #10609, #10611, #10613, #10616, #12004, #12373, #13486 and #14212. I manually compared every reported shared file: those changes add separate APIs/tests, unrelated debt entries or blank lines; none implements these five queries or changes `GuestFreeTypeVariants.cpp`. The final test/debt correction retains the scanned file/export scope. No dependency on those PRs is needed. No title, PS5 hardware, native Linux run of this head, or complete CTest suite is claimed. Earlier contributor/reviewer results apply only to their stated revisions and environments. <!-- OS, title or homebrew, what was checked. "Not tested" is a valid answer. A performance change: the summary lines of main and of this PR from the same machine and scene, with the traces attached, captured as the Performance report issue form describes. --> ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: <!-- #PR, or none --> none - [x] Fixes: <!-- issue it closes as Fixes #N, or none --> none - [x] Unblocks: <!-- title ID and Game bring-up discussion, e.g. PPSA01325 #3232, or none --> none - [x] GPUs tested: <!-- for AGC, shader recompiler or VideoOut changes: vendor, model, driver and OS of each GPU the GPU tests ran on; otherwise n/a --> n/a - [x] AI-assisted: <!-- yes / no --> yes
MarcZX10 commented 2026-10-22 05:34:48 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-22T05:34:48Z.

Review: DISMISSED


The bridge preserves FreeType’s return conventions and delegates the cmap-14 queries to the bundled library; the regression covers the query results, list termination, alternate charmaps, absent maps, and 64-bit inputs. The reported Windows run and 10/10 focused tests are strong evidence. The current overlap scan against open PRs reports no overlap, and git diff --check passes.

I’m requesting one repository-required follow-up before this is ready: the branch’s recorded base is 0c6a5bd593, while current main is 4a17c71757. Please rebase onto current main, rerun the focused FreeType tests and convention/overlap checks, and update the description with the refreshed base and results. git merge-tree shows the current head can merge cleanly, but the contribution checklist requires branches to be based on current main.

No local FreeType build or test ran in this review environment. The PR’s hosted product build jobs are skipped; its eligibility, conventions, intake, labels, and report checks pass. I’m relying on the author’s detailed Windows results and the independent Linux and Windows focused runs recorded above, all of which tested the older base.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5609688825 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9404#pullrequestreview-5609688825). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-22T05:34:48Z. **Review:** DISMISSED --- The bridge preserves FreeType’s return conventions and delegates the cmap-14 queries to the bundled library; the regression covers the query results, list termination, alternate charmaps, absent maps, and 64-bit inputs. The reported Windows run and 10/10 focused tests are strong evidence. The current overlap scan against open PRs reports no overlap, and `git diff --check` passes. I’m requesting one repository-required follow-up before this is ready: the branch’s recorded base is `0c6a5bd593`, while current `main` is `4a17c71757`. Please rebase onto current `main`, rerun the focused FreeType tests and convention/overlap checks, and update the description with the refreshed base and results. `git merge-tree` shows the current head can merge cleanly, but the contribution checklist requires branches to be based on current `main`. No local FreeType build or test ran in this review environment. The PR’s hosted product build jobs are skipped; its eligibility, conventions, intake, labels, and report checks pass. I’m relying on the author’s detailed Windows results and the independent Linux and Windows focused runs recorded above, all of which tested the older base.
jotitadev commented 2026-10-27 01:21:06 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-27T01:21:06Z.

Review: COMMENTED


Linux run of the current head, since the description covers Windows only and the review above notes that no FreeType build ran there.

Machine: Linux x86_64, i7-8700 (6 cores / 12 threads, AVX2), Ubuntu 26.04, GCC 15.2, Release, BUILD_TESTING=ON. Head a7ccfa05a merged onto main e2d457be3. The merge is clean even though the branch is about 4,700 commits behind.

  • Build ok. All 30 freetype tests pass, guest_freetype_variant among them (20 of 20 repeated runs), plus patched_libraries. The five exports appear in the patched libSceFreeType.prx as dPcZ76eZb64, Vrab2WK1mgk, 9Lm2mfsSmws, mGMeRKWGTL4 and tl72PmqhXww.
  • main has no stubs for these exports, so the test cannot link against main. Instead, I checked four behavioral mutations. The test catches all of them: GetVariantSelectors returning null (line 191), GetCharVariantIsDefault always returning 1 (line 162), GetCharsOfVariant calling GetVariantsOfChar (line 192), and GetCharVariantIndex on a null face (line 194).
  • One note on the high-bit cases (0x100000041, 0x10000FE0F, UINT64_MAX). On Linux, FT_ULong is 64 bits. Removing the wrapper's static_cast<std::uint32_t> from all four functions still passes: the bundled FreeType truncates to FT_UInt32 itself (ftobjs.c around line 4116). So on both hosts, those assertions check FreeType's truncation, not the wrapper's. The casts are harmless. I'm only noting that the test would not catch their removal.

Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5661168238 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9404#pullrequestreview-5661168238). Originally posted by [jotitadev](https://github.com/jotitadev) on 2026-10-27T01:21:06Z. **Review:** COMMENTED --- Linux run of the current head, since the description covers Windows only and the review above notes that no FreeType build ran there. Machine: Linux x86_64, i7-8700 (6 cores / 12 threads, AVX2), Ubuntu 26.04, GCC 15.2, Release, `BUILD_TESTING=ON`. Head `a7ccfa05a` merged onto `main` `e2d457be3`. The merge is clean even though the branch is about 4,700 commits behind. - Build ok. All 30 `freetype` tests pass, `guest_freetype_variant` among them (20 of 20 repeated runs), plus `patched_libraries`. The five exports appear in the patched `libSceFreeType.prx` as `dPcZ76eZb64`, `Vrab2WK1mgk`, `9Lm2mfsSmws`, `mGMeRKWGTL4` and `tl72PmqhXww`. - `main` has no stubs for these exports, so the test cannot link against `main`. Instead, I checked four behavioral mutations. The test catches all of them: `GetVariantSelectors` returning null (line 191), `GetCharVariantIsDefault` always returning 1 (line 162), `GetCharsOfVariant` calling `GetVariantsOfChar` (line 192), and `GetCharVariantIndex` on a null face (line 194). - One note on the high-bit cases (`0x100000041`, `0x10000FE0F`, `UINT64_MAX`). On Linux, `FT_ULong` is 64 bits. Removing the wrapper's `static_cast<std::uint32_t>` from all four functions still passes: the bundled FreeType truncates to `FT_UInt32` itself (`ftobjs.c` around line 4116). So on both hosts, those assertions check FreeType's truncation, not the wrapper's. The casts are harmless. I'm only noting that the test would not catch their removal. Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!9404
No description provided.