[cairo] Two problems with Type 1 fonts

Elmar Braun elmar.braun at sh-p.de
Fri Nov 30 15:00:07 PST 2007


I have two (possibly related) problems with Type 1 fonts. I'm using 
Cairo 1.4.12 on Windows.

The first problem is that text output to any surface other than a Win32 
surface is completely garbled. For example, when I use a Type 1 font to 
write the string "Type" to a PDF-, SVG- or image surface, the surface 
will show the string "5ZQF".

The second issue is that cairo_scaled_font_glyph_extents() doesn't seem 
to work correctly with Type 1 fonts. When I rely on the results of that 
function to draw glyphs with cairo_show_glyphs(), the glyph positions 
are skewed. I think this may be related to the first problem, because 
the glyph positions seem to be correct for the garbled glyphs that are 
emitted on non-screen surfaces.

The attached PNG demonstrates the problem. It shows how Cairo renders 
four lines: The first uses a Type 1 font and cairo_show_text. The second 
uses cairo_scaled_font_glyph_extents and cairo_show_glyphs, also with a 
Type 1 font. The third and fourth lines show the output of using the 
same code as for the first and second, but with a TrueType font.

I've also attached the PDF output of the same four lines. It shows that 
the first two lines are completely garbled, though the second one has 
correct glyph positions (for the wrong glyphs).

-------------- next part --------------
A non-text attachment was scrubbed...
Name: Type1.png
Type: image/png
Size: 9421 bytes
Desc: not available
Url : http://lists.cairographics.org/archives/cairo/attachments/20071201/dd0d7c41/attachment-0001.png 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: out.pdf
Type: application/pdf
Size: 17359 bytes
Desc: not available
Url : http://lists.cairographics.org/archives/cairo/attachments/20071201/dd0d7c41/attachment-0001.pdf 

More information about the cairo mailing list