fix(libcairo): reland cairo_ft_font_options_substitute with libfontconfig imports the relinker rewrites #18499
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/18499"
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 AlfaRojo on 2026-11-11T19:00:36Z.
What
Restores
cairo_ft_font_options_substitute(#16895) that #18478 reverted, and fixes the cause of the red Windowspatched_librariestest (libcairo.prx: LoadLibraryEx failed with error 127). This is the fix-forward alternative to the revert; #18478 has since merged, so commit 1 is the revert of that revert and commit 2 is the fix. The feature and its tests are @AlexWhitehouse's from #16895, unchanged except for the renamed calls.Cause: libcairo imported
FcPatternGet,FcPatternDel,FcPatternAddBoolandFcPatternAddIntegerfrom libfontconfig by plain name. The relinker rewrites only<name>_nid_postfiximports to NIDs, and the patched libfontconfig exports only NIDs, so the patched libcairo kept names that no export satisfied and the Windows loader failed eagerly.Fix: these four exports are declared, defined and called as
<name>_nid_postfix(the suffix does not change the NID), the same cross-library mechanism libSceErrorDialog uses for libSceIme (ModalDialogOpen_nid_postfix). No change to the relinker.core/libs/prx/libcairo/CMakeLists.txtadds the newsrc/FtFontOptions.cppsource and its test target, and libcairo now linkslibfontconfig(target_link_libraries(libcairo PRIVATE libfontconfig)). The guest fontconfig and cairo tests call the suffixed names.Tested
Windows 11 Pro 10.0.26200, WinLibs GCC 15.2.0 r7 UCRT, Ninja, Release, on
main65351c2931(#18478).ctest -R "patched_libraries|guest_cairo|guest_fontconfig": 16/16, run 3 times (patched_libraries, guest_cairo_ft_font_options, guest_cairo_font_options and the guest_fontconfig suites pass each time).patched_librariesfails withlibcairo.prx: LoadLibraryEx failed with error 127; with the fix it passes.py -3 tools/check_test_registration.py: no new or unbuilt tests.py -3 tools/check_conventions.py --base upstream/main: passed.boolenum incurl_setup_once.h), so I configured with envCFLAGS="-std=gnu17 -Wno-error=incompatible-pointer-types"; nothing from that is committed.tools/pr_overlap.pyfailed closed (saved with the PR). Uncompared diffs checked by hand: no open libcairo PR (#14212, #15208, #16954, #18381, #18382, #18404, #18406) touches fontconfig calls. Open libfontconfig PRs #17631 (FcDefaultSubstitute), #17744 (FcPatternGetFTFace) and #17741 call or test the four plain names (FcPatternGet,FcPatternAddInteger); whichever merges second needs those calls renamed to the_nid_postfixnames.ece63ef2c5(merged with upstream/maine5dba50ccb, which brought #19141's Cairo and pixman source build; conflict inlibcairo.hppresolved by keeping both includes):ctest -R "patched_libraries|guest_cairo|guest_fontconfig"passes 20 of 20 tests in 3/3 runs;check_test_registration.pyandcheck_conventions.py --base upstream/mainpass. #19141 builds Cairo with the image backend only and does not compilecairo-ft-font.c, socairo_ft_font_options_substituteis still a stub onmain(Export.cpp); this PR supplies it as a port over the guest libfontconfig. The debt file lists 66 stub rows, matching the 66 stubs inExport.cpp.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 MarcZX10 on 2026-11-12T14:28:10Z.
Review: COMMENTED
Reviewed — no blocking findings
The reland of
cairo_ft_font_options_substituteat head64bfec8shows no blocking defect by reading. Its build and tests were not run here.What I ran
64bfec8143a161af8116e2d4ce5e668856c4b654. Base:main. No merged-preview check.Reader output, unedited counts
FcPatternGet(,FcPatternAddBool(,FcPatternAddInteger(,FcPatternDel(incore: 0 matching lines each at head.libfontconfig.hppincludesInventoryExports.hpp.docs/dev/debt/libcairo.md: 73 matching table rows at head.Export.cpp: 73NotImplemented_nid_no_patch(__func__)stubs at head.Results
coreat headlibfontconfig.hppcteston Windowscheck_test_registration.py,check_conventions.pyFindings
Blocking
None.
Non-blocking
core/libs/prx/libcairo/src/FtFontOptions.cpp:1starts with a 35-line LGPL/MPL license block.docs/dev/CONVENTIONS.mdallows code comments only for technical debt, the end of#endif, and the end of a namespace, and the checklist ticks "No comments in code except technical debt". Other ported sources incore/libs/prxcarry license headers, so this may be an accepted exception. Decide which, and make the checklist match.core/libs/prx/libcairo/CMakeLists.txt:101and:102change the libcairo build: a new test target, the new source, andtarget_link_libraries(libcairo PRIVATE libfontconfig). The description says "No change to the relinker or to CMake" and does not mention the new libcairo → libfontconfig link. Correct the description.Not verified
ctestrun on Windows. The author reports 16/16 onmain65351c2931. The description names that revision, not head64bfec8, so I could not confirm the tested tree is this head.tools/check_test_registration.pyandtools/check_conventions.py: author-reported only._nid_postfiximports map to the NIDs the patched libfontconfig exports, and that droppingcairo_ft_font_options_substitutefrom the stubs leaves the NID table correct. The relinker was not read.cairo-ft-font.c: not checked, no network in this run. PS5 behaviour is unmeasured, as the debt file says.To get this to a good state
ctest -R "patched_libraries|guest_cairo|guest_fontconfig"andpy -3 tools/check_test_registration.pyon head64bfec8, and state the revision the run used.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-14T00:12:52Z.
Review: APPROVED
Reviewed — looks good
The reviewed head is
ece63ef2c5c9a0c21d866455e318d4b4caffebf3; I read every file listed as reviewed, found no verified blocking defect, and did not run checks locally.What I ran
No commands were run. The author reports Windows test and convention checks passed; those results were not independently verified.
Results
Findings
Blocking
None.
Non-blocking
None.
Sources
Reviewed the prepared diff and changed sources pinned to the supplied head. The full file texts for all reviewed entries were available; no changed files were excluded by rule.
Not verified
The author-reported Windows test runs, registration check, conventions check, and PS5 behavior were not verified. No files were excluded from review; all files marked
reviewedin the manifest were read.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-15T04:33:25Z.
Review: COMMENTED
Reviewed — comments
The implementation and selected call sites were inspected at head
a8226529e8d032cd368a1d71ad56d2096e4dc55e; I did not run the reported checks or read every changed file, so a formal approval is not justified.What I ran
No commands or tests were run. I inspected the prepared description, commit list, manifest and diff, then used
repo_read.pyto inspect selected source and search for remaining plain-name calls.Results
Findings
Blocking
None identified in the inspected code.
Non-blocking
Not verified
I read
core/libs/prx/libcairo/src/FtFontOptions.cpp,core/libs/prx/libcairo/FontOptions.cpp,core/libs/prx/libfontconfig/Objects.cpp, andcore/libs/prx/libfontconfig/include/InventoryExports.hpp; I inspected relevant diff sections and searched for plain-name uses. I did not read the full text of every changed file, including the new guest test, other changed tests, build configuration and debt documentation. I did not verify compilation, test registration, test execution, Windows loading, or console behavior.To get this to a good state
Nothing is required. Optional: include independently reproducible test output for the reported Windows checks.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-16T04:14:19Z.
Review: COMMENTED
Reviewed — no blocking findings
The inspected implementation follows the stated Cairo font option mappings and routes the affected Fontconfig calls through the suffixed exports; I did not run checks in this review.
What I ran
Reviewed head
d0b21d3c36bab6f977dd3414f5edbee7a42e1eb6usingrepo_read.pyto inspect the prepared diff, manifest and selected source files. No tests or builds were run.Results
Negative control
Not run during this review; the description reports an author-run negative control.
Findings
Blocking
None identified in the inspected code.
Non-blocking
None.
Not verified
The complete contents of
Objects.cpp,PatternFormat.cpp,GuestFontconfigFormat.cpp, andGuestFontconfigObjects.cppwere not read. The entirety ofExport.cppandGuestCairoFtFontOptions.cppwas read; the remaining changed files were inspected only in the portions shown in the diff. No build or test run was performed, and author-reported checks were not independently verified.To get this to a good state
Nothing is required.