summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c/luatexdir/pdf
diff options
context:
space:
mode:
authorAkira Kakuto <kakuto@fuk.kindai.ac.jp>2021-01-16 05:54:04 +0000
committerAkira Kakuto <kakuto@fuk.kindai.ac.jp>2021-01-16 05:54:04 +0000
commit77ab6ed5ef1f461991eac129796fcfa887c3576e (patch)
treee8fe1108d51542456ec973b4adfaaf9ca2803752 /Build/source/texk/web2c/luatexdir/pdf
parent2787bcb50d7936fe64a7b4c389d373a432b8404d (diff)
sync with the upstream
git-svn-id: svn://tug.org/texlive/trunk@57441 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/web2c/luatexdir/pdf')
-rw-r--r--Build/source/texk/web2c/luatexdir/pdf/pdfgen.c11
-rw-r--r--Build/source/texk/web2c/luatexdir/pdf/pdflink.c10
-rw-r--r--Build/source/texk/web2c/luatexdir/pdf/pdflink.h1
-rw-r--r--Build/source/texk/web2c/luatexdir/pdf/pdflistout.c15
-rw-r--r--Build/source/texk/web2c/luatexdir/pdf/pdftables.c18
-rw-r--r--Build/source/texk/web2c/luatexdir/pdf/pdftypes.h1
6 files changed, 43 insertions, 13 deletions
diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdfgen.c b/Build/source/texk/web2c/luatexdir/pdf/pdfgen.c
index 63736787ec5..ce610cb4925 100644
--- a/Build/source/texk/web2c/luatexdir/pdf/pdfgen.c
+++ b/Build/source/texk/web2c/luatexdir/pdf/pdfgen.c
@@ -916,6 +916,7 @@ void pdf_print_toks(PDF pdf, halfword p)
xfree(s);
}
+/*
void pdf_add_rect_spec(PDF pdf, halfword r)
{
pdf_add_bp(pdf, pdf_ann_left(r));
@@ -923,6 +924,16 @@ void pdf_add_rect_spec(PDF pdf, halfword r)
pdf_add_bp(pdf, pdf_ann_right(r));
pdf_add_bp(pdf, pdf_ann_top(r));
}
+*/
+
+void pdf_add_rect_spec(PDF pdf, halfword r)
+{
+ /* the check is now here */
+ pdf_add_bp(pdf, pdf_ann_left(r) < pdf_ann_right(r) ? pdf_ann_left(r) : pdf_ann_right(r));
+ pdf_add_bp(pdf, pdf_ann_bottom(r) < pdf_ann_top(r) ? pdf_ann_bottom(r) : pdf_ann_top(r));
+ pdf_add_bp(pdf, pdf_ann_left(r) < pdf_ann_right(r) ? pdf_ann_right(r) : pdf_ann_left(r));
+ pdf_add_bp(pdf, pdf_ann_bottom(r) < pdf_ann_top(r) ? pdf_ann_top(r) : pdf_ann_bottom(r));
+}
void pdf_rectangle(PDF pdf, halfword r)
{
diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdflink.c b/Build/source/texk/web2c/luatexdir/pdf/pdflink.c
index 55521b17692..77b950adf25 100644
--- a/Build/source/texk/web2c/luatexdir/pdf/pdflink.c
+++ b/Build/source/texk/web2c/luatexdir/pdf/pdflink.c
@@ -29,6 +29,16 @@ with LuaTeX; if not, see <http://www.gnu.org/licenses/>.
*/
+void pdf_out_link_state(PDF pdf, halfword p)
+{
+ if (pdf_link_state(p) >= 0 && pdf_link_state(p) <= 1) {
+ pdf->link_state = pdf_link_state(p);
+ } else {
+ /* ignores so one can use them for whatever purpose */
+ }
+}
+
+
void push_link_level(PDF pdf, halfword p)
{
if (pdf->link_stack_ptr >= pdf_max_link_level)
diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdflink.h b/Build/source/texk/web2c/luatexdir/pdf/pdflink.h
index 5b3d2042a80..ed96beab3dc 100644
--- a/Build/source/texk/web2c/luatexdir/pdf/pdflink.h
+++ b/Build/source/texk/web2c/luatexdir/pdf/pdflink.h
@@ -28,6 +28,7 @@
extern void push_link_level(PDF pdf, halfword p);
extern void pop_link_level(PDF pdf);
extern void do_link(PDF pdf, halfword p, halfword parent_box, scaledpos cur);
+extern void pdf_out_link_state(PDF pdf, halfword p);
extern void end_link(PDF pdf, halfword p);
extern void append_link(PDF pdf, halfword parent_box, scaledpos cur, small_number i);
extern void scan_startlink(PDF pdf);
diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdflistout.c b/Build/source/texk/web2c/luatexdir/pdf/pdflistout.c
index 86567c1dc4e..02c7025c330 100644
--- a/Build/source/texk/web2c/luatexdir/pdf/pdflistout.c
+++ b/Build/source/texk/web2c/luatexdir/pdf/pdflistout.c
@@ -177,6 +177,7 @@ static void handle_backend_whatsit(PDF pdf, halfword p, halfword parent_box, sca
case pdf_refobj_node:
case pdf_end_link_node:
case pdf_end_thread_node:
+ case pdf_link_state_node:
backend_out_whatsit[subtype(p)](pdf, p);
break;
case pdf_annot_node:
@@ -254,8 +255,20 @@ void hlist_out(PDF pdf, halfword this_box, int rule_callback_id)
cur_s++;
backend_out_control[backend_control_push_list](pdf,&saved_pos,&saved_loc);
for (i = 1; i <= pdf->link_stack_ptr; i++) {
- if (pdf->link_stack[i].nesting_level == cur_s)
+ if (pdf->link_state == 1) {
+ /*
+ We ignore this link. This is a compatibility-with-pdftex feature needed for latex. It
+ is suboptimal in the sense that when the whatsit is set, the next box is influenced,
+ so there there can be side effects when used in the middle of a line, when using
+ vadjust, etc. But we can assume that tha macro package knows when and where this
+ mechanism is triggered, so a more sophisticated solution is not needed (and would be
+ confusing in its own anyway.)
+
+ I would not be surprised of we have some leak here but it's harmless.
+ */
+ } else if (pdf->link_stack[i].nesting_level == cur_s) {
append_link(pdf, this_box, cur, (small_number) i);
+ }
}
if (synctex) {
synctexhlist(this_box);
diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdftables.c b/Build/source/texk/web2c/luatexdir/pdf/pdftables.c
index a97d0e39e85..2a02dcd98ec 100644
--- a/Build/source/texk/web2c/luatexdir/pdf/pdftables.c
+++ b/Build/source/texk/web2c/luatexdir/pdf/pdftables.c
@@ -224,8 +224,7 @@ void check_obj_type(PDF pdf, int t, int objnum)
void set_rect_dimens(PDF pdf, halfword p, halfword parent_box, scaledpos cur, scaled_whd alt_rule, scaled margin)
{
/*tex The positions relative to cur: */
- scaledpos ll, ur;
- scaledpos pos_ll, pos_ur, tmp;
+ scaledpos ll, ur, pos_ll, pos_ur;
posstructure localpos;
localpos.dir = pdf->posstruct->dir;
/*tex |pdf| contains current point on page: */
@@ -246,16 +245,11 @@ void set_rect_dimens(PDF pdf, halfword p, halfword parent_box, scaledpos cur, sc
pos_ll = localpos.pos;
synch_pos_with_cur(&localpos, pdf->posstruct, ur);
pos_ur = localpos.pos;
- if (pos_ll.h > pos_ur.h) {
- tmp.h = pos_ll.h;
- pos_ll.h = pos_ur.h;
- pos_ur.h = tmp.h;
- }
- if (pos_ll.v > pos_ur.v) {
- tmp.v = pos_ll.v;
- pos_ll.v = pos_ur.v;
- pos_ur.v = tmp.v;
- }
+ /*
+ The test for swapping has been moved to the moment we write the rectangle. This has to
+ do with the fact that we have code dealing with directions and that the |pdf_ann_*|
+ horizontal edges get recalculated in some places.
+ */
if (global_shipping_mode == SHIPPING_PAGE && matrixused()) {
matrixtransformrect(pos_ll.h, pos_ll.v, pos_ur.h, pos_ur.v);
pos_ll.h = getllx();
diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdftypes.h b/Build/source/texk/web2c/luatexdir/pdf/pdftypes.h
index 67ffcbecb22..ad2465f5283 100644
--- a/Build/source/texk/web2c/luatexdir/pdf/pdftypes.h
+++ b/Build/source/texk/web2c/luatexdir/pdf/pdftypes.h
@@ -371,6 +371,7 @@ typedef struct pdf_output_file_ {
/* the pdf link stack */
pdf_link_stack_record link_stack[(pdf_max_link_level + 1)];
int link_stack_ptr;
+ int link_state;
/* the thread data */
int last_thread; /* pointer to the last thread */
scaled_whd thread;