From 657457ef4a08c1f000f272e00f654f4064cc37bd Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Sat, 15 Apr 2023 01:06:07 +0200 Subject: 2023-04-15 00:22:00 --- .../general/manuals/luatex/luatex-nodes.tex | 2 +- source/luametatex/source/tex/texmaincontrol.c | 3 +- source/luametatex/source/tex/texmath.c | 21 ++++- source/luametatex/source/tex/texmlist.c | 29 ++++-- source/luametatex/source/tex/texnodes.c | 8 +- tex/context/base/mkii/cont-new.mkii | 2 +- tex/context/base/mkii/context.mkii | 2 +- tex/context/base/mkiv/cont-new.mkiv | 2 +- tex/context/base/mkiv/context.mkiv | 2 +- tex/context/base/mkiv/status-files.pdf | Bin 24623 -> 24611 bytes tex/context/base/mkiv/status-lua.pdf | Bin 267946 -> 267963 bytes tex/context/base/mkxl/cont-new.mkxl | 2 +- tex/context/base/mkxl/context.mkxl | 2 +- tex/context/base/mkxl/math-act.lmt | 92 ++++++++++++++---- tex/context/base/mkxl/tabl-com.mkxl | 7 ++ tex/context/fonts/mkiv/bonum-math.lfg | 3 + tex/context/fonts/mkiv/common-math-jmn.lfg | 104 ++++++++++++++++++--- tex/context/fonts/mkiv/concrete-math.lfg | 3 + tex/context/fonts/mkiv/dejavu-math.lfg | 3 + tex/context/fonts/mkiv/ebgaramond-math.lfg | 3 + tex/context/fonts/mkiv/erewhon-math.lfg | 3 + tex/context/fonts/mkiv/kpfonts-math.lfg | 3 + tex/context/fonts/mkiv/modern-math.lfg | 3 + tex/context/fonts/mkiv/newcomputermodern-math.lfg | 3 + tex/context/fonts/mkiv/pagella-math.lfg | 3 + tex/context/fonts/mkiv/schola-math.lfg | 3 + tex/context/fonts/mkiv/stixtwo-math.lfg | 13 +++ tex/context/fonts/mkiv/termes-math.lfg | 3 + tex/context/fonts/mkiv/xcharter-math.lfg | 3 + tex/context/modules/mkxl/s-system-macros.mkxl | 8 +- tex/context/modules/mkxl/s-text-tests.mkxl | 72 ++++++++++++++ tex/generic/context/luatex/luatex-fonts-merged.lua | 2 +- 32 files changed, 354 insertions(+), 55 deletions(-) create mode 100644 tex/context/modules/mkxl/s-text-tests.mkxl diff --git a/doc/context/sources/general/manuals/luatex/luatex-nodes.tex b/doc/context/sources/general/manuals/luatex/luatex-nodes.tex index 2453edb2d..e023d4dac 100644 --- a/doc/context/sources/general/manuals/luatex/luatex-nodes.tex +++ b/doc/context/sources/general/manuals/luatex/luatex-nodes.tex @@ -2391,7 +2391,7 @@ consistency. You can of course always define additional accessors using \type \supported {mlist_to_hlist} \yes \nop \supported {new} \yes \yes \supported {next} \yes \nop -\supported {prepend_prevdepth} \nop \yes +\supported {prepend_prevdepth} \yes \yes \supported {prev} \yes \nop \supported {protect_glyphs} \yes \yes \supported {protect_glyph} \yes \yes 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. diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii index 9a1ca833a..37528b541 100644 --- a/tex/context/base/mkii/cont-new.mkii +++ b/tex/context/base/mkii/cont-new.mkii @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2023.04.11 22:45} +\newcontextversion{2023.04.15 00:19} %D This file is loaded at runtime, thereby providing an %D excellent place for hacks, patches, extensions and new diff --git a/tex/context/base/mkii/context.mkii b/tex/context/base/mkii/context.mkii index 994439fa2..6996d0e72 100644 --- a/tex/context/base/mkii/context.mkii +++ b/tex/context/base/mkii/context.mkii @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2023.04.11 22:45} +\edef\contextversion{2023.04.15 00:19} %D For those who want to use this: diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv index c7c28fc7c..0623da6c5 100644 --- a/tex/context/base/mkiv/cont-new.mkiv +++ b/tex/context/base/mkiv/cont-new.mkiv @@ -13,7 +13,7 @@ % \normalend % uncomment this to get the real base runtime -\newcontextversion{2023.04.11 22:45} +\newcontextversion{2023.04.15 00:19} %D This file is loaded at runtime, thereby providing an excellent place for hacks, %D patches, extensions and new features. There can be local overloads in cont-loc diff --git a/tex/context/base/mkiv/context.mkiv b/tex/context/base/mkiv/context.mkiv index aee10b279..78fbb2605 100644 --- a/tex/context/base/mkiv/context.mkiv +++ b/tex/context/base/mkiv/context.mkiv @@ -49,7 +49,7 @@ %D {YYYY.MM.DD HH:MM} format. \edef\contextformat {\jobname} -\edef\contextversion{2023.04.11 22:45} +\edef\contextversion{2023.04.15 00:19} %D Kind of special: diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf index 074d13f5d..3c36f07cf 100644 Binary files a/tex/context/base/mkiv/status-files.pdf and b/tex/context/base/mkiv/status-files.pdf differ diff --git a/tex/context/base/mkiv/status-lua.pdf b/tex/context/base/mkiv/status-lua.pdf index e08a49d4e..12f91518e 100644 Binary files a/tex/context/base/mkiv/status-lua.pdf and b/tex/context/base/mkiv/status-lua.pdf differ diff --git a/tex/context/base/mkxl/cont-new.mkxl b/tex/context/base/mkxl/cont-new.mkxl index 9f4678349..cc8a43777 100644 --- a/tex/context/base/mkxl/cont-new.mkxl +++ b/tex/context/base/mkxl/cont-new.mkxl @@ -13,7 +13,7 @@ % \normalend % uncomment this to get the real base runtime -\newcontextversion{2023.04.11 22:45} +\newcontextversion{2023.04.15 00:19} %D This file is loaded at runtime, thereby providing an excellent place for hacks, %D patches, extensions and new features. There can be local overloads in cont-loc diff --git a/tex/context/base/mkxl/context.mkxl b/tex/context/base/mkxl/context.mkxl index 19cc4ee85..d866f4b94 100644 --- a/tex/context/base/mkxl/context.mkxl +++ b/tex/context/base/mkxl/context.mkxl @@ -29,7 +29,7 @@ %D {YYYY.MM.DD HH:MM} format. \immutable\edef\contextformat {\jobname} -\immutable\edef\contextversion{2023.04.11 22:45} +\immutable\edef\contextversion{2023.04.15 00:19} %overloadmode 1 % check frozen / warning %overloadmode 2 % check frozen / error diff --git a/tex/context/base/mkxl/math-act.lmt b/tex/context/base/mkxl/math-act.lmt index e8310ef2b..f6fd5dab5 100644 --- a/tex/context/base/mkxl/math-act.lmt +++ b/tex/context/base/mkxl/math-act.lmt @@ -1309,6 +1309,7 @@ do else c.width = width end +c.bottomanchor = width/2 -- maybe optional end if italic then c.italic = nil @@ -1349,8 +1350,9 @@ do end end end - return - elseif not list or list == "all" or list == true or parameters.all then + goto done + end + if not list or list == "all" or list == true or parameters.all then list = sortedkeys(targetcharacters) elseif type(list) == "string" then list = { list } @@ -1377,6 +1379,7 @@ do end end end + ::done:: feedback_tweak(whatever,target,original,done) end @@ -1958,7 +1961,7 @@ do newprivateslot("minus rule right piece"), } - local function useminus(target,unicode,characters,parameters,skipfirst,what) + local function useminus(target,unicode,characters,parameters,skipfirst,what,tounicode) local minus = characters[0x2212] local parts = minus.parts if parameters == true then @@ -1996,7 +1999,7 @@ do leftcommand[xshift], downcommand[yshift], -- slotcommand[0][glyph], - { "slot", 0, glyph, xscale, yscale }, + { "slot", 0, glyph, xscale, yscale }, }, } part.glyph = what[i] @@ -2011,7 +2014,7 @@ do -- slotcommand[0][0x2212], { "slot", 0, 0x2212, xscale, yscale }, }, - unicode = unicode, + unicode = tounicode or unicode, parts = parts, partsorientation = "horizontal", } @@ -2020,7 +2023,7 @@ do -- add minus parts of not there and create clipped clone - local function checkminus(target,unicode,characters,parameters,skipfirst,what) + local function checkminus(target,unicode,characters,parameters,skipfirst,what,tounicode) local minus = characters[unicode] local parts = minus.parts if parameters == true then @@ -2092,6 +2095,7 @@ do } minus.partsorientation = "horizontal" end + minus.unicode = tounicode or unicode end function mathtweaks.replacerules(target,original,parameters) @@ -2104,10 +2108,10 @@ do checkminus(target,0x2212,characters,minus,false,mrp) end if fraction then - useminus(target,fbe,characters,fraction,false,frp) + useminus(target,fbe,characters,fraction,false,frp,0x2044) -- division slash end if radical then - useminus(target,rbe,characters,radical,true,rrp) + useminus(target,rbe,characters,radical,true,rrp,0x2061) -- apply function end if stacker then useminus(target,0x203E,characters,stacker,false,frp) @@ -2666,6 +2670,7 @@ do -- see pagella for an extensive example [0x030A] = { 0x02DA, false }, [0x0303] = { 0x02DC, true }, [0x20DB] = { 0x20DB, false }, +-- [0x20EF] = { 0x20EF, false }, } datasets.fixaccents = mapping @@ -2673,6 +2678,18 @@ do -- see pagella for an extensive example datasets.flattenaccents = mapping datasets.copyaccents = mapping + -- local flat = stretchingdata.flataccent + -- if flat then + -- -- Nasty! xoffset needed. Check this when we patch vf. + -- local flatdata = characters[flat] + -- flatdata.width = width + -- flatdata.advance = 0 + -- flatdata.topanchor = topanchor + -- flatdata.xoffset = width + topanchor + -- end + +local cdata = characters.data + function mathtweaks.fixaccents(target,original,parameters) local characters = target.characters local done = false @@ -2680,22 +2697,27 @@ do -- see pagella for an extensive example local alias = entry[1] local stretchingdata = characters[stretching] if stretchingdata and stretchingdata.width == 0 then +if false then + local b = target.descriptions[stretching].boundingbox + if b then + local llx = b[1] * target.parameters.hfactor + local urx = b[3] * target.parameters.hfactor + width = urx - llx + stretchingdata.width = width + stretchingdata.xoffset = - llx + stretchingdata.advance = urx + stretchingdata.topanchor = width/2 + stretchingdata.bottomanchor = width/2 + end +else local topanchor = stretchingdata.topanchor or 0 local width = -topanchor - topanchor = width/2 + topanchor = width/2 stretchingdata.width = width stretchingdata.advance = 0 stretchingdata.topanchor = topanchor stretchingdata.commands = { rightcommand[width + topanchor], charcommand[stretching] } --- local flat = stretchingdata.flataccent --- if flat then --- -- Nasty! xoffset needed. Check this when we patch vf. --- local flatdata = characters[flat] --- flatdata.width = width --- flatdata.advance = 0 --- flatdata.topanchor = topanchor --- flatdata.xoffset = width + topanchor --- end +end if not trace_tweaking then done = true elseif done then @@ -2708,6 +2730,40 @@ do -- see pagella for an extensive example feedback_tweak("fixaccents",target,original,done) end + function mathtweaks.checkaccents(target,original,parameters) + local characters = target.characters + local done = false + local factor = target.parameters.hfactor + for unicode, data in sortedhash(characters) do + local width = data.width + if width == 0 then + local d = chardata[data.unicode or unicode] + local c = d and d.category + if c == "mn" then + local b = target.descriptions[unicode].boundingbox + if b then + local llx = b[1] * factor + local urx = b[3] * factor + width = urx - llx + data.width = width + data.xoffset = - llx + data.advance = urx + data.topanchor = width/2 + data.bottomanchor = width/2 + end + if not trace_tweaking then + done = true + elseif done then + done[unicode] = true + else + done = { [unicode] = true } + end + end + end + end + feedback_tweak("checkaccents",target,original,done) + end + -- all true|number false function mathtweaks.extendaccents(target,original,parameters) diff --git a/tex/context/base/mkxl/tabl-com.mkxl b/tex/context/base/mkxl/tabl-com.mkxl index d8eb7ada7..8621d2f62 100644 --- a/tex/context/base/mkxl/tabl-com.mkxl +++ b/tex/context/base/mkxl/tabl-com.mkxl @@ -49,6 +49,7 @@ \permanent\protected\lettonothing\BH \permanent\protected\lettonothing\BL \permanent\protected\lettonothing\BR +\permanent\protected\lettonothing\BT \permanent\protected\lettonothing\CC \permanent\protected\lettonothing\CL \permanent\protected\lettonothing\CM @@ -68,6 +69,8 @@ \permanent\protected\lettonothing\HL \permanent\protected\lettonothing\HQ \permanent\protected\lettonothing\HR +\permanent\protected\lettonothing\HF +\permanent\protected\lettonothing\HLHL \permanent\protected\lettonothing\LB \permanent\protected\lettonothing\LC \permanent\protected\lettonothing\LT @@ -94,9 +97,13 @@ \permanent\protected\lettonothing\SM \permanent\protected\lettonothing\SR \permanent\protected\lettonothing\TB +\permanent\protected\lettonothing\TC \permanent\protected\lettonothing\TL +\permanent\protected\lettonothing\TM \permanent\protected\lettonothing\TR +\permanent\protected\lettonothing\TT \permanent\protected\lettonothing\VL +\permanent\protected\lettonothing\VLVL \permanent\protected\lettonothing\VC \permanent\protected\lettonothing\VD \permanent\protected\lettonothing\VN diff --git a/tex/context/fonts/mkiv/bonum-math.lfg b/tex/context/fonts/mkiv/bonum-math.lfg index 2852c6449..ce36da352 100644 --- a/tex/context/fonts/mkiv/bonum-math.lfg +++ b/tex/context/fonts/mkiv/bonum-math.lfg @@ -70,6 +70,9 @@ return { presets.moveitalics { correct = true }, presets.wipeanchors { }, presets.wipeitalics { }, + { + tweak = "checkaccents", + }, { -- We need to check these, are the tweaks necessary or not? tweak = "dimensions", diff --git a/tex/context/fonts/mkiv/common-math-jmn.lfg b/tex/context/fonts/mkiv/common-math-jmn.lfg index 1ebb7db39..995da0db6 100644 --- a/tex/context/fonts/mkiv/common-math-jmn.lfg +++ b/tex/context/fonts/mkiv/common-math-jmn.lfg @@ -1,3 +1,15 @@ +local nps = fonts.helpers.newprivateslot + +local fake20D6 = nps("arrow fake 0x20D6") +local fake20D7 = nps("arrow fake 0x20D7") +local fake20E1 = nps("arrow fake 0x20E1") + +local fake20EE = nps("arrow fake 0x20EE") +local fake20EF = nps("arrow fake 0x20EF") +local fake034D = nps("arrow fake 0x034D") + +local real034D = nps("arrow real 0x034D") + return { name = "common-math-jmn", version = "1.00", @@ -118,7 +130,7 @@ return { builders.horibar(main,0x203E,false,false,false,0x02212) end - local ffactor = antykwa and 1 or 1 + local ffactor = antykwa and 1 or 1 -- check MS local mfactor = antykwa and 1 or .8 local lfactor = antykwa and 1 or .8 @@ -131,8 +143,11 @@ return { builders.extension(main,0x27F9,dfl,dfm,dar,ffactor,mfactor,lfactor) builders.extension(main,0x27FA,dal,dfm,dar,ffactor,mfactor,lfactor) - local tfactor = antykwa and -0.8 or -0.8 - local bfactor = antykwa and 0.1 or 0.1 + local tfactor = antykwa and -0.8 or -1.1 -- move up check MS + local bfactor = antykwa and 0.1 or 0.2 + +local tfactor = antykwa and -0.6 or -.6 -- move up check MS +local bfactor = antykwa and 0.1 or 0.2 local left = characters[0x27F5] local right = characters[0x27F6] @@ -141,17 +156,82 @@ return { local height = max(left.height or 0,right.height or 0,both.height or 0) local depth = max(left.depth or 0,right.depth or 0,both.depth or 0) - left .height = height left .depth = depth - right.height = height right.depth = depth - both .height = height both .depth = depth + left .height = height ; left .depth = depth + right.height = height ; right.depth = depth + both .height = height ; both .depth = depth + + -- top and bottom arrows : a real mess but now we're drawn into patching it; why are these + -- small ones shifted in the bbox; we could do a better job on top and bottom anchors; we + -- also could use the bbox as in opentype (\wideoverleftarrow etc) + + local rightarrow = characters[0x20D7] + local leftarrow = copytable(rightarrow) + local doublearrow = copytable(rightarrow) + local width = rightarrow.width + local height = rightarrow.height + + -- top + + characters[0x20D6] = leftarrow + characters[0x20E1] = doublearrow + + rightarrow.xoffset = -.2*width + leftarrow.commands = { + { "offset", width, 0, 0x20D7, -1, 1 } + } + doublearrow.commands = { + { "offset", antykwa and .9*width or width, 0, 0x20D7, -1, 1 }, + { "offset", antykwa and .1*width or 0, 0, 0x20D7, 1, 1 } + } + + -- bottom + + local rightarrow = copytable(rightarrow) + local leftarrow = copytable(leftarrow) + local doublearrow = copytable(doublearrow) + + characters[0x20EE] = leftarrow + characters[0x20EF] = rightarrow + characters[0x034D] = doublearrow + + local bheight = .40*height -- can be tuned to match top + local yoffset = -.65*height -- can be tuned to match top + + leftarrow .height = bheight + rightarrow .height = bheight + doublearrow.height = bheight + + rightarrow .yoffset = yoffset + leftarrow .yoffset = yoffset + doublearrow.yoffset = yoffset + + leftarrow.commands = { + { "offset", width, 0, 0x20D7, -1, 1 } + } + doublearrow.commands = { + { "offset", antykwa and .9*width or width, 0, 0x20D7, -1, 1 }, + { "offset", antykwa and .1*width or 0, 0, 0x20D7, 1, 1 } + } + + -- extensibles + + local tl = copytable(left) ; characters[fake20D6] = tl ; characters[0x20D6].next = fake20D6 -- over + local tm = copytable(right) ; characters[fake20D7] = tm ; characters[0x20D7].next = fake20D7 + local tr = copytable(both) ; characters[fake20E1] = tr ; characters[0x20E1].next = fake20E1 + + tl.inneryoffset = tfactor*height ; tl.innerlocation = "top" ; tl.next = nil ; tl.italic = nil + tm.inneryoffset = tfactor*height ; tm.innerlocation = "top" ; tm.next = nil ; tm.italic = nil + tr.inneryoffset = tfactor*height ; tr.innerlocation = "top" ; tr.next = nil ; tr.italic = nil + + local bl = copytable(left) ; characters[fake20EE] = bl ; characters[0x20EE].next = fake20EE -- under + local bm = copytable(right) ; characters[fake20EF] = bm ; characters[0x20EF].next = fake20EF + local br = copytable(both) ; characters[fake034D] = br ; characters[0x034D].next = fake034D - local t = copytable(left) characters[0x20D6] = t t.inneryoffset = tfactor*height t.innerlocation = "top" t.next = nil t.italic = nil -- over - local t = copytable(right) characters[0x20D7] = t t.inneryoffset = tfactor*height t.innerlocation = "top" t.next = nil t.italic = nil - local t = copytable(both) characters[0x20E1] = t t.inneryoffset = tfactor*height t.innerlocation = "top" t.next = nil t.italic = nil + bl.inneryoffset = bfactor*height bl.innerlocation = "bottom" ; bl.next = nil ; bl.italic = nil + bm.inneryoffset = bfactor*height bm.innerlocation = "bottom" ; bm.next = nil ; bm.italic = nil + br.inneryoffset = bfactor*height br.innerlocation = "bottom" ; br.next = nil ; br.italic = nil - local t = copytable(left) characters[0x20EE] = t t.inneryoffset = bfactor*height t.innerlocation = "bottom" t.next = nil t.italic = nil -- under - local t = copytable(right) characters[0x20EF] = t t.inneryoffset = bfactor*height t.innerlocation = "bottom" t.next = nil t.italic = nil - local t = copytable(both) characters[0x034D] = t t.inneryoffset = bfactor*height t.innerlocation = "bottom" t.next = nil t.italic = nil + -- local tfactor = antykwa and -15 or -15 local bfactor = antykwa and 1 or 1 diff --git a/tex/context/fonts/mkiv/concrete-math.lfg b/tex/context/fonts/mkiv/concrete-math.lfg index 142778015..e92bb122a 100644 --- a/tex/context/fonts/mkiv/concrete-math.lfg +++ b/tex/context/fonts/mkiv/concrete-math.lfg @@ -34,6 +34,9 @@ return { presets.moveitalics { correct = true }, presets.moveintegrals { factor = 1.5 }, presets.wipeitalics { }, + { + tweak = "checkaccents", + }, { tweak = "kerns", list = { diff --git a/tex/context/fonts/mkiv/dejavu-math.lfg b/tex/context/fonts/mkiv/dejavu-math.lfg index c97765122..4098a32d0 100644 --- a/tex/context/fonts/mkiv/dejavu-math.lfg +++ b/tex/context/fonts/mkiv/dejavu-math.lfg @@ -56,6 +56,9 @@ return { -- a dimension tweak before the above (e.g. 0.2 italic and 0.8 width) doesn't work -- because once the advance is set the move is blocked and the ic stil wiped. So, -- we kern. Actually the upright (ascii) f has italic correction. + { + tweak = "checkaccents", + }, { tweak = "kerns", list = { diff --git a/tex/context/fonts/mkiv/ebgaramond-math.lfg b/tex/context/fonts/mkiv/ebgaramond-math.lfg index d2ef73f55..c25147b14 100644 --- a/tex/context/fonts/mkiv/ebgaramond-math.lfg +++ b/tex/context/fonts/mkiv/ebgaramond-math.lfg @@ -50,6 +50,9 @@ return { presets.moveitalics { correct = true, letters = true }, presets.moveintegrals { factor = 1.5 }, presets.wipeitalics { }, + { + tweak = "checkaccents", + }, { tweak = "simplifykerns", }, diff --git a/tex/context/fonts/mkiv/erewhon-math.lfg b/tex/context/fonts/mkiv/erewhon-math.lfg index 223927184..5a28735f1 100644 --- a/tex/context/fonts/mkiv/erewhon-math.lfg +++ b/tex/context/fonts/mkiv/erewhon-math.lfg @@ -52,6 +52,9 @@ return { presets.moveitalics { correct = true, letters = true }, presets.moveintegrals { factor = 1.5 }, presets.wipeitalics { }, + { + tweak = "checkaccents", + }, { tweak = "kerns", list = { diff --git a/tex/context/fonts/mkiv/kpfonts-math.lfg b/tex/context/fonts/mkiv/kpfonts-math.lfg index 1b2eea45f..db3e44be8 100644 --- a/tex/context/fonts/mkiv/kpfonts-math.lfg +++ b/tex/context/fonts/mkiv/kpfonts-math.lfg @@ -25,6 +25,9 @@ return { tweak = "version", expected = "Version 0.40", }, + { + tweak = "checkaccents", + }, { tweak = "dimensions", list = { diff --git a/tex/context/fonts/mkiv/modern-math.lfg b/tex/context/fonts/mkiv/modern-math.lfg index fb9c8fd4b..fa4216263 100644 --- a/tex/context/fonts/mkiv/modern-math.lfg +++ b/tex/context/fonts/mkiv/modern-math.lfg @@ -55,6 +55,9 @@ return { presets.moveintegrals { factor = 1.4, icfactor = 0.8 }, -- the icfactor is due to the very slanted integral. presets.wipeanchors { }, presets.wipeitalics { }, + { + tweak = "checkaccents", + }, { tweak = "dimensions", list = { diff --git a/tex/context/fonts/mkiv/newcomputermodern-math.lfg b/tex/context/fonts/mkiv/newcomputermodern-math.lfg index 9e5e6ab3a..d147e787e 100644 --- a/tex/context/fonts/mkiv/newcomputermodern-math.lfg +++ b/tex/context/fonts/mkiv/newcomputermodern-math.lfg @@ -107,6 +107,9 @@ return { presets.moveintegrals { factor = 1.4, icfactor = 0.8 }, -- the icfactor is due to the very slanted integral. presets.wipeanchors { }, presets.wipeitalics { }, + { + tweak = "checkaccents", + }, { tweak = "kerns", list = { diff --git a/tex/context/fonts/mkiv/pagella-math.lfg b/tex/context/fonts/mkiv/pagella-math.lfg index a9b3ea4bb..3aa3ef24b 100644 --- a/tex/context/fonts/mkiv/pagella-math.lfg +++ b/tex/context/fonts/mkiv/pagella-math.lfg @@ -82,6 +82,9 @@ return { presets.moveintegrals { factor = 1.5 }, -- we need to check the 1.5 presets.wipeanchors { }, presets.wipeitalics { }, + { + tweak = "checkaccents", + }, { tweak = "parameters", feature = "euleroverpagella", diff --git a/tex/context/fonts/mkiv/schola-math.lfg b/tex/context/fonts/mkiv/schola-math.lfg index 58eb1a6ea..f0155cb57 100644 --- a/tex/context/fonts/mkiv/schola-math.lfg +++ b/tex/context/fonts/mkiv/schola-math.lfg @@ -46,6 +46,9 @@ return { presets.moveitalics { correct = true, letters = true }, presets.moveintegrals { }, presets.wipeitalics { }, + { + tweak = "checkaccents", + }, { tweak = "kerns", list = { diff --git a/tex/context/fonts/mkiv/stixtwo-math.lfg b/tex/context/fonts/mkiv/stixtwo-math.lfg index ebacf7a81..bbe4e3685 100644 --- a/tex/context/fonts/mkiv/stixtwo-math.lfg +++ b/tex/context/fonts/mkiv/stixtwo-math.lfg @@ -98,6 +98,19 @@ return { presets.moveitalics { correct = true, letters = true }, presets.moveintegrals { }, presets.wipeitalics { }, + { + tweak = "checkaccents", + }, + -- Extensibles use .s1 (variant 1), so we cannot wipe all + { + tweak = "wipevariants", + list = { + [0x20D6] = 3, + [0x20D7] = 3, + [0x20EE] = 3, + [0x20EF] = 3, + }, + }, { tweak = "simplifykerns", }, diff --git a/tex/context/fonts/mkiv/termes-math.lfg b/tex/context/fonts/mkiv/termes-math.lfg index 504249878..c74228179 100644 --- a/tex/context/fonts/mkiv/termes-math.lfg +++ b/tex/context/fonts/mkiv/termes-math.lfg @@ -48,6 +48,9 @@ return { presets.moveitalics { correct = true, letters = true }, presets.moveintegrals { factor = 1.5 }, presets.wipeitalics { }, + { + tweak = "checkaccents", + }, { tweak = "kerns", list = { diff --git a/tex/context/fonts/mkiv/xcharter-math.lfg b/tex/context/fonts/mkiv/xcharter-math.lfg index e2ed3e116..48b1cad5d 100644 --- a/tex/context/fonts/mkiv/xcharter-math.lfg +++ b/tex/context/fonts/mkiv/xcharter-math.lfg @@ -38,6 +38,9 @@ return { presets.moveitalics { correct = true, letters = true }, presets.moveintegrals { factor = 1.5 }, presets.wipeitalics { }, + { + tweak = "checkaccents", + }, { tweak = "kerns", list = { diff --git a/tex/context/modules/mkxl/s-system-macros.mkxl b/tex/context/modules/mkxl/s-system-macros.mkxl index 605859000..7e78b265a 100644 --- a/tex/context/modules/mkxl/s-system-macros.mkxl +++ b/tex/context/modules/mkxl/s-system-macros.mkxl @@ -48,6 +48,8 @@ [A4,landscape] [A4,landscape] +\bitwiseflip \normalizelinemode \discardzerotabskipsnormalizecode + \starttext \startluacode @@ -137,7 +139,7 @@ local function show(visible, check) -- context.starttabulate { "|l|l|l|lj2|l|l|l|l|l|l|l|l|" } - context.starttabulate { "|l|l|l|lj2|l|l|l|l|l|l|l|l|" } + context.starttabulate { "|l|l|l|lj2|l|l|l|l|l|l|l|l|l|" } for i=1,#list do local k = list[i] if check(k) then @@ -148,6 +150,7 @@ local permanent = v.permanent and "permanent" local primitive = v.primitive and "primitive" local instance = v.instance and "instance" + local constant = v.constant and "constant" local dealtwith = mutable or immutable or mutable or frozen or permanent or primitive -- beware: we can have combinations local whatever = find(k,"^[a-z][a-z][a-z]+_") local cscommand = gsub(v.cmdname or "","_"," ") @@ -165,7 +168,7 @@ ctx_NC() if primitive then ctx_bold(csname) else ctx_verb(csname) end ctx_NC() if parameters then context(parameters > 0 and parameters or "-") end - ctx_NC() if undefined then context.red(false) end + ctx_NC() if undefined then context.red(false) end context(cscommand) ctx_NC() if primitive then context(primitive) end ctx_NC() if permanent then context(permanent) end @@ -174,6 +177,7 @@ ctx_NC() if mutable then context(mutable) end ctx_NC() if instance then context(instance) end ctx_NC() if noaligned then context(noaligned) end + ctx_NC() if constant then context(constant) end ctx_NC() if filename then context(hashnames[filename]) end ctx_NC() ctx_NR() end diff --git a/tex/context/modules/mkxl/s-text-tests.mkxl b/tex/context/modules/mkxl/s-text-tests.mkxl new file mode 100644 index 000000000..6766a7a09 --- /dev/null +++ b/tex/context/modules/mkxl/s-text-tests.mkxl @@ -0,0 +1,72 @@ +%D \module +%D [ file=s-text-tests.mkxl, +%D version=2023.04.11, +%D title=\CONTEXT\ Style File, +%D subtitle=Some Text Tests, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\continueifinputfile{s-text-tests.mkxl} + +%D Here we collect some tests that later will become proper macros. + +\usebodyfont[bonum] +\usebodyfont[cambria] +\usebodyfont[concrete] +\usebodyfont[dejavu] +\usebodyfont[ebgaramond] +\usebodyfont[erewhon] +\usebodyfont[kpfonts] +\usebodyfont[libertinus] +\usebodyfont[lucida] +\usebodyfont[minion] +\usebodyfont[modern] +\usebodyfont[newcomputermodern-book] +\usebodyfont[pagella] +\usebodyfont[schola] +\usebodyfont[stixtwo] +\usebodyfont[termes] +\usebodyfont[xcharter] + +\starttext + +\startbuffer +(a) (f) [f] \{f\} f: f; f! f? f\textbar f* f@ f& f/ f\textbackslash +\stopbuffer + +\starttexdefinition ugly #1 + \startsubject[title=#1] + \start + \switchtobodyfont[#1] + {\tf \getbuffer}\blank[small] + {\bf \getbuffer}\blank[small] + {\it \getbuffer}\blank[small] + {\bi \getbuffer}\blank[big] + \stop + \stopsubject +\stoptexdefinition + +\ugly{bonum} +\ugly{cambria} +\ugly{concrete} +\ugly{dejavu} +\ugly{ebgaramond} +\ugly{erewhon} +\ugly{kpfonts} +\ugly{libertinus} +\ugly{lucida} +\ugly{minion} +\ugly{modern} +\ugly{newcomputermodern-book} +\ugly{pagella} +\ugly{schola} +\ugly{stixtwo} +\ugly{termes} +\ugly{xcharter} + +\stoptext diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 2e71a19d3..3cd7aa0da 100644 --- a/tex/generic/context/luatex/luatex-fonts-merged.lua +++ b/tex/generic/context/luatex/luatex-fonts-merged.lua @@ -1,6 +1,6 @@ -- merged file : c:/data/develop/context/sources/luatex-fonts-merged.lua -- parent file : c:/data/develop/context/sources/luatex-fonts.lua --- merge date : 2023-04-11 22:45 +-- merge date : 2023-04-15 00:19 do -- begin closure to overcome local limits and interference -- cgit v1.2.3