feat(libfreetype): implement FT_Face_Properties and FT_Palette_Set_Foreground_Color #15444

Merged
VakzOs merged 6 commits from upstream-pr/15444 into main 2026-11-07 05:08:55 +00:00
VakzOs commented 2026-11-03 10:19:43 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by VakzOs on 2026-11-03T10:19:43Z.


What

The legacy libfreetype exports VKuZXhyjtoo and NbFQEYieSS0 threw. The verified NID name database names them FT_Face_Properties and FT_Palette_Set_Foreground_Color, and tools/nid_names.py computes the same NIDs for those names. They are now implemented in src/FaceSettings.cpp.

Both resolve the host FT_Face behind the guest FT_FaceRec from libSceFreeType and call the bundled FreeType 2.15.0 on it. Properties use the console's 16-byte FT_Parameter (a 64-bit FT_ULong tag and a data pointer). They are converted and passed to FreeType one at a time, so, as in FreeType, nothing after the first rejected entry is read and no scratch array is allocated. On Windows a tag above 32 bits becomes 0 and is rejected as unknown, the same result as on Linux. The colour is the 4-byte BGRA FT_Color passed by value. Results are FreeType's own:

  • stem darkening and random seed set, or reset to the module default with null data;
  • Unimplemented_Feature for FT_PARAM_TAG_LCD_FILTER_WEIGHTS, because subpixel rendering is disabled;
  • Invalid_Argument for an unknown tag and for a non-zero count with no array.

One difference: a null face returns Invalid_Face_Handle from FT_Face_Properties. FreeType would dereference it.

docs/dev/debt/libfreetype.md records the unverified console version and build options, and that rendering with these settings is not tested.

Tested

Linux, GCC 13, Release: the new guest_legacy_freetype_face_settings passes. It opens FreeType's test font varc-reset-only.ttf through the guest API and checks the host face's state after each call:

  • stem darkening on and off, and the seed, including a negative seed clamped to 0;
  • defaults restored with null data;
  • the LCD, unknown, 64-bit and null-array errors;
  • a count of UINT32_MAX on a two-entry array whose second tag is unknown, which stops there;
  • the stored foreground colour and its flag;
  • null faces.

The test includes FreeType's private headers and uses the submodule's test fonts, so it is registered only when ANYPS5_USE_SYSTEM_DEPS is off, as libSceFreeTypeOl does. Swapping the colour channels or truncating tags to 32 bits makes the test fail. The patched module exports VKuZXhyjtoo and NbFQEYieSS0 and no FT_* symbols. python3 tools/check_conventions.py --base origin/main passes.

tools/pr_overlap.py --branch reports #15408 (libfreetype font metadata), for the same reasons as #15439: both add core/libs/prx/libfreetype/CMakeLists.txt and touch adjacent lines. No export is shared.

Not tested on hardware or with a title.

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: #15439, #15442 (land order: #15408, #15439, #15442, then this PR)
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5135526834 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/15444). Originally posted by [VakzOs](https://github.com/VakzOs) on 2026-11-03T10:19:43Z. --- ### What The legacy `libfreetype` exports `VKuZXhyjtoo` and `NbFQEYieSS0` threw. The [verified NID name database](https://github.com/zecoxao/sce_symbols/blob/2883963a0a514ba6e77407a08ef4730a65e88254/aerolib.csv) names them `FT_Face_Properties` and `FT_Palette_Set_Foreground_Color`, and `tools/nid_names.py` computes the same NIDs for those names. They are now implemented in `src/FaceSettings.cpp`. Both resolve the host `FT_Face` behind the guest `FT_FaceRec` from libSceFreeType and call the bundled FreeType 2.15.0 on it. Properties use the console's 16-byte `FT_Parameter` (a 64-bit `FT_ULong` tag and a data pointer). They are converted and passed to FreeType one at a time, so, as in FreeType, nothing after the first rejected entry is read and no scratch array is allocated. On Windows a tag above 32 bits becomes 0 and is rejected as unknown, the same result as on Linux. The colour is the 4-byte BGRA `FT_Color` passed by value. Results are FreeType's own: - stem darkening and random seed set, or reset to the module default with null data; - `Unimplemented_Feature` for `FT_PARAM_TAG_LCD_FILTER_WEIGHTS`, because subpixel rendering is disabled; - `Invalid_Argument` for an unknown tag and for a non-zero count with no array. One difference: a null face returns `Invalid_Face_Handle` from `FT_Face_Properties`. FreeType would dereference it. `docs/dev/debt/libfreetype.md` records the unverified console version and build options, and that rendering with these settings is not tested. ### Tested Linux, GCC 13, Release: the new `guest_legacy_freetype_face_settings` passes. It opens FreeType's test font `varc-reset-only.ttf` through the guest API and checks the host face's state after each call: - stem darkening on and off, and the seed, including a negative seed clamped to 0; - defaults restored with null data; - the LCD, unknown, 64-bit and null-array errors; - a count of `UINT32_MAX` on a two-entry array whose second tag is unknown, which stops there; - the stored foreground colour and its flag; - null faces. The test includes FreeType's private headers and uses the submodule's test fonts, so it is registered only when `ANYPS5_USE_SYSTEM_DEPS` is off, as libSceFreeTypeOl does. Swapping the colour channels or truncating tags to 32 bits makes the test fail. The patched module exports `VKuZXhyjtoo` and `NbFQEYieSS0` and no `FT_*` symbols. `python3 tools/check_conventions.py --base origin/main` passes. `tools/pr_overlap.py --branch` reports #15408 (libfreetype font metadata), for the same reasons as #15439: both add `core/libs/prx/libfreetype/CMakeLists.txt` and touch adjacent lines. No export is shared. Not tested on hardware or with a title. ### Checklist - [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: #15439, #15442 (land order: #15408, #15439, #15442, then this PR) - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
mashingaan commented 2026-11-03 10:30:21 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by mashingaan on 2026-11-03T10:30:21Z.

Review: COMMENTED


One Windows-specific boundary issue: this guest wrapper accepts 64-bit lengths, but FT_ULong is unsigned long, which is 32-bit on Windows. Both casts here can silently truncate values above ULONG_MAX before FreeType receives them. Please reject either unrepresentable length before casting so Windows does not interpret a different input size or output capacity than the guest supplied. A focused Windows check at ULONG_MAX + 1 would cover this boundary.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5750581634 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/15444#pullrequestreview-5750581634). Originally posted by [mashingaan](https://github.com/mashingaan) on 2026-11-03T10:30:21Z. **Review:** COMMENTED --- One Windows-specific boundary issue: this guest wrapper accepts 64-bit lengths, but `FT_ULong` is `unsigned long`, which is 32-bit on Windows. Both casts here can silently truncate values above `ULONG_MAX` before FreeType receives them. Please reject either unrepresentable length before casting so Windows does not interpret a different input size or output capacity than the guest supplied. A focused Windows check at `ULONG_MAX + 1` would cover this boundary.
XairRrR commented 2026-11-03 11:36:45 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-11-03T11:36:45Z.

Review: CHANGES_REQUESTED


Reviewed — changes requested

The wrappers behave like the bundled FreeType 2.15.0, and the new tests pass and fail when the production code is mutated. One problem blocks: the new face-settings test includes FreeType's private internal/ headers without a guard, so it cannot compile in the documented ANYPS5_USE_SYSTEM_DEPS=ON build.

What I ran

Head c6c86c1a942e94ea047276b60f1bd747142cc5cc, main 4f41f4c375f5abb487dbd184fbc150f31994d762, merged with --no-ff in a clean worktree. The diff also carries the commits of the stacked #15439 (gzip) and #15442 (Multiple Masters), so this review covers all three.

git diff --check 4f41f4c375f5abb487dbd184fbc150f31994d762...c6c86c1a942e94ea047276b60f1bd747142cc5cc
python3 tools/check_conventions.py --base 4f41f4c375f5abb487dbd184fbc150f31994d762
ctest --test-dir build -N -R guest_legacy_freetype
ctest --test-dir build -j8 --test-load 32 --output-on-failure -R guest_legacy_freetype
# negative control (mutations of src/FaceSettings.cpp, see below)
ninja -C build -j32 -l32 guest_legacy_freetype_face_settings_tests
ctest --test-dir build --output-on-failure -R guest_legacy_freetype_face_settings
# restore the merged file, rebuild, rerun all three, git status --porcelain

Results

Check Result
git diff --check clean
check_conventions.py "All conventions checks passed."
Build of the merged tree (script) ok
guest_legacy_freetype_gzip passed (0.01 s)
guest_legacy_freetype_multiple_masters passed (0.01 s)
guest_legacy_freetype_face_settings passed (0.01 s)
Selected tests (script, 2462 run) no new failures and no timeouts. 4 tests fail on main too (guest_interfaces, guest_socket_options_multicast, unwrap_self_..._group, vector_constant_factor_tininess), and guest_net_ctl is skipped on main too. None of these comes from this PR.
Vulkan validation not applicable: no AGC, shader or VideoOut file changed

Negative control

The production files are new, so restoring main only removes the functions and the test would fail to link, which proves nothing. I mutated src/FaceSettings.cpp instead, in the two ways the description names:

  • Swapped colour channels (FT_Color{color.red, color.green, color.blue, color.alpha}): guest_legacy_freetype_face_settings fails (Subprocess aborted).
  • Tags truncated to 32 bits (HostTag returns static_cast<std::uint32_t>(tag)): the test fails (Subprocess aborted).

After that I restored the merged file and rebuilt. All three tests pass again, and git status --porcelain is empty.

Findings

Blocking

  1. The face-settings test cannot build with ANYPS5_USE_SYSTEM_DEPS=ON.

    • core/libs/tests/GuestLegacyFreeTypeFaceSettings.cpp:7-8 includes <freetype/internal/ftobjs.h> and <freetype/internal/tttypes.h>.
    • core/libs/prx/libfreetype/CMakeLists.txt:29-37 registers the test whatever the setting.
    • FreeType's install leaves out these private headers (PATTERN "internal" EXCLUDE in the install rules of the FreeType submodule's CMakeLists.txt). A distribution libfreetype-dev therefore does not have them.
    • The project already handles this: libSceFreeTypeOl, which includes the same headers, is wrapped in if(NOT ANYPS5_USE_SYSTEM_DEPS) (core/libs/prx/libSceFreeTypeOl/CMakeLists.txt:1).
    • With system deps, freetype is not listed among the submodules that "always stay bundled" (docs/dev/BUILD.md:160). So FREETYPE_TEST_FONTS, which points into 3rdparty/freetype/tests/data, can also be missing. That hits the Multiple Masters test as well.
    • Fix: register the face-settings and Multiple Masters tests only under if(NOT ANYPS5_USE_SYSTEM_DEPS), as libSceFreeTypeOl does. Or check the face state without the private headers.

    I could not build this configuration because no system FreeType is installed on this machine. The finding rests on FreeType's install rules and the existing guard.

Non-blocking

  1. The wrappers size and read the guest array from the count alone.
    • src/FaceSettings.cpp:25-28 allocates numProperties + 1 host entries and copies every guest entry before FreeType runs. FreeType itself stops at the first Unimplemented_Feature or Invalid_Argument entry (ftobjs.c FT_Face_Properties) and never reads past it.
    • So, unlike FreeType, the wrapper reads entries after a failing one.
    • A count near UINT32_MAX asks for about 64 GiB. The resulting std::bad_alloc would then cross an extern "C" guest boundary.
    • src/MultipleMasters.cpp:18 and :29 do the same for numCoords and *length.
    • Suggested fix: copy lazily, or cap the copy at the first entry whose tag FreeType does not accept and pass the shorter count. For the MM getters, clamp the scratch size to the face's axis or design count.
  2. The Windows-only gzip boundary check does not run on Linux. mashingaan's earlier finding on Gzip.cpp is fixed in 557fcc76e7: both lengths are checked against numeric_limits<FT_ULong>::max() before the casts (src/Gzip.cpp:34). The ULONG_MAX + 1 test sits under if constexpr and only runs where unsigned long is 32-bit, so on this Linux machine that branch is compiled out. I confirm the code fix by reading it, not by running it.

Not verified

  • ANYPS5_USE_SYSTEM_DEPS=ON builds: no system FreeType here.
  • Windows and MinGW, including the 32-bit FT_ULong paths and the ENVIRONMENT_MODIFICATION PATH setup.
  • Behaviour on the console, and whether the host renderer honours stem darkening, the seed or the foreground colour for guest glyphs. The debt entry already records the latter.
  • The NID-to-name mapping through tools/nid_names.py: I did not run it.

To get this to a good state

  1. Guard guest_legacy_freetype_face_settings (and guest_legacy_freetype_multiple_masters, which needs the submodule's test fonts) with if(NOT ANYPS5_USE_SYSTEM_DEPS), or drop the private-header dependency.
  2. Optionally, bound the host scratch arrays as described under Non-blocking 1.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5751479635 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/15444#pullrequestreview-5751479635). Originally posted by [XairRrR](https://github.com/XairRrR) on 2026-11-03T11:36:45Z. **Review:** CHANGES_REQUESTED --- # Reviewed — changes requested The wrappers behave like the bundled FreeType 2.15.0, and the new tests pass and fail when the production code is mutated. One problem blocks: the new face-settings test includes FreeType's private `internal/` headers without a guard, so it cannot compile in the documented `ANYPS5_USE_SYSTEM_DEPS=ON` build. ## What I ran Head `c6c86c1a942e94ea047276b60f1bd747142cc5cc`, `main` `4f41f4c375f5abb487dbd184fbc150f31994d762`, merged with `--no-ff` in a clean worktree. The diff also carries the commits of the stacked #15439 (gzip) and #15442 (Multiple Masters), so this review covers all three. ``` git diff --check 4f41f4c375f5abb487dbd184fbc150f31994d762...c6c86c1a942e94ea047276b60f1bd747142cc5cc python3 tools/check_conventions.py --base 4f41f4c375f5abb487dbd184fbc150f31994d762 ctest --test-dir build -N -R guest_legacy_freetype ctest --test-dir build -j8 --test-load 32 --output-on-failure -R guest_legacy_freetype # negative control (mutations of src/FaceSettings.cpp, see below) ninja -C build -j32 -l32 guest_legacy_freetype_face_settings_tests ctest --test-dir build --output-on-failure -R guest_legacy_freetype_face_settings # restore the merged file, rebuild, rerun all three, git status --porcelain ``` ## Results | Check | Result | |---|---| | `git diff --check` | clean | | `check_conventions.py` | "All conventions checks passed." | | Build of the merged tree (script) | ok | | `guest_legacy_freetype_gzip` | passed (0.01 s) | | `guest_legacy_freetype_multiple_masters` | passed (0.01 s) | | `guest_legacy_freetype_face_settings` | passed (0.01 s) | | Selected tests (script, 2462 run) | no new failures and no timeouts. 4 tests fail on `main` too (`guest_interfaces`, `guest_socket_options_multicast`, `unwrap_self_..._group`, `vector_constant_factor_tininess`), and `guest_net_ctl` is skipped on `main` too. None of these comes from this PR. | | Vulkan validation | not applicable: no AGC, shader or VideoOut file changed | ## Negative control The production files are new, so restoring `main` only removes the functions and the test would fail to link, which proves nothing. I mutated `src/FaceSettings.cpp` instead, in the two ways the description names: - **Swapped colour channels** (`FT_Color{color.red, color.green, color.blue, color.alpha}`): `guest_legacy_freetype_face_settings` fails (Subprocess aborted). - **Tags truncated to 32 bits** (`HostTag` returns `static_cast<std::uint32_t>(tag)`): the test fails (Subprocess aborted). After that I restored the merged file and rebuilt. All three tests pass again, and `git status --porcelain` is empty. ## Findings ### Blocking 1. **The face-settings test cannot build with `ANYPS5_USE_SYSTEM_DEPS=ON`.** - `core/libs/tests/GuestLegacyFreeTypeFaceSettings.cpp:7-8` includes `<freetype/internal/ftobjs.h>` and `<freetype/internal/tttypes.h>`. - `core/libs/prx/libfreetype/CMakeLists.txt:29-37` registers the test whatever the setting. - FreeType's install leaves out these private headers (`PATTERN "internal" EXCLUDE` in the install rules of the FreeType submodule's `CMakeLists.txt`). A distribution `libfreetype-dev` therefore does not have them. - The project already handles this: `libSceFreeTypeOl`, which includes the same headers, is wrapped in `if(NOT ANYPS5_USE_SYSTEM_DEPS)` (`core/libs/prx/libSceFreeTypeOl/CMakeLists.txt:1`). - With system deps, `freetype` is not listed among the submodules that "always stay bundled" (docs/dev/BUILD.md:160). So `FREETYPE_TEST_FONTS`, which points into `3rdparty/freetype/tests/data`, can also be missing. That hits the Multiple Masters test as well. - **Fix:** register the face-settings and Multiple Masters tests only under `if(NOT ANYPS5_USE_SYSTEM_DEPS)`, as `libSceFreeTypeOl` does. Or check the face state without the private headers. I could not build this configuration because no system FreeType is installed on this machine. The finding rests on FreeType's install rules and the existing guard. ### Non-blocking 1. **The wrappers size and read the guest array from the count alone.** - `src/FaceSettings.cpp:25-28` allocates `numProperties + 1` host entries and copies every guest entry before FreeType runs. FreeType itself stops at the first `Unimplemented_Feature` or `Invalid_Argument` entry (`ftobjs.c` `FT_Face_Properties`) and never reads past it. - So, unlike FreeType, the wrapper reads entries after a failing one. - A count near `UINT32_MAX` asks for about 64 GiB. The resulting `std::bad_alloc` would then cross an `extern "C"` guest boundary. - `src/MultipleMasters.cpp:18` and `:29` do the same for `numCoords` and `*length`. - **Suggested fix:** copy lazily, or cap the copy at the first entry whose tag FreeType does not accept and pass the shorter count. For the MM getters, clamp the scratch size to the face's axis or design count. 2. **The Windows-only gzip boundary check does not run on Linux.** mashingaan's earlier finding on `Gzip.cpp` is fixed in 557fcc76e754: both lengths are checked against `numeric_limits<FT_ULong>::max()` before the casts (`src/Gzip.cpp:34`). The `ULONG_MAX + 1` test sits under `if constexpr` and only runs where `unsigned long` is 32-bit, so on this Linux machine that branch is compiled out. I confirm the code fix by reading it, not by running it. ## Not verified - `ANYPS5_USE_SYSTEM_DEPS=ON` builds: no system FreeType here. - Windows and MinGW, including the 32-bit `FT_ULong` paths and the `ENVIRONMENT_MODIFICATION` PATH setup. - Behaviour on the console, and whether the host renderer honours stem darkening, the seed or the foreground colour for guest glyphs. The debt entry already records the latter. - The NID-to-name mapping through `tools/nid_names.py`: I did not run it. ## To get this to a good state 1. Guard `guest_legacy_freetype_face_settings` (and `guest_legacy_freetype_multiple_masters`, which needs the submodule's test fonts) with `if(NOT ANYPS5_USE_SYSTEM_DEPS)`, or drop the private-header dependency. 2. Optionally, bound the host scratch arrays as described under Non-blocking 1. <!-- anyps5-bots job=3281 head=c6c86c1a942e94ea047276b60f1bd747142cc5cc -->
XairRrR commented 2026-11-03 12:18:54 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-11-03T12:18:54Z.

Review: APPROVED


Re-checked — approved

Since my last review there are two new commits. bdc326089e caps the Multiple Masters scratch arrays and skips that test when system deps are used. 3a1af1e45e passes face properties to FreeType one at a time and puts the face-settings test inside the same system-deps guard. With these, my blocking finding is resolved.

What changed since my last review

The previous review was of c6c86c1a942e94ea047276b60f1bd747142cc5cc.

  • bdc326089e (stacked #15442):
    • guest_legacy_freetype_multiple_masters is now registered only under if(NOT ANYPS5_USE_SYSTEM_DEPS).
    • The getters ask FreeType for at most 65536 entries. Guest entries past that repeat the last value FreeType wrote.
    • The test adds a 65539-entry comparison against native FreeType.
  • cd2049bc6a: rebased. The face-settings test is now registered inside the same guard.
  • 3a1af1e45e: FT_Face_Properties drops the numProperties + 1 scratch vector. Each entry is converted and passed on its own, and the loop returns at the first error. The test adds a call with a count of UINT32_MAX on a two-entry array whose second tag is unknown.
  • Debt entries in docs/dev/debt/libfreetype.md are updated to match.
  • Author's reply in the discussion covers both points. I checked them below.

What I ran

Head 3a1af1e45e547147e017bfa8a72d2b5c848b74c6, main 4f41f4c375f5abb487dbd184fbc150f31994d762, merged with --no-ff (tree c35a11d33883d9d0ba6c34cbd3469f87ebc41632) in a clean worktree.

git diff --check 4f41f4c375f5abb487dbd184fbc150f31994d762...3a1af1e45e547147e017bfa8a72d2b5c848b74c6
python3 tools/check_conventions.py --base 4f41f4c375f5abb487dbd184fbc150f31994d762
ctest --test-dir build -j8 --test-load 32 --output-on-failure -R guest_legacy_freetype
# negative control: put back the pre-fix versions of the two production files
git show c6c86c1a942e94ea047276b60f1bd747142cc5cc:core/libs/prx/libfreetype/src/FaceSettings.cpp > core/libs/prx/libfreetype/src/FaceSettings.cpp
git show 90223b33c2b4:core/libs/prx/libfreetype/src/MultipleMasters.cpp > core/libs/prx/libfreetype/src/MultipleMasters.cpp
ninja -C build -j32 -l32 guest_legacy_freetype_face_settings_tests guest_legacy_freetype_multiple_masters_tests
ctest --test-dir build --output-on-failure -R "guest_legacy_freetype_(face_settings|multiple_masters)"
# restore the merged files from c35a11d33883d9d0ba6c34cbd3469f87ebc41632, rebuild, rerun all three
git status --porcelain
Check Result
git diff --check clean
check_conventions.py "All conventions checks passed."
Script build of the merged tree ok
Script's selected tests (2458 run) no new failures, no timeouts. The 4 known failures (guest_interfaces, guest_socket_options_multicast, unwrap_self_…_group, vector_constant_factor_tininess) and the guest_net_ctl skip also happen on main; none comes from this PR.
guest_legacy_freetype_gzip / _multiple_masters / _face_settings all pass, 0.01 s each
Vulkan validation not applicable: no AGC, shader or VideoOut file changed

Negative control (pre-fix production files, new tests):

  • guest_legacy_freetype_face_settings fails with ***Timeout (21.66 s): the old copy loop runs over the UINT32_MAX count.
  • guest_legacy_freetype_multiple_masters still passes. See non-blocking 1.

After restoring the merged files and rebuilding, all three tests pass and git status --porcelain is empty.

Previous findings

  1. Blocking: face-settings test can't build with ANYPS5_USE_SYSTEM_DEPS=ON. Resolved.
    • Both tests that need FreeType's private headers or the submodule's test fonts are now inside if(NOT ANYPS5_USE_SYSTEM_DEPS), at core/libs/prx/libfreetype/CMakeLists.txt:23-51. This is the same guard libSceFreeTypeOl uses.
    • guest_legacy_freetype_gzip stays unconditional. It uses only public headers and embedded data.
    • I still cannot build the system-deps configuration here; this is checked by reading the CMake.
  2. Non-blocking: scratch arrays sized from the guest count. Resolved.
    • Face properties: core/libs/prx/libfreetype/src/FaceSettings.cpp:25-29 now converts and passes one entry at a time.
    • I compared this with FreeType 2.15.0 FT_Face_Properties (in ftobjs.c). The results match:
      • FreeType applies entries in order and stops at the first Unimplemented_Feature or Invalid_Argument. Earlier entries stay applied, which is what the test checks with random_seed == 7.
      • A null array with a non-zero count is forwarded and returns Invalid_Argument.
      • A count of 0 returns Ok.
    • The UINT32_MAX test at core/libs/tests/GuestLegacyFreeTypeFaceSettings.cpp:63-64 fails against the old code, as the author said.
    • Multiple Masters: in MultipleMasters.cpp the used - 1 index is reached only when the count is non-zero.
    • The weight-vector length write-back (nativeLength == used ? requested : nativeLength) matches T1_Get_MM_WeightVector:
      • on success it returns num_designs, which is at most 16, so it can never equal a capped 65536;
      • when FreeType fails without writing, the guest's own length comes back.
  3. Non-blocking: the Windows-only gzip boundary check is compiled out on Linux. Unchanged and still open as a note. Nothing to do on this machine; the Windows CI job covers it.

New findings

Blocking

None.

Non-blocking

  1. The 65539-entry test does not exercise the scratch cap.
    • CheckLargeCounts (core/libs/tests/GuestLegacyFreeTypeMultipleMasters.cpp:67-79) passes with the uncapped code from 90223b33c2 too. It checks that the results match FreeType's padding beyond the cap, not that the allocation is bounded.
    • This is acceptable, because a test of the real hazard (a count near UINT32_MAX) would itself need about 32 GiB with the old code.
    • Mention this in the description so the claim reads as an equivalence check, not as proof of the bound.

Not verified

  • ANYPS5_USE_SYSTEM_DEPS=ON builds: no system FreeType on this machine.
  • Windows and MinGW, including the 32-bit FT_ULong tag and length paths, and the ENVIRONMENT_MODIFICATION PATH setup.
  • Behaviour on the console, and whether the host renderer honours these settings for guest glyphs. The debt entry records this.
  • tools/nid_names.py NID-to-name mapping: I did not run it.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5752026171 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/15444#pullrequestreview-5752026171). Originally posted by [XairRrR](https://github.com/XairRrR) on 2026-11-03T12:18:54Z. **Review:** APPROVED --- # Re-checked — approved Since my last review there are two new commits. bdc326089e caps the Multiple Masters scratch arrays and skips that test when system deps are used. 3a1af1e45e passes face properties to FreeType one at a time and puts the face-settings test inside the same system-deps guard. With these, my blocking finding is resolved. ## What changed since my last review The previous review was of `c6c86c1a942e94ea047276b60f1bd747142cc5cc`. - **bdc326089e** (stacked #15442): - `guest_legacy_freetype_multiple_masters` is now registered only under `if(NOT ANYPS5_USE_SYSTEM_DEPS)`. - The getters ask FreeType for at most 65536 entries. Guest entries past that repeat the last value FreeType wrote. - The test adds a 65539-entry comparison against native FreeType. - **cd2049bc6a**: rebased. The face-settings test is now registered inside the same guard. - **3a1af1e45e**: `FT_Face_Properties` drops the `numProperties + 1` scratch vector. Each entry is converted and passed on its own, and the loop returns at the first error. The test adds a call with a count of `UINT32_MAX` on a two-entry array whose second tag is unknown. - **Debt entries** in `docs/dev/debt/libfreetype.md` are updated to match. - **Author's reply** in the discussion covers both points. I checked them below. ## What I ran Head `3a1af1e45e547147e017bfa8a72d2b5c848b74c6`, `main` `4f41f4c375f5abb487dbd184fbc150f31994d762`, merged with `--no-ff` (tree `c35a11d33883d9d0ba6c34cbd3469f87ebc41632`) in a clean worktree. ``` git diff --check 4f41f4c375f5abb487dbd184fbc150f31994d762...3a1af1e45e547147e017bfa8a72d2b5c848b74c6 python3 tools/check_conventions.py --base 4f41f4c375f5abb487dbd184fbc150f31994d762 ctest --test-dir build -j8 --test-load 32 --output-on-failure -R guest_legacy_freetype # negative control: put back the pre-fix versions of the two production files git show c6c86c1a942e94ea047276b60f1bd747142cc5cc:core/libs/prx/libfreetype/src/FaceSettings.cpp > core/libs/prx/libfreetype/src/FaceSettings.cpp git show 90223b33c2b4:core/libs/prx/libfreetype/src/MultipleMasters.cpp > core/libs/prx/libfreetype/src/MultipleMasters.cpp ninja -C build -j32 -l32 guest_legacy_freetype_face_settings_tests guest_legacy_freetype_multiple_masters_tests ctest --test-dir build --output-on-failure -R "guest_legacy_freetype_(face_settings|multiple_masters)" # restore the merged files from c35a11d33883d9d0ba6c34cbd3469f87ebc41632, rebuild, rerun all three git status --porcelain ``` | Check | Result | |---|---| | `git diff --check` | clean | | `check_conventions.py` | "All conventions checks passed." | | Script build of the merged tree | ok | | Script's selected tests (2458 run) | no new failures, no timeouts. The 4 known failures (`guest_interfaces`, `guest_socket_options_multicast`, `unwrap_self_…_group`, `vector_constant_factor_tininess`) and the `guest_net_ctl` skip also happen on `main`; none comes from this PR. | | `guest_legacy_freetype_gzip` / `_multiple_masters` / `_face_settings` | all pass, 0.01 s each | | Vulkan validation | not applicable: no AGC, shader or VideoOut file changed | **Negative control** (pre-fix production files, new tests): - `guest_legacy_freetype_face_settings` fails with ***Timeout (21.66 s): the old copy loop runs over the `UINT32_MAX` count. - `guest_legacy_freetype_multiple_masters` still passes. See non-blocking 1. After restoring the merged files and rebuilding, all three tests pass and `git status --porcelain` is empty. ## Previous findings 1. **Blocking: face-settings test can't build with `ANYPS5_USE_SYSTEM_DEPS=ON`. Resolved.** - Both tests that need FreeType's private headers or the submodule's test fonts are now inside `if(NOT ANYPS5_USE_SYSTEM_DEPS)`, at `core/libs/prx/libfreetype/CMakeLists.txt:23-51`. This is the same guard `libSceFreeTypeOl` uses. - `guest_legacy_freetype_gzip` stays unconditional. It uses only public headers and embedded data. - I still cannot build the system-deps configuration here; this is checked by reading the CMake. 2. **Non-blocking: scratch arrays sized from the guest count. Resolved.** - Face properties: `core/libs/prx/libfreetype/src/FaceSettings.cpp:25-29` now converts and passes one entry at a time. - I compared this with FreeType 2.15.0 `FT_Face_Properties` (in `ftobjs.c`). The results match: - FreeType applies entries in order and stops at the first `Unimplemented_Feature` or `Invalid_Argument`. Earlier entries stay applied, which is what the test checks with `random_seed == 7`. - A null array with a non-zero count is forwarded and returns `Invalid_Argument`. - A count of 0 returns `Ok`. - The `UINT32_MAX` test at `core/libs/tests/GuestLegacyFreeTypeFaceSettings.cpp:63-64` fails against the old code, as the author said. - Multiple Masters: in `MultipleMasters.cpp` the `used - 1` index is reached only when the count is non-zero. - The weight-vector length write-back (`nativeLength == used ? requested : nativeLength`) matches `T1_Get_MM_WeightVector`: - on success it returns `num_designs`, which is at most 16, so it can never equal a capped 65536; - when FreeType fails without writing, the guest's own length comes back. 3. **Non-blocking: the Windows-only gzip boundary check is compiled out on Linux. Unchanged and still open as a note.** Nothing to do on this machine; the Windows CI job covers it. ## New findings ### Blocking None. ### Non-blocking 1. **The 65539-entry test does not exercise the scratch cap.** - `CheckLargeCounts` (`core/libs/tests/GuestLegacyFreeTypeMultipleMasters.cpp:67-79`) passes with the uncapped code from 90223b33c2 too. It checks that the results match FreeType's padding beyond the cap, not that the allocation is bounded. - This is acceptable, because a test of the real hazard (a count near `UINT32_MAX`) would itself need about 32 GiB with the old code. - Mention this in the description so the claim reads as an equivalence check, not as proof of the bound. ## Not verified - `ANYPS5_USE_SYSTEM_DEPS=ON` builds: no system FreeType on this machine. - Windows and MinGW, including the 32-bit `FT_ULong` tag and length paths, and the `ENVIRONMENT_MODIFICATION` PATH setup. - Behaviour on the console, and whether the host renderer honours these settings for guest glyphs. The debt entry records this. - `tools/nid_names.py` NID-to-name mapping: I did not run it. <!-- anyps5-bots job=3318 head=3a1af1e45e547147e017bfa8a72d2b5c848b74c6 -->
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!15444
No description provided.