Repository navigation
fix: start system font scan during language-aware context setup - #2640
Karloss1234 wants to merge 1 commit into
Conversation
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Start font scan during setup crates/ui-egui/src/app.rs |
setup_context_for_language starts font scanning before it sets font definitions and applies the theme. |
Priority:
Estimated code review effort: 1 (Trivial) | ~4 minutes
Change: Bug fix
Possibly related PRs
- storytold/gridcraft#2714: Adds Linux fontconfig discovery and Arabic fallback, which can use the scan started during language-aware setup.
- storytold/gridcraft#2275: Adds installed-font cataloging for the snapshot example, addressing a similar missing-scan path.
- storytold/gridcraft#581: Adds desktop system-font support for Indian-script interface languages, which uses system-font discovery.
Suggested reviewers: dylanmtaylor
Merge Risk: 
Minimal · up to 567cc
-
The change restores font scanning for language-aware startup without introducing an established merge-blocking risk.
Security architecture risk: 
Minimal · up to 567cc
-
The change activates existing local-font discovery during language-aware startup. It adds no caller-selected scan path or additional privileges, and preserves the existing safeguards for repeated initialization and font publication. No material security regression was identified.
Retained concerns
No architecture-level concerns identified.Security review details
-
Security Blast Radius
- inferred — The exposure change is activation of existing local-font parsing for native language-aware callers, under the application process’s filesystem authority. Influence over scanned content depends on local filesystem or process-environment control; the changed method supplies no document-derived scan path. On wasm, start_scan initiates no background work.
Trust Boundaries and Controls
- observed — The existing scanner filters font extensions, checks file metadata against a 64 MiB size threshold before reading, caps retained family aliases at 16 per face, and deduplicates visited directories. These controls remain in place on the newly activated path; they do not establish a total scan-resource bound.
Resilience and Maintainability Implications
- observed — If the catalog is not published, the completion gate prevents workbook-font rebinding while initial language-font installation proceeds independently. The change preserves this separation between initial rendering setup and background discovery.
-
Pre-merge checks: 
5
-
Full details: Docstring Coverage
-
Explanation
Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 1 functions across 1 files.
-
Finishing Touches
-
🧪 Generate unit tests (beta)
-
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Comment @coderabbitai help to get the list of available commands.
|
CodeRabbit identified #2229 as a potentially related issue. This fix may also resolve that report, since the root cause appears to be the same: I reproduced the problem on Kubuntu 26.04 and Fedora 44. After adding |
|
This fix also addresses the root cause of the Calibri rendering problem I previously reported in #1815. My original assumption was that Calibri needed improved rendering at 100% zoom. Further investigation showed that the installed font wasn't being loaded, and GridCraft was displaying a substitute font instead. This PR fixes the font substitution Problem. |
3daed92 to
567cc7a
Compare
|
Review notes (not a formal review) on head 567cc7a. Checked
Not checked
|
|
Additional evidence: I have also tested standard GridCraft v0.13.0 on a native Windows installation running from an SSD where the same font discovery issue occurs, so the issue is not specific to Linux (Kubuntu or Fedora). I haven't tested this PR Font Scan solution with the Windows installation. This PR solution has been tested successfully in GridCraft v0.13.0 on Kubuntu and Fedora. I am surprised that no one else has noticed that GridCraft only displays three different fonts across a selection of 17 fonts. The three displayed fonts are fallback fonts because there is no system font scan on GridCraft Startup (Calibri and Arial are identical etc). With this PR there are 17 visibly different and correct fonts. Does no one install/test the desktop version of GridCraft? |
This is a good callout - to be fair I typically always run the default font in whichever I'm in (GridCraft or Excel)... but would be a good thing to test regularly to make sure this system is running. Thanks for calling it out. |
|
It would be great if this PR could be reviewed and, if appropriate, merged. I'd like to build on these changes to investigate and improve some of the remaining font-rendering issues, but it would be helpful to have this font-discovery work confirmed first. v0.14.2 has been tested. Thanks! |
FredApps
left a comment
There was a problem hiding this comment.
ReviewerA — source-read COMMENT (not an approval)
I read the whole diff: one line calling fonts::start_scan() in setup_context_for_language. start_scan is guarded by a OnceLock, so a second call is a no-op, and it is a no-op on wasm. That looks safe. Please add a note or test showing the scan now starts before the first language-specific font lookup (the stated bug), since nothing in the diff proves the ordering.
I ran nothing and have no exact-head CI result for this PR, so this is not an approval.
Status: waiting_author.
Problem
On Linux, GridCraft was not rendering installed system fonts such as Arial, Calibri, Courier New, and Times New Roman correctly. Bold and italic variants were also affected.
The font scanner was never started during the normal desktop startup path.
Root cause
fonts::start_scan()was called bysetup_context(), but the desktop application usessetup_context_for_language()instead.Consequently, the background font scan never started, leaving system font families unavailable to the renderer.
Fix
Call
fonts::start_scan()fromsetup_context_for_language().The scanner uses
OnceLock, so repeated calls are safe.Verification
Tested on Kubuntu 26.04. Before the fix, the font scan never completed because it was not started. After the fix, installed system fonts were discovered and registered, and normal, bold, and italic rendering worked correctly.
Summary by CodeRabbit