Bug 107346 - Type 3 font from PDF rendered blurry in SVG
Summary: Type 3 font from PDF rendered blurry in SVG
Status: RESOLVED MOVED
Alias: None
Product: cairo
Classification: Unclassified
Component: svg backend (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: Emmanuel Pacaud
QA Contact: cairo-bugs mailing list
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-07-23 15:35 UTC by Ben
Modified: 2018-08-25 13:37 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
SVG exported with pdf2svg (504.68 KB, image/svg+xml)
2018-07-23 15:40 UTC, Ben
Details
Screenshot of the SVG (86.96 KB, image/png)
2018-07-23 15:41 UTC, Ben
Details

Description Ben 2018-07-23 15:35:14 UTC
This PDF[1] has type-3 fonts. it looks good in Evince but when converted to SVG with pdf2svg (poppler+cairo) the text is blurry.

The PDF is from [2].

[1] http://cseweb.ucsd.edu/~goguen/pps/tcs97.pdf
[2] https://superuser.com/questions/740002/pdf-with-type-3-fonts-looks-better-after-pdf2ps-how-can-i-convert-it-back
Comment 1 Ben 2018-07-23 15:40:23 UTC
Created attachment 140782 [details]
SVG exported with pdf2svg
Comment 2 Ben 2018-07-23 15:41:09 UTC
Created attachment 140783 [details]
Screenshot of the SVG
Comment 3 Uli Schlachter 2018-07-25 16:31:19 UTC
Looking at the SVG's source, the glyphs have been "rastered". For example:

<symbol overflow="visible" id="glyph0-238">
<g transform="matrix(1,0,0,1,0,3)">
<rect x="1" y="1" width="1" height="1"/>
<rect x="3" y="1" width="1" height="1"/>
<rect x="1" y="2" width="1" height="1"/>
<rect x="2" y="4" width="1" height="1"/>
</g>
</symbol>

I would guess that the size of the raster is about 7x5 and that's also more or less the equality of the resulting picture.

No idea *why* this happens, but somewhere along the process, some important information gets lost. Also, no idea if this is Poppler's fault or cairo's fault.

Adrian?
Comment 4 Ben 2018-08-01 14:36:20 UTC
The PDF looks good in Evince (poppler) and when converted to PNG with pdftocairo.
Maybe it means that the issue is with Cairo SVG backend?
Comment 5 Ben 2018-08-25 12:29:31 UTC
This issue seems to be related:
https://bugs.freedesktop.org/show_bug.cgi?id=12769

The PDF attached in the issue has the same problem when exported to SVG.
They say that the 12 commits on poppler master from 0b5ee897 to 0741a4026 fixed it.
https://lists.freedesktop.org/archives/poppler/2008-October/004190.html
https://lists.freedesktop.org/archives/poppler/2008-November/004198.html

Is it possible that it was fixed specifically for PS export and a similar fix is needed for SVG export?
Comment 6 Ben 2018-08-25 13:05:35 UTC
I've changed the cairo svg surface to ps surface in pdf2svg and now the font isn't blurry.
https://github.com/dawbarton/pdf2svg/blob/master/pdf2svg.c

Line 29:
--#include <cairo-svg.h>
++#include <cairo-ps.h>
Line 66:
--surface = cairo_svg_surface_create(svgFilename, width, height);
++surface = cairo_ps_surface_create(svgFilename, width, height);

Does this mean that the problem is on Poppler side or Cairo side?
Comment 7 GitLab Migration User 2018-08-25 13:37:43 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/cairo/cairo/issues/107.


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.