Forum Feature requests

Text Anti-Aliasing Support

I noticed that different pdf viewers render font icons from PDFs generated with Prince radically differently.

Would it be possible to add support for font-smooth (implemented as -webkit-font-smoothing and -moz-osx-font-smoothing) or a custom css property so that users can control how fonts are anti-aliased with Prince?

Attached are screen shots from Chrome showing how the html is rendered with and without font smoothing, screen shots of the pdf rendered in Chrome versus Adobe Acrobat, and a minimal test case.

System Information:
Mac Yosemite (10.10.3)
Prince 10 rev 4
Chrome Version 44.0.2403.157 (64-bit)

All the screen shots were rendered at "actual-size" which varied notably between the programs.
  1. AdobeAcrobatDC.png12.1 kB
  2. ChromeHTMLNoSmooth.png7.7 kB
  3. ChromeHTMLSmooth.png7.9 kB
  4. ChromePDF.png8.5 kB
  5. FontAntiAliasTest.zip39.7 kB
This is difficult, because PDFs are vector formats that can be rasterised at whatever resolution is required by the output device. I'm not sure if there is any hint we can embed in the PDF that would influence how the PDF viewer will rasterise the font. Even regular shapes like stroked/filled rectangles can be rendered differently at screen resolutions by different PDF viewers. Usually there is no problem when they are actually printed, though.
Regardless of specs, the trend these days is for popular icon fonts like Font Awesome to specify
-webkit-font-smoothing: antialiased;
which of course is ignored by Prince. Without that css, the icons can look pretty bad (on screen) when converted to PDF.

My team uses a custom icon font extensively (in addition to Font Awesome). If Prince can do anything to improve the PDF rendering of these icon fonts, it would definitely be appreciated.

Pulse Energy

Probably the only way to force a particular type of anti-aliasing would be for Prince to render the icons to a bitmap image and include that in the PDF. This would reduce print quality, but might make screen quality slightly more consistent across different PDF viewers.