Open classabbyamp opened 11 months ago
Ranges for custom assignment of codepoints to glyphs is AFAIK only available on Kitty, right? Or do we have other TEs allowing that as well?
If I am not mistaken, on Linux at least, you could use fontconfig to achieve the same. Googling around, I found this: https://stackoverflow.com/questions/47501411/how-to-set-font-per-unicode-range-codepoint-in-fontconfig I'd have to try it myself, but I think that would be a proper way to do it. Plus point: it would work on every application automatically then.
On the other hand, we planned to integrate "Symbols Nerd Font" (and others) for convenience into Contour natively anyways (#170).
Ranges for custom assignment of codepoints to glyphs is AFAIK only available on Kitty, right? Or do we have other TEs allowing that as well?
not sure, I've used kitty for a while and don't know the whole landscape.
If I am not mistaken, on Linux at least, you could use fontconfig to achieve the same.
I was going to say I already had a fontconfig conf for this but it seems it doesn't do that. Will try the fontconfig conf method.
So using fontconfig for that seems simply impossible (for an user) to do.
There's two ways to promote a font; locale shenanigans (can't work; "dev icons" isn't a locale) or carefully designing your font priority list like a bonzai garden, which is impossible since there's already font priorities set by the system fontconfigs.
Even if this worked, it wouldn't work on other platforms.
On the other hand, we planned to integrate "Symbols Nerd Font" (and others) for convenience into Contour natively anyways (https://github.com/contour-terminal/contour/issues/170).
While I don't have a strong opinion on that, it is not a suitable answer to the problem; It's a forever incomplete solution that only covers one potential use-case. It's worth considering that supersizing the terminal for each special-use font that a user has requested will have undesirable effects, like causing the bundled fonts to not be skippable nor updateable without a terminal update. Some of these fonts can also break use-cases that aren't broken with a normal monospace font: for the entirety of Nerdfont's 2.x releases, it's Material Design Icons were located at incorrect codepoints, clobbering some asian scripts. Preloading box-drawing characters in terminals doesn't have that problem, since the character set is extremely small, and is located in a dedicated and standardised Unicode block.
Abstract
nerd-fonts are a common way to add special symbols in terminal UIs (shell prompts, editors, etc). There are two ways this is implemented, a patched font or a symbols-only font. I prefer to use the symbols-only font because it allows for more flexibility and I don't need to install 2GB worth of duplicate fonts, but it does mean some form of fallback mechanism is necessary. It seems that currently this does partially work:
(kitty left, contour right; notice the incorrect symbol for the
>
)Motivation
To ensure that certain ranges of codepoints have the correct font, I propose a configuration option that allows for assigning ranges to certain fonts. I suspect this assignment might already be possible under-the-hood, given the
font.emoji
config option.Specification
My thought is something like:
Other Implementations
https://sw.kovidgoyal.net/kitty/conf/#opt-kitty.symbol_map