feat(desktop): custom font family option (rebased #4165)#4194
Merged
Conversation
Lets power users type an arbitrary CSS font-family stack (persisted in localStorage, injected as --font-family-custom). A blank value removes the property and the CSS falls back via var(), so the stack never begins with a leading comma that would void the whole font-family.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Lands #4165 (custom font-family option in desktop Appearance settings) on current
main-v2, with the review fix applied.Credit to @myNinety for the feature; folded in @SivanCola's review fix and a small cleanup.
Fixes over #4165
--font-family-custom:(empty), so--sansbecame, "PingFang SC", …with a leading comma, voiding the wholefont-family. NowapplyFontFamilyremoves the property when the name is blank, and the CSS readsvar(--font-family-custom, "PingFang SC")so a missing value degrades gracefully.applyFontFamily(font)call in theonFontFamilyhandler.What it does
font-familystack (e.g."LXGW WenKai", "JetBrains Mono", monospace), persisted inlocalStorageand injected as the--font-family-customCSS variable.style.setPropertyand consumed throughvar()in afont-familycontext —var()substitution is token-scoped and can't break out of the declaration, so a bad value only falls back, it can't inject CSS.Verification (local)
pnpm --dir desktop/frontend typecheck— clean apart from the usual ungenerated-wailsjsbinding errors thatwails generateresolves in CI.pnpm --dir desktop/frontend check:css— green.Closes #4165