[Development] System-wide font preferences for monospace font

Rutledge Shawn Shawn.Rutledge at digia.com
Thu May 16 11:32:58 CEST 2013


On 9 May 2013, at 2:09 PM, Jan Kundrát wrote:

> In Qt5, the situation looks a bit better, the qtbase:gui/kernel/qplatformtheme.h contains QPlatformTheme::Font enum with support for multiple fonts to be used in the application menus, labels etc. Unfortunately, the support for a "fixed font" is not there. and in addition to that, this feature does not appear to be visible to the user code as it's a private header.


On 15 May 2013, at 5:40 PM, Jan Kundrát wrote:

> On Thursday, 9 May 2013 22:41:07 CEST, Jan Kundrát wrote:
>> However, both KDE and Gnome's settings each include more data, 
>> including the font size and options like bold, italic etc. Are 
>> these also handled by fontconfig, so that when I ask for a 
>> "Monospace" I always get the font with a correct size and 
>> "style"?
> 
> It doesn't seem so, based on my reading of the docs. If I am right, this means that there is some value in having a cross-platform way of obtaining "user's preferred fixed-width font, including the font size". For example on this machine, I have a "DejaVu Sans 10" as the default font but "Monospace 9", whatever it actually is, as the fixed width font. If I relied on fontconfig, I'd get a 10pt "Monospace" which is too big for my preferences.
> 
> Am I right here?

It seems that way to me, at least it would be self-consistent to have that preference alongside the others.

In your patch though, on gnome you start a process to run gconftool-2 to get the font.  Is that really the right way to get those settings?  Only for Gnome 2, right?  Because (last time I checked) src/plugins/platformthemes/gtk2 still needs work IMO: we need to get the theme colors correctly, but that's complicated, so it didn't seem to me that there is just one place to look (one config file or one gtk function to call).  Maybe you're right that it needs to be done this way, because gconftool knows all the places that the settings can be overridden, but then it would be nice if we could run gconftool once and get all the settings that we need for all colors and fonts.  It looks like qt 4 runs gconftool multiple times.  But it's not very efficient.  Is there no way to do this with some library that can be linked?  Gnome applications never need to do this?

$ gconftool-2 -a /desktop/gnome/interface
 enable_animations = true
 document_font_name = Sans 8
 can_change_accels = true
 gtk_theme = Ambiance
 use_custom_font = true
 cursor_blink = false
 buttons_have_icons = true
 font_name = Ubuntu 7
 icon_theme = ubuntu-mono-dark
 monospace_font_name = Monospace 8

Only 3 fonts and no colors.


More information about the Development mailing list