[cairo] pangocairo problem
Bill Spitzak
spitzak at gmail.com
Sat Jan 22 20:11:38 PST 2011
Never mind I found the bug.
(replace families[n] with families[i]. DOH!!!)
On 01/22/2011 07:59 PM, Bill Spitzak wrote:
> The following code prints "not a family!" 188 times. That does not seem
> to be what the pango docs claim it will do!
>
> cairo_surface_t* surface = cairo_xlib_surface_create(...);
> cairo_t* cr = cairo_create(surface);
> PangoLayout *layout = pango_cairo_create_layout (cr);
> PangoContext* context = pango_layout_get_context(layout);
> PangoFontFamily** families; int n;
> pango_context_list_families(context, &families, &n);
> for (int i=0; i < n; i++) {
> PangoFontFamily* family = families[n];
> if (PANGO_IS_FONT_FAMILY(family))
> printf("%s\n", pango_font_family_get_name(family));
> else
> printf("not a family!\n");
> }
> g_free(families);
>
> surface, cr, and layout all seem to work fine otherwise and I can draw
> text into the window with them.
>
> System is Ubuntu 11.04. Cairo and pixman are from the current git
> repository, but pango is the one included with Ubuntu. This program is
> *not* using gtk but just the cairopango dependencies.
>
> Help?
>
> PS: Obviously I am trying to get a list of available fonts. If this is
> the wrong approach please tell me.
>
>
More information about the cairo
mailing list