[Dev-luatex] \pdfannot in TRT direction

Hartmut Henkel hartmut_henkel at gmx.de
Sun Jul 5 22:06:02 CEST 2009

Hi Khaled,

On Thu, 2 Jul 2009, Khaled Hosny wrote:

> PDF annotations are not placed correctly in TRT directions (and I
> guess other directions as well), I tried to track this issue and
> apparently directions are not taken into account when doing do_annot()
> in pdflistout.c.

checked your test file. i guess it's looking wrong since you did not set
width, height, or depth of the \pdfannot. Then by default it takes as
annotation rectangle dimensions and position the width from the current
point to the end of the surrounding box (as pdftex does). And in TRT
mode the end of the box is left from the current point, as the
surrounding \hbox goes across the full \hsize. The viewer then places
the annotation text flush left into this rectangle, so it ends up rather
left on the paper. I guess one does not have good control over this
other than stating width, height, and depth as arguments to \pdfannot.
Seems to be also rather implementation dependent.

Just set width to some value (e. g. 20mm, see also samplepdf.tex from
pdftex) and you will hopefully see that the annotation will be about
where you want it. And have a look at the /Rect [] array in the PDF

The directions _are_ taken care of (in a correct way i hope); the
coordinate transform to the page system happens within the
set_rect_dimens() function called from do_annot(). Even for the vertical
*B* and *T* directions it should be ok, but it stretches the
width/height/depth concept, as annotations seem to be generally TLT

Well, one could start philosophize whether the rectangle should be
mounted better always to the right from the current point, independent
from direction. One could state dimensions (x,y), and maybe (x,y) offset
strictly in page coordinates, and forget about w/h/d as the rectangle
has anyway not much to do with the classical width/height/depth TeX
parameters, particularly when they are transformed. But then one has to
guarantee that the annotation does not fall off the page...

Regards, Hartmut

More information about the dev-luatex mailing list