Default monospace font in Qt applications

In the file ~/.config/fontconfig/fonts.conf i have set monospace to DejaVuSansMono:

<alias>
  <family>monospace</family>
  <prefer><family>DejaVuSansMono</family></prefer>
</alias>

GTK applications (like the text editor Pluma) respect this setting and if I select the font Monospace I get DejaVu Sans Mono. In the Qt application TortoiseHg Workbench, however, the font Monospace is associated with Courier:

enter image description here

Here are the font settings in TortoiseHg:

enter image description here

Where do Qt applications retrieve their font associations from?

I can set the font in TortoiseHg to DejaVu Sans Mono but I believe it would be more advantageous to address the underlying issue so that DejaVu Sans Mono becomes the monospace font for all Qt applications. Do you have any suggestions?

I run Debian 12 and TortoiseHg version 6.3.1 which is built with Qt-5.15.8.

Edit: Before I installed the package ttf-mscorefonts-installer, DejaVu Sans Mono was the font associated with Monospace in TortoiseHg.

Asked By: August Karlstrom

||

Install and run qt5ct, or you can directly edit ~/.config/qt5ct/qt5ct.conf.

Answered By: Ipor Sircer

This turned out to be a bug in TortoiseHg:

https://foss.heptapod.net/mercurial/tortoisehg/thg/-/issues/5911

The obvious workaround is to (explicitly) set the fonts to DejaVu Sans Mono in the TortoiseHg font settings.

Answered By: August Karlstrom
Categories: Answers Tags: , , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.