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. The attached patch is quick hack, it does work to some degree, but I don't really understand how PDF annotations are supposed to work, and the result in vertical mode is not right yet. Also, if I didn't set page and body direction, the vlist example will ignore the direction change completely (is this related to the other text direction in vertical mode issue?) Regards, Khaled -- Khaled Hosny Arabic localiser and member of Arabeyes.org team Free font developer
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.
The attached patch is quick hack, it does work to some degree, but I don't really understand how PDF annotations are supposed to work, and the result in vertical mode is not right yet.
Also, if I didn't set page and body direction, the vlist example will ignore the direction change completely (is this related to the other text direction in vertical mode issue?)
thanks for the report, seems do_annot was still just TLT only. I'll try to fix (waiting for supelec). Regards, Hartmut
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 file. 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 text. 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
On Sun, Jul 05, 2009 at 10:06:02PM +0200, Hartmut Henkel wrote:
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 file.
OK, got that and I think it is fine that way. However, if I don't set page and body dir, annotations in vertical mode will be positioned at the left side of the page: \pardir TRT\textdir TRT \pdfannot {/Subtype/Text/Contents(My comment)} \leavevmode\pdfannot {/Subtype/Text/Contents(My comment)} \bye Is that related to hbox in vmode issue? (I think that was the source of my problem, but I didn't realize that then). Regards, Khaled -- Khaled Hosny Arabic localiser and member of Arabeyes.org team Free font developer
Hartmut Henkel wrote:
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 text.
indeed and we should be careful in adding to much automatism to that as often the code involved in custom annotations can be rather complex
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...
normally this is under macro package control and one can simply use -width or -height depending on the direction wanted (in pdf annotations are something independent of the page stream anyway) the annotation model is already tricky in the sense that one has to do some positioning i.e. ps/pdf llcorner upwards model versus tex's page stream down model so let's not act too hastely i suggest that we leave this code untouched till we have cleaned up the backend code (when you visit NL sometime we can sit on the balcony and muse about all the variants and options an dpossibilities) Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
participants (3)
-
Hans Hagen
-
Hartmut Henkel
-
Khaled Hosny