Summary: | PDF Font Embedding Bug with some OpenType Fonts and some PDF viewers | ||
---|---|---|---|
Product: | cairo | Reporter: | Robert Ricci <robert.ricci> |
Component: | pdf backend | Assignee: | Adrian Johnson <ajohnson> |
Status: | RESOLVED FIXED | QA Contact: | cairo-bugs mailing list <cairo-bugs> |
Severity: | normal | ||
Priority: | medium | CC: | Brian.Ewins, mhopf |
Version: | 1.4.6 | ||
Hardware: | x86 (IA32) | ||
OS: | Mac OS X (All) | ||
Whiteboard: | |||
i915 platform: | i915 features: | ||
Attachments: |
Inconsolata.otf test
inode_xdsl.pdf Fix font embedding problem with Apple PDF Viewer Fix a bug that would cause truetype subsetting to fail on valid fonts. Fix for cairo 1.4.10 |
Description
Robert Ricci
2007-05-03 12:01:05 UTC
Created attachment 9860 [details] Inconsolata.otf test (In reply to comment #0) > The "Incolsolata" OpenType Font does not seem to embed properly in > PDFs created by Cairo 1.4.6. The PDFs display properly in some viewers, > but in others, characters are rendered as empty rectangles. What other viewers besides Apple Preview have this problem? I don't have a Mac so I am unable to reproduce the problem. I have made some changes to the font embedding and attached a sample pdf. Could you check if this pdf displays correctly. If Preview has a font properties dialog similar to acroread I would be interested to know what font type and encoding is displayed. > The pdffonts command has this to say about the embedding: > name type emb sub uni object ID > ------------------------------------ ----------------- --- --- --- --------- > Inconsolata CID Type 0C yes no yes 10 0 Have you seen any pdf files with this font type that does display correctly in Preview? It would be helpful for me to look a one of these pdfs to see how it differs from the cairo pdf. I have not been able to find any viewers other than Preview that have this problem. The PDF you attached has the same display problem with Preview, which seems, sadly, to not have a font properties dialog. I haven't been able to find/make any other PDFs that embed this particular font using this particular type (I'm sure this is, in part, due to my lack of experience in this area.) For example, creating a document in Word and then printing to a PDF embeds the font as Type 1C. With cairo-1.4.6 and cairo-1.4.10 under Mac OS X 1.4 I see no fonts at all (I've tried Helvetica and Comic Sans MS) using Apple's Viewer application. Acrobat Reader 8.1 and Ghostscript have no problems. I will try cairo-1.4 tomorrow. (In reply to comment #3) > With cairo-1.4.6 and cairo-1.4.10 under Mac OS X 1.4 I see no fonts at all > (I've tried Helvetica and Comic Sans MS) using Apple's Viewer application. > > Acrobat Reader 8.1 and Ghostscript have no problems. I will try cairo-1.4 > tomorrow. It would be helpful to attach a PDF test case that I can look at. The font embedding changed in 1.4.6 to CID encoding due to limitations with the non CID encoding that resulted in increased PDF size and some fonts embedded as unhinted outlines. Prior to 1.4.6 the cairo font embedding had an ugly hack to work around bugs in Apple Preview. If you can locate a PDF created with another application that has the same type of font embedding (see comment #1) that a) displays correctly: I can look at it how the font is embedded and change cairo to work the same way, or b) does not display correctly: then it is a bug in the Apple viewer. If PDFs display correctly in every pdf viewer except Apple Preview it is most likely a Preview bug. Created attachment 10487 [details]
inode_xdsl.pdf
I did not expect to find a file but pdffont inode_xdsl.pdf prints
name type emb sub uni object ID
------------------------------------ ------------ --- --- --- ---------
XXJVAY+BlurMedium CID Type 0C yes yes yes 83 0
HUHDKE+Myriad-Condensed CID Type 0C yes yes yes 88 0
CXSUSO+Myriad-CnBold CID Type 0C yes yes yes 95 0
XVDQAY+Myriad-Bold CID Type 0C yes yes yes 230 0
HXBTKE+Myriad-CnBoldItalic CID Type 0C yes yes yes 235 0
and the Apple Viewer displays the text.
Could you test these two files with Apple Preview. http://annarchy.freedesktop.org/~ajohnson/bug10849/test1.pdf http://annarchy.freedesktop.org/~ajohnson/bug10849/test2.pdf (In reply to comment #6) > Could you test these two files with Apple Preview. > > http://annarchy.freedesktop.org/~ajohnson/bug10849/test1.pdf > > http://annarchy.freedesktop.org/~ajohnson/bug10849/test2.pdf > test1.pdf looks identical (and I assume correct) under Apple Preview 3.0.9 (409) (which comes with OS X 10.4.10) and Adobe Reader 8.0.0 (on the same Mac). test2.pdf appears as a blank page under both readers. Could you test this file with Apple Preview. http://annarchy.freedesktop.org/~ajohnson/bug10849/test3.pdf It says: "The quick brown fox jumps over the lazy dog" Created attachment 10581 [details] [review] Fix font embedding problem with Apple PDF Viewer Here's two more test cases. test4 has an OpenType/CFF font. test5 has a TrueType font. I've also attached my patch in case anyone wants to do any further testing. It applies to 1.4.10. If these two PDFs work I will commit the patch. http://annarchy.freedesktop.org/~ajohnson/bug10849/test4.pdf http://annarchy.freedesktop.org/~ajohnson/bug10849/test5.pdf test4.pdf shows rectangles instead of "One two three four five six seven eight nine ten." test5.pdf shows "One two three four five six seven eight nine ten." I've applied the patch to cairo-1.4.10 but it did not solve the problem. The file I've generated on Mac OS X, just in case you need it, is available here: http://mark13.org/toad/download/other/test.pdf (In reply to comment #12) > I've applied the patch to cairo-1.4.10 but it did not solve the problem. > > The file I've generated on Mac OS X, just in case you need it, is available > here: > > http://mark13.org/toad/download/other/test.pdf What font are you using here? The CairoFont-x-y name instead of the real font name indicates that a cairo fallback font was embedded. This is the result of either cairo not supporting subsetting of this font or the subsetting failed. In both cases cairo generates a CFF font from the font outlines. Could you do some further testing with various truetype and opentype/cff fonts to give me some more data on what works and what doesn't. Does the patch help with truetype fonts? This was a TrueType font. The file http://mark13.org/toad/download/other/test2.pdf contains 4 different fonts: futura:size=12, TrueType Hiragino Kaku Gothic Pro W3:size=12, OpenType PostScript. Comic Sans MS:size=12, TrueType Free Serif:size=12, TrueType (not available, the fallback is being used) and all of them seem to use the fallback. Apples's view can't display them, but Acrobat read can. Now Apple's X11 comes with modified FontConfig, etc. libraries which can access Mac OS X's font system. Maybe this is the cause why the fallback is being used. Created attachment 10631 [details] [review] Fix a bug that would cause truetype subsetting to fail on valid fonts. I have fixed a problem with the TrueType subsetting that would cause it to fail on some fonts. Could you test this patch to see if it fixes the problem of using fallback on the ttf fonts you tested. I have to admit, it does not help. I'm so sorry. The result is here: http://mark13.org/toad/download/other/test3.pdf (In reply to comment #14) > This was a TrueType font. The file > > http://mark13.org/toad/download/other/test2.pdf > > contains 4 different fonts: > > futura:size=12, TrueType > Hiragino Kaku Gothic Pro W3:size=12, OpenType PostScript. > Comic Sans MS:size=12, TrueType > Free Serif:size=12, TrueType (not available, the fallback is being used) > > and all of them seem to use the fallback. > > Apples's view can't display them, but Acrobat read can. > > Now Apple's X11 comes with modified FontConfig, etc. libraries which can access > Mac OS X's font system. Maybe this is the cause why the fallback is being used. > This is a separate bug from the problem of viewing CFF fonts in Apple Preview. I suggest filing a new bug for this. It is going to require someone with a Mac to figure out why TrueType subsetting fails on that platform. This bug is also being discussed on this cairo list thread: http://lists.cairographics.org/archives/cairo/2007-September/011452.html Created attachment 11817 [details] [review] Fix for cairo 1.4.10 This bug has been fix in the git repository. A patch for 1.4.10 is attached. |
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.