feat(libfreetype): implement the Multiple Masters getters #15442

Merged
VakzOs merged 4 commits from upstream-pr/15442 into main 2026-11-07 03:29:16 +00:00
VakzOs commented 2026-11-03 10:11:25 +00:00 (Migrated from github.com)

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


What

The legacy libfreetype exports PS-iwpPa2tc and K9ZOPLPOqbY threw. The verified NID name database names them FT_Get_MM_Blend_Coordinates and FT_Get_MM_WeightVector, and tools/nid_names.py computes the same NIDs for those names. They are now implemented in src/MultipleMasters.cpp.

Both resolve the host FT_Face behind the guest FT_FaceRec from libSceFreeType and call the bundled FreeType 2.15.0. The console's FT_Fixed is 64-bit and Windows' is 32-bit, so the values go through a native buffer and are copied back to the guest array only on success. The weight vector length is written back as FreeType writes it. Errors are FreeType's own, including Invalid_Face_Handle for a null face and Invalid_Argument for a face without Multiple Masters. FreeType is asked for at most 65536 entries, more than any face has axes or designs; guest entries beyond that repeat FreeType's own padding value, so a huge count needs no huge scratch array.

Tested

Linux, GCC 13, Release: the new guest_legacy_freetype_multiple_masters passes. It opens FreeType's test fonts varc-reset-only.ttf (one variation axis) and varc-static-gvar.ttf (no fvar) through both the guest API and native FreeType. For counts 0, 1 and 3, and for weight vector lengths 0 and 2, it checks that results, copied values, untouched padding and lengths match native FreeType, with and without an output array. It also compares 65539 entries with native FreeType, which checks that the entries beyond the 65536-entry cap repeat FreeType's padding; this is an equivalence check, not a proof of the bound, since the uncapped version passes it too and a count near UINT32_MAX would need about 32 GiB with that version. It also checks the null-face result. Breaking the copy-back makes the test fail. The test needs FreeType's test fonts from the submodule, so it is registered only when ANYPS5_USE_SYSTEM_DEPS is off, as libSceFreeTypeOl does. 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 (land order: #15408, #15439, then this PR)
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5135421242 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/15442). Originally posted by [VakzOs](https://github.com/VakzOs) on 2026-11-03T10:11:25Z. --- ### What The legacy `libfreetype` exports `PS-iwpPa2tc` and `K9ZOPLPOqbY` threw. The [verified NID name database](https://github.com/zecoxao/sce_symbols/blob/2883963a0a514ba6e77407a08ef4730a65e88254/aerolib.csv) names them `FT_Get_MM_Blend_Coordinates` and `FT_Get_MM_WeightVector`, and `tools/nid_names.py` computes the same NIDs for those names. They are now implemented in `src/MultipleMasters.cpp`. Both resolve the host `FT_Face` behind the guest `FT_FaceRec` from libSceFreeType and call the bundled FreeType 2.15.0. The console's `FT_Fixed` is 64-bit and Windows' is 32-bit, so the values go through a native buffer and are copied back to the guest array only on success. The weight vector length is written back as FreeType writes it. Errors are FreeType's own, including `Invalid_Face_Handle` for a null face and `Invalid_Argument` for a face without Multiple Masters. FreeType is asked for at most 65536 entries, more than any face has axes or designs; guest entries beyond that repeat FreeType's own padding value, so a huge count needs no huge scratch array. ### Tested Linux, GCC 13, Release: the new `guest_legacy_freetype_multiple_masters` passes. It opens FreeType's test fonts `varc-reset-only.ttf` (one variation axis) and `varc-static-gvar.ttf` (no `fvar`) through both the guest API and native FreeType. For counts 0, 1 and 3, and for weight vector lengths 0 and 2, it checks that results, copied values, untouched padding and lengths match native FreeType, with and without an output array. It also compares 65539 entries with native FreeType, which checks that the entries beyond the 65536-entry cap repeat FreeType's padding; this is an equivalence check, not a proof of the bound, since the uncapped version passes it too and a count near `UINT32_MAX` would need about 32 GiB with that version. It also checks the null-face result. Breaking the copy-back makes the test fail. The test needs FreeType's test fonts from the submodule, so it is registered only when `ANYPS5_USE_SYSTEM_DEPS` is off, as libSceFreeTypeOl does. `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 (land order: #15408, #15439, then this PR) - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
XairRrR commented 2026-11-03 11:38:35 +00:00 (Migrated from github.com)

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

Review: APPROVED


Reviewed — approved

FT_Get_MM_Blend_Coordinates, FT_Get_MM_WeightVector and the stacked FT_Gzip_Uncompress (from #15439) forward correctly to the bundled FreeType 2.15.0, and the new tests pass. The test fonts only have zero blend coordinates, so the Multiple Masters test does not check the values that get copied back.

What I ran

Head 90223b33c2b4e213b30bba725b9a15cc15187b05, main 4f41f4c375f5abb487dbd184fbc150f31994d762, merged tree b1273630265df613b995fdd82cd0c1214c03f6bb. Debian 13 VM, GCC 14.2.0, Release, Ninja.

git diff --check 4f41f4c375f5abb487dbd184fbc150f31994d762...90223b33c2b4e213b30bba725b9a15cc15187b05
python3 tools/check_conventions.py --base 4f41f4c375f5abb487dbd184fbc150f31994d762
ctest --test-dir build --output-on-failure -R "guest_legacy_freetype|public_headers|guest_freetype_face_info"
# negative control (see below)
ninja -C build -j32 -l32 guest_legacy_freetype_gzip_tests guest_legacy_freetype_multiple_masters_tests
ctest --test-dir build --output-on-failure -R guest_legacy_freetype
# restore merged files, rebuild, rerun
ninja -C build -j32 -l32 guest_legacy_freetype_gzip_tests guest_legacy_freetype_multiple_masters_tests libfreetype
ctest --test-dir build --output-on-failure -R guest_legacy_freetype
git status --porcelain

Results

Check Result
git diff --check clean
check_conventions.py All conventions checks passed
Configure / build / libs (script) ok
Selected tests (script) 2461 run, 0 new failures, 0 timeouts. 4 failures also happen on main (guest_interfaces, guest_socket_options_multicast, unwrap_self_..._group, vector_constant_factor_tininess). guest_net_ctl is skipped on main too.
guest_legacy_freetype_gzip passed (0.01 s)
guest_legacy_freetype_multiple_masters passed (0.01 s)
public_headers*, guest_freetype_face_info passed (68/68 in the focused run)
Vulkan validation not applicable: no AGC, shader or VideoOut files changed

Negative control

The production sources are new files, and without the new CMakeLists.txt the tests are not even registered, so restoring main proves nothing. I broke the code inside the merged tree instead:

  • src/Gzip.cpp: I removed the *outputLength = length write-back. guest_legacy_freetype_gzip aborted (it fails, as it should).
  • src/MultipleMasters.cpp, copy-back removed: I deleted both copy-back loops. guest_legacy_freetype_multiple_masters aborted (it fails, as it should).
  • src/MultipleMasters.cpp, zeros written: I made the copy-back write 0 instead of native[index]. guest_legacy_freetype_multiple_masters still passed (see the first non-blocking finding).

I then restored both files from the merged tree and rebuilt. Both tests pass again, and git status --porcelain is empty.

Findings

Blocking

None.

Non-blocking

  1. The Multiple Masters test does not check the copied values. core/libs/tests/GuestLegacyFreeTypeMultipleMasters.cpp:84 expects every coordinate to be 0. varc-reset-only.ttf sits at its default instance, and the weight vector never succeeds on either font, which the debt entry says too. A copy-back that writes zeros, or truncates FT_Fixed, therefore passes. That partly contradicts "Breaking the copy-back makes the test fail" in the description: removing the copy-back is caught, writing the wrong values is not.

    • Suggested fix: before comparing, set a non-default instance on both the native face and the host face behind the guest face, for example with FT_Set_Var_Blend_Coordinates. The comparison would then use non-zero values.
  2. A guest-controlled count sizes the host allocation. core/libs/prx/libfreetype/src/MultipleMasters.cpp:18 and :29 allocate numCoords + 1 (or *length + 1) host FT_Fixed values before FreeType has checked the face. A bogus count such as 0xFFFFFFFF throws std::bad_alloc (32 GiB) through a VABI export. Native FreeType would just write into the guest's buffer. This is unlikely from a real title.

    • Suggested fix: clamp the buffer to the face's axis or design count, or use a fixed T1_MAX_MM_AXIS/T1_MAX_MM_DESIGNS-sized buffer plus the guest count. Native FreeType's padding behaviour must stay the same.
  3. This PR also contains #15439's commits. The diff includes de485286749a and 557fcc76e754 (FT_Gzip_Uncompress), and the description only mentions them through Depends on: #15439. I reviewed them here as well: the FT_Memory bridge to the guest memory record and the FT_ULong range check look correct, and the gzip test fails without the length write-back. After #15439 lands, rebase so this PR carries only the Multiple Masters commit.

Not verified

  • Windows/MinGW, where FT_Fixed/FT_ULong are 32-bit: I did not build or run it. The ULONG_MAX branch of the gzip test only compiles there.
  • Weight vector success path: a successful FT_Get_MM_WeightVector on an Adobe Multiple Master font is not exercised, which the debt entry also says.
  • Two FreeType copies: libfreetype and libSceFreeType each link their own static FreeType (--exclude-libs,ALL), and the getters run on a face created by the other copy. This works because both are built from the same freetype target. I did not test it with ANYPS5_USE_SYSTEM_DEPS=ON.
  • Console behaviour: I did not check hardware or a title.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5751508440 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/15442#pullrequestreview-5751508440). Originally posted by [XairRrR](https://github.com/XairRrR) on 2026-11-03T11:38:35Z. **Review:** APPROVED --- # Reviewed — approved `FT_Get_MM_Blend_Coordinates`, `FT_Get_MM_WeightVector` and the stacked `FT_Gzip_Uncompress` (from #15439) forward correctly to the bundled FreeType 2.15.0, and the new tests pass. The test fonts only have zero blend coordinates, so the Multiple Masters test does not check the values that get copied back. ## What I ran Head `90223b33c2b4e213b30bba725b9a15cc15187b05`, `main` `4f41f4c375f5abb487dbd184fbc150f31994d762`, merged tree `b1273630265df613b995fdd82cd0c1214c03f6bb`. Debian 13 VM, GCC 14.2.0, Release, Ninja. ``` git diff --check 4f41f4c375f5abb487dbd184fbc150f31994d762...90223b33c2b4e213b30bba725b9a15cc15187b05 python3 tools/check_conventions.py --base 4f41f4c375f5abb487dbd184fbc150f31994d762 ctest --test-dir build --output-on-failure -R "guest_legacy_freetype|public_headers|guest_freetype_face_info" # negative control (see below) ninja -C build -j32 -l32 guest_legacy_freetype_gzip_tests guest_legacy_freetype_multiple_masters_tests ctest --test-dir build --output-on-failure -R guest_legacy_freetype # restore merged files, rebuild, rerun ninja -C build -j32 -l32 guest_legacy_freetype_gzip_tests guest_legacy_freetype_multiple_masters_tests libfreetype ctest --test-dir build --output-on-failure -R guest_legacy_freetype git status --porcelain ``` ## Results | Check | Result | |---|---| | `git diff --check` | clean | | `check_conventions.py` | All conventions checks passed | | Configure / build / `libs` (script) | ok | | Selected tests (script) | 2461 run, 0 new failures, 0 timeouts. 4 failures also happen on `main` (`guest_interfaces`, `guest_socket_options_multicast`, `unwrap_self_..._group`, `vector_constant_factor_tininess`). `guest_net_ctl` is skipped on `main` too. | | `guest_legacy_freetype_gzip` | passed (0.01 s) | | `guest_legacy_freetype_multiple_masters` | passed (0.01 s) | | `public_headers*`, `guest_freetype_face_info` | passed (68/68 in the focused run) | | Vulkan validation | not applicable: no AGC, shader or VideoOut files changed | ## Negative control The production sources are new files, and without the new `CMakeLists.txt` the tests are not even registered, so restoring `main` proves nothing. I broke the code inside the merged tree instead: - **`src/Gzip.cpp`:** I removed the `*outputLength = length` write-back. `guest_legacy_freetype_gzip` aborted (it fails, as it should). - **`src/MultipleMasters.cpp`, copy-back removed:** I deleted both copy-back loops. `guest_legacy_freetype_multiple_masters` aborted (it fails, as it should). - **`src/MultipleMasters.cpp`, zeros written:** I made the copy-back write `0` instead of `native[index]`. `guest_legacy_freetype_multiple_masters` still **passed** (see the first non-blocking finding). I then restored both files from the merged tree and rebuilt. Both tests pass again, and `git status --porcelain` is empty. ## Findings ### Blocking None. ### Non-blocking 1. **The Multiple Masters test does not check the copied values.** `core/libs/tests/GuestLegacyFreeTypeMultipleMasters.cpp:84` expects every coordinate to be 0. `varc-reset-only.ttf` sits at its default instance, and the weight vector never succeeds on either font, which the debt entry says too. A copy-back that writes zeros, or truncates `FT_Fixed`, therefore passes. That partly contradicts "Breaking the copy-back makes the test fail" in the description: removing the copy-back is caught, writing the wrong values is not. - **Suggested fix:** before comparing, set a non-default instance on both the native face and the host face behind the guest face, for example with `FT_Set_Var_Blend_Coordinates`. The comparison would then use non-zero values. 2. **A guest-controlled count sizes the host allocation.** `core/libs/prx/libfreetype/src/MultipleMasters.cpp:18` and `:29` allocate `numCoords + 1` (or `*length + 1`) host `FT_Fixed` values before FreeType has checked the face. A bogus count such as `0xFFFFFFFF` throws `std::bad_alloc` (32 GiB) through a VABI export. Native FreeType would just write into the guest's buffer. This is unlikely from a real title. - **Suggested fix:** clamp the buffer to the face's axis or design count, or use a fixed `T1_MAX_MM_AXIS`/`T1_MAX_MM_DESIGNS`-sized buffer plus the guest count. Native FreeType's padding behaviour must stay the same. 3. **This PR also contains #15439's commits.** The diff includes `de485286749a` and `557fcc76e754` (`FT_Gzip_Uncompress`), and the description only mentions them through `Depends on: #15439`. I reviewed them here as well: the FT_Memory bridge to the guest memory record and the `FT_ULong` range check look correct, and the gzip test fails without the length write-back. After #15439 lands, rebase so this PR carries only the Multiple Masters commit. ## Not verified - **Windows/MinGW, where `FT_Fixed`/`FT_ULong` are 32-bit:** I did not build or run it. The `ULONG_MAX` branch of the gzip test only compiles there. - **Weight vector success path:** a successful `FT_Get_MM_WeightVector` on an Adobe Multiple Master font is not exercised, which the debt entry also says. - **Two FreeType copies:** `libfreetype` and `libSceFreeType` each link their own static FreeType (`--exclude-libs,ALL`), and the getters run on a face created by the other copy. This works because both are built from the same `freetype` target. I did not test it with `ANYPS5_USE_SYSTEM_DEPS=ON`. - **Console behaviour:** I did not check hardware or a title. <!-- anyps5-bots job=3275 head=90223b33c2b4e213b30bba725b9a15cc15187b05 -->
XairRrR commented 2026-11-03 12:23:17 +00:00 (Migrated from github.com)

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

Review: APPROVED


Re-checked — approved

The new commit bdc326089eac caps the host scratch arrays of both Multiple Masters getters at 65536 entries and keeps FreeType's padding and *len behaviour. It adds a 65539-entry comparison against native FreeType and registers that test only when ANYPS5_USE_SYSTEM_DEPS is off. This resolves the one finding that touched the code. The other two findings are still open and are non-blocking.

What changed since my last review

  • Commits 1–3 are unchanged (same SHAs). There is one new commit, bdc326089eac ("bound the Multiple Masters scratch arrays and skip their test with system deps"):
    • src/MultipleMasters.cpp: FreeType is asked for at most ScratchLimit = 0x10000 entries.
      • Guest entries past that copy native[used - 1], which is FreeType's padding value.
      • The weight vector writes back the guest's requested length when FreeType left nativeLength untouched, and FreeType's value otherwise.
    • Test: a new CheckLargeCounts compares 65539 entries with native FreeType, for both functions and both fonts.
    • CMakeLists.txt: the Multiple Masters test is registered only when ANYPS5_USE_SYSTEM_DEPS is off, as libSceFreeTypeOl does for its own font-based test. Each test now gets its own Windows PATH property.
    • Debt entry: it now records the 65536 cap.
  • The description was updated to match. There are no new author comments.

What I ran

Head bdc326089eacc9b0d3fb0f8f656d0db14c6bd7e8, main 4f41f4c375f5abb487dbd184fbc150f31994d762, merged tree 356b760655a7502b24e42fd8d7408732266f7055. Debian 13 VM, GCC 14.2.0, Release, Ninja.

git show bdc326089eacc9b0d3fb0f8f656d0db14c6bd7e8
git diff --check 4f41f4c375f5abb487dbd184fbc150f31994d762...bdc326089eacc9b0d3fb0f8f656d0db14c6bd7e8
python3 tools/check_conventions.py --base 4f41f4c375f5abb487dbd184fbc150f31994d762
ctest --test-dir build --output-on-failure -R "guest_legacy_freetype|guest_freetype_face_info"
# mutation A: blend copy-back limited to `used` entries (no padding repeat)
ninja -C build -j32 -l32 guest_legacy_freetype_multiple_masters_tests libfreetype
ctest --test-dir build --output-on-failure -R guest_legacy_freetype_multiple_masters
# mutation B: weight vector writes back `nativeLength` unconditionally
ninja -C build -j32 -l32 guest_legacy_freetype_multiple_masters_tests libfreetype
ctest --test-dir build --output-on-failure -R guest_legacy_freetype_multiple_masters
# restore the merged file, rebuild, rerun
ninja -C build -j32 -l32 guest_legacy_freetype_multiple_masters_tests libfreetype
ctest --test-dir build -R guest_legacy_freetype
git status --porcelain
Check Result
git diff --check clean
check_conventions.py All conventions checks passed
Configure / build / libs (script) ok
Selected tests (script) 2457 run, 0 new failures, 0 timeouts. The 4 known main failures are unchanged. guest_net_ctl is skipped on main too.
guest_legacy_freetype_gzip, guest_legacy_freetype_multiple_masters, guest_freetype_face_info passed (3/3, each at most 0.01 s)
Mutation A (no padding repeat beyond 65536) guest_legacy_freetype_multiple_masters aborted, so the test catches it
Mutation B (*length = nativeLength always) guest_legacy_freetype_multiple_masters aborted, so the test catches it
Restore and rerun 2/2 passed, git status --porcelain empty
Vulkan validation not applicable: no AGC, shader or VideoOut files changed

I also checked the new clamping against the bundled FreeType 2.15.0 sources (src/base/ftmm.c, T1_Get_MM_Blend and T1_Get_MM_WeightVector in src/type1/t1load.c, and the TrueType GX getter):

  • Blend coordinates: FreeType fills every entry past the axis count with a constant: 0 for GX, 0x8000 for Type 1. An fvar axis count fits in 16 bits and Type 1 has at most 4 axes, so a 65536-entry request always ends in padding, and repeating native[used - 1] gives what native FreeType would write.
  • Weight vector, short buffer: when requested < num_designs, used == requested and FreeType writes num_designs back.
  • Weight vector, success: FreeType writes num_designs, which is at most 16. It can only equal used when used == requested.
  • Weight vector, early errors: a null face, a missing blend or the len && !weightvector check leave nativeLength == used, so the guest's length stays as it was.
  • Zero count: used - 1 is never evaluated, because both loops run zero times.

So core/libs/prx/libfreetype/src/MultipleMasters.cpp:25, :36 and :38 match native FreeType in every case I traced.

Previous findings

  1. The Multiple Masters test does not check the copied values. Still open, non-blocking. CheckLargeCounts adds coverage of the padding and of the length, but every coordinate is still 0. Line 97 of core/libs/tests/GuestLegacyFreeTypeMultipleMasters.cpp still expects zeros, and no non-default instance is set. A copy-back that writes zeros would still pass. The suggestion stands: call FT_Set_Var_Blend_Coordinates on both faces before comparing.
  2. A guest-controlled count sizes the host allocation. Resolved. ScratchLimit caps the scratch vector at 65537 FT_Fixed values (lines 21 and 32). The 65539-entry test and the two mutations above show that the behaviour beyond the cap still matches native FreeType.
  3. This PR also carries #15439's commits. Still open, non-blocking. Commits de485286749a and 557fcc76e754 are unchanged. Rebase once #15439 lands.

New findings

Blocking

None.

Non-blocking

None.

Not verified

  • Windows/MinGW, where FT_Fixed and FT_ULong are 32-bit: I did not build or run it, including the split ENVIRONMENT_MODIFICATION properties.
  • ANYPS5_USE_SYSTEM_DEPS=ON: I did not configure it. I only read the CMake to confirm that the Multiple Masters test is not registered there and that the gzip test still is.
  • Weight vector success path: a successful FT_Get_MM_WeightVector on an Adobe Multiple Master font is still not exercised, as the debt entry says.
  • Console behaviour: I did not check hardware or a title.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5752080992 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/15442#pullrequestreview-5752080992). Originally posted by [XairRrR](https://github.com/XairRrR) on 2026-11-03T12:23:17Z. **Review:** APPROVED --- # Re-checked — approved The new commit `bdc326089eac` caps the host scratch arrays of both Multiple Masters getters at 65536 entries and keeps FreeType's padding and `*len` behaviour. It adds a 65539-entry comparison against native FreeType and registers that test only when `ANYPS5_USE_SYSTEM_DEPS` is off. This resolves the one finding that touched the code. The other two findings are still open and are non-blocking. ## What changed since my last review - Commits 1–3 are unchanged (same SHAs). There is one new commit, `bdc326089eac` ("bound the Multiple Masters scratch arrays and skip their test with system deps"): - **`src/MultipleMasters.cpp`:** FreeType is asked for at most `ScratchLimit = 0x10000` entries. - Guest entries past that copy `native[used - 1]`, which is FreeType's padding value. - The weight vector writes back the guest's requested length when FreeType left `nativeLength` untouched, and FreeType's value otherwise. - **Test:** a new `CheckLargeCounts` compares 65539 entries with native FreeType, for both functions and both fonts. - **`CMakeLists.txt`:** the Multiple Masters test is registered only when `ANYPS5_USE_SYSTEM_DEPS` is off, as `libSceFreeTypeOl` does for its own font-based test. Each test now gets its own Windows `PATH` property. - **Debt entry:** it now records the 65536 cap. - The description was updated to match. There are no new author comments. ## What I ran Head `bdc326089eacc9b0d3fb0f8f656d0db14c6bd7e8`, `main` `4f41f4c375f5abb487dbd184fbc150f31994d762`, merged tree `356b760655a7502b24e42fd8d7408732266f7055`. Debian 13 VM, GCC 14.2.0, Release, Ninja. ``` git show bdc326089eacc9b0d3fb0f8f656d0db14c6bd7e8 git diff --check 4f41f4c375f5abb487dbd184fbc150f31994d762...bdc326089eacc9b0d3fb0f8f656d0db14c6bd7e8 python3 tools/check_conventions.py --base 4f41f4c375f5abb487dbd184fbc150f31994d762 ctest --test-dir build --output-on-failure -R "guest_legacy_freetype|guest_freetype_face_info" # mutation A: blend copy-back limited to `used` entries (no padding repeat) ninja -C build -j32 -l32 guest_legacy_freetype_multiple_masters_tests libfreetype ctest --test-dir build --output-on-failure -R guest_legacy_freetype_multiple_masters # mutation B: weight vector writes back `nativeLength` unconditionally ninja -C build -j32 -l32 guest_legacy_freetype_multiple_masters_tests libfreetype ctest --test-dir build --output-on-failure -R guest_legacy_freetype_multiple_masters # restore the merged file, rebuild, rerun ninja -C build -j32 -l32 guest_legacy_freetype_multiple_masters_tests libfreetype ctest --test-dir build -R guest_legacy_freetype git status --porcelain ``` | Check | Result | |---|---| | `git diff --check` | clean | | `check_conventions.py` | All conventions checks passed | | Configure / build / `libs` (script) | ok | | Selected tests (script) | 2457 run, 0 new failures, 0 timeouts. The 4 known `main` failures are unchanged. `guest_net_ctl` is skipped on `main` too. | | `guest_legacy_freetype_gzip`, `guest_legacy_freetype_multiple_masters`, `guest_freetype_face_info` | passed (3/3, each at most 0.01 s) | | Mutation A (no padding repeat beyond 65536) | `guest_legacy_freetype_multiple_masters` aborted, so the test catches it | | Mutation B (`*length = nativeLength` always) | `guest_legacy_freetype_multiple_masters` aborted, so the test catches it | | Restore and rerun | 2/2 passed, `git status --porcelain` empty | | Vulkan validation | not applicable: no AGC, shader or VideoOut files changed | I also checked the new clamping against the bundled FreeType 2.15.0 sources (`src/base/ftmm.c`, `T1_Get_MM_Blend` and `T1_Get_MM_WeightVector` in `src/type1/t1load.c`, and the TrueType GX getter): - **Blend coordinates:** FreeType fills every entry past the axis count with a constant: 0 for GX, `0x8000` for Type 1. An `fvar` axis count fits in 16 bits and Type 1 has at most 4 axes, so a 65536-entry request always ends in padding, and repeating `native[used - 1]` gives what native FreeType would write. - **Weight vector, short buffer:** when `requested < num_designs`, `used == requested` and FreeType writes `num_designs` back. - **Weight vector, success:** FreeType writes `num_designs`, which is at most 16. It can only equal `used` when `used == requested`. - **Weight vector, early errors:** a null face, a missing blend or the `len && !weightvector` check leave `nativeLength == used`, so the guest's length stays as it was. - **Zero count:** `used - 1` is never evaluated, because both loops run zero times. So `core/libs/prx/libfreetype/src/MultipleMasters.cpp:25`, `:36` and `:38` match native FreeType in every case I traced. ## Previous findings 1. **The Multiple Masters test does not check the copied values.** Still open, non-blocking. `CheckLargeCounts` adds coverage of the padding and of the length, but every coordinate is still 0. Line 97 of `core/libs/tests/GuestLegacyFreeTypeMultipleMasters.cpp` still expects zeros, and no non-default instance is set. A copy-back that writes zeros would still pass. The suggestion stands: call `FT_Set_Var_Blend_Coordinates` on both faces before comparing. 2. **A guest-controlled count sizes the host allocation.** Resolved. `ScratchLimit` caps the scratch vector at 65537 `FT_Fixed` values (lines 21 and 32). The 65539-entry test and the two mutations above show that the behaviour beyond the cap still matches native FreeType. 3. **This PR also carries #15439's commits.** Still open, non-blocking. Commits `de485286749a` and `557fcc76e754` are unchanged. Rebase once #15439 lands. ## New findings ### Blocking None. ### Non-blocking None. ## Not verified - **Windows/MinGW, where `FT_Fixed` and `FT_ULong` are 32-bit:** I did not build or run it, including the split `ENVIRONMENT_MODIFICATION` properties. - **`ANYPS5_USE_SYSTEM_DEPS=ON`:** I did not configure it. I only read the CMake to confirm that the Multiple Masters test is not registered there and that the gzip test still is. - **Weight vector success path:** a successful `FT_Get_MM_WeightVector` on an Adobe Multiple Master font is still not exercised, as the debt entry says. - **Console behaviour:** I did not check hardware or a title. <!-- anyps5-bots job=3321 head=bdc326089eacc9b0d3fb0f8f656d0db14c6bd7e8 -->
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!15442
No description provided.