Re: Listing fonts
- From: Havoc Pennington <hp redhat com>
- To: Andrea Frome <andrea bluemug com>
- Cc: gtk-list gnome org
- Subject: Re: Listing fonts
- Date: 07 Jun 2000 21:34:30 -0400
Andrea Frome <andrea@bluemug.com> writes:
> I'm working on porting an application from Motif to Gtk, and I'm
> surprised to find that there isn't a method analogous to
> XListFonts() in Gdk for listing the fonts available on the
> system. I understand that I could just make a call to XListFonts()
> (this is what the GtkFontSelection widget does), but I'm trying to
> make the ported application independent of X.
>
> Is there a reason this functionality wasn't included in Gdk?
Because GDK 1.2 doesn't have a useful cross-platform way to represent
a listed font. The result would have to be an XLFD, and that's not
portable, so you may as well use XListFonts().
> How do people usually work around this? Are there plans to provide
> a wrapper function in the next release?
>
Yes, GDK 1.4 uses Pango (http://www.pango.org) which has a nice
cross-platform cross-font-system representation for fonts
(PangoFontDescription).
I'm guessing you would call pango_context_list_families() or
pango_context_list_fonts(), and there will be a function
gtk_widget_get_pango_context() to conveniently get a context. See
http://www.pango.org/api/pango-text-processing.html for details.
Havoc
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]