feat(libcairo): implement font options lifecycle and settings #14328
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/14328"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by hyvvs on 2026-11-01T09:26:49Z.
What
Implement eight previously unimplemented
libcairofont-options exports: create, copy, destroy, antialias set/get, hint-style set, hint-metrics set and subpixel-order set. The public declarations now use the Cairo pointer and enum ABI (including explicit 32-bit enum representation for valid out-of-range C values). Each object owns its own allocation, copies are independent, and a shared immutable error object handles null copies and allocation failures; null/error setters and destroy do nothing. Cairo font options have no reference count.Behavior was checked against the Cairo 1.18.4 source and public API documentation. The technical-debt table removes these eight resolved exports, and the progress scanner measures
libcairomoving from 0/161 to 8/161 implemented exports.Merge coordination: #14258 changes disjoint matrix exports but also edits the libcairo debt introduction. #14308 adds unreachable
return 0statements after throwing stubs, including these eight definitions; it contains no competing Cairo semantics. #14327 changes disjoint image/surface exports but shares theExport.cpparea and debt introduction. These may require conflict resolution when merged.Coordinated landing order: #14258 (matrix) -> #14327 (image surfaces) -> #14328 (font options) -> #14329 (regions). Symbol implementations are disjoint but the PRs share Cairo export inventory, CMake, and technical-debt files. Each later PR will integrate earlier merged changes before landing; standalone branches are not yet a single integrated Cairo build.
Tested
GuestCairoFontOptions.cppwithFontOptions.cppusing-std=c++20 -Wall -Wextra -Werror; standalone ABI test passed.-fsanitize=address -fsanitize=undefinedand ran withASAN_OPTIONS=detect_leaks=1:halt_on_error=1andUBSAN_OPTIONS=print_stacktrace=1:halt_on_error=1; passed.python tools/check_conventions.py --base upstream/main: passed.git diff --check: passed.tools/progress.pymeasured exactly the eight intended exports as implemented; no unrelated libcairo export changed.-DBUILD_TESTING=ONbut cannot complete in the fresh worktree because the SDL2 and FFmpeg submodules are not initialized. The standalone test uses the exact production implementation source compiled on each platform.tools/pr_overlap.py --branch feat/libcairo-font-optionswas run and reviewed. Old unrelated PRs sharecore/libs/CMakeLists.txt; their changed-line hunks are separate from this PR's source and test-registration hunks. #14258, #14308 and #14327 are called out above.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by BunnyFl on 2026-11-02T03:42:23Z.
Review: APPROVED
Windows 11, WinLibs GCC 15.2.0 r7, Release. Head
b2d817a3d3merged into upstream/main93dbd0f82a:guest_cairo_font_optionsandpublic_headerspass.cairo_font_options_set_antialiaswriting wheneveroptions != nullptr(so also into the shared error object), the test crashes. So it does exercise a setter on the nil object.Provenance, checked against firmware 13.42's
libcairo.sprx:1.18.0, so 1.18.4'scairo-font-options.cis the right family; the font-options code is the same across those releases.cairo_font_options_create(j2xKmRzIV84) allocates 0x38 bytes and zeroes them, every field at its default. On allocation failure it raises a no-memory error and returns the shared nil object, as the source does and as this implementation models.The landing order you lay out with #14258, #14327 and #14329 is noted. Each of those touches the same debt intro and
Export.cppregion, so the later ones will need the usual rebase.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-02T06:18:19Z.
Review: COMMENTED
Reviewed — no blocking findings
This implements the libcairo font-options exports (create, copy, destroy, the antialias, hint-style, hint-metrics and subpixel-order setters, and the antialias getter) in
FontOptions.cpp, with the stubs removed fromExport.cpp. The implementation follows cairo's nil-object pattern. The PR declares #14327 as a dependency, for merge order only, and the stack report flags the dependency chain. The Windows build compiled the new guest test, but the CTest run did not report it.What I ran
b2d817a3d37662db052dae1253ce5d16c0c9de29; base26fa1212b82f76dd49cf12d65e445d6ff3e0844c. 6 files, +224/-49:libcairo/FontOptions.cpp(new, 71 lines),libcairo/Export.cpp(stubs removed),libcairo/include/InventoryExports.hpp(eight declarations with parameters),core/libs/tests/GuestCairoFontOptions.cpp(new, 102 lines),core/libs/CMakeLists.txt(+8: addsFontOptions.cpptolibcairoand builds the test), anddocs/dev/debt/libcairo.md(not read in full).FontOptions.cppin full and the whole test. Checked the eight declarations against the eight definitions: all match.tools/pr_stack_check.pyfrom the main checkout): dependency order#14258 → #14327 → #14328. The report marks#14327 → #14328ascurrent_dependency_head_not_included, with overlapping changed paths inlibcairo/Export.cpp,libcairo/include/InventoryExports.hppanddocs/dev/debt/libcairo.md. The individual merge preview against current main is clean.guest_cairo_font_options_tests.exeand listed it under the guest tests. No CTest result forguest_cairo_font_optionsappears in the log. The run reports 2594 of 2594.Results
current_dependency_head_not_includedfor #14258 → #14327 and #14327 → #14328, with overlapping paths; individual previews cleanguest_cairo_font_options(hosted)Read-only check output
Precheck was not run: no PR-head code is run here. Diff check: passed. Conventions: passed. ABI audit: passed (161 symbols). Stack check: exit 0, with the flagged dependency relations above. Hosted:
gh api repos/boykopovar/AnyPS5/commits/b2d817a3d37662db052dae1253ce5d16c0c9de29/check-runs, and the Windows job log.Negative control
Not run here. A negative control needs a local build, and code from this head is not run here.
Findings
Blocking
None.
Non-blocking
current_dependency_head_not_included, with overlapping files in libcairo'sExport.cpp,InventoryExports.hppand the debt file. Land #14327 first, and rebase this PR onto it before merging if #14327 changes. Otherwise these files will conflict.FontOptions.cppinto its own executable rather than linking thelibcairotarget, so the test does not exercise the shared library's copy of the code. It is still a valid unit test.Sources
github.com/boykopovar/AnyPS5@b2d817a3d3/core/libs/prx/libcairo/FontOptions.cppgithub.com/boykopovar/AnyPS5@b2d817a3d3/core/libs/tests/GuestCairoFontOptions.cppgithub.com/boykopovar/AnyPS5@b2d817a3d3/core/libs/prx/libcairo/include/InventoryExports.hppgithub.com/boykopovar/AnyPS5@b2d817a3d3/core/libs/CMakeLists.txt(lines 218 and 1277-1282)windowsonb2d817a3d3Not verified
CAIRO_ANTIALIAS_BEST == 6), against cairo's header.To get this to a good state
Imported from boykopovar/AnyPS5. Originally posted by BunnyFl on 2026-11-04T15:39:46Z.
Review: APPROVED
@hyvvs re-checked at
1446abba83. This PR's own files,core/libs/prx/libcairo/FontOptions.cppandcore/libs/tests/GuestCairoFontOptions.cpp, are byte-identical to my approvedb2d817a3d3(git diff b2d817a3d3 1446abba83on both is empty). The new lines come from the #14327 stack.Surface.cpp,include/Surface.hppandtests/GuestCairoSurface.cpphere are identical to #14327's current head255872d012. This approval still covers only the font-options part. I haven't reviewed #14327's surface code.What I ran: head
1446abba83merged ontomainb11c7bf84f(merge486a2d174d), Windows 11, WinLibs GCC, Release,BUILD_TESTING=ON:guest_cairo_matrix,guest_cairo_surface,guest_cairo_font_optionsandpublic_headers: 4 of 4 pass.check_conventions.py --base upstream/mainpasses.pr_overlap.py --branch: 11 open PRs touch the same files. Every one that shares exports is part of your declared Cairo stack (#14327, #14329, #15315, #15317, #15324, #15430, #15675, #15679, #15681).Imported from boykopovar/AnyPS5. Originally posted by BunnyFl on 2026-11-04T21:46:22Z.
Review: APPROVED
@hyvvs re-checked at
282f660d61, still approved for the font-options part.git range-diffagainst my approval of1446abba83: the ten earlier commits are unchanged, and the one new commit,282f660d61("preserve image type on rectangle subsurfaces"), changes onlycore/libs/prx/libcairo/Surface.cppandcore/libs/tests/GuestCairoSurface.cpp. Those two files, andinclude/Surface.hpp, are identical to #14327's current headf6ca44f6ce.FontOptions.cppandGuestCairoFontOptions.cppare unchanged (git diff 1446abba83 282f660d61on both is empty). As before, this approval covers the font options; I haven't reviewed #14327's surface code, including the newcairo_surface_get_typeanswer.What I ran
Windows 11 Pro 10.0.26300, WinLibs GCC 15.2, Release, this head merged cleanly onto
mainb611e634f7(b2ace2f48e):guest_cairo_matrix,guest_cairo_surface,guest_cairo_font_optionsandpublic_headers: 4 of 4 pass.tools/pr_overlap.py --branchon this head: every PR that shares lines is a Cairo PR touching the sameCMakeLists.txtregistrations andExport.cpplines: your stack (#14327, #14329, #15315, #15317, #15324, #15430, #15675, #15679, #15681, #15685) and #15208 (gradient pattern state).