diff options
author | Hans Hagen <pragma@wxs.nl> | 2021-06-01 17:45:33 +0200 |
---|---|---|
committer | Context Git Mirror Bot <phg@phi-gamma.net> | 2021-06-01 17:45:33 +0200 |
commit | 268cc2e9f10c887b29ac2136e9a0cdf40e464796 (patch) | |
tree | a91fa89364a765592fd6602308dc875c812da5a3 /tex | |
parent | 316fec3fcb4b5e6f352a3a58db1656e08659202c (diff) | |
download | context-268cc2e9f10c887b29ac2136e9a0cdf40e464796.tar.gz |
2021-06-01 17:02:00
Diffstat (limited to 'tex')
21 files changed, 425 insertions, 143 deletions
diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii index 7ab6e4160..3b21edcd9 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{2021.05.31 14:09} +\newcontextversion{2021.06.01 17:00} %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 f04382825..03b2f79bc 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{2021.05.31 14:09} +\edef\contextversion{2021.06.01 17:00} %D For those who want to use this: diff --git a/tex/context/base/mkii/mult-cs.mkii b/tex/context/base/mkii/mult-cs.mkii index 8645dd34b..0e1e0a92c 100644 --- a/tex/context/base/mkii/mult-cs.mkii +++ b/tex/context/base/mkii/mult-cs.mkii @@ -1265,6 +1265,7 @@ \setinterfaceconstant{symbolset}{sadasymbolu} \setinterfaceconstant{symcolor}{barvasymbolu} \setinterfaceconstant{symstyle}{stylsymboly} +\setinterfaceconstant{synchronize}{synchronize} \setinterfaceconstant{synonym}{synonymum} \setinterfaceconstant{synonymcolor}{barvasynonyma} \setinterfaceconstant{synonymcommand}{synonymcommand} diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv index 2a6b72405..caf46fe43 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{2021.05.31 14:09} +\newcontextversion{2021.06.01 17:00} %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 88000966e..005fbf05a 100644 --- a/tex/context/base/mkiv/context.mkiv +++ b/tex/context/base/mkiv/context.mkiv @@ -45,7 +45,7 @@ %D {YYYY.MM.DD HH:MM} format. \edef\contextformat {\jobname} -\edef\contextversion{2021.05.31 14:09} +\edef\contextversion{2021.06.01 17:00} %D Kind of special: diff --git a/tex/context/base/mkiv/mult-fun.lua b/tex/context/base/mkiv/mult-fun.lua index 1b774afa3..1cacdff27 100644 --- a/tex/context/base/mkiv/mult-fun.lua +++ b/tex/context/base/mkiv/mult-fun.lua @@ -39,6 +39,8 @@ return { "definecolor", -- "anchorxy", "anchorx", "anchory", + "anchorht", "anchordp", + "anchorll", "anchorur", "anchorbox", }, commands = { "loadfile", "loadimage", "loadmodule", diff --git a/tex/context/base/mkiv/mult-low.lua b/tex/context/base/mkiv/mult-low.lua index 592645b8c..2745fb52a 100644 --- a/tex/context/base/mkiv/mult-low.lua +++ b/tex/context/base/mkiv/mult-low.lua @@ -172,7 +172,7 @@ return { "clipwidthcode", "flattendiscretionariescode", -- "noligaturingcode", "nokerningcode", "noleftligaturecode", "noleftkerncode", "norightligaturecode", "norightkerncode", - "noexpansioncode", "noprotrusioncode", + "noexpansioncode", "noprotrusioncode", "noitaliccorrectioncode", -- "frozenflagcode", "tolerantflagcode", "protectedflagcode", "primitiveflagcode", "permanentflagcode", "noalignedflagcode", "immutableflagcode", "mutableflagcode", "globalflagcode", "overloadedflagcode", "immediateflagcode", "conditionalflagcode", "valueflagcode", "instanceflagcode", @@ -555,7 +555,7 @@ return { "prelistbox", "postlistbox", "prelistcopy", "postlistcopy", "setprelistbox", "setpostlistbox", -- "noligaturing", "nokerning", "noexpansion", "noprotrusion", - "noleftkerning", "noleftligaturing", "norightkerning", "norightligaturing", + "noleftkerning", "noleftligaturing", "norightkerning", "norightligaturing", "noitaliccorrection", -- "futureletnexttoken", "defbackslashbreak", "letbackslashbreak", -- diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf Binary files differindex 08ce08e1b..3b3e4165a 100644 --- a/tex/context/base/mkiv/status-files.pdf +++ b/tex/context/base/mkiv/status-files.pdf diff --git a/tex/context/base/mkiv/status-lua.pdf b/tex/context/base/mkiv/status-lua.pdf Binary files differindex 4eed9795d..f276ac586 100644 --- a/tex/context/base/mkiv/status-lua.pdf +++ b/tex/context/base/mkiv/status-lua.pdf diff --git a/tex/context/base/mkxl/anch-loc.lmt b/tex/context/base/mkxl/anch-loc.lmt index d16ff94a4..56ddeb7e2 100644 --- a/tex/context/base/mkxl/anch-loc.lmt +++ b/tex/context/base/mkxl/anch-loc.lmt @@ -70,7 +70,7 @@ end -- local function finalizepositions(...) -- end -local function collectpositions(current,pos_h,pos_v) +local function collectpositions(current,pos_h,pos_v,cur_b) -- beware, we actually can have a copy due to setting trialrun so we cannot -- fetch the nodetable directly but go via the metatable ... fast enough local data = getprop(current,"data") @@ -90,7 +90,7 @@ local function collectpositions(current,pos_h,pos_v) elseif y > hash.max then hash.max = y end - hash[y] = { pos_h, pos_v, data, current, 0, false } + hash[y] = { pos_h, pos_v, data, current, 0, false, cur_b } end local function valid(name,x,y) @@ -113,6 +113,42 @@ local function anchory(name,x,y) return v and v[2] or 0 end +local function anchorht(name,x,y) + local v = valid(name,x,y) + if v then + return v[7][2] + else + return 0 + end +end + +local function anchordp(name,x,y) + local v = valid(name,x,y) + if v then + return v[7][3] + else + return 0 + end +end + +local function anchorur(name,x,y) + local v = valid(name,x,y) + if v then + return v[1], v[2] + v[7][2] + else + return 0, 0 + end +end + +local function anchorll(name,x,y) + local v = valid(name,x,y) + if v then + return v[1], v[2] - v[7][3] + else + return 0, 0 + end +end + local function anchorxy(name,x,y) local v = valid(name,x,y) if v then @@ -347,6 +383,7 @@ do local injectnumeric = injectors.numeric local injectpair = injectors.pair + local injectpath = injectors.path local scaninteger = scanners.integer local scanstring = scanners.string @@ -357,16 +394,85 @@ do local registerdirect = metapost.registerdirect registerscript("anchorxy", function() - x, y = anchorxy(scanstring(),scaninteger(),scaninteger()) - return injectpair(x*bpfactor, y*bpfactor) + local x, y = anchorxy(scanstring(),scaninteger(),scaninteger()) + return injectpair(x*bpfactor,y*bpfactor) end) - registerdirect("anchorx", function() + registerdirect("anchorx", function() return anchorx(scanstring(),scaninteger(),scaninteger()) * bpfactor end) - registerdirect("anchory", function() + registerdirect("anchory", function() return anchory(scanstring(),scaninteger(),scaninteger()) * bpfactor end) + registerdirect("anchorht", function() + return anchorht(scanstring(),scaninteger(),scaninteger()) * bpfactor + end) + + registerdirect("anchordp", function() + return anchordp(scanstring(),scaninteger(),scaninteger()) * bpfactor + end) + + registerdirect("anchorur", function() + local x, y = anchorur(scanstring(),scaninteger(),scaninteger()) + return injectpair(x*bpfactor,y*bpfactor) + end) + + registerdirect("anchorll", function() + local x, y = anchorll(scanstring(),scaninteger(),scaninteger()) + return injectpair(x*bpfactor,y*bpfactor) + end) + + registerscript("anchorbox", function() + local l = valid(scanstring(),scaninteger(),scaninteger()) + local r = valid(scanstring(),scaninteger(),scaninteger()) + local llx, lly, urx, ury, llb, urb + if l and r then + llx = l[1] + lly = l[2] + urx = r[1] + ury = r[2] + llb = l[7] + urb = r[7] + if llx > urx then + llx, urx = urx, llx + end + if lly > ury then + lly, ury = ury, lly + lly = lly - urb[3] + ury = ury + llb[2] + else + lly = lly - llb[3] + ury = ury + urb[2] + end + llx = llx * bpfactor + lly = lly * bpfactor + urx = urx * bpfactor + ury = ury * bpfactor + else + llx = 0 + lly = 0 + urx = 0 + ury = 0 + end + local p = { + cycle = true, + curled = true, + { llx, lly }, + { urx, lly }, + { urx, ury }, + { llx, ury } + } + -- local p = { + -- cycle = true, + -- -- curled = true, + -- { x_coord = llx, y_coord = lly }, + -- { x_coord = urx, y_coord = lly }, + -- { x_coord = urx, y_coord = ury }, + -- { x_coord = llx, y_coord = ury } + -- } + injectpath(p) + end) + end diff --git a/tex/context/base/mkxl/cont-new.mkxl b/tex/context/base/mkxl/cont-new.mkxl index 0444caf4f..730c7896c 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{2021.05.31 14:09} +\newcontextversion{2021.06.01 17:00} %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 67be93764..916b1bb8f 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{2021.05.31 14:09} +\immutable\edef\contextversion{2021.06.01 17:00} %overloadmode 1 % check frozen / warning %overloadmode 2 % check frozen / error diff --git a/tex/context/base/mkxl/driv-usr.lmt b/tex/context/base/mkxl/driv-usr.lmt index e9d24b3c2..2dc3cda73 100644 --- a/tex/context/base/mkxl/driv-usr.lmt +++ b/tex/context/base/mkxl/driv-usr.lmt @@ -100,6 +100,7 @@ hlist_out = function(this_box,current) local ref_r = pos_r pos_r = getdirection(this_box) local cur_h = 0 + local cur_b for current, id, subtype in nextnode, current do if id == glyph_code then -- or id == kern_code @@ -221,7 +222,11 @@ hlist_out = function(this_box,current) if subtype == userdefined_code then local action = userdefined[getprop(current,"id")] if action then - action(current,pos_h,pos_v) + if not cur_b then + local wd, ht, dp = getwhd(this_box) + cur_b = { wd, ht, dp, ref_h, ref_v, ref_r } + end + action(current, pos_h,pos_v, cur_b) end end elseif id == disc_code then @@ -256,6 +261,7 @@ vlist_out = function(this_box,current) local top_edge = cur_v pos_h = ref_h pos_v = ref_v - cur_v + local cur_b for current, id, subtype in nextnode, current do if id == glue_code then @@ -322,6 +328,10 @@ vlist_out = function(this_box,current) if subtype == userdefined_code then local action = userdefined[getprop(current,"id")] if action then + if not cur_b then + local wd, ht, dp = getwhd(this_box) + cur_b = { wd, ht, dp, ref_h, ref_v, ref_r } + end action(current,pos_h,pos_v) end end diff --git a/tex/context/base/mkxl/lang-ini.mkxl b/tex/context/base/mkxl/lang-ini.mkxl index 02d2407bd..6ea18ac41 100644 --- a/tex/context/base/mkxl/lang-ini.mkxl +++ b/tex/context/base/mkxl/lang-ini.mkxl @@ -845,6 +845,10 @@ \permanent\protected\def\norightkerning {\bitwiseflip\glyphoptions\norightkerncode} \permanent\protected\def\norightligaturing{\bitwiseflip\glyphoptions\norightligaturecode} +% This is not really language related but let's define it here: + +\permanent\protected\def\noitaliccorrection{\bitwiseflip\glyphoptions\noitaliccorrectioncode} + %D Also \LMTX: % \startlanguageoptions[de] diff --git a/tex/context/base/mkxl/math-ali.mkxl b/tex/context/base/mkxl/math-ali.mkxl index 44e436338..ddc004198 100644 --- a/tex/context/base/mkxl/math-ali.mkxl +++ b/tex/context/base/mkxl/math-ali.mkxl @@ -271,6 +271,7 @@ %D Here we implement the user interface part. We start with basic math alignments: \newcount \c_math_eqalign_column +\newcount \c_math_eqalign_row \newconditional\c_math_eqalign_first \newtoks \everymathalignment @@ -374,6 +375,7 @@ \fi \math_alignment_snap_start \the\everymathalignment + \c_math_eqalign_row \zerocount \c_math_eqalign_column\zerocount \edef\p_math_alignment_number{\mathalignmentparameter\c!number}% \processcommacommand @@ -463,6 +465,7 @@ \def\math_first_in_eqalign {\global\c_math_eqalign_column\plusone + \global\advance\c_math_eqalign_row\plusone \dostarttagged\t!mtablerow \empty \dostarttagged\t!mtablecell\empty} @@ -507,10 +510,10 @@ {\expandafter\chardef\csname\??mathalignmentvariant\number\c_math_eqalign_column\expandafter\expandafter\expandafter\endcsname \ifcsname\??mathalignmentvariant#1\endcsname\lastnamedcs\else\zerocount\fi\relax} -\letvalue{\??mathalignmentvariant\v!normal}\zerocount -\letvalue{\??mathalignmentvariant\v!left }\plusone -\letvalue{\??mathalignmentvariant\v!right }\plustwo -\letvalue{\??mathalignmentvariant\v!middle}\plusthree +\letcsname\??mathalignmentvariant\v!normal\endcsname\zerocount +\letcsname\??mathalignmentvariant\v!left \endcsname\plusone +\letcsname\??mathalignmentvariant\v!right \endcsname\plustwo +\letcsname\??mathalignmentvariant\v!middle\endcsname\plusthree \permanent\protected\def\math_align_NR_generic[#1][#2]% {\strc_formulas_place_number_nested{#1}{#2}\crcr} @@ -833,6 +836,7 @@ \everycr\emptytoks \tabskip\zeropoint \global\c_math_eqalign_column\plusone + \global\c_math_eqalign_row\plusone \global\c_math_cases_nc\zerocount \halign\bgroup \ifmmode\else\startimath\fi @@ -928,6 +932,7 @@ \def\math_matrix_start_table {\global\c_math_eqalign_column\zerocount + \global\c_math_eqalign_row\zerocount \dostarttagged\t!math\empty \dostarttagged\t!mtable\empty} @@ -945,6 +950,7 @@ \def\math_matrix_start_row {\beginlocalcontrol \global\c_math_eqalign_column\zerocount + \global\advance\c_math_eqalign_row\plusone \dostarttagged\t!mtablerow\empty \endlocalcontrol} @@ -971,15 +977,67 @@ % We could construct a preamble with alignment and such embedded but the number % of matrices with many rows is normally so low that it doesn't pay of at all. +\newconditional\c_math_matrix_first +\newconstant \c_math_matrix_anchor_mode + +% enabled : 1 +% left/both : 2 +% right/both : 4 + +% \c_math_matrix_anchor_mode3 + +\permanent\protected\def\setmathmatrixanchoring[#1]% + {\c_math_matrix_anchor_mode\zerocount + \processaction + [#1] + [ \v!left=>\bitwiseflip\c_math_matrix_anchor_mode\numexpr\plusone+\plustwo\relax, + \v!right=>\bitwiseflip\c_math_matrix_anchor_mode\numexpr\plusone+\plusfour\relax, + \v!both=>\bitwiseflip\c_math_matrix_anchor_mode\numexpr\plusone+\plustwo+\plusfour\relax, + \v!yes=>\bitwiseflip\c_math_matrix_anchor_mode\numexpr\plusone]} + +\def\math_matrix_anchor + {\ifbitwiseand\c_math_matrix_anchor_mode\plusone + \markanchor{matrix}{\numexpr\c_math_eqalign_column+1\relax}\c_math_eqalign_row + \fi} + \protected\def\math_matrix_distance {\relax \ifdim\d_math_eqalign_distance>\zeropoint - \hskip\d_math_eqalign_distance + \hskip.5\d_math_eqalign_distance + \fi + \math_matrix_anchor + \ifdim\d_math_eqalign_distance>\zeropoint + \hskip.5\d_math_eqalign_distance + \fi + \relax} + +\protected\def\math_matrix_distance_first + {\relax + \ifbitwiseand\c_math_matrix_anchor_mode\plusone + \math_matrix_anchor + \fi + \ifdim\d_math_eqalign_distance>\zeropoint + \ifbitwiseand\c_math_matrix_anchor_mode\plustwo + \hskip.5\d_math_eqalign_distance + \fi + \fi + \relax} + +\protected\def\math_matrix_distance_last + {\relax + \ifdim\d_math_eqalign_distance>\zeropoint + \ifbitwiseand\c_math_matrix_anchor_mode\plusfour + \hskip.5\d_math_eqalign_distance + \fi + \fi + \ifbitwiseand\c_math_matrix_anchor_mode\plusone + \math_matrix_anchor \fi \relax} \def\math_matrix_preamble {\math_matrix_strut + \math_matrix_distance_first \global\advance\c_math_eqalign_column\plusone \math_matrix_start_cell \alignmark\alignmark @@ -992,10 +1050,9 @@ \alignmark\alignmark \math_matrix_stop_cell} -\newconditional\c_math_matrix_first - \permanent\protected\def\math_matrix_NR {\aligntab\omit + \math_matrix_distance_last \math_matrix_stop_row \math_matrix_pickup \crcr @@ -1123,6 +1180,7 @@ \rawprocesscommacommand[\mathmatrixparameter\c!align]\math_matrix_set_columns_step} \newcount\c_math_eqalign_column_saved +\newcount\c_math_eqalign_row_saved % \installglobalmacrostack\c_math_matrix_first @@ -1130,6 +1188,7 @@ {\begingroup \globalpushmacro\c_math_matrix_first % hm, does that work? \c_math_eqalign_column_saved\c_math_eqalign_column + \c_math_eqalign_row_saved\c_math_eqalign_row \globalpushmacro\c_math_eqalign_first \edef\currentmathmatrix{#1}% \setupcurrentmathmatrix[#2]% @@ -1142,6 +1201,7 @@ {\math_matrix_stop_processing \globalpushmacro\c_math_eqalign_first \global\c_math_eqalign_column\c_math_eqalign_column_saved + \global\c_math_eqalign_row\c_math_eqalign_row_saved \globalpopmacro\c_math_matrix_first \endgroup} @@ -1157,13 +1217,13 @@ \mutable\let\mathmatrixleft \empty % experimental hook \mutable\let\mathmatrixright\empty % experimental hook -\setvalue{\??mathmatrixalignlocation\v!top }{\raise\dimexpr(\nextboxdp-\nextboxht)/2 +\mathaxisheight\mathstyle\relax} -\setvalue{\??mathmatrixalignlocation\v!high }{\raise\dimexpr(\nextboxdp-\nextboxht)/2\relax} -\setvalue{\??mathmatrixalignlocation\v!center}{\relax} -\setvalue{\??mathmatrixalignlocation\v!lohi} {\relax} -\setvalue{\??mathmatrixalignlocation\v!normal}{\relax} -\setvalue{\??mathmatrixalignlocation\v!bottom}{\lower\dimexpr(\nextboxdp-\nextboxht)/2 +\mathaxisheight\mathstyle\relax} -\setvalue{\??mathmatrixalignlocation\v!low }{\lower\dimexpr(\nextboxdp-\nextboxht)/2\relax} +\defcsname\??mathmatrixalignlocation\v!top \endcsname{\raise\dimexpr(\nextboxdp-\nextboxht)/2 +\mathaxisheight\mathstyle\relax} +\defcsname\??mathmatrixalignlocation\v!high \endcsname{\raise\dimexpr(\nextboxdp-\nextboxht)/2\relax} +\defcsname\??mathmatrixalignlocation\v!center\endcsname{\relax} +\defcsname\??mathmatrixalignlocation\v!lohi \endcsname{\relax} +\defcsname\??mathmatrixalignlocation\v!normal\endcsname{\relax} +\defcsname\??mathmatrixalignlocation\v!bottom\endcsname{\lower\dimexpr(\nextboxdp-\nextboxht)/2 +\mathaxisheight\mathstyle\relax} +\defcsname\??mathmatrixalignlocation\v!low \endcsname{\lower\dimexpr(\nextboxdp-\nextboxht)/2\relax} \def\math_matrix_finish_nextbox {\begincsname\??mathmatrixalignlocation\mathmatrixparameter\c!location\endcsname\hbox\bgroup @@ -1314,9 +1374,8 @@ {\math_matrix_stop \endgroup} -%D The following code is derived from Aditya's simplematrix prototype but -%D adapted to regular mathmatrices (which saves some code so it can go into -%D the core): +%D The following code is derived from Aditya's simplematrix prototype but adapted to +%D regular mathmatrices: \def\math_matrix_simple_row#1% {\rawprocesscommalist[#1]\math_matrix_simple_col @@ -1590,7 +1649,7 @@ \newdimen\d_strc_math_framed_width -\setvalue{\??formulaoption\v!frame}% +\defcsname\??formulaoption\v!frame\endcsname {\edef\p_frame{\formulaparameter\c!frame}% \ifx\p_frame\v!number \c_strc_formulas_frame_mode\plustwo % inside frame diff --git a/tex/context/base/mkxl/mlib-lua.lmt b/tex/context/base/mkxl/mlib-lua.lmt index 479dbcae1..137aa6223 100644 --- a/tex/context/base/mkxl/mlib-lua.lmt +++ b/tex/context/base/mkxl/mlib-lua.lmt @@ -125,27 +125,57 @@ end -- local p = mp.scan.path() -- mp.inject.path(p,true,true) +-- function inject.path(p,close,connector) +-- local curled = false +-- local n = #p +-- if p.close or p.cycle then +-- close = true +-- end +-- if p.curled then +-- curled = true +-- end +-- if n > 1 then +-- -- [ ../true | --/false | nil/auto ] +-- if connector == nil or connector == "auto" then +-- connector = #p[1] > 2 +-- end +-- if connector == false or connector == "--" then +-- curled = true +-- elseif connector == true or connector == ".." then +-- if close and not same(p,n) then +-- p[n+1] = p[1] +-- end +-- end +-- end +-- if trace then reporti("path") end +-- return injectpath(currentmpx,p,close,curled) +-- end + function inject.path(p,close,connector) + local closed = false local curled = false local n = #p - if p.close or p.cycle then - close = true + if close == nil then + closed = (p.close or p.cycle or p.closed) and true or false + else + closed = close end - if n > 1 then - -- [ ../true | --/false | nil/auto ] - if connector == nil or connector == "auto" then + if connector then + if connector == "auto" then connector = #p[1] > 2 end if connector == false or connector == "--" then curled = true - elseif connector == true or connector == ".." then - if close and not same(p,n) then - p[n+1] = p[1] - end + -- elseif connector == true or connector == ".." then + -- if close and not same(p,n) then + -- p[n+1] = p[1] + -- end end + elseif p.curled then + curled = true end if trace then reporti("path") end - return injectpath(currentmpx,p,close,curled) + return injectpath(currentmpx,p,closed,curled) end -- bonus: diff --git a/tex/context/base/mkxl/mlib-mpf.lmt b/tex/context/base/mkxl/mlib-mpf.lmt index 51b507647..b03c664b8 100644 --- a/tex/context/base/mkxl/mlib-mpf.lmt +++ b/tex/context/base/mkxl/mlib-mpf.lmt @@ -943,8 +943,8 @@ do local scannumeric = scan.numeric local skiptoken = skip.token - local injectstring = inject.string - local injectnumeric = inject.numeric + ----- injectstring = inject.string + ----- injectnumeric = inject.numeric local registerdirect = metapost.registerdirect local registerscript = metapost.registerscript diff --git a/tex/context/base/mkxl/node-shp.lmt b/tex/context/base/mkxl/node-shp.lmt index 8a0a26510..a4171e379 100644 --- a/tex/context/base/mkxl/node-shp.lmt +++ b/tex/context/base/mkxl/node-shp.lmt @@ -113,3 +113,53 @@ statistics.register("node frequencies", function() return format("saved in %q",filename) end end) + +do -- for the moment: + + local whatsitcodes = nodes.whatsitcodes + local whatsit_code = nodecodes.whatsit + + local removables = { + [whatsitcodes.open] = true, + [whatsitcodes.close] = true, + [whatsitcodes.write] = true, + [whatsitcodes.savepos] = true, + [whatsitcodes.latelua] = true, + } + + local setlist = nuts.setlist + local getlist = nuts.getlist + local remove = nuts.remove + + local function cleanup(head) + for current, id, subtype in nextnode, head do + if id == whatsit_code then + if removables[subtype] then + head = remove(head,current,true) + end + elseif id == hlist_code or id == vlist_code then + local sl = getlist(current) + if sl then + local rl = cleanup(sl) + if rl ~= sl then + setlist(current,rl) + end + end + end + end + return head + end + + function handlers.cleanupbox(box) + cleanup(getbox(box)) + end + + implement { + name = "cleanupbox", + public = true, + protected = true, + actions = handlers.cleanupbox, + arguments = "integerargument" + } + +end diff --git a/tex/context/base/mkxl/typo-itc.lmt b/tex/context/base/mkxl/typo-itc.lmt index 74c47355f..dd7945eab 100644 --- a/tex/context/base/mkxl/typo-itc.lmt +++ b/tex/context/base/mkxl/typo-itc.lmt @@ -43,6 +43,7 @@ local isglyph = nuts.isglyph local setkern = nuts.setkern local getkern = nuts.getkern local getheight = nuts.getheight +local getoptions = nuts.getoptions local insertnodeafter = nuts.insertafter local remove_node = nuts.remove @@ -58,6 +59,8 @@ local unsetvalue = attributes.unsetvalue local new_correction_kern = nodepool.italickern local new_correction_glue = nodepool.glue +local no_correction_code = tex.glyphoptioncodes.noitaliccorrection + local fonthashes = fonts.hashes local fontdata = fonthashes.identifiers local italicsdata = fonthashes.italics @@ -116,36 +119,46 @@ end -- todo: clear attribute +local function correction_okay(n) + return not (getoptions(n) & no_correction_code) +end + local function okay(data,current,font,prevchar,previtalic,char,what) - if data then + if getoptions(current) & no_correction_code then if trace_italics then - report_italics("ignoring %p between %s italic %C and italic %C",previtalic,what,prevchar,char) + report_italics("ignoring %p between %s italic %C and italic %C, %s",previtalic,what,prevchar,char,"disabled") end return false - end - if threshold then - -- if getid(current) == glyph_code then - while current and getid(current) ~= glyph_code do - current = getprev(current) + elseif data then + if trace_italics then + report_italics("ignoring %p between %s italic %C and italic %C, %s",previtalic,what,prevchar,char,"no data") end - if current then - local ht = getheight(current) - local ex = exheights[font] - local th = threshold * ex - if ht <= th then - if trace_italics then - report_italics("ignoring correction between %s italic %C and regular %C, height %p less than threshold %p",prevchar,what,char,ht,th) + return false + else + if threshold then + -- if getid(current) == glyph_code then + while current and getid(current) ~= glyph_code do + current = getprev(current) + end + if current then + local ht = getheight(current) + local ex = exheights[font] + local th = threshold * ex + if ht <= th then + if trace_italics then + report_italics("ignoring correction between %s italic %C and regular %C, height %p less than threshold %p",prevchar,what,char,ht,th) + end + return false end - return false + else + -- maybe backtrack to glyph end - else - -- maybe backtrack to glyph end + if trace_italics then + report_italics("inserting %p between %s italic %C and regular %C",previtalic,what,prevchar,char) + end + return true end - if trace_italics then - report_italics("inserting %p between %s italic %C and regular %C",previtalic,what,prevchar,char) - end - return true end -- maybe: with_attributes(current,n) : @@ -188,7 +201,7 @@ local function domath(head,current) local next = getnext(current) if next then local char, id = isglyph(next) - if char then + if char and correction_okay(next) then -- we can have an old font where italic correction has been applied -- or a new one where it hasn't been done local kern = getprev(current) @@ -393,35 +406,39 @@ local function texthandler(head) while current do local char, id = isglyph(current) if char then - local font = id - if font ~= lastfont then - local data = italicsdata[font] - if data then - local attr = forcedvariant or getattr(current,a_italics) - if attr and attr > 0 then - local cd = data[char] - if not cd then - -- this really can happen - replaceitalic = 0 - else - replaceitalic = cd.italic - if not replaceitalic then - replaceitalic = setitalicinfont(font,char) -- calculated once - -- replaceitalic = 0 - end - if replaceitalic ~= 0 then - lastfont = font - lastattr = attr - replacechar = char - replacehead = replace - updated = true + if correction_okay(current) then + local font = id + if font ~= lastfont then + local data = italicsdata[font] + if data then + local attr = forcedvariant or getattr(current,a_italics) + if attr and attr > 0 then + local cd = data[char] + if not cd then + -- this really can happen + replaceitalic = 0 + else + replaceitalic = cd.italic + if not replaceitalic then + replaceitalic = setitalicinfont(font,char) -- calculated once + -- replaceitalic = 0 + end + if replaceitalic ~= 0 then + lastfont = font + lastattr = attr + replacechar = char + replacehead = replace + updated = true + end end end end + replacefont = font end - replacefont = font + break + else + current = getprev(current) end - break else current = getprev(current) end @@ -432,35 +449,39 @@ local function texthandler(head) while current do local char, id = isglyph(current) if char then - local font = id - if font ~= lastfont then - local data = italicsdata[font] - if data then - local attr = forcedvariant or getattr(current,a_italics) - if attr and attr > 0 then - local cd = data[char] - if not cd then - -- this really can happen - -- postitalic = 0 - else - postitalic = cd.italic - if not postitalic then - postitalic = setitalicinfont(font,char) -- calculated once - -- postitalic = 0 - end - if postitalic ~= 0 then - lastfont = font - lastattr = attr - postchar = char - posthead = post - updated = true + if correction_okay(current) then + local font = id + if font ~= lastfont then + local data = italicsdata[font] + if data then + local attr = forcedvariant or getattr(current,a_italics) + if attr and attr > 0 then + local cd = data[char] + if not cd then + -- this really can happen + -- postitalic = 0 + else + postitalic = cd.italic + if not postitalic then + postitalic = setitalicinfont(font,char) -- calculated once + -- postitalic = 0 + end + if postitalic ~= 0 then + lastfont = font + lastattr = attr + postchar = char + posthead = post + updated = true + end end end end + postfont = font end - postfont = font + break + else + current = getprev(current) end - break else current = getprev(current) end @@ -518,43 +539,41 @@ local function texthandler(head) else current = endofmath(current) end + elseif previtalic ~= 0 then + if trace_italics then + report_italics("inserting %p between %s italic %C and whatever",previtalic,"glyph",prevchar) + end + insertnodeafter(prevhead,prev,correction_kern(previtalic,current)) + previnserted = nil + previtalic = 0 + replaceinserted = nil + replaceitalic = 0 + postinserted = nil + postitalic = 0 else - if previtalic ~= 0 then + if replaceitalic ~= 0 then if trace_italics then - report_italics("inserting %p between %s italic %C and whatever",previtalic,"glyph",prevchar) + report_italics("inserting %p between %s italic %C and whatever",replaceitalic,"replace",replacechar) end - insertnodeafter(prevhead,prev,correction_kern(previtalic,current)) + insertnodeafter(replacehead,replace,correction_kern(replaceitalic,current)) previnserted = nil previtalic = 0 replaceinserted = nil replaceitalic = 0 postinserted = nil postitalic = 0 - else - if replaceitalic ~= 0 then - if trace_italics then - report_italics("inserting %p between %s italic %C and whatever",replaceitalic,"replace",replacechar) - end - insertnodeafter(replacehead,replace,correction_kern(replaceitalic,current)) - previnserted = nil - previtalic = 0 - replaceinserted = nil - replaceitalic = 0 - postinserted = nil - postitalic = 0 - end - if postitalic ~= 0 then - if trace_italics then - report_italics("inserting %p between %s italic %C and whatever",postitalic,"post",postchar) - end - insertnodeafter(posthead,post,correction_kern(postitalic,current)) - previnserted = nil - previtalic = 0 - replaceinserted = nil - replaceitalic = 0 - postinserted = nil - postitalic = 0 + end + if postitalic ~= 0 then + if trace_italics then + report_italics("inserting %p between %s italic %C and whatever",postitalic,"post",postchar) end + insertnodeafter(posthead,post,correction_kern(postitalic,current)) + previnserted = nil + previtalic = 0 + replaceinserted = nil + replaceitalic = 0 + postinserted = nil + postitalic = 0 end end current = getnext(current) diff --git a/tex/context/interface/mkii/keys-cs.xml b/tex/context/interface/mkii/keys-cs.xml index f13345e04..0a69cdd6d 100644 --- a/tex/context/interface/mkii/keys-cs.xml +++ b/tex/context/interface/mkii/keys-cs.xml @@ -1271,6 +1271,7 @@ <cd:constant name='symbolset' value='sadasymbolu'/> <cd:constant name='symcolor' value='barvasymbolu'/> <cd:constant name='symstyle' value='stylsymboly'/> + <cd:constant name='synchronize' value='synchronize'/> <cd:constant name='synonym' value='synonymum'/> <cd:constant name='synonymcolor' value='barvasynonyma'/> <cd:constant name='synonymcommand' value='synonymcommand'/> diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 1f823df95..aed87aa35 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 : 2021-05-31 14:09 +-- merge date : 2021-06-01 17:00 do -- begin closure to overcome local limits and interference |