[cairo] Wrong output from cairo_show_glyphs

Marco Botton marco at balsamiq.com
Fri Jun 6 00:49:56 PDT 2014

Hi all,
I am having some troubles calling cairo_show_glyphs when the current scale factor is 2 (or higher).
Please look at the attached snapshot.

The wrong output is that a given array of glyphs is rendered with different sizes. Some glyphs are scaled, some other glyphs are not.

The glyphs positions are correct, like if all the glyphs had correct size.

It may happen to any of the glyphs, but a given glyph will be rendered coherently (buggy or not buggy) in the following calls to cairo_show_glyphs.

If I set the scale factor to 4, then the buggy glyphs are still rendered at 1x scale.

These are the steps of my program:

1.  load a custom Truetype font in Freetype.
2.  create font data in Cairo and Harfbuzz.
3.  set cairo's scale factor to 2.
3.  call FT_Set_Char_Size to set the font size to 13 with 72 dpi.
4.  for each string in ["File", "Edit", "View", Help"]
5.    call hb_buffer_create to create an empty Harfbuzz buffer and set its options
6.    add UTF8 string to the buffer
7.    call hb_shape to layout the glyphs
8.    call hb_buffer_get_glyph_infos, hb_buffer_get_glyph_positions to create glyphs info
9.    malloc an array of cairo_glyphs and set glyphs positions
10.   call cairo_set_font_face, cairo_set_font_size
11.   call cairo_show_glyphs
12.   free the memory
13. end for

I tried to write a short program to reproduce the bug, but unsuccessfully. I hope somebody can point me to a possible explanation of this strange behavior.



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cairographics.org/archives/cairo/attachments/20140606/bc5c6e00/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PastedGraphic-4.png
Type: image/png
Size: 8311 bytes
Desc: not available
URL: <http://lists.cairographics.org/archives/cairo/attachments/20140606/bc5c6e00/attachment-0001.png>

More information about the cairo mailing list