-
Notifications
You must be signed in to change notification settings - Fork 691
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adjust fallback font size to match glyph scale of primary font #3029
Comments
@qwerasd205 do you mind adding some additions details to this? It's unclear from the issue here what the actual bug or feature request or what this is. I think the title is likely wrong. |
It is something I plan to get around to some time soon- it's more of a feature request than a bug, since it's just to alleviate some undesirable but expected behavior. The idea is If you wanna change this issue to be about that then "adjust fallback font size to match glyph scale of primary font" or something along those lines would be a better title. |
Got it thanks. I'm going to rename this issue and mark it as a feature then because I think its working fine, but an improvement on it can make it work better. |
Related: #3939 |
This refactor enables two very significant improvements to our font handling, which I will be implementing next: 1. Automatically adjust size of fallback faces to better align with the primary face, a la CSS [`font-size-adjust`](https://developer.mozilla.org/en-US/docs/Web/CSS/font-size-adjust). [^1] 2. Move glyph resizing/positioning out of GPU-land and in to `renderGlyph` and apply alignment/resizing rules from the nerd fonts patcher[^2] to the glyphs at rasterization time, so that we can ensure exact cell fits and swap out our embedded JB Mono with an unpatched version with a separate dedicated symbols-only nerd font. In addition to being necessary prep work for those two changes, this PR is also a minor but real stand-alone improvement. By only computing the cell metrics for our primary font, we avoid a *lot* of wasted work when loading fallback fonts, and also avoid that being a source of load errors, which we don't yet handle gracefully[^3]. To validate this PR I've run the full set of font backend tests locally on my Mac with no failures, and did a sanity check of running Ghostty with both renderers and with CoreText and FreeType font backends and then `cat`ing a file that requires fallback fonts to render, and everything looks correct. [^1]: #3029 [^2]: The alignment and resizing rules for the nerd font symbols are defined in the patcher [here](https://github.com/ryanoasis/nerd-fonts/blob/6d0b8ba05af0d1380905aee1a136c1dedf71c1db/font-patcher#L866-L1151) [^3]: #2991
Certain fonts are just smaller by default, meaning I'd need to increase the font size for them to "look" the same with others. Examples are Inconsolata, Ubuntu Mono, Dank Mono, etc.
When using these fonts with the increased size, the built-in nerd font icons become bigger (makes sense since they follow the configured size) and hence look very disproportionate to the text.
(Reference Discord conversation: https://discord.com/channels/1005603569187160125/1319693664846348288)
The text was updated successfully, but these errors were encountered: