themingeninge: Handle translations properly

We want to keep the location of where to render, but transform th
context by the pango transform.
This commit is contained in:
Benjamin Otte 2011-05-22 03:53:21 +02:00
parent 03fbb1f34f
commit ec34c4bd83

View File

@ -2370,29 +2370,18 @@ prepare_context_for_layout (cairo_t *cr,
matrix = pango_context_get_matrix (pango_layout_get_context (layout));
cairo_move_to (cr, x, y);
if (matrix)
{
cairo_matrix_t cairo_matrix;
PangoRectangle rect;
cairo_matrix_init (&cairo_matrix,
matrix->xx, matrix->yx,
matrix->xy, matrix->yy,
matrix->x0, matrix->y0);
pango_layout_get_extents (layout, NULL, &rect);
pango_matrix_transform_rectangle (matrix, &rect);
pango_extents_to_pixels (&rect, NULL);
cairo_matrix.x0 += x - rect.x;
cairo_matrix.y0 += y - rect.y;
cairo_set_matrix (cr, &cairo_matrix);
cairo_move_to (cr, 0, 0);
}
else
{
cairo_move_to (cr, x, y);
cairo_transform (cr, &cairo_matrix);
}
}