[tex-live] [Patch] XeTeX - Avoid modification of internal poppler object, fix compilation with poppler 0.72

Stefan Brüns stefan.bruens at rwth-aachen.de
Fri Dec 28 02:32:13 CET 2018


On Montag, 24. Dezember 2018 10:12:28 CET Mojca Miklavec wrote:
> Dear Akira,
> 
> On Mon, 24 Dec 2018 at 09:45, Akira Kakuto wrote:
> > > For TL 2019 (no need to do it just now) it would be helpful though if
> > > the sources could do some #ifdef-ing (based on poppler version) to
> > > also support the latest system version of poppler.
> > 
> > The present XeTeX sources themselves are completely compatible
> > with the newest poppler 0.72.0.
> 
> Awesome, thank you very much, I wasn't aware of this :)
> 
> > I don't know about configuration for system poppler.
> > Karl or Norbert will configure if they admit its
> > necessity and if they have free time.
> 
> Last time some people tried to backport some of your patches
> (admittedly to TeX Live 2018) and eventually gave up, but it could be
> that LuaTeX was the main blocker (which will no longer be the case in
> TL 2019 anyway). I didn't look into it at that time, we simply
> switched to the built-in version. I'll retry with the latest sources.

Ifdef's are somewhat complicated as poppler only defines a version string like
#define POPPLER_VERSION 0.72.0
which is somewhat difficult to use for version compares. Might be possible to 
do some version checks in configure.

The majority of poppler changes are const correctness changes. The API exposed 
internal objects as non-const, while it should have been const from the 
beginning.

All these changes can be handled by using
const Foo foo = bar->getFoo();
instead of
Foo foo = bar->getFoo();
in the calling code, i.e. {Pdf,Lua,Xe}TeX.

The first version compiles fine with *all* versions of poppler, while the 
second fails with more and more parts of poppler, as const is added wherever 
appropriate. No #ifdef's needed here.

Unfortunately, the TeX code has added static casts removing the const in more 
and more places instead of declaring the variables as const. In most cases, 
this is no functional problem, as the (non-const) objects where never 
modified, the occasion here in XeTeX was one of the rare outliers.
 
There where two actual API changes in poppler:
0.69: dictionaries changed the signature from add(char* key, ...) to add(const 
char* key, ...), where the old version transferred ownership of the key (so 
one had to use dict->add(copystring("key"), ...), the new one uses references 
(so one can use dict->add("key", ...) now).

0.72: GooString::getCString() was renamed to GooString::c_str(). Attribute 
changed the constructor from Attribute(char*, size_t, ...) to 
Attribute(GooString, ...).

If you want patches, see:
const correctness:
https://build.opensuse.org/package/view_file/
home:StefanBruens:branches:Publishing:TeXLive/texlive/source-fix-const-
poppler0.66.0.patch

poppler 0.69 changes:
https://build.opensuse.org/package/view_file/
home:StefanBruens:branches:Publishing:TeXLive/texlive/source-poppler-fix-dict-
memleak.patch

poppler 0.72 changes:
https://build.opensuse.org/package/view_file/
home:StefanBruens:branches:Publishing:TeXLive/texlive/source-poppler-use-
std_string.patch

Note, you have to rename *-newpoppler.cc to *.cc in pdftexdir before applying 
the patches. All three patches are for TL 2018.

Kind regards,

Stefan

-- 
Stefan Brüns  /  Bergstraße 21  /  52062 Aachen
home: +49 241 53809034     mobile: +49 151 50412019
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: This is a digitally signed message part.
URL: <https://tug.org/pipermail/tex-live/attachments/20181228/4e0133a3/attachment.sig>


More information about the tex-live mailing list