[dvipdfmx] missing annotation rectangle if the box contains no glyph

Shunsaku Hirata shunsaku.hirata74 at gmail.com
Sun Jun 28 05:24:45 CEST 2020

For this issue, I have added two new special commands:

* pdf:xann
As explained before, this is for extending the annotation area.
Meaningful only in pdf:bann-pdf:eann blocks. Otherwise this
special command is silently ignored.
The size of phantom text should be supplied as,

  \special{pdf:xann width 50pt height 9pt depth 1pt}

* dvipdfmx:catch_phantom
This is just an easy solution to this issue.
Normally, dvipdfmx uses only graphics objects actually put, to
determine the annotation area. But with this special, dvipdfmx
also uses "horizontal" displacement caused by DVI commands
like "right" for calculating annotation areas.
After dvipdfmx encounters

  \special{dvipdfmx:catch_phantom true}

it checks "horizontal" movements in pdf:bann-pdf:eann blocks
to generate a rectangle to be added to the current annotation
area with height as current font size.

Alternatively, "height" and "depth" can be explicitly specified,

  \special{dvipdfmx:catch_phantom true height 20pt depth 2pt}

Then, specified values will be used instead of current font size.
To turn off this feature, just use this with "false" as

  \special{dvipdfmx:catch_phantom false}

This workaround is based on heuristics that TeX normally uses
the push-pop operation to skip the left-margin instead of using
horizontal movement commands.
It is not guaranteed to work as expected.

Shunsaku Hirata

More information about the dvipdfmx mailing list.