[cairo] Pango underline does not work with cairo scale.

Behdad Esfahbod behdad at behdad.org
Tue May 4 10:58:10 PDT 2010


Known bug.  Fixed it in pango master repository right now.

http://git.gnome.org/browse/pango/commit/?id=1caf2947f0941e2354dd4f43d56934e1ec706b6e

http://git.gnome.org/browse/pango/commit/?id=34e05035af0ce854df1cc2f77c0b11dbc1a3cb36

behdad

On 04/30/2010 02:53 AM, Magicloud Magiclouds wrote:
> Hi, the code is following. In a scaled cairo context, the underline is
> not scaled as the text. test.png shows that the underline is ever
> larger than the "00".
> The version of pango is 1.28.0-1. The version of cairo is 1.8.10-4.
> 
> #include <cairo.h>
> #include <pango/pango.h>
> 
> int main () {
>   cairo_surface_t * s = cairo_image_surface_create
> (CAIRO_FORMAT_ARGB32, 1280, 800);
>   cairo_t * c = cairo_create (s);
>   cairo_scale (c, 10, 10);
>   PangoLayout * l = pango_cairo_create_layout (c);
>   pango_layout_set_text (l, "00", 2);
>   PangoAttrList * attrs = pango_attr_list_new ();
>   pango_attr_list_insert (attrs, pango_attr_underline_new
> (PANGO_UNDERLINE_DOUBLE));
>   pango_layout_set_attributes (l, attrs);
>   cairo_move_to (c, 1, 1);
>   pango_cairo_show_layout (c, l);
>   cairo_surface_write_to_png (s, "test.png");
>   return 0;
> }


More information about the cairo mailing list