diff options
author | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2015-12-16 14:50:11 +0000 |
---|---|---|
committer | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2015-12-16 14:50:11 +0000 |
commit | 621273b5ef8cc9e83d9aca07bf012f727ba26f15 (patch) | |
tree | 0b5cb28eec37e3e0e93a09729cbc30834166a5f9 /Build/source/texk/web2c/luatexdir/pdf/pdflink.w | |
parent | f04f01782aebac8cb2fcde278c02a4fb3be4bb12 (diff) |
web2c/luatexdir: LuaTeX beta-0.86.0 (Sync with the upstream).
git-svn-id: svn://tug.org/texlive/trunk@39116 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/web2c/luatexdir/pdf/pdflink.w')
-rw-r--r-- | Build/source/texk/web2c/luatexdir/pdf/pdflink.w | 61 |
1 files changed, 30 insertions, 31 deletions
diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdflink.w b/Build/source/texk/web2c/luatexdir/pdf/pdflink.w index 89fb1057567..b21d0774ecd 100644 --- a/Build/source/texk/web2c/luatexdir/pdf/pdflink.w +++ b/Build/source/texk/web2c/luatexdir/pdf/pdflink.w @@ -19,7 +19,6 @@ @ @c - #include "ptexlib.h" @ To implement nested link annotations, we need a stack to hold copy of @@ -31,7 +30,6 @@ void push_link_level(PDF pdf, halfword p) { if (pdf->link_stack_ptr >= pdf_max_link_level) overflow("pdf link stack size", pdf_max_link_level); - assert(((type(p) == whatsit_node) && (subtype(p) == pdf_start_link_node))); pdf->link_stack_ptr++; pdf->link_stack[pdf->link_stack_ptr].nesting_level = cur_s; pdf->link_stack[pdf->link_stack_ptr].link_node = copy_node_list(p); @@ -41,7 +39,6 @@ void push_link_level(PDF pdf, halfword p) @ @c void pop_link_level(PDF pdf) { - assert(pdf->link_stack_ptr > 0); flush_node_list(pdf->link_stack[pdf->link_stack_ptr].link_node); pdf->link_stack_ptr--; } @@ -54,8 +51,7 @@ void do_link(PDF pdf, halfword p, halfword parent_box, scaledpos cur) if (type(p) == vlist_node) normal_error("pdf backend", "'startlink' ended up in vlist"); if (global_shipping_mode == SHIPPING_FORM) - normal_error("pdf backend", "link annotations cannot be inside an XForm"); - assert(type(parent_box) == hlist_node); + normal_error("pdf backend", "link annotations cannot be inside an xform"); if (is_obj_scheduled(pdf, pdf_link_objnum(p))) pdf_link_objnum(p) = pdf_create_obj(pdf, obj_type_others, 0); push_link_level(pdf, p); @@ -80,32 +76,34 @@ void end_link(PDF pdf, halfword p) normal_error("pdf backend","pdf link_stack empty, 'endlink' used without 'startlink'"); if (pdf->link_stack[pdf->link_stack_ptr].nesting_level != cur_s) normal_error("pdf backend","'endlink' ended up in different nesting level than 'startlink'"); - - /* N.B.: test for running link must be done on |link_node| and not |ref_link_node|, - as |ref_link_node| can be set by |do_link| or |append_link| already */ - + /* + NOTA BENE: test for running link must be done on |link_node| and not + |ref_link_node|, as |ref_link_node| can be set by |do_link| or + |append_link| already + */ if (is_running(width(pdf->link_stack[pdf->link_stack_ptr].link_node))) { q = pdf->link_stack[pdf->link_stack_ptr].ref_link_node; if (global_shipping_mode == SHIPPING_PAGE && matrixused()) { - matrixrecalculate(pos.h + pdf_link_margin); + matrixrecalculate(pos.h + pdf_link_margin); pdf_ann_left(q) = getllx() - pdf_link_margin; pdf_ann_top(q) = getlly() - pdf_link_margin; pdf_ann_right(q) = geturx() + pdf_link_margin; pdf_ann_bottom(q) = getury() + pdf_link_margin; } else { switch (pdf->posstruct->dir) { - case dir_TLT: - pdf_ann_right(q) = pos.h + pdf_link_margin; - break; - case dir_TRT: - pdf_ann_left(q) = pos.h - pdf_link_margin; - break; - case dir_LTL: - case dir_RTT: - pdf_ann_bottom(q) = pos.v - pdf_link_margin; - break; - default: - assert(0); + case dir_TLT: + pdf_ann_right(q) = pos.h + pdf_link_margin; + break; + case dir_TRT: + pdf_ann_left(q) = pos.h - pdf_link_margin; + break; + case dir_LTL: + case dir_RTT: + pdf_ann_bottom(q) = pos.v - pdf_link_margin; + break; + default: + pdf_ann_right(q) = pos.h + pdf_link_margin; + formatted_warning("pdf backend","forcing bad dir %i to TLT in link",pdf->posstruct->dir); } } } @@ -114,10 +112,9 @@ void end_link(PDF pdf, halfword p) @ For ``running'' annotations we must append a new node when the end of annotation is in other box than its start. The new created node is identical to -corresponding whatsit node representing the start of annotation, but its -|info| field is |max_halfword|. We set |info| field just before destroying the -node, in order to use |flush_node_list| to do the job. - +corresponding whatsit node representing the start of annotation, but its |info| +field is |max_halfword|. We set |info| field just before destroying the node, in +order to use |flush_node_list| to do the job. @ Append a new pdf annot to |pdf_link_list|. @@ -127,7 +124,6 @@ void append_link(PDF pdf, halfword parent_box, scaledpos cur, small_number i) halfword p; int k; scaled_whd alt_rule; - assert(type(parent_box) == hlist_node); p = copy_node(pdf->link_stack[(int) i].link_node); pdf->link_stack[(int) i].ref_link_node = p; subtype(p) = pdf_link_data_node; /* this node is not a normal link node */ @@ -152,14 +148,17 @@ void scan_startlink(PDF pdf) new_annot_whatsit(pdf_start_link_node); set_pdf_link_attr(cur_list.tail_field, null); if (scan_keyword("attr")) { - scan_pdf_ext_toks(); + scan_toks(false, true); set_pdf_link_attr(cur_list.tail_field, def_ref); } r = scan_action(pdf); set_pdf_link_action(cur_list.tail_field, r); set_pdf_link_objnum(cur_list.tail_field, k); pdf_last_link = k; - /* N.B.: although it is possible to set |obj_annot_ptr(k) := tail| here, it - is not safe if nodes are later copied/destroyed/moved; a better place - to do this is inside |do_link|, when the whatsit node is written out */ + /* + NOTA BENE: although it is possible to set |obj_annot_ptr(k) := tail| + here, it is not safe if nodes are later copied/destroyed/moved; a better + place to do this is inside |do_link|, when the whatsit node is written + out + */ } |