summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2023-04-15 01:06:07 +0200
committerContext Git Mirror Bot <phg@phi-gamma.net>2023-04-15 01:06:07 +0200
commit657457ef4a08c1f000f272e00f654f4064cc37bd (patch)
tree2f1f9a6a68aa8bc0679ff1c912e9b2476960e667 /source
parent3b909ab613140e7a9c824c434b642f0578473a6d (diff)
downloadcontext-657457ef4a08c1f000f272e00f654f4064cc37bd.tar.gz
2023-04-15 00:22:00
Diffstat (limited to 'source')
-rw-r--r--source/luametatex/source/tex/texmaincontrol.c3
-rw-r--r--source/luametatex/source/tex/texmath.c21
-rw-r--r--source/luametatex/source/tex/texmlist.c29
-rw-r--r--source/luametatex/source/tex/texnodes.c8
4 files changed, 46 insertions, 15 deletions
diff --git a/source/luametatex/source/tex/texmaincontrol.c b/source/luametatex/source/tex/texmaincontrol.c
index 6d6a2c031..c93011ad9 100644
--- a/source/luametatex/source/tex/texmaincontrol.c
+++ b/source/luametatex/source/tex/texmaincontrol.c
@@ -6309,7 +6309,8 @@ static void tex_aux_run_show_whatever(void)
When we have version 2.10 released I might move the mode tests to the runners so that we get a
smaller case cq. jump table and we might also go for mode 1 permanently. A side effect will be
- that some commands codes will be collapsed (move and such).
+ that some commands codes will be collapsed (move and such). See older source for the two
+ intermediate variants that were tested for a few years.
*/
diff --git a/source/luametatex/source/tex/texmath.c b/source/luametatex/source/tex/texmath.c
index dff87b5cc..f4d962d68 100644
--- a/source/luametatex/source/tex/texmath.c
+++ b/source/luametatex/source/tex/texmath.c
@@ -2952,8 +2952,25 @@ void tex_run_math_accent(void)
}
break;
case 's': case 'S':
- if (tex_scan_mandate_keyword("source", 1)) {
- noad_source(accent) = tex_scan_int(0, NULL);
+ switch (tex_scan_character("othOTH", 0, 0, 0)) {
+ case 'o': case 'O':
+ if (tex_scan_mandate_keyword("source", 2)) {
+ noad_source(accent) = tex_scan_int(0, NULL);
+ }
+ break;
+ case 't': case 'T':
+ if (tex_scan_mandate_keyword("stretch", 2)) {
+ noad_options(accent) |= noad_option_stretch;
+ }
+ break;
+ case 'h': case 'H':
+ if (tex_scan_mandate_keyword("shrink", 2)) {
+ noad_options(accent) |= noad_option_shrink;
+ }
+ break;
+ default:
+ tex_aux_show_keyword_error("source|stretch|shrink");
+ goto DONE;
}
break;
case 'f': case 'F':
diff --git a/source/luametatex/source/tex/texmlist.c b/source/luametatex/source/tex/texmlist.c
index 91bb864d7..a3154df62 100644
--- a/source/luametatex/source/tex/texmlist.c
+++ b/source/luametatex/source/tex/texmlist.c
@@ -935,10 +935,12 @@ static halfword tex_aux_char_box(halfword fnt, int chr, halfword att, scaled *ic
}
return box;
}
- if ((shrink && (whd.wd > target)) || (stretch && (whd.wd < target))) {
- glyph_x_scale(glyph) = lround((double) glyph_x_scale(glyph) * target/whd.wd);
- glyph_x_offset(glyph) = (whd.wd - target)/2;
- }
+ if ((shrink && (whd.wd > target)) || (stretch && (whd.wd < target))) { // we need to keep an eye on it
+ glyph_x_scale(glyph) = lround((double) glyph_x_scale(glyph) * target/whd.wd);
+ // glyph_x_offset(glyph) = (whd.wd - target)/2;
+ whd = tex_char_whd_from_glyph(glyph);
+ box_width(box) = whd.wd;
+ }
}
return box;
}
@@ -1578,7 +1580,7 @@ static halfword tex_aux_make_delimiter(halfword target, halfword delimiter, int
the traditional width (which is fake width + italic) becomes less and the delta is
added. See (**).
*/
- HERE:
+ HERE:
result = tex_aux_char_box(fnt, chr, att, delta, glyph_math_delimiter_subtype, flat ? targetsize : 0, style, shrink, stretch);
if (flat) {
/* This will be done when we have a reasonable example. */
@@ -2873,7 +2875,11 @@ static int tex_aux_compute_accent_skew(halfword target, int flags, scaled *skew,
There is no bot_accent so let's assume that the shift also applies
to bottom and overlay accents.
*/
- *skew = tex_char_unchecked_top_anchor_from_font(fnt, chr);
+ if (flags & bot_accent_code) {
+ *skew = tex_char_unchecked_bottom_anchor_from_font(fnt, chr);
+ } else {
+ *skew = tex_char_unchecked_top_anchor_from_font(fnt, chr);
+ }
if (*skew != INT_MIN) {
*skew = tex_aux_math_x_size_scaled(fnt, *skew, size);
absolute = 1;
@@ -3073,8 +3079,7 @@ static void tex_aux_do_make_math_accent(halfword target, halfword accentfnt, hal
}
if (! accent) {
/*tex Italic gets added to width for traditional fonts (no italic anyway): */
-// accent = tex_aux_char_box(accentfnt, accentchr, attrlist, NULL, glyph_math_accent_subtype, basewidth, style, 0, 0); // usedwidth
- accent = tex_aux_char_box(accentfnt, accentchr, attrlist, NULL, glyph_math_accent_subtype, usedwidth, style, 0, 0); // usedwidth
+ accent = tex_aux_char_box(accentfnt, accentchr, attrlist, NULL, glyph_math_accent_subtype, usedwidth, style, has_noad_option_stretch(target), has_noad_option_shrink(target)); // basewidth
found = 1;
}
if (flags & top_accent_code) {
@@ -3156,7 +3161,13 @@ static void tex_aux_do_make_math_accent(halfword target, halfword accentfnt, hal
/*tex If the accent is extensible just take the center. */
anchor = tex_half_scaled(accentwidth);
} else {
- anchor = tex_char_unchecked_top_anchor_from_font(accentfnt, accentchr); /* no bot accent key */
+ if (flags & top_accent_code) {
+ anchor = tex_char_unchecked_top_anchor_from_font(accentfnt, accentchr); /* no bot accent key */
+ } else if (flags & bot_accent_code) {
+ anchor = tex_char_unchecked_bottom_anchor_from_font(accentfnt, accentchr); /* no bot accent key */
+ } else {
+ anchor = INT_MIN;
+ }
if (anchor == INT_MIN || has_noad_option_center(target)) {
/*tex just take the center */
anchor = tex_half_scaled(accentwidth);
diff --git a/source/luametatex/source/tex/texnodes.c b/source/luametatex/source/tex/texnodes.c
index 49a5b8fa7..63cf9e4c3 100644
--- a/source/luametatex/source/tex/texnodes.c
+++ b/source/luametatex/source/tex/texnodes.c
@@ -779,9 +779,11 @@ void lmt_nodelib_initialize(void) {
properties, we create a new table and give it the original one as a metatable. After some
experiments (that also included timing) with these scenarios I decided that a deep copy made no
sense, nor did nilling. In the end both the shallow copy and the metatable variant were both
- ok, although the second ons is slower. The most important aspect to keep in mind is that
- references to other nodes in properties no longer can be valid for that copy. We could use two
- tables (one unique and one shared) or metatables but that only complicates matters.
+ okay, although the metatables at that time performed a bit less. The most important aspect to
+ keep in mind is that references to other nodes in properties no longer can be valid for that
+ copy. We could use two tables (one unique and one shared) or metatables but that only
+ complicates matters. Maybe some day I will remove the method that not used in \CONTEXT, just
+ because switching methods during a run will for sure break things.
When defining a new node, we could already allocate a table but it is rather easy to do that at
the lua end e.g. using a metatable __index method. That way it is under macro package control.