feat(libSceFreeType): implement FT_Open_Face for memory and path sources #10604

Merged
MarcZX10 merged 10 commits from upstream-pr/10604 into main 2026-11-06 20:29:59 +00:00
MarcZX10 commented 2026-10-24 12:18:00 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-24T12:18:00Z.


What

Adds FT_Open_Face to libSceFreeType, following the bundled FreeType 2.13.3 (ftobjs.c) with the LP64 FT_Open_Args layout (new GuestOpenArgs, with a layout assertion). It supports the FT_OPEN_MEMORY and FT_OPEN_PATHNAME sources: a memory source is opened in place like FT_New_Memory_Face, and a path is read into memory owned by the face like FT_New_Face. The argument checks and their order follow the native call (null arguments, null library, face-count query with no output, masked face index). FT_OPEN_STREAM, FT_OPEN_DRIVER and FT_OPEN_PARAMS throw: they carry guest callbacks, module handles or parameter arrays the host cannot use. Console signature, argument layout and errors are unverified; the debt entry says so.

Commits: implementation, test, debt entry.

Tested

Linux x86-64, GCC, full CMake build (Ninja, Release). guest_freetype_open_face writes a fixture font under a temporary app0 directory and compares the guest call with the native FT_Open_Face for a memory source and a path source (face counts, flags, glyph count and metrics), a missing path, a null path, a null memory base, no source, a face-count query with no output, a request for a second face, a masked face index, a null argument block and a null library, and checks that the three unsupported flags throw. The host CPU (Xeon E5-1620 v2) fails the startup CPU-feature gate, so I ran the test with that check disabled in a local, uncommitted edit; it exits 0. Windows was not run. tools/check_conventions.py and git diff --check pass. No title or GPU involved.

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:4995316115 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10604). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-24T12:18:00Z. --- ### What Adds `FT_Open_Face` to libSceFreeType, following the bundled FreeType 2.13.3 ([ftobjs.c](https://github.com/freetype/freetype/blob/42608f77f20749dd6ddc9e0536788eaad70ea4b5/src/base/ftobjs.c)) with the LP64 `FT_Open_Args` layout (new `GuestOpenArgs`, with a layout assertion). It supports the `FT_OPEN_MEMORY` and `FT_OPEN_PATHNAME` sources: a memory source is opened in place like `FT_New_Memory_Face`, and a path is read into memory owned by the face like `FT_New_Face`. The argument checks and their order follow the native call (null arguments, null library, face-count query with no output, masked face index). `FT_OPEN_STREAM`, `FT_OPEN_DRIVER` and `FT_OPEN_PARAMS` throw: they carry guest callbacks, module handles or parameter arrays the host cannot use. Console signature, argument layout and errors are unverified; the debt entry says so. Commits: implementation, test, debt entry. ### Tested Linux x86-64, GCC, full CMake build (Ninja, Release). `guest_freetype_open_face` writes a fixture font under a temporary `app0` directory and compares the guest call with the native `FT_Open_Face` for a memory source and a path source (face counts, flags, glyph count and metrics), a missing path, a null path, a null memory base, no source, a face-count query with no output, a request for a second face, a masked face index, a null argument block and a null library, and checks that the three unsupported flags throw. The host CPU (Xeon E5-1620 v2) fails the startup CPU-feature gate, so I ran the test with that check disabled in a local, uncommitted edit; it exits 0. Windows was not run. `tools/check_conventions.py` and `git diff --check` pass. No title or GPU involved. ### 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: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
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!10604
No description provided.