diff options
Diffstat (limited to 'Build/source/texk/web2c/luatexdir/pdf/pdfthread.w')
-rw-r--r-- | Build/source/texk/web2c/luatexdir/pdf/pdfthread.w | 102 |
1 files changed, 60 insertions, 42 deletions
diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdfthread.w b/Build/source/texk/web2c/luatexdir/pdf/pdfthread.w index 72ba892fa50..c5728143b5c 100644 --- a/Build/source/texk/web2c/luatexdir/pdf/pdfthread.w +++ b/Build/source/texk/web2c/luatexdir/pdf/pdfthread.w @@ -1,26 +1,26 @@ % pdfthread.w - -% Copyright 2009-2010 Taco Hoekwater <taco@@luatex.org> - +% +% Copyright 2009-2012 Taco Hoekwater <taco@@luatex.org> +% % This file is part of LuaTeX. - +% % LuaTeX is free software; you can redistribute it and/or modify it under % the terms of the GNU General Public License as published by the Free % Software Foundation; either version 2 of the License, or (at your % option) any later version. - +% % LuaTeX is distributed in the hope that it will be useful, but WITHOUT % ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or % FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public % License for more details. - +% % You should have received a copy of the GNU General Public License along % with LuaTeX; if not, see <http://www.gnu.org/licenses/>. @ @c static const char _svn_version[] = - "$Id: pdfthread.w 3905 2010-10-02 20:29:20Z hhenkel $" - "$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/pdf/pdfthread.w $"; + "$Id: pdfthread.w 4451 2012-07-05 21:13:01Z hhenkel $" + "$URL: http://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/pdf/pdfthread.w $"; #include "ptexlib.h" @@ -36,8 +36,9 @@ void append_bead(PDF pdf, halfword p) int a, b, c, t; if (global_shipping_mode == SHIPPING_FORM) pdf_error("ext4", "threads cannot be inside an XForm"); - t = get_obj(pdf, obj_type_thread, pdf_thread_id(p), pdf_thread_named_id(p)); - b = pdf_new_objnum(pdf); + t = pdf_get_obj(pdf, obj_type_thread, pdf_thread_id(p), + pdf_thread_named_id(p)); + b = pdf_create_obj(pdf, obj_type_others, 0); obj_bead_ptr(pdf, b) = pdf_get_mem(pdf, pdfmem_bead_size); set_obj_bead_page(pdf, b, pdf->last_page); set_obj_bead_data(pdf, b, p); @@ -132,6 +133,8 @@ void end_thread(PDF pdf, halfword p) case dir_RTT: pdf_ann_left(pdf->last_thread) = pos.h - pdf_thread_margin; break; + default: + assert(0); } } if (pdf->last_thread_named_id) @@ -143,12 +146,13 @@ void end_thread(PDF pdf, halfword p) @c void thread_title(PDF pdf, int t) { - pdf_printf(pdf, "/Title ("); + pdf_add_name(pdf, "Title"); + pdf_out(pdf, '('); if (obj_info(pdf, t) < 0) pdf_print(pdf, -obj_info(pdf, t)); else pdf_print_int(pdf, obj_info(pdf, t)); - pdf_printf(pdf, ")\n"); + pdf_out(pdf, ')'); } void pdf_fix_thread(PDF pdf, int t) @@ -166,23 +170,32 @@ void pdf_fix_thread(PDF pdf, int t) tprint(" has been referenced but does not exist, replaced by a fixed one"); print_ln(); print_ln(); - a = pdf_new_dict(pdf, obj_type_others, 0, 0); - pdf_indirect_ln(pdf, "T", t); - pdf_indirect_ln(pdf, "V", a); - pdf_indirect_ln(pdf, "N", a); - pdf_indirect_ln(pdf, "P", pdf->last_page); - pdf_printf(pdf, "/R [0 0 "); - pdf_print_bp(pdf, page_width); - pdf_out(pdf, ' '); - pdf_print_bp(pdf, page_height); - pdf_printf(pdf, "]\n"); + a = pdf_create_obj(pdf, obj_type_others, 0); + pdf_begin_obj(pdf, a, OBJSTM_ALWAYS); + pdf_begin_dict(pdf); + pdf_dict_add_ref(pdf, "T", t); + pdf_dict_add_ref(pdf, "V", a); + pdf_dict_add_ref(pdf, "N", a); + pdf_dict_add_ref(pdf, "P", pdf->last_page); + pdf_add_name(pdf, "R"); + pdf_begin_array(pdf); + pdf_add_int(pdf, 0); + pdf_add_int(pdf, 0); + pdf_add_bp(pdf, page_width); + pdf_add_bp(pdf, page_height); + pdf_end_array(pdf); pdf_end_dict(pdf); - pdf_begin_dict(pdf, t, 1); - pdf_printf(pdf, "/I << \n"); + pdf_end_obj(pdf); + + pdf_begin_obj(pdf, t, OBJSTM_ALWAYS); + pdf_begin_dict(pdf); + pdf_add_name(pdf, "I"); + pdf_begin_dict(pdf); thread_title(pdf, t); - pdf_printf(pdf, ">>\n"); - pdf_indirect_ln(pdf, "F", a); pdf_end_dict(pdf); + pdf_dict_add_ref(pdf, "F", a); + pdf_end_dict(pdf); + pdf_end_obj(pdf); } void out_thread(PDF pdf, int t) @@ -193,7 +206,8 @@ void out_thread(PDF pdf, int t) pdf_fix_thread(pdf, t); return; } - pdf_begin_dict(pdf, t, 1); + pdf_begin_obj(pdf, t, OBJSTM_ALWAYS); + pdf_begin_dict(pdf); a = obj_thread_first(pdf, t); b = a; last_attr = 0; @@ -205,26 +219,29 @@ void out_thread(PDF pdf, int t) if (last_attr != 0) { pdf_print_ln(pdf, last_attr); } else { - pdf_printf(pdf, "/I << \n"); + pdf_add_name(pdf, "I"); + pdf_begin_dict(pdf); thread_title(pdf, t); - pdf_printf(pdf, ">>\n"); + pdf_end_dict(pdf); } - pdf_indirect_ln(pdf, "F", a); + pdf_dict_add_ref(pdf, "F", a); pdf_end_dict(pdf); + pdf_end_obj(pdf); do { - pdf_begin_dict(pdf, a, 1); + pdf_begin_obj(pdf, a, OBJSTM_ALWAYS); + pdf_begin_dict(pdf); if (a == b) - pdf_indirect_ln(pdf, "T", t); - pdf_indirect_ln(pdf, "V", obj_bead_prev(pdf, a)); - pdf_indirect_ln(pdf, "N", obj_bead_next(pdf, a)); - pdf_indirect_ln(pdf, "P", obj_bead_page(pdf, a)); - pdf_indirect_ln(pdf, "R", obj_bead_rect(pdf, a)); + pdf_dict_add_ref(pdf, "T", t); + pdf_dict_add_ref(pdf, "V", obj_bead_prev(pdf, a)); + pdf_dict_add_ref(pdf, "N", obj_bead_next(pdf, a)); + pdf_dict_add_ref(pdf, "P", obj_bead_page(pdf, a)); + pdf_dict_add_ref(pdf, "R", obj_bead_rect(pdf, a)); pdf_end_dict(pdf); + pdf_end_obj(pdf); a = obj_bead_next(pdf, a); } while (a != b); } - @ @c void scan_thread_id(void) { @@ -260,15 +277,16 @@ void print_bead_rectangles(PDF pdf) int l; if ((k = get_page_resources_list(pdf, obj_type_bead)) != NULL) { while (k != NULL) { - l = pdf_new_obj(pdf, obj_type_others, 0, 1); - pdf_out(pdf, '['); + l = pdf_create_obj(pdf, obj_type_others, 0); + pdf_begin_obj(pdf, l, OBJSTM_ALWAYS); + pdf_begin_array(pdf); i = obj_bead_data(pdf, k->info); /* pointer to a whatsit or whatsit-like node */ - pdf_print_rect_spec(pdf, i); + pdf_add_rect_spec(pdf, i); if (subtype(i) == pdf_thread_data_node) /* thanh says it mis be destroyed here */ flush_node(i); - pdf_printf(pdf, "]\n"); - set_obj_bead_rect(pdf, k->info, l); /* rewrite |obj_bead_data| */ + pdf_end_array(pdf); pdf_end_obj(pdf); + set_obj_bead_rect(pdf, k->info, l); /* rewrite |obj_bead_data| */ k = k->link; } } |