rsvg_cairo_render_pango_layout (RsvgDrawingCtx * ctx, PangoLayout * layout, double x, double y)
{
    RsvgCairoRender *render = (RsvgCairoRender *) ctx->render;
    RsvgState *state = rsvg_current_state (ctx);
    PangoRectangle ink;
    RsvgBbox bbox;

    _rsvg_cairo_set_text_antialias (render->cr, state->text_rendering_type);

    _set_rsvg_affine (render, state->affine);

    pango_layout_get_extents (layout, &ink, NULL);

    rsvg_bbox_init (&bbox, state->affine);
    bbox.x = x + ink.x / (double)PANGO_SCALE;
    bbox.y = y + ink.y / (double)PANGO_SCALE;
    bbox.w = ink.width / (double)PANGO_SCALE;
    bbox.h = ink.height / (double)PANGO_SCALE;
    bbox.virgin = 0;

    if (state->fill) {
        cairo_move_to (render->cr, x, y);
        rsvg_bbox_insert (&render->bbox, &bbox);
        _set_source_rsvg_paint_server (ctx,
                                       state->current_color,
                                       state->fill,
                                       state->fill_opacity,
                                       bbox, rsvg_current_state (ctx)->current_color);

        pango_cairo_show_layout (render->cr, layout);
    }

    if (state->stroke) {
        cairo_move_to (render->cr, x, y);
        rsvg_bbox_insert (&render->bbox, &bbox);
        pango_cairo_layout_path (render->cr, layout);

        _set_source_rsvg_paint_server (ctx,
                                       state->current_color,
                                       state->stroke,
                                       state->stroke_opacity,
                                       bbox, rsvg_current_state (ctx)->current_color);

        cairo_set_line_width (render->cr, _rsvg_css_normalize_length (&state->stroke_width, ctx, 'h'));
        cairo_set_miter_limit (render->cr, state->miter_limit);
        cairo_set_line_cap (render->cr, (cairo_line_cap_t) state->cap);
        cairo_set_line_join (render->cr, (cairo_line_join_t) state->join);
        cairo_set_dash (render->cr, state->dash.dash, state->dash.n_dash,
                        _rsvg_css_normalize_length (&state->dash.offset, ctx, 'o'));
        cairo_stroke (render->cr);
    }
}
rsvg_cairo_render_pango_layout (RsvgDrawingCtx * ctx, PangoLayout * layout, double x, double y)
{
    RsvgCairoRender *render = (RsvgCairoRender *) ctx->render;
    RsvgState *state = rsvg_current_state (ctx);
    PangoRectangle ink;
    RsvgBbox bbox;

    _rsvg_cairo_set_text_antialias (render->cr, state->text_rendering_type);

    _set_rsvg_affine (render, state->affine);

    pango_layout_get_extents (layout, &ink, NULL);

    rsvg_bbox_init (&bbox, state->affine);
    bbox.x = x + ink.x / (double)PANGO_SCALE;
    bbox.y = y + ink.y / (double)PANGO_SCALE;
    bbox.w = ink.width / (double)PANGO_SCALE;
    bbox.h = ink.height / (double)PANGO_SCALE;
    bbox.virgin = 0;

    if (state->fill) {
        cairo_move_to (render->cr, x, y);
        rsvg_bbox_insert (&render->bbox, &bbox);
        _set_source_rsvg_paint_server (ctx,
                                       state->current_color,
                                       state->fill,
                                       state->fill_opacity,
                                       bbox, rsvg_current_state (ctx)->current_color);

        pango_cairo_show_layout (render->cr, layout);
    }

    if (state->stroke) {
        cairo_move_to (render->cr, x, y);
        rsvg_bbox_insert (&render->bbox, &bbox);
        pango_cairo_layout_path (render->cr, layout);

        _set_source_rsvg_paint_server (ctx,
                                       state->current_color,
                                       state->stroke,
                                       state->stroke_opacity,
                                       bbox, rsvg_current_state (ctx)->current_color);

        cairo_set_line_width (render->cr, _rsvg_css_normalize_length (&state->stroke_width, ctx, 'h'));
        cairo_set_miter_limit (render->cr, state->miter_limit);
        cairo_set_line_cap (render->cr, (cairo_line_cap_t) state->cap);
        cairo_set_line_join (render->cr, (cairo_line_join_t) state->join);
        cairo_set_dash (render->cr, state->dash.dash, state->dash.n_dash,
                        _rsvg_css_normalize_length (&state->dash.offset, ctx, 'o'));
        cairo_stroke (render->cr);
    }
}