font handling confusion (in gtk-demo)
- From: martine cs washington edu (Evan Martin)
- To: gtk-devel-list gnome org
- Subject: font handling confusion (in gtk-demo)
- Date: Tue, 8 Jan 2002 15:00:44 -0800
I'm a bit new to Pango and Xft, so bear with me.
I recently began the process of porting an app to the new GTK (it'll be
out RSN, right?) and I needed to update some code that was using the old
GtkText widget. Some of the text needs to be monospaced (server
responses), but I can't for the life of me figure out how to set up an
appropriate tag to achieve a "monospaced font" effect.
After looking through a variety of pages and documentation, I noticed
this in the gtk-demo source:
if (is_source)
{
font_desc = pango_font_description_from_string ("Courier
12");
Is hardcoding a font name like "Courier 12" considered ok practice?
On my (relatively stock, wrt GTK/Xft/Pango) Debian system, gtk-demo
dispays the code examples (which are tagged by the above code) in a
proportionally-spaced font.
A simple program like this:
gtk_init(&argc, &argv);
dlg = gtk_font_selection_dialog_new("Select font");
gtk_dialog_run(GTK_DIALOG(dlg));
shows I have no "Courier 12".
After a bit more looking around, it appears the proper thing to do is
use an alias. In my ~/.xftconfig, I added:
match any family = "mono" edit family += "Courier New";
and then requesting a "mono" family gives me a monspaced font.
But this requires a change on my system (and a change on every other
system). Is there a standard ("correct") way to achieve this?
Should "Courier 12" be an alias?
--
Evan Martin
martine cs washington edu
http://neugierig.org
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]