You are not logged in.

#1 2019-04-28 13:26:52

galago
Member
Registered: 2015-11-13
Posts: 4

poppler-lcd -- PDF rendering library with sub-pixel rendering

Introduction

PDF rendering library with sub-pixel engine. The goal is to increase the apparent resolution of PDF content on LCD laptop.

Compatibility

tested on Poppler-0.76

Features
  • Embed sub-pixel rendering into Cairo font engine of poppler and poppler-glib. Add Cairo backend to poppler-qt5.

  • Grant sub-pixel smoothing ability to poppler-based PDF viewers, such as Evince, Okular and TeXstudio, without contaminating their source code.

Install by AUR helper
yaourt -S poppler-lcd poppler-glib-lcd poppler-qt5-lcd
Supported Frontends
  • Document Viewer (Evince)

  • Okular

  • TeXstudio

  • ...

TeXstudio sets splash as its default rendering backend. In order to use Cairo subpixel backend without patching TeXstudio, we can nullify its backend setting by fabricating and injecting a preload library as follows:

D="#define _ setRenderBackend(RenderBackend)\n"
N="namespace Poppler{struct Document{enum RenderBackend{};void _;};void Document::_{}}"
F="$HOME/.config/texstudio/injct.so"
echo $D$N|gcc -xc++ -shared -fPIC -fno-inline -o $F -
sudo sed -i "s#Exec=tex#Exec=LD_PRELOAD=$F tex#" /usr/share/applications/texstudio.desktop

TeXstudio started by the modified ".desktop" file will be subpixel enabled.

History

PDF viewers on Linux laptop won't render fonts smoothly due to the lack of sub-pixel hinting.

The issue was submitted 13 years ago by Ernst Sjöstrand (Issue 61). Anders Kaseorg provided a 10-line patch that forced subpixel rendering on Cairo and some image comparison showed great improvements. Then Paul Gideon Dann created a patch for Poppler-0.14 and Vladimir's for Poppler-0.22.

About 9 years ago, Paul requested a Cairo backend for Poppler's Qt4 wrapper, to which the maintainer Albert Astals Cid said no lest someone may complain about a new sub-pixel functionality (Issue 435).

Two years ago, Yichao Zhou proposed a patch of subpixel rendering support for Poppler-0.43 (Issue 23). It was reviewed by Adrian Johnson but he didn't seem to be willing to accept it.

Nowadays, Zhou's patch won't work for Poppler>0.43 (see https://github.com/zhou13/poppler-subpixel) and Paul is still maintaining his patch for the latest poppler version (see https://github.com/giddie/poppler-cairo-backend). Paul's latest update is for Poppler-0.74 on 18 Feb, 2019, but the patch has the following disadvantages:

  1. subpixel rendering wrapper for glib is so incomplete that any poppler-glib based frontend (e.g. evince) has to be patched to enable subpixel rendering.

  2. Cairo compositing operator used for Type 3 fonts is controlled inexplicitly by switching off subpixel antialias.

Recently, based on the work of Paul and Zhou, I have rewritten the subpixel patch for the latest Poppler-0.76 to provide subpixel functionality to PDF viewers without patching their own source code. See more details about my patch on the repository hosted at https://github.com/jonathanffon/poppler-lcd-patch

Screenshot

https://raw.githubusercontent.com/jonat … ompare.png

Mod edit: Please only post thumbnails or links to images -- V1del

Last edited by galago (2019-04-28 14:42:55)

Offline

#2 2019-04-28 14:00:41

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,534
Website

Re: poppler-lcd -- PDF rendering library with sub-pixel rendering

There is no need to advise the use of an unsupported AUR helper.  And there should be no need to recommend using -Sd to remove anything if your packages properly use provides and replaces fields which they seem to.  However, you also the replaces field which you should not.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#3 2019-04-28 14:54:01

galago
Member
Registered: 2015-11-13
Posts: 4

Re: poppler-lcd -- PDF rendering library with sub-pixel rendering

Trilby wrote:

There is no need to advise the use of an unsupported AUR helper.  And there should be no need to recommend using -Sd to remove anything if your packages properly use provides and replaces fields which they seem to.  However, you also the replaces field which you should not.

Thx. "replaces" field is removed from PKGBUILD

Offline

#4 2019-04-28 15:41:27

ayekat
Member
Registered: 2011-01-17
Posts: 1,590

Re: poppler-lcd -- PDF rendering library with sub-pixel rendering

Also, nitpicking, but I think there is no need to explicitly install poppler-lcd, since it's a dependency for both poppler-glib-lcd and poppler-qt5-lcd (to keep the local dependency tree sane).
But really, I think all of those packages should be installed --asdeps anyway, since they will likely be required by some other (frontend) package. I know this is more of a general "how to maintain my system" argument, but I think it also shows why there is no point in telling people to run specific commands (as Trilby already mentioned), especially if it instructs people to use an AUR helper (a dead one, on top of that).

Also, I think telling people that for Texstudio they may need to preload a custom shared library to have it use the Cairo subpixel rendering is enough. The specific instructions given there are not particularly smart: the changes to that .desktop file will be undone at the next update of the texlive package.


pkgshackscfgblag

Offline

#5 2019-04-28 15:52:12

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,534
Website

Re: poppler-lcd -- PDF rendering library with sub-pixel rendering

ayekat wrote:

Also, nitpicking, but I think there is no need to explicitly install poppler-lcd, since it's a dependency for both poppler-glib-lcd and poppler-qt5-lcd.

I think there is - I agree using the --asdeps flag would be good, but these are AUR packages, if you don't install them, they will not be installed as dependencies.

EDIT: Ah, I suppose you mean there is no need to install them as explicitly installed.  Yes, that'd I'd agree with that.

Last edited by Trilby (2019-04-28 15:53:29)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

Board footer

Powered by FluxBB