Sane default fonts?
Is there a place where I can get a list of all fonts that are guaranteed to be present on any s开发者_如何学Cystem with GTK? I need a way to set a sane default font for some plots, and of course the sane default font must be present.
Edit: If no specific fonts are guaranteed to be present, is there an easy way to just get some sane default scalable sans-serif font? I don't care about the details.
Edit # 2: If nothing can be guaranteed on GTK, can someone give me good platform-specific default scalable sans-serif fonts that are guaranteed to be present on any reasonable installation of Windows and *nix/X11?
No fonts are guaranteed to be present on any system with GTK, since GTK is a cross-platform toolkit and doesn't install any of its own fonts.
Depending on how you are rendering your plots (Cairo?), any text should already be drawn in a default font. EDIT: Sounds like you are using gdk_draw_layout()
to draw your text. This takes a PangoLayout
argument. If you obtain that PangoLayout
using gtk_widget_create_pango_layout()
, then it should already have a sane default font set. You can even find out what font that is, by getting the PangoContext
using pango_layout_get_context()
, and then calling pango_context_get_font_description()
on that.
If you are also using GNOME, then you can check the value of the /desktop/gnome/interface/font-name
, /desktop/gnome/interface/monospace-font-name
, and /desktop/gnome/interface/document-font-name
keys with GConf.
The default fonts you should use in GTK+ are "Sans", "Monospace" and "Serif". I don't believe that any specific fonts are guaranteed to exist.
精彩评论