feat(libcairo): implement the FreeType font face lifetime exports #18406
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/18406"
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 simnJS on 2026-11-11T13:29:06Z.
What
Implements
cairo_ft_font_face_create_for_ft_face,cairo_font_face_reference,cairo_font_face_destroy,cairo_font_face_get_user_dataandcairo_font_face_set_user_datafollowing Cairo 1.18.0. This addresses the review of #16892:FT_Face,face_indexand load flags, as in_cairo_ft_unscaled_font_keys_equaland_cairo_ft_font_face_create. A repeated call returns the same face with one more reference and shared user data.FT_Face; Cairo does not either.NO_MEMORY). No invented status codes are used._cairo_user_data_array_set_data: replacing or clearing a key releases the old data, and an empty slot is reused.__put, the last reference stays while the finalizers run, so a finalizer may reference and destroy the face.cairo_ft_font_options_substituteis not touched (#16895).Recorded in the debt file:
tools/guest_pointer_audit.pyreports the read offace->face_index; Cairo reads it directly too.Tested
guest_cairo_*tests andpublic_headerspass.guest_cairo_font_facealso passed under ASan and UBSan on an earlier stack of this change.FT_Face.guest_cairo_font_face.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 PrivacyOnion on 2026-11-11T15:42:15Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
18161f0f80:tools/check_conventions.pypassed;git diff --checkclean.guest_cairo_font_face_testsbuilt cleanly.guest_cairo_font_face):core/libs/prx/libcairo/Export.cpp,core/libs/prx/libcairo/include/InventoryExports.hpp,core/libs/prx/libcairo/libcairo.hppreverted tomain, the new tests do not build/link without the change; restoring it makes them build and pass.Looks Good To Me
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-12T14:25:40Z.
Review: COMMENTED
Full AI review: FreeType font face lifetime exports — no blocking findings
Nothing blocks this; the points below are optional.
What I ran
18161f0f80322a836858afe8f786574d69ae0599, basemain. Read-only review: no build, no compiler, no tests run.manifest.json,files.jsonand the fulldiff.patch.GuestCairoFontFace.cppby hand againstFontFace.cpp.Results
FontFace.cppcairo_font_face_destroyonlyCommands and searches
Findings
Blocking
None.
Non-blocking
core/libs/prx/libcairo/FontFace.cpp:134:cairo_font_face_set_user_datacalls the old slot'sdestroybefore it replaces the slot. A callback that sets the same key again sees the old entry and releases the same data a second time. Failure:set(key, A, DA), thenset(key, B, DB).DA(A)runs and callsset(key, C, DC). The slot still holdsA, soDA(A)runs again, andCis then overwritten byBand never released. Swapping the slot to the new value first, then calling the saved olddestroy, avoids both problems. Cairo's own ordering is not verified here.Sources
face_indexis a field of the guest face record, as the cache key assumes.NotImplemented_nid_no_patchis[[noreturn]], as the null-face paths assume.Not verified
guest_cairo_*tests,public_headers, and the ASan and UBSan runs: not run here. The PR description reports them; I did not confirm them.tools/guest_pointer_audit.pyoutput for theface_indexread: not run.SceTypes.hpp, included byinclude/FontFace.hpp: not located with the reader.Export.cppandInventoryExports.hppwere read as diff only.FontFace.cpp,include/FontFace.hppandtests/GuestCairoFontFace.cpp.Export.cpp,CMakeLists.txt,libcairo.hpp,InventoryExports.hppanddocs/dev/debt/libcairo.mdwere reviewed from their diff hunks only. Nothing was excluded.To get this to a good state
Nothing is required.
Optional:
destroy(finding 1), and add a test that replaces a key from inside its own destroy callback.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-14T01:14:10Z.
Review: COMMENTED
Reviewed — comments
Changes are required before merge: the review is incomplete because I could not run the required reader command or inspect all reviewed files.
What I ran
The prepared diff is pinned to head
679799633831233b812f78f61ed970b6875ff9df. No tests or build commands were run. Repository context was read through the review tools.Results
Findings
Blocking
None verified.
Non-blocking
None.
Not verified
The attempted reader invocation could not run in this environment. I read
review/description.md,review/commits.md,review/manifest.json, andreview/diff.patch(lines 1–511). I inspected the changed implementation incore/libs/prx/libcairo/FontFace.cppas shown in the diff and the added test source shown there. I did not read every file listed as reviewed in the manifest, nor verify test results reported in the PR description.To get this to a good state
Nothing is required. The optional point is to complete review of all files marked reviewed and run the relevant checks before making a formal decision.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-14T23:28:46Z.
Review: COMMENTED
Reviewed — no blocking findings
The implementation is supported by targeted source review, but I did not run the reported tests or inspect every changed file, so a formal approval is not justified.
What I ran
0729def9fab91783bbdae8ef126c78f9ce0d444busingrepo_read.py.Results
Findings
Blocking
None identified in the code reviewed.
Non-blocking
None.
Not verified
I read
description.md,commits.md,diff.patch,manifest.json,README.md, and the changed source ranges forFontFace.cpp,FontFace.hpp,CMakeLists.txt, anddocs/dev/debt/libcairo.md. I did not read all added lines inGuestCairoFontFace.cpp, or the changed file contents forExport.cpp,InventoryExports.hpp, andlibcairo.hpp. The author-reported Linux tests, sanitizer run, and Cairo comparison were not run or independently confirmed. Windows and console behavior were not verified.To get this to a good state
Nothing is required. Optional: complete review of the remaining changed lines and independently run the reported checks before relying on this review as a merge decision.