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

Magicloud Magiclouds magicloud.magiclouds at gmail.com
Mon May 3 18:44:50 PDT 2010


Hi, could someone help me on this? Thanks.

On Fri, Apr 30, 2010 at 2:53 PM, Magicloud Magiclouds
<magicloud.magiclouds at gmail.com> 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