Skip to content

feat(libSceFreeType): implement FT_Get_Gasp - #9530

Merged
oneandonlydean merged 2 commits into
boykopovar:mainfrom
Ondra97:codex/feat-freetype-gasp
Oct 23, 2026
Merged

oneandonlydean merged 2 commits into
boykopovar:mainfrom
Ondra97:codex/feat-freetype-gasp

Conversation

@Ondra97

@Ondra97 Ondra97 commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

What

Implement the missing guest FT_Get_Gasp query (l4azYkX86Ds). Resolve the existing guest face to its native FreeType face and return the font's rasterizer-advice flags for the complete 32-bit ppem argument. This lets guest clients choose hinting and grayscale/monochrome rendering from the font's gasp table.

The name/NID is in the pinned PS5 3.20 inventory; the ABI follows the existing face bridge and public FT_Int(FT_Face, FT_UInt) signature. Behavior comes directly from bundled FreeType 2.13.3 ftgasp.c and its gasp table loader. Console version/result compatibility remains unverified and is recorded in debt. No title unblock or performance improvement is claimed.

Extend the existing font fixture with an optional, correctly indexed gasp table and exercise the query through the existing guest_freetype test. All eight synthetic fonts are checked against native FreeType and independently specified range results; rendering choices made from the returned flags also produce matching glyph bitmaps. There is no new CMake target or third-party dependency.

The former merge-order predecessor #9309 is merged; the branch includes its character-size implementation and current transform and naming tests.

Tested

Rebased on upstream main 0db47b263d1019043f7d28fad4e7ee0a1ea5ec6a; tested head ac06b871a9299345e55f64f7fa6e632bf02262ef. Windows 11 Pro 10.0.26300, WinLibs MinGW-w64 GCC 15.2.0 UCRT, Ninja, Release, BUILD_TESTING=ON, bundled dependencies. CPU: AMD Ryzen 9 7900X; RAM: 32 GB; GPU: NVIDIA GeForce RTX 4070 Ti SUPER. Font rendering uses the CPU.

  • cmake --build ../build --target relinker libs guest_freetype_tests guest_freetype_charmap_tests guest_freetype_names_tests guest_freetype_sfnt_names_tests guest_freetype_request_size_tests patched_libraries_tests guest_font_tests guest_system_font_tests guest_font_writing_line_tests font_face_lifetime_tests --parallel 8: production relinker, all patched libraries and selected runtime fixtures built successfully with submitted sources only.
  • ctest --test-dir ../build -R '^(guest_freetype.*|guest_.*font.*|font_.*|patched_libraries)$' -V --output-on-failure --no-tests=error: 12/12 passed, no skips, 1.80 s total; 367 patched libraries loaded, 0 failed.
  • Gasp regression: 8 synthetic fonts, 524,304 range/extreme-size queries, null-face checks and 14 rendered glyph comparisons against native FreeType. Current upstream coverage includes 1,555 outline-orientation cases, 2 rendered glyph comparisons, character-size, size requests, naming and font lifetimes.
  • python tools/check_conventions.py --base origin/main, python tools/check_main_sync.py --base origin/main --strict, git diff origin/main...HEAD --check and python tools/check_test_registration.py ../build: passed; 1,209 test executables, none built and unregistered.
  • python tools/pr_overlap.py --branch codex/pr9530-rebase-20261023b --repo boykopovar/AnyPS5 --jobs 8: reviewed. The old feat(libSceFreeType): implement FT_Get_Gasp #9530 head is the expected self-match; feat(libSceFreeTypeOl): declare 150 PS5 3.20 exports #9453 adds a throwing same-NID stub in the separate libSceFreeTypeOl library. feat(libSceFreeType): decompose guest outlines #9560 and feat(libSceFreeType): expose LP64 trigonometry #9574 add independent functions at shared test/include insertions; their merge order is separate from this implementation. Remaining conflicting shared debt entries describe independent bitmap, bounding-box, PostScript or platform-export work. feat(libSceFreeType): expose CID font metadata #9545 and feat(libSceFreeType): manage multiple size objects #9550 add separate CID/size functions and test helpers. No other open PR implements this guest query in libSceFreeType.

The include conflict preserves main's <algorithm>/<bit> imports for outline orientation alongside FT_GASP_H. git range-diff confirms unchanged query and regression behavior. The original missing-feature baseline cannot link this regression because it lacks FT_Get_Gasp_nid_postfix. Console compatibility and title-level impact remain unverified.

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

@github-actions

github-actions Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Progress report (0db47b2 → ac06b87)

➖ System libraries: 45.17% (+0.0%, +1 implemented functions)

✅ 1 implemented
Library Name
libSceFreeType FT_Get_Gasp_nid_postfix

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The wrapper delegates to the bundled FreeType 2.13.3 FT_Get_Gasp using the mapped native face; I checked the source's null/non-SFNT, range-boundary, no-table and version-0 masking behavior against the regression's expectations. The fixture computes the SFNT search parameters from its table count, and the tests compare both the guest adapter and native FreeType across the documented range and rendering cases. The declared #9309 dependency is accurate: a direct merge conflicts only in the shared debt file. Current eligibility, conventions, intake, labels and report checks pass; product/relinker jobs are skipped. The extensive build/test evidence in the PR is author-reported; I did not run a local build or tests.'

@Ondra97

Ondra97 commented Oct 22, 2026

Copy link
Copy Markdown
Contributor Author

I am preparing FT_Outline_Get_Orientation as an independent follow-up. It shares include/debt insertion points with this PR, but no exported function implementation. I will list #9530 as the merge-order dependency (which already orders #9309 first), then rebase those insertions after this PR merges. No changes to this branch are needed.

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rechecked the unchanged FT_Get_Gasp adapter against bundled FreeType 2.13.3, including null/no-table results, range boundaries, version-0 masking and preservation of guest slot state. The regression and reported rendered-glyph comparisons cover the public behavior; #9309 remains open as the declared debt insertion predecessor. Eligibility, conventions, intake, labels and report checks pass; platform/product jobs were skipped. I did not rerun local tests.

@Ondra97

Ondra97 commented Oct 22, 2026

Copy link
Copy Markdown
Contributor Author

I opened #9560, which adds FT_Outline_Decompose. I declared #9530 for merge order because the regression calls share an insertion, and its #9309 dependency adds separate helpers at the decomposition test-helper insertion. Retain both tests and their helpers. The implementations are independent.

@fogydes

fogydes commented Oct 22, 2026

Copy link
Copy Markdown
Contributor

Reviewed; no issues found. The wrapper keeps the sibling pattern (FaceOf + null host through to FT_Get_Gasp, which answers FT_GASP_NO_TABLE for a null face — the test pins that for both null ppems). The test's oracle is the host FreeType itself: 524304 guest/native query pairs over the full ppem range plus malformed and version-0 gasp tables, and the version-zero flags & 3 expectation matches the freetype source, so nothing in the answer space is invented. The fixture's font-table builder computes the table-directory searchRange/entrySelector correctly for the now-eight-table font (largest power of two at or below the entry count); the old hard-coded 4-table values stay byte-identical for fonts of that size, so existing tests are unaffected. Debt entry added with the exact freetype source link. Runtime stays inside the 30 s budget.

@MarcZX10

Copy link
Copy Markdown
Contributor

I rechecked current head c6c78bf28c2a: it merges cleanly with today’s main, and current diff-check/conventions pass. The reported 524,304 query comparisons, 14 rendered-glyph checks and 3/3 FreeType CTest selection are strong author-reported evidence. This branch is 2 ahead / 119 behind current main (merge base a6dcea927); please refresh it and rerun the focused FreeType tests/checks. Keep the declared #9309 debt-file order; #9538 also uses this PR as its declared predecessor for a shared test insertion.

@github-actions

github-actions Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
PR 9453 FT_Get_Gasp

Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 9848 docs/dev/debt/libSceFreeType.md

@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Oct 23, 2026
@Ondra97
Ondra97 force-pushed the codex/feat-freetype-gasp branch from f8abb04 to ef0bbdd Compare October 23, 2026 03:08
@github-actions github-actions Bot added needs rebase Conflicts with main, rebase needed and removed needs rebase Conflicts with main, rebase needed labels Oct 23, 2026
@Ondra97
Ondra97 force-pushed the codex/feat-freetype-gasp branch from ef0bbdd to ac06b87 Compare October 23, 2026 05:49
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Oct 23, 2026
@oneandonlydean oneandonlydean self-assigned this Oct 23, 2026
@oneandonlydean
oneandonlydean merged commit 4ac5597 into boykopovar:main Oct 23, 2026
11 of 12 checks passed
@Ondra97
Ondra97 deleted the codex/feat-freetype-gasp branch October 25, 2026 02:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants