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
\pagedir TRT
\bodydir TRT
\pardir TRT
\textdir TRT
Hello \TeX \pdfannot{/Subtype /Text /T(Hlist) /Contents(My comment)} Hello again.
\pdfannot{/Subtype /Text /T(Vlist) /Contents(My comment)} Hello again.
\bye
diff --git a/source/texk/web2c/luatexdir/pdf/pdfannot.c b/source/texk/web2c/luatexdir/pdf/pdfannot.c
index e2e8e05..1f52f59 100644
--- a/source/texk/web2c/luatexdir/pdf/pdfannot.c
+++ b/source/texk/web2c/luatexdir/pdf/pdfannot.c
@@ -27,7 +27,7 @@ static const char __svn_version[] =
halfword pdf_annot_list; /* list of annotations in the current page */
-void do_annot(PDF pdf, halfword p, halfword parent_box, scaled x, scaled y)
+void do_annot(PDF pdf, halfword p, halfword parent_box, scaledpos pos)
{
if (!is_shipping_page)
pdf_error("ext4", "annotations cannot be inside an XForm");
@@ -35,7 +35,7 @@ void do_annot(PDF pdf, halfword p, halfword parent_box, scaled x, scaled y)
return;
if (is_obj_scheduled(pdf, pdf_annot_objnum(p)))
pdf_annot_objnum(p) = pdf_new_objnum(pdf);
- set_rect_dimens(p, parent_box, x, y,
+ set_rect_dimens(p, parent_box, pos.h, pos.v,
pdf_width(p), pdf_height(p), pdf_depth(p), 0);
obj_annot_ptr(pdf, pdf_annot_objnum(p)) = p;
pdf_append_list(pdf_annot_objnum(p), pdf_annot_list);
diff --git a/source/texk/web2c/luatexdir/pdf/pdfannot.h b/source/texk/web2c/luatexdir/pdf/pdfannot.h
index 64a7c0c..e6f5265 100644
--- a/source/texk/web2c/luatexdir/pdf/pdfannot.h
+++ b/source/texk/web2c/luatexdir/pdf/pdfannot.h
@@ -31,8 +31,7 @@
extern halfword pdf_annot_list; /* list of annotations in the current page */
-extern void do_annot(PDF pdf, halfword p, halfword parent_box, scaled x,
- scaled y);
+extern void do_annot(PDF pdf, halfword p, halfword parent_box, scaledpos pos);
extern void new_annot_whatsit(small_number w);
extern void scan_annot(PDF pdf);
diff --git a/source/texk/web2c/luatexdir/pdf/pdflistout.c b/source/texk/web2c/luatexdir/pdf/pdflistout.c
index 0161d5f..fdff6ed 100644
--- a/source/texk/web2c/luatexdir/pdf/pdflistout.c
+++ b/source/texk/web2c/luatexdir/pdf/pdflistout.c
@@ -18,6 +18,8 @@
with LuaTeX; if not, see <http://www.gnu.org/licenses/>. */
#include "ptexlib.h"
+#include "commands.h"
+#define page_width dimen_par(param_page_width_code)
static const char __svn_version[] =
"$Id$"
@@ -422,7 +424,17 @@ void pdf_hlist_out(PDF pdf)
cur.h = edge;
break;
case pdf_annot_node:
- do_annot(pdf, p, this_box, left_edge, base_line);
+ switch (box_direction(dvi_direction)) {
+ case dir_TL_:
+ pos.h = left_edge;
+ pos.v = base_line;
+ break;
+ case dir_TR_:
+ pos.h = left_edge - page_width;
+ pos.v = base_line;
+ break;
+ }
+ do_annot(pdf, p, this_box, pos);
break;
case pdf_start_link_node:
do_link(pdf, p, this_box, left_edge, base_line);
@@ -928,8 +940,17 @@ void pdf_vlist_out(PDF pdf)
cur.v = cur.v + pdf_height(p) + pdf_depth(p);
break;
case pdf_annot_node:
- do_annot(pdf, p, this_box, left_edge,
- top_edge + height(this_box));
+ switch (box_direction(dvi_direction)) {
+ case dir_TL_:
+ pos.h = left_edge;
+ pos.v = top_edge + height(this_box);
+ break;
+ case dir_TR_:
+ pos.h = left_edge - page_width;
+ pos.v = top_edge + height(this_box);
+ break;
+ }
+ do_annot(pdf, p, this_box, pos);
break;
case pdf_start_link_node:
pdf_error("ext4", "\\pdfstartlink ended up in vlist");
signature.asc
Description: Digital signature
_______________________________________________ dev-luatex mailing list [email protected] http://www.ntg.nl/mailman/listinfo/dev-luatex
