diff options
author | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2016-09-10 09:52:59 +0000 |
---|---|---|
committer | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2016-09-10 09:52:59 +0000 |
commit | 7e17932009a54c6047241ce05f043b51cce32233 (patch) | |
tree | 7b6001c89a8bbf5dee032af1048892cf9ab20373 /Build | |
parent | 8072d653e5694112aadd35396317648fa019dc6e (diff) |
luatexdir: sync with the upstream
git-svn-id: svn://tug.org/texlive/trunk@42031 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build')
18 files changed, 328 insertions, 150 deletions
diff --git a/Build/source/texk/web2c/luatexdir/font/luafont.w b/Build/source/texk/web2c/luatexdir/font/luafont.w index 0b30b4df41a..baaaac4e9a6 100644 --- a/Build/source/texk/web2c/luatexdir/font/luafont.w +++ b/Build/source/texk/web2c/luatexdir/font/luafont.w @@ -103,6 +103,8 @@ const char *MATH_param_names[] = { "SubscriptShiftDownWithSuperscript", "FractionDelimiterSize", "FractionDelimiterDisplayStyleSize", + "NoLimitSubFactor", + "NoLimitSupFactor", NULL, }; diff --git a/Build/source/texk/web2c/luatexdir/font/texfont.h b/Build/source/texk/web2c/luatexdir/font/texfont.h index 3b2773109f2..f89512ecec7 100644 --- a/Build/source/texk/web2c/luatexdir/font/texfont.h +++ b/Build/source/texk/web2c/luatexdir/font/texfont.h @@ -139,7 +139,6 @@ typedef struct texfont { int _font_cache_id; /* internal information */ char _font_encodingbytes; /* 1 or 2 bytes */ boolean _font_oldmath; /* default to false when MathConstants seen */ - int _font_slant; /* a slant in ppt */ int _font_extend; /* an extension in ppt, or 1000 */ int font_max_shrink; @@ -230,114 +229,114 @@ extern const char *font_embedding_strings[]; boolean cmp_font_area(int, str_number); -# define font_reassign(a,b) { if (a!=NULL) free(a); a = b; } +# define font_reassign(a,b) { if (a!=NULL) free(a); a = b; } -# define font_filename(a) font_tables[a]->_font_filename -# define set_font_filename(f,b) font_reassign(font_filename(f),b) +# define font_filename(a) font_tables[a]->_font_filename +# define set_font_filename(f,b) font_reassign(font_filename(f),b) -# define font_fullname(a) font_tables[a]->_font_fullname -# define set_font_fullname(f,b) font_reassign(font_fullname(f),b) +# define font_fullname(a) font_tables[a]->_font_fullname +# define set_font_fullname(f,b) font_reassign(font_fullname(f),b) -# define font_psname(a) font_tables[a]->_font_psname -# define set_font_psname(f,b) font_reassign(font_psname(f),b) +# define font_psname(a) font_tables[a]->_font_psname +# define set_font_psname(f,b) font_reassign(font_psname(f),b) -# define font_encodingname(a) font_tables[a]->_font_encodingname -# define set_font_encodingname(f,b) font_reassign(font_encodingname(f),b) +# define font_encodingname(a) font_tables[a]->_font_encodingname +# define set_font_encodingname(f,b) font_reassign(font_encodingname(f),b) -# define cmp_font_filename(a,b) (!(font_filename(a)!=NULL || font_filename(b)!=NULL || \ - strcmp(font_filename(a),font_filename(b)))) -# define cmp_font_fullname(a,b) (!(font_fullname(a)!=NULL || font_fullname(b)!=NULL || \ - strcmp(font_fullname(a),font_fullname(b)))) -# define cmp_font_encodingname(a,b) (!(font_encoding(a)!=NULL || font_encodingname(b)!=NULL || \ - strcmp(font_encodingname(a),font_encodingname(b)))) +# define cmp_font_filename(a,b) (!(font_filename(a)!=NULL || font_filename(b)!=NULL || \ + strcmp(font_filename(a),font_filename(b)))) +# define cmp_font_fullname(a,b) (!(font_fullname(a)!=NULL || font_fullname(b)!=NULL || \ + strcmp(font_fullname(a),font_fullname(b)))) +# define cmp_font_encodingname(a,b) (!(font_encoding(a)!=NULL || font_encodingname(b)!=NULL || \ + strcmp(font_encodingname(a),font_encodingname(b)))) -# define font_bc(a) font_tables[a]->_font_bc -# define set_font_bc(f,b) font_bc(f) = b +# define font_bc(a) font_tables[a]->_font_bc +# define set_font_bc(f,b) font_bc(f) = b -# define font_ec(a) font_tables[a]->_font_ec -# define set_font_ec(f,b) font_ec(f) = b +# define font_ec(a) font_tables[a]->_font_ec +# define set_font_ec(f,b) font_ec(f) = b -# define font_used(a) (font_tables[a]!=NULL && font_tables[a]->_font_used) -# define set_font_used(a,b) font_tables[a]->_font_used = b +# define font_used(a) (font_tables[a]!=NULL && font_tables[a]->_font_used) +# define set_font_used(a,b) font_tables[a]->_font_used = b -# define font_touched(a) font_tables[a]->_font_touched -# define set_font_touched(a,b) font_touched(a) = b +# define font_touched(a) font_tables[a]->_font_touched +# define set_font_touched(a,b) font_touched(a) = b -# define font_type(a) font_tables[a]->_font_type -# define set_font_type(a,b) font_type(a) = b; +# define font_type(a) font_tables[a]->_font_type +# define set_font_type(a,b) font_type(a) = b; -# define font_format(a) font_tables[a]->_font_format -# define font_format_name(a) font_format_strings[font_tables[a]->_font_format] -# define set_font_format(a,b) font_format(a) = b +# define font_format(a) font_tables[a]->_font_format +# define font_format_name(a) font_format_strings[font_tables[a]->_font_format] +# define set_font_format(a,b) font_format(a) = b -# define font_embedding(a) font_tables[a]->_font_embedding -# define set_font_embedding(a,b) font_embedding(a) = b +# define font_embedding(a) font_tables[a]->_font_embedding +# define set_font_embedding(a,b) font_embedding(a) = b -# define font_cidversion(a) font_tables[a]->_font_cidversion -# define set_font_cidversion(a,b) font_cidversion(a) = b +# define font_cidversion(a) font_tables[a]->_font_cidversion +# define set_font_cidversion(a,b) font_cidversion(a) = b -# define font_cidsupplement(a) font_tables[a]->_font_cidsupplement -# define set_font_cidsupplement(a,b) font_cidsupplement(a) = b +# define font_cidsupplement(a) font_tables[a]->_font_cidsupplement +# define set_font_cidsupplement(a,b) font_cidsupplement(a) = b -# define font_cidordering(a) font_tables[a]->_font_cidordering -# define set_font_cidordering(f,b) font_reassign(font_cidordering(f),b) +# define font_cidordering(a) font_tables[a]->_font_cidordering +# define set_font_cidordering(f,b) font_reassign(font_cidordering(f),b) -# define font_cidregistry(a) font_tables[a]->_font_cidregistry -# define set_font_cidregistry(f,b) font_reassign(font_cidregistry(f),b) +# define font_cidregistry(a) font_tables[a]->_font_cidregistry +# define set_font_cidregistry(f,b) font_reassign(font_cidregistry(f),b) -# define font_map(a) font_tables[a]->_font_map -# define set_font_map(a,b) font_map(a) = b +# define font_map(a) font_tables[a]->_font_map +# define set_font_map(a,b) font_map(a) = b -# define font_cache_id(a) font_tables[a]->_font_cache_id -# define set_font_cache_id(a,b) font_cache_id(a) = b +# define font_cache_id(a) font_tables[a]->_font_cache_id +# define set_font_cache_id(a,b) font_cache_id(a) = b -# define font_encodingbytes(a) font_tables[a]->_font_encodingbytes -# define set_font_encodingbytes(a,b) font_encodingbytes(a) = b +# define font_encodingbytes(a) font_tables[a]->_font_encodingbytes +# define set_font_encodingbytes(a,b) font_encodingbytes(a) = b -# define font_oldmath(a) font_tables[a]->_font_oldmath -# define set_font_oldmath(a,b) font_oldmath(a) = b +# define font_oldmath(a) font_tables[a]->_font_oldmath +# define set_font_oldmath(a,b) font_oldmath(a) = b -# define font_slant(a) font_tables[a]->_font_slant -# define set_font_slant(a,b) font_slant(a) = b +# define font_slant(a) font_tables[a]->_font_slant +# define set_font_slant(a,b) font_slant(a) = b -# define font_extend(a) font_tables[a]->_font_extend -# define set_font_extend(a,b) font_extend(a) = b +# define font_extend(a) font_tables[a]->_font_extend +# define set_font_extend(a,b) font_extend(a) = b -# define font_shrink(a) font_tables[a]->_font_shrink -# define set_font_shrink(a,b) font_shrink(a) = b +# define font_shrink(a) font_tables[a]->_font_shrink +# define set_font_shrink(a,b) font_shrink(a) = b -# define font_stretch(a) font_tables[a]->_font_stretch -# define set_font_stretch(a,b) font_stretch(a) = b +# define font_stretch(a) font_tables[a]->_font_stretch +# define set_font_stretch(a,b) font_stretch(a) = b -# define font_max_shrink(a) font_tables[a]->font_max_shrink -# define set_font_max_shrink(a,b) font_max_shrink(a) = b +# define font_max_shrink(a) font_tables[a]->font_max_shrink +# define set_font_max_shrink(a,b) font_max_shrink(a) = b -# define font_max_stretch(a) font_tables[a]->font_max_stretch -# define set_font_max_stretch(a,b) font_max_stretch(a) = b +# define font_max_stretch(a) font_tables[a]->font_max_stretch +# define set_font_max_stretch(a,b) font_max_stretch(a) = b -# define font_step(a) font_tables[a]->_font_step -# define set_font_step(a,b) font_step(a) = b +# define font_step(a) font_tables[a]->_font_step +# define set_font_step(a,b) font_step(a) = b -# define font_auto_expand(a) font_tables[a]->_font_auto_expand -# define set_font_auto_expand(a,b) font_auto_expand(a) = b +# define font_auto_expand(a) font_tables[a]->_font_auto_expand +# define set_font_auto_expand(a,b) font_auto_expand(a) = b -# define font_tounicode(a) font_tables[a]->_font_tounicode -# define set_font_tounicode(a,b) font_tounicode(a) = b +# define font_tounicode(a) font_tables[a]->_font_tounicode +# define set_font_tounicode(a,b) font_tounicode(a) = b -# define hyphen_char(a) font_tables[a]->_hyphen_char -# define set_hyphen_char(a,b) hyphen_char(a) = b +# define hyphen_char(a) font_tables[a]->_hyphen_char +# define set_hyphen_char(a,b) hyphen_char(a) = b -# define skew_char(a) font_tables[a]->_skew_char -# define set_skew_char(a,b) skew_char(a) = b +# define skew_char(a) font_tables[a]->_skew_char +# define set_skew_char(a,b) skew_char(a) = b -# define font_natural_dir(a) font_tables[a]->_font_natural_dir -# define set_font_natural_dir(a,b) font_natural_dir(a) = b +# define font_natural_dir(a) font_tables[a]->_font_natural_dir +# define set_font_natural_dir(a,b) font_natural_dir(a) = b -# define pdf_font_num(a) font_tables[a]->_pdf_font_num -# define set_pdf_font_num(a,b) pdf_font_num(a) = b +# define pdf_font_num(a) font_tables[a]->_pdf_font_num +# define set_pdf_font_num(a,b) pdf_font_num(a) = b -# define pdf_font_attr(a) font_tables[a]->_pdf_font_attr -# define set_pdf_font_attr(a,b) pdf_font_attr(a) = b +# define pdf_font_attr(a) font_tables[a]->_pdf_font_attr +# define set_pdf_font_attr(a,b) pdf_font_attr(a) = b # define left_boundarychar -1 # define right_boundarychar -2 diff --git a/Build/source/texk/web2c/luatexdir/lang/texlang.w b/Build/source/texk/web2c/luatexdir/lang/texlang.w index f6dcfdb9153..cf88928e8d4 100644 --- a/Build/source/texk/web2c/luatexdir/lang/texlang.w +++ b/Build/source/texk/web2c/luatexdir/lang/texlang.w @@ -906,11 +906,17 @@ void hnj_hyphenation(halfword head, halfword tail) } if (wordlen <= lhmin) { lhmin = lhmin - lchar + 1 ; + if (lhmin < 0) + lhmin = 1; } if (wordlen >= rhmin) { rhmin = rhmin - lchar + 1 ; + if (rhmin < 0) + rhmin = 1; } hmin = hmin - lchar + 1 ; + if (hmin < 0) + rhmin = 1; lchar = character(r) ; } hy = uni2string(hy, (unsigned) lchar); @@ -962,20 +968,35 @@ void hnj_hyphenation(halfword head, halfword tail) left = wordstart; for (i = lhmin; i > 1; i--) { left = vlink(left); - while (!is_simple_character(left)) + while (!is_simple_character(left)) { left = vlink(left); + } + /* + if (!left) + break ; + */ + /* what is left overruns right .. a bit messy */ } right = r; for (i = rhmin; i > 0; i--) { right = alink(right); - while (!is_simple_character(right)) + while (!is_simple_character(right)) { right = alink(right); + } + /* + if (!right) + break ; + */ + /* what is right overruns left .. a bit messy */ } + /* maybe an extra check ... */ + /* if (left && right) { */ #ifdef VERBOSE - formatted_warning("hyphenation","hyphenate %s (c=%d,l=%d,r=%d) from %c to %c", - utf8word, clang, lhmin, rhmin, character(left), character(right)); + formatted_warning("hyphenation","hyphenate %s (c=%d,l=%d,r=%d) from %c to %c", + utf8word, clang, lhmin, rhmin, character(left), character(right)); #endif - (void) hnj_hyphen_hyphenate(lang->patterns, wordstart, end_word, wordlen, left, right, &langdata); + (void) hnj_hyphen_hyphenate(lang->patterns, wordstart, end_word, wordlen, left, right, &langdata); + /* } */ } } explicit_hyphen = false; diff --git a/Build/source/texk/web2c/luatexdir/lua/lnodelib.c b/Build/source/texk/web2c/luatexdir/lua/lnodelib.c index 1bfa5550949..80ac8a24e30 100644 --- a/Build/source/texk/web2c/luatexdir/lua/lnodelib.c +++ b/Build/source/texk/web2c/luatexdir/lua/lnodelib.c @@ -1694,6 +1694,28 @@ static int lua_nodelib_dimensions(lua_State * L) return 0; /* not reached */ } +static int lua_nodelib_rangedimensions(lua_State * L) /* parent, first, last */ +{ + int top = lua_gettop(L); + if (top > 1) { + scaled_whd siz; + halfword l = *(check_isnode(L, 1)); /* parent */ + halfword n = *(check_isnode(L, 2)); /* first */ + halfword p = null; + if (top > 2) { + p = *(check_isnode(L, 3)); /* last */ + } + siz = natural_sizes(n, p, (glue_ratio) glue_set(l), glue_sign(l), glue_order(l), box_dir(l)); + lua_pushinteger(L, siz.wd); + lua_pushinteger(L, siz.ht); + lua_pushinteger(L, siz.dp); + return 3; + } else { + luaL_error(L, "missing argument to 'rangedimensions' (2 or more nodes expected)"); + } + return 0; /* not reached */ +} + /* node.direct.dimensions*/ static int lua_nodelib_direct_dimensions(lua_State * L) @@ -1729,7 +1751,29 @@ static int lua_nodelib_direct_dimensions(lua_State * L) lua_pushinteger(L, siz.dp); return 3; } else { - luaL_error(L, "missing argument to 'dimensions' (node expected)"); + luaL_error(L, "missing argument to 'dimensions' (direct node expected)"); + } + return 0; /* not reached */ +} + +static int lua_nodelib_direct_rangedimensions(lua_State * L) /* parent, first, last */ +{ + int top = lua_gettop(L); + if (top > 1) { + scaled_whd siz; + halfword l = (halfword) lua_tointeger(L,1); /* parent */ + halfword n = (halfword) lua_tointeger(L,2); /* first */ + halfword p = null; + if (top > 2) { + p = (halfword) lua_tointeger(L,3); /* last */ + } + siz = natural_sizes(n, p, (glue_ratio) glue_set(l), glue_sign(l), glue_order(l), box_dir(l)); + lua_pushinteger(L, siz.wd); + lua_pushinteger(L, siz.ht); + lua_pushinteger(L, siz.dp); + return 3; + } else { + luaL_error(L, "missing argument to 'rangedimensions' (2 or more direct nodes expected)"); } return 0; /* not reached */ } @@ -6991,6 +7035,7 @@ static const struct luaL_Reg direct_nodelib_f[] = { {"count", lua_nodelib_direct_count}, {"current_attr", lua_nodelib_direct_currentattr}, {"dimensions", lua_nodelib_direct_dimensions}, + {"rangedimensions", lua_nodelib_direct_rangedimensions}, /* {"do_ligature_n", lua_nodelib_direct_do_ligature_n}, */ {"end_of_math", lua_nodelib_direct_end_of_math}, /* {"family_font", lua_nodelib_mfont}, */ /* no node argument */ @@ -7086,6 +7131,7 @@ static const struct luaL_Reg nodelib_f[] = { {"count", lua_nodelib_count}, {"current_attr", lua_nodelib_currentattr}, {"dimensions", lua_nodelib_dimensions}, + {"rangedimensions", lua_nodelib_rangedimensions}, /* {"do_ligature_n", lua_nodelib_do_ligature_n}, */ {"end_of_math", lua_nodelib_end_of_math}, {"family_font", lua_nodelib_mfont}, diff --git a/Build/source/texk/web2c/luatexdir/lua/luainit.w b/Build/source/texk/web2c/luatexdir/lua/luainit.w index 6681b4b560c..ca755642038 100644 --- a/Build/source/texk/web2c/luatexdir/lua/luainit.w +++ b/Build/source/texk/web2c/luatexdir/lua/luainit.w @@ -167,6 +167,10 @@ static void prepare_cmdline(lua_State * L, char **av, int ac, int zero_offset) return; } + +@ @c +int kpse_init = -1; + @ @c string input_name = NULL; @@ -471,26 +475,16 @@ static void parse_options(int ac, char **av) } } #ifdef WIN32 - } else if (sargv[sargc-1] && sargv[sargc-1][0] != '-' && + } else if (sargc > 1 && sargv[sargc-1] && sargv[sargc-1][0] != '-' && sargv[sargc-1][0] != '\\') { if (sargv[sargc-1][0] == '&') dump_name = xstrdup(sargv[sargc-1] + 1); else { - char *p; if (sargv[sargc-1][0] == '*') input_name = xstrdup(sargv[sargc-1] + 1); else input_name = xstrdup(sargv[sargc-1]); sargv[sargc-1] = normalize_quotes(input_name, "argument"); - /* Same as - input_name = (char *)xbasename(input_name); - but without cast const => non-const. */ - input_name += xbasename(input_name) - input_name; - p = strrchr(input_name, '.'); - if (p != NULL && strcasecmp(p, ".tex") == 0) - *p = '\0'; - if (!c_job_name) - c_job_name = normalize_quotes(input_name, "jobname"); } if (safer_option) /* --safer implies --nosocket */ nosocket_option = 1; @@ -596,8 +590,10 @@ static void fix_dumpname(void) TEX_format_default = concat(dump_name, DUMP_EXT); } else { /* For |dump_name| to be NULL is a bug. */ - if (!ini_version) - normal_error("luatex","no format given"); + if (!ini_version) { + fprintf(stdout, "no format given, quitting\n"); + exit(1); + } } } @@ -858,7 +854,7 @@ void lua_initialize(int ac, char **av) { char *given_file = NULL; char *banner; - int kpse_init; + /*int kpse_init;*/ size_t len; int starttime; int utc; diff --git a/Build/source/texk/web2c/luatexdir/luatex.c b/Build/source/texk/web2c/luatexdir/luatex.c index 3b9125c4501..7e06c938885 100644 --- a/Build/source/texk/web2c/luatexdir/luatex.c +++ b/Build/source/texk/web2c/luatexdir/luatex.c @@ -29,9 +29,9 @@ #define TeX int luatex_version = 98; /* \.{\\luatexversion} */ -int luatex_revision = '3'; /* \.{\\luatexrevision} */ -int luatex_date_info = 2016081300; /* the compile date is now hardwired */ -const char *luatex_version_string = "0.98.3"; +int luatex_revision = '4'; /* \.{\\luatexrevision} */ +int luatex_date_info = 2016090500; /* the compile date is now hardwired */ +const char *luatex_version_string = "0.98.4"; const char *engine_name = my_name; /* the name of this engine */ #include <kpathsea/c-ctype.h> diff --git a/Build/source/texk/web2c/luatexdir/ptexlib.h b/Build/source/texk/web2c/luatexdir/ptexlib.h index e71efae65f8..caded2b204a 100644 --- a/Build/source/texk/web2c/luatexdir/ptexlib.h +++ b/Build/source/texk/web2c/luatexdir/ptexlib.h @@ -373,4 +373,7 @@ extern extinfo *copy_variants(extinfo * o); extern int program_name_set; /* in lkpselib.c */ +extern int kpse_init; /* in luainit.w */ +extern int kpse_available(const char * m); /* in texfileio.w */ + #endif /* PTEXLIB_H */ diff --git a/Build/source/texk/web2c/luatexdir/tex/commands.w b/Build/source/texk/web2c/luatexdir/tex/commands.w index 88211643533..e4a269d93d0 100644 --- a/Build/source/texk/web2c/luatexdir/tex/commands.w +++ b/Build/source/texk/web2c/luatexdir/tex/commands.w @@ -557,6 +557,8 @@ void initialize_commands(void) primitive_luatex("Umathlimitbelowvgap", set_math_param_cmd, math_param_limit_below_vgap, 0); primitive_luatex("Umathlimitbelowbgap", set_math_param_cmd, math_param_limit_below_bgap, 0); primitive_luatex("Umathlimitbelowkern", set_math_param_cmd, math_param_limit_below_kern, 0); + primitive_luatex("Umathnolimitsubfactor", set_math_param_cmd, math_param_nolimit_sub_factor, 0); /* bonus */ + primitive_luatex("Umathnolimitsupfactor", set_math_param_cmd, math_param_nolimit_sup_factor, 0); /* bonus */ primitive_luatex("Umathunderdelimitervgap", set_math_param_cmd, math_param_under_delimiter_vgap, 0); primitive_luatex("Umathunderdelimiterbgap", set_math_param_cmd, math_param_under_delimiter_bgap, 0); primitive_luatex("Umathoverdelimitervgap", set_math_param_cmd, math_param_over_delimiter_vgap, 0); @@ -751,6 +753,7 @@ void initialize_etex_commands(void) primitive_luatex("matheqnogapstep", assign_int_cmd, int_base + math_eqno_gap_step_code, int_base); primitive_luatex("mathdisplayskipmode", assign_int_cmd, int_base + math_display_skip_mode_code, int_base); primitive_luatex("mathscriptsmode", assign_int_cmd, int_base + math_scripts_mode_code, int_base); + primitive_luatex("mathnolimitsmode", assign_int_cmd, int_base + math_nolimits_mode_code, int_base); primitive_luatex("synctex", assign_int_cmd, int_base + synctex_code, int_base); primitive_etex("currentgrouplevel", last_item_cmd, current_group_level_code, 0); diff --git a/Build/source/texk/web2c/luatexdir/tex/dumpdata.w b/Build/source/texk/web2c/luatexdir/tex/dumpdata.w index ae769584381..85ff55f4e09 100644 --- a/Build/source/texk/web2c/luatexdir/tex/dumpdata.w +++ b/Build/source/texk/web2c/luatexdir/tex/dumpdata.w @@ -23,7 +23,7 @@ /* we start with 907: the sum of the values of the bytes of "don knuth" */ -#define FORMAT_ID (907+17) +#define FORMAT_ID (907+18) #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 7f83dd3d6cc..b2bda5f605b 100644 --- a/Build/source/texk/web2c/luatexdir/tex/equivalents.h +++ b/Build/source/texk/web2c/luatexdir/tex/equivalents.h @@ -278,20 +278,21 @@ the |number_regs| \.{\\dimen} registers. # define math_eqno_gap_step_code 87 /* factor/1000 used for distance between eq and eqno */ # define math_display_skip_mode_code 88 # define math_scripts_mode_code 89 -# define synctex_code 90 /* is synctex file generation enabled ? */ -# define shape_mode_code 91 -# define first_valid_language_code 92 -# define hyphenation_bounds_code 93 +# define math_nolimits_mode_code 90 +# define synctex_code 91 /* is synctex file generation enabled ? */ +# define shape_mode_code 92 +# define first_valid_language_code 93 +# define hyphenation_bounds_code 94 -# define math_option_code 94 +# define math_option_code 95 -# define mathoption_int_base (int_base+95) /* one reserve */ -# define mathoption_int_last (int_base+100) +# define mathoption_int_base (int_base+96) /* one reserve */ +# define mathoption_int_last (int_base+104) -# define backend_int_base (int_base+101) -# define backend_int_last (int_base+125) +# define backend_int_base (int_base+105) +# define backend_int_last (int_base+129) -# define tex_int_pars (126) /* total number of integer parameters */ +# define tex_int_pars (130) /* total number of integer parameters */ # define page_direction_code (tex_int_pars) # define body_direction_code (tex_int_pars+1) @@ -637,6 +638,7 @@ extern halfword last_cs_name; #define disable_kern_par int_par(disable_kern_code) #define disable_space_par int_par(disable_space_code) #define scripts_mode_par int_par(math_scripts_mode_code) +#define nolimits_mode_par int_par(math_nolimits_mode_code) #define thin_mu_skip_par glue_par(thin_mu_skip_code) #define med_mu_skip_par glue_par(med_mu_skip_code) diff --git a/Build/source/texk/web2c/luatexdir/tex/errors.w b/Build/source/texk/web2c/luatexdir/tex/errors.w index 4cad07c6f28..1af16ec58ef 100644 --- a/Build/source/texk/web2c/luatexdir/tex/errors.w +++ b/Build/source/texk/web2c/luatexdir/tex/errors.w @@ -219,6 +219,7 @@ void do_final_end(void) { update_terminal(); ready_already = 0; + lua_close(Luas); /* new per 0.99 */ if ((history != spotless) && (history != warning_issued)) uexit(1); else diff --git a/Build/source/texk/web2c/luatexdir/tex/linebreak.w b/Build/source/texk/web2c/luatexdir/tex/linebreak.w index fb67eb2fcec..1c8a1e20f69 100644 --- a/Build/source/texk/web2c/luatexdir/tex/linebreak.w +++ b/Build/source/texk/web2c/luatexdir/tex/linebreak.w @@ -183,7 +183,7 @@ void line_break(boolean d, int line_break_context) club_penalty_par, club_penalties_par_ptr, (d ? display_widow_penalties_par_ptr : widow_penalties_par_ptr), - (d ? display_widow_penalty_code : widow_penalty_code), + (d ? display_widow_penalty_par : widow_penalty_par), broken_penalty_par, final_par_glue); } diff --git a/Build/source/texk/web2c/luatexdir/tex/mainbody.w b/Build/source/texk/web2c/luatexdir/tex/mainbody.w index 0fb8bc4b484..faa6e1992da 100644 --- a/Build/source/texk/web2c/luatexdir/tex/mainbody.w +++ b/Build/source/texk/web2c/luatexdir/tex/mainbody.w @@ -449,7 +449,7 @@ void main_body(void) initialize_math(); fixup_selector(log_opened_global); check_texconfig_init(); - if ((iloc < ilimit) && (get_cat_code(cat_code_table_code, buffer[iloc]) != escape_cmd)) + if ((iloc < ilimit) && (get_cat_code(cat_code_table_par, buffer[iloc]) != escape_cmd)) start_input(); /* \.{\\input} assumed */ /* DIR: Initialize |text_dir_ptr| */ text_dir_ptr = new_dir(0); diff --git a/Build/source/texk/web2c/luatexdir/tex/mlist.w b/Build/source/texk/web2c/luatexdir/tex/mlist.w index ace56be8627..753ce840cbc 100644 --- a/Build/source/texk/web2c/luatexdir/tex/mlist.w +++ b/Build/source/texk/web2c/luatexdir/tex/mlist.w @@ -53,6 +53,7 @@ already apply that shift. @ @c #define is_new_mathfont(A) ((font_math_params(A) >0) && (math_old_par == 0)) #define is_old_mathfont(A,B) ((font_math_params(A)==0) && (font_params(A)>=(B))) +#define do_new_math(A) ((font_math_params(A) >0) && (font_oldmath(A) == 0) && (math_old_par == 0)) @ \def\LuaTeX{Lua\TeX} @@ -94,7 +95,7 @@ already apply that shift. } \ } while (0) -#define font_MATH_par(a,b) \ +#define font_MATH_par(a,b) \ (font_math_params(a)>=b ? font_math_param(a,b) : undefined_math_parameter) @ here are the math parameters that are font-dependant @@ -197,7 +198,7 @@ static void math_param_error(const char *param, int style) static scaled accent_base_height(int f) { scaled a; - if (is_new_mathfont(f)) { + if (do_new_math(f)) { a = font_MATH_par(f, AccentBaseHeight); if (a == undefined_math_parameter) a = x_height(f); @@ -280,6 +281,7 @@ static scaled radical_rule(int var) @c #define get_math_param_or_error(a,b) do_get_math_param_or_error(a, math_param_##b, #b) +#define get_math_param_or_zero(a,b) do_get_math_param_or_zero(a, math_param_##b, #b) static scaled do_get_math_param_or_error(int var, int param, const char *name) { @@ -291,6 +293,15 @@ static scaled do_get_math_param_or_error(int var, int param, const char *name) return a; } +static scaled do_get_math_param_or_zero(int var, int param, const char *name) +{ + scaled a = get_math_param(param, var); + if (a == undefined_math_parameter) { + a = 0; + } + return a; +} + @ A variant on a suggestion on the list based on analysis by UV. @c @@ -365,6 +376,9 @@ static scaled get_delimiter_height(scaled max_d, scaled max_h, boolean axis) { #define limit_below_bgap(a) get_math_param_or_error(a, limit_below_bgap) #define limit_below_kern(a) get_math_param_or_error(a, limit_below_kern) +#define nolimit_sub_factor(a) get_math_param_or_zero(a, nolimit_sub_factor) +#define nolimit_sup_factor(a) get_math_param_or_zero(a, nolimit_sup_factor) + #define sub_shift_drop(a) get_math_param_or_error(a, sub_shift_drop) #define sup_shift_drop(a) get_math_param_or_error(a, sup_shift_drop) #define sub_shift_down(a) get_math_param_or_error(a, sub_shift_down) @@ -563,6 +577,14 @@ void fixup_math_parameters(int fam_id, int size_id, int f, int lvl) 0, lvl); DEFINE_DMATH_PARAMETERS(math_param_limit_below_kern, size_id, 0, lvl); + DEFINE_MATH_PARAMETERS(math_param_nolimit_sub_factor, size_id, + font_MATH_par(f, NoLimitSubFactor), lvl); /* bonus */ + DEFINE_DMATH_PARAMETERS(math_param_nolimit_sub_factor, size_id, + font_MATH_par(f, NoLimitSubFactor), lvl); /* bonus */ + DEFINE_MATH_PARAMETERS(math_param_nolimit_sup_factor, size_id, + font_MATH_par(f, NoLimitSupFactor), lvl); /* bonus */ + DEFINE_DMATH_PARAMETERS(math_param_nolimit_sup_factor, size_id, + font_MATH_par(f, NoLimitSupFactor), lvl); /* bonus */ DEFINE_MATH_PARAMETERS(math_param_fraction_rule, size_id, font_MATH_par(f, FractionRuleThickness), lvl); @@ -819,6 +841,14 @@ void fixup_math_parameters(int fam_id, int size_id, int f, int lvl) big_op_spacing5(size_id), lvl); DEFINE_DMATH_PARAMETERS(math_param_limit_below_kern, size_id, big_op_spacing5(size_id), lvl); + DEFINE_MATH_PARAMETERS(math_param_nolimit_sub_factor, size_id, + font_MATH_par(f, NoLimitSubFactor), lvl); /* bonus */ + DEFINE_DMATH_PARAMETERS(math_param_nolimit_sub_factor, size_id, + font_MATH_par(f, NoLimitSubFactor), lvl); /* bonus */ + DEFINE_MATH_PARAMETERS(math_param_nolimit_sup_factor, size_id, + font_MATH_par(f, NoLimitSupFactor), lvl); /* bonus */ + DEFINE_DMATH_PARAMETERS(math_param_nolimit_sup_factor, size_id, + font_MATH_par(f, NoLimitSupFactor), lvl); /* bonus */ DEFINE_MATH_PARAMETERS(math_param_subsup_vgap, size_id, 4 * default_rule_thickness(size_id), lvl); DEFINE_DMATH_PARAMETERS(math_param_subsup_vgap, size_id, @@ -991,7 +1021,7 @@ static pointer char_box(internal_font_number f, int c, pointer bb) { pointer b, p; /* the new box and its character node */ b = new_null_box(); - if (is_new_mathfont(f)) + if (do_new_math(f)) width(b) = char_width(f, c); else width(b) = char_width(f, c) + char_italic(f, c); @@ -1404,7 +1434,7 @@ static pointer do_delimiter(pointer q, pointer d, int s, scaled v, boolean flat, b = get_delim_box(d, ext, f, v, att, cur_style, vlist_node); } if (delta != NULL) { - if (is_new_mathfont(f)) { + if (do_new_math(f)) { *delta = char_vert_italic(f,x); } else { *delta = char_italic(f,x); @@ -1414,12 +1444,12 @@ static pointer do_delimiter(pointer q, pointer d, int s, scaled v, boolean flat, *stack = true ; } else { b = char_box(f, c, att); - if (!is_new_mathfont(f)) { + if (!do_new_math(f)) { /* italic gets added to width */ width(b) += char_italic(f, c); } if (delta != NULL) { - *delta = char_italic(f,x); + *delta = char_italic(f, c); /* was historically (f, x) */ } if (stack != NULL) *stack = false ; @@ -2113,7 +2143,7 @@ static boolean compute_accent_skew(pointer q, int flags, scaled *s) boolean s_is_absolute = false; /* will be true if a top-accent is placed in |s| */ if (type(nucleus(q)) == math_char_node) { fetch(nucleus(q)); - if (is_new_mathfont(cur_f)) { + if (do_new_math(cur_f)) { /* there is no bot_accent so let's assume similarity @@ -2183,7 +2213,7 @@ static void do_make_math_accent(pointer q, internal_font_number f, int c, int fl x = clean_box(nucleus(q), cramped_style(cur_style), cur_style); w = width(x); h = height(x); - if (is_new_mathfont(cur_f) && !s_is_absolute) { + if (do_new_math(cur_f) && !s_is_absolute) { s = half(w); s_is_absolute = true; } @@ -2261,7 +2291,7 @@ static void do_make_math_accent(pointer q, internal_font_number f, int c, int fl } else if ((vlink(q) != null) && (type(nucleus(q)) == math_char_node)) { /* only pure math char nodes */ internal_font_number f = fam_fnt(math_fam(nucleus(q)),cur_size); - if (is_new_mathfont(f)) { + if (do_new_math(f)) { ic = char_italic(f,math_character(nucleus(q))); } } @@ -2545,7 +2575,7 @@ static void make_fraction(pointer q, int cur_style) put the fraction into a box with its delimiters, and make |new_hlist(q)| point to it */ - if (is_new_mathfont(cur_f)) { + if (do_new_math(cur_f)) { if (math_use_old_fraction_scaling_par) { delta = fraction_del_size_old(cur_style); } else { @@ -2610,7 +2640,7 @@ static scaled make_op(pointer q, int cur_style) small_fam(y) = math_fam(nucleus(q)); small_char(y) = math_character(nucleus(q)); x = do_delimiter(q, y, text_size, ok_size, false, cur_style, true, NULL, &delta); - if (is_new_mathfont(cur_f)) { + if (do_new_math(cur_f)) { /* we never added italic correction */ } else if ((subscr(q) != null) && (subtype(q) != op_noad_type_limits)) { /* remove italic correction */ @@ -2628,7 +2658,7 @@ static scaled make_op(pointer q, int cur_style) delta = char_italic(cur_f, cur_c); x = clean_box(nucleus(q), cur_style, cur_style); if (delta != null) { - if (is_new_mathfont(cur_f)) { + if (do_new_math(cur_f)) { /* we never added italic correction */ } else if ((subscr(q) != null) && (subtype(q) != op_noad_type_limits)) { /* remove italic correction */ @@ -2642,7 +2672,7 @@ static scaled make_op(pointer q, int cur_style) delta = char_italic(cur_f, cur_c); x = clean_box(nucleus(q), cur_style, cur_style); if (delta != 0) { - if (is_new_mathfont(cur_f)) { + if (do_new_math(cur_f)) { /* we never added italic correction */ } else if ((subscr(q) != null) && (subtype(q) != op_noad_type_limits)) { /* remove italic correction */ @@ -2662,15 +2692,56 @@ static scaled make_op(pointer q, int cur_style) /* we now handle op_nod_type_no_limits here too */ if (subtype(q) == op_noad_type_no_limits) { - if (is_new_mathfont(cur_f)) { - if (delta != 0) { - delta = half(delta) ; - } + if (do_new_math(cur_f)) { + /* + if (delta != 0) { + delta = half(delta) ; + } + */ p = check_nucleus_complexity(q, &dummy, cur_style); if ((subscr(q) == null) && (supscr(q) == null)) { assign_new_hlist(q, p); } else { - make_scripts(q, p, 0, cur_style, delta, -delta); + /* + make_scripts(q, p, 0, cur_style, delta, -delta); + */ + int mode = nolimits_mode_par; /* wins */ + /* + for easy configuration ... fonts are somewhat inconsistent and the + values for italic correction run from 30 to 60% of the width + */ + switch (mode) { + case 0 : + /* as with limits */ + make_scripts(q, p, 0, cur_style, half(delta), -half(delta)); + break; + case 1 : + /* MathConstants driven */ + make_scripts(q, p, 0, cur_style, + round_xn_over_d(delta, nolimit_sup_factor(cur_style), 1000), + -round_xn_over_d(delta, nolimit_sub_factor(cur_style), 1000)); + case 2 : + /* no correction */ + make_scripts(q, p, 0, cur_style, 0, 0); + break; + case 3 : + /* half bottom correction */ + make_scripts(q, p, 0, cur_style, 0, -half(delta)); + break; + case 4 : + /* full bottom correction */ + make_scripts(q, p, 0, cur_style, 0, -delta); + break; + default : + /* half bottom and top correction */ + if (mode > 15) { + /* for quickly testing values */ + make_scripts(q, p, 0, cur_style, 0, -round_xn_over_d(delta, mode, 1000)); + } else { + make_scripts(q, p, 0, cur_style, half(delta), -half(delta)); + } + break; + } } delta = 0; } else { @@ -2691,7 +2762,7 @@ static scaled make_op(pointer q, int cur_style) v = new_null_box(); reset_attributes(v, node_attr(q)); type(v) = vlist_node; - if (is_new_mathfont(cur_f)) { + if (do_new_math(cur_f)) { n = null; if (! math_no_italic_compensation_par) { n = nucleus(q); @@ -2802,7 +2873,7 @@ static scaled make_op(pointer q, int cur_style) supscr(q) = null; } assign_new_hlist(q, v); - if (is_new_mathfont(cur_f)) { + if (do_new_math(cur_f)) { delta = 0; } } @@ -2844,7 +2915,7 @@ static void make_ord(pointer q) fetch(nucleus(q)); a = cur_c; /* add italic correction */ - if (is_new_mathfont(cur_f) && (char_italic(cur_f,math_character(nucleus(q))) != 0)) { + if (do_new_math(cur_f) && (char_italic(cur_f,math_character(nucleus(q))) != 0)) { p = new_kern(char_italic(cur_f,math_character(nucleus(q)))); reset_attributes(p, node_attr(q)); couple_nodes(p,vlink(q)); @@ -3005,7 +3076,7 @@ static scaled find_math_kern(internal_font_number l_f, int l_c, { scaled corr_height_top = 0, corr_height_bot = 0; scaled krn_l = 0, krn_r = 0, krn = 0; - if ((!is_new_mathfont(l_f)) || (!is_new_mathfont(r_f)) || (!char_exists(l_f, l_c)) || (!char_exists(r_f, r_c))) + if ((!do_new_math(l_f)) || (!do_new_math(r_f)) || (!char_exists(l_f, l_c)) || (!char_exists(r_f, r_c))) return MATH_KERN_NOT_FOUND; if (cmd == sup_mark_cmd) { @@ -3732,14 +3803,14 @@ static pointer check_nucleus_complexity(halfword q, scaled * delta, int cur_styl fetch(nucleus(q)); if (char_exists(cur_f, cur_c)) { /* we could look at neighbours */ - if (is_new_mathfont(cur_f)) { + if (do_new_math(cur_f)) { *delta = 0 ; /* cf spec only the last one */ } else { *delta = char_italic(cur_f, cur_c); } p = new_glyph(cur_f, cur_c); reset_attributes(p, node_attr(nucleus(q))); - if (is_new_mathfont(cur_f)) { + if (do_new_math(cur_f)) { if (! math_no_char_italic_par) { /* keep italic, but bad with two successive letters */ } else if (get_char_cat_code(cur_c) == 11) { @@ -3759,7 +3830,7 @@ static pointer check_nucleus_complexity(halfword q, scaled * delta, int cur_styl couple_nodes(p,x); *delta = 0; } - if (is_new_mathfont(cur_f)) { + if (do_new_math(cur_f)) { *delta = char_italic(cur_f, cur_c); /* must be more selective */ } } diff --git a/Build/source/texk/web2c/luatexdir/tex/texfileio.w b/Build/source/texk/web2c/luatexdir/tex/texfileio.w index 8b21cd02e71..c222eef975b 100644 --- a/Build/source/texk/web2c/luatexdir/tex/texfileio.w +++ b/Build/source/texk/web2c/luatexdir/tex/texfileio.w @@ -107,13 +107,21 @@ static char *find_in_output_directory(const char *s) @ find an \.{\\input} or \.{\\read} file. |n| differentiates between those case. @c +int kpse_available(const char *m) { + if (!kpse_init) { + fprintf(stdout,"missing kpse replacement callback '%s', quitting\n",m); + exit(1); + } + return 1 ; +} + char *luatex_find_read_file(const char *s, int n, int callback_index) { char *ftemp = NULL; int callback_id = callback_defined(callback_index); if (callback_id > 0) { (void) run_callback(callback_id, "dS->R", n, s, &ftemp); - } else { + } else if (kpse_available("find_read_file")) { /* use kpathsea here */ ftemp = find_in_output_directory(s); if (!ftemp) @@ -136,7 +144,7 @@ char *luatex_find_file(const char *s, int callback_index) if (callback_id > 0) { (void) run_callback(callback_id, "S->R", s, &ftemp); - } else { + } else if (kpse_available("find_read_file")) { /* use kpathsea here */ switch (callback_index) { case find_enc_file_callback: diff --git a/Build/source/texk/web2c/luatexdir/tex/texmath.h b/Build/source/texk/web2c/luatexdir/tex/texmath.h index 93e85b46221..e5ad6798257 100644 --- a/Build/source/texk/web2c/luatexdir/tex/texmath.h +++ b/Build/source/texk/web2c/luatexdir/tex/texmath.h @@ -155,6 +155,8 @@ typedef enum { math_param_limit_below_vgap, math_param_limit_below_bgap, math_param_limit_below_kern, + math_param_nolimit_sub_factor, /* bonus */ + math_param_nolimit_sup_factor, /* bonus */ math_param_under_delimiter_vgap, math_param_under_delimiter_bgap, math_param_over_delimiter_vgap, @@ -307,6 +309,8 @@ typedef enum { SubscriptShiftDownWithSuperscript, FractionDelimiterSize, FractionDelimiterDisplayStyleSize, + NoLimitSubFactor, + NoLimitSupFactor, MATH_param_last, } MATH_param_codes; diff --git a/Build/source/texk/web2c/luatexdir/tex/texmath.w b/Build/source/texk/web2c/luatexdir/tex/texmath.w index 4d588079ce7..b378c662619 100644 --- a/Build/source/texk/web2c/luatexdir/tex/texmath.w +++ b/Build/source/texk/web2c/luatexdir/tex/texmath.w @@ -452,6 +452,7 @@ const char *math_param_names[] = { "fractiondenomvgap", "fractiondenomdown", "fractiondelsize", "limitabovevgap", "limitabovebgap", "limitabovekern", "limitbelowvgap", "limitbelowbgap", "limitbelowkern", + "nolimitsubfactor", "nolimitsupfactor", /* bonus */ "underdelimitervgap", "underdelimiterbgap", "overdelimitervgap", "overdelimiterbgap", "subshiftdrop", "supshiftdrop", "subshiftdown", diff --git a/Build/source/texk/web2c/luatexdir/tex/texnodes.w b/Build/source/texk/web2c/luatexdir/tex/texnodes.w index 50fbe95190f..c242577404f 100644 --- a/Build/source/texk/web2c/luatexdir/tex/texnodes.w +++ b/Build/source/texk/web2c/luatexdir/tex/texnodes.w @@ -2827,9 +2827,21 @@ void show_node_wrapup_pdf(int p) @ Recursive calls on |show_node_list| therefore use the following pattern: @c #define node_list_display(A) do { \ - append_char('.'); \ - show_node_list(A); \ - flush_char(); \ + append_char('.'); \ + show_node_list(A); \ + flush_char(); \ +} while (0) + +#define node_list_display_x(A,B) do { \ + if ((B) != null) { \ + append_char('.'); \ + append_char(A); \ + append_char(' '); \ + show_node_list(B); \ + flush_char(); \ + flush_char(); \ + flush_char(); \ + } \ } while (0) /* prints a node list symbolically */ @@ -3145,17 +3157,26 @@ void show_node_list(int p) /* Display discretionary |p|; */ /* The |post_break| list of a discretionary node is indicated by a prefixed `\.{\char'174}' instead of the `\..' before the |pre_break| list. */ + /* We're not compatible anyway so ... + tprint_esc("discretionary"); + print_int(disc_penalty(p)); + print_char('|'); + if (vlink(no_break(p)) != null) { + tprint(" replacing "); + node_list_display(vlink(no_break(p))); + } + node_list_display(vlink(pre_break(p))); + append_char('|'); + show_node_list(vlink(post_break(p))); + flush_char(); + */ tprint_esc("discretionary"); + tprint(" (penalty "); print_int(disc_penalty(p)); - print_char('|'); - if (vlink(no_break(p)) != null) { - tprint(" replacing "); - node_list_display(vlink(no_break(p))); - } - node_list_display(vlink(pre_break(p))); /* recursive call */ - append_char('|'); - show_node_list(vlink(post_break(p))); - flush_char(); /* recursive call */ + print_char(')'); + node_list_display_x('<',vlink(pre_break(p))); + node_list_display_x('>',vlink(post_break(p))); + node_list_display_x('=',vlink(no_break(p))); break; case mark_node: /* Display mark |p|; */ |