<div dir="ltr"><div>You have to set the font after you do the transform.<br><br></div>However I did not expect this mess, I thought what Cairo did was draw the font as though the transform it was using before was still in effect (ie "font lock", similar to the proposed "line width lock").<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jan 6, 2016 at 7:45 AM, Matthew Conway <span dir="ltr"><<a href="mailto:mconway@espial.com" target="_blank">mconway@espial.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I'm trying to rotate an array of glyphs (where each glyph represents a textual character).<br>
<br>
Consider the following:<br>
<br>
----------------<br>
| A TEXT LABEL |<br>
----------------<br>
<br>
Where the rectangle is a solid coloured background and the text is drawn (centered) on top of the rectangle (think subtitles being displayed on a TV screen).<br>
<br>
For some situations, I need to rotate the text label (rectangle and text) 90 degrees clockwise. I do not expect the text rotation to be vertical as shown here:<br>
<br>
|̄ ̄ ̄ |<br>
| A |<br>
|   |<br>
| T |<br>
| E |<br>
| X |<br>
| T |<br>
|   |<br>
| L |<br>
| A |<br>
| B |<br>
| E |<br>
| L |<br>
|___|<br>
<br>
Instead, I am expecting the text to be rotated (in position) with the label.<br>
<br>
Sometimes (about 25% of the time), Cairo seems to be rotating random text characters and drawing them over the top of other correctly rotated characters.<br>
<br>
/* Draw the labels background */<br>
cairo_rectangle( cr, x, y, width, height );<br>
cairo_set_source_rgba( cr, red, green, blue, alpha );<br>
cairo_fill( vg->cairo_context );<br>
<br>
/* Rotate 90 degrees clockwise and show the text */cairo_translate( cr, x, y );<br>
cairo_rotate( cr, 1.5708 );<br>
cairo_show_glyphs( cr, glyphs, num_glyphs );<br>
<br>
<br>
Notes:<br>
1. The glyphs are created by freetype libraries.<br>
2. The system is using Wayland to draw the text labels.<br>
<br>
<br>
I've tried quite a few things, the most successful was to add a call to show_glyphs before translating, which reduces the issue to show approximatley 5% of the time:<br>
<br>
/* Rotate 90 degrees clockwise and show the text */<br>
cairo_show_glyphs( cr, glyphs, num_glyphs );<br>
cairo_translate( cr, x, y );<br>
cairo_rotate( cr, 1.5708 );<br>
cairo_show_glyphs( cr, glyphs, num_glyphs );<br>
<br>
<br>
I've taken a photo of the screen to show what the issue looks like, it can be viewed here:<br>
<a href="http://postimg.org/image/x4g4fne5h/" rel="noreferrer" target="_blank">http://postimg.org/image/x4g4fne5h/</a><br>
<br>
<br>
I'm using:<br>
- latest cairo 1.14.6<br>
- freetype to create the font glyphs<br>
- Wayland<br>
<br>
<br>
Thanks,<br>
Matt.<span class="HOEnZb"><font color="#888888"><br>
-- <br>
cairo mailing list<br>
<a href="mailto:cairo@cairographics.org" target="_blank">cairo@cairographics.org</a><br>
<a href="http://lists.cairographics.org/mailman/listinfo/cairo" rel="noreferrer" target="_blank">http://lists.cairographics.org/mailman/listinfo/cairo</a></font></span></blockquote></div><br></div>