Skip to content

fix(libSceFont): use current style for glyph and kerning scales - #8633

Merged
oneandonlydean merged 1 commit into
boykopovar:mainfrom
vittoriosalvadore:codex/fix-font-point-dpi-scales
Oct 23, 2026
Merged

oneandonlydean merged 1 commit into
boykopovar:mainfrom
vittoriosalvadore:codex/fix-font-point-dpi-scales

Conversation

@vittoriosalvadore

@vittoriosalvadore vittoriosalvadore commented Oct 20, 2026 •

Copy link
Copy Markdown

What

After setting a font size in points or changing its DPI, generated glyphs and ordinary kerning still use the pixel dimensions last written by sceFontSetScalePixel (or the initial 16-pixel defaults). The font's pixel getter and rendered metrics already use the current style, so those paths disagree.

Read ordinary kerning dimensions from the current style and capture each generated glyph's dimensions together with its metrics under the same font lock. Remove the obsolete duplicate dimensions from FontState, including instance copying. For example, 20 by 30 points at 144 DPI now produces a glyph reporting 40 by 60 pixels and the corresponding kerning; subsequent DPI changes are reflected consistently. Renderer-specific scaling remains independent.

#8058 is already merged and its fallback face selection is preserved. This changes sceFont behavior, separate from the native FreeType export added by #8558. No title or performance claim.

Tested

Windows 11 x64, required WinLibs MinGW-w64 GCC 15.2.0 r7 (x86_64-ucrt-posix-seh), Release, full root configuration with BUILD_TESTING=ON and bundled dependencies.

  • Built guest_font_tests, guest_system_font_tests, guest_font_writing_line_tests, font_face_lifetime_tests and guest_freetype_tests.

  • CTest focused pattern: ^(guest_font|guest_system_font|guest_font_writing_line|font_face_lifetime.*|guest_freetype)$, verbose, parallel 2, timeout 30: seven tests passed with zero skips.

  • New runtime assertions cover point sizes, independent axis DPI, default/reset DPI, pixel sizing, generated glyph metadata, kerning, independent instances and renderer scale isolation.

  • Negative control: keep the new test but restore all five changed production files from main, rebuild guest_font_tests and confirm guest_font fails with the generated-glyph scale mismatch. Restore this change, rebuild, and all seven focused tests pass again.

  • cmake --build <build> --parallel 3 --target libs relinker: passed.

  • python -B tools/check_conventions.py --base origin/main: passed.

  • python -B tools/pr_overlap.py --branch codex/fix-font-point-dpi-scales: no reported conflicting lines/exports; manually inspected test: organize library tests and label CTest suites #6044, which renames GuestFont.cpp unchanged. Temporary merge-tree comparisons with our fix(libSceFont): accept overlapping render surface rows #8250 and other Font PRs fix(libSceFont): keep horizontal writing on a single baseline #5209/fix(libSceFont): open fonts and the system font directory under non-ASCII paths on Windows #8375 are clean.

  • Final diff reviewed by Astra high with no unresolved findings.

Independent Linux validation by Filip722 on this exact head: Debian 13.7 x86-64, GCC 15.2.0, bundled FreeType 2.13.3; all seven focused tests passed without skips. The same negative control failed with the expected scale mismatch, then all seven tests passed after restoring the PR. This is contributor-reported focused runtime validation, not a full Linux build or test-suite run.

No game, console hardware, macOS runtime or complete CTest suite tested. The author's local build and runtime validation were on Windows.

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 20, 2026 •

Copy link
Copy Markdown

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 6044 core/libs/tests/GuestFont.cpp

@Filip722

Copy link
Copy Markdown
Contributor

Independent Linux testing of head f956527f6739d47dd483f65b1a6eb73e8bd8dea6:

  • Debian 13.7 x86-64, Linux 7.2.9-x64v3-xanmod1, AMD Ryzen 5 7640HS, GCC 15.2.0.
  • Release, BUILD_TESTING=ON, ANYPS5_RELINKER_ONLY=OFF, bundled FreeType 2.13.3. Built all five focused test targets and their runtime dependencies successfully.
  • 7/7 tests passed, no skips, using:
ctest --test-dir build -R '^(guest_font|guest_system_font|guest_font_writing_line|font_face_lifetime.*|guest_freetype)$' -V --timeout 30

The new guest_font assertions exercise point-to-pixel conversion, independent axis DPI, reset/default DPI, pixel sizing, generated-glyph metadata, kerning, independent font instances and renderer scale isolation on Linux.

I also repeated the negative control locally: kept the PR's test and restored only its five production files from base 434e965d4620c48e315b25fb869a2d84b39cfb2d. guest_font failed with:

Generated glyph scale 100.000 x 100.000 differs from font scale 40.000 x 60.000

Restored the exact PR implementation, rebuilt, and all seven focused tests passed again. Conventions and diff whitespace checks passed.

Focused Linux runtime tests only; no full test-suite, game or console-hardware testing. No other unmerged PR was applied.

AI-assisted: yes.

@github-actions github-actions Bot added the prx label Oct 20, 2026
@vittoriosalvadore

Copy link
Copy Markdown
Author

@Filip722 Thank you for validating #8633 on Linux and repeating the negative control. All seven focused tests also pass on Windows with zero skips.

@vittoriosalvadore

Copy link
Copy Markdown
Author

@adriadam10 Could you run full Linux and Windows CI for #8250, #8633 and #8997 (full=true, linux=true, select=false)? My account has read-only access. I found no runs for these PRs among the latest 100 manual dispatches. Thank you.

@oneandonlydean oneandonlydean self-assigned this Oct 22, 2026
@oneandonlydean
oneandonlydean merged commit ca6fbf7 into boykopovar:main Oct 23, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants