For some fonts converting to path on pdf export thickens text and degrades quality

Bug #1396582 reported by Michael Demetriou on 2014-11-26
22
This bug affects 4 people
Affects Status Importance Assigned to Milestone
Inkscape
Medium
Unassigned

Bug Description

For some fonts (for example Fira Sans) when choosing "Convert texts to paths" the resulting text appears bolder and, in smaller point sizes, severely distorted. Converting to paths from the menu and then exporting does not exhibit the same issue.

The attached pdf has a showcase of this bug: Open sans is not affected, while Fira Sans is affected only when converting to paths at export time.

Michael Demetriou (qwazix) wrote :
su_v (suv-lp) wrote :

Please add information about OS/platform and Inkscape version (see Inkscape menu 'Help > About Inkscape') to the bug description, and attach the original SVG file used to create the PDF file to allow further investigation of the reported issue.

Changed in inkscape:
status: New → Incomplete
Michael Demetriou (qwazix) wrote :

I am attaching the svg file that reproduces the bug. You will need the free software fonts Open Sans (http://www.google.com/fonts#UsePlace:use/Collection:Open+Sans) and Fira Sans (https://www.mozilla.org/en-US/styleguide/products/firefox-os/typeface/) to be able to correctly reproduce the bug.

This bug affects 0.48.5 r10040 on MacOSX as well as the version shipped with ubuntu 14.04 default repositories (I do not have access to that right now, I will test and report back)

su_v (suv-lp) on 2014-11-26
Changed in inkscape:
status: Incomplete → New
tags: added: exporting pdf
su_v (suv-lp) wrote :

AFAICT not directly an Inkscape bug: based on tests with local builds (on OS X 10.7.5), whether or not it reproduces with Inkscape 0.48.5 and current trunk r13803 depends on which versions of upstream libraries are used.

Not reproduced (Inkscape. 0.48.5, 0.91+devel r13803):
- cairo 1.12.2, fontconfig 2.9.0, freetype 2.4.10, pango 1.30.1
- cairo 1.12.14, fontconfig 2.9.0, freetype 2.4.10, pango 1.32.5,
  harfbuzz 0.9.14

Reproduced (Inkscape. 0.48.5, 0.91+devel r13803):
- cairo 1.14.0, fontconfig 2.11.1, freetype 2.5.4, pango 1.36.8,
  harfbuzz 0.9.36

The difference in the generated output appears to be related to the font type: OTF affected, TTF not.

The resulting effect is possibly related to changes in upstream libraries (freetype, or cairo), as discussed in a similar poppler bug report earlier this year describing the same visual effect (darkened rendering of text at small sizes with OTF fonts):
poppler: <https://bugs.freedesktop.org/show_bug.cgi?id=78990>
freetype: <https://savannah.nongnu.org/bugs/index.php?42406>

In Inkscape, the outlining of text via PDF export option is eventually done by cairo (with information about the font from "the underlying font system"):
http://bazaar.launchpad.net/~inkscape.dev/inkscape/trunk/view/13803/src/extension/internal/cairo-render-context.cpp#L1618
http://cairographics.org/manual/cairo-Paths.html#cairo-glyph-path
whereas 'Object to path' uses internal functions:
http://bazaar.launchpad.net/~inkscape.dev/inkscape/trunk/view/13803/src/path-chemistry.cpp#L509
http://bazaar.launchpad.net/~inkscape.dev/inkscape/trunk/view/13803/src/libnrtype/Layout-TNG-Output.cpp#L761
http://bazaar.launchpad.net/~inkscape.dev/inkscape/trunk/view/13803/src/libnrtype/Layout-TNG.h#L375

Changed in inkscape:
importance: Undecided → Medium
status: New → Triaged
su_v (suv-lp) wrote :

On 2014-12-19 05:56 (+0100), ~suv wrote:
> The resulting effect is possibly related to changes in upstream
> libraries (freetype, or cairo), as discussed in a similar poppler bug
> report earlier this year describing the same visual effect (darkened
> rendering of text at small sizes with OTF fonts): poppler:
> <https://bugs.freedesktop.org/show_bug.cgi?id=78990> freetype:
> <https://savannah.nongnu.org/bugs/index.php?42406>

Confirmed: after recompiling freetype 2.5.4 with the old (freetype) CFF engine enabled and used by default as described in [1], PDF export now produces the expected result (small type isn't outlined darker in the PDF file). The new Adobe CFF engine was added in freetype 2.5.0 [2], which matches the findings of the local tests with older versions.

Using the old freetype CFF engine also "fixes" Inkscape's 'import via poppler' PDF import option (0.91+devel) and poppler's command line utility 'pdftocairo' (both methods otherwise may produce "fattened" outlined small text in the SVG output).

[1] http://git.savannah.gnu.org/cgit/freetype/freetype2.git/tree/include/config/ftoption.h#n800
[2] http://git.savannah.gnu.org/cgit/freetype/freetype2.git/tree/docs/CHANGES#n269

su_v (suv-lp) wrote :

On 2014-12-19 10:46 (+0100), ~suv wrote:
> Confirmed: after recompiling freetype 2.5.4 with the old (freetype) CFF
> engine enabled and used by default as described in [1] (…)
>
> [1] http://git.savannah.gnu.org/cgit/freetype/freetype2.git/tree/include/config/ftoption.h#n800

A better description is actually in 'include/ftcffdrv.h' [3].

[3] http://git.savannah.gnu.org/cgit/freetype/freetype2.git/tree/include/ftcffdrv.h#n120

su_v (suv-lp) wrote :

Based on tests with recent releases of freetype (on OS X 10.7.5):
- reproduced with freetype <= 2.6.1
- not reproduced with freetype 2.6.2
this report can be closed for Inkscape once freetype 2.6.2 or later is available on the major Linux distros (as well as bundled with Inkscape's Windows and OS X packages).

tags: added: fonts
Fabian Rost (fabianrost) wrote :

As a workaround manually converting the text to path before export via Path -> Object to Path works for me.

houz (houz) wrote :

Sure, that works, but it doesn't make this less of a bug.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.