[cairo] Text output under angle - uneven text

Behdad Esfahbod behdad at behdad.org
Mon Feb 1 21:34:04 PST 2010

On 02/01/2010 10:29 PM, cu wrote:
> Good day all,
>  I am seeing a strange issue with text output. When I apply rotation
> matrix to text before output, I find that letters in a sentence are not
> properly aligned - that is to say, they seem to be drawn higher/lower
> relative to each other if the angle is not completely horizontal (or
> vertical). What's more - they seem to oscillate up/down as the angle
> changes. I.e. if I want to rotate text around, it will not stay as one
> line, but rather appear as letters that slightly "dance" as the text is
> rotated. It's not a major bug, but it does not look good, the result is
> somewhat "unprofessionaly" looking - in contrast to the rest of the
> graphics.
> The code that does it is very basic:
> cairo_matrix_init_translate(&mnew, x, y);
> cairo_matrix_rotate(&mnew, angle);
> cairo_set_matrix(cr, &mnew);
> cairo_move_to(cr, -0.5 * txSize.width, -0.5 * txSize.height);
> cairo_show_text(cr, tbuf);
> Cairo version is either 1.8.x or 1.9.2, under Mac, Windows or Linux -
> the result looks the same.
> Any help in resolving this would be appreciated!

Hi Mike,

What you are seeing is the fact that cairo does not support subpixel text
positioning yet.  You may have more luck with cairo_text_path();cairo_fill(),
but that's drastically slower.


> -Mike

More information about the cairo mailing list