Intermittent issues using cairo_rotate to rotate an array of text glyphs
Matthew Conway <[email protected]>
| Newsgroups | gmane.comp.lib.cairo |
|---|---|
| Message-ID | <[email protected]> |
I'm trying to rotate an array of glyphs (where each glyph represents a textual character). Consider the following: ---------------- | A TEXT LABEL | ---------------- 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). 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: |̄ ̄ ̄ | | A | | | | T | | E | | X | | T | | | | L | | A | | B | | E | | L | |___| Instead, I am expecting the text to be rotated (in position) with the label. 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. /* Draw the labels background */ cairo_rectangle( cr, x, y, width, height ); cairo_set_source_rgba( cr, red, green, blue, alpha ); cairo_fill( vg->cairo_context ); /* Rotate 90 degrees clockwise and show the text */cairo_translate( cr, x, y ); cairo_rotate( cr, 1.5708 ); cairo_show_glyphs( cr, glyphs, num_glyphs ); Notes: 1. The glyphs are created by freetype libraries. 2. The system is using Wayland to draw the text labels. 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: /* Rotate 90 degrees clockwise and show the text */ cairo_show_glyphs( cr, glyphs, num_glyphs ); cairo_translate( cr, x, y ); cairo_rotate( cr, 1.5708 ); cairo_show_glyphs( cr, glyphs, num_glyphs ); I've taken a photo of the screen to show what the issue looks like, it can be viewed here: http://postimg.org/image/x4g4fne5h/ I'm using: - latest cairo 1.14.6 - freetype to create the font glyphs - Wayland Thanks, Matt. -- cairo mailing list [email protected] http://lists.cairographics.org/mailman/listinfo/cairo