Bug 38976

Summary: Text disappearing when rendering a pdf onto a cairo pdf surface
Product: cairo Reporter: michael
Component: pdf backendAssignee: Adrian Johnson <ajohnson>
Status: RESOLVED FIXED QA Contact: cairo-bugs mailing list <cairo-bugs>
Severity: blocker    
Priority: medium    
Version: 1.10.2   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: the source file that won't work
testcase - modified version of pdf2png.c
Version of original pdf that works fine (some letters removed)
result of pdf2pdf on #48771
result of pdf2pdf on the version that works (with letters removed)

Description michael 2011-07-05 05:42:51 UTC
Created attachment 48771 [details]
the source file that won't work

Text disappearing when rendering a pdf onto a cairo pdf surface
Comment 1 michael 2011-07-05 05:43:56 UTC
Created attachment 48772 [details]
testcase - modified version of pdf2png.c
Comment 2 michael 2011-07-06 00:13:29 UTC
Created attachment 48800 [details]
Version of original pdf that works fine (some letters removed)
Comment 3 michael 2011-07-06 00:14:50 UTC
There was a bug before that I reported, where I believe some characters weren't properly encoded in cairo and was interpreted as PS/PDF codes in the final document; i'm not quite sure about this though, as I can't find the bug report anymore... I know that my old test case works now though, so some things are fixed.
Comment 4 Adrian Johnson 2011-07-06 02:11:18 UTC
Testing your source file with your modified pdf2png and cairo 1.10.2 and poppler 0.16.4 works for me.

Please attach your output files from both PDFs.
Comment 5 michael 2011-07-06 02:18:58 UTC
Created attachment 48807 [details]
result of pdf2pdf on #48771
Comment 6 michael 2011-07-06 02:23:51 UTC
Created attachment 48808 [details]
result of pdf2pdf on the version that works (with letters removed)
Comment 7 michael 2011-07-06 02:29:01 UTC
I'm using poppler 0.16.6

I'm viewing the pdfs in adobe acrobat 9
Comment 8 Adrian Johnson 2011-07-06 02:31:40 UTC
The status in pdf2png is not set before it is printed. Could you add the line:

    status = cairo_surface_status (surface);

after cairo_surface_finish() and see if any error is printed.
Comment 9 michael 2011-07-06 02:58:13 UTC
(In reply to comment #8)
> The status in pdf2png is not set before it is printed. Could you add the line:
>     status = cairo_surface_status (surface);
> after cairo_surface_finish() and see if any error is printed.

No error (nothing) printed.
Comment 10 Adrian Johnson 2011-07-06 05:53:04 UTC
The CFF fallback font in your PDF is corrupt. There is a 1 byte difference between the CFF font in your PDF and the CFF font in my PDF generated from the same test case. The difference is in one element of an offset array inside the font. The array contents are identical so cairo must know the correct size of the array elements. But one number in the array of offsets that point to the contents of the array is 0 instead of 14. I have no idea what could be causing this difference. I can not see any thing in the code that could cause this.
Comment 11 Adrian Johnson 2011-07-06 06:06:37 UTC
I just noticed I was testing with current 1.10 branch instead of 1.10.2. I can reproduce the bug with 1.10.2 but not with the latest 1.10 branch. Valgrind shows what the problem is. It has already been fixed with this commit:

http://cgit.freedesktop.org/cairo/commit/?h=1.10&id=684fff7a498dec0ccfde0f3b9edc48ca0cdf2c20

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.