diff options
Diffstat (limited to 'Build/source/texk/web2c')
17 files changed, 256 insertions, 135 deletions
diff --git a/Build/source/texk/web2c/luatexdir/NEWS b/Build/source/texk/web2c/luatexdir/NEWS index c96a8f3ea9f..47f8bc4c783 100644 --- a/Build/source/texk/web2c/luatexdir/NEWS +++ b/Build/source/texk/web2c/luatexdir/NEWS @@ -2,6 +2,20 @@ This file is in the public domain. ============================================================== +LuaTeX Release 0.90.0 was released 2016032512 +============================================================== + +This is the version that will go on TeX Live 2016 + +- mostly small bug fixes +- a few setters/getters added to the pdf namespace (were in the tex one before) +- a few patches to the lua interface macros +- a bit more control over protrusion edges +- no fundamental changes + + + +============================================================== Luatex Release 0.89.4 was released 2016031100 ============================================================== @@ -2675,7 +2689,7 @@ Other news: we probably introduced new problems as well). * Most (all?) files now have a corrected Copyright header, - and link in $Id: NEWS 5840 2016-03-11 10:30:17Z luigi $ and $URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/NEWS $ into the object file. + and link in $Id: NEWS 5886 2016-03-25 12:13:10Z luigi $ and $URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/NEWS $ into the object file. * Some unnecessary files were removed from the distribution. diff --git a/Build/source/texk/web2c/luatexdir/font/writet1.w b/Build/source/texk/web2c/luatexdir/font/writet1.w index 5288b785f37..958adfbb0db 100644 --- a/Build/source/texk/web2c/luatexdir/font/writet1.w +++ b/Build/source/texk/web2c/luatexdir/font/writet1.w @@ -757,7 +757,7 @@ static char **t1_builtin_enc(void) for (i = 0; i < 256; i++) glyph_names[i] = (char *) notdef; if (t1_suffix("def")) { /* predefined encoding */ - sscanf(t1_line_array + strlen("/Encoding"), "%256s", t1_buf_array); + sscanf(t1_line_array + strlen("/Encoding"), "%255s", t1_buf_array); if (strcmp(t1_buf_array, "StandardEncoding") == 0) { t1_encoding = ENC_STANDARD; for (i = 0; i < 256; i++) { @@ -822,7 +822,7 @@ static char **t1_builtin_enc(void) /* check for \.{dup <index> <glyph> put} */ - if (sscanf(p, "dup %i%256s put", &i, t1_buf_array) == 2 && + if (sscanf(p, "dup %i%255s put", &i, t1_buf_array) == 2 && *t1_buf_array == '/' && valid_code(i)) { if (strcmp(t1_buf_array + 1, notdef) != 0) glyph_names[i] = xstrdup(t1_buf_array + 1); diff --git a/Build/source/texk/web2c/luatexdir/image/epdf.h b/Build/source/texk/web2c/luatexdir/image/epdf.h index 3d4751c4587..57bb2e39ae9 100644 --- a/Build/source/texk/web2c/luatexdir/image/epdf.h +++ b/Build/source/texk/web2c/luatexdir/image/epdf.h @@ -123,7 +123,7 @@ extern "C" { /* pdftoepdf.cc */ extern void read_pdf_info(image_dict *); extern void flush_pdf_info(image_dict *); - extern void write_epdf(PDF, image_dict *); + extern void write_epdf(PDF, image_dict *, int suppress_optional_info); extern void unrefPdfDocument(char *); extern void unrefMemStreamPdfDocument(char *); extern void epdf_free(void); diff --git a/Build/source/texk/web2c/luatexdir/image/pdftoepdf.h b/Build/source/texk/web2c/luatexdir/image/pdftoepdf.h index 12d15121017..0a8ef942c0e 100644 --- a/Build/source/texk/web2c/luatexdir/image/pdftoepdf.h +++ b/Build/source/texk/web2c/luatexdir/image/pdftoepdf.h @@ -29,7 +29,7 @@ void flush_pdf_info(image_dict *); /* flush_pdfstream_info(image_dict *); */ /* somehow doesn't work due to xfree macro */ void unrefPdfDocument(char *); void unrefMemStreamPdfDocument(char *); -void write_epdf(PDF, image_dict *); +void write_epdf(PDF, image_dict *, int suppress_optional_info); void epdf_check_mem(void); void copyReal(PDF pdf, double d); diff --git a/Build/source/texk/web2c/luatexdir/image/pdftoepdf.w b/Build/source/texk/web2c/luatexdir/image/pdftoepdf.w index b9d496ac9f0..d86504f82bc 100644 --- a/Build/source/texk/web2c/luatexdir/image/pdftoepdf.w +++ b/Build/source/texk/web2c/luatexdir/image/pdftoepdf.w @@ -707,7 +707,7 @@ void read_pdf_info(image_dict * idict) that can happen during PDF inclusion will arise here. */ -void write_epdf(PDF pdf, image_dict * idict) +void write_epdf(PDF pdf, image_dict * idict, int suppress_optional_info) { PdfDocument *pdf_doc = NULL; PDFDoc *doc = NULL; @@ -719,7 +719,7 @@ void write_epdf(PDF pdf, image_dict * idict) PDFRectangle *pagebox; int i, l; double bbox[4]; - char s[256]; + /* char s[256]; */ const char *pagedictkeys[] = { "Group", "LastModified", "Metadata", "PieceInfo", "Resources", "SeparationInfo", NULL }; @@ -743,20 +743,23 @@ void write_epdf(PDF pdf, image_dict * idict) pdf_begin_dict(pdf); pdf_dict_add_name(pdf, "Type", "XObject"); pdf_dict_add_name(pdf, "Subtype", "Form"); - if (img_attr(idict) != NULL && strlen(img_attr(idict)) > 0) + if (img_attr(idict) != NULL && strlen(img_attr(idict)) > 0) { pdf_printf(pdf, "\n%s\n", img_attr(idict)); + } pdf_dict_add_int(pdf, "FormType", 1); /* write additional information */ pdf_dict_add_img_filename(pdf, idict); - snprintf(s, 30, "%s.PageNumber", pdfkeyprefix); - pdf_dict_add_int(pdf, s, (int) img_pagenum(idict)); - doc->getDocInfoNF(&obj1); - if (obj1.isRef()) { - /* the info dict must be indirect (PDF Ref p. 61) */ - snprintf(s, 30, "%s.InfoDict", pdfkeyprefix); - pdf_dict_add_ref(pdf, s, addInObj(pdf, pdf_doc, obj1.getRef())); + if ((suppress_optional_info & 4) == 0) { + pdf_dict_add_int(pdf, "PTEX.PageNumber", (int) img_pagenum(idict)); + } + if ((suppress_optional_info & 8) == 0) { + doc->getDocInfoNF(&obj1); + if (obj1.isRef()) { + /* the info dict must be indirect (PDF Ref p. 61) */ + pdf_dict_add_ref(pdf, "PTEX.InfoDict", addInObj(pdf, pdf_doc, obj1.getRef())); + } + obj1.free(); } - obj1.free(); if (img_is_bbox(idict)) { bbox[0] = sp2bp(img_bbox(idict)[0]); bbox[1] = sp2bp(img_bbox(idict)[1]); diff --git a/Build/source/texk/web2c/luatexdir/image/writeimg.w b/Build/source/texk/web2c/luatexdir/image/writeimg.w index 7407d228a0f..f8e035f549d 100644 --- a/Build/source/texk/web2c/luatexdir/image/writeimg.w +++ b/Build/source/texk/web2c/luatexdir/image/writeimg.w @@ -589,7 +589,7 @@ void write_img(PDF pdf, image_dict * idict) break; case IMG_TYPE_PDFMEMSTREAM: case IMG_TYPE_PDF: - write_epdf(pdf, idict); + write_epdf(pdf, idict,(int) pdf_suppress_optional_info); break; case IMG_TYPE_PDFSTREAM: write_pdfstream(pdf, idict); @@ -666,8 +666,8 @@ void idict_to_array(image_dict * idict) void pdf_dict_add_img_filename(PDF pdf, image_dict * idict) { - char s[21], *p; - if (pdf_image_addfilename>0) { + char *p; + if ((pdf_image_addfilename > 0) && ((pdf_suppress_optional_info & 2) == 0)) { /* for now PTEX.FileName only for PDF, but prepared for JPG, PNG, ... */ if (! ( (img_type(idict) == IMG_TYPE_PDF) || (img_type(idict) == IMG_TYPE_PDFMEMSTREAM) )) return; @@ -682,8 +682,7 @@ void pdf_dict_add_img_filename(PDF pdf, image_dict * idict) p = img_filepath(idict); } // write additional information - snprintf(s, 20, "%s.FileName", pdfkeyprefix); - pdf_add_name(pdf, s); + pdf_add_name(pdf, "PTEX.FileName"); pdf_printf(pdf, " (%s)", convertStringToPDFString(p, strlen(p))); } } diff --git a/Build/source/texk/web2c/luatexdir/lua/lnodelib.c b/Build/source/texk/web2c/luatexdir/lua/lnodelib.c index d9a5569fc38..a5112385195 100644 --- a/Build/source/texk/web2c/luatexdir/lua/lnodelib.c +++ b/Build/source/texk/web2c/luatexdir/lua/lnodelib.c @@ -1932,7 +1932,9 @@ static int lua_nodelib_is_char(lua_State * L) { halfword n = *(check_isnode(L, 1)); if (type(n) != glyph_node) { - lua_pushnil(L); /* no glyph at all */ + lua_pushnil(L); /* no glyph at all */ + lua_pushinteger(L,type(n)); /* can save a lookup call */ + return 2; } else if (subtype(n) >= 256) { lua_pushboolean(L,0); /* a done glyph */ } else if (lua_type(L,2) == LUA_TNUMBER) { @@ -1948,6 +1950,19 @@ static int lua_nodelib_is_char(lua_State * L) return 1; } +static int lua_nodelib_is_glyph(lua_State * L) +{ + halfword n = *(check_isnode(L, 1)); + if (type(n) != glyph_node) { + lua_pushboolean(L,0); + lua_pushinteger(L,type(n)); + } else { + lua_pushinteger(L,character(n)); + lua_pushinteger(L,font(n)); + } + return 2; +} + /* node.direct.has_field */ static int lua_nodelib_direct_has_field(lua_State * L) @@ -5847,6 +5862,8 @@ static int lua_nodelib_direct_is_char(lua_State * L) halfword n = lua_tointeger(L, 1); if (type(n) != glyph_node) { lua_pushnil(L); /* no glyph at all */ + lua_pushinteger(L,type(n)); /* can save a lookup call */ + return 2; } else if (subtype(n) >= 256) { lua_pushboolean(L,0); /* a done glyph */ } else if (lua_type(L,2) == LUA_TNUMBER) { @@ -5862,6 +5879,19 @@ static int lua_nodelib_direct_is_char(lua_State * L) return 1; } +static int lua_nodelib_direct_is_glyph(lua_State * L) +{ + halfword n = lua_tointeger(L, 1); + if (type(n) != glyph_node) { + lua_pushboolean(L,0); + lua_pushinteger(L,type(n)); + } else { + lua_pushinteger(L,character(n)); + lua_pushinteger(L,font(n)); + } + return 2; +} + static int lua_nodelib_direct_setdiscretionary(lua_State * L) { halfword n = lua_tointeger(L, 1); @@ -6752,6 +6782,7 @@ static const struct luaL_Reg direct_nodelib_f[] = { {"get_attribute", lua_nodelib_direct_get_attribute}, {"has_field", lua_nodelib_direct_has_field}, {"is_char", lua_nodelib_direct_is_char}, + {"is_glyph", lua_nodelib_direct_is_glyph}, {"hpack", lua_nodelib_direct_hpack}, /* {"id", lua_nodelib_id}, */ /* no node argument */ {"insert_after", lua_nodelib_direct_insert_after}, @@ -6842,6 +6873,7 @@ static const struct luaL_Reg nodelib_f[] = { {"get_attribute", lua_nodelib_get_attribute}, {"has_field", lua_nodelib_has_field}, {"is_char", lua_nodelib_is_char}, + {"is_glyph", lua_nodelib_is_glyph}, {"hpack", lua_nodelib_hpack}, {"id", lua_nodelib_id}, {"insert_after", lua_nodelib_insert_after}, diff --git a/Build/source/texk/web2c/luatexdir/lua/lpdflib.c b/Build/source/texk/web2c/luatexdir/lua/lpdflib.c index 29bfba6baf3..7991f234f0e 100644 --- a/Build/source/texk/web2c/luatexdir/lua/lpdflib.c +++ b/Build/source/texk/web2c/luatexdir/lua/lpdflib.c @@ -506,6 +506,23 @@ static int l_registerannot(lua_State * L) return 0; } +/* + +# define valid_pdf_key ( \ + lua_key_eq(s,pageresources) \ + lua_key_eq(s,pageattributes) || \ + lua_key_eq(s,pagesattributes) || \ + lua_key_eq(s,catalog) || \ + lua_key_eq(s,info) || \ + lua_key_eq(s,names) || \ + lua_key_eq(s,trailer) || \ + lua_key_eq(s,xformresources) || \ + lua_key_eq(s,xformattributes) || \ + lua_key_eq(s,trailerid) \ +) + +*/ + #define l_get_pdf_value(key) \ lua_get_metatablelua(pdf_data); \ lua_key_rawgeti(key); \ @@ -520,20 +537,12 @@ static int l_get_names (lua_State * L) { l_get_pdf_value(names); } static int l_get_trailer (lua_State * L) { l_get_pdf_value(trailer); } static int l_get_xformresources (lua_State * L) { l_get_pdf_value(xformresources); } static int l_get_xformattributes(lua_State * L) { l_get_pdf_value(xformattributes); } +static int l_get_trailerid (lua_State * L) { l_get_pdf_value(trailerid); } -# define valid_pdf_key ( \ - lua_key_eq(s,catalog) || \ - lua_key_eq(s,info) || \ - lua_key_eq(s,trailer) || \ - lua_key_eq(s,names) || \ - lua_key_eq(s,pageattributes) || \ - lua_key_eq(s,pagesattributes) || \ - lua_key_eq(s,pageresources) \ -) +/* static int getpdf(lua_State * L) { - /* [pdf table] [key] */ const char *s ; if (lua_gettop(L) != 2) { return 0; @@ -548,15 +557,14 @@ static int getpdf(lua_State * L) return 1; } else if (valid_pdf_key) { lua_get_metatablelua(pdf_data); - /* [pdf table] [key] [pdf.data table] */ lua_replace(L, -3); - /* [pdf.data table] [key] */ lua_rawget(L, -2); return 1; } } return 0; } +*/ #define l_set_pdf_value(key) \ if (lua_type(L,-1) == LUA_TSTRING) { \ @@ -576,10 +584,12 @@ static int l_set_names (lua_State * L) { l_set_pdf_value(names); } static int l_set_trailer (lua_State * L) { l_set_pdf_value(trailer); } static int l_set_xformresources (lua_State * L) { l_set_pdf_value(xformresources); } static int l_set_xformattributes(lua_State * L) { l_set_pdf_value(xformattributes); } +static int l_set_trailerid (lua_State * L) { l_set_pdf_value(trailerid); } + +/* static int setpdf(lua_State * L) { - /* [pdf table] [key] [value] */ const char *s ; if (lua_gettop(L) != 3) { return 0; @@ -588,15 +598,15 @@ static int setpdf(lua_State * L) s = lua_tostring(L, -1); if (valid_pdf_key) { lua_get_metatablelua(pdf_data); - /* [pdf table] [key] [value] [pdf.data table] */ lua_replace(L, -4); - /* [pdf.data table] [key] [value] */ } } lua_rawset(L, -3); return 0; } +*/ + static int l_objtype(lua_State * L) { int n = lua_gettop(L); @@ -1008,6 +1018,18 @@ static int getpdfignoreunknownimages(lua_State * L) { return 1; } + static int l_set_suppress_optional_info(lua_State * L) { + if (lua_type(L, 1) == LUA_TNUMBER) { + set_tex_extension_count_register(c_pdf_suppress_optional_info,lua_tointeger(L, 1)); + } + return 0; +} + +static int l_get_suppress_optional_info(lua_State * L) { + lua_pushinteger(L,get_tex_extension_count_register(c_pdf_suppress_optional_info)); + return 1; +} + static int newpdfcolorstack(lua_State * L) { const char *s = NULL; @@ -1064,6 +1086,7 @@ static const struct luaL_Reg pdflib[] = { { "setpagesattributes", l_set_pagesattributes }, { "setxformresources", l_set_xformresources }, { "setxformattributes", l_set_xformattributes }, + { "settrailerid", l_set_trailerid }, { "getcatalog", l_get_catalog }, { "getinfo", l_get_info }, { "getnames", l_get_names }, @@ -1073,6 +1096,7 @@ static const struct luaL_Reg pdflib[] = { { "getpagesattributes", l_get_pagesattributes }, { "getxformresources", l_get_xformresources }, { "getxformattributes", l_get_xformattributes }, + { "gettrailerid", l_get_trailerid }, { "getlastlink", l_get_lastlink }, { "getretval", l_get_retval }, { "getlastobj", l_get_lastobj }, @@ -1085,6 +1109,8 @@ static const struct luaL_Reg pdflib[] = { { "setdecimaldigits", l_set_decimal_digits }, { "getpkresolution", l_get_pk_resolution }, { "setpkresolution", l_set_pk_resolution }, + { "getsuppressoptionalinfo", l_get_suppress_optional_info }, + { "setsuppressoptionalinfo", l_set_suppress_optional_info }, /* moved from tex table */ { "fontname", getpdffontname }, { "fontobjnum", getpdffontobjnum }, @@ -1121,15 +1147,15 @@ int luaopen_pdf(lua_State * L) lua_settable(L,LUA_REGISTRYINDEX); /* */ luaL_register(L, "pdf", pdflib); - /* build meta table */ + /* luaL_newmetatable(L, "pdf.meta"); lua_pushstring(L, "__index"); lua_pushcfunction(L, getpdf); - /* do these later, NYI */ lua_settable(L, -3); lua_pushstring(L, "__newindex"); lua_pushcfunction(L, setpdf); lua_settable(L, -3); - lua_setmetatable(L, -2); /* meta to itself */ + lua_setmetatable(L, -2); + */ return 1; } diff --git a/Build/source/texk/web2c/luatexdir/lua/luatex-api.h b/Build/source/texk/web2c/luatexdir/lua/luatex-api.h index 163d5577410..8802253c199 100644 --- a/Build/source/texk/web2c/luatexdir/lua/luatex-api.h +++ b/Build/source/texk/web2c/luatexdir/lua/luatex-api.h @@ -794,6 +794,7 @@ make_lua_key(top_right);\ make_lua_key(tounicode);\ make_lua_key(tracingparagraphs);\ make_lua_key(trailer);\ +make_lua_key(trailerid);\ make_lua_key(transform);\ make_lua_key(trim);\ make_lua_key(type);\ @@ -1148,6 +1149,7 @@ init_lua_key(top_right);\ init_lua_key(tounicode);\ init_lua_key(tracingparagraphs);\ init_lua_key(trailer);\ +init_lua_key(trailerid);\ init_lua_key(transform);\ init_lua_key(trim);\ init_lua_key(type);\ @@ -1570,6 +1572,7 @@ use_lua_key(top_right); use_lua_key(tounicode); use_lua_key(tracingparagraphs); use_lua_key(trailer); +use_lua_key(trailerid); use_lua_key(transform); use_lua_key(trim); use_lua_key(type); diff --git a/Build/source/texk/web2c/luatexdir/luatex.c b/Build/source/texk/web2c/luatexdir/luatex.c index 2140d4c96a0..522c24dee7c 100644 --- a/Build/source/texk/web2c/luatexdir/luatex.c +++ b/Build/source/texk/web2c/luatexdir/luatex.c @@ -28,10 +28,10 @@ #define TeX -int luatex_version = 89; /* \.{\\luatexversion} */ -int luatex_revision = '5'; /* \.{\\luatexrevision} */ -int luatex_date_info = 2016031115; /* the compile date is now hardwired */ -const char *luatex_version_string = "beta-0.89.5"; +int luatex_version = 90; /* \.{\\luatexversion} */ +int luatex_revision = '0'; /* \.{\\luatexrevision} */ +int luatex_date_info = 2016032512; /* the compile date is now hardwired */ +const char *luatex_version_string = "beta-0.90.0"; const char *engine_name = my_name; /* the name of this engine */ #include <kpathsea/c-ctype.h> diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdfgen.w b/Build/source/texk/web2c/luatexdir/pdf/pdfgen.w index 5882d0b6f72..c5db4c71413 100644 --- a/Build/source/texk/web2c/luatexdir/pdf/pdfgen.w +++ b/Build/source/texk/web2c/luatexdir/pdf/pdfgen.w @@ -1425,48 +1425,60 @@ and that they should be reasonably unique. Since it's difficult to get the file size at this point in the execution of pdfTeX and scanning the info dict is also difficult, we start with a simpler implementation using just the first two items. + @c static void print_ID(PDF pdf) { - time_t t; - size_t size; - char time_str[32]; - md5_state_t state; - md5_byte_t digest[16]; - char id[64]; - char pwd[4096]; - /* start md5 */ - md5_init(&state); - /* get the time */ - t = time(NULL); - 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 */ - if (getcwd(pwd, sizeof(pwd)) == NULL) - formatted_error("pdf backend","getcwd() failed (%s), (path too long?)", strerror(errno)); + if ((pdf_suppress_optional_info & 512) == 0) { + if (pdf_trailer_id != 0) { + char *s = NULL; + int len; + s = tokenlist_to_cstring(pdf_trailer_id, true, &len); + /* this had better be an array! sp maybe we need to check for [] and error otherwise */ + pdf_add_name(pdf, "ID"); + pdf_out_block(pdf,s,len); + } else { + time_t t; + size_t size; + char time_str[32]; + md5_state_t state; + md5_byte_t digest[16]; + char id[64]; + char pwd[4096]; + /* start md5 */ + md5_init(&state); + /* get the time */ + t = time(NULL); + 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 */ + if (getcwd(pwd, sizeof(pwd)) == NULL) { + formatted_error("pdf backend","getcwd() failed (%s), (path too long?)", strerror(errno)); + } #ifdef WIN32 - { - char *p; - for (p = pwd; *p; p++) { - if (*p == '\\') - *p = '/'; - else if (IS_KANJI(p)) - p++; + { + char *p; + for (p = pwd; *p; p++) { + if (*p == '\\') + *p = '/'; + else if (IS_KANJI(p)) + p++; + } + } +#endif + md5_append(&state, (const md5_byte_t *) pwd, (int) strlen(pwd)); + md5_append(&state, (const md5_byte_t *) "/", 1); + md5_append(&state, (const md5_byte_t *) pdf->file_name, (int) strlen(pdf->file_name)); + /* finish md5 */ + md5_finish(&state, digest); + /* write the IDs */ + convertStringToHexString((char *) digest, id, 16); + pdf_add_name(pdf, "ID"); + pdf_begin_array(pdf); + pdf_printf(pdf, "<%s> <%s>", id, id); + pdf_end_array(pdf); } } -#endif - md5_append(&state, (const md5_byte_t *) pwd, (int) strlen(pwd)); - md5_append(&state, (const md5_byte_t *) "/", 1); - md5_append(&state, (const md5_byte_t *) pdf->file_name, - (int) strlen(pdf->file_name)); - /* finish md5 */ - md5_finish(&state, digest); - /* write the IDs */ - convertStringToHexString((char *) digest, id, 16); - pdf_add_name(pdf, "ID"); - pdf_begin_array(pdf); - pdf_printf(pdf, "<%s> <%s>", id, id); - pdf_end_array(pdf); } @ Print the /CreationDate entry. @@ -2155,8 +2167,7 @@ static int pdf_print_info(PDF pdf, int luatexversion, pdf_puts(pdf, p); /* no free, pointer */ pdf_out(pdf, '\n'); } - if (!producer_given) { - /* Print the Producer key */ + if ((pdf_suppress_optional_info & 128) == 0 && !producer_given) { pdf_add_name(pdf, "Producer"); pdf_puts(pdf, " (LuaTeX-"); pdf_print_int(pdf, luatexversion / 100); @@ -2166,20 +2177,23 @@ static int pdf_print_info(PDF pdf, int luatexversion, pdf_print(pdf, luatexrevision); pdf_out(pdf, ')'); } - if (!creator_given) + if ((pdf_suppress_optional_info & 16) == 0 && !creator_given) { pdf_dict_add_string(pdf, "Creator", "TeX"); - if (!creationdate_given) { + } + if ((pdf_suppress_optional_info & 32) == 0 && !creationdate_given) { init_start_time(pdf); pdf_dict_add_string(pdf, "CreationDate", pdf->start_time_str); } - if (!moddate_given) { + if ((pdf_suppress_optional_info & 64) == 0 && !moddate_given) { init_start_time(pdf); pdf_dict_add_string(pdf, "ModDate", pdf->start_time_str); } - if (!trapped_given) { + if ((pdf_suppress_optional_info & 256) == 0 && !trapped_given) { pdf_dict_add_name(pdf, "Trapped", "False"); } - pdf_dict_add_string(pdf, "PTEX.Fullbanner", luatex_banner); + if ((pdf_suppress_optional_info & 1) == 0) { + pdf_dict_add_string(pdf, "PTEX.FullBanner", luatex_banner); + } pdf_end_dict(pdf); pdf_end_obj(pdf); return k; diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdftables.h b/Build/source/texk/web2c/luatexdir/pdf/pdftables.h index ee1d1832103..f185ab5c11e 100644 --- a/Build/source/texk/web2c/luatexdir/pdf/pdftables.h +++ b/Build/source/texk/web2c/luatexdir/pdf/pdftables.h @@ -132,6 +132,7 @@ typedef enum { c_pdf_inclusion_copy_font, c_pdf_gen_tounicode, c_pdf_pk_fixed_dpi, + c_pdf_suppress_optional_info, } pdf_backend_counters ; typedef enum { @@ -150,6 +151,7 @@ typedef enum { t_pdf_xform_attr, t_pdf_xform_resources, t_pdf_pk_mode, + t_pdf_trailer_id, } pdf_backend_tokenlists ; extern int pdf_last_annot; @@ -175,6 +177,7 @@ extern int pdf_retval; # define pdf_inclusion_copy_font get_tex_extension_count_register(c_pdf_inclusion_copy_font) # define pdf_gen_tounicode get_tex_extension_count_register(c_pdf_gen_tounicode) # define pdf_pk_fixed_dpi get_tex_extension_count_register(c_pdf_pk_fixed_dpi) +# define pdf_suppress_optional_info get_tex_extension_count_register(c_pdf_suppress_optional_info) # define pdf_h_origin get_tex_extension_dimen_register(d_pdf_h_origin) # define pdf_v_origin get_tex_extension_dimen_register(d_pdf_v_origin) @@ -189,6 +192,7 @@ extern int pdf_retval; # define pdf_xform_attr get_tex_extension_toks_register(t_pdf_xform_attr) # define pdf_xform_resources get_tex_extension_toks_register(t_pdf_xform_resources) # define pdf_pk_mode get_tex_extension_toks_register(t_pdf_pk_mode) +# define pdf_trailer_id get_tex_extension_toks_register(t_pdf_trailer_id) # define set_pdf_minor_version(i) set_tex_extension_count_register(c_pdf_minor_version,i) # define set_pdf_compress_level(i) set_tex_extension_count_register(c_pdf_compress_level,i) diff --git a/Build/source/texk/web2c/luatexdir/tex/dumpdata.w b/Build/source/texk/web2c/luatexdir/tex/dumpdata.w index c2fba1934c7..ac4f96f2f0e 100644 --- a/Build/source/texk/web2c/luatexdir/tex/dumpdata.w +++ b/Build/source/texk/web2c/luatexdir/tex/dumpdata.w @@ -27,7 +27,7 @@ /* we start with 907: the sum of the values of the bytes of "don knuth" */ -#define FORMAT_ID (907+12) +#define FORMAT_ID (907+13) #if ((FORMAT_ID>=0) && (FORMAT_ID<=256)) #error Wrong value for FORMAT_ID. #endif diff --git a/Build/source/texk/web2c/luatexdir/tex/equivalents.h b/Build/source/texk/web2c/luatexdir/tex/equivalents.h index cc74fa829a1..ba4b4042859 100644 --- a/Build/source/texk/web2c/luatexdir/tex/equivalents.h +++ b/Build/source/texk/web2c/luatexdir/tex/equivalents.h @@ -287,9 +287,9 @@ the |number_regs| \.{\\dimen} registers. # define mathoption_int_last (int_base+99) # define backend_int_base (int_base+100) -# define backend_int_last (int_base+119) +# define backend_int_last (int_base+124) -# define tex_int_pars (120) /* total number of integer parameters */ +# define tex_int_pars (125) /* total number of integer parameters */ # define page_direction_code (tex_int_pars) # define body_direction_code (tex_int_pars+1) diff --git a/Build/source/texk/web2c/luatexdir/tex/linebreak.w b/Build/source/texk/web2c/luatexdir/tex/linebreak.w index 58afdb8e535..6560192da93 100644 --- a/Build/source/texk/web2c/luatexdir/tex/linebreak.w +++ b/Build/source/texk/web2c/luatexdir/tex/linebreak.w @@ -352,6 +352,10 @@ static boolean check_expand_pars(internal_font_number f) l = pop_node(); /* don't visit this node again */ run = false; } +if ((vlink(l) != null) && (type(l) == boundary_node) && ((subtype(l) == 1) || (subtype(l) == 3))) { + /* skip next node */ + l = vlink(l); +} if (vlink(l) != null) { l = vlink(l); } else if (hlist_stack_level == 0) { @@ -392,8 +396,11 @@ static boolean check_expand_pars(internal_font_number f) l = pop_node(); } if ((r != l) && (r != null)) { +if ((alink(r) != null) && (type(r) == boundary_node) && ((subtype(r) == 2) || (subtype(r) == 3))) { + /* skip next node */ + r = alink(r); +} if (alink(r) != null) { - assert(vlink(alink(r)) == r); r = alink(r); } else { /* this is the input: \.{\\leavevmode\\penalty-10000\\penalty-10000} (bug \#268) */ run = false; diff --git a/Build/source/texk/web2c/luatexdir/tex/scanning.w b/Build/source/texk/web2c/luatexdir/tex/scanning.w index 99e9ca5e893..90499e8b4e5 100644 --- a/Build/source/texk/web2c/luatexdir/tex/scanning.w +++ b/Build/source/texk/web2c/luatexdir/tex/scanning.w @@ -1477,13 +1477,11 @@ most of the work has already been done. @c void scan_glue(int level) -{ /* sets |cur_val| to a glue spec pointer */ - boolean negative; /* should the answer be negated? */ - halfword q; /* new glue specification */ - boolean mu; /* does |level=mu_val|? */ - mu = (level == mu_val_level); - /* Get the next non-blank non-sign... */ - negative = false; +{ + boolean negative = false; /* should the answer be negated? */ + halfword q = null; /* new glue specification */ + boolean mu = (level == mu_val_level); /* does |level=mu_val|? */ + /* Get the next non-blank non-sign ... */ do { /* Get the next non-blank non-call token */ do { @@ -1494,7 +1492,6 @@ void scan_glue(int level) cur_tok = other_token + '+'; } } while (cur_tok == other_token + '+'); - if ((cur_cmd >= min_internal_cmd) && (cur_cmd <= max_internal_cmd)) { scan_something_internal(level, negative); if (cur_val_level >= glue_val_level) { @@ -1512,20 +1509,40 @@ void scan_glue(int level) if (negative) negate(cur_val); } - /* Create a new glue specification whose width is |cur_val|; scan for its - stretch and shrink components */ - q = new_spec(zero_glue); - width(q) = cur_val; + /* + Create a new glue specification whose width is |cur_val|; scan for its + stretch and shrink components. + */ + /* + In several places there is a test for zero glue, for instance in protrusion + left/right node detection. In that case a \hskip\dimen<n> with the dimen being + zero will not be seen as zero glue. Therefore we delay the allocation of + glue till we know for sure that there are no fils involved. (!!) + */ + if (cur_val != 0) { /* !! new test */ + q = new_spec(zero_glue); + width(q) = cur_val; + } if (scan_keyword("plus")) { + if (q == null) { /* !! new test */ + q = new_spec(zero_glue); + } scan_dimen(mu, true, false); stretch(q) = cur_val; stretch_order(q) = (quarterword) cur_order; } if (scan_keyword("minus")) { + if (q == null) { /* !! new test */ + q = new_spec(zero_glue); + } scan_dimen(mu, true, false); shrink(q) = cur_val; shrink_order(q) = (quarterword) cur_order; } + if (q == null) { /* !! new test */ + q = zero_glue ; + add_glue_ref(zero_glue); + } cur_val = q; } diff --git a/Build/source/texk/web2c/luatexdir/tex/textoken.w b/Build/source/texk/web2c/luatexdir/tex/textoken.w index 9ac21635b3a..98889cced7c 100644 --- a/Build/source/texk/web2c/luatexdir/tex/textoken.w +++ b/Build/source/texk/web2c/luatexdir/tex/textoken.w @@ -2317,38 +2317,40 @@ static int do_variable_dvi(halfword c) static int do_variable_pdf(halfword c) { - if (scan_keyword("compresslevel")) { do_variable_backend_int(c_pdf_compress_level); } - else if (scan_keyword("decimaldigits")) { do_variable_backend_int(c_pdf_decimal_digits); } - else if (scan_keyword("imageresolution")) { do_variable_backend_int(c_pdf_image_resolution); } - else if (scan_keyword("pkresolution")) { do_variable_backend_int(c_pdf_pk_resolution); } - else if (scan_keyword("uniqueresname")) { do_variable_backend_int(c_pdf_unique_resname); } - else if (scan_keyword("minorversion")) { do_variable_backend_int(c_pdf_minor_version); } - else if (scan_keyword("pagebox")) { do_variable_backend_int(c_pdf_pagebox); } - else if (scan_keyword("inclusionerrorlevel")) { do_variable_backend_int(c_pdf_inclusion_errorlevel); } - else if (scan_keyword("ignoreunknownimages")) { do_variable_backend_int(c_pdf_ignore_unknown_images); } - else if (scan_keyword("gamma")) { do_variable_backend_int(c_pdf_gamma); } - else if (scan_keyword("imageapplygamma")) { do_variable_backend_int(c_pdf_image_apply_gamma); } - else if (scan_keyword("imagegamma")) { do_variable_backend_int(c_pdf_image_gamma); } - else if (scan_keyword("imagehicolor")) { do_variable_backend_int(c_pdf_image_hicolor); } - else if (scan_keyword("imageaddfilename")) { do_variable_backend_int(c_pdf_image_addfilename); } - else if (scan_keyword("objcompresslevel")) { do_variable_backend_int(c_pdf_objcompresslevel); } - else if (scan_keyword("inclusioncopyfonts")) { do_variable_backend_int(c_pdf_inclusion_copy_font); } - else if (scan_keyword("gentounicode")) { do_variable_backend_int(c_pdf_gen_tounicode); } - else if (scan_keyword("pkfixeddpi")) { do_variable_backend_int(c_pdf_pk_fixed_dpi); } - - else if (scan_keyword("horigin")) { do_variable_backend_dimen(d_pdf_h_origin); } - else if (scan_keyword("vorigin")) { do_variable_backend_dimen(d_pdf_v_origin); } - else if (scan_keyword("threadmargin")) { do_variable_backend_dimen(d_pdf_thread_margin); } - else if (scan_keyword("destmargin")) { do_variable_backend_dimen(d_pdf_dest_margin); } - else if (scan_keyword("linkmargin")) { do_variable_backend_dimen(d_pdf_link_margin); } - else if (scan_keyword("xformmargin")) { do_variable_backend_dimen(d_pdf_xform_margin); } - - else if (scan_keyword("pageattr")) { do_variable_backend_toks(t_pdf_page_attr); } - else if (scan_keyword("pageresources")) { do_variable_backend_toks(t_pdf_page_resources); } - else if (scan_keyword("pagesattr")) { do_variable_backend_toks(t_pdf_pages_attr); } - else if (scan_keyword("xformattr")) { do_variable_backend_toks(t_pdf_xform_attr); } - else if (scan_keyword("xformresources")) { do_variable_backend_toks(t_pdf_xform_resources); } - else if (scan_keyword("pkmode")) { do_variable_backend_toks(t_pdf_pk_mode); } + if (scan_keyword("compresslevel")) { do_variable_backend_int(c_pdf_compress_level); } + else if (scan_keyword("decimaldigits")) { do_variable_backend_int(c_pdf_decimal_digits); } + else if (scan_keyword("imageresolution")) { do_variable_backend_int(c_pdf_image_resolution); } + else if (scan_keyword("pkresolution")) { do_variable_backend_int(c_pdf_pk_resolution); } + else if (scan_keyword("uniqueresname")) { do_variable_backend_int(c_pdf_unique_resname); } + else if (scan_keyword("minorversion")) { do_variable_backend_int(c_pdf_minor_version); } + else if (scan_keyword("pagebox")) { do_variable_backend_int(c_pdf_pagebox); } + else if (scan_keyword("inclusionerrorlevel")) { do_variable_backend_int(c_pdf_inclusion_errorlevel); } + else if (scan_keyword("ignoreunknownimages")) { do_variable_backend_int(c_pdf_ignore_unknown_images); } + else if (scan_keyword("gamma")) { do_variable_backend_int(c_pdf_gamma); } + else if (scan_keyword("imageapplygamma")) { do_variable_backend_int(c_pdf_image_apply_gamma); } + else if (scan_keyword("imagegamma")) { do_variable_backend_int(c_pdf_image_gamma); } + else if (scan_keyword("imagehicolor")) { do_variable_backend_int(c_pdf_image_hicolor); } + else if (scan_keyword("imageaddfilename")) { do_variable_backend_int(c_pdf_image_addfilename); } + else if (scan_keyword("objcompresslevel")) { do_variable_backend_int(c_pdf_objcompresslevel); } + else if (scan_keyword("inclusioncopyfonts")) { do_variable_backend_int(c_pdf_inclusion_copy_font); } + else if (scan_keyword("gentounicode")) { do_variable_backend_int(c_pdf_gen_tounicode); } + else if (scan_keyword("pkfixeddpi")) { do_variable_backend_int(c_pdf_pk_fixed_dpi); } + else if (scan_keyword("suppressoptionalinfo")) { do_variable_backend_int(c_pdf_suppress_optional_info); } + + else if (scan_keyword("horigin")) { do_variable_backend_dimen(d_pdf_h_origin); } + else if (scan_keyword("vorigin")) { do_variable_backend_dimen(d_pdf_v_origin); } + else if (scan_keyword("threadmargin")) { do_variable_backend_dimen(d_pdf_thread_margin); } + else if (scan_keyword("destmargin")) { do_variable_backend_dimen(d_pdf_dest_margin); } + else if (scan_keyword("linkmargin")) { do_variable_backend_dimen(d_pdf_link_margin); } + else if (scan_keyword("xformmargin")) { do_variable_backend_dimen(d_pdf_xform_margin); } + + else if (scan_keyword("pageattr")) { do_variable_backend_toks(t_pdf_page_attr); } + else if (scan_keyword("pageresources")) { do_variable_backend_toks(t_pdf_page_resources); } + else if (scan_keyword("pagesattr")) { do_variable_backend_toks(t_pdf_pages_attr); } + else if (scan_keyword("xformattr")) { do_variable_backend_toks(t_pdf_xform_attr); } + else if (scan_keyword("xformresources")) { do_variable_backend_toks(t_pdf_xform_resources); } + else if (scan_keyword("pkmode")) { do_variable_backend_toks(t_pdf_pk_mode); } + else if (scan_keyword("trailerid")) { do_variable_backend_toks(t_pdf_trailer_id); } else return 0; |