[cairo] PDF backend: PDF trailer not written?

Sascha Steinbiss steinbiss at zbh.uni-hamburg.de
Tue Dec 2 04:50:41 PST 2008


Adrian Johnson wrote:
>> I suppose this does not refer to any text drawn via cairo_show_text()? 
>> Any text I draw is read from a properly UTF8-encoded file. So what 
>> "input string" does this message refer to, and why doesn't it seem to 
>> cause a problem in the older version?
> It could be something to do with the glyph to unicode mapping that is 
> embedded with each font to facilitate copy and pasting text from PDFs.
> It would be useful to get a stack trace when the error occurs. You can 
> do this by compiling cairo with debug enabled then running your 
> application in gdb with a breakpoint set on _cairo_error().

 From the trace, it seems like you are right:

Breakpoint 1, _cairo_error (status=CAIRO_STATUS_INVALID_STRING) at 
cairo.c:87
87	    assert (_cairo_status_is_error (status));
(gdb) bt
#0  _cairo_error (status=CAIRO_STATUS_INVALID_STRING) at cairo.c:87
#1  0x00007fc675ad27e3 in _cairo_utf8_to_utf16 (str=0x2400a10 "???", 
len=-1,
     result=0x7fff7df46bb0, items_written=0x7fff7df46bac) at 
cairo-unicode.c:382
#2  0x00007fc675b00fca in _cairo_pdf_surface_emit_unicode_for_glyph (
     surface=0x23d1940, utf8=0x2400a10 "???") at cairo-pdf-surface.c:2879
#3  0x00007fc675b01289 in _cairo_pdf_surface_emit_to_unicode_stream (
     surface=0x23d1940, font_subset=0x7fff7df46db0, is_composite=1,
     stream=0x7fff7df46ce0) at cairo-pdf-surface.c:2972
#4  0x00007fc675b01d98 in _cairo_pdf_surface_emit_truetype_font_subset (
     surface=0x23d1940, font_subset=0x7fff7df46db0) at 
cairo-pdf-surface.c:3353
#5  0x00007fc675b02b85 in _cairo_pdf_surface_emit_unscaled_font_subset (
     font_subset=0x7fff7df46db0, closure=0x23d1940) at 
cairo-pdf-surface.c:3722
#6  0x00007fc675ada3b2 in _cairo_sub_font_collect (entry=0x25bbd40,
     closure=0x7fff7df46e60) at cairo-scaled-font-subsets.c:577
#7  0x00007fc675adada4 in _cairo_scaled_font_subsets_foreach_internal (
     font_subsets=0x2415190,
     font_subset_callback=0x7fc675b02b34 
<_cairo_pdf_surface_emit_unscaled_font_subset>, closure=0x23d1940, 
type=CAIRO_SUBSETS_FOREACH_UNSCALED)
     at cairo-scaled-font-subsets.c:889
#8  0x00007fc675adae30 in _cairo_scaled_font_subsets_foreach_unscaled (
     font_subsets=0x2415190,
     font_subset_callback=0x7fc675b02b34 
<_cairo_pdf_surface_emit_unscaled_font_subset>, closure=0x23d1940) at 
cairo-scaled-font-subsets.c:915
#9  0x00007fc675b02cde in _cairo_pdf_surface_emit_font_subsets (
     surface=0x23d1940) at cairo-pdf-surface.c:3772
#10 0x00007fc675afd31d in _cairo_pdf_surface_finish 
(abstract_surface=0x23d1940)
     at cairo-pdf-surface.c:1195
#11 0x00007fc675aca588 in *INT_cairo_surface_finish (surface=0x23d1940)
     at cairo-surface.c:530
#12 0x00007fc675ab7ddf in _cairo_paginated_surface_finish (
     abstract_surface=0x21dbaf0) at cairo-paginated-surface.c:172
#13 0x00007fc675aca588 in *INT_cairo_surface_finish (surface=0x21dbaf0)
     at cairo-surface.c:530
#14 0x000000000055772d in gt_sketch_page_runner (argc=14, argv=0x21c9850,
     parsed_args=12, tool_arguments=0x21c9220, err=0x21af230)
     at src/annotationsketch/gt_sketch_page.c:286
#15 0x00000000004cf1b6 in gt_tool_run (tool=0x21c9920, argc=14, 
argv=0x21c9850,
     err=0x21af230) at src/core/tool.c:88
#16 0x000000000041049c in gt_dev_runner (argc=15, argv=0x21c94d0,
     parsed_args=1, tool_arguments=0x21c8820, err=0x21af230)
     at src/tools/gt_dev.c:114
#17 0x00000000004cf1b6 in gt_tool_run (tool=0x21c24b0, argc=15, 
argv=0x21c94d0,
     err=0x21af230) at src/core/tool.c:88
#18 0x000000000040bc83 in gtr_run (gtr=0x21b1280, argc=15, 
argv=0x7fff7df47430,
     err=0x21af230) at src/gtr.c:329
#19 0x000000000040afe2 in main (argc=15, argv=0x7fff7df47430) at src/gt.c:39

Do you think this may be a problem with the font? From the looks of it, 
the other system I used had a different font set as the "sans-serif" 
default used in the toy text API (which is enough for me).
The system with this error seems to use Bitstream Vera Sans (the Gnome 
default) while the other (SuSE) system seems to use a Helvetica-like 
font unknown to me. Can I find out somehow which font is compiled in?
Any other ideas?

Thanks again in advance for your help,
Sascha


More information about the cairo mailing list