Skip to content

fontique: resolve metric-compatible aliases with fontconfig - #99

Open
nicoburns wants to merge 1 commit into
mainfrom
devin/1793668880-fontconfig-metric-aliases
Open

nicoburns wants to merge 1 commit into
mainfrom
devin/1793668880-fontconfig-metric-aliases

Conversation

@nicoburns

Copy link
Copy Markdown
Member

LLM Contributions: code and description written by Devin; rewrite the description in your own words before upstreaming to linebender/parley.

On Linux, fontique only knows the family names of installed fonts, so font-family: Helvetica, Times, Arial or Times New Roman on a machine without them falls through to the generic default (DejaVu Sans, even for Times). Chrome follows fontconfig's metric aliases and renders them with Liberation Sans/Serif.

At startup, for each name in fontconfig's 30-metric-aliases.conf groups that isn't installed, add_metric_compatible_aliases asks fontconfig for its match and, only when that match is in the same metric-compatible group, adds the name as an alias of the matched family. Fontconfig's catch-all default (e.g. DejaVu Sans for an unknown name) is never aliased, so other missing names still fall through to the CSS fallback list.

Measured in Blitz against Chrome 156 on Ubuntu: text widths for Helvetica, Times, Arial and Times New Roman now match Chrome (315/291px vs 358px before) and the mean pixel difference per line is under 1/255.

One case this doesn't cover: when a Type 1 Courier (pcrr8a.pfb, from gsfonts/TeX) is installed, the name exists but fontique can't load it, so Courier still falls back to DejaVu Sans while Chrome uses Liberation Mono.

Changelog

Fixed

  • Fontconfig backend: uninstalled families such as Helvetica and Times resolve to their metric-compatible substitutes (e.g. Liberation Sans/Serif).

Link to Devin session: https://dioxus.staging.devinenterprise.com/sessions/ce5c4353702746cd821bfeb3812bfd37
Open in Devin Desktop: https://dioxus.staging.devinenterprise.com/desktop/session/ce5c4353702746cd821bfeb3812bfd37?variant=devin-insiders

@staging-devin-ai-integration

Copy link
Copy Markdown

I'll fix CI failures and address comments from users with write access that start with 'Devin'.

  • Disable automatic comment, CI, and merge conflict monitoring

@staging-devin-ai-integration
staging-devin-ai-integration Bot force-pushed the devin/1793668880-fontconfig-metric-aliases branch from 528e311 to 8d8b99e Compare November 3, 2026 01:31
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.

1 participant