Skip to content

doctor: match font names the way qt lists them - #3972

Merged
bbedward merged 3 commits into
duxlabs-dev:masterfrom
cmleon51:fix/font_settings
Oct 29, 2026
Merged

bbedward merged 3 commits into
duxlabs-dev:masterfrom
cmleon51:fix/font_settings

Conversation

@cmleon51

@cmleon51 cmleon51 commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Description

This PR aims to fix the following problem mentioned in Issue #3935: when running the command dms doctor -v and a font that exists in multiple foundries exists it will give out an error and say that the configured font is not in fc-list.

Cause: the problem arises in the fact that in qt qml Qt.fontFamilies() is used while in the go code only the list from fc-list : family is checked and they give out different kind of lists

Fix: in the go code we now build a qt-like font list taking into account the fact that font families may come from different foundries

This PR doesn't aim to solve the other issue mentioned: when a dropdown list has an element that is wider than the given width the elements text will be cut off. The fix lives in dux-qml-common in the following PR: duxlabs-dev/dux-qml-common#33

Claude code was used to generate the code but I take responsibility for it since I have reviewed it, understood it and modified it.

Type of change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that changes existing behavior)
  • Refactor / internal cleanup
  • Documentation
  • Other

Related issues

Fixes #3935

Screenshots / video

Before this PR we can see that when selecting RobotoMono Nerd Font [pyrs] dms doctor -v gives a warning:
1793132415559594817

After my PR the warning is gone:
1793132444600126877

Checklist

  • My code follows the conventions in CONTRIBUTING.md
  • I have tested my changes locally
  • New user-facing strings are wrapped in I18n.tr() with translator context, reusing existing terms where possible
  • Go changes: ran make fmt, added/updated tests, make test passes, and go mod tidy is clean
  • QML changes: ran make lint-qml with no new warnings
  • I have opened a corresponding pull request in dlx-docs to document any new behaviors: https://github.com/duxlabs-dev/dux-docs

@bbedward

Copy link
Copy Markdown
Member

/claude review

Comment thread core/cmd/dms/commands_doctor.go Resolved
@claude

claude Bot commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

Claude review

One regression to fix before merge.

  • A bare family name with more than one foundry now warns "not found" even though Qt still resolves it, core/cmd/dms/commands_doctor.go:1832
    Checked: fc-list parsing against Qt's fontconfig registration (alternate names, foundry suffixes, generic families), the checkConfiguredFont and checkFonts call sites, and the tests. Model: claude-opus-5-5.

@cmleon51

Copy link
Copy Markdown
Contributor Author

Hello,
I have thought about this PR and I have reworked how fonts are dealt with in dux shell:

  • The font list is not separate anymore between Qt and go, Qt asks go the font list
  • There are no more fonts with different foundries in the list since picking a specific font foundry breaks some rendered text (e.g. RobotoMono Nerd Font [pyrs] draws upright text with the italic file) while the bare font uses all available foundries.
  • The font list doesn't give out weight-named families anymore like Noto Sans Light, that's the slider's responsability to deal with

I understand that these changes will "break" some doctor -v commands since fonts like Robotmono Ned Font [pyrs] will get a warning asking the user to pick the font again but I think that these changes will make the font picker spimpler and easier to understand and we no longer depend on how qt lists fonts.

@bbedward

Copy link
Copy Markdown
Member

/claude review

_families = ["Default"].concat(DCommon.Fonts.selectableFamilies(root.defaultFamily));
_enumerated = true;
DMSService.sendRequest("fonts.families", null, response => {
if (response.error || !Array.isArray(response.result)) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the request fails (socket not connected, or an older dms without fonts.families), _families stays ["Default"]. Because _enumerated is already true, it never retries, so the picker loses the bundled fonts and every installed font. The old code always had a list from Qt.fontFamilies().

Fix: fall back to the local list on error:

Suggested change
if (response.error || !Array.isArray(response.result)) {
if (response.error || !Array.isArray(response.result)) {
root.log.error("Failed to load font families:", response.error);
root._families = ["Default"].concat(DCommon.Fonts.selectableFamilies(root.defaultFamily));
return;
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like this suggestione, if the system can't talk to the server it shouldn't show a list of fonts, even tho those are from Qt. Only Go should create the list and if that's not possible an error is shown (through commit "266ceae3ad9c") and a log will be stored too.

Comment thread core/internal/fonts/families.go Resolved
@claude

claude Bot commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

Claude review

Two issues to fix before merge.

  • If the fonts.families request fails, the picker shows only "Default" and never retries, with no fallback to the local list, quickshell/Modules/Settings/Widgets/SettingsFontDropdownRow.qml:29
  • The generic aliases mean Families() is never empty, so doctor can no longer report an empty fontconfig cache, core/internal/fonts/families.go:25
    Checked: the new fonts.families IPC handler and API bump, fc-list parsing, doctor call sites and bundled font paths, the font dropdown request and fallback paths, and the tests. Model: claude-opus-5-5.

@bbedward

Copy link
Copy Markdown
Member

/claude review

@claude

claude Bot commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

Claude review

No new issues found. The empty-cache report is fixed in 8c6ed06. The earlier comment about the font picker having no fallback when fonts.families fails still applies to SettingsFontDropdownRow.qml:29.
Checked: the fonts.families handler and API bump, the fc-list family[0] parsing and generic aliases, the doctor family set and empty-cache paths, the gochi hand bundled path and tests, and the picker request and filtering. Model: claude-opus-5-5.

@cmleon51

Copy link
Copy Markdown
Contributor Author

Fixes that claude suggested are applied except the one regarding having a fallback for the font list since that wouldn't make sense in that we would end up having a different font / value in the end, if go can't return the font list an error is logged and through a Toast is shown.

@bbedward

Copy link
Copy Markdown
Member

I gotta do some regression testing on this one, feels like I'm getting half the fonts that QTs list has available to choose from

@cmleon51

Copy link
Copy Markdown
Contributor Author

The font list is shorter (e.g. on my machine it went from 805 fonts to 339) but almost all of the missing fonts are duplicate names for the same font:

  • There are no more Family [Foundry] entries in the list (e.g. RobotoMono Nerd Font used to be listed as RobotoMono Nerd Font [pyrs]/RobotoMono Nerd Font [GOOG] but now appears only with it's bare name, which uses all foundries)
  • There are no more Short Nerd Font names entries in the list (e.g. in Qt's list JetBrainsMono NF, NFM and NFP are alternate names of JetBrainsMono Nerd Font, Nerd Font Mono and Nerd Font Propo, now only their bare name appears)
  • There are no more Weight-named families entries in the list (e.g. Noto Sans Light is gone and only Noto Sans stays since we can use the weight slider to adjust it).

There are regressions which are worth mentioning:

  • Italic faces that the font only exposes as an alternate name (e.g. Red Hat Mono Italic). Fonts that name their italic as the main family, like Red Hat Display Italic, are still listed.
  • Condensed widths that are only alternate names (DejaVu Sans Condensed, Open Sans Condensed), since there's no width setting. Condensed fonts that are a family of their own, like IBM Plex Sans Condensed or Nimbus Sans Narrow, are still listed.

However, these regressions account for 19 missing fonts on my machine, and they can be brought back if needed. the other 453 fonts were just duplicates.

For reference the font list now matches Obsidian and Zed (apart from two Red Hat italics).

@bbedward

Copy link
Copy Markdown
Member

I think I'd rather just fix the doctor matcher with this, and potentially trim the duplicates with QTs list, instead of relying on the go daemon for listing fonts

@github-actions github-actions Bot added core Go daemon and CLI under core/ fix labels Oct 29, 2026
@cmleon51

Copy link
Copy Markdown
Contributor Author

Sure thing, I have reverted my latest changes and only kept the ones that deal with matchint Qt.fontFamilies() output.

I will see about filtering Qt.fontFamilies() in another PR.

Thank you.

@bbedward

Copy link
Copy Markdown
Member

/claude review

@claude

claude Bot commented Oct 29, 2026

Copy link
Copy Markdown
Contributor

Claude review

No issues found. The revert to a doctor-only fix is clean, and the bare-name regression from the first review is fixed in 45e93c5.
Checked: the fc-list family/style/foundry parsing and alternate-name cutoff, bare and [foundry] registration, generic aliases, empty-cache and fc-list-missing paths in checkFonts/checkConfiguredFont, the new gochi hand bundled path against dux-qml-common, and the tests. Model: claude-opus-5-5.

@bbedward
bbedward merged commit b18fc38 into duxlabs-dev:master Oct 29, 2026
4 checks passed
dux-ci Bot pushed a commit that referenced this pull request Oct 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core Go daemon and CLI under core/ fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Font settings show installed fonts as missing, and font picker names are truncated

2 participants