I am using vim in (kitty) terminal where I can set different font for normal, italic, bold and italic-bold text. This is important because (for instance) Cascadia Code has many weights as separate fonts:
Cascadia Code PL Cascadia Code PL Bold Cascadia Code PL Bold Italic Cascadia Code PL ExtraLight Cascadia Code PL ExtraLight Italic Cascadia Code PL Italic Cascadia Code PL Light Cascadia Code PL Light Italic Cascadia Code PL Regular Cascadia Code PL SemiBold Cascadia Code PL SemiBold Italic Cascadia Code PL SemiLight Cascadia Code PL SemiLight Italic
Since I prefer thinner font, setting 'Light' as normal font and 'Regular' as bold works well in terminal.
However, in gvim, setting:
set guifont=Cascadia\ Code\ PL\ Light\ 10.2 set guifontwide=Cascadia\ Code\ PL\ Light\ 10.2
produces 'Light' normal font, then for bold segments it falls to 'Bold' since I can't specify bold separately.
Question: Is it possible to specify bold/italic/bold-italic separately in gvim? If not possible please consider this as feature request.
I think you can set separate fonts for different highlighting groups. So you can specify an italic font for a highlighting group, that uses italic. However the help mentions this can cause redraw problems.
That sounds interesting but I am using gruvbox theme which has a lot of groups using bold, Redefining all of them can be tricky and theme specific. I would rather use general bold/italic/bold-italic selector.
I guess redraw problems can happen when different fonts have different widths, so switching any of the programming fonts won't show that issue -- at least should not.
There must be already point in code where gvim decides what 'other' font to use when bold or italic is requested. I'll dig some trough source code to see if I can force other font. Ideally this can end with PR but can take some time since I am not familiar with gvim code.
Of course any input/help is welcome.
The highlighting already supports using bold and italic. The implementation will try to find the right font to use with 'guifont'. To overrule that we could introduce 'guifontbold' and 'guifontitalic'. This then needs to be implemented for each platform. Font names are platform specific anyway.