mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-12-31 10:42:12 +00:00
This adds functionality for choosing different normalization metrics for each fallback font. It's not exposed as a config option, but could be in the future, which would probably go a long way towards addressing concerns like #7929. The currently available reference metrics are, in priority order: `ic_width, ex_height, cap_height, line_height, em_size`. The default value is `ic_width`. By priority order, I mean that if the chosen metric is not defined in the fallback font, we move to the next metric in the list---we don't normalize by an estimated metric from the fallback font (however, we're happy to use an estimated metric from the primary font, that's how `ic_width` normalization between CJK and Latin fonts work). This extends the pattern that was used between `ic_width` and `ex_height` in the existing hardcoded rule. `line_height` is always defined, so the buck stops there. What motivated me to implement this was the fact that, with the existing hardcoded rule, the embedded symbols-only Nerd Font was always scaled up by a factor of 1.2, which turned out to be an important reason why it's been difficult to make icon scaling work to everyone's satisfaction. Accordingly, the symbols-only font is the first to take advantage of the new functionality. If this PR is merged, #7917 is no longer needed. (To limit the scope of this PR, it only includes the minimal changes to let icon scaling take advantage of this functionality. I may submit a follow-up PR with some further icon scaling improvement enabled by this.)