Repository navigation
fix(snap): isolate fontconfig cache to prevent square font rendering - #3103
IsmaelMartinez merged 3 commits into
Conversation
electron-builder's core22 snap launcher template injects the host's $REALHOME/.cache/fontconfig into fonts.conf. On modern distributions like Ubuntu 24.04 LTS, the host's fontconfig format (cache-11/12) conflicts with the runtime's fontconfig 2.12.6 (cache-7), causing UI text and tray context menus to render as square boxes (tofu). Patch desktop-common.sh at build time to isolate the font cache to $SNAP_USER_COMMON/.cache/fontconfig and avoid reading host cache files. Also ensure stale snap font caches are cleared on revision update. closes IsmaelMartinez#3092 refs IsmaelMartinez#1105, IsmaelMartinez#357
âĶn format - Address review comments by testing font cache cleanup execution under SNAP_DESKTOP_COMPONENTS_NEED_UPDATE=true and false. - Ensure host font cache remains untouched during snap cache purges. - Update troubleshooting callout syntax from GitHub alert to Docusaurus :::note. refs IsmaelMartinez#3092
|
There was a problem hiding this comment.
ðĩ Needs a closer look
Compatibility with downloaded architecture-specific launcher templates remains unverified.
0 open findings
What changed in this PR
Addresses square-box text in Snap menus and dialogs by isolating fontconfig caches from the host.
Changes:
- Removes host cache references and clears stale Snap caches on updates.
- Adds regression coverage for isolation, cleanup, and idempotency.
- Documents automatic isolation and older-version workarounds.
| File | Description |
|---|---|
| tests/âunit/âsnapDesktopLauncherPatch.test.js | Tests cache isolation, cleanup, and repeat patching. |
| scripts/âpatchSnapDesktopLauncher.js | Patches the launcher to isolate and refresh font caches. |
| docs-site/âdocs/âtroubleshooting.md | Clarifies when manual workarounds remain necessary. |
ð§ Review effort: Balanced
ðĄ Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
ðĶ PR Snap Build Artifactsâ Snap builds successful! Download artifacts: ð§ Linux Snap Packagesx86_64 (108.20 MB) arm64 (105.53 MB) armv7l (105.27 MB) ð Note: Other package formats (.deb, .rpm, .AppImage, .dmg, .exe) are built in the main workflow |
ðĶ PR Build Artifactsâ Build successful! Download artifacts: ð§ Linuxx86_64 (436.54 MB) - Contains: .deb, .rpm, .tar.gz, .AppImage arm64 (428.80 MB) - Contains: .deb, .rpm, .tar.gz, .AppImage armv7l (430.56 MB) - Contains: .deb, .rpm, .tar.gz, .AppImage ð macOSx86_64 (Intel) (126.01 MB) - Contains: .dmg arm64 (Apple Silicon) (119.11 MB) - Contains: .dmg ðŠ Windowsx86_64 (111.42 MB) - Contains: .exe installer ð Note: Snap packages (.snap) are built in a separate workflow ð Last updated: 2026-10-15 06:42 UTC |
|
Thanks a lot @HamzaHassanM. The squares-instead-of-text bug in the snap has come back on and off for years (#357, #865, #1105, #1328, #1336, #3092), and this is the first fix that addresses the cause rather than asking people to clear caches by hand. Running the actual launcher code under bash in the test is a nice touch. We also checked the patch against the downloaded x64 and armhf launcher templates and the bundled arm64 one, and it applies cleanly to all three. Merging. Generated by Claude Code |



Summary
On modern Linux distributions such as Ubuntu 24.04 LTS, Electron Snap applications experience broken font rendering where UI text (such as system tray context menus and dialogs) renders as square boxes (tofu
âĄâĄâĄâĄ).Root Cause
electron-builder'score22snap launcher runsdesktop-common.sh, which definesmake_user_fontconfigand unconditionally emits<cachedir>$REALHOME/.cache/fontconfig</cachedir>.gnome-3-28-1804(fontconfig 2.12.6, cache format 7), whereas modern host systems runfontconfig 2.15.0+(cache format 11/12).Fix
scripts/patchSnapDesktopLauncher.js, patchdesktop-common.shat build time to remove the$REALHOME/.cache/fontconfigreference frommake_user_fontconfig. The snap now strictly uses its own isolated cache path (<cachedir prefix="xdg">fontconfig</cachedir>), mapped to$SNAP_USER_COMMON/.cache/fontconfig.$XDG_CACHE_HOME/fontconfig) whenSNAP_DESKTOP_COMPONENTS_NEED_UPDATE="true"so existing installations upgrading to this revision automatically purge corrupt/incompatible cache.closes #3092
refs #1105, #357
Testing
npm run lint(required)npm run test:unitDocumentation
docs-site/docs/troubleshooting.mdNotes for reviewers
Unit tests were added in
tests/unit/snapDesktopLauncherPatch.test.jsto ensure the patch removes the host cache directory, adds the cache purge on update, and remains strictly idempotent.
Confidence Score: 5/5
The PR appears safe to merge.Summary
The PR isolates the Snap font cache from the host cache and clears stale Snap caches on revision updates.
Reviews (3) · Last reviewed commit: "test(snap): clean up redundant inline co..." · Reviewed by Greptile