summaryrefslogtreecommitdiff
path: root/source/luametatex
diff options
context:
space:
mode:
Diffstat (limited to 'source/luametatex')
-rw-r--r--source/luametatex/cmake/lua.cmake14
-rw-r--r--source/luametatex/source/lua/lmtinterface.h1
-rw-r--r--source/luametatex/source/lua/lmttexlib.c3
-rw-r--r--source/luametatex/source/luacore/lua54/src/llimits.h21
-rw-r--r--source/luametatex/source/luacore/lua54/src/loslib.c17
-rw-r--r--source/luametatex/source/luacore/lua54/src/luaconf.h6
-rw-r--r--source/luametatex/source/tex/texalign.c4
-rw-r--r--source/luametatex/source/tex/texcommands.c4
-rw-r--r--source/luametatex/source/tex/texmaincontrol.c4
-rw-r--r--source/luametatex/source/tex/texmath.c252
-rw-r--r--source/luametatex/source/tex/texmlist.c68
-rw-r--r--source/luametatex/source/tex/texnodes.h133
12 files changed, 357 insertions, 170 deletions
diff --git a/source/luametatex/cmake/lua.cmake b/source/luametatex/cmake/lua.cmake
index 7c7eac35d..a31f1c8b0 100644
--- a/source/luametatex/cmake/lua.cmake
+++ b/source/luametatex/cmake/lua.cmake
@@ -82,13 +82,13 @@ if (NOT MSVC)
)
endif (NOT MSVC)
-if (CMAKE_HOST_APPLE)
- target_compile_definitions(lua PUBLIC
- TARGET_OS_IOS=0
- TARGET_OS_WATCH=0
- TARGET_OS_TV=0
- )
-endif (CMAKE_HOST_APPLE)
+# if (CMAKE_HOST_APPLE)
+# target_compile_definitions(lua PUBLIC
+# TARGET_OS_IOS=0
+# TARGET_OS_WATCH=0
+# TARGET_OS_TV=0
+# )
+# endif (CMAKE_HOST_APPLE)
# this seems to be ok for mingw default
#
diff --git a/source/luametatex/source/lua/lmtinterface.h b/source/luametatex/source/lua/lmtinterface.h
index c3ea2a184..59ef808c8 100644
--- a/source/luametatex/source/lua/lmtinterface.h
+++ b/source/luametatex/source/lua/lmtinterface.h
@@ -472,6 +472,7 @@ make_lua_key(L, attributelist);\
make_lua_key(L, auto);\
make_lua_key(L, automatic);\
make_lua_key(L, automaticpenalty);\
+make_lua_key(L, autobase);\
make_lua_key(L, axis);\
make_lua_key(L, AxisHeight);\
make_lua_key(L, baselineskip);\
diff --git a/source/luametatex/source/lua/lmttexlib.c b/source/luametatex/source/lua/lmttexlib.c
index ecc0d63ed..0afd6cdf6 100644
--- a/source/luametatex/source/lua/lmttexlib.c
+++ b/source/luametatex/source/lua/lmttexlib.c
@@ -4829,7 +4829,7 @@ static int texlib_getglyphoptionvalues(lua_State *L)
static int texlib_getnoadoptionvalues(lua_State *L)
{
- lua_createtable(L, 2, 32);
+ lua_createtable(L, 2, 34);
lua_push_key_at_index(L, axis, noad_option_axis);
lua_push_key_at_index(L, noaxis, noad_option_no_axis);
lua_push_key_at_index(L, exact, noad_option_exact);
@@ -4865,6 +4865,7 @@ static int texlib_getnoadoptionvalues(lua_State *L)
lua_push_key_at_index(L, sourceonnucleus, noad_option_source_on_nucleus);
lua_push_key_at_index(L, fixedsuperorsubscript, noad_option_fixed_super_or_sub_script);
lua_push_key_at_index(L, fixedsuperandsubscript, noad_option_fixed_super_and_sub_script);
+ lua_push_key_at_index(L, autobase, noad_option_auto_base);
return 1;
}
diff --git a/source/luametatex/source/luacore/lua54/src/llimits.h b/source/luametatex/source/luacore/lua54/src/llimits.h
index 52a32f92e..251a27021 100644
--- a/source/luametatex/source/luacore/lua54/src/llimits.h
+++ b/source/luametatex/source/luacore/lua54/src/llimits.h
@@ -71,11 +71,24 @@ typedef signed char ls_byte;
/*
-** conversion of pointer to unsigned integer:
-** this is for hashing only; there is no problem if the integer
-** cannot hold the whole pointer value
+** conversion of pointer to unsigned integer: this is for hashing only;
+** there is no problem if the integer cannot hold the whole pointer
+** value. (In strict ISO C this may cause undefined behavior, but no
+** actual machine seems to bother.)
*/
-#define point2uint(p) ((unsigned int)((size_t)(p) & UINT_MAX))
+#if !defined(LUA_USE_C89) && defined(__STDC_VERSION__) && \
+ __STDC_VERSION__ >= 199901L
+#include <stdint.h>
+#if defined(UINTPTR_MAX) /* even in C99 this type is optional */
+#define L_P2I uintptr_t
+#else /* no 'intptr'? */
+#define L_P2I uintmax_t /* use the largerst available integer */
+#endif
+#else /* C89 option */
+#define L_P2I size_t
+#endif
+
+#define point2uint(p) ((unsigned int)((L_P2I)(p) & UINT_MAX))
diff --git a/source/luametatex/source/luacore/lua54/src/loslib.c b/source/luametatex/source/luacore/lua54/src/loslib.c
index 7eb05cafd..89ac06bc4 100644
--- a/source/luametatex/source/luacore/lua54/src/loslib.c
+++ b/source/luametatex/source/luacore/lua54/src/loslib.c
@@ -138,21 +138,14 @@
/* }================================================================== */
-/*
-** Despite claiming to be ISO, the C library in some Apple platforms
-** does not implement 'system'.
-*/
-#if !defined(l_system) && defined(__APPLE__) /* { */
-#include "TargetConditionals.h"
-#if TARGET_OS_IOS || TARGET_OS_WATCH || TARGET_OS_TV
-#define l_system(cmd) ((cmd) == NULL ? 0 : -1)
-#endif
-#endif /* } */
-
#if !defined(l_system)
+#if defined(LUA_USE_IOS)
+/* Despite claiming to be ISO C, iOS does not implement 'system'. */
+#define l_system(cmd) ((cmd) == NULL ? 0 : -1)
+#else
#define l_system(cmd) system(cmd) /* default definition */
#endif
-
+#endif
static int os_execute (lua_State *L) {
diff --git a/source/luametatex/source/luacore/lua54/src/luaconf.h b/source/luametatex/source/luacore/lua54/src/luaconf.h
index e4650fbce..137103ede 100644
--- a/source/luametatex/source/luacore/lua54/src/luaconf.h
+++ b/source/luametatex/source/luacore/lua54/src/luaconf.h
@@ -70,6 +70,12 @@
#endif
+#if defined(LUA_USE_IOS)
+#define LUA_USE_POSIX
+#define LUA_USE_DLOPEN
+#endif
+
+
/*
@@ LUAI_IS32INT is true iff 'int' has (at least) 32 bits.
*/
diff --git a/source/luametatex/source/tex/texalign.c b/source/luametatex/source/tex/texalign.c
index 4ea4879c2..7a1045fea 100644
--- a/source/luametatex/source/tex/texalign.c
+++ b/source/luametatex/source/tex/texalign.c
@@ -971,7 +971,7 @@ void tex_run_alignment_initialize(void)
token_link(current) = null;
while (1) {
tex_aux_get_preamble_token();
- if (cur_cmd == parameter_cmd || (cur_cmd == alignment_cmd && cur_chr == align_content_code)) {
+ if ((cur_cmd == alignment_cmd && cur_chr == align_content_code) || cur_cmd == parameter_cmd) {
break;
} else if ((cur_cmd == alignment_cmd || cur_cmd == alignment_tab_cmd) && (lmt_input_state.align_state == -1000000)) {
if ((current == lmt_alignment_state.hold_token_head) && (! lmt_alignment_state.cur_loop) && (cur_cmd == alignment_tab_cmd)) {
@@ -1004,7 +1004,7 @@ void tex_run_alignment_initialize(void)
tex_aux_get_preamble_token();
if ((cur_cmd == alignment_cmd || cur_cmd == alignment_tab_cmd) && (lmt_input_state.align_state == -1000000)) {
break;
- } else if (cur_cmd == parameter_cmd || (cur_cmd == alignment_cmd && cur_chr == align_content_code)) {
+ } else if ((cur_cmd == alignment_cmd && cur_chr == align_content_code) || cur_cmd == parameter_cmd) {
tex_handle_error(
normal_error_type,
"Only one # is allowed per tab",
diff --git a/source/luametatex/source/tex/texcommands.c b/source/luametatex/source/tex/texcommands.c
index eaf2c7bbd..e52825b33 100644
--- a/source/luametatex/source/tex/texcommands.c
+++ b/source/luametatex/source/tex/texcommands.c
@@ -1056,8 +1056,8 @@ void tex_initialize_commands(void)
tex_primitive(tex_command, "unvcopy", un_vbox_cmd, copy_code, 0);
tex_primitive(luatex_command, "unvpack", un_vbox_cmd, unpack_code, 0);
- tex_primitive(etex_command, "pagediscards", un_vbox_cmd, page_discards_code, 0);
- tex_primitive(etex_command, "splitdiscards", un_vbox_cmd, split_discards_code, 0);
+ tex_primitive(etex_command, "pagediscards", un_vbox_cmd, page_discards_code, 0);
+ tex_primitive(etex_command, "splitdiscards", un_vbox_cmd, split_discards_code, 0);
tex_primitive(luatex_command, "insertunbox", un_vbox_cmd, insert_box_code, 0);
tex_primitive(luatex_command, "insertuncopy", un_vbox_cmd, insert_copy_code, 0);
diff --git a/source/luametatex/source/tex/texmaincontrol.c b/source/luametatex/source/tex/texmaincontrol.c
index c15704129..783de2b8b 100644
--- a/source/luametatex/source/tex/texmaincontrol.c
+++ b/source/luametatex/source/tex/texmaincontrol.c
@@ -4558,8 +4558,8 @@ static void tex_aux_set_def(int a, int force)
if (is_constant(a)) {
/* todo: check if already defined or just accept a leak */
set_token_reference(t, max_token_reference);
- } else if (! token_link(t)) {
- t = lmt_token_state.empty; /* maybe in tex_define */
+ // } else if (! token_link(t)) {
+ // t = lmt_token_state.empty; /* leaks */
}
tex_define(a, p, tex_flags_to_cmd(a), t);
}
diff --git a/source/luametatex/source/tex/texmath.c b/source/luametatex/source/tex/texmath.c
index 4979c1a23..0820b2405 100644
--- a/source/luametatex/source/tex/texmath.c
+++ b/source/luametatex/source/tex/texmath.c
@@ -2876,6 +2876,132 @@ void tex_finish_math_radical(void)
}
}
+// void tex_run_math_accent(void)
+// {
+// mathcodeval t = tex_no_math_code();
+// mathcodeval b = tex_no_math_code();
+// mathcodeval o = tex_no_math_code();
+// halfword code = cur_chr;
+// halfword accent = tex_new_node(accent_noad, bothflexible_accent_subtype);
+// quarterword subtype = ordinary_noad_subtype;
+// halfword attrlist = null;
+// if (cur_cmd == accent_cmd) {
+// tex_handle_error(
+// normal_error_type,
+// "Please use \\mathaccent for accents in math mode",
+// "I'm changing \\accent to \\mathaccent here; wish me luck. (Accents are not the\n"
+// "same in formulas as they are in text.)" );
+// }
+// tex_tail_append(accent);
+// switch (code) {
+// case math_accent_code:
+// /*tex |\mathaccent| */
+// t = tex_scan_mathchar(tex_mathcode);
+// break;
+// case math_uaccent_code:
+// /*tex |\Umathaccent| */
+// while (1) {
+// switch (tex_scan_character("abnsfABNSF", 0, 1, 0)) {
+// case 'a': case 'A':
+// if (tex_scan_mandate_keyword("attr", 1)) {
+// attrlist = tex_scan_attribute(attrlist);
+// }
+// break;
+// case 's': case 'S':
+// if (tex_scan_mandate_keyword("source", 1)) {
+// noad_source(accent) = tex_scan_int(0, NULL);
+// }
+// break;
+// case 'f': case 'F':
+// if (tex_scan_mandate_keyword("fraction", 1)) {
+// accent_fraction(accent) = tex_scan_int(0, NULL);
+// }
+// break;
+// case 'n': case 'N':
+// if (tex_scan_mandate_keyword("nooverflow", 1)) {
+// /*tex
+// Actually there never is an overflow but for consistency we do
+// accept this key. Mayebe in the future it will be used.
+// */
+// noad_options(accent) |= noad_option_no_overflow;
+// }
+// break;
+// case 'b': case 'B':
+// if (tex_scan_mandate_keyword("base", 1)) {
+// noad_options(accent) |= noad_option_auto_base;
+// }
+// break;
+// default:
+// goto DONE;
+// }
+// }
+// DONE:
+// /* todo: integrate in the above */
+// if (tex_scan_keyword("fixed")) {
+// /*tex top */
+// node_subtype(accent) = fixedtop_accent_subtype;
+// t = tex_scan_mathchar(umath_mathcode);
+// } else if (tex_scan_keyword("both")) {
+// /*tex top bottom */
+// if (tex_scan_keyword("fixed")) {
+// node_subtype(accent) = fixedtop_accent_subtype;
+// }
+// t = tex_scan_mathchar(umath_mathcode);
+// if (tex_scan_keyword("fixed")) {
+// node_subtype(accent) = fixedboth_accent_subtype;
+// }
+// b = tex_scan_mathchar(umath_mathcode);
+// } else if (tex_scan_keyword("bottom")) {
+// /*tex bottom */
+// if (tex_scan_keyword("fixed")) {
+// node_subtype(accent) = fixedbottom_accent_subtype;
+// }
+// b = tex_scan_mathchar(umath_mathcode);
+// } else if (tex_scan_keyword("top")) {
+// /*tex top */
+// if (tex_scan_keyword("fixed")) {
+// node_subtype(accent) = fixedtop_accent_subtype;
+// }
+// t = tex_scan_mathchar(umath_mathcode);
+// } else if (tex_scan_keyword("overlay")) {
+// /* overlay */
+// if (tex_scan_keyword("fixed")) {
+// node_subtype(accent) = fixedtop_accent_subtype;
+// }
+// o = tex_scan_mathchar(umath_mathcode);
+// } else {
+// /*tex top */
+// t = tex_scan_mathchar(umath_mathcode);
+// }
+// break;
+// default:
+// tex_confusion("scan math accent");
+// }
+// if (attrlist) {
+// tex_attach_attribute_list_attribute(accent, attrlist);
+// }
+// if (! (t.character_value == 0 && t.family_value == 0)) {
+// halfword n = tex_new_node(math_char_node, 0);
+// subtype = tex_aux_set_math_char(n, &t, NULL);
+// accent_top_character(accent) = n;
+// }
+// if (! (b.character_value == 0 && b.family_value == 0)) {
+// halfword n = tex_new_node(math_char_node, 0);
+// subtype = tex_aux_set_math_char(n, &b, NULL);
+// accent_bottom_character(accent) = n;
+// }
+// if (! (o.character_value == 0 && o.family_value == 0)) {
+// halfword n = tex_new_node(math_char_node, 0);
+// subtype = tex_aux_set_math_char(n, &o, NULL);
+// accent_middle_character(accent) = n;
+// }
+// {
+// halfword n = tex_new_node(math_char_node, subtype);
+// noad_nucleus(accent) = n;
+// tex_aux_scan_math(n, tex_math_style_variant(cur_list.math_style, math_parameter_accent_variant), 0, 0, 0, 0, unset_noad_class, unset_noad_class);
+// }
+// }
+
void tex_run_math_accent(void)
{
mathcodeval t = tex_no_math_code();
@@ -2901,7 +3027,7 @@ void tex_run_math_accent(void)
case math_uaccent_code:
/*tex |\Umathaccent| */
while (1) {
- switch (tex_scan_character("ansfASFN", 0, 1, 0)) {
+ switch (tex_scan_character("abnsftoABNSFTO", 0, 1, 0)) {
case 'a': case 'A':
if (tex_scan_mandate_keyword("attr", 1)) {
attrlist = tex_scan_attribute(attrlist);
@@ -2913,10 +3039,23 @@ void tex_run_math_accent(void)
}
break;
case 'f': case 'F':
- if (tex_scan_mandate_keyword("fraction", 1)) {
- accent_fraction(accent) = tex_scan_int(0, NULL);
+ switch (tex_scan_character("frFR", 0, 0, 0)) {
+ case 'r': case 'R':
+ if (tex_scan_mandate_keyword("fraction", 2)) {
+ accent_fraction(accent) = tex_scan_int(0, NULL);
+ }
+ break;
+ case 'f': case 'F':
+ /*tex fixed <char> */
+ if (tex_scan_mandate_keyword("fixed", 2)) {
+ node_subtype(accent) = fixedtop_accent_subtype;
+ t = tex_scan_mathchar(umath_mathcode);
+ }
+ goto DONE;
+ default:
+ tex_aux_show_keyword_error("fraction|fixed");
+ goto DONE;
}
- break;
case 'n': case 'N':
if (tex_scan_mandate_keyword("nooverflow", 1)) {
/*tex
@@ -2926,52 +3065,79 @@ void tex_run_math_accent(void)
noad_options(accent) |= noad_option_no_overflow;
}
break;
+ case 'b': case 'B':
+ switch (tex_scan_character("aoAo", 0, 0, 0)) {
+ case 'a': case 'A':
+ if (tex_scan_mandate_keyword("base", 2)) {
+ noad_options(accent) |= noad_option_auto_base;
+ }
+ break;
+ case 'o': case 'O':
+ /*tex bottom [fixed] <char> */
+ /*tex both [fixed] <char> [fixed] <char> */
+ if (tex_scan_character("t", 0, 0, 0)) {
+ switch (tex_scan_character("thTH", 0, 0, 0)) {
+ case 'h': case 'H':
+ if (tex_scan_mandate_keyword("both", 4)) {
+ /*tex top bottom */
+ if (tex_scan_keyword("fixed")) {
+ node_subtype(accent) = fixedtop_accent_subtype;
+ }
+ t = tex_scan_mathchar(umath_mathcode);
+ if (tex_scan_keyword("fixed")) {
+ node_subtype(accent) = fixedboth_accent_subtype;
+ }
+ b = tex_scan_mathchar(umath_mathcode);
+ }
+ goto DONE;
+ case 't': case 'T':
+ if (tex_scan_mandate_keyword("bottom", 4)) {
+ /*tex bottom */
+ if (tex_scan_keyword("fixed")) {
+ node_subtype(accent) = fixedbottom_accent_subtype;
+ }
+ b = tex_scan_mathchar(umath_mathcode);
+ }
+ goto DONE;
+ default:
+ tex_aux_show_keyword_error("both|bottom");
+ goto DONE;
+ }
+ }
+ goto DONE;
+ default:
+ tex_aux_show_keyword_error("base|both|bottom");
+ goto DONE;
+ }
+ break;
+ case 't': case 'T':
+ /*tex top [fixed] <char> */
+ if (tex_scan_mandate_keyword("top", 1)) {
+ if (tex_scan_keyword("fixed")) {
+ node_subtype(accent) = fixedtop_accent_subtype;
+ }
+ t = tex_scan_mathchar(umath_mathcode);
+ }
+ goto DONE;
+ case 'o': case 'O':
+ /*tex overlay [fixed] <char> */
+ if (tex_scan_mandate_keyword("overlay", 1)) {
+ if (tex_scan_keyword("fixed")) {
+ node_subtype(accent) = fixedtop_accent_subtype;
+ }
+ o = tex_scan_mathchar(umath_mathcode);
+ }
+ goto DONE;
default:
+ /*tex top <char> */
+ t = tex_scan_mathchar(umath_mathcode);
goto DONE;
}
}
- DONE:
- /* todo: integrate in the above */
- if (tex_scan_keyword("fixed")) {
- /*tex top */
- node_subtype(accent) = fixedtop_accent_subtype;
- t = tex_scan_mathchar(umath_mathcode);
- } else if (tex_scan_keyword("both")) {
- /*tex top bottom */
- if (tex_scan_keyword("fixed")) {
- node_subtype(accent) = fixedtop_accent_subtype;
- }
- t = tex_scan_mathchar(umath_mathcode);
- if (tex_scan_keyword("fixed")) {
- node_subtype(accent) = fixedboth_accent_subtype;
- }
- b = tex_scan_mathchar(umath_mathcode);
- } else if (tex_scan_keyword("bottom")) {
- /*tex bottom */
- if (tex_scan_keyword("fixed")) {
- node_subtype(accent) = fixedbottom_accent_subtype;
- }
- b = tex_scan_mathchar(umath_mathcode);
- } else if (tex_scan_keyword("top")) {
- /*tex top */
- if (tex_scan_keyword("fixed")) {
- node_subtype(accent) = fixedtop_accent_subtype;
- }
- t = tex_scan_mathchar(umath_mathcode);
- } else if (tex_scan_keyword("overlay")) {
- /* overlay */
- if (tex_scan_keyword("fixed")) {
- node_subtype(accent) = fixedtop_accent_subtype;
- }
- o = tex_scan_mathchar(umath_mathcode);
- } else {
- /*tex top */
- t = tex_scan_mathchar(umath_mathcode);
- }
- break;
default:
tex_confusion("scan math accent");
}
+ DONE:
if (attrlist) {
tex_attach_attribute_list_attribute(accent, attrlist);
}
diff --git a/source/luametatex/source/tex/texmlist.c b/source/luametatex/source/tex/texmlist.c
index b3f8cf294..d7c37e47a 100644
--- a/source/luametatex/source/tex/texmlist.c
+++ b/source/luametatex/source/tex/texmlist.c
@@ -1136,13 +1136,12 @@ halfword tex_make_extensible(halfword fnt, halfword chr, scaled target, scaled m
if (overlap < initial) {
initial = overlap;
}
- // if (advance == 0) {
- // /*tex for tfm fonts (so no need for scaling) */
- // advance = tex_aux_math_x_size_scaled(fnt, tex_char_width_from_font(fnt, e->glyph), size); /* todo: combine */
- if (advance <= 0) {
- tex_formatted_error("fonts", "bad horizontal extensible character %i in font %i", chr, fnt);
- }
- // }
+ if (advance == 0) {
+ advance = tex_aux_math_x_size_scaled(fnt, tex_char_width_from_font(fnt, e->glyph), size); /* todo: combine */
+ }
+ if (advance <= 0) {
+ tex_formatted_error("fonts", "bad horizontal extensible character %i in font %i", chr, fnt);
+ }
max_natural += advance - initial;
overlap = tex_aux_math_x_size_scaled(fnt, e->end_overlap, size);
} else {
@@ -1156,13 +1155,12 @@ halfword tex_make_extensible(halfword fnt, halfword chr, scaled target, scaled m
if (overlap < initial) {
initial = overlap;
}
- // if (advance == 0) {
- // /*tex for tfm fonts (so no need for scaling) */
- // advance = tex_aux_math_x_size_scaled(fnt, tex_char_width_from_font(fnt, e->glyph), size); /* todo: combine */
- if (advance <= 0) {
- tex_formatted_error("fonts", "bad horizontal extensible character %i in font %i", chr, fnt);
- }
- // }
+ if (advance == 0) {
+ advance = tex_aux_math_x_size_scaled(fnt, tex_char_width_from_font(fnt, e->glyph), size); /* todo: combine */
+ }
+ if (advance <= 0) {
+ tex_formatted_error("fonts", "bad horizontal extensible character %i in font %i", chr, fnt);
+ }
max_natural += advance - initial;
overlap = tex_aux_math_x_size_scaled(fnt, e->end_overlap, size);
pieces--;
@@ -1180,12 +1178,12 @@ halfword tex_make_extensible(halfword fnt, halfword chr, scaled target, scaled m
if (overlap < initial) {
initial = overlap;
}
- // if (advance == 0) {
- // advance = tex_aux_math_y_size_scaled(fnt, tex_char_total_from_font(fnt, e->glyph), size); /* todo: combine */
- if (advance <= 0) {
- tex_formatted_error("fonts", "bad vertical extensible character %i in font %i", chr, fnt);
- }
- // }
+ if (advance == 0) {
+ advance = tex_aux_math_y_size_scaled(fnt, tex_char_total_from_font(fnt, e->glyph), size); /* todo: combine */
+ }
+ if (advance <= 0) {
+ tex_formatted_error("fonts", "bad vertical extensible character %i in font %i", chr, fnt);
+ }
max_natural += advance - initial;
overlap = tex_aux_math_y_size_scaled(fnt, e->end_overlap, size);
} else {
@@ -1199,12 +1197,12 @@ halfword tex_make_extensible(halfword fnt, halfword chr, scaled target, scaled m
if (overlap < initial) {
initial = overlap;
}
- // if (advance == 0) {
- // advance = tex_aux_math_y_size_scaled(fnt, tex_char_total_from_font(fnt, e->glyph), size); /* todo: combine */
- if (advance <= 0) {
- tex_formatted_error("fonts", "bad vertical extensible character %i in font %i", chr, fnt);
- }
- // }
+ if (advance == 0) {
+ advance = tex_aux_math_y_size_scaled(fnt, tex_char_total_from_font(fnt, e->glyph), size); /* todo: combine */
+ }
+ if (advance <= 0) {
+ tex_formatted_error("fonts", "bad vertical extensible character %i in font %i", chr, fnt);
+ }
max_natural += advance - initial;
overlap = tex_aux_math_y_size_scaled(fnt, e->end_overlap, size);
pieces--;
@@ -1426,10 +1424,13 @@ static halfword tex_aux_make_delimiter(halfword target, halfword delimiter, int
}
}
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;
+ if (tex_char_has_tag_from_font(curfnt, curchr, horizontal_tag) || tex_char_has_tag_from_font(curfnt, curchr, vertical_tag)) {
+ /*tex We only check when we are explicit. */
+ 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) {
@@ -2745,7 +2746,7 @@ typedef enum math_accent_location_codes {
top_accent_code = 1,
bot_accent_code = 2,
overlay_accent_code = 4,
- stretch_accent_code = 8,
+ stretch_accent_code = 8, /* reserved, not yet set */
} math_accent_location_codes;
static int tex_aux_compute_accent_skew(halfword target, int flags, scaled *skew, halfword size)
@@ -2982,8 +2983,11 @@ static void tex_aux_do_make_math_accent(halfword target, halfword accentfnt, hal
}
}
}
+ if (has_noad_option_auto_base(target)) {
+ b = - box_depth(accent);
+ }
if (b != undefined_math_parameter) {
- /* not okay */
+ /* not okay but interesting with negative values */
delta = baseheight < b ? baseheight : b;
}
if (u != undefined_math_parameter) {
diff --git a/source/luametatex/source/tex/texnodes.h b/source/luametatex/source/tex/texnodes.h
index 113de8f40..e19ff933d 100644
--- a/source/luametatex/source/tex/texnodes.h
+++ b/source/luametatex/source/tex/texnodes.h
@@ -1743,46 +1743,47 @@ typedef struct noad_classes {
// # else
typedef enum noad_options {
// # endif
- noad_option_axis = 0x000000001,
- noad_option_no_axis = 0x000000002,
- noad_option_exact = 0x000000004,
- noad_option_left = 0x000000008, /* align option for overflown under/over */ /* used ? */
- noad_option_middle = 0x000000010, /* idem */
- noad_option_right = 0x000000020, /* idem */
- noad_option_adapt_to_left_size = 0x000000040, /* old trickery, might go away but kind of fun */
- noad_option_adapt_to_right_size = 0x000000080, /* idem */
- noad_option_no_sub_script = 0x000000100,
- noad_option_no_super_script = 0x000000200,
- noad_option_no_sub_pre_script = 0x000000400,
- noad_option_no_super_pre_script = 0x000000800,
- noad_option_no_script = 0x000001000,
- noad_option_no_overflow = 0x000002000, /* keep (middle) extensible widthin target size */
- noad_option_void = 0x000004000, /* wipe and set width to zero */
- noad_option_phantom = 0x000008000, /* wipe */
- noad_option_openup_height = 0x000010000,
- noad_option_openup_depth = 0x000020000,
- noad_option_limits = 0x000040000, /* traditional modifier */
- noad_option_no_limits = 0x000080000, /* idem */
- noad_option_prefer_font_thickness = 0x000100000,
- noad_option_no_ruling = 0x000200000,
- noad_option_shifted_sub_script = 0x000400000,
- noad_option_shifted_super_script = 0x000800000,
- noad_option_shifted_sub_pre_script = 0x001000000,
- noad_option_shifted_super_pre_script = 0x002000000,
- noad_option_unpack_list = 0x004000000,
- noad_option_no_check = 0x008000000, /* don't check for missing end fence */
- noad_option_auto = 0x010000000,
- noad_option_unroll_list = 0x020000000,
- noad_option_followed_by_space = 0x040000000,
- noad_option_proportional = 0x080000000,
+ noad_option_axis = 0x0000000001,
+ noad_option_no_axis = 0x0000000002,
+ noad_option_exact = 0x0000000004,
+ noad_option_left = 0x0000000008, /* align option for overflown under/over */ /* used ? */
+ noad_option_middle = 0x0000000010, /* idem */
+ noad_option_right = 0x0000000020, /* idem */
+ noad_option_adapt_to_left_size = 0x0000000040, /* old trickery, might go away but kind of fun */
+ noad_option_adapt_to_right_size = 0x0000000080, /* idem */
+ noad_option_no_sub_script = 0x0000000100,
+ noad_option_no_super_script = 0x0000000200,
+ noad_option_no_sub_pre_script = 0x0000000400,
+ noad_option_no_super_pre_script = 0x0000000800,
+ noad_option_no_script = 0x0000001000,
+ noad_option_no_overflow = 0x0000002000, /* keep (middle) extensible widthin target size */
+ noad_option_void = 0x0000004000, /* wipe and set width to zero */
+ noad_option_phantom = 0x0000008000, /* wipe */
+ noad_option_openup_height = 0x0000010000,
+ noad_option_openup_depth = 0x0000020000,
+ noad_option_limits = 0x0000040000, /* traditional modifier */
+ noad_option_no_limits = 0x0000080000, /* idem */
+ noad_option_prefer_font_thickness = 0x0000100000,
+ noad_option_no_ruling = 0x0000200000,
+ noad_option_shifted_sub_script = 0x0000400000,
+ noad_option_shifted_super_script = 0x0000800000,
+ noad_option_shifted_sub_pre_script = 0x0001000000,
+ noad_option_shifted_super_pre_script = 0x0002000000,
+ noad_option_unpack_list = 0x0004000000,
+ noad_option_no_check = 0x0008000000, /* don't check for missing end fence */
+ noad_option_auto = 0x0010000000,
+ noad_option_unroll_list = 0x0020000000,
+ noad_option_followed_by_space = 0x0040000000,
+ noad_option_proportional = 0x0080000000,
/*tex Watch out: the following options exceed halfword: |noad_options| are |long long|. */
} noad_options;
/*tex The Microsoft compiler truncates to int, so: */
-# define noad_option_source_on_nucleus 0x100000000
-# define noad_option_fixed_super_or_sub_script 0x200000000
-# define noad_option_fixed_super_and_sub_script 0x400000000
+# define noad_option_source_on_nucleus 0x0100000000
+# define noad_option_fixed_super_or_sub_script 0x0200000000
+# define noad_option_fixed_super_and_sub_script 0x0400000000
+# define noad_option_auto_base 0x0800000000
# define has_option(a,b) (((a) & (b)) == (b))
# define unset_option(a,b) ((a) & ~(b))
@@ -1809,37 +1810,38 @@ inline static int has_noad_no_script_option(halfword n, halfword option)
# define has_noad_option_nosubprescript(a) has_noad_no_script_option(a, noad_option_no_sub_pre_script)
# define has_noad_option_nosupprescript(a) has_noad_no_script_option(a, noad_option_no_super_pre_script)
-# define has_noad_option_shiftedsubscript(a) (has_option(noad_options(a), noad_option_shifted_sub_script))
-# define has_noad_option_shiftedsupscript(a) (has_option(noad_options(a), noad_option_shifted_super_script))
-# define has_noad_option_shiftedsubprescript(a) (has_option(noad_options(a), noad_option_shifted_sub_pre_script))
-# define has_noad_option_shiftedsupprescript(a) (has_option(noad_options(a), noad_option_shifted_super_pre_script))
-# define has_noad_option_axis(a) (has_option(noad_options(a), noad_option_axis))
-# define has_noad_option_exact(a) (has_option(noad_options(a), noad_option_exact))
-# define has_noad_option_noaxis(a) (has_option(noad_options(a), noad_option_no_axis))
-# define has_noad_option_openupheight(a) (has_option(noad_options(a), noad_option_openup_height))
-# define has_noad_option_openupdepth(a) (has_option(noad_options(a), noad_option_openup_depth))
-# define has_noad_option_adapttoleft(a) (has_option(noad_options(a), noad_option_adapt_to_left_size))
-# define has_noad_option_adapttoright(a) (has_option(noad_options(a), noad_option_adapt_to_right_size))
-# define has_noad_option_limits(a) (has_option(noad_options(a), noad_option_limits))
-# define has_noad_option_nolimits(a) (has_option(noad_options(a), noad_option_no_limits))
-# define has_noad_option_nooverflow(a) (has_option(noad_options(a), noad_option_no_overflow))
-# define has_noad_option_preferfontthickness(a) (has_option(noad_options(a), noad_option_prefer_font_thickness))
-# define has_noad_option_noruling(a) (has_option(noad_options(a), noad_option_no_ruling))
-# define has_noad_option_unpacklist(a) (has_option(noad_options(a), noad_option_unpack_list))
-# define has_noad_option_nocheck(a) (has_option(noad_options(a), noad_option_no_check))
-# define has_noad_option_exact(a) (has_option(noad_options(a), noad_option_exact))
-# define has_noad_option_left(a) (has_option(noad_options(a), noad_option_left))
-# define has_noad_option_middle(a) (has_option(noad_options(a), noad_option_middle))
-# define has_noad_option_right(a) (has_option(noad_options(a), noad_option_right))
-# define has_noad_option_auto(a) (has_option(noad_options(a), noad_option_auto))
-# define has_noad_option_phantom(a) (has_option(noad_options(a), noad_option_phantom))
-# define has_noad_option_void(a) (has_option(noad_options(a), noad_option_void))
-# define has_noad_option_unrolllist(a) (has_option(noad_options(a), noad_option_unroll_list))
-# define has_noad_option_followedbyspace(a) (has_option(noad_options(a), noad_option_followed_by_space))
-# define has_noad_option_proportional(a) (has_option(noad_options(a), noad_option_proportional))
-# define has_noad_option_source_on_nucleus(a) (has_option(noad_options(a), noad_option_source_on_nucleus))
+# define has_noad_option_shiftedsubscript(a) (has_option(noad_options(a), noad_option_shifted_sub_script))
+# define has_noad_option_shiftedsupscript(a) (has_option(noad_options(a), noad_option_shifted_super_script))
+# define has_noad_option_shiftedsubprescript(a) (has_option(noad_options(a), noad_option_shifted_sub_pre_script))
+# define has_noad_option_shiftedsupprescript(a) (has_option(noad_options(a), noad_option_shifted_super_pre_script))
+# define has_noad_option_axis(a) (has_option(noad_options(a), noad_option_axis))
+# define has_noad_option_exact(a) (has_option(noad_options(a), noad_option_exact))
+# define has_noad_option_noaxis(a) (has_option(noad_options(a), noad_option_no_axis))
+# define has_noad_option_openupheight(a) (has_option(noad_options(a), noad_option_openup_height))
+# define has_noad_option_openupdepth(a) (has_option(noad_options(a), noad_option_openup_depth))
+# define has_noad_option_adapttoleft(a) (has_option(noad_options(a), noad_option_adapt_to_left_size))
+# define has_noad_option_adapttoright(a) (has_option(noad_options(a), noad_option_adapt_to_right_size))
+# define has_noad_option_limits(a) (has_option(noad_options(a), noad_option_limits))
+# define has_noad_option_nolimits(a) (has_option(noad_options(a), noad_option_no_limits))
+# define has_noad_option_nooverflow(a) (has_option(noad_options(a), noad_option_no_overflow))
+# define has_noad_option_preferfontthickness(a) (has_option(noad_options(a), noad_option_prefer_font_thickness))
+# define has_noad_option_noruling(a) (has_option(noad_options(a), noad_option_no_ruling))
+# define has_noad_option_unpacklist(a) (has_option(noad_options(a), noad_option_unpack_list))
+# define has_noad_option_nocheck(a) (has_option(noad_options(a), noad_option_no_check))
+# define has_noad_option_exact(a) (has_option(noad_options(a), noad_option_exact))
+# define has_noad_option_left(a) (has_option(noad_options(a), noad_option_left))
+# define has_noad_option_middle(a) (has_option(noad_options(a), noad_option_middle))
+# define has_noad_option_right(a) (has_option(noad_options(a), noad_option_right))
+# define has_noad_option_auto(a) (has_option(noad_options(a), noad_option_auto))
+# define has_noad_option_phantom(a) (has_option(noad_options(a), noad_option_phantom))
+# define has_noad_option_void(a) (has_option(noad_options(a), noad_option_void))
+# define has_noad_option_unrolllist(a) (has_option(noad_options(a), noad_option_unroll_list))
+# define has_noad_option_followedbyspace(a) (has_option(noad_options(a), noad_option_followed_by_space))
+# define has_noad_option_proportional(a) (has_option(noad_options(a), noad_option_proportional))
+# define has_noad_option_source_on_nucleus(a) (has_option(noad_options(a), noad_option_source_on_nucleus))
# define has_noad_option_fixed_super_or_sub_script(a) (has_option(noad_options(a), noad_option_fixed_super_or_sub_script))
# define has_noad_option_fixed_super_and_sub_script(a) (has_option(noad_options(a), noad_option_fixed_super_and_sub_script))
+# define has_noad_option_auto_base(a) (has_option(noad_options(a), noad_option_auto_base))
/*tex
In the meantime the codes and subtypes are in sync. The variable component does not really
@@ -1928,7 +1930,8 @@ typedef enum math_modifier_types {
# define accent_top_overshoot noad_extra_5
# define accent_bot_overshoot noad_extra_6
-typedef enum math_accent_subtypes {
+typedef enum math_accent_subtypes {
+ /* we can be more specific: todo fixedoverlay_accent_subtype */
bothflexible_accent_subtype,
fixedtop_accent_subtype,
fixedbottom_accent_subtype,