diff options
Diffstat (limited to 'source/luametatex')
-rw-r--r-- | source/luametatex/source/libraries/miniz/miniz.c | 2 | ||||
-rw-r--r-- | source/luametatex/source/lua/lmtinterface.h | 131 | ||||
-rw-r--r-- | source/luametatex/source/lua/lmtnodelib.c | 85 | ||||
-rw-r--r-- | source/luametatex/source/luarest/lmtoslibext.c | 24 | ||||
-rw-r--r-- | source/luametatex/source/mp/mpc/mp.c | 10 | ||||
-rw-r--r-- | source/luametatex/source/mp/mpw/mp.w | 14 | ||||
-rw-r--r-- | source/luametatex/source/tex/texcommands.c | 2 | ||||
-rw-r--r-- | source/luametatex/source/tex/texmath.c | 39 | ||||
-rw-r--r-- | source/luametatex/source/tex/texmlist.c | 60 | ||||
-rw-r--r-- | source/luametatex/source/tex/texnodes.c | 21 | ||||
-rw-r--r-- | source/luametatex/source/tex/texnodes.h | 11 | ||||
-rw-r--r-- | source/luametatex/source/tex/texrules.c | 19 |
12 files changed, 205 insertions, 213 deletions
diff --git a/source/luametatex/source/libraries/miniz/miniz.c b/source/luametatex/source/libraries/miniz/miniz.c index c197c181c..8d0032f9e 100644 --- a/source/luametatex/source/libraries/miniz/miniz.c +++ b/source/luametatex/source/libraries/miniz/miniz.c @@ -3068,7 +3068,7 @@ static WCHAR* mz_utf8z_to_widechar(const char* str) { int reqChars = MultiByteToWideChar(CP_UTF8, 0, str, -1, NULL, 0); WCHAR* wStr = (WCHAR*)malloc(reqChars * sizeof(WCHAR)); - MultiByteToWideChar(CP_UTF8, 0, str, -1, wStr, sizeof(WCHAR) * reqChars); + MultiByteToWideChar(CP_UTF8, 0, str, -1, wStr, reqChars); return wStr; } diff --git a/source/luametatex/source/lua/lmtinterface.h b/source/luametatex/source/lua/lmtinterface.h index f5fd10900..c3ea2a184 100644 --- a/source/luametatex/source/lua/lmtinterface.h +++ b/source/luametatex/source/lua/lmtinterface.h @@ -488,18 +488,7 @@ make_lua_key(L, bend_tolerance);\ make_lua_key(L, bestinsert);\ make_lua_key(L, bestpagebreak);\ make_lua_key(L, bestsize);\ -make_lua_key(L, bin);\ -make_lua_key(L, binbinspacing);\ -make_lua_key(L, binclosespacing);\ -make_lua_key(L, binfracspacing);\ -make_lua_key(L, bininnerspacing);\ -make_lua_key(L, binmiddlespacing);\ -make_lua_key(L, binopenspacing);\ -make_lua_key(L, binopspacing);\ -make_lua_key(L, binordspacing);\ -make_lua_key(L, binpunctspacing);\ -make_lua_key(L, binradspacing);\ -make_lua_key(L, binrelspacing);\ +make_lua_key(L, binary);\ make_lua_key(L, boolean);\ make_lua_key(L, bothflexible);\ make_lua_key(L, bottom);\ @@ -536,17 +525,6 @@ make_lua_key(L, choice);\ make_lua_key(L, class);\ make_lua_key(L, cleaders);\ make_lua_key(L, close);\ -make_lua_key(L, closebinspacing);\ -make_lua_key(L, closeclosespacing);\ -make_lua_key(L, closefracspacing);\ -make_lua_key(L, closeinnerspacing);\ -make_lua_key(L, closemiddlespacing);\ -make_lua_key(L, closeopenspacing);\ -make_lua_key(L, closeopspacing);\ -make_lua_key(L, closeordspacing);\ -make_lua_key(L, closepunctspacing);\ -make_lua_key(L, closeradspacing);\ -make_lua_key(L, closerelspacing);\ make_lua_key(L, clubpenalties);\ make_lua_key(L, clubpenalty);\ make_lua_key(L, cmd);\ @@ -697,17 +675,6 @@ make_lua_key(L, force);\ make_lua_key(L, forcecheck);\ make_lua_key(L, forcehandler);\ make_lua_key(L, forcerulethickness);\ -make_lua_key(L, fracbinspacing);\ -make_lua_key(L, fracclosespacing);\ -make_lua_key(L, fracfracspacing);\ -make_lua_key(L, fracinnerspacing);\ -make_lua_key(L, fracmiddlespacing);\ -make_lua_key(L, fracopenspacing);\ -make_lua_key(L, fracopspacing);\ -make_lua_key(L, fracordspacing);\ -make_lua_key(L, fracpunctspacing);\ -make_lua_key(L, fracradspacing);\ -make_lua_key(L, fracrelspacing);\ make_lua_key(L, fraction);\ make_lua_key(L, FractionDelimiterDisplayStyleSize);\ make_lua_key(L, FractionDelimiterSize);\ @@ -782,18 +749,7 @@ make_lua_key(L, index);\ make_lua_key(L, info);\ make_lua_key(L, Info);\ make_lua_key(L, inner);\ -make_lua_key(L, innerbinspacing);\ -make_lua_key(L, innerclosespacing);\ -make_lua_key(L, innerfracspacing);\ -make_lua_key(L, innerinnerspacing);\ make_lua_key(L, innerlocation);\ -make_lua_key(L, innermiddlespacing);\ -make_lua_key(L, inneropenspacing);\ -make_lua_key(L, inneropspacing);\ -make_lua_key(L, innerordspacing);\ -make_lua_key(L, innerpunctspacing);\ -make_lua_key(L, innerradspacing);\ -make_lua_key(L, innerrelspacing);\ make_lua_key(L, innerxoffset);\ make_lua_key(L, inneryoffset);\ make_lua_key(L, input);\ @@ -931,18 +887,7 @@ make_lua_key(L, mathtextchar);\ make_lua_key(L, medmuskip);\ make_lua_key(L, message);\ make_lua_key(L, middle);\ -make_lua_key(L, middlebinspacing);\ make_lua_key(L, middlebox);\ -make_lua_key(L, middleclosespacing);\ -make_lua_key(L, middlefracspacing);\ -make_lua_key(L, middleinnerspacing);\ -make_lua_key(L, middlemiddlespacing);\ -make_lua_key(L, middleopenspacing);\ -make_lua_key(L, middleopspacing);\ -make_lua_key(L, middleordspacing);\ -make_lua_key(L, middlepunctspacing);\ -make_lua_key(L, middleradspacing);\ -make_lua_key(L, middlerelspacing);\ make_lua_key(L, MinConnectorOverlap);\ make_lua_key(L, mirror);\ make_lua_key(L, mkern);\ @@ -991,47 +936,13 @@ make_lua_key(L, nucleus);\ make_lua_key(L, number);\ make_lua_key(L, numerator);\ make_lua_key(L, numeratorvariant);\ -make_lua_key(L, op);\ -make_lua_key(L, opbinspacing);\ -make_lua_key(L, opclosespacing);\ make_lua_key(L, open);\ -make_lua_key(L, openbinspacing);\ -make_lua_key(L, openclosespacing);\ -make_lua_key(L, openfracspacing);\ -make_lua_key(L, openinnerspacing);\ -make_lua_key(L, openmiddlespacing);\ -make_lua_key(L, openopenspacing);\ -make_lua_key(L, openopspacing);\ -make_lua_key(L, openordspacing);\ -make_lua_key(L, openpunctspacing);\ -make_lua_key(L, openradspacing);\ -make_lua_key(L, openrelspacing);\ make_lua_key(L, openupdepth);\ make_lua_key(L, openupheight);\ make_lua_key(L, operator);\ make_lua_key(L, operatorsize);\ -make_lua_key(L, opfracspacing);\ -make_lua_key(L, opinnerspacing);\ -make_lua_key(L, opmiddlespacing);\ -make_lua_key(L, opopenspacing);\ -make_lua_key(L, opopspacing);\ -make_lua_key(L, opordspacing);\ -make_lua_key(L, oppunctspacing);\ -make_lua_key(L, opradspacing);\ -make_lua_key(L, oprelspacing);\ make_lua_key(L, options);\ -make_lua_key(L, ord);\ -make_lua_key(L, ordbinspacing);\ -make_lua_key(L, ordclosespacing);\ -make_lua_key(L, ordfracspacing);\ -make_lua_key(L, ordinnerspacing);\ -make_lua_key(L, ordmiddlespacing);\ -make_lua_key(L, ordopenspacing);\ -make_lua_key(L, ordopspacing);\ -make_lua_key(L, ordordspacing);\ -make_lua_key(L, ordpunctspacing);\ -make_lua_key(L, ordradspacing);\ -make_lua_key(L, ordrelspacing);\ +make_lua_key(L, ordinary);\ make_lua_key(L, orientation);\ make_lua_key(L, original);\ make_lua_key(L, orphanpenalties);\ @@ -1134,22 +1045,8 @@ make_lua_key(L, semi_protected_call);\ make_lua_key(L, protrudechars);\ make_lua_key(L, protrusion);\ make_lua_key(L, ptr);\ -make_lua_key(L, punct);\ -make_lua_key(L, punctbinspacing);\ -make_lua_key(L, punctclosespacing);\ -make_lua_key(L, punctfracspacing);\ -make_lua_key(L, punctinnerspacing);\ -make_lua_key(L, punctmiddlespacing);\ -make_lua_key(L, punctopenspacing);\ -make_lua_key(L, punctopspacing);\ -make_lua_key(L, punctordspacing);\ -make_lua_key(L, punctpunctspacing);\ -make_lua_key(L, punctradspacing);\ -make_lua_key(L, punctrelspacing);\ +make_lua_key(L, punctuation);\ make_lua_key(L, quad);\ -make_lua_key(L, radbinspacing);\ -make_lua_key(L, radclosespacing);\ -make_lua_key(L, radfracspacing);\ make_lua_key(L, radical);\ make_lua_key(L, radicaldegreeafter);\ make_lua_key(L, radicaldegreebefore);\ @@ -1169,14 +1066,6 @@ make_lua_key(L, RadicalRuleThickness);\ make_lua_key(L, radicalvariant);\ make_lua_key(L, RadicalVerticalGap);\ make_lua_key(L, radicalvgap);\ -make_lua_key(L, radinnerspacing);\ -make_lua_key(L, radmiddlespacing);\ -make_lua_key(L, radopenspacing);\ -make_lua_key(L, radopspacing);\ -make_lua_key(L, radordspacing);\ -make_lua_key(L, radpunctspacing);\ -make_lua_key(L, radradspacing);\ -make_lua_key(L, radrelspacing);\ make_lua_key(L, reader);\ make_lua_key(L, register);\ make_lua_key(L, register_attribute);\ @@ -1198,19 +1087,8 @@ make_lua_key(L, registergluespec);\ make_lua_key(L, registerinteger);\ make_lua_key(L, registermugluespec);\ make_lua_key(L, regular);\ -make_lua_key(L, rel);\ +make_lua_key(L, relation);\ make_lua_key(L, relax);\ -make_lua_key(L, relbinspacing);\ -make_lua_key(L, relclosespacing);\ -make_lua_key(L, relfracspacing);\ -make_lua_key(L, relinnerspacing);\ -make_lua_key(L, relmiddlespacing);\ -make_lua_key(L, relopenspacing);\ -make_lua_key(L, relopspacing);\ -make_lua_key(L, relordspacing);\ -make_lua_key(L, relpunctspacing);\ -make_lua_key(L, relradspacing);\ -make_lua_key(L, relrelspacing);\ make_lua_key(L, remove_item);\ make_lua_key(L, repeat);\ make_lua_key(L, replace);\ @@ -1450,6 +1328,7 @@ make_lua_key(L, vertical);\ make_lua_key(L, verticalmathkern);\ make_lua_key(L, vextensible);\ make_lua_key(L, vextensiblevariant);\ +make_lua_key(L, virtual);\ make_lua_key(L, vlist);\ make_lua_key(L, vmode);\ make_lua_key(L, vmodepar);\ diff --git a/source/luametatex/source/lua/lmtnodelib.c b/source/luametatex/source/lua/lmtnodelib.c index 116860f85..6a07e3454 100644 --- a/source/luametatex/source/lua/lmtnodelib.c +++ b/source/luametatex/source/lua/lmtnodelib.c @@ -2902,6 +2902,27 @@ static int nodelib_direct_getlistdimensions(lua_State *L) return 0; } +static int nodelib_direct_getruledimensions(lua_State *L) +{ + halfword n = nodelib_valid_direct_from_index(L, 1); + if (n && node_type(n) == rule_node) { + if (node_subtype(n) == virtual_rule_subtype) { + lua_pushinteger(L, rule_data(n)); + lua_pushinteger(L, rule_left(n)); + lua_pushinteger(L, rule_right(n)); + lua_pushboolean(L, 1); + } else { + lua_pushinteger(L, rule_width(n)); + lua_pushinteger(L, rule_height(n)); + lua_pushinteger(L, rule_depth(n)); + lua_pushboolean(L, 0); + } + return 4; + } else { + return 0; + } +} + /* node.direct.getlist */ static int nodelib_direct_getlist(lua_State *L) @@ -3541,32 +3562,45 @@ static int nodelib_direct_setlink(lua_State *L) and the nodes themselves can have old values for prev and next, so ... only single nodes are looked at! */ - if (lua_type(L, i) == LUA_TNUMBER) { - halfword c = nodelib_valid_direct_from_index(L, i); /* current node */ - if (c) { - if (c != t) { - if (t) { - node_next(t) = c; - node_prev(c) = t; - } else if (i > 1) { - /* we assume that the first node is a kind of head */ - node_prev(c) = null; - } - t = c; - if (! h) { - h = t; + switch (lua_type(L, i)) { + case LUA_TNUMBER: + { + halfword c = nodelib_valid_direct_from_index(L, i); /* current node */ + if (c) { + if (c != t) { + if (t) { + node_next(t) = c; + node_prev(c) = t; + } else if (i > 1) { + /* we assume that the first node is a kind of head */ + node_prev(c) = null; + } + t = c; + if (! h) { + h = t; + } + } else { + /* we ignore duplicate nodes which can be tails or the previous */ + } + } else { + /* we ignore bad nodes, but we could issue a message */ } - } else { - /* we ignore duplicate nodes which can be tails or the previous */ } - } else { - /* we ignore bad nodes, but we could issue a message */ - } - } else if (t) { - /* safeguard: a nil in the list can be meant as end so we nil the next of tail */ - node_next(t) = null; - } else { - /* we just ignore nil nodes and have no tail yet */ + break; + case LUA_TBOOLEAN: + if (lua_toboolean(L, i)) { + /*tex Just skip this one. */ + break; + } else { + /* fall through */ + } + default: + if (t) { + /* safeguard: a nil in the list can be meant as end so we nil the next of tail */ + node_next(t) = null; + } else { + /* we just ignore nil nodes and have no tail yet */ + } } } nodelib_push_direct_or_nil(L, h); @@ -9758,7 +9792,8 @@ static const struct luaL_Reg nodelib_direct_function_list[] = { { "rangedimensions", nodelib_direct_rangedimensions }, /* maybe get... */ { "getglyphdimensions", nodelib_direct_getglyphdimensions }, { "getkerndimension", nodelib_direct_getkerndimension }, - { "getlistdimensions", nodelib_direct_getlistdimensions }, + { "getlistdimensions", nodelib_direct_getlistdimensions }, + { "getruledimensions", nodelib_direct_getruledimensions }, { "patchattributes", nodelib_direct_patchattributes }, { "remove", nodelib_direct_remove }, { "removefromlist", nodelib_direct_remove_from_list }, diff --git a/source/luametatex/source/luarest/lmtoslibext.c b/source/luametatex/source/luarest/lmtoslibext.c index 0dc5fb940..e49edd5a5 100644 --- a/source/luametatex/source/luarest/lmtoslibext.c +++ b/source/luametatex/source/luarest/lmtoslibext.c @@ -115,15 +115,21 @@ static int oslib_sleep(lua_State *L) osver.dwOSVersionInfoSize = sizeof(osver); GetSystemInfo(&sysinfo); strcpy(uts->sysname, "Windows"); - /* When |GetVersionEx| becomes obsolete the version and release fields will be set to "". */ - GetVersionEx(&osver); - sprintf(uts->version, "%ld.%02ld", osver.dwMajorVersion, osver.dwMinorVersion); - if (osver.szCSDVersion[0] != '\0' && (strlen(osver.szCSDVersion) + strlen(uts->version) + 1) < sizeof(uts->version)) { - strcat(uts->version, " "); - strcat(uts->version, osver.szCSDVersion); - } - sprintf(uts->release, "build %ld", osver.dwBuildNumber & 0xFFFF); - /* So far for the fragile and actually not that relevant part of |uts|. */ + /*tex When |GetVersionEx| becomes obsolete the version and release fields will be set to "". */ + // if (0) { + // GetVersionEx(&osver); + // sprintf(uts->version, "%ld.%02ld", osver.dwMajorVersion, osver.dwMinorVersion); + // if (osver.szCSDVersion[0] != '\0' && (strlen(osver.szCSDVersion) + strlen(uts->version) + 1) < sizeof(uts->version)) { + // strcat(uts->version, " "); + // strcat(uts->version, osver.szCSDVersion); + // } + // sprintf(uts->release, "build %ld", osver.dwBuildNumber & 0xFFFF); + // } else { + /*tex I can't motivate myself to figure this out. */ + strcpy(uts->version, ""); + strcpy(uts->release, ""); + // } + /*tex So far for the fragile and actually not that relevant part of |uts|. */ switch (sysinfo.wProcessorArchitecture) { case PROCESSOR_ARCHITECTURE_AMD64: strcpy(uts->machine, "x86_64"); diff --git a/source/luametatex/source/mp/mpc/mp.c b/source/luametatex/source/mp/mpc/mp.c index d171e07a6..2d0320868 100644 --- a/source/luametatex/source/mp/mpc/mp.c +++ b/source/luametatex/source/mp/mpc/mp.c @@ -9028,11 +9028,21 @@ static mp_knot mp_path_intersection(MP mp, mp_knot h, mp_knot hh, int path, mp_k number_add(nn, unity_t); ll = pp; pp = mp_next_knot(pp); +if (pp != hh && mp_knotstate(pp) == mp_end_knot) { + number_add(nn, unity_t); + ll = pp; + pp = mp_next_knot(pp); +} } while (pp != hh); } number_add(n, unity_t); l = p; p = mp_next_knot(p); +if (p != hh && mp_knotstate(p) == mp_end_knot) { + number_add(n, unity_t); + l = p; + p = mp_next_knot(p); +} } while (p != h); mp->tol_step = mp->tol_step + 3; if (done) { diff --git a/source/luametatex/source/mp/mpw/mp.w b/source/luametatex/source/mp/mpw/mp.w index 5fb24250c..f4bdb58ca 100644 --- a/source/luametatex/source/mp/mpw/mp.w +++ b/source/luametatex/source/mp/mpw/mp.w @@ -13827,11 +13827,25 @@ static mp_knot mp_path_intersection(MP mp, mp_knot h, mp_knot hh, int path, mp_k number_add(nn, unity_t); ll = pp; pp = mp_next_knot(pp); +/* begin experiment HH/MS, maybe a loop */ +if (pp != hh && mp_knotstate(pp) == mp_end_knot) { + number_add(nn, unity_t); + ll = pp; + pp = mp_next_knot(pp); +} +/* end experiment HH/MS */ } while (pp != hh); } number_add(n, unity_t); l = p; p = mp_next_knot(p); +/* begin experiment HH/MS, maybe a loop */ +if (p != hh && mp_knotstate(p) == mp_end_knot) { + number_add(n, unity_t); + l = p; + p = mp_next_knot(p); +} +/* end experiment HH/MS */ } while (p != h); mp->tol_step = mp->tol_step + 3; if (done) { diff --git a/source/luametatex/source/tex/texcommands.c b/source/luametatex/source/tex/texcommands.c index 03bcc34d1..13357a141 100644 --- a/source/luametatex/source/tex/texcommands.c +++ b/source/luametatex/source/tex/texcommands.c @@ -495,10 +495,12 @@ void tex_initialize_commands(void) tex_primitive(tex_command, "vrule", vrule_cmd, normal_rule_code, 0); tex_primitive(luatex_command, "novrule", vrule_cmd, empty_rule_code, 0); + tex_primitive(luatex_command, "virtualvrule", vrule_cmd, virtual_rule_code, 0); tex_primitive(luatex_command, "srule", vrule_cmd, strut_rule_code, 0); tex_primitive(tex_command, "hrule", hrule_cmd, normal_rule_code, 0); tex_primitive(luatex_command, "nohrule", hrule_cmd, empty_rule_code, 0); + tex_primitive(luatex_command, "virtualhrule", hrule_cmd, virtual_rule_code, 0); tex_primitive(tex_command, "count", register_cmd, int_val_level, 0); tex_primitive(luatex_command, "attribute", register_cmd, attr_val_level, 0); diff --git a/source/luametatex/source/tex/texmath.c b/source/luametatex/source/tex/texmath.c index a9f1a3ed9..4979c1a23 100644 --- a/source/luametatex/source/tex/texmath.c +++ b/source/luametatex/source/tex/texmath.c @@ -1691,20 +1691,27 @@ int tex_check_active_math_char(int character) case alignment_tab_cmd: case superscript_cmd: case subscript_cmd: - cur_cmd = code; - cur_chr = character; - cur_tok = token_val(cur_cmd, cur_chr); - if (tracing_commands_par >= 4) { - tex_aux_report_active(4, "control", code, character); - } - return 1; case letter_cmd: case other_char_cmd: + case active_char_cmd: cur_cmd = code; cur_chr = character; cur_tok = token_val(cur_cmd, cur_chr); if (tracing_commands_par >= 4) { - tex_aux_report_active(4, "inject", code, character); + switch (code) { + case alignment_tab_cmd: + case superscript_cmd: + case subscript_cmd: + tex_aux_report_active(4, "control", code, character); + break; + case letter_cmd: + case other_char_cmd: + tex_aux_report_active(4, "inject", code, character); + break; + case active_char_cmd: + tex_aux_report_active(4, "active", code, character); + break; + } } return 1; default: @@ -1754,6 +1761,21 @@ static int tex_aux_scan_active_math_char(mathcodeval *mval, int where) tex_aux_report_active(where, "inject", code, character); } return 0; + case active_char_cmd: + /*tex + We reset the code so that we don't get a loop, whuich means that the macro that + gets invoked has to set the amcode again if needed. + */ + tex_set_am_code(character, other_char_cmd, 0); + cur_cs = tex_active_to_cs(cur_chr, 1); + cur_cmd = eq_type(cur_cs); + cur_chr = eq_value(cur_cs); + tex_x_token(); + tex_back_input(cur_tok); + if (tracing_commands_par >= 4) { + tex_aux_report_active(where, "active", code, character); + } + return 1; default: if (tracing_commands_par >= 4) { tex_aux_report_active(where, "ignore", code, character); @@ -1761,6 +1783,7 @@ static int tex_aux_scan_active_math_char(mathcodeval *mval, int where) return 1; } } else if (mval->class_value == active_math_class_value) { + /*tex We might eventually drop tthis feature in favor of the amcode. */ cur_cs = tex_active_to_cs(cur_chr, 1); cur_cmd = eq_type(cur_cs); cur_chr = eq_value(cur_cs); diff --git a/source/luametatex/source/tex/texmlist.c b/source/luametatex/source/tex/texmlist.c index 79ab490e7..b3f8cf294 100644 --- a/source/luametatex/source/tex/texmlist.c +++ b/source/luametatex/source/tex/texmlist.c @@ -1326,14 +1326,14 @@ static halfword register_extensible(halfword fnt, halfword chr, int size, halfwo { int callback_id = lmt_callback_defined(register_extensible_callback); if (callback_id > 0) { - halfword b = null; - lmt_run_callback(lmt_lua_state.lua_instance, callback_id, "dddN->N", fnt, chr, size, result, &b); - if (b) { - switch (node_type(b)) { + halfword boxed = null; + lmt_run_callback(lmt_lua_state.lua_instance, callback_id, "dddN->N", fnt, chr, size, result, &boxed); + if (boxed) { + switch (node_type(boxed)) { case hlist_node: case vlist_node: - tex_attach_attribute_list_attribute(b, att); - return b; + tex_attach_attribute_list_attribute(boxed, att); /* yes or no */ + return boxed; default: tex_formatted_error("fonts", "invalid extensible character %U registered for font %F, [h|v]list expected", chr, fnt); break; @@ -1425,10 +1425,12 @@ static halfword tex_aux_make_delimiter(halfword target, halfword delimiter, int goto FOUND; } } - if (tex_char_has_tag_from_font(curfnt, curchr, extensible_tag)) { - fnt = curfnt; - chr = curchr; - do_parts = 1; + if (tex_char_has_tag_from_font(curfnt, curchr, extensible_tag)) { + if (flat ? tex_char_has_tag_from_font(curfnt, curchr, horizontal_tag) : tex_char_has_tag_from_font(curfnt, curchr, vertical_tag)) { + fnt = curfnt; + chr = curchr; + do_parts = 1; + } goto FOUND; } else if (count > 1000) { tex_formatted_warning("fonts", "endless loop in extensible character %U of font %F", curchr, curfnt); @@ -2142,7 +2144,6 @@ static void tex_aux_make_over(halfword target, halfword style, halfword size, ha extensibles. The order is: kern, rule, gap, content. */ - halfword result; scaled thickness = tex_get_math_y_parameter_checked(style, math_parameter_overbar_rule); scaled vgap = tex_get_math_y_parameter_checked(style, math_parameter_overbar_vgap); scaled kern = tex_get_math_y_parameter_checked(style, math_parameter_overbar_kern); @@ -2152,14 +2153,16 @@ static void tex_aux_make_over(halfword target, halfword style, halfword size, ha thickness = t; } } - result = tex_aux_overbar( - tex_aux_clean_box(noad_nucleus(target), tex_math_style_variant(style, math_parameter_over_line_variant), style, math_nucleus_list, 0, NULL), - vgap, thickness, kern, - get_attribute_list(noad_nucleus(target)), math_over_rule_subtype, size, fam - ); - node_subtype(result) = math_over_list; - kernel_math_list(noad_nucleus(target)) = result; - node_type(noad_nucleus(target)) = sub_box_node; + { + halfword result = tex_aux_overbar( + tex_aux_clean_box(noad_nucleus(target), tex_math_style_variant(style, math_parameter_over_line_variant), style, math_nucleus_list, 0, NULL), + vgap, thickness, kern, + get_attribute_list(noad_nucleus(target)), math_over_rule_subtype, size, fam + ); + node_subtype(result) = math_over_list; + kernel_math_list(noad_nucleus(target)) = result; + node_type(noad_nucleus(target)) = sub_box_node; + } } static void tex_aux_make_under(halfword target, halfword style, halfword size, halfword fam) @@ -2171,7 +2174,6 @@ static void tex_aux_make_under(halfword target, halfword style, halfword size, h rule, kern. */ - halfword result; scaled thickness = tex_get_math_y_parameter_checked(style, math_parameter_underbar_rule); scaled vgap = tex_get_math_y_parameter_checked(style, math_parameter_underbar_vgap); scaled kern = tex_get_math_y_parameter_checked(style, math_parameter_underbar_kern); @@ -2181,14 +2183,16 @@ static void tex_aux_make_under(halfword target, halfword style, halfword size, h thickness = t; } } - result = tex_aux_underbar( - tex_aux_clean_box(noad_nucleus(target), tex_math_style_variant(style, math_parameter_under_line_variant), style, math_nucleus_list, 0, NULL), - vgap, thickness, kern, - get_attribute_list(noad_nucleus(target)), math_under_rule_subtype, size, fam - ); - node_subtype(result) = math_over_list; - kernel_math_list(noad_nucleus(target)) = result; - node_type(noad_nucleus(target)) = sub_box_node; + { + halfword result = tex_aux_underbar( + tex_aux_clean_box(noad_nucleus(target), tex_math_style_variant(style, math_parameter_under_line_variant), style, math_nucleus_list, 0, NULL), + vgap, thickness, kern, + get_attribute_list(noad_nucleus(target)), math_under_rule_subtype, size, fam + ); + node_subtype(result) = math_over_list; + kernel_math_list(noad_nucleus(target)) = result; + node_type(noad_nucleus(target)) = sub_box_node; + } } /*tex diff --git a/source/luametatex/source/tex/texnodes.c b/source/luametatex/source/tex/texnodes.c index 27b9520e3..625a4346b 100644 --- a/source/luametatex/source/tex/texnodes.c +++ b/source/luametatex/source/tex/texnodes.c @@ -204,6 +204,7 @@ void lmt_nodelib_initialize(void) { set_value_entry_key(subtypes_rule, math_radical_rule_subtype, radical) set_value_entry_key(subtypes_rule, box_rule_subtype, box) set_value_entry_key(subtypes_rule, image_rule_subtype, image) + set_value_entry_key(subtypes_rule, virtual_rule_subtype, virtual) subtypes_glyph = lmt_aux_allocate_value_info(glyph_math_accent_subtype); @@ -212,13 +213,13 @@ void lmt_nodelib_initialize(void) { set_value_entry_key(subtypes_glyph, glyph_ligature_subtype, ligature) set_value_entry_key(subtypes_glyph, glyph_math_delimiter_subtype, delimiter); set_value_entry_key(subtypes_glyph, glyph_math_extensible_subtype, extensible); - set_value_entry_key(subtypes_glyph, glyph_math_ordinary_subtype, ord); - set_value_entry_key(subtypes_glyph, glyph_math_operator_subtype, op); - set_value_entry_key(subtypes_glyph, glyph_math_binary_subtype, bin); - set_value_entry_key(subtypes_glyph, glyph_math_relation_subtype, rel); + set_value_entry_key(subtypes_glyph, glyph_math_ordinary_subtype, ordinary); + set_value_entry_key(subtypes_glyph, glyph_math_operator_subtype, operator); + set_value_entry_key(subtypes_glyph, glyph_math_binary_subtype, binary); + set_value_entry_key(subtypes_glyph, glyph_math_relation_subtype, relation); set_value_entry_key(subtypes_glyph, glyph_math_open_subtype, open); set_value_entry_key(subtypes_glyph, glyph_math_close_subtype, close); - set_value_entry_key(subtypes_glyph, glyph_math_punctuation_subtype, punct); + set_value_entry_key(subtypes_glyph, glyph_math_punctuation_subtype, punctuation); set_value_entry_key(subtypes_glyph, glyph_math_variable_subtype, variable); set_value_entry_key(subtypes_glyph, glyph_math_active_subtype, active); set_value_entry_key(subtypes_glyph, glyph_math_inner_subtype, inner); @@ -307,13 +308,13 @@ void lmt_nodelib_initialize(void) { subtypes_noad = lmt_aux_allocate_value_info(vcenter_noad_subtype); // last_noad_subtype - set_value_entry_key(subtypes_noad, ordinary_noad_subtype, ord) - set_value_entry_key(subtypes_noad, operator_noad_subtype, op) - set_value_entry_key(subtypes_noad, binary_noad_subtype, bin) - set_value_entry_key(subtypes_noad, relation_noad_subtype, rel) + set_value_entry_key(subtypes_noad, ordinary_noad_subtype, ordinary) + set_value_entry_key(subtypes_noad, operator_noad_subtype, operator) + set_value_entry_key(subtypes_noad, binary_noad_subtype, binary) + set_value_entry_key(subtypes_noad, relation_noad_subtype, relation) set_value_entry_key(subtypes_noad, open_noad_subtype, open) set_value_entry_key(subtypes_noad, close_noad_subtype, close) - set_value_entry_key(subtypes_noad, punctuation_noad_subtype, punct) + set_value_entry_key(subtypes_noad, punctuation_noad_subtype, punctuation) set_value_entry_key(subtypes_noad, variable_noad_subtype, variable) set_value_entry_key(subtypes_noad, active_noad_subtype, active) set_value_entry_key(subtypes_noad, inner_noad_subtype, inner) diff --git a/source/luametatex/source/tex/texnodes.h b/source/luametatex/source/tex/texnodes.h index 093978c4e..113de8f40 100644 --- a/source/luametatex/source/tex/texnodes.h +++ b/source/luametatex/source/tex/texnodes.h @@ -79,6 +79,13 @@ - radical - boundary + Before we went on with \LUAMETATEX\ already quite a bit was added to \LUATEX\ (granularity in + subtypes, more of them, etc.) but here we add more. Some day I might make a list of difference + just for historic reasons. Don't assume equivalence: some in \LUATEX\ was sort of experimental + and improved over time and maybe should not have been added to \LUATEX\ at all and been delayed + for \LUAMETATEX\ instead (as it's probably not used), so that core \LUATEX\ stayed closer the + other engines. + */ typedef enum node_types { @@ -966,6 +973,7 @@ typedef enum rule_subtypes { empty_rule_subtype, strut_rule_subtype, outline_rule_subtype, + virtual_rule_subtype, user_rule_subtype, math_over_rule_subtype, math_under_rule_subtype, @@ -978,7 +986,8 @@ typedef enum rule_subtypes { typedef enum rule_codes { normal_rule_code, empty_rule_code, - strut_rule_code, + virtual_rule_code, + strut_rule_code } rule_codes; # define last_rule_subtype image_rule_subtype diff --git a/source/luametatex/source/tex/texrules.c b/source/luametatex/source/tex/texrules.c index b3d069ad3..db993585b 100644 --- a/source/luametatex/source/tex/texrules.c +++ b/source/luametatex/source/tex/texrules.c @@ -4,19 +4,19 @@ # include "luametatex.h" -halfword tex_aux_scan_rule_spec(rule_types t, halfword s) +halfword tex_aux_scan_rule_spec(rule_types type, halfword code) { /*tex |width|, |depth|, and |height| all equal |null_flag| now */ - halfword rule = tex_new_rule_node((quarterword) s); + halfword rule = tex_new_rule_node((quarterword) code); halfword attr = node_attr(rule); - switch (t) { + switch (type) { case h_rule_type: rule_height(rule) = default_rule; rule_depth(rule) = 0; break; case v_rule_type: case m_rule_type: - if (s == strut_rule_code) { + if (code == strut_rule_code) { rule_width(rule) = 0; node_subtype(rule) = strut_rule_subtype; } else { @@ -124,9 +124,18 @@ halfword tex_aux_scan_rule_spec(rule_types t, halfword s) } DONE: node_attr(rule) = attr; - if (t == v_rule_type && s == strut_rule_code) { + if (type == v_rule_type && code == strut_rule_code) { tex_aux_check_text_strut_rule(rule, text_style); } + if (code == virtual_rule_code) { + rule_data(rule) = rule_width(rule); + rule_left(rule) = rule_height(rule); + rule_right(rule) = rule_depth(rule); + rule_width(rule) = 0; + rule_height(rule) = 0; + rule_depth(rule) = 0; + node_subtype(rule) = virtual_rule_subtype; + } return rule; } |