summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c/luatexdir/pdf
diff options
context:
space:
mode:
authorAkira Kakuto <kakuto@fuk.kindai.ac.jp>2016-07-24 22:43:11 +0000
committerAkira Kakuto <kakuto@fuk.kindai.ac.jp>2016-07-24 22:43:11 +0000
commit7b14b75626befe976530136bcf3158a16bd95df0 (patch)
tree9aefff9670d456ac7402074ffddb1a7f2d7b036d /Build/source/texk/web2c/luatexdir/pdf
parentb7f40e4f685e941ac062cac36728a4cad0faab6c (diff)
luatexdir: Sync with the upstream
git-svn-id: svn://tug.org/texlive/trunk@41755 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/web2c/luatexdir/pdf')
-rw-r--r--Build/source/texk/web2c/luatexdir/pdf/pdfannot.w18
-rw-r--r--Build/source/texk/web2c/luatexdir/pdf/pdfcolorstack.w5
-rw-r--r--Build/source/texk/web2c/luatexdir/pdf/pdfgen.h2
-rw-r--r--Build/source/texk/web2c/luatexdir/pdf/pdfgen.w86
-rw-r--r--Build/source/texk/web2c/luatexdir/pdf/pdfglyph.w7
-rw-r--r--Build/source/texk/web2c/luatexdir/pdf/pdflistout.w4
-rw-r--r--Build/source/texk/web2c/luatexdir/pdf/pdfobj.w18
-rw-r--r--Build/source/texk/web2c/luatexdir/pdf/pdfpage.w7
-rw-r--r--Build/source/texk/web2c/luatexdir/pdf/pdfshipout.w88
-rw-r--r--Build/source/texk/web2c/luatexdir/pdf/pdftables.h4
-rw-r--r--Build/source/texk/web2c/luatexdir/pdf/pdfthread.w8
-rw-r--r--Build/source/texk/web2c/luatexdir/pdf/pdfxform.h4
-rw-r--r--Build/source/texk/web2c/luatexdir/pdf/pdfxform.w18
13 files changed, 132 insertions, 137 deletions
diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdfannot.w b/Build/source/texk/web2c/luatexdir/pdf/pdfannot.w
index 6bbfec226e7..43ee3692bd1 100644
--- a/Build/source/texk/web2c/luatexdir/pdf/pdfannot.w
+++ b/Build/source/texk/web2c/luatexdir/pdf/pdfannot.w
@@ -22,8 +22,6 @@
#include "ptexlib.h"
@ @c
-#define tail cur_list.tail_field
-
void do_annot(PDF pdf, halfword p, halfword parent_box, scaledpos cur)
{
scaled_whd alt_rule;
@@ -52,15 +50,15 @@ void do_annot(PDF pdf, halfword p, halfword parent_box, scaledpos cur)
scaled_whd alt_rule;
new_whatsit(w);
alt_rule = scan_alt_rule(); /* scans |<rule spec>| to |alt_rule| */
- set_width(tail, alt_rule.wd);
- set_height(tail, alt_rule.ht);
- set_depth(tail, alt_rule.dp);
+ set_width(tail_par, alt_rule.wd);
+ set_height(tail_par, alt_rule.ht);
+ set_depth(tail_par, alt_rule.dp);
if ((w == pdf_thread_node) || (w == pdf_start_thread_node)) {
if (scan_keyword("attr")) {
scan_toks(false, true);
- set_pdf_thread_attr(tail, def_ref);
+ set_pdf_thread_attr(tail_par, def_ref);
} else {
- set_pdf_thread_attr(tail, null);
+ set_pdf_thread_attr(tail_par, null);
}
}
}
@@ -87,10 +85,10 @@ void do_annot(PDF pdf, halfword p, halfword parent_box, scaledpos cur)
k = pdf_create_obj(pdf, obj_type_annot, 0);
}
new_annot_whatsit(pdf_annot_node);
- obj_annot_ptr(pdf, k) = tail;
- set_pdf_annot_objnum(tail, k);
+ obj_annot_ptr(pdf, k) = tail_par;
+ set_pdf_annot_objnum(tail_par, k);
scan_toks(false, true);
- set_pdf_annot_data(tail, def_ref);
+ set_pdf_annot_data(tail_par, def_ref);
}
pdf_last_annot = k;
}
diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdfcolorstack.w b/Build/source/texk/web2c/luatexdir/pdf/pdfcolorstack.w
index bcc7145c6ce..ac117d6ba05 100644
--- a/Build/source/texk/web2c/luatexdir/pdf/pdfcolorstack.w
+++ b/Build/source/texk/web2c/luatexdir/pdf/pdfcolorstack.w
@@ -47,9 +47,6 @@ They have the following properties:
*/
#define COLOR_DEFAULT "0 g 0 G"
-#define SET_ORIGIN 0
-#define DIRECT_PAGE 1
-#define DIRECT_ALWAYS 2
typedef struct {
char **page_stack;
@@ -89,7 +86,7 @@ static void colstacks_first_init(void)
colstacks[0].page_current = xstrdup(COLOR_DEFAULT);
colstacks[0].form_current = xstrdup(COLOR_DEFAULT);
colstacks[0].form_init = xstrdup(COLOR_DEFAULT);
- colstacks[0].literal_mode = DIRECT_ALWAYS;
+ colstacks[0].literal_mode = direct_always;
colstacks[0].page_start = true;
}
diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdfgen.h b/Build/source/texk/web2c/luatexdir/pdf/pdfgen.h
index 0a8e099b177..551f686e6fe 100644
--- a/Build/source/texk/web2c/luatexdir/pdf/pdfgen.h
+++ b/Build/source/texk/web2c/luatexdir/pdf/pdfgen.h
@@ -188,7 +188,7 @@ extern scaled round_xn_over_d(scaled x, int n, unsigned int d);
extern char *convertStringToPDFString(const char *in, int len);
-extern void init_start_time(PDF);
+extern void initialize_start_time(PDF);
extern char *getcreationdate(PDF);
extern void check_o_mode(PDF pdf, const char *s, int o_mode, boolean errorflag);
diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdfgen.w b/Build/source/texk/web2c/luatexdir/pdf/pdfgen.w
index 7786d83a125..e27928a9e18 100644
--- a/Build/source/texk/web2c/luatexdir/pdf/pdfgen.w
+++ b/Build/source/texk/web2c/luatexdir/pdf/pdfgen.w
@@ -26,8 +26,6 @@
#include "lua/luatex-api.h"
#include "md5.h"
-#define is_hex_char isxdigit
-
#define check_nprintf(size_get, size_want) \
if ((unsigned)(size_get) >= (unsigned)(size_want)) \
formatted_error("pdf backend","snprintf() failed in file %s at line %d", __FILE__, __LINE__);
@@ -50,6 +48,7 @@ halfword pdf_names_toks; /* additional keys of Names
halfword pdf_trailer_toks; /* additional keys of Trailer dictionary */
shipping_mode_e global_shipping_mode = NOT_SHIPPING; /* set to |shipping_mode| when |ship_out| starts */
+
@ Create a new buffer |strbuf_s| of size |size| and maximum allowed size |limit|.
Initialize it and set |p| to begin of data.
@@ -245,7 +244,7 @@ int pdf_get_mem(PDF pdf, int s)
output_mode get_o_mode(void)
{
output_mode o_mode;
- if (int_par(output_mode_code) > 0) {
+ if (output_mode_par > 0) {
o_mode = OMODE_PDF;
} else
o_mode = OMODE_DVI;
@@ -285,7 +284,7 @@ void fix_pdf_minorversion(PDF pdf)
/* Check that variables for \.{PDF} output are unchanged */
if (pdf->minor_version != pdf_minor_version)
normal_error("pdf backend", "minorversion cannot be changed after data is written to the PDF file");
- if (pdf->draftmode != int_par(draft_mode_code))
+ if (pdf->draftmode != draft_mode_par)
normal_error("pdf backend", "draftmode cannot be changed after data is written to the PDF file");
}
if (pdf->draftmode != 0) {
@@ -633,7 +632,7 @@ void pdf_print_str(PDF pdf, const char *s)
return;
}
s++;
- while (is_hex_char((unsigned char)*s))
+ while (isxdigit((unsigned char)*s))
s++;
if (s != orig + l) {
pdf_out(pdf, '(');
@@ -960,7 +959,7 @@ void pdf_rectangle(PDF pdf, halfword r)
static void init_pdf_outputparameters(PDF pdf)
{
int pk_mode;
- pdf->draftmode = fix_int(int_par(draft_mode_code), 0, 1);
+ pdf->draftmode = fix_int(draft_mode_par, 0, 1);
pdf->compress_level = fix_int(pdf_compress_level, 0, 9);
pdf->decimal_digits = fix_int(pdf_decimal_digits, 3, 5);
pdf->gamma = fix_int(pdf_gamma, 0, 1000000);
@@ -987,15 +986,17 @@ static void init_pdf_outputparameters(PDF pdf)
pk_mode = pdf_pk_mode; /* lookup once */
if (pk_mode != null) {
char *s = tokenlist_to_cstring(pk_mode, true, NULL);
+ /* This will become LUATEX in 1.0. */
kpse_init_prog("PDFTEX", (unsigned) pdf->pk_resolution, s, nil);
xfree(s);
} else {
+ /* This will become LUATEX in 1.0. */
kpse_init_prog("PDFTEX", (unsigned) pdf->pk_resolution, nil, nil);
}
if (!kpse_var_value("MKTEXPK"))
kpse_set_program_enabled(kpse_pk_format, 1, kpse_src_cmdline);
}
- set_job_id(pdf, int_par(year_code), int_par(month_code), int_par(day_code), int_par(time_code));
+ set_job_id(pdf, year_par, month_par, day_par, time_par);
if ((pdf_unique_resname > 0) && (pdf->resname_prefix == NULL))
pdf->resname_prefix = get_resname_prefix(pdf);
}
@@ -1026,6 +1027,7 @@ static void ensure_pdf_header_written(PDF pdf)
init_pdf_outputparameters(pdf);
/* Write \.{PDF} header */
pdf_printf(pdf, "%%PDF-1.%d\n", pdf->minor_version);
+ /* The next blob will be removed 1.0. */
pdf_out(pdf, '%');
pdf_out(pdf, 'P' + 128);
pdf_out(pdf, 'T' + 128);
@@ -1455,7 +1457,7 @@ static void print_ID(PDF pdf)
/* start md5 */
md5_init(&state);
/* get the time */
- t = time(NULL);
+ t = pdf->start_time;
size = strftime(time_str, sizeof(time_str), "%Y%m%dT%H%M%SZ", gmtime(&t));
md5_append(&state, (const md5_byte_t *) time_str, (int) size);
/* get the file name */
@@ -1542,7 +1544,11 @@ static void makepdftime(PDF pdf)
time_t t = pdf->start_time;
char *time_str = pdf->start_time_str;
/* get the time */
- lt = *localtime(&t);
+ if (utc_option) {
+ lt = *gmtime(&t);
+ } else {
+ lt = *localtime(&t);
+ }
size = strftime(time_str, TIME_STR_SIZE, "D:%Y%m%d%H%M%S", &lt);
/* expected format: "YYYYmmddHHMMSS" */
if (size == 0) {
@@ -1582,10 +1588,10 @@ static void makepdftime(PDF pdf)
}
@ @c
-void init_start_time(PDF pdf)
+void initialize_start_time(PDF pdf)
{
if (pdf->start_time == 0) {
- pdf->start_time = time((time_t *) NULL);
+ pdf->start_time = get_start_time();
pdf->start_time_str = xtalloc(TIME_STR_SIZE, char);
makepdftime(pdf);
}
@@ -1594,7 +1600,7 @@ void init_start_time(PDF pdf)
@ @c
char *getcreationdate(PDF pdf)
{
- init_start_time(pdf);
+ initialize_start_time(pdf);
return pdf->start_time_str;
}
@@ -1642,9 +1648,9 @@ void check_o_mode(PDF pdf, const char *s, int o_mode_bitpattern, boolean strict)
normal_error("pdf backend","weird output state");
}
if (strict)
- formatted_error("pdf backend", "%s not allowed in %s mode (outputmode = %d)",s, m, (int) int_par(output_mode_code));
+ formatted_error("pdf backend", "%s not allowed in %s mode (outputmode = %d)",s, m, (int) output_mode_par);
else
- formatted_warning("pdf backend", "%s not allowed in %s mode (outputmode = %d)",s, m, (int) int_par(output_mode_code));
+ formatted_warning("pdf backend", "%s not allowed in %s mode (outputmode = %d)",s, m, (int) output_mode_par);
} else if (strict)
ensure_output_state(pdf, ST_HEADER_WRITTEN);
}
@@ -1688,11 +1694,10 @@ char *get_resname_prefix(PDF pdf)
}
@ @c
-#define mag int_par(mag_code)
-
void pdf_begin_page(PDF pdf)
{
int xform_attributes;
+ int xform_type = 0;
scaled form_margin = pdf_xform_margin; /* was one_bp until SVN4066 */
ensure_output_state(pdf, ST_HEADER_WRITTEN);
init_pdf_pagecalculations(pdf);
@@ -1711,12 +1716,16 @@ void pdf_begin_page(PDF pdf)
pdf->last_thread = null;
pdf_begin_dict(pdf);
} else {
+ xform_type = obj_xform_type(pdf, pdf_cur_form) ;
pdf_begin_obj(pdf, pdf_cur_form, OBJSTM_NEVER);
pdf->last_stream = pdf_cur_form;
/* Write out Form stream header */
pdf_begin_dict(pdf);
- pdf_dict_add_name(pdf, "Type", "XObject");
- pdf_dict_add_name(pdf, "Subtype", "Form");
+ if (xform_type == 0) {
+ pdf_dict_add_name(pdf, "Type", "XObject");
+ pdf_dict_add_name(pdf, "Subtype", "Form");
+ pdf_dict_add_int(pdf, "FormType", 1);
+ }
xform_attributes = pdf_xform_attr; /* lookup once */
if (xform_attributes != null)
pdf_print_toks(pdf, xform_attributes);
@@ -1730,23 +1739,26 @@ void pdf_begin_page(PDF pdf)
luaL_unref(Luas, LUA_REGISTRYINDEX, obj_xform_attr_str(pdf, pdf_cur_form));
set_obj_xform_attr_str(pdf, pdf_cur_form, null);
}
- pdf_add_name(pdf, "BBox");
- pdf_begin_array(pdf);
- pdf_add_bp(pdf, -form_margin);
- pdf_add_bp(pdf, -form_margin);
- pdf_add_bp(pdf, pdf->page_size.h + form_margin);
- pdf_add_bp(pdf, pdf->page_size.v + form_margin);
- pdf_end_array(pdf);
- pdf_dict_add_int(pdf, "FormType", 1);
- pdf_add_name(pdf, "Matrix");
- pdf_begin_array(pdf);
- pdf_add_int(pdf, 1);
- pdf_add_int(pdf, 0);
- pdf_add_int(pdf, 0);
- pdf_add_int(pdf, 1);
- pdf_add_int(pdf, 0);
- pdf_add_int(pdf, 0);
- pdf_end_array(pdf);
+ if (xform_type == 0 || xform_type == 1 || xform_type == 3) {
+ pdf_add_name(pdf, "BBox");
+ pdf_begin_array(pdf);
+ pdf_add_bp(pdf, -form_margin);
+ pdf_add_bp(pdf, -form_margin);
+ pdf_add_bp(pdf, pdf->page_size.h + form_margin);
+ pdf_add_bp(pdf, pdf->page_size.v + form_margin);
+ pdf_end_array(pdf);
+ }
+ if (xform_type == 0 || xform_type == 2 || xform_type == 3) {
+ pdf_add_name(pdf, "Matrix");
+ pdf_begin_array(pdf);
+ pdf_add_int(pdf, 1);
+ pdf_add_int(pdf, 0);
+ pdf_add_int(pdf, 0);
+ pdf_add_int(pdf, 1);
+ pdf_add_int(pdf, 0);
+ pdf_add_int(pdf, 0);
+ pdf_end_array(pdf);
+ }
pdf_dict_add_ref(pdf, "Resources", pdf->page_resources->last_resources);
}
/* Start stream of page/form contents */
@@ -2176,11 +2188,11 @@ static int pdf_print_info(PDF pdf, int luatexversion,
pdf_dict_add_string(pdf, "Creator", "TeX");
}
if ((pdf_suppress_optional_info & 32) == 0 && !creationdate_given) {
- init_start_time(pdf);
+ initialize_start_time(pdf);
pdf_dict_add_string(pdf, "CreationDate", pdf->start_time_str);
}
if ((pdf_suppress_optional_info & 64) == 0 && !moddate_given) {
- init_start_time(pdf);
+ initialize_start_time(pdf);
pdf_dict_add_string(pdf, "ModDate", pdf->start_time_str);
}
if ((pdf_suppress_optional_info & 256) == 0 && !trapped_given) {
diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdfglyph.w b/Build/source/texk/web2c/luatexdir/pdf/pdfglyph.w
index 93096d025e5..a1059828938 100644
--- a/Build/source/texk/web2c/luatexdir/pdf/pdfglyph.w
+++ b/Build/source/texk/web2c/luatexdir/pdf/pdfglyph.w
@@ -22,13 +22,10 @@
#include "ptexlib.h"
#include "pdf/pdfpage.h"
-#define pdf2double(a) ((double) (a).m / ten_pow[(a).e])
-
@ eternal constants
@c
-#define one_bp ((double) 65536 * (double) 72.27 / 72) /* number of sp per 1bp */
-#define e_tj 3 /* must be 3; movements in []TJ are in fontsize/$10^3$ units */
+#define e_tj 3 /* must be 3; movements in []TJ are in fontsize/$10^3$ units */
@ @c
static int64_t pdf_char_width(pdfstructure * p, internal_font_number f, int i)
@@ -58,7 +55,7 @@ static void setup_fontparameters(PDF pdf, internal_font_number f, int ex_glyph)
u = font_units_per_em(f) / 1000.0;
pdf->f_cur = f;
p->f_pdf = pdf_set_font(pdf, f);
- p->fs.m = i64round(font_size(f) / u / one_bp * ten_pow[p->fs.e]);
+ p->fs.m = i64round(font_size(f) / u / by_one_bp * ten_pow[p->fs.e]);
slant = font_slant(f) / 1000.0;
extend = font_extend(f) / 1000.0;
expand = 1.0 + (ex_glyph/1) / 1000.0;
diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdflistout.w b/Build/source/texk/web2c/luatexdir/pdf/pdflistout.w
index b6f3e6ff1a1..8c5abad5302 100644
--- a/Build/source/texk/web2c/luatexdir/pdf/pdflistout.w
+++ b/Build/source/texk/web2c/luatexdir/pdf/pdflistout.w
@@ -310,7 +310,7 @@ void hlist_out(PDF pdf, halfword this_box, int rule_callback_id)
int i; /* index to scan |pdf_link_stack| */
int save_loc = 0; /* DVI! \.{DVI} byte location upon entry */
scaledpos save_dvi = { 0, 0 }; /* DVI! what |dvi| should pop to */
- int synctex = int_par(synctex_code) ;
+ int synctex = synctex_par ;
g_order = glue_order(this_box);
g_sign = glue_sign(this_box);
@@ -764,7 +764,7 @@ void vlist_out(PDF pdf, halfword this_box, int rule_callback_id)
scaled_whd rule;
int save_loc = 0; /* DVI byte location upon entry */
scaledpos save_dvi = { 0, 0 }; /* DVI! what |dvi| should pop to */
- int synctex = int_par(synctex_code) ;
+ int synctex = synctex_par ;
g_order = (glue_ord) glue_order(this_box);
g_sign = glue_sign(this_box);
diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdfobj.w b/Build/source/texk/web2c/luatexdir/pdf/pdfobj.w
index 7dd51061595..e5ca09de624 100644
--- a/Build/source/texk/web2c/luatexdir/pdf/pdfobj.w
+++ b/Build/source/texk/web2c/luatexdir/pdf/pdfobj.w
@@ -29,13 +29,21 @@ void pdf_write_obj(PDF pdf, int k)
lstring data;
const_lstring st;
size_t li; /* index into |data.s| */
- int saved_compress_level = pdf->compress_level;
+ int saved_compress_level ;
int os_threshold = OBJSTM_ALWAYS; /* gives compressed objects for \.{\\pdfvariable objcompresslevel} >= |OBJSTM_ALWAYS| */
int l = 0; /* possibly a lua registry reference */
int ll = 0;
data.s = NULL;
- if (obj_obj_pdfcompresslevel(pdf, k) > -1) /* -1 = "unset" */
+ /* we can have an immediate object before we are initialized */
+ ensure_output_state(pdf, ST_HEADER_WRITTEN);
+ saved_compress_level = pdf->compress_level;
+ /* end of ugly hack */
+ if (obj_obj_pdfcompresslevel(pdf, k) > -1) { /* -1 = "unset" */
pdf->compress_level = obj_obj_pdfcompresslevel(pdf, k);
+ if (pdf->compress_level == 0) {
+ pdf->objcompresslevel = 0;
+ }
+ }
if (obj_obj_objstm_threshold(pdf, k) != OBJSTM_UNSET)
os_threshold = obj_obj_objstm_threshold(pdf, k);
if (obj_obj_is_stream(pdf, k)) {
@@ -183,21 +191,19 @@ void scan_obj(PDF pdf)
}
@ @c
-#define tail cur_list.tail_field
-
void scan_refobj(PDF pdf)
{
scan_int();
check_obj_type(pdf, obj_type_obj, cur_val);
new_whatsit(pdf_refobj_node);
- pdf_obj_objnum(tail) = cur_val;
+ pdf_obj_objnum(tail_par) = cur_val;
}
void scan_refobj_lua(PDF pdf, int k)
{
check_obj_type(pdf, obj_type_obj, k);
new_whatsit(pdf_refobj_node);
- pdf_obj_objnum(tail) = k;
+ pdf_obj_objnum(tail_par) = k;
}
@ @c
diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdfpage.w b/Build/source/texk/web2c/luatexdir/pdf/pdfpage.w
index 90f63534d32..f0782d2093c 100644
--- a/Build/source/texk/web2c/luatexdir/pdf/pdfpage.w
+++ b/Build/source/texk/web2c/luatexdir/pdf/pdfpage.w
@@ -26,11 +26,6 @@
#include <assert.h>
#include <math.h>
-@ eternal constant: number of sp per 1bp
-
-@c
-#define one_bp ((double) 65536 * (double) 72.27 / 72)
-
@ @c
void init_pdf_pagecalculations(PDF pdf)
{
@@ -66,7 +61,7 @@ void init_pdf_pagecalculations(PDF pdf)
p->ishex = 0;
p->need_tf = false;
p->need_tm = false;
- p->k1 = ten_pow[p->pdf.h.e] / one_bp;
+ p->k1 = ten_pow[p->pdf.h.e] / by_one_bp;
}
@ @c
diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdfshipout.w b/Build/source/texk/web2c/luatexdir/pdf/pdfshipout.w
index 253f8dc4202..8665f685e1f 100644
--- a/Build/source/texk/web2c/luatexdir/pdf/pdfshipout.w
+++ b/Build/source/texk/web2c/luatexdir/pdf/pdfshipout.w
@@ -22,20 +22,6 @@
#include "ptexlib.h"
@ @c
-#define count(A) eqtb[count_base+(A)].cint
-
-#define mag int_par(mag_code)
-#define h_offset dimen_par(h_offset_code)
-#define page_bottom_offset dimen_par(page_bottom_offset_code)
-#define page_height dimen_par(page_height_code)
-#define page_left_offset dimen_par(page_left_offset_code)
-#define page_right_offset dimen_par(page_right_offset_code)
-#define page_top_offset dimen_par(page_top_offset_code)
-#define page_width dimen_par(page_width_code)
-#define tracing_output int_par(tracing_output_code)
-#define tracing_stats int_par(tracing_stats_code)
-#define v_offset dimen_par(v_offset_code)
-
scaledpos shipbox_refpos;
@ |ship_out| is used to shipout a box to PDF or DVI mode. If |shipping_mode| is
@@ -61,16 +47,16 @@ void ship_out(PDF pdf, halfword p, shipping_mode_e shipping_mode)
Start sheet {\sl Sync\TeX} information record; we assume that |pdf_output| is
properly set up.
*/
- if (int_par(synctex_code)) {
+ if (synctex_par) {
if (output_mode_used == OMODE_DVI) {
- synctexsheet(mag);
+ synctexsheet(mag_par);
} else {
synctexsheet(1000);
}
}
pre_callback_id = callback_defined(start_page_number_callback);
post_callback_id = callback_defined(stop_page_number_callback);
- if ((tracing_output > 0) && (pre_callback_id == 0)) {
+ if ((tracing_output_par > 0) && (pre_callback_id == 0)) {
tprint_nl("");
print_ln();
tprint("Completed box being shipped out");
@@ -95,7 +81,7 @@ void ship_out(PDF pdf, halfword p, shipping_mode_e shipping_mode)
}
}
}
- if ((tracing_output > 0) && shipping_mode == SHIPPING_PAGE) {
+ if ((tracing_output_par > 0) && shipping_mode == SHIPPING_PAGE) {
print_char(']');
update_terminal();
begin_diagnostic();
@@ -103,7 +89,7 @@ void ship_out(PDF pdf, halfword p, shipping_mode_e shipping_mode)
end_diagnostic(true);
}
/* Ship box |p| out */
- if (shipping_mode == SHIPPING_PAGE && box_dir(p) != page_direction)
+ if (shipping_mode == SHIPPING_PAGE && box_dir(p) != page_direction_par)
normal_warning("backend","pagedir differs from bodydir, the output may be placed wrongly on the page");
/*
Update the values of |max_h| and |max_v|; but if the page is too large,
@@ -111,14 +97,14 @@ void ship_out(PDF pdf, halfword p, shipping_mode_e shipping_mode)
error messages are being ignored. Such pages are not output to the
\.{dvi} file, since they may confuse the printing software.
*/
- if ((height(p) > max_dimen) || (depth(p) > max_dimen) || (height(p) + depth(p) + v_offset > max_dimen) || (width(p) + h_offset > max_dimen)) {
+ if ((height(p) > max_dimen) || (depth(p) > max_dimen) || (height(p) + depth(p) + v_offset_par > max_dimen) || (width(p) + h_offset_par > max_dimen)) {
const char *hlp[] = {
"The page just created is more than 18 feet tall or",
"more than 18 feet wide, so I suspect something went wrong.",
NULL
};
tex_error("Huge page cannot be shipped out", hlp);
- if (tracing_output <= 0) {
+ if (tracing_output_par <= 0) {
begin_diagnostic();
tprint_nl("The following box has been deleted:");
show_box(p);
@@ -126,47 +112,47 @@ void ship_out(PDF pdf, halfword p, shipping_mode_e shipping_mode)
}
goto DONE;
}
- if (height(p) + depth(p) + v_offset > max_v)
- max_v = height(p) + depth(p) + v_offset;
- if (width(p) + h_offset > max_h)
- max_h = width(p) + h_offset;
+ if (height(p) + depth(p) + v_offset_par > max_v)
+ max_v = height(p) + depth(p) + v_offset_par;
+ if (width(p) + h_offset_par > max_h)
+ max_h = width(p) + h_offset_par;
/* Calculate page dimensions and margins */
if (global_shipping_mode == SHIPPING_PAGE) {
- if (page_width > 0)
- pdf->page_size.h = page_width;
+ if (page_width_par > 0)
+ pdf->page_size.h = page_width_par;
else {
- switch (page_direction) {
+ switch (page_direction_par) {
case dir_TLT:
- pdf->page_size.h = width(p) + 2 * page_left_offset;
+ pdf->page_size.h = width(p) + 2 * page_left_offset_par;
break;
case dir_TRT:
- pdf->page_size.h = width(p) + 2 * page_right_offset;
+ pdf->page_size.h = width(p) + 2 * page_right_offset_par;
break;
case dir_LTL:
- pdf->page_size.h = height(p) + depth(p) + 2 * page_left_offset;
+ pdf->page_size.h = height(p) + depth(p) + 2 * page_left_offset_par;
break;
case dir_RTT:
- pdf->page_size.h = height(p) + depth(p) + 2 * page_right_offset;
+ pdf->page_size.h = height(p) + depth(p) + 2 * page_right_offset_par;
break;
default:
- pdf->page_size.h = width(p) + 2 * page_left_offset;
+ pdf->page_size.h = width(p) + 2 * page_left_offset_par;
normal_warning("pdf backend","bad page direction, assuming TLT, case 1");
}
}
- if (page_height > 0)
- pdf->page_size.v = page_height;
+ if (page_height_par > 0)
+ pdf->page_size.v = page_height_par;
else {
- switch (page_direction) {
+ switch (page_direction_par) {
case dir_TLT:
case dir_TRT:
- pdf->page_size.v = height(p) + depth(p) + 2 * page_top_offset;
+ pdf->page_size.v = height(p) + depth(p) + 2 * page_top_offset_par;
break;
case dir_LTL:
case dir_RTT:
- pdf->page_size.v = width(p) + 2 * page_top_offset;
+ pdf->page_size.v = width(p) + 2 * page_top_offset_par;
break;
default:
- pdf->page_size.v = height(p) + depth(p) + 2 * page_top_offset;
+ pdf->page_size.v = height(p) + depth(p) + 2 * page_top_offset_par;
normal_warning("pdf backend","bad page direction, assuming TLT, case 2");
}
}
@@ -193,27 +179,27 @@ void ship_out(PDF pdf, halfword p, shipping_mode_e shipping_mode)
Then shift |refpoint.pos| of the DVI origin depending on the
|page_direction| within the upright (TLT) page coordinate system
*/
- switch (page_direction) {
+ switch (page_direction_par) {
case dir_TLT:
case dir_LTL:
- refpoint.pos.h += h_offset;
- refpoint.pos.v -= v_offset;
+ refpoint.pos.h += h_offset_par;
+ refpoint.pos.v -= v_offset_par;
break;
case dir_TRT:
case dir_RTT:
- refpoint.pos.h += pdf->page_size.h - page_right_offset - one_true_inch;
- refpoint.pos.v -= v_offset;
+ refpoint.pos.h += pdf->page_size.h - page_right_offset_par - one_true_inch;
+ refpoint.pos.v -= v_offset_par;
break;
default:
- refpoint.pos.h += h_offset;
- refpoint.pos.v -= v_offset;
+ refpoint.pos.h += h_offset_par;
+ refpoint.pos.v -= v_offset_par;
normal_warning("pdf backend","bad page direction, assuming TLT, case 3");
}
/*
Then switch to page box coordinate system; do |height(p)| movement,
to get the location of the box origin.
*/
- pdf->posstruct->dir = page_direction;
+ pdf->posstruct->dir = page_direction_par;
cur.h = 0;
cur.v = height(p);
synch_pos_with_cur(pdf->posstruct, &refpoint, cur);
@@ -297,13 +283,13 @@ void ship_out(PDF pdf, halfword p, shipping_mode_e shipping_mode)
normal_error("pdf backend", "unknown output mode");
}
DONE:
- if ((tracing_output <= 0) && (post_callback_id == 0) && shipping_mode == SHIPPING_PAGE) {
+ if ((tracing_output_par <= 0) && (post_callback_id == 0) && shipping_mode == SHIPPING_PAGE) {
print_char(']');
update_terminal();
}
dead_cycles = 0;
/* Flush the box from memory, showing statistics if requested */
- if ((tracing_stats > 1) && (pre_callback_id == 0)) {
+ if ((tracing_stats_par > 1) && (pre_callback_id == 0)) {
tprint_nl("Memory usage before: ");
print_int(var_used);
print_char('&');
@@ -311,7 +297,7 @@ void ship_out(PDF pdf, halfword p, shipping_mode_e shipping_mode)
print_char(';');
}
flush_node_list(p);
- if ((tracing_stats > 1) && (post_callback_id == 0)) {
+ if ((tracing_stats_par > 1) && (post_callback_id == 0)) {
tprint(" after: ");
print_int(var_used);
print_char('&');
@@ -321,7 +307,7 @@ void ship_out(PDF pdf, halfword p, shipping_mode_e shipping_mode)
if (shipping_mode == SHIPPING_PAGE && (post_callback_id > 0))
(void) run_callback(post_callback_id, "->");
/* Finish sheet {\sl Sync\TeX} information record */
- if (int_par(synctex_code))
+ if (synctex_par)
synctexteehs();
global_shipping_mode = NOT_SHIPPING;
}
diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdftables.h b/Build/source/texk/web2c/luatexdir/pdf/pdftables.h
index 47dee7c6949..d36f6e611a9 100644
--- a/Build/source/texk/web2c/luatexdir/pdf/pdftables.h
+++ b/Build/source/texk/web2c/luatexdir/pdf/pdftables.h
@@ -99,6 +99,10 @@ depending on the object type; however it may be used as a counter as well.
# define inf_pk_dpi 72 /* min PK pixel density value from \.{texmf.cnf} */
# define sup_pk_dpi 8000 /* max PK pixel density value from \.{texmf.cnf} */
+# define pdf2double(a) ((double) (a).m / ten_pow[(a).e])
+
+# define by_one_bp ((double) 65536 * (double) 72.27 / 72) /* number of sp per 1bp */
+
extern int find_obj(PDF pdf, int t, int i, boolean byname);
extern void check_obj_exists(PDF pdf, int objnum);
extern void check_obj_type(PDF pdf, int t, int objnum);
diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdfthread.w b/Build/source/texk/web2c/luatexdir/pdf/pdfthread.w
index b11e48c5fc0..6b3dd4b9432 100644
--- a/Build/source/texk/web2c/luatexdir/pdf/pdfthread.w
+++ b/Build/source/texk/web2c/luatexdir/pdf/pdfthread.w
@@ -21,10 +21,6 @@
#include "ptexlib.h"
-@ @c
-#define page_width dimen_par(page_width_code)
-#define page_height dimen_par(page_height_code)
-
@ Threads are handled in similar way as link annotations
@c
void append_bead(PDF pdf, halfword p)
@@ -168,8 +164,8 @@ void pdf_fix_thread(PDF pdf, int t)
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_add_bp(pdf, page_width_par);
+ pdf_add_bp(pdf, page_height_par);
pdf_end_array(pdf);
pdf_end_dict(pdf);
pdf_end_obj(pdf);
diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdfxform.h b/Build/source/texk/web2c/luatexdir/pdf/pdfxform.h
index f7f6e54d68f..64525d837ea 100644
--- a/Build/source/texk/web2c/luatexdir/pdf/pdfxform.h
+++ b/Build/source/texk/web2c/luatexdir/pdf/pdfxform.h
@@ -22,7 +22,7 @@
#ifndef PDFXFORM_H
# define PDFXFORM_H
-# define pdfmem_xform_size 8 /* size of memory in |pdf->mem| which |obj_data_ptr| holds */
+# define pdfmem_xform_size 9 /* size of memory in |pdf->mem| which |obj_data_ptr| holds */
# define obj_xform_width(pdf,A) pdf->mem[obj_data_ptr(pdf,A) + 0]
# define obj_xform_height(pdf,A) pdf->mem[obj_data_ptr(pdf,A) + 1]
@@ -32,6 +32,7 @@
# define obj_xform_resources(pdf,A) pdf->mem[obj_data_ptr(pdf,A) + 5] /* additional xform Resources */
# define obj_xform_attr_str(pdf,A) pdf->mem[obj_data_ptr(pdf,A) + 6]
# define obj_xform_resources_str(pdf,A) pdf->mem[obj_data_ptr(pdf,A) + 7]
+# define obj_xform_type(pdf,A) pdf->mem[obj_data_ptr(pdf,A) + 8]
# define set_pdf_xform_objnum(A,B) pdf_xform_objnum(A)=B
# define set_obj_xform_width(pdf,A,B) obj_xform_width(pdf,A)=B
@@ -42,6 +43,7 @@
# define set_obj_xform_resources(pdf,A,B) obj_xform_resources(pdf,A)=B
# define set_obj_xform_attr_str(pdf,A,B) obj_xform_attr_str(pdf,A)=B
# define set_obj_xform_resources_str(pdf,A,B) obj_xform_resources_str(pdf,A)=B
+# define set_obj_xform_type(pdf,A,B) obj_xform_type(pdf,A)=B
extern int pdf_cur_form; /* the form being output */
diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdfxform.w b/Build/source/texk/web2c/luatexdir/pdf/pdfxform.w
index 962acb0f031..4c83b024939 100644
--- a/Build/source/texk/web2c/luatexdir/pdf/pdfxform.w
+++ b/Build/source/texk/web2c/luatexdir/pdf/pdfxform.w
@@ -22,8 +22,6 @@
#include "pdf/pdfpage.h"
@ @c
-#define box(A) eqtb[box_base+(A)].hh.rh
-
int pdf_cur_form; /* the form being output */
void pdf_place_form(PDF pdf, halfword p)
@@ -72,6 +70,12 @@ void scan_pdfxform(PDF pdf)
pdf->xform_count++;
k = pdf_create_obj(pdf, obj_type_xform, pdf->xform_count);
set_obj_data_ptr(pdf, k, pdf_get_mem(pdf, pdfmem_xform_size));
+ if (scan_keyword("type")) {
+ scan_int();
+ set_obj_xform_type(pdf, k, cur_val);
+ } else {
+ set_obj_xform_type(pdf, k, 0);
+ }
if (scan_keyword("attr")) {
scan_toks(false, true);
set_obj_xform_attr(pdf, k, def_ref);
@@ -99,8 +103,6 @@ void scan_pdfxform(PDF pdf)
}
@ @c
-#define tail cur_list.tail_field
-
void scan_pdfrefxform(PDF pdf)
{
scaled_whd alt_rule, dim, nat;
@@ -116,8 +118,8 @@ void scan_pdfrefxform(PDF pdf)
} else {
dim = nat;
}
- width(tail) = dim.wd;
- height(tail) = dim.ht;
- depth(tail) = dim.dp;
- rule_index(tail) = cur_val;
+ width(tail_par) = dim.wd;
+ height(tail_par) = dim.ht;
+ depth(tail_par) = dim.dp;
+ rule_index(tail_par) = cur_val;
}