Re: Computing character height



Mon Dieu, C'est Magnifique!

Merci!
Antonio

P.S.: Yeah, I'm still learning Pango concepts. Next time: clusters and glyphs and characters...

Just for the records:

void text_rectangles(cairo_t * cairo, PangoLayout * layout)
{
        PangoLayoutIter * iter = NULL;
        PangoRectangle extents;

        cairo_set_source_rgb(cairo, 0.5, 0.0, 0.0);
        cairo_set_line_width(cairo, 0.5);

        iter = pango_layout_get_iter(layout);
        do {
                pango_layout_iter_get_cluster_extents(iter, &extents, NULL);
                pango_extents_to_pixels(&extents, NULL);
cairo_rectangle(cairo, extents.x, extents.y, extents.width, extents.height);
        } while (pango_layout_iter_next_cluster(iter));

        cairo_stroke(cairo);

        pango_layout_iter_free(iter);
}



El 12/03/13 10:03, Emmanuel Pacaud escribió:
Le lundi 11 mars 2013 à 18:34 +0100, Antonio Vieiro a écrit :

          pango_layout_iter_get_char_extents(iter, &extents);

Have a look at the documentation, this function returns the logical
extents of the current character.

If you want to get the ink extents, use
pango_layout_iter_get_cluster_extents.

        Emmanuel.




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]