[NTG-pdftex] issues with pdf(pre|ap)pendkern

Robert w.m.l at gmx.net
Tue Aug 10 00:34:19 CEST 2021


a microtype user stumbled upon some bugs with

(1) interaction with protrusion:

if a glyph has a pre- or appended kern, protrusion will not work for
this glyph, as pdftex will stop scanning at the inserted kern. This is
certainly wrong, as this extra kern should not be considered as explicit
but as implicit (but see below). It could easily be fixed, I think, by
adding the auto_kern subtype to cp_skipable:

pdftex.web, l. 24375:
@d cp_skipable(#) == {skipable nodes at the margins during character
     not is_char_node(#) and
         or ((type(#) = kern_node) and
             ((width(#) = 0) or (subtype(#) = normal) or (subtype(#) =

A further question would be whether the extra kern should be skipped
only, or also discarded. This, I suppose, depends on how you see the
prepend/append mechanism conceptually: should it be considered as adding
kerning pairs with all other glyphs in the font, or as modifying the
side bearings of the glyph in question. In the first case, the kern
should be discarded (and in the example below, the "A" would be
protruded by 500/1000em), in the second not ("A" protruded by
(500-150)/1000em). For me it would be fine either way, as microtype
could then adjust it anyway...

(2) interaction with discretionaries:

if an explicit hyphen (or two or three) has an appended kern, the
discretionary following the hyphen will be inserted /before/ the kern,
so that pdftex may break the line at this point, disjoining the appended
kern from the glyph and carrying it over to the beginning of the next line.

(3) interaction with hyphenation:

in case of hyphenation, the discretionary hyphen does not receive any
pre/appended kerns at all. (This one's actually older, but I either
forgot to report, or it got lost, or rejected. In that case, I apologise.)

Here's an example for all three issues:

   \vbox to 0pt{\vrule height 1cm\hfill\vrule height 1cm \vss}
   \leavevmode\llap{#1 }\ignorespaces}

text text text text text
text text text AtextA AtextA

text text text text text text
text text text-text-text

text text text text text text
text text-text\-text-text



More information about the ntg-pdftex mailing list