Skip to content

Font customization#150

Merged
speziato merged 22 commits into
mainfrom
feat/add-font-settings
May 19, 2026
Merged

Font customization#150
speziato merged 22 commits into
mainfrom
feat/add-font-settings

Conversation

@speziato
Copy link
Copy Markdown
Collaborator

@speziato speziato commented May 9, 2026

Summary 💡

This PR adds system fonts retrieval to be used by the frontend, to enable users to change their preferred font for the general interface and for monospaced inputs.

Closes: #115

Description 📝

This implementation reads fonts from system folders (which are selected based on the build target), deduplicates all font families for the same font, and classifies them (monospace or not).

This also implements a caching mechanism to avoid reloading all fonts every time. The cache can be invalidated with the refresh boolean in go function's invocations.

It adds three new configuration parameters. The font family ones are backwards compatible: if missing, treat as default (font families as defined by the frontend by default).

A new go dependency (golang.org/x/image v0.39.0) to read font metadata was added.

I took the opportunity to rework the Appearance pane of the Settings modal: the color schemes where too big and wording around theme and colors was misleading. I refactored it to use dropdowns inside groups of cohesive settings:

image image image image

Breaking Changes 💔

The zoom configuration setting is NOT backwards-compatible: it substitutes the previous LocalStorage-based implementation.

Tests performed 🧪

  • All new tests specific for font deduplication, validation and classification pass
  • No regression with an old configuration
  • Font preferences are saved and used on closing and reopening the app

@speziato speziato linked an issue May 9, 2026 that may be closed by this pull request
Comment thread internal/configuration/configuration_manager.go Outdated
Comment thread internal/configuration/configuration_manager.go
Comment thread internal/configuration/configuration_manager.go Outdated
@speziato speziato force-pushed the feat/add-font-settings branch 5 times, most recently from d52447e to ef072b4 Compare May 16, 2026 22:01
@speziato speziato marked this pull request as ready for review May 16, 2026 22:07
@speziato speziato requested a review from matstech May 16, 2026 22:07
Comment thread frontend/src/lib/components/Settings/AppearancePane.svelte Outdated
Comment thread internal/fonts/list.go Outdated
speziato added 16 commits May 18, 2026 00:02
This also implements a caching mechanism to avoid reloading all fonts every time. The cache can be invalidated with the `refresh` boolean.

The implementation also uses different files based on the build target to list the correct folders based on the underlying os.

A new dependency to read font metadata was added.
Prefer user system settings instead, and scale the whole interface from the frontend's zoom level. Maybe in a future commit we could add the persistence of the zoom level to the saved app config
- add dedicated component for appearance pane
- add reusable anchored dropdowns
- fix codemirror font settings
- avoid unnecessary writes in stores
this implementation completely replaces the golang.org/x/image package because it has an issue with variable fonts is using the `ParseCollectionReaderAt` and `ParseReaderAt` functions.
@speziato speziato force-pushed the feat/add-font-settings branch from d8a4a15 to abe2121 Compare May 17, 2026 22:09
@speziato speziato force-pushed the feat/add-font-settings branch from 2ea20e7 to 89e9a83 Compare May 19, 2026 18:40
This fork is used as a temporary solution until it's merged upstream. We should monitor [the issue we opened](golang/go#79489) and eventually the related PR.

Co-authored-by: matstech <matteo.stabile2@gmail.com>
@speziato speziato force-pushed the feat/add-font-settings branch from 89e9a83 to d8eca4f Compare May 19, 2026 18:44
@speziato speziato merged commit 8cfbcbf into main May 19, 2026
9 checks passed
@speziato speziato deleted the feat/add-font-settings branch May 19, 2026 19:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add configuration settings for font family and size

2 participants