You are not logged in.

#1 2018-06-22 07:17:30

hakunamatata
Member
Registered: 2016-03-31
Posts: 36

Font matching in vte-based terminal emulators

I am using termite as a terminal emulator which provides an allow_bold option. Also, I am using a font that does not have different variants, instead it comes with different families for particular styles (e.g. bold). If I enable the aforementioned option, termite (or rather fontconfig) does not select the bold font family and instead emulates a bold version of the regular font family. This is not optimal and causes some color rendering issues. As far as I understand, the allow_bold option is provided by vte. Here is the documentation of the option:

Controls whether or not the terminal will attempt to draw bold text, either by using a bold font variant or by repainting text with a different offset.

I assume the second part explains what is going on, because the font specified in the config does not have a bold variant, the text is repainted with a different offset. I tried to replace the font (only the bold variant) with the font family corresponding to the bold variant in fontconfig. This does not seem to work.

~/.config/fontconfig/fonts.conf

<match target="pattern">
    <test qual="any" name="family">
        <string>Operator Mono Book</string>
    </test>
    <test name="weight" compare="more_eq">
        <const>bold</const>
    </test>
    <edit name="family" mode="assign" binding="strong">
        <string>Operator Mono Bold</string>
    </edit>
</match>

~/.config/termite/config

font = Operator Mono Book, 12
Workaround

I have found that changing the font size (from 12 to 13) improves the situation, i.e. there are no more weird color rendering issues and the emulated bold version looks more realistic (i.e. more similar to the actual bold font family). Obviously, the fontconfig rule is not needed for the workaround and can be deleted. However, it is not a solution and only a workaround. It would still be nice to know, what termite (or other vte-based terminal emulators) are matching when the allow_bold option is enabled.

~/.config/termite/config

font = Operator Mono Book, 13

Last edited by hakunamatata (2018-07-05 19:05:44)

Offline

Board footer

Powered by FluxBB