From 0aa93a6d31a45d8df2d8516567b98967ce04f183 Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Fri, 14 Oct 2022 10:56:48 +0200 Subject: 2022-10-14 10:15:00 --- .../lexers/data/scite-context-data-context.lua | 2 +- .../context/lexers/data/scite-context-data-tex.lua | 2 +- .../context/scite-context-data-context.properties | 121 +- .../context/scite-context-data-tex.properties | 197 +- .../manuals/ontarget/ontarget-gettingridof.tex | 1666 ++++++++++++++ .../sources/general/manuals/ontarget/ontarget.tex | 1 + metapost/context/base/mpxl/mp-math.mpxl | 10 + metapost/context/base/mpxl/mp-tool.mpxl | 41 +- scripts/context/lua/mtx-fonts.lua | 2 +- scripts/context/lua/mtx-unicode.lua | 84 +- source/luametatex/source/README | 39 - source/luametatex/source/lua/lmtfontlib.c | 52 +- source/luametatex/source/lua/lmtinterface.c | 61 +- source/luametatex/source/lua/lmtinterface.h | 37 +- source/luametatex/source/lua/lmtnodelib.c | 186 +- source/luametatex/source/lua/lmtnodelib.h | 56 +- source/luametatex/source/lua/lmttexlib.c | 46 +- source/luametatex/source/lua/lmttokenlib.c | 6 +- .../luametatex/source/luacore/lua54/src/lobject.c | 2 +- .../luametatex/source/luacore/lua54/src/loslib.c | 4 +- .../luametatex/source/luacore/lua54/src/lutf8lib.c | 27 +- source/luametatex/source/luacore/lua54/src/lvm.c | 4 +- source/luametatex/source/luacore/lua54/src/lvm.h | 5 + source/luametatex/source/luametatex.h | 7 +- source/luametatex/source/mp/mpc/mp.c | 24 +- source/luametatex/source/mp/mpc/mp.h | 2 + source/luametatex/source/mp/mpw/mp.w | 250 ++- source/luametatex/source/tex/texadjust.c | 12 +- source/luametatex/source/tex/texalign.c | 10 +- source/luametatex/source/tex/texbuildpage.c | 9 - source/luametatex/source/tex/texbuildpage.h | 1 - source/luametatex/source/tex/texcommands.c | 60 +- source/luametatex/source/tex/texcommands.h | 68 +- source/luametatex/source/tex/texconditional.c | 10 + source/luametatex/source/tex/texconditional.h | 13 +- source/luametatex/source/tex/texdumpdata.c | 38 +- source/luametatex/source/tex/texdumpdata.h | 6 +- source/luametatex/source/tex/texequivalents.c | 78 +- source/luametatex/source/tex/texequivalents.h | 165 +- source/luametatex/source/tex/texerrors.c | 95 +- source/luametatex/source/tex/texfont.c | 137 +- source/luametatex/source/tex/texfont.h | 47 +- source/luametatex/source/tex/texinserts.c | 2 +- source/luametatex/source/tex/texmaincontrol.c | 120 +- source/luametatex/source/tex/texmath.c | 224 +- source/luametatex/source/tex/texmath.h | 21 +- source/luametatex/source/tex/texmathcodes.c | 10 +- source/luametatex/source/tex/texmlist.c | 1218 +++-------- source/luametatex/source/tex/texmlist.h | 20 +- source/luametatex/source/tex/texnodes.c | 247 +-- source/luametatex/source/tex/texnodes.h | 19 +- source/luametatex/source/tex/texpackaging.c | 72 +- source/luametatex/source/tex/texpackaging.h | 2 +- source/luametatex/source/tex/texprinting.c | 143 +- source/luametatex/source/tex/texprinting.h | 99 +- source/luametatex/source/tex/texscanning.c | 97 +- source/luametatex/source/tex/textoken.c | 63 +- source/luametatex/source/utilities/auxfile.c | 10 - .../luametatex/source/utilities/auxsparsearray.c | 7 - .../luametatex/source/utilities/auxsparsearray.h | 12 - source/luametatex/source/utilities/auxunistring.h | 1 - tex/context/base/mkii/cont-new.mkii | 2 +- tex/context/base/mkii/context.mkii | 2 +- tex/context/base/mkiv/char-def.lua | 2301 +++++++++++++++++++- tex/context/base/mkiv/char-ini.lua | 24 +- tex/context/base/mkiv/cont-new.mkiv | 2 +- tex/context/base/mkiv/context.mkiv | 2 +- tex/context/base/mkiv/font-cff.lua | 23 +- tex/context/base/mkiv/font-dsp.lua | 20 +- tex/context/base/mkiv/font-imp-italics.lua | 8 +- tex/context/base/mkiv/font-mis.lua | 2 +- tex/context/base/mkiv/font-osd.lua | 103 +- tex/context/base/mkiv/font-otc.lua | 6 + tex/context/base/mkiv/font-otl.lua | 2 +- tex/context/base/mkiv/font-ots.lua | 423 ++-- tex/context/base/mkiv/font-shp.lua | 2 +- tex/context/base/mkiv/math-dir.lua | 1 + tex/context/base/mkiv/mult-low.lua | 10 +- tex/context/base/mkiv/mult-prm.lua | 6 + tex/context/base/mkiv/pack-cut.mkiv | 8 +- tex/context/base/mkiv/status-files.pdf | Bin 24641 -> 24594 bytes tex/context/base/mkiv/status-lua.pdf | Bin 260468 -> 261499 bytes tex/context/base/mkiv/strc-doc.lua | 6 +- tex/context/base/mkiv/strc-lst.lua | 9 + tex/context/base/mkiv/type-set.mkiv | 1 + tex/context/base/mkxl/anch-pgr.lmt | 7 +- tex/context/base/mkxl/anch-pos.lmt | 52 +- tex/context/base/mkxl/anch-pos.mkxl | 27 +- tex/context/base/mkxl/buff-ini.lmt | 2 +- tex/context/base/mkxl/cont-new.mkxl | 2 +- tex/context/base/mkxl/context.mkxl | 2 +- tex/context/base/mkxl/core-env.lmt | 48 +- tex/context/base/mkxl/core-uti.lmt | 4 +- tex/context/base/mkxl/font-con.lmt | 30 +- tex/context/base/mkxl/font-ctx.lmt | 36 +- tex/context/base/mkxl/font-imp-effects.lmt | 20 +- tex/context/base/mkxl/font-imp-math.lmt | 105 +- tex/context/base/mkxl/font-ini.mklx | 6 +- tex/context/base/mkxl/font-mat.mklx | 275 ++- tex/context/base/mkxl/font-mps.lmt | 8 + tex/context/base/mkxl/font-otl.lmt | 24 +- tex/context/base/mkxl/font-ots.lmt | 246 ++- tex/context/base/mkxl/font-pre.mkxl | 4 - tex/context/base/mkxl/grph-trf.mkxl | 2 +- tex/context/base/mkxl/lpdf-ano.lmt | 6 +- tex/context/base/mkxl/lpdf-emb.lmt | 132 +- tex/context/base/mkxl/lpdf-lmt.lmt | 12 +- tex/context/base/mkxl/lpdf-rul.lmt | 2 - tex/context/base/mkxl/math-act.lmt | 1083 +++++++-- tex/context/base/mkxl/math-ali.mkxl | 184 +- tex/context/base/mkxl/math-del.mklx | 7 + tex/context/base/mkxl/math-fbk.lmt | 4 +- tex/context/base/mkxl/math-fen.mkxl | 72 +- tex/context/base/mkxl/math-fnt.lmt | 5 +- tex/context/base/mkxl/math-frc.mkxl | 30 +- tex/context/base/mkxl/math-ini.mkxl | 659 +++--- tex/context/base/mkxl/math-map.lmt | 160 +- tex/context/base/mkxl/math-noa.lmt | 11 +- tex/context/base/mkxl/math-rad.mklx | 8 +- tex/context/base/mkxl/math-stc.mklx | 11 +- tex/context/base/mkxl/math-vfu.lmt | 11 +- tex/context/base/mkxl/mult-sys.mkxl | 1 + tex/context/base/mkxl/node-ali.lmt | 64 +- tex/context/base/mkxl/node-ini.lmt | 2 + tex/context/base/mkxl/pack-box.mkxl | 2 +- tex/context/base/mkxl/pack-cut.mkxl | 9 +- tex/context/base/mkxl/pack-mrl.mkxl | 6 +- tex/context/base/mkxl/pack-pos.mkxl | 4 +- tex/context/base/mkxl/pack-rul.lmt | 31 +- tex/context/base/mkxl/pack-rul.mkxl | 21 +- tex/context/base/mkxl/page-box.mklx | 17 +- tex/context/base/mkxl/spac-ver.lmt | 47 +- tex/context/base/mkxl/spac-ver.mkxl | 20 +- tex/context/base/mkxl/strc-lst.mklx | 2 +- tex/context/base/mkxl/strc-ref.lmt | 28 +- tex/context/base/mkxl/strc-ref.mklx | 20 +- tex/context/base/mkxl/strc-reg.lmt | 10 +- tex/context/base/mkxl/strc-reg.mkxl | 3 + tex/context/base/mkxl/syst-ini.mkxl | 7 +- tex/context/base/mkxl/tabl-tbl.mkxl | 6 +- tex/context/base/mkxl/task-ini.lmt | 2 +- tex/context/base/mkxl/type-set.mkxl | 1 + tex/context/fonts/mkiv/asana-math.lfg | 15 +- tex/context/fonts/mkiv/bonum-math.lfg | 741 ++++--- tex/context/fonts/mkiv/cambria-math.lfg | 84 +- tex/context/fonts/mkiv/common-math.lfg | 106 + tex/context/fonts/mkiv/concrete-math.lfg | 36 +- tex/context/fonts/mkiv/dejavu-math.lfg | 144 +- tex/context/fonts/mkiv/erewhon-math.lfg | 83 +- tex/context/fonts/mkiv/garamond-math.lfg | 353 +-- tex/context/fonts/mkiv/generic-math.lfg | 27 + tex/context/fonts/mkiv/kpfonts-math.lfg | 95 +- tex/context/fonts/mkiv/libertinus-math.lfg | 201 +- tex/context/fonts/mkiv/lm.lfg | 25 +- tex/context/fonts/mkiv/lucida-opentype-math.lfg | 180 +- tex/context/fonts/mkiv/minion-math.lfg | 99 +- tex/context/fonts/mkiv/pagella-math.lfg | 259 +-- tex/context/fonts/mkiv/schola-math.lfg | 132 +- tex/context/fonts/mkiv/stix-two-math.lfg | 184 +- tex/context/fonts/mkiv/termes-math.lfg | 173 +- tex/context/fonts/mkiv/type-imp-concrete.mkiv | 58 +- tex/context/fonts/mkiv/type-imp-erewhon.mkiv | 46 +- tex/context/fonts/mkiv/type-imp-euler.mkiv | 8 +- tex/context/fonts/mkiv/type-imp-latinmodern.mkiv | 4 +- .../fonts/mkiv/type-imp-newcomputermodern.mkiv | 2 +- tex/context/fonts/mkiv/type-imp-stix.mkiv | 31 +- tex/context/fonts/mkiv/type-imp-texgyre.mkiv | 25 +- tex/context/fonts/mkiv/type-imp-xits.mkiv | 4 +- tex/context/fonts/mkiv/xits-math.lfg | 27 + tex/context/modules/mkiv/s-fonts-charts.mkiv | 6 +- tex/context/modules/mkiv/s-fonts-coverage.mkiv | 12 +- tex/context/modules/mkiv/s-fonts-shapes.lua | 139 +- tex/context/modules/mkiv/s-fonts-shapes.mkiv | 16 +- tex/context/modules/mkiv/s-math-characters.lua | 2 +- tex/generic/context/luatex/luatex-fonts-merged.lua | 395 ++-- 175 files changed, 10622 insertions(+), 5723 deletions(-) create mode 100644 doc/context/sources/general/manuals/ontarget/ontarget-gettingridof.tex delete mode 100644 source/luametatex/source/README create mode 100644 tex/context/fonts/mkiv/common-math.lfg diff --git a/context/data/scite/context/lexers/data/scite-context-data-context.lua b/context/data/scite/context/lexers/data/scite-context-data-context.lua index f90de0fca..f5929b52b 100644 --- a/context/data/scite/context/lexers/data/scite-context-data-context.lua +++ b/context/data/scite/context/lexers/data/scite-context-data-context.lua @@ -1,4 +1,4 @@ return { - ["constants"]={ "zerocount", "minusone", "minustwo", "plusone", "plustwo", "plusthree", "plusfour", "plusfive", "plussix", "plusseven", "pluseight", "plusnine", "plusten", "pluseleven", "plustwelve", "plussixteen", "plusfifty", "plushundred", "plusonehundred", "plustwohundred", "plusfivehundred", "plusthousand", "plustenthousand", "plustwentythousand", "medcard", "maxcard", "maxcardminusone", "zeropoint", "onepoint", "halfapoint", "onebasepoint", "maxcount", "maxdimen", "scaledpoint", "thousandpoint", "points", "halfpoint", "zeroskip", "centeringskip", "stretchingskip", "shrinkingskip", "centeringfillskip", "stretchingfillskip", "shrinkingfillskip", "zeromuskip", "onemuskip", "pluscxxvii", "pluscxxviii", "pluscclv", "pluscclvi", "normalpagebox", "binaryshiftedten", "binaryshiftedtwenty", "binaryshiftedthirty", "thickermuskip", "directionlefttoright", "directionrighttoleft", "endoflinetoken", "outputnewlinechar", "emptytoks", "empty", "undefined", "prerollrun", "voidbox", "emptybox", "emptyvbox", "emptyhbox", "bigskipamount", "medskipamount", "smallskipamount", "fmtname", "fmtversion", "texengine", "texenginename", "texengineversion", "texenginefunctionality", "luatexengine", "pdftexengine", "xetexengine", "unknownengine", "contextformat", "contextversion", "contextlmtxmode", "contextmark", "mksuffix", "activecatcode", "bgroup", "egroup", "endline", "conditionaltrue", "conditionalfalse", "attributeunsetvalue", "statuswrite", "uprotationangle", "rightrotationangle", "downrotationangle", "leftrotationangle", "inicatcodes", "ctxcatcodes", "texcatcodes", "notcatcodes", "txtcatcodes", "vrbcatcodes", "prtcatcodes", "nilcatcodes", "luacatcodes", "tpacatcodes", "tpbcatcodes", "xmlcatcodes", "ctdcatcodes", "rlncatcodes", "escapecatcode", "begingroupcatcode", "endgroupcatcode", "mathshiftcatcode", "alignmentcatcode", "endoflinecatcode", "parametercatcode", "superscriptcatcode", "subscriptcatcode", "ignorecatcode", "spacecatcode", "lettercatcode", "othercatcode", "activecatcode", "commentcatcode", "invalidcatcode", "tabasciicode", "newlineasciicode", "formfeedasciicode", "endoflineasciicode", "endoffileasciicode", "commaasciicode", "spaceasciicode", "periodasciicode", "hashasciicode", "dollarasciicode", "commentasciicode", "ampersandasciicode", "colonasciicode", "backslashasciicode", "circumflexasciicode", "underscoreasciicode", "leftbraceasciicode", "barasciicode", "rightbraceasciicode", "tildeasciicode", "delasciicode", "leftparentasciicode", "rightparentasciicode", "lessthanasciicode", "morethanasciicode", "doublecommentsignal", "atsignasciicode", "exclamationmarkasciicode", "questionmarkasciicode", "doublequoteasciicode", "singlequoteasciicode", "forwardslashasciicode", "primeasciicode", "hyphenasciicode", "percentasciicode", "leftbracketasciicode", "rightbracketasciicode", "hsizefrozenparcode", "skipfrozenparcode", "hangfrozenparcode", "indentfrozenparcode", "parfillfrozenparcode", "adjustfrozenparcode", "protrudefrozenparcode", "tolerancefrozenparcode", "stretchfrozenparcode", "loosenessfrozenparcode", "lastlinefrozenparcode", "linepenaltyfrozenparcode", "clubpenaltyfrozenparcode", "widowpenaltyfrozenparcode", "displaypenaltyfrozenparcode", "brokenpenaltyfrozenparcode", "demeritsfrozenparcode", "shapefrozenparcode", "linefrozenparcode", "hyphenationfrozenparcode", "shapingpenaltyfrozenparcode", "orphanpenaltyfrozenparcode", "allfrozenparcode", "mathpenaltyfrozenparcode", "activemathcharcode", "activetabtoken", "activeformfeedtoken", "activeendoflinetoken", "batchmodecode", "nonstopmodecode", "scrollmodecode", "errorstopmodecode", "bottomlevelgroupcode", "simplegroupcode", "hboxgroupcode", "adjustedhboxgroupcode", "vboxgroupcode", "vtopgroupcode", "aligngroupcode", "noaligngroupcode", "outputgroupcode", "mathgroupcode", "discretionarygroupcode", "insertgroupcode", "vadjustgroupcode", "vcentergroupcode", "mathabovegroupcode", "mathchoicegroupcode", "alsosimplegroupcode", "semisimplegroupcode", "mathshiftgroupcode", "mathleftgroupcode", "localboxgroupcode", "splitoffgroupcode", "splitkeepgroupcode", "preamblegroupcode", "alignsetgroupcode", "finrowgroupcode", "discretionarygroupcode", "markautomigrationcode", "insertautomigrationcode", "adjustautomigrationcode", "preautomigrationcode", "postautomigrationcode", "charnodecode", "hlistnodecode", "vlistnodecode", "rulenodecode", "insertnodecode", "marknodecode", "adjustnodecode", "ligaturenodecode", "discretionarynodecode", "whatsitnodecode", "mathnodecode", "gluenodecode", "kernnodecode", "penaltynodecode", "unsetnodecode", "mathsnodecode", "charifcode", "catifcode", "numifcode", "dimifcode", "oddifcode", "vmodeifcode", "hmodeifcode", "mmodeifcode", "innerifcode", "voidifcode", "hboxifcode", "vboxifcode", "xifcode", "eofifcode", "trueifcode", "falseifcode", "caseifcode", "definedifcode", "csnameifcode", "fontcharifcode", "overrulemathcontrolcode", "underrulemathcontrolcode", "radicalrulemathcontrolcode", "fractionrulemathcontrolcode", "accentskewhalfmathcontrolcode", "accentskewapplymathcontrolcode", "applyordinarykernpairmathcontrolcode", "applyverticalitalickernmathcontrolcode", "applyordinaryitalickernmathcontrolcode", "applycharitalickernmathcontrolcode", "reboxcharitalickernmathcontrolcode", "applyboxeditalickernmathcontrolcode", "staircasekernmathcontrolcode", "applytextitalickernmathcontrolcode", "applyscriptitalickernmathcontrolcode", "checkspaceitalickernmathcontrolcode", "checktextitalickernmathcontrolcode", "analyzescriptnucleuscharmathcontrolcode", "analyzescriptnucleuslistmathcontrolcode", "analyzescriptnucleusboxmathcontrolcode", "noligaturingglyphoptioncode", "nokerningglyphoptioncode", "noexpansionglyphoptioncode", "noprotrusionglyphoptioncode", "noleftkerningglyphoptioncode", "noleftligaturingglyphoptioncode", "norightkerningglyphoptioncode", "norightligaturingglyphoptioncode", "noitaliccorrectionglyphoptioncode", "normalparcontextcode", "vmodeparcontextcode", "vboxparcontextcode", "vtopparcontextcode", "vcenterparcontextcode", "vadjustparcontextcode", "insertparcontextcode", "outputparcontextcode", "alignparcontextcode", "noalignparcontextcode", "spanparcontextcode", "resetparcontextcode", "leftoriginlistanchorcode", "leftheightlistanchorcode", "leftdepthlistanchorcode", "rightoriginlistanchorcode", "rightheightlistanchorcode", "rightdepthlistanchorcode", "centeroriginlistanchorcode", "centerheightlistanchorcode", "centerdepthlistanchorcode", "halfwaytotallistanchorcode", "halfwayheightlistanchorcode", "halfwaydepthlistanchorcode", "halfwayleftlistanchorcode", "halfwayrightlistanchorcode", "negatexlistsigncode", "negateylistsigncode", "negatelistsigncode", "fontslantperpoint", "fontinterwordspace", "fontinterwordstretch", "fontinterwordshrink", "fontexheight", "fontemwidth", "fontextraspace", "slantperpoint", "mathexheight", "mathemwidth", "interwordspace", "interwordstretch", "interwordshrink", "exheight", "emwidth", "extraspace", "mathaxisheight", "muquad", "startmode", "stopmode", "startnotmode", "stopnotmode", "startmodeset", "stopmodeset", "doifmode", "doifelsemode", "doifmodeelse", "doifnotmode", "startmodeset", "stopmodeset", "startallmodes", "stopallmodes", "startnotallmodes", "stopnotallmodes", "doifallmodes", "doifelseallmodes", "doifallmodeselse", "doifnotallmodes", "startenvironment", "stopenvironment", "environment", "startcomponent", "stopcomponent", "component", "startproduct", "stopproduct", "product", "startproject", "stopproject", "project", "starttext", "stoptext", "startnotext", "stopnotext", "startdocument", "stopdocument", "documentvariable", "unexpandeddocumentvariable", "setupdocument", "presetdocument", "doifelsedocumentvariable", "doifdocumentvariableelse", "doifdocumentvariable", "doifnotdocumentvariable", "startmodule", "stopmodule", "usemodule", "usetexmodule", "useluamodule", "setupmodule", "currentmoduleparameter", "moduleparameter", "everystarttext", "everystoptext", "startTEXpage", "stopTEXpage", "enablemode", "disablemode", "preventmode", "definemode", "globalenablemode", "globaldisablemode", "globalpreventmode", "pushmode", "popmode", "typescriptone", "typescripttwo", "typescriptthree", "mathsizesuffix", "mathordinarycode", "mathordcode", "mathoperatorcode", "mathopcode", "mathbinarycode", "mathbincode", "mathrelationcode", "mathrelcode", "mathopencode", "mathclosecode", "mathpunctuationcode", "mathpunctcode", "mathovercode", "mathundercode", "mathinnercode", "mathradicalcode", "mathfractioncode", "mathmiddlecode", "mathaccentcode", "mathfencedcode", "mathghostcode", "mathvariablecode", "mathactivecode", "mathvcentercode", "mathconstructcode", "mathwrappedcode", "mathbegincode", "mathendcode", "mathexplicitcode", "mathdivisioncode", "mathfactorialcode", "mathdimensioncode", "mathexperimentalcode", "mathtextpunctuationcode", "mathimaginarycode", "mathdifferentialcode", "mathexponentialcode", "mathellipsiscode", "mathfunctioncode", "mathdigitcode", "mathalphacode", "mathboxcode", "mathchoicecode", "mathnothingcode", "mathlimopcode", "mathnolopcode", "mathunsetcode", "mathunspacedcode", "mathallcode", "mathfakecode", "mathunarycode", "mathmaybeordinarycode", "mathmayberelationcode", "mathmaybebinarycode", "mathnumbergroupcode", "constantnumber", "constantnumberargument", "constantdimen", "constantdimenargument", "constantemptyargument", "luastringsep", "!!bs", "!!es", "lefttorightmark", "righttoleftmark", "lrm", "rlm", "bidilre", "bidirle", "bidipop", "bidilro", "bidirlo", "breakablethinspace", "nobreakspace", "nonbreakablespace", "narrownobreakspace", "zerowidthnobreakspace", "ideographicspace", "ideographichalffillspace", "twoperemspace", "threeperemspace", "fourperemspace", "fiveperemspace", "sixperemspace", "figurespace", "punctuationspace", "hairspace", "enquad", "emquad", "zerowidthspace", "zerowidthnonjoiner", "zerowidthjoiner", "zwnj", "zwj", "optionalspace", "asciispacechar", "softhyphen", "Ux", "eUx", "Umathaccents", "parfillleftskip", "parfillrightskip", "startlmtxmode", "stoplmtxmode", "startmkivmode", "stopmkivmode", "wildcardsymbol", "normalhyphenationcode", "automatichyphenationcode", "explicithyphenationcode", "syllablehyphenationcode", "uppercasehyphenationcode", "collapsehyphenationcode", "compoundhyphenationcode", "strictstarthyphenationcode", "strictendhyphenationcode", "automaticpenaltyhyphenationcode", "explicitpenaltyhyphenationcode", "permitgluehyphenationcode", "permitallhyphenationcode", "permitmathreplacehyphenationcode", "forcecheckhyphenationcode", "lazyligatureshyphenationcode", "forcehandlerhyphenationcode", "feedbackcompoundhyphenationcode", "ignoreboundshyphenationcode", "partialhyphenationcode", "completehyphenationcode", "normalizelinenormalizecode", "parindentskipnormalizecode", "swaphangindentnormalizecode", "swapparsshapenormalizecode", "breakafterdirnormalizecode", "removemarginkernsnormalizecode", "clipwidthnormalizecode", "flattendiscretionariesnormalizecode", "discardzerotabskipsnormalizecode", "flattenhleadersnormalizecode", "normalizeparnormalizeparcode", "flattenvleadersnormalizeparcode", "nopreslackclassoptioncode", "nopostslackclassoptioncode", "lefttopkernclassoptioncode", "righttopkernclassoptioncode", "leftbottomkernclassoptioncode", "rightbottomkernclassoptioncode", "lookaheadforendclassoptioncode", "noitaliccorrectionclassoptioncode", "defaultmathclassoptions", "checkligatureclassoptioncode", "checkitaliccorrectionclassoptioncode", "checkkernpairclassoptioncode", "flattenclassoptioncode", "omitpenaltyclassoptioncode", "unpackclassoptioncode", "raiseprimeclassoptioncode", "carryoverlefttopkernclassoptioncode", "carryoverleftbottomkernclassoptioncode", "carryoverrighttopkernclassoptioncode", "carryoverrightbottomkernclassoptioncode", "preferdelimiterdimensionsclassoptioncode", "autoinjectclassoptioncode", "removeitaliccorrectionclassoptioncode", "noligaturingglyphoptioncode", "nokerningglyphoptioncode", "noleftligatureglyphoptioncode", "noleftkernglyphoptioncode", "norightligatureglyphoptioncode", "norightkernglyphoptioncode", "noexpansionglyphoptioncode", "noprotrusionglyphoptioncode", "noitaliccorrectionglyphoptioncode", "nokerningcode", "noligaturingcode", "frozenflagcode", "tolerantflagcode", "protectedflagcode", "primitiveflagcode", "permanentflagcode", "noalignedflagcode", "immutableflagcode", "mutableflagcode", "globalflagcode", "overloadedflagcode", "immediateflagcode", "conditionalflagcode", "valueflagcode", "instanceflagcode", "ordmathflattencode", "binmathflattencode", "relmathflattencode", "punctmathflattencode", "innermathflattencode", "normalworddiscoptioncode", "preworddiscoptioncode", "postworddiscoptioncode", "continueifinputfile", "continuewhenlmtxmode", "continuewhenmkivmode" }, + ["constants"]={ "zerocount", "minusone", "minustwo", "plusone", "plustwo", "plusthree", "plusfour", "plusfive", "plussix", "plusseven", "pluseight", "plusnine", "plusten", "pluseleven", "plustwelve", "plussixteen", "plusfifty", "plushundred", "plusonehundred", "plustwohundred", "plusfivehundred", "plusthousand", "plustenthousand", "plustwentythousand", "medcard", "maxcard", "maxcardminusone", "zeropoint", "onepoint", "halfapoint", "onebasepoint", "maxcount", "maxdimen", "scaledpoint", "thousandpoint", "points", "halfpoint", "zeroskip", "centeringskip", "stretchingskip", "shrinkingskip", "centeringfillskip", "stretchingfillskip", "shrinkingfillskip", "zeromuskip", "onemuskip", "pluscxxvii", "pluscxxviii", "pluscclv", "pluscclvi", "normalpagebox", "binaryshiftedten", "binaryshiftedtwenty", "binaryshiftedthirty", "thickermuskip", "directionlefttoright", "directionrighttoleft", "endoflinetoken", "outputnewlinechar", "emptytoks", "empty", "undefined", "prerollrun", "voidbox", "emptybox", "emptyvbox", "emptyhbox", "bigskipamount", "medskipamount", "smallskipamount", "fmtname", "fmtversion", "texengine", "texenginename", "texengineversion", "texenginefunctionality", "luatexengine", "pdftexengine", "xetexengine", "unknownengine", "contextformat", "contextversion", "contextlmtxmode", "contextmark", "mksuffix", "activecatcode", "bgroup", "egroup", "endline", "conditionaltrue", "conditionalfalse", "attributeunsetvalue", "statuswrite", "uprotationangle", "rightrotationangle", "downrotationangle", "leftrotationangle", "inicatcodes", "ctxcatcodes", "texcatcodes", "notcatcodes", "txtcatcodes", "vrbcatcodes", "prtcatcodes", "nilcatcodes", "luacatcodes", "tpacatcodes", "tpbcatcodes", "xmlcatcodes", "ctdcatcodes", "rlncatcodes", "escapecatcode", "begingroupcatcode", "endgroupcatcode", "mathshiftcatcode", "alignmentcatcode", "endoflinecatcode", "parametercatcode", "superscriptcatcode", "subscriptcatcode", "ignorecatcode", "spacecatcode", "lettercatcode", "othercatcode", "activecatcode", "commentcatcode", "invalidcatcode", "tabasciicode", "newlineasciicode", "formfeedasciicode", "endoflineasciicode", "endoffileasciicode", "commaasciicode", "spaceasciicode", "periodasciicode", "hashasciicode", "dollarasciicode", "commentasciicode", "ampersandasciicode", "colonasciicode", "backslashasciicode", "circumflexasciicode", "underscoreasciicode", "leftbraceasciicode", "barasciicode", "rightbraceasciicode", "tildeasciicode", "delasciicode", "leftparentasciicode", "rightparentasciicode", "lessthanasciicode", "morethanasciicode", "doublecommentsignal", "atsignasciicode", "exclamationmarkasciicode", "questionmarkasciicode", "doublequoteasciicode", "singlequoteasciicode", "forwardslashasciicode", "primeasciicode", "hyphenasciicode", "percentasciicode", "leftbracketasciicode", "rightbracketasciicode", "hsizefrozenparcode", "skipfrozenparcode", "hangfrozenparcode", "indentfrozenparcode", "parfillfrozenparcode", "adjustfrozenparcode", "protrudefrozenparcode", "tolerancefrozenparcode", "stretchfrozenparcode", "loosenessfrozenparcode", "lastlinefrozenparcode", "linepenaltyfrozenparcode", "clubpenaltyfrozenparcode", "widowpenaltyfrozenparcode", "displaypenaltyfrozenparcode", "brokenpenaltyfrozenparcode", "demeritsfrozenparcode", "shapefrozenparcode", "linefrozenparcode", "hyphenationfrozenparcode", "shapingpenaltyfrozenparcode", "orphanpenaltyfrozenparcode", "allfrozenparcode", "mathpenaltyfrozenparcode", "activemathcharcode", "activetabtoken", "activeformfeedtoken", "activeendoflinetoken", "batchmodecode", "nonstopmodecode", "scrollmodecode", "errorstopmodecode", "bottomlevelgroupcode", "simplegroupcode", "hboxgroupcode", "adjustedhboxgroupcode", "vboxgroupcode", "vtopgroupcode", "aligngroupcode", "noaligngroupcode", "outputgroupcode", "mathgroupcode", "discretionarygroupcode", "insertgroupcode", "vadjustgroupcode", "vcentergroupcode", "mathabovegroupcode", "mathchoicegroupcode", "alsosimplegroupcode", "semisimplegroupcode", "mathshiftgroupcode", "mathleftgroupcode", "localboxgroupcode", "splitoffgroupcode", "splitkeepgroupcode", "preamblegroupcode", "alignsetgroupcode", "finrowgroupcode", "discretionarygroupcode", "markautomigrationcode", "insertautomigrationcode", "adjustautomigrationcode", "preautomigrationcode", "postautomigrationcode", "charnodecode", "hlistnodecode", "vlistnodecode", "rulenodecode", "insertnodecode", "marknodecode", "adjustnodecode", "ligaturenodecode", "discretionarynodecode", "whatsitnodecode", "mathnodecode", "gluenodecode", "kernnodecode", "penaltynodecode", "unsetnodecode", "mathsnodecode", "overrulemathcontrolcode", "underrulemathcontrolcode", "radicalrulemathcontrolcode", "fractionrulemathcontrolcode", "accentskewhalfmathcontrolcode", "accentskewapplymathcontrolcode", "applyordinarykernpairmathcontrolcode", "applyverticalitalickernmathcontrolcode", "applyordinaryitalickernmathcontrolcode", "applycharitalickernmathcontrolcode", "reboxcharitalickernmathcontrolcode", "applyboxeditalickernmathcontrolcode", "staircasekernmathcontrolcode", "applytextitalickernmathcontrolcode", "applyscriptitalickernmathcontrolcode", "checkspaceitalickernmathcontrolcode", "checktextitalickernmathcontrolcode", "analyzescriptnucleuscharmathcontrolcode", "analyzescriptnucleuslistmathcontrolcode", "analyzescriptnucleusboxmathcontrolcode", "accenttopskewwithoffsetmathcontrolcode", "ignorekerndimensionsmathcontrolcode", "noligaturingglyphoptioncode", "nokerningglyphoptioncode", "noexpansionglyphoptioncode", "noprotrusionglyphoptioncode", "noleftkerningglyphoptioncode", "noleftligaturingglyphoptioncode", "norightkerningglyphoptioncode", "norightligaturingglyphoptioncode", "noitaliccorrectionglyphoptioncode", "islargeoperatorglyphoptioncode", "hasitalicshapeglyphoptioncode", "normalparcontextcode", "vmodeparcontextcode", "vboxparcontextcode", "vtopparcontextcode", "vcenterparcontextcode", "vadjustparcontextcode", "insertparcontextcode", "outputparcontextcode", "alignparcontextcode", "noalignparcontextcode", "spanparcontextcode", "resetparcontextcode", "leftoriginlistanchorcode", "leftheightlistanchorcode", "leftdepthlistanchorcode", "rightoriginlistanchorcode", "rightheightlistanchorcode", "rightdepthlistanchorcode", "centeroriginlistanchorcode", "centerheightlistanchorcode", "centerdepthlistanchorcode", "halfwaytotallistanchorcode", "halfwayheightlistanchorcode", "halfwaydepthlistanchorcode", "halfwayleftlistanchorcode", "halfwayrightlistanchorcode", "negatexlistsigncode", "negateylistsigncode", "negatelistsigncode", "fontslantperpoint", "fontinterwordspace", "fontinterwordstretch", "fontinterwordshrink", "fontexheight", "fontemwidth", "fontextraspace", "slantperpoint", "mathexheight", "mathemwidth", "interwordspace", "interwordstretch", "interwordshrink", "exheight", "emwidth", "extraspace", "mathaxisheight", "muquad", "startmode", "stopmode", "startnotmode", "stopnotmode", "startmodeset", "stopmodeset", "doifmode", "doifelsemode", "doifmodeelse", "doifnotmode", "startmodeset", "stopmodeset", "startallmodes", "stopallmodes", "startnotallmodes", "stopnotallmodes", "doifallmodes", "doifelseallmodes", "doifallmodeselse", "doifnotallmodes", "startenvironment", "stopenvironment", "environment", "startcomponent", "stopcomponent", "component", "startproduct", "stopproduct", "product", "startproject", "stopproject", "project", "starttext", "stoptext", "startnotext", "stopnotext", "startdocument", "stopdocument", "documentvariable", "unexpandeddocumentvariable", "setupdocument", "presetdocument", "doifelsedocumentvariable", "doifdocumentvariableelse", "doifdocumentvariable", "doifnotdocumentvariable", "startmodule", "stopmodule", "usemodule", "usetexmodule", "useluamodule", "setupmodule", "currentmoduleparameter", "moduleparameter", "everystarttext", "everystoptext", "startTEXpage", "stopTEXpage", "enablemode", "disablemode", "preventmode", "definemode", "globalenablemode", "globaldisablemode", "globalpreventmode", "pushmode", "popmode", "typescriptone", "typescripttwo", "typescriptthree", "mathsizesuffix", "mathordinarycode", "mathordcode", "mathoperatorcode", "mathopcode", "mathbinarycode", "mathbincode", "mathrelationcode", "mathrelcode", "mathopencode", "mathclosecode", "mathpunctuationcode", "mathpunctcode", "mathovercode", "mathundercode", "mathinnercode", "mathradicalcode", "mathfractioncode", "mathmiddlecode", "mathaccentcode", "mathfencedcode", "mathghostcode", "mathvariablecode", "mathactivecode", "mathvcentercode", "mathconstructcode", "mathwrappedcode", "mathbegincode", "mathendcode", "mathexplicitcode", "mathdivisioncode", "mathfactorialcode", "mathdimensioncode", "mathexperimentalcode", "mathtextpunctuationcode", "mathimaginarycode", "mathdifferentialcode", "mathexponentialcode", "mathellipsiscode", "mathfunctioncode", "mathdigitcode", "mathalphacode", "mathboxcode", "mathchoicecode", "mathnothingcode", "mathlimopcode", "mathnolopcode", "mathunsetcode", "mathunspacedcode", "mathallcode", "mathfakecode", "mathunarycode", "mathmaybeordinarycode", "mathmayberelationcode", "mathmaybebinarycode", "mathnumbergroupcode", "constantnumber", "constantnumberargument", "constantdimen", "constantdimenargument", "constantemptyargument", "luastringsep", "!!bs", "!!es", "lefttorightmark", "righttoleftmark", "lrm", "rlm", "bidilre", "bidirle", "bidipop", "bidilro", "bidirlo", "breakablethinspace", "nobreakspace", "nonbreakablespace", "narrownobreakspace", "zerowidthnobreakspace", "ideographicspace", "ideographichalffillspace", "twoperemspace", "threeperemspace", "fourperemspace", "fiveperemspace", "sixperemspace", "figurespace", "punctuationspace", "hairspace", "enquad", "emquad", "zerowidthspace", "zerowidthnonjoiner", "zerowidthjoiner", "zwnj", "zwj", "optionalspace", "asciispacechar", "softhyphen", "Ux", "eUx", "Umathaccents", "parfillleftskip", "parfillrightskip", "startlmtxmode", "stoplmtxmode", "startmkivmode", "stopmkivmode", "wildcardsymbol", "normalhyphenationcode", "automatichyphenationcode", "explicithyphenationcode", "syllablehyphenationcode", "uppercasehyphenationcode", "collapsehyphenationcode", "compoundhyphenationcode", "strictstarthyphenationcode", "strictendhyphenationcode", "automaticpenaltyhyphenationcode", "explicitpenaltyhyphenationcode", "permitgluehyphenationcode", "permitallhyphenationcode", "permitmathreplacehyphenationcode", "forcecheckhyphenationcode", "lazyligatureshyphenationcode", "forcehandlerhyphenationcode", "feedbackcompoundhyphenationcode", "ignoreboundshyphenationcode", "partialhyphenationcode", "completehyphenationcode", "normalizelinenormalizecode", "parindentskipnormalizecode", "swaphangindentnormalizecode", "swapparsshapenormalizecode", "breakafterdirnormalizecode", "removemarginkernsnormalizecode", "clipwidthnormalizecode", "flattendiscretionariesnormalizecode", "discardzerotabskipsnormalizecode", "flattenhleadersnormalizecode", "normalizeparnormalizeparcode", "flattenvleadersnormalizeparcode", "nopreslackclassoptioncode", "nopostslackclassoptioncode", "lefttopkernclassoptioncode", "righttopkernclassoptioncode", "leftbottomkernclassoptioncode", "rightbottomkernclassoptioncode", "lookaheadforendclassoptioncode", "noitaliccorrectionclassoptioncode", "defaultmathclassoptions", "checkligatureclassoptioncode", "checkitaliccorrectionclassoptioncode", "checkkernpairclassoptioncode", "flattenclassoptioncode", "omitpenaltyclassoptioncode", "unpackclassoptioncode", "raiseprimeclassoptioncode", "carryoverlefttopkernclassoptioncode", "carryoverleftbottomkernclassoptioncode", "carryoverrighttopkernclassoptioncode", "carryoverrightbottomkernclassoptioncode", "preferdelimiterdimensionsclassoptioncode", "autoinjectclassoptioncode", "removeitaliccorrectionclassoptioncode", "operatoritaliccorrectionclassoptioncode", "noligaturingglyphoptioncode", "nokerningglyphoptioncode", "noleftligatureglyphoptioncode", "noleftkernglyphoptioncode", "norightligatureglyphoptioncode", "norightkernglyphoptioncode", "noexpansionglyphoptioncode", "noprotrusionglyphoptioncode", "noitaliccorrectionglyphoptioncode", "nokerningcode", "noligaturingcode", "frozenflagcode", "tolerantflagcode", "protectedflagcode", "primitiveflagcode", "permanentflagcode", "noalignedflagcode", "immutableflagcode", "mutableflagcode", "globalflagcode", "overloadedflagcode", "immediateflagcode", "conditionalflagcode", "valueflagcode", "instanceflagcode", "ordmathflattencode", "binmathflattencode", "relmathflattencode", "punctmathflattencode", "innermathflattencode", "normalworddiscoptioncode", "preworddiscoptioncode", "postworddiscoptioncode", "continueifinputfile", "continuewhenlmtxmode", "continuewhenmkivmode" }, ["helpers"]={ "startsetups", "stopsetups", "startxmlsetups", "stopxmlsetups", "startluasetups", "stopluasetups", "starttexsetups", "stoptexsetups", "startrawsetups", "stoprawsetups", "startlocalsetups", "stoplocalsetups", "starttexdefinition", "stoptexdefinition", "starttexcode", "stoptexcode", "startcontextcode", "stopcontextcode", "startcontextdefinitioncode", "stopcontextdefinitioncode", "texdefinition", "doifelsesetups", "doifsetupselse", "doifsetups", "doifnotsetups", "setup", "setups", "texsetup", "xmlsetup", "luasetup", "directsetup", "fastsetup", "copysetups", "resetsetups", "doifelsecommandhandler", "doifcommandhandlerelse", "doifnotcommandhandler", "doifcommandhandler", "newmode", "setmode", "resetmode", "newsystemmode", "setsystemmode", "resetsystemmode", "pushsystemmode", "popsystemmode", "globalsetmode", "globalresetmode", "globalsetsystemmode", "globalresetsystemmode", "booleanmodevalue", "newcount", "newdimen", "newskip", "newmuskip", "newbox", "newtoks", "newread", "newwrite", "newmarks", "newinsert", "newattribute", "newif", "newlanguage", "newfamily", "newfam", "newhelp", "then", "begcsname", "autorule", "strippedcsname", "checkedstrippedcsname", "nofarguments", "firstargumentfalse", "firstargumenttrue", "secondargumentfalse", "secondargumenttrue", "thirdargumentfalse", "thirdargumenttrue", "fourthargumentfalse", "fourthargumenttrue", "fifthargumentfalse", "fifthargumenttrue", "sixthargumentfalse", "sixthargumenttrue", "seventhargumentfalse", "seventhargumenttrue", "vkern", "hkern", "vpenalty", "hpenalty", "doglobal", "dodoglobal", "redoglobal", "resetglobal", "donothing", "untraceddonothing", "dontcomplain", "moreboxtracing", "lessboxtracing", "noboxtracing", "forgetall", "donetrue", "donefalse", "foundtrue", "foundfalse", "inlineordisplaymath", "indisplaymath", "forcedisplaymath", "startforceddisplaymath", "stopforceddisplaymath", "startpickupmath", "stoppickupmath", "reqno", "forceinlinemath", "mathortext", "thebox", "htdp", "unvoidbox", "hfilll", "vfilll", "mathbox", "mathlimop", "mathnolop", "mathnothing", "mathalpha", "currentcatcodetable", "defaultcatcodetable", "catcodetablename", "newcatcodetable", "startcatcodetable", "stopcatcodetable", "startextendcatcodetable", "stopextendcatcodetable", "pushcatcodetable", "popcatcodetable", "restorecatcodes", "setcatcodetable", "letcatcodecommand", "defcatcodecommand", "uedcatcodecommand", "hglue", "vglue", "hfillneg", "vfillneg", "hfilllneg", "vfilllneg", "ruledhss", "ruledhfil", "ruledhfill", "ruledhfilll", "ruledhfilneg", "ruledhfillneg", "normalhfillneg", "normalhfilllneg", "ruledvss", "ruledvfil", "ruledvfill", "ruledvfilll", "ruledvfilneg", "ruledvfillneg", "normalvfillneg", "normalvfilllneg", "ruledhbox", "ruledvbox", "ruledvtop", "ruledvcenter", "ruledmbox", "ruledhpack", "ruledvpack", "ruledtpack", "ruledhskip", "ruledvskip", "ruledkern", "ruledmskip", "ruledmkern", "ruledhglue", "ruledvglue", "normalhglue", "normalvglue", "ruledpenalty", "filledhboxb", "filledhboxr", "filledhboxg", "filledhboxc", "filledhboxm", "filledhboxy", "filledhboxk", "scratchstring", "scratchstringone", "scratchstringtwo", "tempstring", "scratchcounter", "globalscratchcounter", "privatescratchcounter", "scratchdimen", "globalscratchdimen", "privatescratchdimen", "scratchskip", "globalscratchskip", "privatescratchskip", "scratchmuskip", "globalscratchmuskip", "privatescratchmuskip", "scratchtoks", "globalscratchtoks", "privatescratchtoks", "scratchbox", "globalscratchbox", "privatescratchbox", "scratchmacro", "scratchmacroone", "scratchmacrotwo", "scratchconditiontrue", "scratchconditionfalse", "ifscratchcondition", "scratchconditiononetrue", "scratchconditiononefalse", "ifscratchconditionone", "scratchconditiontwotrue", "scratchconditiontwofalse", "ifscratchconditiontwo", "globalscratchcounterone", "globalscratchcountertwo", "globalscratchcounterthree", "groupedcommand", "groupedcommandcs", "triggergroupedcommand", "triggergroupedcommandcs", "simplegroupedcommand", "simplegroupedcommandcs", "pickupgroupedcommand", "pickupgroupedcommandcs", "mathgroupedcommandcs", "usedbaselineskip", "usedlineskip", "usedlineskiplimit", "availablehsize", "localhsize", "setlocalhsize", "distributedhsize", "hsizefraction", "next", "nexttoken", "nextbox", "dowithnextbox", "dowithnextboxcs", "dowithnextboxcontent", "dowithnextboxcontentcs", "flushnextbox", "boxisempty", "boxtostring", "contentostring", "prerolltostring", "givenwidth", "givenheight", "givendepth", "scangivendimensions", "scratchwidth", "scratchheight", "scratchdepth", "scratchoffset", "scratchdistance", "scratchtotal", "scratchitalic", "scratchhsize", "scratchvsize", "scratchxoffset", "scratchyoffset", "scratchhoffset", "scratchvoffset", "scratchxposition", "scratchyposition", "scratchtopoffset", "scratchbottomoffset", "scratchleftoffset", "scratchrightoffset", "scratchcounterone", "scratchcountertwo", "scratchcounterthree", "scratchcounterfour", "scratchcounterfive", "scratchcountersix", "scratchdimenone", "scratchdimentwo", "scratchdimenthree", "scratchdimenfour", "scratchdimenfive", "scratchdimensix", "scratchskipone", "scratchskiptwo", "scratchskipthree", "scratchskipfour", "scratchskipfive", "scratchskipsix", "scratchmuskipone", "scratchmuskiptwo", "scratchmuskipthree", "scratchmuskipfour", "scratchmuskipfive", "scratchmuskipsix", "scratchtoksone", "scratchtokstwo", "scratchtoksthree", "scratchtoksfour", "scratchtoksfive", "scratchtokssix", "scratchboxone", "scratchboxtwo", "scratchboxthree", "scratchboxfour", "scratchboxfive", "scratchboxsix", "scratchnx", "scratchny", "scratchmx", "scratchmy", "scratchunicode", "scratchmin", "scratchmax", "scratchleftskip", "scratchrightskip", "scratchtopskip", "scratchbottomskip", "doif", "doifnot", "doifelse", "firstinset", "doifinset", "doifnotinset", "doifelseinset", "doifinsetelse", "doifelsenextchar", "doifnextcharelse", "doifelsenextcharcs", "doifnextcharcselse", "doifelsenextoptional", "doifnextoptionalelse", "doifelsenextoptionalcs", "doifnextoptionalcselse", "doifelsefastoptionalcheck", "doiffastoptionalcheckelse", "doifelsefastoptionalcheckcs", "doiffastoptionalcheckcselse", "doifelsenextbgroup", "doifnextbgroupelse", "doifelsenextbgroupcs", "doifnextbgroupcselse", "doifelsenextparenthesis", "doifnextparenthesiselse", "doifelseundefined", "doifundefinedelse", "doifelsedefined", "doifdefinedelse", "doifundefined", "doifdefined", "doifelsevalue", "doifvalue", "doifnotvalue", "doifnothing", "doifsomething", "doifelsenothing", "doifnothingelse", "doifelsesomething", "doifsomethingelse", "doifvaluenothing", "doifvaluesomething", "doifelsevaluenothing", "doifvaluenothingelse", "doifelsedimension", "doifdimensionelse", "doifelsenumber", "doifnumberelse", "doifnumber", "doifnotnumber", "doifelsecommon", "doifcommonelse", "doifcommon", "doifnotcommon", "doifinstring", "doifnotinstring", "doifelseinstring", "doifinstringelse", "doifelseassignment", "doifassignmentelse", "docheckassignment", "doifelseassignmentcs", "doifassignmentelsecs", "validassignment", "novalidassignment", "doiftext", "doifelsetext", "doiftextelse", "doifnottext", "quitcondition", "truecondition", "falsecondition", "tracingall", "tracingnone", "loggingall", "tracingcatcodes", "showluatokens", "aliasmacro", "removetoks", "appendtoks", "prependtoks", "appendtotoks", "prependtotoks", "to", "endgraf", "endpar", "reseteverypar", "finishpar", "empty", "null", "space", "quad", "enspace", "emspace", "charspace", "nbsp", "crlf", "obeyspaces", "obeylines", "obeytabs", "obeypages", "obeyedspace", "obeyedline", "obeyedtab", "obeyedpage", "normalspace", "naturalspace", "controlspace", "normalspaces", "ignoretabs", "ignorelines", "ignorepages", "ignoreeofs", "setcontrolspaces", "executeifdefined", "singleexpandafter", "doubleexpandafter", "tripleexpandafter", "dontleavehmode", "removelastspace", "removeunwantedspaces", "keepunwantedspaces", "removepunctuation", "ignoreparskip", "forcestrutdepth", "onlynonbreakablespace", "wait", "writestatus", "define", "defineexpandable", "redefine", "setmeasure", "setemeasure", "setgmeasure", "setxmeasure", "definemeasure", "freezemeasure", "measure", "measured", "directmeasure", "setquantity", "setequantity", "setgquantity", "setxquantity", "definequantity", "freezequantity", "quantity", "quantitied", "directquantity", "installcorenamespace", "getvalue", "getuvalue", "setvalue", "setevalue", "setgvalue", "setxvalue", "letvalue", "letgvalue", "resetvalue", "undefinevalue", "ignorevalue", "setuvalue", "setuevalue", "setugvalue", "setuxvalue", "globallet", "udef", "ugdef", "uedef", "uxdef", "checked", "unique", "getparameters", "geteparameters", "getgparameters", "getxparameters", "forgetparameters", "copyparameters", "getdummyparameters", "dummyparameter", "directdummyparameter", "setdummyparameter", "letdummyparameter", "setexpandeddummyparameter", "usedummystyleandcolor", "usedummystyleparameter", "usedummycolorparameter", "processcommalist", "processcommacommand", "quitcommalist", "quitprevcommalist", "processaction", "processallactions", "processfirstactioninset", "processallactionsinset", "unexpanded", "expanded", "startexpanded", "stopexpanded", "protect", "unprotect", "firstofoneargument", "firstoftwoarguments", "secondoftwoarguments", "firstofthreearguments", "secondofthreearguments", "thirdofthreearguments", "firstoffourarguments", "secondoffourarguments", "thirdoffourarguments", "fourthoffourarguments", "firstoffivearguments", "secondoffivearguments", "thirdoffivearguments", "fourthoffivearguments", "fifthoffivearguments", "firstofsixarguments", "secondofsixarguments", "thirdofsixarguments", "fourthofsixarguments", "fifthofsixarguments", "sixthofsixarguments", "firstofoneunexpanded", "firstoftwounexpanded", "secondoftwounexpanded", "firstofthreeunexpanded", "secondofthreeunexpanded", "thirdofthreeunexpanded", "gobbleoneargument", "gobbletwoarguments", "gobblethreearguments", "gobblefourarguments", "gobblefivearguments", "gobblesixarguments", "gobblesevenarguments", "gobbleeightarguments", "gobbleninearguments", "gobbletenarguments", "gobbleoneoptional", "gobbletwooptionals", "gobblethreeoptionals", "gobblefouroptionals", "gobblefiveoptionals", "dorecurse", "doloop", "exitloop", "dostepwiserecurse", "recurselevel", "recursedepth", "dofastloopcs", "fastloopindex", "fastloopfinal", "dowith", "doloopovermatch", "doloopovermatched", "doloopoverlist", "newconstant", "setnewconstant", "setconstant", "setconstantvalue", "newconditional", "settrue", "setfalse", "settruevalue", "setfalsevalue", "setconditional", "newmacro", "setnewmacro", "newfraction", "newsignal", "newboundary", "dosingleempty", "dodoubleempty", "dotripleempty", "doquadrupleempty", "doquintupleempty", "dosixtupleempty", "doseventupleempty", "dosingleargument", "dodoubleargument", "dotripleargument", "doquadrupleargument", "doquintupleargument", "dosixtupleargument", "doseventupleargument", "dosinglegroupempty", "dodoublegroupempty", "dotriplegroupempty", "doquadruplegroupempty", "doquintuplegroupempty", "permitspacesbetweengroups", "dontpermitspacesbetweengroups", "nopdfcompression", "maximumpdfcompression", "normalpdfcompression", "onlypdfobjectcompression", "nopdfobjectcompression", "modulonumber", "dividenumber", "getfirstcharacter", "doifelsefirstchar", "doiffirstcharelse", "mathclassvalue", "startnointerference", "stopnointerference", "twodigits", "threedigits", "leftorright", "offinterlineskip", "oninterlineskip", "nointerlineskip", "strut", "halfstrut", "quarterstrut", "depthstrut", "halflinestrut", "noheightstrut", "setstrut", "strutbox", "strutht", "strutdp", "strutwd", "struthtdp", "strutgap", "begstrut", "endstrut", "lineheight", "leftboundary", "rightboundary", "signalcharacter", "aligncontentleft", "aligncontentmiddle", "aligncontentright", "shiftbox", "vpackbox", "hpackbox", "vpackedbox", "hpackedbox", "ordordspacing", "ordopspacing", "ordbinspacing", "ordrelspacing", "ordopenspacing", "ordclosespacing", "ordpunctspacing", "ordinnerspacing", "ordfracspacing", "ordradspacing", "ordmiddlespacing", "ordaccentspacing", "opordspacing", "opopspacing", "opbinspacing", "oprelspacing", "opopenspacing", "opclosespacing", "oppunctspacing", "opinnerspacing", "opfracspacing", "opradspacing", "opmiddlespacing", "opaccentspacing", "binordspacing", "binopspacing", "binbinspacing", "binrelspacing", "binopenspacing", "binclosespacing", "binpunctspacing", "bininnerspacing", "binfracspacing", "binradspacing", "binmiddlespacing", "binaccentspacing", "relordspacing", "relopspacing", "relbinspacing", "relrelspacing", "relopenspacing", "relclosespacing", "relpunctspacing", "relinnerspacing", "relfracspacing", "relradspacing", "relmiddlespacing", "relaccentspacing", "openordspacing", "openopspacing", "openbinspacing", "openrelspacing", "openopenspacing", "openclosespacing", "openpunctspacing", "openinnerspacing", "openfracspacing", "openradspacing", "openmiddlespacing", "openaccentspacing", "closeordspacing", "closeopspacing", "closebinspacing", "closerelspacing", "closeopenspacing", "closeclosespacing", "closepunctspacing", "closeinnerspacing", "closefracspacing", "closeradspacing", "closemiddlespacing", "closeaccentspacing", "punctordspacing", "punctopspacing", "punctbinspacing", "punctrelspacing", "punctopenspacing", "punctclosespacing", "punctpunctspacing", "punctinnerspacing", "punctfracspacing", "punctradspacing", "punctmiddlespacing", "punctaccentspacing", "innerordspacing", "inneropspacing", "innerbinspacing", "innerrelspacing", "inneropenspacing", "innerclosespacing", "innerpunctspacing", "innerinnerspacing", "innerfracspacing", "innerradspacing", "innermiddlespacing", "inneraccentspacing", "fracordspacing", "fracopspacing", "fracbinspacing", "fracrelspacing", "fracopenspacing", "fracclosespacing", "fracpunctspacing", "fracinnerspacing", "fracfracspacing", "fracradspacing", "fracmiddlespacing", "fracaccentspacing", "radordspacing", "radopspacing", "radbinspacing", "radrelspacing", "radopenspacing", "radclosespacing", "radpunctspacing", "radinnerspacing", "radfracspacing", "radradspacing", "radmiddlespacing", "radaccentspacing", "middleordspacing", "middleopspacing", "middlebinspacing", "middlerelspacing", "middleopenspacing", "middleclosespacing", "middlepunctspacing", "middleinnerspacing", "middlefracspacing", "middleradspacing", "middlemiddlespacing", "middleaccentspacing", "accentordspacing", "accentopspacing", "accentbinspacing", "accentrelspacing", "accentopenspacing", "accentclosespacing", "accentpunctspacing", "accentinnerspacing", "accentfracspacing", "accentradspacing", "accentmiddlespacing", "accentaccentspacing", "normalreqno", "startimath", "stopimath", "normalstartimath", "normalstopimath", "startdmath", "stopdmath", "normalstartdmath", "normalstopdmath", "normalsuperscript", "normalsubscript", "normalnosuperscript", "normalnosubscript", "normalprimescript", "superscript", "subscript", "nosuperscript", "nosubscript", "primescript", "superprescript", "subprescript", "nosuperprescript", "nosubsprecript", "uncramped", "cramped", "mathstyletrigger", "triggermathstyle", "triggeredmathstyle", "mathstylefont", "mathsmallstylefont", "mathstyleface", "mathsmallstyleface", "mathstylecommand", "mathpalette", "mathstylehbox", "mathstylevbox", "mathstylevcenter", "mathstylevcenteredhbox", "mathstylevcenteredvbox", "mathtext", "setmathsmalltextbox", "setmathtextbox", "pushmathstyle", "popmathstyle", "triggerdisplaystyle", "triggertextstyle", "triggerscriptstyle", "triggerscriptscriptstyle", "triggeruncrampedstyle", "triggercrampedstyle", "triggersmallstyle", "triggeruncrampedsmallstyle", "triggercrampedsmallstyle", "triggerbigstyle", "triggeruncrampedbigstyle", "triggercrampedbigstyle", "luaexpr", "expelsedoif", "expdoif", "expdoifnot", "expdoifelsecommon", "expdoifcommonelse", "expdoifelseinset", "expdoifinsetelse", "ctxdirectlua", "ctxlatelua", "ctxsprint", "ctxwrite", "ctxcommand", "ctxdirectcommand", "ctxlatecommand", "ctxreport", "ctxlua", "luacode", "lateluacode", "directluacode", "registerctxluafile", "ctxloadluafile", "luaversion", "luamajorversion", "luaminorversion", "ctxluacode", "luaconditional", "luaexpanded", "ctxluamatch", "startluaparameterset", "stopluaparameterset", "luaparameterset", "definenamedlua", "obeylualines", "obeyluatokens", "startluacode", "stopluacode", "startlua", "stoplua", "startctxfunction", "stopctxfunction", "ctxfunction", "startctxfunctiondefinition", "stopctxfunctiondefinition", "installctxfunction", "installprotectedctxfunction", "installprotectedctxscanner", "installctxscanner", "resetctxscanner", "cldprocessfile", "cldloadfile", "cldloadviafile", "cldcontext", "cldcommand", "carryoverpar", "freezeparagraphproperties", "defrostparagraphproperties", "setparagraphfreezing", "forgetparagraphfreezing", "updateparagraphproperties", "updateparagraphpenalties", "updateparagraphdemerits", "updateparagraphshapes", "updateparagraphlines", "lastlinewidth", "assumelongusagecs", "Umathbottomaccent", "Umathtopaccent", "Umathbotaccent", "righttolefthbox", "lefttorighthbox", "righttoleftvbox", "lefttorightvbox", "righttoleftvtop", "lefttorightvtop", "rtlhbox", "ltrhbox", "rtlvbox", "ltrvbox", "rtlvtop", "ltrvtop", "autodirhbox", "autodirvbox", "autodirvtop", "leftorrighthbox", "leftorrightvbox", "leftorrightvtop", "lefttoright", "righttoleft", "checkedlefttoright", "checkedrighttoleft", "synchronizelayoutdirection", "synchronizedisplaydirection", "synchronizeinlinedirection", "dirlre", "dirrle", "dirlro", "dirrlo", "rtltext", "ltrtext", "lesshyphens", "morehyphens", "nohyphens", "dohyphens", "dohyphencollapsing", "nohyphencollapsing", "compounddiscretionary", "Ucheckedstartdisplaymath", "Ucheckedstopdisplaymath", "break", "nobreak", "allowbreak", "goodbreak", "nospace", "nospacing", "dospacing", "naturalhbox", "naturalvbox", "naturalvtop", "naturalhpack", "naturalvpack", "naturaltpack", "reversehbox", "reversevbox", "reversevtop", "reversehpack", "reversevpack", "reversetpack", "hcontainer", "vcontainer", "tcontainer", "frule", "compoundhyphenpenalty", "start", "stop", "unsupportedcs", "openout", "closeout", "write", "openin", "closein", "read", "readline", "readfromterminal", "boxlines", "boxline", "setboxline", "copyboxline", "boxlinewd", "boxlineht", "boxlinedp", "boxlinenw", "boxlinenh", "boxlinend", "boxlinels", "boxliners", "boxlinelh", "boxlinerh", "boxlinelp", "boxlinerp", "boxlinein", "boxrangewd", "boxrangeht", "boxrangedp", "bitwiseset", "bitwiseand", "bitwiseor", "bitwisexor", "bitwisenot", "bitwisenil", "ifbitwiseand", "bitwise", "bitwiseshift", "bitwiseflip", "textdir", "linedir", "pardir", "boxdir", "prelistbox", "postlistbox", "prelistcopy", "postlistcopy", "setprelistbox", "setpostlistbox", "noligaturing", "nokerning", "noexpansion", "noprotrusion", "noleftkerning", "noleftligaturing", "norightkerning", "norightligaturing", "noitaliccorrection", "futureletnexttoken", "defbackslashbreak", "letbackslashbreak", "pushoverloadmode", "popoverloadmode", "pushrunstate", "poprunstate", "suggestedalias", "showboxhere", "discoptioncodestring", "flagcodestring", "frozenparcodestring", "glyphoptioncodestring", "groupcodestring", "hyphenationcodestring", "mathcontrolcodestring", "mathflattencodestring", "normalizecodestring", "parcontextcodestring", "newlocalcount", "newlocaldimen", "newlocalskip", "newlocalmuskip", "newlocaltoks", "newlocalbox", "newlocalwrite", "newlocalread", "setnewlocalcount", "setnewlocaldimen", "setnewlocalskip", "setnewlocalmuskip", "setnewlocaltoks", "setnewlocalbox", "ifexpression" }, } \ No newline at end of file diff --git a/context/data/scite/context/lexers/data/scite-context-data-tex.lua b/context/data/scite/context/lexers/data/scite-context-data-tex.lua index 4416d41dd..f91d06f06 100644 --- a/context/data/scite/context/lexers/data/scite-context-data-tex.lua +++ b/context/data/scite/context/lexers/data/scite-context-data-tex.lua @@ -1,7 +1,7 @@ return { ["aleph"]={ "Alephminorversion", "Alephrevision", "Alephversion" }, ["etex"]={ "botmarks", "clubpenalties", "currentgrouplevel", "currentgrouptype", "currentifbranch", "currentiflevel", "currentiftype", "detokenize", "dimexpr", "displaywidowpenalties", "everyeof", "firstmarks", "fontchardp", "fontcharht", "fontcharic", "fontcharwd", "glueexpr", "glueshrink", "glueshrinkorder", "gluestretch", "gluestretchorder", "gluetomu", "ifcsname", "ifdefined", "iffontchar", "interactionmode", "interlinepenalties", "lastlinefit", "lastnodetype", "marks", "muexpr", "mutoglue", "numexpr", "pagediscards", "parshapedimen", "parshapeindent", "parshapelength", "predisplaydirection", "protected", "savinghyphcodes", "savingvdiscards", "scantokens", "showgroups", "showifs", "showtokens", "splitbotmarks", "splitdiscards", "splitfirstmarks", "topmarks", "tracingassigns", "tracinggroups", "tracingifs", "tracingnesting", "unexpanded", "unless", "widowpenalties" }, - ["luatex"]={ "Uabove", "Uabovewithdelims", "Uatop", "Uatopwithdelims", "Uchar", "Udelcode", "Udelimited", "Udelimiter", "Udelimiterover", "Udelimiterunder", "Uhextensible", "Uleft", "Umathaccent", "Umathaccentbasedepth", "Umathaccentbaseheight", "Umathaccentbottomovershoot", "Umathaccentbottomshiftdown", "Umathaccentextendmargin", "Umathaccentsuperscriptdrop", "Umathaccentsuperscriptpercent", "Umathaccenttopovershoot", "Umathaccenttopshiftup", "Umathaccentvariant", "Umathadapttoleft", "Umathadapttoright", "Umathaxis", "Umathbottomaccentvariant", "Umathchar", "Umathcharclass", "Umathchardef", "Umathcharfam", "Umathcharslot", "Umathclass", "Umathcode", "Umathconnectoroverlapmin", "Umathdegreevariant", "Umathdelimiterovervariant", "Umathdelimiterpercent", "Umathdelimitershortfall", "Umathdelimiterundervariant", "Umathdenominatorvariant", "Umathdict", "Umathdictdef", "Umathdiscretionary", "Umathextrasubpreshift", "Umathextrasubprespace", "Umathextrasubshift", "Umathextrasubspace", "Umathextrasuppreshift", "Umathextrasupprespace", "Umathextrasupshift", "Umathextrasupspace", "Umathflattenedaccentbasedepth", "Umathflattenedaccentbaseheight", "Umathflattenedaccentbottomshiftdown", "Umathflattenedaccenttopshiftup", "Umathfractiondelsize", "Umathfractiondenomdown", "Umathfractiondenomvgap", "Umathfractionnumup", "Umathfractionnumvgap", "Umathfractionrule", "Umathfractionvariant", "Umathhextensiblevariant", "Umathlimitabovebgap", "Umathlimitabovekern", "Umathlimitabovevgap", "Umathlimitbelowbgap", "Umathlimitbelowkern", "Umathlimitbelowvgap", "Umathlimits", "Umathnoaxis", "Umathnolimits", "Umathnolimitsubfactor", "Umathnolimitsupfactor", "Umathnumeratorvariant", "Umathopenupdepth", "Umathopenupheight", "Umathoperatorsize", "Umathoverbarkern", "Umathoverbarrule", "Umathoverbarvgap", "Umathoverdelimiterbgap", "Umathoverdelimitervariant", "Umathoverdelimitervgap", "Umathoverlayaccentvariant", "Umathoverlinevariant", "Umathphantom", "Umathpresubshiftdistance", "Umathpresupshiftdistance", "Umathprimeraise", "Umathprimeraisecomposed", "Umathprimeshiftdrop", "Umathprimeshiftup", "Umathprimespaceafter", "Umathprimevariant", "Umathprimewidth", "Umathquad", "Umathradicaldegreeafter", "Umathradicaldegreebefore", "Umathradicaldegreeraise", "Umathradicalkern", "Umathradicalrule", "Umathradicalvariant", "Umathradicalvgap", "Umathruledepth", "Umathruleheight", "Umathskeweddelimitertolerance", "Umathskewedfractionhgap", "Umathskewedfractionvgap", "Umathsource", "Umathspaceafterscript", "Umathspacebeforescript", "Umathstackdenomdown", "Umathstacknumup", "Umathstackvariant", "Umathstackvgap", "Umathsubscriptvariant", "Umathsubshiftdistance", "Umathsubshiftdown", "Umathsubshiftdrop", "Umathsubsupshiftdown", "Umathsubsupvgap", "Umathsubtopmax", "Umathsupbottommin", "Umathsuperscriptvariant", "Umathsupshiftdistance", "Umathsupshiftdrop", "Umathsupshiftup", "Umathsupsubbottommax", "Umathtopaccentvariant", "Umathunderbarkern", "Umathunderbarrule", "Umathunderbarvgap", "Umathunderdelimiterbgap", "Umathunderdelimitervariant", "Umathunderdelimitervgap", "Umathunderlinevariant", "Umathuseaxis", "Umathvextensiblevariant", "Umathvoid", "Umathxscale", "Umathyscale", "Umiddle", "Unosubprescript", "Unosubscript", "Unosuperprescript", "Unosuperscript", "Uoperator", "Uover", "Uoverdelimiter", "Uoverwithdelims", "Uprimescript", "Uradical", "Uright", "Uroot", "Urooted", "Ushiftedsubprescript", "Ushiftedsubscript", "Ushiftedsuperprescript", "Ushiftedsuperscript", "Uskewed", "Uskewedwithdelims", "Ustack", "Ustartdisplaymath", "Ustartmath", "Ustartmathmode", "Ustopdisplaymath", "Ustopmath", "Ustopmathmode", "Ustretched", "Ustretchedwithdelims", "Ustyle", "Usubprescript", "Usubscript", "Usuperprescript", "Usuperscript", "Uunderdelimiter", "Uvextensible", "adjustspacing", "adjustspacingshrink", "adjustspacingstep", "adjustspacingstretch", "afterassigned", "aftergrouped", "aliased", "aligncontent", "alignmark", "alignmentcellsource", "alignmentwrapsource", "aligntab", "allcrampedstyles", "alldisplaystyles", "allmathstyles", "allscriptscriptstyles", "allscriptstyles", "allsplitstyles", "alltextstyles", "alluncrampedstyles", "atendofgroup", "atendofgrouped", "attribute", "attributedef", "automaticdiscretionary", "automatichyphenpenalty", "automigrationmode", "autoparagraphmode", "begincsname", "beginlocalcontrol", "beginmathgroup", "beginsimplegroup", "boundary", "boxadapt", "boxanchor", "boxanchors", "boxattribute", "boxdirection", "boxfreeze", "boxgeometry", "boxorientation", "boxrepack", "boxshift", "boxsource", "boxtarget", "boxtotal", "boxxmove", "boxxoffset", "boxymove", "boxyoffset", "catcodetable", "clearmarks", "copymathatomrule", "copymathparent", "copymathspacing", "crampeddisplaystyle", "crampedscriptscriptstyle", "crampedscriptstyle", "crampedtextstyle", "csstring", "currentloopiterator", "currentloopnesting", "currentmarks", "defcsname", "detokenized", "dimensiondef", "dimexpression", "directlua", "edefcsname", "efcode", "endlocalcontrol", "endmathgroup", "endsimplegroup", "enforced", "etoks", "etoksapp", "etokspre", "everybeforepar", "everymathatom", "everytab", "exceptionpenalty", "expand", "expandafterpars", "expandafterspaces", "expandcstoken", "expanded", "expandedafter", "expandedloop", "expandtoken", "explicitdiscretionary", "explicithyphenpenalty", "firstvalidlanguage", "flushmarks", "fontcharta", "fontid", "fontmathcontrol", "fontspecdef", "fontspecid", "fontspecifiedname", "fontspecifiedsize", "fontspecscale", "fontspecxscale", "fontspecyscale", "fonttextcontrol", "formatname", "frozen", "futurecsname", "futuredef", "futureexpand", "futureexpandis", "futureexpandisap", "gdefcsname", "gleaders", "glet", "gletcsname", "glettonothing", "gluespecdef", "glyph", "glyphdatafield", "glyphoptions", "glyphscale", "glyphscriptfield", "glyphscriptscale", "glyphscriptscriptscale", "glyphstatefield", "glyphtextscale", "glyphxoffset", "glyphxscale", "glyphxscaled", "glyphyoffset", "glyphyscale", "glyphyscaled", "gtoksapp", "gtokspre", "hccode", "hjcode", "hmcode", "holdingmigrations", "hpack", "hyphenationmin", "hyphenationmode", "ifabsdim", "ifabsnum", "ifarguments", "ifboolean", "ifchkdim", "ifchknum", "ifcmpdim", "ifcmpnum", "ifcondition", "ifcstok", "ifdimexpression", "ifdimval", "ifempty", "ifflags", "ifhaschar", "ifhastok", "ifhastoks", "ifhasxtoks", "ifincsname", "ifinsert", "ifmathparameter", "ifmathstyle", "ifnumexpression", "ifnumval", "ifparameter", "ifparameters", "ifrelax", "iftok", "ignorearguments", "ignorepars", "immediate", "immutable", "indexofcharacter", "indexofregister", "inherited", "initcatcodetable", "insertbox", "insertcopy", "insertdepth", "insertdistance", "insertheight", "insertheights", "insertlimit", "insertmaxdepth", "insertmode", "insertmultiplier", "insertpenalty", "insertprogress", "insertstorage", "insertstoring", "insertunbox", "insertuncopy", "insertwidth", "instance", "integerdef", "lastarguments", "lastatomclass", "lastboundary", "lastchkdim", "lastchknum", "lastleftclass", "lastloopiterator", "lastnamedcs", "lastnodesubtype", "lastpageextra", "lastparcontext", "lastrightclass", "leftmarginkern", "letcharcode", "letcsname", "letfrozen", "letmathatomrule", "letmathparent", "letmathspacing", "letprotected", "lettonothing", "linebreakcriterium", "linedirection", "localbrokenpenalty", "localcontrol", "localcontrolled", "localcontrolledloop", "localinterlinepenalty", "localleftbox", "localleftboxbox", "localmiddlebox", "localmiddleboxbox", "localrightbox", "localrightboxbox", "lpcode", "luabytecode", "luabytecodecall", "luacopyinputnodes", "luadef", "luaescapestring", "luafunction", "luafunctioncall", "luatexbanner", "luatexrevision", "luatexversion", "mathaccent", "mathatom", "mathatomglue", "mathatomskip", "mathbackwardpenalties", "mathbeginclass", "mathcheckfencesmode", "mathdictgroup", "mathdictproperties", "mathdirection", "mathdisplaymode", "mathdisplayskipmode", "mathdoublescriptmode", "mathendclass", "matheqnogapstep", "mathfenced", "mathfontcontrol", "mathforwardpenalties", "mathfrac", "mathghost", "mathgluemode", "mathgroupingmode", "mathleftclass", "mathlimitsmode", "mathmainstyle", "mathmiddle", "mathnolimitsmode", "mathpenaltiesmode", "mathrad", "mathrightclass", "mathrulesfam", "mathrulesmode", "mathscale", "mathscriptsmode", "mathslackmode", "mathspacingmode", "mathstackstyle", "mathstyle", "mathstylefontid", "mathsurroundmode", "mathsurroundskip", "maththreshold", "meaningasis", "meaningfull", "meaningless", "mugluespecdef", "mutable", "noaligned", "noatomruling", "noboundary", "nohrule", "norelax", "normalizelinemode", "normalizeparmode", "nospaces", "novrule", "numericscale", "numexpression", "orelse", "orphanpenalties", "orphanpenalty", "orunless", "outputbox", "overloaded", "overloadmode", "overshoot", "pageboundary", "pageextragoal", "pagevsize", "parametercount", "parametermark", "parattribute", "pardirection", "permanent", "pettymuskip", "postexhyphenchar", "posthyphenchar", "postinlinepenalty", "prebinoppenalty", "predisplaygapfactor", "preexhyphenchar", "prehyphenchar", "preinlinepenalty", "prerelpenalty", "protrudechars", "protrusionboundary", "pxdimen", "quitloop", "quitvmode", "resetmathspacing", "retokenized", "rightmarginkern", "rpcode", "savecatcodetable", "scaledemwidth", "scaledexheight", "scaledextraspace", "scaledfontdimen", "scaledinterwordshrink", "scaledinterwordspace", "scaledinterwordstretch", "scaledmathstyle", "scaledslantperpoint", "scantextokens", "semiexpand", "semiexpanded", "semiprotected", "setdefaultmathcodes", "setfontid", "setmathatomrule", "setmathdisplaypostpenalty", "setmathdisplayprepenalty", "setmathignore", "setmathoptions", "setmathpostpenalty", "setmathprepenalty", "setmathspacing", "shapingpenaltiesmode", "shapingpenalty", "snapshotpar", "srule", "supmarkmode", "swapcsvalues", "tabsize", "textdirection", "thewithoutunit", "tinymuskip", "todimension", "tohexadecimal", "tointeger", "tokenized", "toksapp", "tokspre", "tolerant", "tomathstyle", "toscaled", "tosparsedimension", "tosparsescaled", "tpack", "tracingadjusts", "tracingalignments", "tracingexpressions", "tracingfonts", "tracingfullboxes", "tracinghyphenation", "tracinginserts", "tracinglevels", "tracingmarks", "tracingmath", "tracingnodes", "tracingpenalties", "uleaders", "undent", "unexpandedloop", "unhpack", "unletfrozen", "unletprotected", "untraced", "unvpack", "vpack", "wordboundary", "wrapuppar", "xdefcsname", "xtoks", "xtoksapp", "xtokspre" }, + ["luatex"]={ "Uabove", "Uabovewithdelims", "Uatop", "Uatopwithdelims", "Uchar", "Udelcode", "Udelimited", "Udelimiter", "Udelimiterover", "Udelimiterunder", "Uhextensible", "Uleft", "Umathaccent", "Umathaccentbasedepth", "Umathaccentbaseheight", "Umathaccentbottomovershoot", "Umathaccentbottomshiftdown", "Umathaccentextendmargin", "Umathaccentsuperscriptdrop", "Umathaccentsuperscriptpercent", "Umathaccenttopovershoot", "Umathaccenttopshiftup", "Umathaccentvariant", "Umathadapttoleft", "Umathadapttoright", "Umathaxis", "Umathbottomaccentvariant", "Umathchar", "Umathcharclass", "Umathchardef", "Umathcharfam", "Umathcharslot", "Umathclass", "Umathcode", "Umathconnectoroverlapmin", "Umathdegreevariant", "Umathdelimiterovervariant", "Umathdelimiterpercent", "Umathdelimitershortfall", "Umathdelimiterundervariant", "Umathdenominatorvariant", "Umathdict", "Umathdictdef", "Umathdiscretionary", "Umathextrasubpreshift", "Umathextrasubprespace", "Umathextrasubshift", "Umathextrasubspace", "Umathextrasuppreshift", "Umathextrasupprespace", "Umathextrasupshift", "Umathextrasupspace", "Umathflattenedaccentbasedepth", "Umathflattenedaccentbaseheight", "Umathflattenedaccentbottomshiftdown", "Umathflattenedaccenttopshiftup", "Umathfractiondelsize", "Umathfractiondenomdown", "Umathfractiondenomvgap", "Umathfractionnumup", "Umathfractionnumvgap", "Umathfractionrule", "Umathfractionvariant", "Umathhextensiblevariant", "Umathlimitabovebgap", "Umathlimitabovekern", "Umathlimitabovevgap", "Umathlimitbelowbgap", "Umathlimitbelowkern", "Umathlimitbelowvgap", "Umathlimits", "Umathnoaxis", "Umathnolimits", "Umathnolimitsubfactor", "Umathnolimitsupfactor", "Umathnumeratorvariant", "Umathopenupdepth", "Umathopenupheight", "Umathoperatorsize", "Umathoverbarkern", "Umathoverbarrule", "Umathoverbarvgap", "Umathoverdelimiterbgap", "Umathoverdelimitervariant", "Umathoverdelimitervgap", "Umathoverlayaccentvariant", "Umathoverlinevariant", "Umathphantom", "Umathpresubshiftdistance", "Umathpresupshiftdistance", "Umathprimeraise", "Umathprimeraisecomposed", "Umathprimeshiftdrop", "Umathprimeshiftup", "Umathprimespaceafter", "Umathprimevariant", "Umathprimewidth", "Umathquad", "Umathradicaldegreeafter", "Umathradicaldegreebefore", "Umathradicaldegreeraise", "Umathradicalextensibleafter", "Umathradicalextensiblebefore", "Umathradicalkern", "Umathradicalrule", "Umathradicalvariant", "Umathradicalvgap", "Umathruledepth", "Umathruleheight", "Umathskeweddelimitertolerance", "Umathskewedfractionhgap", "Umathskewedfractionvgap", "Umathsource", "Umathspaceafterscript", "Umathspacebeforescript", "Umathstackdenomdown", "Umathstacknumup", "Umathstackvariant", "Umathstackvgap", "Umathsubscriptvariant", "Umathsubshiftdistance", "Umathsubshiftdown", "Umathsubshiftdrop", "Umathsubsupshiftdown", "Umathsubsupvgap", "Umathsubtopmax", "Umathsupbottommin", "Umathsuperscriptvariant", "Umathsupshiftdistance", "Umathsupshiftdrop", "Umathsupshiftup", "Umathsupsubbottommax", "Umathtopaccentvariant", "Umathunderbarkern", "Umathunderbarrule", "Umathunderbarvgap", "Umathunderdelimiterbgap", "Umathunderdelimitervariant", "Umathunderdelimitervgap", "Umathunderlinevariant", "Umathuseaxis", "Umathvextensiblevariant", "Umathvoid", "Umathxscale", "Umathyscale", "Umiddle", "Unosubprescript", "Unosubscript", "Unosuperprescript", "Unosuperscript", "Uoperator", "Uover", "Uoverdelimiter", "Uoverwithdelims", "Uprimescript", "Uradical", "Uright", "Uroot", "Urooted", "Ushiftedsubprescript", "Ushiftedsubscript", "Ushiftedsuperprescript", "Ushiftedsuperscript", "Uskewed", "Uskewedwithdelims", "Ustack", "Ustartdisplaymath", "Ustartmath", "Ustartmathmode", "Ustopdisplaymath", "Ustopmath", "Ustopmathmode", "Ustretched", "Ustretchedwithdelims", "Ustyle", "Usubprescript", "Usubscript", "Usuperprescript", "Usuperscript", "Uunderdelimiter", "Uvextensible", "adjustspacing", "adjustspacingshrink", "adjustspacingstep", "adjustspacingstretch", "afterassigned", "aftergrouped", "aliased", "aligncontent", "alignmark", "alignmentcellsource", "alignmentwrapsource", "aligntab", "allcrampedstyles", "alldisplaystyles", "allmainstyles", "allmathstyles", "allscriptscriptstyles", "allscriptstyles", "allsplitstyles", "alltextstyles", "alluncrampedstyles", "allunsplitstyles", "atendofgroup", "atendofgrouped", "attribute", "attributedef", "automaticdiscretionary", "automatichyphenpenalty", "automigrationmode", "autoparagraphmode", "begincsname", "beginlocalcontrol", "beginmathgroup", "beginsimplegroup", "boundary", "boxadapt", "boxanchor", "boxanchors", "boxattribute", "boxdirection", "boxfreeze", "boxgeometry", "boxorientation", "boxrepack", "boxshift", "boxsource", "boxtarget", "boxtotal", "boxxmove", "boxxoffset", "boxymove", "boxyoffset", "catcodetable", "clearmarks", "copymathatomrule", "copymathparent", "copymathspacing", "crampeddisplaystyle", "crampedscriptscriptstyle", "crampedscriptstyle", "crampedtextstyle", "csstring", "currentloopiterator", "currentloopnesting", "currentmarks", "defcsname", "detokenized", "dimensiondef", "dimexpression", "directlua", "edefcsname", "efcode", "endlocalcontrol", "endmathgroup", "endsimplegroup", "enforced", "etoks", "etoksapp", "etokspre", "everybeforepar", "everymathatom", "everytab", "exceptionpenalty", "expand", "expandafterpars", "expandafterspaces", "expandcstoken", "expanded", "expandedafter", "expandedloop", "expandtoken", "explicitdiscretionary", "explicithyphenpenalty", "firstvalidlanguage", "flushmarks", "fontcharta", "fontid", "fontmathcontrol", "fontspecdef", "fontspecid", "fontspecifiedname", "fontspecifiedsize", "fontspecscale", "fontspecxscale", "fontspecyscale", "fonttextcontrol", "formatname", "frozen", "futurecsname", "futuredef", "futureexpand", "futureexpandis", "futureexpandisap", "gdefcsname", "gleaders", "glet", "gletcsname", "glettonothing", "gluespecdef", "glyph", "glyphdatafield", "glyphoptions", "glyphscale", "glyphscriptfield", "glyphscriptscale", "glyphscriptscriptscale", "glyphstatefield", "glyphtextscale", "glyphxoffset", "glyphxscale", "glyphxscaled", "glyphyoffset", "glyphyscale", "glyphyscaled", "gtoksapp", "gtokspre", "hccode", "hjcode", "hmcode", "holdingmigrations", "hpack", "hyphenationmin", "hyphenationmode", "ifabsdim", "ifabsnum", "ifarguments", "ifboolean", "ifchkdim", "ifchknum", "ifcmpdim", "ifcmpnum", "ifcondition", "ifcstok", "ifdimexpression", "ifdimval", "ifempty", "ifflags", "ifhaschar", "ifhastok", "ifhastoks", "ifhasxtoks", "ifincsname", "ifinsert", "ifmathparameter", "ifmathstyle", "ifnumexpression", "ifnumval", "ifparameter", "ifparameters", "ifrelax", "iftok", "ifzerodim", "ifzeronum", "ignorearguments", "ignorepars", "immediate", "immutable", "indexofcharacter", "indexofregister", "inherited", "initcatcodetable", "insertbox", "insertcopy", "insertdepth", "insertdistance", "insertheight", "insertheights", "insertlimit", "insertmaxdepth", "insertmode", "insertmultiplier", "insertpenalty", "insertprogress", "insertstorage", "insertstoring", "insertunbox", "insertuncopy", "insertwidth", "instance", "integerdef", "lastarguments", "lastatomclass", "lastboundary", "lastchkdim", "lastchknum", "lastleftclass", "lastloopiterator", "lastnamedcs", "lastnodesubtype", "lastpageextra", "lastparcontext", "lastrightclass", "leftmarginkern", "letcharcode", "letcsname", "letfrozen", "letmathatomrule", "letmathparent", "letmathspacing", "letprotected", "lettonothing", "linebreakcriterium", "linedirection", "localbrokenpenalty", "localcontrol", "localcontrolled", "localcontrolledloop", "localinterlinepenalty", "localleftbox", "localleftboxbox", "localmiddlebox", "localmiddleboxbox", "localrightbox", "localrightboxbox", "lpcode", "luabytecode", "luabytecodecall", "luacopyinputnodes", "luadef", "luaescapestring", "luafunction", "luafunctioncall", "luatexbanner", "luatexrevision", "luatexversion", "mathaccent", "mathatom", "mathatomglue", "mathatomskip", "mathbackwardpenalties", "mathbeginclass", "mathcheckfencesmode", "mathdictgroup", "mathdictproperties", "mathdirection", "mathdisplaymode", "mathdisplayskipmode", "mathdoublescriptmode", "mathendclass", "matheqnogapstep", "mathfenced", "mathfontcontrol", "mathforwardpenalties", "mathfrac", "mathghost", "mathgluemode", "mathgroupingmode", "mathleftclass", "mathlimitsmode", "mathmainstyle", "mathmiddle", "mathnolimitsmode", "mathpenaltiesmode", "mathrad", "mathrightclass", "mathrulesfam", "mathrulesmode", "mathscale", "mathscriptsmode", "mathslackmode", "mathspacingmode", "mathstackstyle", "mathstyle", "mathstylefontid", "mathsurroundmode", "mathsurroundskip", "maththreshold", "meaningasis", "meaningfull", "meaningless", "mugluespecdef", "mutable", "noaligned", "noatomruling", "noboundary", "nohrule", "norelax", "normalizelinemode", "normalizeparmode", "nospaces", "novrule", "numericscale", "numexpression", "orelse", "orphanpenalties", "orphanpenalty", "orunless", "outputbox", "overloaded", "overloadmode", "overshoot", "pageboundary", "pageextragoal", "pagevsize", "parametercount", "parametermark", "parattribute", "pardirection", "permanent", "pettymuskip", "postexhyphenchar", "posthyphenchar", "postinlinepenalty", "prebinoppenalty", "predisplaygapfactor", "preexhyphenchar", "prehyphenchar", "preinlinepenalty", "prerelpenalty", "protrudechars", "protrusionboundary", "pxdimen", "quitloop", "quitvmode", "resetmathspacing", "retokenized", "rightmarginkern", "rpcode", "savecatcodetable", "scaledemwidth", "scaledexheight", "scaledextraspace", "scaledfontdimen", "scaledinterwordshrink", "scaledinterwordspace", "scaledinterwordstretch", "scaledmathstyle", "scaledslantperpoint", "scantextokens", "semiexpand", "semiexpanded", "semiprotected", "setdefaultmathcodes", "setfontid", "setmathatomrule", "setmathdisplaypostpenalty", "setmathdisplayprepenalty", "setmathignore", "setmathoptions", "setmathpostpenalty", "setmathprepenalty", "setmathspacing", "shapingpenaltiesmode", "shapingpenalty", "snapshotpar", "srule", "supmarkmode", "swapcsvalues", "tabsize", "textdirection", "thewithoutunit", "tinymuskip", "todimension", "tohexadecimal", "tointeger", "tokenized", "toksapp", "tokspre", "tolerant", "tomathstyle", "toscaled", "tosparsedimension", "tosparsescaled", "tpack", "tracingadjusts", "tracingalignments", "tracingexpressions", "tracingfonts", "tracingfullboxes", "tracinghyphenation", "tracinginserts", "tracinglevels", "tracingmarks", "tracingmath", "tracingnodes", "tracingpenalties", "uleaders", "undent", "unexpandedloop", "unhpack", "unletfrozen", "unletprotected", "untraced", "unvpack", "vpack", "wordboundary", "wrapuppar", "xdefcsname", "xtoks", "xtoksapp", "xtokspre" }, ["omega"]={ "Omegaminorversion", "Omegarevision", "Omegaversion" }, ["pdftex"]={ "ifpdfabsdim", "ifpdfabsnum", "ifpdfprimitive", "pdfadjustspacing", "pdfannot", "pdfcatalog", "pdfcolorstack", "pdfcolorstackinit", "pdfcompresslevel", "pdfcopyfont", "pdfcreationdate", "pdfdecimaldigits", "pdfdest", "pdfdestmargin", "pdfdraftmode", "pdfeachlinedepth", "pdfeachlineheight", "pdfendlink", "pdfendthread", "pdffirstlineheight", "pdffontattr", "pdffontexpand", "pdffontname", "pdffontobjnum", "pdffontsize", "pdfgamma", "pdfgentounicode", "pdfglyphtounicode", "pdfhorigin", "pdfignoreddimen", "pdfignoreunknownimages", "pdfimageaddfilename", "pdfimageapplygamma", "pdfimagegamma", "pdfimagehicolor", "pdfimageresolution", "pdfincludechars", "pdfinclusioncopyfonts", "pdfinclusionerrorlevel", "pdfinfo", "pdfinfoomitdate", "pdfinsertht", "pdflastannot", "pdflastlinedepth", "pdflastlink", "pdflastobj", "pdflastxform", "pdflastximage", "pdflastximagepages", "pdflastxpos", "pdflastypos", "pdflinkmargin", "pdfliteral", "pdfmajorversion", "pdfmapfile", "pdfmapline", "pdfminorversion", "pdfnames", "pdfnoligatures", "pdfnormaldeviate", "pdfobj", "pdfobjcompresslevel", "pdfomitcharset", "pdfomitcidset", "pdfomitinfodict", "pdfoutline", "pdfoutput", "pdfpageattr", "pdfpagebox", "pdfpageheight", "pdfpageref", "pdfpageresources", "pdfpagesattr", "pdfpagewidth", "pdfpkfixeddpi", "pdfpkmode", "pdfpkresolution", "pdfprimitive", "pdfprotrudechars", "pdfpxdimen", "pdfrandomseed", "pdfrecompress", "pdfrefobj", "pdfrefxform", "pdfrefximage", "pdfreplacefont", "pdfrestore", "pdfretval", "pdfsave", "pdfsavepos", "pdfsetmatrix", "pdfsetrandomseed", "pdfstartlink", "pdfstartthread", "pdfsuppressoptionalinfo", "pdfsuppressptexinfo", "pdftexbanner", "pdftexrevision", "pdftexversion", "pdfthread", "pdfthreadmargin", "pdftracingfonts", "pdftrailer", "pdftrailerid", "pdfuniformdeviate", "pdfuniqueresname", "pdfvorigin", "pdfxform", "pdfxformattr", "pdfxformmargin", "pdfxformname", "pdfxformresources", "pdfximage" }, ["tex"]={ " ", "-", "/", "above", "abovedisplayshortskip", "abovedisplayskip", "abovewithdelims", "accent", "adjdemerits", "advance", "afterassignment", "aftergroup", "atop", "atopwithdelims", "badness", "baselineskip", "batchmode", "begingroup", "belowdisplayshortskip", "belowdisplayskip", "binoppenalty", "botmark", "box", "boxmaxdepth", "brokenpenalty", "catcode", "char", "chardef", "cleaders", "clubpenalty", "copy", "count", "countdef", "cr", "crcr", "csname", "day", "deadcycles", "def", "defaulthyphenchar", "defaultskewchar", "delcode", "delimiter", "delimiterfactor", "delimitershortfall", "dimen", "dimendef", "discretionary", "displayindent", "displaylimits", "displaystyle", "displaywidowpenalty", "displaywidth", "divide", "doublehyphendemerits", "dp", "dump", "edef", "else", "emergencystretch", "end", "endcsname", "endgroup", "endinput", "endlinechar", "eqno", "errhelp", "errmessage", "errorcontextlines", "errorstopmode", "escapechar", "everycr", "everydisplay", "everyhbox", "everyjob", "everymath", "everypar", "everyvbox", "exhyphenchar", "exhyphenpenalty", "expandafter", "fam", "fi", "finalhyphendemerits", "firstmark", "floatingpenalty", "font", "fontdimen", "fontname", "futurelet", "gdef", "global", "globaldefs", "halign", "hangafter", "hangindent", "hbadness", "hbox", "hfil", "hfill", "hfilneg", "hfuzz", "holdinginserts", "hrule", "hsize", "hskip", "hss", "ht", "hyphenation", "hyphenchar", "hyphenpenalty", "if", "ifcase", "ifcat", "ifdim", "iffalse", "ifhbox", "ifhmode", "ifinner", "ifmmode", "ifnum", "ifodd", "iftrue", "ifvbox", "ifvmode", "ifvoid", "ifx", "ignorespaces", "indent", "input", "inputlineno", "insert", "insertpenalties", "interlinepenalty", "jobname", "kern", "language", "lastbox", "lastkern", "lastpenalty", "lastskip", "lccode", "leaders", "left", "lefthyphenmin", "leftskip", "leqno", "let", "limits", "linepenalty", "lineskip", "lineskiplimit", "long", "looseness", "lower", "lowercase", "mark", "mathbin", "mathchar", "mathchardef", "mathchoice", "mathclose", "mathcode", "mathinner", "mathop", "mathopen", "mathord", "mathpunct", "mathrel", "mathsurround", "maxdeadcycles", "maxdepth", "meaning", "medmuskip", "message", "middle", "mkern", "month", "moveleft", "moveright", "mskip", "multiply", "muskip", "muskipdef", "newlinechar", "noalign", "noexpand", "noindent", "nolimits", "nonscript", "nonstopmode", "nulldelimiterspace", "nullfont", "number", "omit", "or", "outer", "output", "outputpenalty", "over", "overfullrule", "overline", "overwithdelims", "pagedepth", "pagefilllstretch", "pagefillstretch", "pagefilstretch", "pagegoal", "pageshrink", "pagestretch", "pagetotal", "par", "parfillleftskip", "parfillskip", "parindent", "parinitleftskip", "parinitrightskip", "parshape", "parskip", "patterns", "pausing", "penalty", "postdisplaypenalty", "predisplaypenalty", "predisplaysize", "pretolerance", "prevdepth", "prevgraf", "radical", "raise", "relax", "relpenalty", "right", "righthyphenmin", "rightskip", "romannumeral", "scriptfont", "scriptscriptfont", "scriptscriptstyle", "scriptspace", "scriptstyle", "scrollmode", "setbox", "setlanguage", "sfcode", "shipout", "show", "showbox", "showboxbreadth", "showboxdepth", "showlists", "shownodedetails", "showthe", "skewchar", "skip", "skipdef", "spacefactor", "spaceskip", "span", "splitbotmark", "splitfirstmark", "splitmaxdepth", "splittopskip", "string", "tabskip", "textfont", "textstyle", "the", "thickmuskip", "thinmuskip", "time", "toks", "toksdef", "tolerance", "topmark", "topskip", "tracingcommands", "tracinglostchars", "tracingmacros", "tracingonline", "tracingoutput", "tracingpages", "tracingparagraphs", "tracingrestores", "tracingstats", "uccode", "uchyph", "unboundary", "underline", "unhbox", "unhcopy", "unkern", "unpenalty", "unskip", "unvbox", "unvcopy", "uppercase", "vadjust", "valign", "vbadness", "vbox", "vcenter", "vfil", "vfill", "vfilneg", "vfuzz", "vrule", "vsize", "vskip", "vsplit", "vss", "vtop", "wd", "widowpenalty", "xdef", "xleaders", "xspaceskip", "year" }, diff --git a/context/data/scite/context/scite-context-data-context.properties b/context/data/scite/context/scite-context-data-context.properties index f88a237f1..ca2911ace 100644 --- a/context/data/scite/context/scite-context-data-context.properties +++ b/context/data/scite/context/scite-context-data-context.properties @@ -48,72 +48,69 @@ insertautomigrationcode adjustautomigrationcode preautomigrationcode postautomig hlistnodecode vlistnodecode rulenodecode insertnodecode marknodecode \ adjustnodecode ligaturenodecode discretionarynodecode whatsitnodecode mathnodecode \ gluenodecode kernnodecode penaltynodecode unsetnodecode mathsnodecode \ -charifcode catifcode numifcode dimifcode oddifcode \ -vmodeifcode hmodeifcode mmodeifcode innerifcode voidifcode \ -hboxifcode vboxifcode xifcode eofifcode trueifcode \ -falseifcode caseifcode definedifcode csnameifcode fontcharifcode \ overrulemathcontrolcode underrulemathcontrolcode radicalrulemathcontrolcode fractionrulemathcontrolcode accentskewhalfmathcontrolcode \ accentskewapplymathcontrolcode applyordinarykernpairmathcontrolcode applyverticalitalickernmathcontrolcode applyordinaryitalickernmathcontrolcode applycharitalickernmathcontrolcode \ reboxcharitalickernmathcontrolcode applyboxeditalickernmathcontrolcode staircasekernmathcontrolcode applytextitalickernmathcontrolcode applyscriptitalickernmathcontrolcode \ checkspaceitalickernmathcontrolcode checktextitalickernmathcontrolcode analyzescriptnucleuscharmathcontrolcode analyzescriptnucleuslistmathcontrolcode analyzescriptnucleusboxmathcontrolcode \ -noligaturingglyphoptioncode nokerningglyphoptioncode noexpansionglyphoptioncode noprotrusionglyphoptioncode noleftkerningglyphoptioncode \ -noleftligaturingglyphoptioncode norightkerningglyphoptioncode norightligaturingglyphoptioncode noitaliccorrectionglyphoptioncode normalparcontextcode \ -vmodeparcontextcode vboxparcontextcode vtopparcontextcode vcenterparcontextcode vadjustparcontextcode \ -insertparcontextcode outputparcontextcode alignparcontextcode noalignparcontextcode spanparcontextcode \ -resetparcontextcode leftoriginlistanchorcode leftheightlistanchorcode leftdepthlistanchorcode rightoriginlistanchorcode \ -rightheightlistanchorcode rightdepthlistanchorcode centeroriginlistanchorcode centerheightlistanchorcode centerdepthlistanchorcode \ -halfwaytotallistanchorcode halfwayheightlistanchorcode halfwaydepthlistanchorcode halfwayleftlistanchorcode halfwayrightlistanchorcode \ -negatexlistsigncode negateylistsigncode negatelistsigncode fontslantperpoint fontinterwordspace \ -fontinterwordstretch fontinterwordshrink fontexheight fontemwidth fontextraspace \ -slantperpoint mathexheight mathemwidth interwordspace interwordstretch \ -interwordshrink exheight emwidth extraspace mathaxisheight \ -muquad startmode stopmode startnotmode stopnotmode \ -startmodeset stopmodeset doifmode doifelsemode doifmodeelse \ -doifnotmode startmodeset stopmodeset startallmodes stopallmodes \ -startnotallmodes stopnotallmodes doifallmodes doifelseallmodes doifallmodeselse \ -doifnotallmodes startenvironment stopenvironment environment startcomponent \ -stopcomponent component startproduct stopproduct product \ -startproject stopproject project starttext stoptext \ -startnotext stopnotext startdocument stopdocument documentvariable \ -unexpandeddocumentvariable setupdocument presetdocument doifelsedocumentvariable doifdocumentvariableelse \ -doifdocumentvariable doifnotdocumentvariable startmodule stopmodule usemodule \ -usetexmodule useluamodule setupmodule currentmoduleparameter moduleparameter \ -everystarttext everystoptext startTEXpage stopTEXpage enablemode \ -disablemode preventmode definemode globalenablemode globaldisablemode \ -globalpreventmode pushmode popmode typescriptone typescripttwo \ -typescriptthree mathsizesuffix mathordinarycode mathordcode mathoperatorcode \ -mathopcode mathbinarycode mathbincode mathrelationcode mathrelcode \ -mathopencode mathclosecode mathpunctuationcode mathpunctcode mathovercode \ -mathundercode mathinnercode mathradicalcode mathfractioncode mathmiddlecode \ -mathaccentcode mathfencedcode mathghostcode mathvariablecode mathactivecode \ -mathvcentercode mathconstructcode mathwrappedcode mathbegincode mathendcode \ -mathexplicitcode mathdivisioncode mathfactorialcode mathdimensioncode mathexperimentalcode \ -mathtextpunctuationcode mathimaginarycode mathdifferentialcode mathexponentialcode mathellipsiscode \ -mathfunctioncode mathdigitcode mathalphacode mathboxcode mathchoicecode \ -mathnothingcode mathlimopcode mathnolopcode mathunsetcode mathunspacedcode \ -mathallcode mathfakecode mathunarycode mathmaybeordinarycode mathmayberelationcode \ -mathmaybebinarycode mathnumbergroupcode constantnumber constantnumberargument constantdimen \ -constantdimenargument constantemptyargument luastringsep !!bs !!es \ -lefttorightmark righttoleftmark lrm rlm bidilre \ -bidirle bidipop bidilro bidirlo breakablethinspace \ -nobreakspace nonbreakablespace narrownobreakspace zerowidthnobreakspace ideographicspace \ -ideographichalffillspace twoperemspace threeperemspace fourperemspace fiveperemspace \ -sixperemspace figurespace punctuationspace hairspace enquad \ -emquad zerowidthspace zerowidthnonjoiner zerowidthjoiner zwnj \ -zwj optionalspace asciispacechar softhyphen Ux \ -eUx Umathaccents parfillleftskip parfillrightskip startlmtxmode \ -stoplmtxmode startmkivmode stopmkivmode wildcardsymbol normalhyphenationcode \ -automatichyphenationcode explicithyphenationcode syllablehyphenationcode uppercasehyphenationcode collapsehyphenationcode \ -compoundhyphenationcode strictstarthyphenationcode strictendhyphenationcode automaticpenaltyhyphenationcode explicitpenaltyhyphenationcode \ -permitgluehyphenationcode permitallhyphenationcode permitmathreplacehyphenationcode forcecheckhyphenationcode lazyligatureshyphenationcode \ -forcehandlerhyphenationcode feedbackcompoundhyphenationcode ignoreboundshyphenationcode partialhyphenationcode completehyphenationcode \ -normalizelinenormalizecode parindentskipnormalizecode swaphangindentnormalizecode swapparsshapenormalizecode breakafterdirnormalizecode \ -removemarginkernsnormalizecode clipwidthnormalizecode flattendiscretionariesnormalizecode discardzerotabskipsnormalizecode flattenhleadersnormalizecode \ -normalizeparnormalizeparcode flattenvleadersnormalizeparcode nopreslackclassoptioncode nopostslackclassoptioncode lefttopkernclassoptioncode \ -righttopkernclassoptioncode leftbottomkernclassoptioncode rightbottomkernclassoptioncode lookaheadforendclassoptioncode noitaliccorrectionclassoptioncode \ -defaultmathclassoptions checkligatureclassoptioncode checkitaliccorrectionclassoptioncode checkkernpairclassoptioncode flattenclassoptioncode \ -omitpenaltyclassoptioncode unpackclassoptioncode raiseprimeclassoptioncode carryoverlefttopkernclassoptioncode carryoverleftbottomkernclassoptioncode \ -carryoverrighttopkernclassoptioncode carryoverrightbottomkernclassoptioncode preferdelimiterdimensionsclassoptioncode autoinjectclassoptioncode removeitaliccorrectionclassoptioncode \ +accenttopskewwithoffsetmathcontrolcode ignorekerndimensionsmathcontrolcode noligaturingglyphoptioncode nokerningglyphoptioncode noexpansionglyphoptioncode \ +noprotrusionglyphoptioncode noleftkerningglyphoptioncode noleftligaturingglyphoptioncode norightkerningglyphoptioncode norightligaturingglyphoptioncode \ +noitaliccorrectionglyphoptioncode islargeoperatorglyphoptioncode hasitalicshapeglyphoptioncode normalparcontextcode vmodeparcontextcode \ +vboxparcontextcode vtopparcontextcode vcenterparcontextcode vadjustparcontextcode insertparcontextcode \ +outputparcontextcode alignparcontextcode noalignparcontextcode spanparcontextcode resetparcontextcode \ +leftoriginlistanchorcode leftheightlistanchorcode leftdepthlistanchorcode rightoriginlistanchorcode rightheightlistanchorcode \ +rightdepthlistanchorcode centeroriginlistanchorcode centerheightlistanchorcode centerdepthlistanchorcode halfwaytotallistanchorcode \ +halfwayheightlistanchorcode halfwaydepthlistanchorcode halfwayleftlistanchorcode halfwayrightlistanchorcode negatexlistsigncode \ +negateylistsigncode negatelistsigncode fontslantperpoint fontinterwordspace fontinterwordstretch \ +fontinterwordshrink fontexheight fontemwidth fontextraspace slantperpoint \ +mathexheight mathemwidth interwordspace interwordstretch interwordshrink \ +exheight emwidth extraspace mathaxisheight muquad \ +startmode stopmode startnotmode stopnotmode startmodeset \ +stopmodeset doifmode doifelsemode doifmodeelse doifnotmode \ +startmodeset stopmodeset startallmodes stopallmodes startnotallmodes \ +stopnotallmodes doifallmodes doifelseallmodes doifallmodeselse doifnotallmodes \ +startenvironment stopenvironment environment startcomponent stopcomponent \ +component startproduct stopproduct product startproject \ +stopproject project starttext stoptext startnotext \ +stopnotext startdocument stopdocument documentvariable unexpandeddocumentvariable \ +setupdocument presetdocument doifelsedocumentvariable doifdocumentvariableelse doifdocumentvariable \ +doifnotdocumentvariable startmodule stopmodule usemodule usetexmodule \ +useluamodule setupmodule currentmoduleparameter moduleparameter everystarttext \ +everystoptext startTEXpage stopTEXpage enablemode disablemode \ +preventmode definemode globalenablemode globaldisablemode globalpreventmode \ +pushmode popmode typescriptone typescripttwo typescriptthree \ +mathsizesuffix mathordinarycode mathordcode mathoperatorcode mathopcode \ +mathbinarycode mathbincode mathrelationcode mathrelcode mathopencode \ +mathclosecode mathpunctuationcode mathpunctcode mathovercode mathundercode \ +mathinnercode mathradicalcode mathfractioncode mathmiddlecode mathaccentcode \ +mathfencedcode mathghostcode mathvariablecode mathactivecode mathvcentercode \ +mathconstructcode mathwrappedcode mathbegincode mathendcode mathexplicitcode \ +mathdivisioncode mathfactorialcode mathdimensioncode mathexperimentalcode mathtextpunctuationcode \ +mathimaginarycode mathdifferentialcode mathexponentialcode mathellipsiscode mathfunctioncode \ +mathdigitcode mathalphacode mathboxcode mathchoicecode mathnothingcode \ +mathlimopcode mathnolopcode mathunsetcode mathunspacedcode mathallcode \ +mathfakecode mathunarycode mathmaybeordinarycode mathmayberelationcode mathmaybebinarycode \ +mathnumbergroupcode constantnumber constantnumberargument constantdimen constantdimenargument \ +constantemptyargument luastringsep !!bs !!es lefttorightmark \ +righttoleftmark lrm rlm bidilre bidirle \ +bidipop bidilro bidirlo breakablethinspace nobreakspace \ +nonbreakablespace narrownobreakspace zerowidthnobreakspace ideographicspace ideographichalffillspace \ +twoperemspace threeperemspace fourperemspace fiveperemspace sixperemspace \ +figurespace punctuationspace hairspace enquad emquad \ +zerowidthspace zerowidthnonjoiner zerowidthjoiner zwnj zwj \ +optionalspace asciispacechar softhyphen Ux eUx \ +Umathaccents parfillleftskip parfillrightskip startlmtxmode stoplmtxmode \ +startmkivmode stopmkivmode wildcardsymbol normalhyphenationcode automatichyphenationcode \ +explicithyphenationcode syllablehyphenationcode uppercasehyphenationcode collapsehyphenationcode compoundhyphenationcode \ +strictstarthyphenationcode strictendhyphenationcode automaticpenaltyhyphenationcode explicitpenaltyhyphenationcode permitgluehyphenationcode \ +permitallhyphenationcode permitmathreplacehyphenationcode forcecheckhyphenationcode lazyligatureshyphenationcode forcehandlerhyphenationcode \ +feedbackcompoundhyphenationcode ignoreboundshyphenationcode partialhyphenationcode completehyphenationcode normalizelinenormalizecode \ +parindentskipnormalizecode swaphangindentnormalizecode swapparsshapenormalizecode breakafterdirnormalizecode removemarginkernsnormalizecode \ +clipwidthnormalizecode flattendiscretionariesnormalizecode discardzerotabskipsnormalizecode flattenhleadersnormalizecode normalizeparnormalizeparcode \ +flattenvleadersnormalizeparcode nopreslackclassoptioncode nopostslackclassoptioncode lefttopkernclassoptioncode righttopkernclassoptioncode \ +leftbottomkernclassoptioncode rightbottomkernclassoptioncode lookaheadforendclassoptioncode noitaliccorrectionclassoptioncode defaultmathclassoptions \ +checkligatureclassoptioncode checkitaliccorrectionclassoptioncode checkkernpairclassoptioncode flattenclassoptioncode omitpenaltyclassoptioncode \ +unpackclassoptioncode raiseprimeclassoptioncode carryoverlefttopkernclassoptioncode carryoverleftbottomkernclassoptioncode carryoverrighttopkernclassoptioncode \ +carryoverrightbottomkernclassoptioncode preferdelimiterdimensionsclassoptioncode autoinjectclassoptioncode removeitaliccorrectionclassoptioncode operatoritaliccorrectionclassoptioncode \ noligaturingglyphoptioncode nokerningglyphoptioncode noleftligatureglyphoptioncode noleftkernglyphoptioncode norightligatureglyphoptioncode \ norightkernglyphoptioncode noexpansionglyphoptioncode noprotrusionglyphoptioncode noitaliccorrectionglyphoptioncode nokerningcode \ noligaturingcode frozenflagcode tolerantflagcode protectedflagcode primitiveflagcode \ diff --git a/context/data/scite/context/scite-context-data-tex.properties b/context/data/scite/context/scite-context-data-tex.properties index 3ea4d1b49..d6f016425 100644 --- a/context/data/scite/context/scite-context-data-tex.properties +++ b/context/data/scite/context/scite-context-data-tex.properties @@ -36,104 +36,105 @@ Umathoverbarkern Umathoverbarrule Umathoverbarvgap Umathoverdelimiterbgap Umatho Umathoverdelimitervgap Umathoverlayaccentvariant Umathoverlinevariant Umathphantom Umathpresubshiftdistance \ Umathpresupshiftdistance Umathprimeraise Umathprimeraisecomposed Umathprimeshiftdrop Umathprimeshiftup \ Umathprimespaceafter Umathprimevariant Umathprimewidth Umathquad Umathradicaldegreeafter \ -Umathradicaldegreebefore Umathradicaldegreeraise Umathradicalkern Umathradicalrule Umathradicalvariant \ -Umathradicalvgap Umathruledepth Umathruleheight Umathskeweddelimitertolerance Umathskewedfractionhgap \ -Umathskewedfractionvgap Umathsource Umathspaceafterscript Umathspacebeforescript Umathstackdenomdown \ -Umathstacknumup Umathstackvariant Umathstackvgap Umathsubscriptvariant Umathsubshiftdistance \ -Umathsubshiftdown Umathsubshiftdrop Umathsubsupshiftdown Umathsubsupvgap Umathsubtopmax \ -Umathsupbottommin Umathsuperscriptvariant Umathsupshiftdistance Umathsupshiftdrop Umathsupshiftup \ -Umathsupsubbottommax Umathtopaccentvariant Umathunderbarkern Umathunderbarrule Umathunderbarvgap \ -Umathunderdelimiterbgap Umathunderdelimitervariant Umathunderdelimitervgap Umathunderlinevariant Umathuseaxis \ -Umathvextensiblevariant Umathvoid Umathxscale Umathyscale Umiddle \ -Unosubprescript Unosubscript Unosuperprescript Unosuperscript Uoperator \ -Uover Uoverdelimiter Uoverwithdelims Uprimescript Uradical \ -Uright Uroot Urooted Ushiftedsubprescript Ushiftedsubscript \ -Ushiftedsuperprescript Ushiftedsuperscript Uskewed Uskewedwithdelims Ustack \ -Ustartdisplaymath Ustartmath Ustartmathmode Ustopdisplaymath Ustopmath \ -Ustopmathmode Ustretched Ustretchedwithdelims Ustyle Usubprescript \ -Usubscript Usuperprescript Usuperscript Uunderdelimiter Uvextensible \ -adjustspacing adjustspacingshrink adjustspacingstep adjustspacingstretch afterassigned \ -aftergrouped aliased aligncontent alignmark alignmentcellsource \ -alignmentwrapsource aligntab allcrampedstyles alldisplaystyles allmathstyles \ -allscriptscriptstyles allscriptstyles allsplitstyles alltextstyles alluncrampedstyles \ -atendofgroup atendofgrouped attribute attributedef automaticdiscretionary \ -automatichyphenpenalty automigrationmode autoparagraphmode begincsname beginlocalcontrol \ -beginmathgroup beginsimplegroup boundary boxadapt boxanchor \ -boxanchors boxattribute boxdirection boxfreeze boxgeometry \ -boxorientation boxrepack boxshift boxsource boxtarget \ -boxtotal boxxmove boxxoffset boxymove boxyoffset \ -catcodetable clearmarks copymathatomrule copymathparent copymathspacing \ -crampeddisplaystyle crampedscriptscriptstyle crampedscriptstyle crampedtextstyle csstring \ -currentloopiterator currentloopnesting currentmarks defcsname detokenized \ -dimensiondef dimexpression directlua edefcsname efcode \ -endlocalcontrol endmathgroup endsimplegroup enforced etoks \ -etoksapp etokspre everybeforepar everymathatom everytab \ -exceptionpenalty expand expandafterpars expandafterspaces expandcstoken \ -expanded expandedafter expandedloop expandtoken explicitdiscretionary \ -explicithyphenpenalty firstvalidlanguage flushmarks fontcharta fontid \ -fontmathcontrol fontspecdef fontspecid fontspecifiedname fontspecifiedsize \ -fontspecscale fontspecxscale fontspecyscale fonttextcontrol formatname \ -frozen futurecsname futuredef futureexpand futureexpandis \ -futureexpandisap gdefcsname gleaders glet gletcsname \ -glettonothing gluespecdef glyph glyphdatafield glyphoptions \ -glyphscale glyphscriptfield glyphscriptscale glyphscriptscriptscale glyphstatefield \ -glyphtextscale glyphxoffset glyphxscale glyphxscaled glyphyoffset \ -glyphyscale glyphyscaled gtoksapp gtokspre hccode \ -hjcode hmcode holdingmigrations hpack hyphenationmin \ -hyphenationmode ifabsdim ifabsnum ifarguments ifboolean \ -ifchkdim ifchknum ifcmpdim ifcmpnum ifcondition \ -ifcstok ifdimexpression ifdimval ifempty ifflags \ -ifhaschar ifhastok ifhastoks ifhasxtoks ifincsname \ -ifinsert ifmathparameter ifmathstyle ifnumexpression ifnumval \ -ifparameter ifparameters ifrelax iftok ignorearguments \ -ignorepars immediate immutable indexofcharacter indexofregister \ -inherited initcatcodetable insertbox insertcopy insertdepth \ -insertdistance insertheight insertheights insertlimit insertmaxdepth \ -insertmode insertmultiplier insertpenalty insertprogress insertstorage \ -insertstoring insertunbox insertuncopy insertwidth instance \ -integerdef lastarguments lastatomclass lastboundary lastchkdim \ -lastchknum lastleftclass lastloopiterator lastnamedcs lastnodesubtype \ -lastpageextra lastparcontext lastrightclass leftmarginkern letcharcode \ -letcsname letfrozen letmathatomrule letmathparent letmathspacing \ -letprotected lettonothing linebreakcriterium linedirection localbrokenpenalty \ -localcontrol localcontrolled localcontrolledloop localinterlinepenalty localleftbox \ -localleftboxbox localmiddlebox localmiddleboxbox localrightbox localrightboxbox \ -lpcode luabytecode luabytecodecall luacopyinputnodes luadef \ -luaescapestring luafunction luafunctioncall luatexbanner luatexrevision \ -luatexversion mathaccent mathatom mathatomglue mathatomskip \ -mathbackwardpenalties mathbeginclass mathcheckfencesmode mathdictgroup mathdictproperties \ -mathdirection mathdisplaymode mathdisplayskipmode mathdoublescriptmode mathendclass \ -matheqnogapstep mathfenced mathfontcontrol mathforwardpenalties mathfrac \ -mathghost mathgluemode mathgroupingmode mathleftclass mathlimitsmode \ -mathmainstyle mathmiddle mathnolimitsmode mathpenaltiesmode mathrad \ -mathrightclass mathrulesfam mathrulesmode mathscale mathscriptsmode \ -mathslackmode mathspacingmode mathstackstyle mathstyle mathstylefontid \ -mathsurroundmode mathsurroundskip maththreshold meaningasis meaningfull \ -meaningless mugluespecdef mutable noaligned noatomruling \ -noboundary nohrule norelax normalizelinemode normalizeparmode \ -nospaces novrule numericscale numexpression orelse \ -orphanpenalties orphanpenalty orunless outputbox overloaded \ -overloadmode overshoot pageboundary pageextragoal pagevsize \ -parametercount parametermark parattribute pardirection permanent \ -pettymuskip postexhyphenchar posthyphenchar postinlinepenalty prebinoppenalty \ -predisplaygapfactor preexhyphenchar prehyphenchar preinlinepenalty prerelpenalty \ -protrudechars protrusionboundary pxdimen quitloop quitvmode \ -resetmathspacing retokenized rightmarginkern rpcode savecatcodetable \ -scaledemwidth scaledexheight scaledextraspace scaledfontdimen scaledinterwordshrink \ -scaledinterwordspace scaledinterwordstretch scaledmathstyle scaledslantperpoint scantextokens \ -semiexpand semiexpanded semiprotected setdefaultmathcodes setfontid \ -setmathatomrule setmathdisplaypostpenalty setmathdisplayprepenalty setmathignore setmathoptions \ -setmathpostpenalty setmathprepenalty setmathspacing shapingpenaltiesmode shapingpenalty \ -snapshotpar srule supmarkmode swapcsvalues tabsize \ -textdirection thewithoutunit tinymuskip todimension tohexadecimal \ -tointeger tokenized toksapp tokspre tolerant \ -tomathstyle toscaled tosparsedimension tosparsescaled tpack \ -tracingadjusts tracingalignments tracingexpressions tracingfonts tracingfullboxes \ -tracinghyphenation tracinginserts tracinglevels tracingmarks tracingmath \ -tracingnodes tracingpenalties uleaders undent unexpandedloop \ -unhpack unletfrozen unletprotected untraced unvpack \ -vpack wordboundary wrapuppar xdefcsname xtoks \ -xtoksapp xtokspre +Umathradicaldegreebefore Umathradicaldegreeraise Umathradicalextensibleafter Umathradicalextensiblebefore Umathradicalkern \ +Umathradicalrule Umathradicalvariant Umathradicalvgap Umathruledepth Umathruleheight \ +Umathskeweddelimitertolerance Umathskewedfractionhgap Umathskewedfractionvgap Umathsource Umathspaceafterscript \ +Umathspacebeforescript Umathstackdenomdown Umathstacknumup Umathstackvariant Umathstackvgap \ +Umathsubscriptvariant Umathsubshiftdistance Umathsubshiftdown Umathsubshiftdrop Umathsubsupshiftdown \ +Umathsubsupvgap Umathsubtopmax Umathsupbottommin Umathsuperscriptvariant Umathsupshiftdistance \ +Umathsupshiftdrop Umathsupshiftup Umathsupsubbottommax Umathtopaccentvariant Umathunderbarkern \ +Umathunderbarrule Umathunderbarvgap Umathunderdelimiterbgap Umathunderdelimitervariant Umathunderdelimitervgap \ +Umathunderlinevariant Umathuseaxis Umathvextensiblevariant Umathvoid Umathxscale \ +Umathyscale Umiddle Unosubprescript Unosubscript Unosuperprescript \ +Unosuperscript Uoperator Uover Uoverdelimiter Uoverwithdelims \ +Uprimescript Uradical Uright Uroot Urooted \ +Ushiftedsubprescript Ushiftedsubscript Ushiftedsuperprescript Ushiftedsuperscript Uskewed \ +Uskewedwithdelims Ustack Ustartdisplaymath Ustartmath Ustartmathmode \ +Ustopdisplaymath Ustopmath Ustopmathmode Ustretched Ustretchedwithdelims \ +Ustyle Usubprescript Usubscript Usuperprescript Usuperscript \ +Uunderdelimiter Uvextensible adjustspacing adjustspacingshrink adjustspacingstep \ +adjustspacingstretch afterassigned aftergrouped aliased aligncontent \ +alignmark alignmentcellsource alignmentwrapsource aligntab allcrampedstyles \ +alldisplaystyles allmainstyles allmathstyles allscriptscriptstyles allscriptstyles \ +allsplitstyles alltextstyles alluncrampedstyles allunsplitstyles atendofgroup \ +atendofgrouped attribute attributedef automaticdiscretionary automatichyphenpenalty \ +automigrationmode autoparagraphmode begincsname beginlocalcontrol beginmathgroup \ +beginsimplegroup boundary boxadapt boxanchor boxanchors \ +boxattribute boxdirection boxfreeze boxgeometry boxorientation \ +boxrepack boxshift boxsource boxtarget boxtotal \ +boxxmove boxxoffset boxymove boxyoffset catcodetable \ +clearmarks copymathatomrule copymathparent copymathspacing crampeddisplaystyle \ +crampedscriptscriptstyle crampedscriptstyle crampedtextstyle csstring currentloopiterator \ +currentloopnesting currentmarks defcsname detokenized dimensiondef \ +dimexpression directlua edefcsname efcode endlocalcontrol \ +endmathgroup endsimplegroup enforced etoks etoksapp \ +etokspre everybeforepar everymathatom everytab exceptionpenalty \ +expand expandafterpars expandafterspaces expandcstoken expanded \ +expandedafter expandedloop expandtoken explicitdiscretionary explicithyphenpenalty \ +firstvalidlanguage flushmarks fontcharta fontid fontmathcontrol \ +fontspecdef fontspecid fontspecifiedname fontspecifiedsize fontspecscale \ +fontspecxscale fontspecyscale fonttextcontrol formatname frozen \ +futurecsname futuredef futureexpand futureexpandis futureexpandisap \ +gdefcsname gleaders glet gletcsname glettonothing \ +gluespecdef glyph glyphdatafield glyphoptions glyphscale \ +glyphscriptfield glyphscriptscale glyphscriptscriptscale glyphstatefield glyphtextscale \ +glyphxoffset glyphxscale glyphxscaled glyphyoffset glyphyscale \ +glyphyscaled gtoksapp gtokspre hccode hjcode \ +hmcode holdingmigrations hpack hyphenationmin hyphenationmode \ +ifabsdim ifabsnum ifarguments ifboolean ifchkdim \ +ifchknum ifcmpdim ifcmpnum ifcondition ifcstok \ +ifdimexpression ifdimval ifempty ifflags ifhaschar \ +ifhastok ifhastoks ifhasxtoks ifincsname ifinsert \ +ifmathparameter ifmathstyle ifnumexpression ifnumval ifparameter \ +ifparameters ifrelax iftok ifzerodim ifzeronum \ +ignorearguments ignorepars immediate immutable indexofcharacter \ +indexofregister inherited initcatcodetable insertbox insertcopy \ +insertdepth insertdistance insertheight insertheights insertlimit \ +insertmaxdepth insertmode insertmultiplier insertpenalty insertprogress \ +insertstorage insertstoring insertunbox insertuncopy insertwidth \ +instance integerdef lastarguments lastatomclass lastboundary \ +lastchkdim lastchknum lastleftclass lastloopiterator lastnamedcs \ +lastnodesubtype lastpageextra lastparcontext lastrightclass leftmarginkern \ +letcharcode letcsname letfrozen letmathatomrule letmathparent \ +letmathspacing letprotected lettonothing linebreakcriterium linedirection \ +localbrokenpenalty localcontrol localcontrolled localcontrolledloop localinterlinepenalty \ +localleftbox localleftboxbox localmiddlebox localmiddleboxbox localrightbox \ +localrightboxbox lpcode luabytecode luabytecodecall luacopyinputnodes \ +luadef luaescapestring luafunction luafunctioncall luatexbanner \ +luatexrevision luatexversion mathaccent mathatom mathatomglue \ +mathatomskip mathbackwardpenalties mathbeginclass mathcheckfencesmode mathdictgroup \ +mathdictproperties mathdirection mathdisplaymode mathdisplayskipmode mathdoublescriptmode \ +mathendclass matheqnogapstep mathfenced mathfontcontrol mathforwardpenalties \ +mathfrac mathghost mathgluemode mathgroupingmode mathleftclass \ +mathlimitsmode mathmainstyle mathmiddle mathnolimitsmode mathpenaltiesmode \ +mathrad mathrightclass mathrulesfam mathrulesmode mathscale \ +mathscriptsmode mathslackmode mathspacingmode mathstackstyle mathstyle \ +mathstylefontid mathsurroundmode mathsurroundskip maththreshold meaningasis \ +meaningfull meaningless mugluespecdef mutable noaligned \ +noatomruling noboundary nohrule norelax normalizelinemode \ +normalizeparmode nospaces novrule numericscale numexpression \ +orelse orphanpenalties orphanpenalty orunless outputbox \ +overloaded overloadmode overshoot pageboundary pageextragoal \ +pagevsize parametercount parametermark parattribute pardirection \ +permanent pettymuskip postexhyphenchar posthyphenchar postinlinepenalty \ +prebinoppenalty predisplaygapfactor preexhyphenchar prehyphenchar preinlinepenalty \ +prerelpenalty protrudechars protrusionboundary pxdimen quitloop \ +quitvmode resetmathspacing retokenized rightmarginkern rpcode \ +savecatcodetable scaledemwidth scaledexheight scaledextraspace scaledfontdimen \ +scaledinterwordshrink scaledinterwordspace scaledinterwordstretch scaledmathstyle scaledslantperpoint \ +scantextokens semiexpand semiexpanded semiprotected setdefaultmathcodes \ +setfontid setmathatomrule setmathdisplaypostpenalty setmathdisplayprepenalty setmathignore \ +setmathoptions setmathpostpenalty setmathprepenalty setmathspacing shapingpenaltiesmode \ +shapingpenalty snapshotpar srule supmarkmode swapcsvalues \ +tabsize textdirection thewithoutunit tinymuskip todimension \ +tohexadecimal tointeger tokenized toksapp tokspre \ +tolerant tomathstyle toscaled tosparsedimension tosparsescaled \ +tpack tracingadjusts tracingalignments tracingexpressions tracingfonts \ +tracingfullboxes tracinghyphenation tracinginserts tracinglevels tracingmarks \ +tracingmath tracingnodes tracingpenalties uleaders undent \ +unexpandedloop unhpack unletfrozen unletprotected untraced \ +unvpack vpack wordboundary wrapuppar xdefcsname \ +xtoks xtoksapp xtokspre keywordclass.tex.omega=\ Omegaminorversion Omegarevision Omegaversion diff --git a/doc/context/sources/general/manuals/ontarget/ontarget-gettingridof.tex b/doc/context/sources/general/manuals/ontarget/ontarget-gettingridof.tex new file mode 100644 index 000000000..75b7f5bc0 --- /dev/null +++ b/doc/context/sources/general/manuals/ontarget/ontarget-gettingridof.tex @@ -0,0 +1,1666 @@ +% language=us runpath=texruns:manuals/ontarget + +\startcomponent ontarget-gettingridof + +\environment ontarget-style + +\startchapter[title={Issues in math fonts}] + +\startsection[title=Introduction] + +After trying to improve math rendering of \OPENTYPE\ math fonts, we \footnote +{Mikael Sundqvist and Hans Hagen} ended up with a mix of improving the engine and +fixing fonts runtime, and we are rather satisfied with the results so far. + +However, as we progress and also improve the more structural and input related +features of \CONTEXT, we wonder why we don't simply are more drastic when it +comes to fonts. The \OPENTYPE\ specifications are vague, and most existing +\OPENTYPE\ math fonts use a mixture of the \OPENTYPE\ features and the old \TEX\ +habits, so we are sort of on our own. The advantage of this situation is that we +feel free to experiment and do as we like. + +In another article we discuss our issues with \UNICODE\ math, and we have +realized that good working solutions will be bound to a macro package anyway. +Also, math typesetting has not evolved much after Don Knuth set the standard, +even if the limitations of those times in terms of memory, processing speed and +font technologies have been lifted already for a while. And right from the start +Don invited users to extend and adapt \TEX\ to one's needs. + +Here we will zoom in on a few aspects: font parameters, glyph dimensions and +properties and kerning of scripts and atoms. We discuss \OPENTYPE\ math fonts +only, and start with a summary of how we tweak them. We leave a detailed engine +discussion to a future article, since that would demand way more pages, and could +confuse the reader. +\stopsection + +\startsection[title={Tweaks, also known as goodies}] + +The easiest tweaks to describe are those that wipe features. Because the +\TEXGYRE\ fonts have many bad top accent anchors (they sit above the highest +point of the shape) the \typ {wipeanchors} tweak can remove them, and we do that +per specified alphabet. + +\bgroup +\definefontfeature[mathextra][goodies=] +\switchtobodyfont[modern] +\startformula +\scale[s=2]{$\widehat{7}$} +% \widehat{7} +\stopformula +\egroup +\stopformulas + +In a similar fashion we \typ {wipeitalics} from upright shapes. Okay, maybe they +can play a role for subscript placement, but then they can also interfere, and +they do not fit with the \OPENTYPE\ specification. The \typ {wipecues} tweak +zeros the dimensions of the invisible times and friends so that they don't +interfere and \typ {wipevariants} gets rid of bad variants of specified +characters. + +The fixers is another category, and the names indicate what gets fixed. Tweaks +like these take lists of code points and specific properties to fix. We could +leave it to your imagination what \typ {fixaccents}, \typ {fixanchors}, \typ +{fixellipses}, \typ {fixoldschool}, \typ {fixprimes}, \typ {fixradicals} and \typ +{fixslashes} do, but here are some details. Inconsistencies in the dimensions of +accents make them jump all over the place so we normalize them. We support +horizontal stretching at the engine level. + +\startformula +\scale[s=2]{\dm{\widehat{a+b+c+d} = \widetilde{u+v+w+x+y}}} +\stopformula + +It required only a few lines of code thanks to already present scaling features. + +% MPS: I thought of an example showing the accents, but I could +% not get it to work fine with the goodies loaded the second +% time the font was loaded +% +% \startformulas +% \bgroup \definefontfeature[mathextra][goodies=]\setupbodyfont[modern] +% \startformula[width=2em] +% \widehat{7} +% \stopformula +% \egroup +% \bgroup\setupbodyfont[modern] +% \startformula[width=2em] +% \widehat{7} +% \stopformula +% \egroup +% \stopformulas + +Anchors can be off so we fix these in a way so that they look better on +especially italic shapes. We make sure that the automated sizing works +consistently, as this is driven by width and overshoot. Several kind of ellipses +can be inconsistent with each other as well as with periods (shape and size wise) +so we have to deal with that. Radicals and other extensibles have old school +dimensions (\TEX\ fonts have a limited set of widths and heights). We need to fix +for instance fences of various size because we want to apply kerns to scripts on +the four possible corners for which we need to know the real height and depth, + +Discussing primes would take many paragraphs so we stick to mentioning that they +are a mess. We now have native prime support in the engine as well as assume +properly dimensioned symbols to be used. Slashes are used for skewed fractions so +we'd better make sure they are set up right. + +A nice tweak is \typ {replacealphabets}. We use this to provide alternative +script (roundhand) and calligraphic (chancery) alphabets (yes we have both +natively in \CONTEXT\ while \UNICODE\ combines them in one alphabet). Many +available \OPENTYPE\ math fonts come with one of the two alphabets only, some +with roundhand and some with chancery. For the record: this tweak replaces the +older \typ {variants} tweak that filtered scripts from a stylistic font feature. + +We also use the \typ {replacealphabets} tweak to drop in Arabic shapes so that we +can do bidirectional math. In practice that doesn't really boil down to a +replacement but more to an addition. The \typ {addmirrors} features accompanies +this, and it is again a rather small extension to the engine to make sure we can +do this efficiently: when a character is looked up we check a mirror variant when +we are in r2l mode, just like we look up a smaller variant when we're in compact +font mode (a \CONTEXT\ feature). + +\bgroup +\definefontfeature[mathextra][mathxitsarabic=yes] +\switchtobodyfont[bonum] +\setupmathematics[bidi=yes,align=righttoleft]\par +\setupalign[righttoleft] % +\startformula +\scale[s=2]{\dm{ +\sum_{\char"1EE4E=\char"1EE01}^{\char"1EE02} \char"1EE03^{\char"1EE4E} = +\char"1EE03^{\char"1EE01}\frac{\char"0661 - \char"1EE03^{\char"1EE02 - +\char"1EE01 + \char"0661}}{\char"0661 - \char"1EE03} \quad (\char"1EE03\neq +\char"0661) +}} + +% \int_{\char"0627}^{\char"0628} \char"1EE03 '(\char"1EE4E) +% %\mathatom class \mathdifferentialcode {\char"062F} +% \dd +% \char"1EE4E +% = \char"1EE03(\char"0628) - \char"1EE03(\char"0627) +% \stopformula +% \startformula +% \sqrt[\char"0663](\char"1EE30) = (\char"1EE30)^{1/\char"0663} +\stopformula +\egroup + +Another application of \typ {replacealphabets} is to drop in single characters +from another font. We use this for instance to replace the \quote {not really an +alpha} in Bonum by one of our own liking. Below we show a math italic a and the +original alpha, together with the modified alpha. + +\startformula +\scale[s=2]{\dm{ +a + \text{\getnamedglyphdirect{file:TeXGyreBonumMath-Companion.otf}{alpha.old}} + \alpha +}} +\stopformula + +For that we ship a companion font. On our disks (and in the distribution) you can +find: + +\starttyping +/tex/texmf-fonts/fonts/data/cms/companion/RalphSmithsFormalScript-Companion.otf +/tex/texmf-fonts/fonts/data/cms/companion/TeXGyreBonumMath-Companion.otf +/tex/texmf-fonts/fonts/data/cms/companion/XITSMath-Companion.otf +\stoptyping + +All these are efficient drop|-|ins that are injected by the \typ +{replacealphabets}, some under user control, some always. We tried to limit the +overhead and actually bidirectional math could be simplified which also had the +benefit that when one does tens of thousands of bodyfont switches a bit of +runtime is gained. + +There are more addition tweaks: \typ {addactuarian} creates the relevant symbols +which is actually a right sided radical (the engine has support for two|-|sided +radicals). It takes a bit of juggling with virtual glyphs and extensible recipes, +but the results are rewarding. + +\setupmathradical[annuity][strut=no] +\definemathdelimited + [myannuity] + [topoffset=.2\exheight, + strut=no, + rightmargin=.05\emwidth, + right=\delimitedrightanutityuc] + +\startformula +\scale[s=2]{\dm{ +\widebar{A}__{\myannuity{m}}^^{2}_{x:\annuity{n}}^{1} +}} +\stopformula + +In a similar fashion we try to add missing extensible arrows with \typ +{addarrows}, bars with \typ {addbars}, equals with \typ {addequals} and again +using the radical mechanism fourier notation symbols (like hats) with \typ +{addfourier}. That one involves subtle kerning because these symbols end up at +the right top of a fence like symbol. + +\startformula +\scale[s=2]{\dm{ +\widehat{f \ast g \ast h}(\xi) = \fourier{\F1\left(f\ast g \ast h\right)}(\xi) +}} +\stopformula + +It was actually one of the reasons to introduce a more advanced kerning mechanism +in the engine, which is not entirely trivial because one has to carry around more +information, since all this is font and character bound, and when wrapped in +boxes that gets hard to analyze. The \typ {addrules} makes sure that we can do +bars over and under constructs properly. The \typ {addparts} is there to add +extensible recipes to characters. + +Some of these tweaks actually are not new and are also available in \MKIV\ but +more as features (optionally driven by the goodie file). An example is \typ +{addscripts} that is there for specially positioned and scaled signs (high minus +and such) but that tweak will probably be redone as part of the \quotation {deal +with all these plus and minus issues}. The dedicated to Alan Braslau \typ +{addprivates} tweak is an example of this: we add specific variants for unary +minus and plus that users can enable on demand, which in turn of course gives +class specific spacing, but we promised not to discuss those engine features +here. + +\startformula +\scale[s=2]{\dm{ +\int_1^2 \left[(x+2)^{\frac[strut=no]{1}{2}} - (x+2)^{\um\frac[strut=no]{1}{2}}\right] \dd x +}} +\stopformula + +There is a handful of tweaks that deals with fixing glyph properties (in detail). +We mention: \typ {dimensions} and \typ {accentdimensions} that can reposition in +the boundingbox, fix the width and italic correction, squeeze and expand etc. The +\typ {kernpairs} tweak adds kern pairs to combinations of characters. The \typ +{kerns} provides a way to add top left, bottom left, top right and bottom right +kerns and those really make the results look better so we love it! + +\startformula +\scale[s=2]{\showglyphs\dm{\F3\left(\frac{1}{1+x^2}\right)^n \quad x^2/(1+x)}} +\stopformula + +The \typ {margins} tweak sets margin fields that the engine can use to calculate +accents over the base character better. The same is true for \typ {setovershoots} +that can make accents lean over a bit. The \typ {staircase} feature can be used +to add the somewhat complicated \OPENTYPE\ kerns. From all this you can deduce +that the engine has all types of kerning that \OPENTYPE\ requires, and more. + +Accents as specified in fonts can be a pain to deal with so we have more tweaks +for them: \typ {copyaccents} moves them to the right slots and \typ +{extendaccents} makes sure that we can extend them. Not all font makers have the +same ideas about where these symbols should sit and what their dimensions should +be. + +The \typ {checkspacing} tweak fixes bad or missing spacing related to \UNICODE\ +character entries in the font, because after all, we might need them. We need to +keep for instance \MATHML\ in mind, which means: processing content that we don't +see and that can contain whatever an editor puts in. The \typ {replacements} +feature replaces one character by another from the same font. The \typ +{substitutes} replaces a character by one from a stylistic feature. + +Relatively late we added the \typ {setoptions} which was needed to control the +engine for specific fonts. The rendering is controlled by a bunch of options +(think of kerning, italic correction, and such). Some are per font, many per +class. Because we can (and do) use mixed math fonts in a document, we might need +to adapt the engine level options per font, and that is what this tweak does: it +passes options to the font so that the engine can consult them and prefer them +over the \quote {global} ones. We needed this for some fonts that have old school +dimensions for extensibles (like Lucida), simply because they imitated Computer +Modern. Normally that goes unnoticed, but, as mentioned before, it interferes +with our optional kerning. The \typ {fixoldschool} tweak sort of can fix that too +so \typ {setoptions} is seldom needed. Luckily, some font providers are willing +to fix their fonts! + +We set and configure all these tweaks in a so-called goodie file, basically a +runtime module that returns a \LUA\ table with specifications. In addition to the +tweaks subtable in the math namespace, there is a subtable that overloads the +font parameters: the ones that \OPENTYPE\ specifies, but also new ones that we +added. In the next section we elaborate more on these font bound parameters. + +\stopsection + +\startsection[title=Font parameters] + +At some point in the upgrading of the math machinery we discussed some of the +inconsistencies between the math constants of the XITS and STIX fonts. Now, one +has to keep in mind that XITS was based on a first release of STIX that only had +\TYPEONE\ fonts so what follows should not to be seen as criticism, but more as +observations and reason for discussion, as well as a basis for decisions to be +made. + +One thing we have to mention in advance, is that we often wonder why some weird +and|/|or confusing stuff in math fonts go unnoticed. We have some suggestions: + +\startitemize +\startitem + The user doesn't care that much how math comes out. This can easily be + observed when you run into documents on the internet or posts on forums. And + publishers don't always seem to care either. Consistency with old documents + sometimes seems to be more important than quality. +\stopitem +\startitem + The user switches to another math font when the current one doesn't handle + its intended math domain well. We have seen that happening and it's the + easiest way out when you have not much control anyway (for instance when + using online tools). +\stopitem +\startitem + The user eventually adds some skips and kerns to get things right, because + after all \TEX\ is also about tweaking. +\stopitem +\startitem + The user doesn't typeset that complex math. It's mostly inline math with an + occasional alignment (also in text style) and very few multi|-|level display + math (with left and right fences that span at most a fraction). +\stopitem +\stopitemize + +We do not claim to be perfect, but we care for details, so let's go on. The next +table shows the math constants as they can be found in the \STIX\ (two) and +\XITS\ (one) fonts. When you typeset with these fonts you will notice that \XITS\ +is somewhat smaller, so two additional columns show the values compensated for +the axis height and accent base height. + +\startluacode +local one = { + ["AccentBaseHeight"]=450, + ["AxisHeight"]=250, + ["DelimitedSubFormulaMinHeight"]=1500, + ["DisplayOperatorMinHeight"]=1450, + ["FlattenedAccentBaseHeight"]=662, + ["FractionDenominatorDisplayStyleGapMin"]=198, + ["FractionDenominatorDisplayStyleShiftDown"]=700, + ["FractionDenominatorGapMin"]=66, + ["FractionDenominatorShiftDown"]=480, + ["FractionNumeratorDisplayStyleGapMin"]=198, + ["FractionNumeratorDisplayStyleShiftUp"]=580, + ["FractionNumeratorGapMin"]=66, + ["FractionNumeratorShiftUp"]=480, + ["FractionRuleThickness"]=66, + ["LowerLimitBaselineDropMin"]=600, + ["LowerLimitGapMin"]=150, + ["MathLeading"]=150, + ["MinConnectorOverlap"]=50, + ["OverbarExtraAscender"]=66, + ["OverbarRuleThickness"]=66, + ["OverbarVerticalGap"]=198, + ["RadicalDegreeBottomRaisePercent"]=70, + ["RadicalDisplayStyleVerticalGap"]=186, + ["RadicalExtraAscender"]=66, + ["RadicalKernAfterDegree"]=-555, + ["RadicalKernBeforeDegree"]=277, + ["RadicalRuleThickness"]=66, + ["RadicalVerticalGap"]=82, + ["ScriptPercentScaleDown"]=75, + ["ScriptScriptPercentScaleDown"]=60, + ["SkewedFractionHorizontalGap"]=300, + ["SkewedFractionVerticalGap"]=66, + ["SpaceAfterScript"]=41, + ["StackBottomDisplayStyleShiftDown"]=900, + ["StackBottomShiftDown"]=800, + ["StackDisplayStyleGapMin"]=462, + ["StackGapMin"]=198, + ["StackTopDisplayStyleShiftUp"]=580, + ["StackTopShiftUp"]=480, + ["StretchStackBottomShiftDown"]=600, + ["StretchStackGapAboveMin"]=150, + ["StretchStackGapBelowMin"]=150, + ["StretchStackTopShiftUp"]=300, + ["SubSuperscriptGapMin"]=264, + ["SubscriptBaselineDropMin"]=50, + ["SubscriptShiftDown"]=250, + ["SubscriptTopMax"]=400, + ["SuperscriptBaselineDropMax"]=375, + ["SuperscriptBottomMaxWithSubscript"]=400, + ["SuperscriptBottomMin"]=125, + ["SuperscriptShiftUp"]=400, + ["SuperscriptShiftUpCramped"]=275, + ["UnderbarExtraDescender"]=66, + ["UnderbarRuleThickness"]=66, + ["UnderbarVerticalGap"]=198, + ["UpperLimitBaselineRiseMin"]=300, + ["UpperLimitGapMin"]=150, +} + +local two = { + ["AccentBaseHeight"]=480, + ["AxisHeight"]=258, + ["DelimitedSubFormulaMinHeight"]=1325, + ["DisplayOperatorMinHeight"]=1800, + ["FlattenedAccentBaseHeight"]=656, + ["FractionDenominatorDisplayStyleGapMin"]=150, + ["FractionDenominatorDisplayStyleShiftDown"]=640, + ["FractionDenominatorGapMin"]=68, + ["FractionDenominatorShiftDown"]=585, + ["FractionNumeratorDisplayStyleGapMin"]=150, + ["FractionNumeratorDisplayStyleShiftUp"]=640, + ["FractionNumeratorGapMin"]=68, + ["FractionNumeratorShiftUp"]=585, + ["FractionRuleThickness"]=68, + ["LowerLimitBaselineDropMin"]=670, + ["LowerLimitGapMin"]=135, + ["MathLeading"]=150, + ["MinConnectorOverlap"]=100, + ["OverbarExtraAscender"]=68, + ["OverbarRuleThickness"]=68, + ["OverbarVerticalGap"]=175, + ["RadicalDegreeBottomRaisePercent"]=55, + ["RadicalDisplayStyleVerticalGap"]=170, + ["RadicalExtraAscender"]=78, + ["RadicalKernAfterDegree"]=-335, + ["RadicalKernBeforeDegree"]=65, + ["RadicalRuleThickness"]=68, + ["RadicalVerticalGap"]=85, + ["ScriptPercentScaleDown"]=70, + ["ScriptScriptPercentScaleDown"]=55, + ["SkewedFractionHorizontalGap"]=350, + ["SkewedFractionVerticalGap"]=68, + ["SpaceAfterScript"]=40, + ["StackBottomDisplayStyleShiftDown"]=690, + ["StackBottomShiftDown"]=385, + ["StackDisplayStyleGapMin"]=300, + ["StackGapMin"]=150, + ["StackTopDisplayStyleShiftUp"]=780, + ["StackTopShiftUp"]=470, + ["StretchStackBottomShiftDown"]=590, + ["StretchStackGapAboveMin"]=68, + ["StretchStackGapBelowMin"]=68, + ["StretchStackTopShiftUp"]=800, + ["SubSuperscriptGapMin"]=150, + ["SubscriptBaselineDropMin"]=160, + ["SubscriptShiftDown"]=210, + ["SubscriptTopMax"]=368, + ["SuperscriptBaselineDropMax"]=230, + ["SuperscriptBottomMaxWithSubscript"]=380, + ["SuperscriptBottomMin"]=120, + ["SuperscriptShiftUp"]=360, + ["SuperscriptShiftUpCramped"]=252, + ["UnderbarExtraDescender"]=68, + ["UnderbarRuleThickness"]=68, + ["UnderbarVerticalGap"]=175, + ["UpperLimitBaselineRiseMin"]=300, + ["UpperLimitGapMin"]=135, +} + +local designrelated = { + ["AccentBaseHeight"] = "optional**", + ["AxisHeight"] = "mandate", + ["FlattenedAccentBaseHeight"] = "optional**", + ["FractionRuleThickness"] = "optional", + ["MinConnectorOverlap"] = "mandate", + ["OverbarRuleThickness"] = "optional*", + ["RadicalDegreeBottomRaisePercent"] = "mandate", + ["UnderbarRuleThickness"] = "optional*", +} + +local a1 = two.AccentBaseHeight / one.AccentBaseHeight +local a2 = two.AxisHeight / one.AxisHeight + +context.starttabulate { "|l|r|r|r|r|l|" } + context.FL() + context.BC() context("constant") + context.BC() context("stix") + context.BC() context("xits") + context.BC() context("base") + context.BC() context("axis") + context.BC() context("relevance") + context.BC() context.NR() + context.ML() + for key, oldvalue in table.sortedhash(one) do + local newvalue = two[key] + local accvalue = math.round(oldvalue * a1) + local axivalue = math.round(oldvalue * a2) + context.NC() context(key) + context.NC() context(newvalue) + context.NC() context(oldvalue) + context.NC() if newvalue == accvalue then context.bold(accvalue) else context(accvalue) end + context.NC() if newvalue == axivalue then context.bold(axivalue) else context(axivalue) end + context.NC() context(designrelated[key]) + context.NC() context.NR() + end + context.LL() +context.stoptabulate() +\stopluacode + +Very few values are the same. So, what exactly do these constants tell us? You +can even wonder why they are there at all. Just think of this: we want to typeset +math, and we have an engine that we can control. We know how we want it to look. +So, what do these constants actually contribute? Plenty relates to the height and +depth of the nucleus and|/|or the axis. The fact that we have to fix some in the +goodie files, and the fact that we actually need more variables that control +positioning, makes for a good argument to just ignore most of the ones provided +by the font, especially when they seem somewhat arbitrarily. Can it be that font +designers are just gambling a bit, looking at another font, and starting from +there? + +The relationship between \TEX's math font parameters and the \OPENTYPE\ math +constants is not one|-|to|-|one. Mapping them onto each other is possible but +actually is font dependent. However, we can assume that the values of Computer +Modern are leading. + +The \typ {AxisHeight}, \typ {AccentBaseHeight} and \typ +{FlattenedAccentBaseHeight} are set to the x|-|height, a value that is defined in +all fonts. The \typ {SkewedFractionVerticalGap} also gets that value. Other +variables relate to the em|-|width (or \type {\quad}), for instance the \typ +{SkewedFractionHorizontalGap} that gets half that value. Of course these last two +then assume that the engine handles skewed fractions. + +Variables that directly map onto each other are \typ {StretchStackGapBelowMin} as +\typ {bigopspacing1}, \typ {StretchStackTopShiftUp} as \typ {bigopspacing3}, \typ +{StretchStackGapAboveMin} as \typ {bigopspacing2} and \typ +{StretchStackBottomShiftDown} as \typ {bigopspacing4}. However, these clash with +\typ {UpperLimitBaselineRiseMin} as \typ {bigopspacing3}, \typ {UpperLimitGapMin} +as \typ {bigopspacing1}, \typ {LowerLimitBaselineDropMin} as \typ {bigopspacing4} +and \typ {LowerLimitGapMin} as \typ {bigopspacing2}. Where in traditional fonts +these are the same, in \OPENTYPE\ they can be different. Should they be? + +Internally we use different names for variables, simply because the engine has +some parameters that \OPENTYPE\ maths hasn't. So we have \typ {limit_above_kern} +and \typ {limit_below_kern} for \typ {bigopspacing5}. + +A couple of parameters have different values for (cramped) displaystyle. The \typ +{FractionDelimiterSize} and \typ {FractionDelimiterDisplayStyleSize} use \typ +{delim2} and \typ {delim1}. The \typ {FractionDenominatorShiftDown} and \typ +{FractionDenominatorDisplayStyleShiftDown} map onto \typ {denom2} and \typ +{denom1} and their numerator counterparts from \typ {num2} and \typ {num1}. The +\typ {Stack*} parameters also use these. The \typ {sub1}, \typ{sub2}, \typ{sup1}, +\typ{sup2}, \typ{sup3}, and \typ {supdrop} can populate the \type {Sub*} and +\type {Super*} parameters, also in different styles. + +The rest of the parameters can be defined in terms of the default rulethickness, +quad or xheight, often multiplied by a factor. For some we see the \type {1/18} +show up a number that we also see with muskips. Some constants can be set from +registers, like \typ {SpaceAfterScript} which is just \type {\scriptspace}. + +If you look at the \LUATEX\ source you wil find a section where this mapping is +done in the case of a traditional font, that is: one without a math constants +table. In \LUAMETATEX\ we don't need to do this because font loading happens in +\LUA. So we simply issue an error when the math engine can't resolve a mandate +parameter. The fact that we have a partial mapping from math constants onto +traditional parameters and that \LUATEX\ has to deal with the traditional ones +too make for a somewhat confusing landscape. When in \LUAMETATEX\ we assume wide +fonts to be used that have a math constants table, we can probably clean up some +of this. + +We need to keep in mind that Cambria was the starting point, and it did borrow +some concepts from \TEX. But \TEX\ had parameters because there was not enough +information in the glyphs! Also, Cambria was meant for \MSWORD, and a word +processor is unlikely to provide the level of control that \TEX\ offers, so it +needs some directions with respect to e.g.\ spacing. Without user control, it has +to come up with acceptable compromises. So actually the \LUAMETATEX\ math engine +can be made a bit cleaner when we just get rid of these parameters. + +So, which constants are actually essential? The \typ {AxisHeight} is important +and also design related. Quite likely this is where the minus sits above the +baseline. It is used for displacements of the baseline so that for instance +fractions nicely align. When testing script anchored to fences we noticed that +the parenthesis in XITS had too little depth while STIX had the expected amount. +This relates to anchoring relative to the math axis. + +Is there a reason why \typ {UnderbarRuleThickness} and \typ +{OverbarRuleThickness} should differ? If not, then we only need a variable that +somehow tells us what thickness fits best with the other top and bottom accents. +It is quite likely the same as the \typ {RadicalRuleThickness}, which is needed +to extend the radical symbol. So, here three constants can be replaced by one +design related one. The \typ {FractionRuleThickness} can also be derived from +that, but more likely is that it is a quantity that the macro package sets up +anyway, maybe related to rules used elsewhere. + +The \typ {MinConnectorOverlap} and \typ {RadicalDegreeBottomRaisePercent} also +are related to the design although one could abuse the top accent anchor for the +second one. So they are important. However, given the small number of +extensibles, they could have been part of the extensible recipes. + +The \typ {AccentBaseHeight} and \typ {FlattenedAccentBaseHeight} might relate to +the margin that the designer put below the accent as part of the glyph, so it is +kind of a design related constant. Nevertheless, we fix quite some accents in the +goodie files because they can be inconsistent. That makes these constants +somewhat dubious too. If we have to check a font, we can just as well set up +constants that we need in the goodie file. Also, isn't it weird that there are no +bottom variants? + +We can forget about \typ {MathLeading} as it serves no purpose in \TEX. The \typ +{DisplayOperatorMinHeight} is often set wrong so although we fix that in the +goodie file it might be that we just can use an internal variable. It is not the +font designer who decides that anyway. The same is true for \typ +{DelimitedSubFormulaMinHeight}. + +If we handle skewed fractions, \typ {SkewedFractionHorizontalGap} and \typ +{SkewedFractionVerticalGap} might give an indication of the tilt but why do we +need two? It is design related though, so they have some importance, when set +right. + +The rest can be grouped, and basically we can replace them by a consistent set of +engine parameters. We can still set them up per font, but at least we can then +use a clean set. Currently, we already have more. For instance, why only \typ +{SpaceAfterScript} and not one for before, and how about prescripts and primes? +If we have to complement them with additional ones and also fix them, we can as +well set up all these script related variables. + +For fractions the font provides \typ {FractionDenominatorDisplayStyleGapMin}, +\typ {FractionDenominatorDisplayStyleShiftDown}, \typ +{FractionDenominatorGapMin}, \typ {FractionDenominatorShiftDown}, \typ +{FractionNumeratorDisplayStyleGapMin}, \typ +{FractionNumeratorDisplayStyleShiftUp}, \typ {FractionNumeratorGapMin} and \typ +{FractionNumeratorShiftUp}. We might try to come up with a simpler model. + +Limits have: \typ {LowerLimitBaselineDropMin}, \typ {LowerLimitGapMin}, \typ +{UpperLimitBaselineRiseMin} and \typ {UpperLimitGapMin}. Limits are tricky anyway +as they also depend on abusing the italic correction for anchoring. + +Horizontal bars are driven by \typ {OverbarExtraAscender}, \typ +{OverbarVerticalGap}, \typ {UnderbarExtraDescender} and \typ +{UnderbarVerticalGap}, but for e.g.\ arrows we are on our own, so again a not so +useful set. + +Then radicals: we need some more than these \typ +{RadicalDisplayStyleVerticalGap}, \typ {RadicalExtraAscender}, \typ +{RadicalKernAfterDegree}, \typ {RadicalKernBeforeDegree} and \typ +{RadicalVerticalGap}, and because we really need to check these there is no gain +having them in the font. + +Isn't it more a decision by the macro package how script and scriptscript should +be scaled? Currently we listen to \typ {ScriptPercentScaleDown} and \typ +{ScriptScriptPercentScaleDown}, but maybe it relates more to usage. + +We need more control than just \typ {SpaceAfterScript} and an engine could +provide it more consistently. It's a loner. + +How about \typ {StackBottomDisplayStyleShiftDown}, \typ {StackBottomShiftDown}, +\typ {StackDisplayStyleGapMin}, \typ {StackGapMin}, \typ +{StackTopDisplayStyleShiftUp} and \typ {StackTopShiftUp}? And isn't this more for +the renderer to decide: \typ {StretchStackBottomShiftDown}, \typ +{StretchStackGapAboveMin}, \typ {StretchStackGapBelowMin} and \typ +{StretchStackTopShiftUp}? + +This messy bit can also be handled more convenient so what exactly is the +relationship with the font design of \typ {SubSuperscriptGapMin}, \typ +{SubscriptBaselineDropMin}, \typ {SubscriptShiftDown}, \typ {SubscriptTopMax}, +\typ {SuperscriptBaselineDropMax}, \typ {SuperscriptBottomMaxWithSubscript}, \typ +{SuperscriptBottomMin}, \typ {SuperscriptShiftUp} and \typ +{SuperscriptShiftUpCramped}? + +Just for the record, here are the (font related) ones we added so far. A set of +prime related constants similar to the script ones: \typ {PrimeRaisePercent}, +\typ {PrimeRaiseComposedPercent}, \typ {PrimeShiftUp}, \typ +{PrimeBaselineDropMax}, \typ {PrimeShiftUpCramped}, \typ {PrimeSpaceAfter} and +\typ {PrimeWidthPercent}. Of course, we also added \typ {SpaceBeforeScript} just +because we want to be symmetrical in the engine where we also have to deal with +prescripts. + +These we provide for some further limit positioning: \typ {NoLimitSupFactor} and +\typ {NoLimitSubFactor}; these for delimiters: \typ {DelimiterPercent} and \typ +{DelimiterShortfall}; and these for radicals in order to compensate for sloping +shapes: \typ {RadicalKernAfterExtensible} and \typ {RadicalKernBeforeExtensible} +because we have doublesided radicals. + +Finally, there are quite some (horrible) accent tuning parameters: \typ +{AccentTopShiftUp}, \typ {AccentBottomShiftDown}, \typ +{FlattenedAccentTopShiftUp}, \typ {FlattenedAccentBottomShiftDown}, \typ +{AccentBaseDepth}, \typ {AccentFlattenedBaseDepth}, \typ {AccentTopOvershoot}, +\typ {AccentBottomOvershoot}, \typ {AccentSuperscriptDrop}, \typ +{AccentSuperscriptPercent} and \typ {AccentExtendMargin}, but we tend to move +some of that to the tweaks on a per accent basis. + +Setting these parameters right is not trivial, and also a bit subjective. We might, +however, assume that for instance the math axis is set right, but alas, when we +were fixing the less and greater symbols in Lucida Bright Math, we found that all +symbols actually were designed for a math axis of 325, instead of the given +value 313, and that difference can be seen! + +\startbuffer +\scale[s=2]{\dm{ + 2 > -\left\{\frac{1}{1+x^2}\right\} +}} +\stopbuffer + +\startlinecorrection +\startcombination[nx=2] + \startcontent + % \definefontfeature[mathextra][goodies=] + \switchtobodyfont[lucidaold] + \showglyphs + \getbuffer + \stopcontent + \startcaption + Old Lucida + \stopcaption + \startcontent + \switchtobodyfont[lucida] + \showglyphs + \getbuffer + \stopcontent + \startcaption + New Lucida + \stopcaption +\stopcombination +\stoplinecorrection + +The assumption is that the axis goes trough the middle of +the minus. Luckily it was relatively easy to fix these two symbols (they also had +to be scaled, maybe they originate in the text font?) and adapt the +axis. We still need to check all the other fonts, but it looks like they are okay, +which is good because the math axis plays an important role in rendering math. +It is one of the few parameters that has to be present and right. A nice side +effect of this is that we end up with discussing new (\CONTEXT) features. One +can for instance shift all non-character symbols down just a little and lower +the math axis, to get a bit more tolerance in lines with many inline fractions, +radicals or superscripts, that otherwise would result in interline skips. + +A first step in getting out of this mess is to define {\em all} these parameters +in the goodie file where we fix them anyway. That way we are at least not +dependent on changes in the font. We are not a word processor so we have way more +freedom to control matters. And preset font parameters sometimes do more harm +than good. A side effect of a cleanup can be that we get rid of the evolved mix +of uppercase and lowercase math control variables and can be more consistent. +Ever since \LUATEX\ got support for \OPENTYPE, math constants names have been +mapped and matched to traditional \TEX\ font parameters. + +\stopsection + +\startsection[title=Metrics] + +With metrics we refer to the dimensions and other properties of math glyphs. The +origin of digital math fonts is definitely Computer Modern and thereby the +storage of properties is bound to the \TFM\ file format. That format is binary +and can be loaded fast. It can also be stored in the format, unless you're using +\LUATEX\ or \LUAMETATEX\ where \LUA\ is the storage format. A \TFM\ file stores +per character the width, height, depth and italic correction. The file also +contains font parameters. In math fonts there are extensible recipes and there is +information about next in size glyphs. The file has kerning and ligature tables +too. + +Given the times \TEX\ evolved in, the format is rather compact. For instance, the +height, depth and italic correction are shared and indices to three shared values +are used. There can be 16 heights and depths and 64 italic corrections. That way +much fits into a memory word. + +The documentation tells us that \quotation {The italic correction of a character +has two different uses. (a)~In ordinary text, the italic correction is added to +the width only if the \TEX\ user specifies \quote{\type {\/}} after the +character. (b)~In math formulas, the italic correction is always added to the +width, except with respect to the positioning of subscripts.} It is this last +phenomena that gives us some trouble with fonts in \OPENTYPE\ math. The fact that +traditional fonts cheat with the width and that we add and selectively remove or +ignore the correction makes for fuzzy code in \LUATEX\ although splitting the +code paths and providing options to control all this helps a bit. In \LUAMETATEX\ +we have more control but also expect an \OPENTYPE\ font. In \OPENTYPE\ math there +are italic corrections, and we even have the peculiar usage of it in positioning +limits. However, the idea was that staircase kerns do the detailed relative +positioning. + +Before we dive into this a bit more, it is worth mentioning that Don Knuth paid a +lot of attention to details. The italic alphabet in math uses the same shapes as +the text italic but metrics are different as is shown below. We have also met fonts +where it looked like the text italics were taken, and where the metrics were handled +via more excessive italic correction, sometimes combined with staircase kerns that +basically were corrections for the side bearing. This is why we always come back to +Latin Modern and Cambria when we investigate fonts: one is based on the traditional +\TEX\ model, with carefully chosen italic corrections, and the other is based on the +\OPENTYPE\ model with staircase kerning. They are our reference fonts. + +\startlinecorrection +\startcombination[nx=1,ny=2] + \startcontent + \definedfont[file:lmroman10italic.otf]% + \showglyphs + \scale[s=3]{abcdefghijklmnopqrstuvwxyz} + \stopcontent + \startcaption + Latin Modern Roman Italic + \stopcaption + \startcontent + \definedfont[file:latinmodernmath.otf]% + \showglyphs + \scale[s=3]{𝑎𝑏𝑐𝑑𝑒𝑓𝑔ℎ𝑖𝑗𝑘𝑙𝑚𝑛𝑜𝑝𝑞𝑟𝑠𝑡𝑢𝑣𝑤𝑥𝑦𝑧} + \stopcontent + \startcaption + Latin Modern Math Italic + \stopcaption +\stopcombination +\stoplinecorrection + +In \CONTEXT\ \MKIV\ we played a lot with italic correction in math and there were +ways to enforce, ignore, selectively apply it, etc. But, because fonts actually +demand a mixture, in \LUAMETATEX\ we ended up with more extensive runtime +patching of them. Another reason for this was that math fonts can have weird +properties. It looks like when these standards are set and fonts are made, the +font makers can do as they like as long as the average formula comes out right, +and metrics to some extent resemble a traditional font. However, when testing how +well a font behaves in a real situation there can be all kind of interferences +from the macro package: inter|-|atom kerning, spacing corrections macros, +specific handling of cases, etc. We even see \OPENTYPE\ fonts that seem to +have the same limited number of heights, depths and italic corrections. And, as a +consequence we get for instance larger sizes of fences having the same depth for +all the size variants, something that is pretty odd for an \OPENTYPE\ font with no +limitations. + +The italic correction in traditional \TEX\ math gets added to the width. When a +subscript is attached to a kernel character it sits tight against that character: +its position is driven by the width of the kernel. A superscript on the other +hand is moved over the italic width so that it doesn't overlap or touch the +likely sticking out bit of the kernel. This means that a traditional font (and +quite some \OPENTYPE\ math fonts are modelled after Computer Modern) have to find +compromises of width and italic correction for characters where the subscript is +supposed to move left (inside the bounding box of the kernel). + +The \OPENTYPE\ specification has some vague remarks about applying italic +correction between the last in a series of slanted shapes and operators, as well +as positioning limits, and suggests that it relates to relative super- and +subscript positioning. It doesn't mention that the correction is to be added to +the width. However, the main mechanism for anchoring script are these top and +bottom edge kerns. It's why in fonts that provide these, we are unlikely to find +italic correction unless it is used for positioning limits. + +It is for that reason that an engine can produce reasonable results for fonts +that either provide italics or provide kerns for anchoring: having both on the +same glyph would mean troubles. It means that we can configure the engine options +to add italic correction as well as kerns, assuming distinctive usage of those +features. For a font that uses both we need to make a choice (this is possible, +since we can configure options per font). But that will never lead to always nicely +typeset math. In fact, without tweaks many fonts will look right because in +practice they use some mixture. But we are not aiming at partial success, we want +all to look good. + +Here is another thing to keep in mind (although now we are guessing a bit). There +is a limited number of heights and depths in \TEX\ fonts possible (16), but four +times as many italic corrections can be defined (64). Is it because Don Knuth +wanted to properly position the sub- and subscripts? Adding italic correction to +the width is pretty safe: shapes should not overlap. Choosing the right width for +a subscript needs more work because it's is more visual. In the end we have a +width that is mostly driven by superscript placement! That also means that as +soon as we remove the italic correction things start looking bad. In fact, +because also upright math characters have italic correction the term \quote +{italic} is a bit of a cheat: it's all about script positioning and has little to +do with the slope of the shapes. + +One of the reasons why for instance spacing between an italic shape and an +upright one in \TEX\ works out okay is that in most cases they come from a +different font, which can be used as criterium for keeping the correction; +between a sequence of same|-|font characters it gets removed. However, in +\OPENTYPE\ math there is a good chance that all comes from the same font (at +least in \CONTEXT), unless one populates many families as in traditional \TEX. We +have no clue how other macro packages deal with this but it might well be the +case that using many families (one for each alphabet) works better in the end. +The engine is really shape and alphabet agnostic, but one can actually wonder if +we should add a glyph property indicating the distinctive range. It would provide +engine level control over a run of glyphs (like multiplying a variable +represented by a greek alpha by another variable presented by an upright b). + +But glyph properties cannot really be used here because we are still dealing with +characters when the engine transforms the noad list into a node list. So, when we +discussed this, we started wondering how the engine could know about a specific +shape (and tilt) property at all, and that brought us to pondering about an +additional axis of options. We already group characters in classes, but we can +also group them with properties like \typ {tilted}, \typ {dotless}, \typ {bold}. +When we pair atoms we can apply options, spacing and such based on the specific +class pair, and we can do something similar with category pairs. It basically +boils down to for instance \type {\mccode} that binds a character to a category. +Then we add a command like \typ {\setmathcategorization} (analogue to \typ +{\setmathspacing}) that binds options to pairs of categories. An easier variant +of this might be to let the \type {\mccode} carry a (bit)set of options that then +get added to the already existing options that can be bound to character noads as +we create them. This saves us some configuration. Deciding what suits best +depends on what we want to do: the fact that \TEX\ doesn't do this means that +probably no one ever gave it much thought, but once we do have this mechanism it +might actually trigger demand, if only by staring at existing documents where +characters of a different kind sit next to each other (take this \quote {a} +invisible times \quote {x}). It would not be the first time that (in \CONTEXT) +the availability of some feature triggers creative (ab)usage. + +Because the landscape has settled, because we haven't seen much fundamental +evolution in \OPENTYPE\ math, because in general \TEX\ math doesn't really +evolve, and because \CONTEXT\ in the past has not been seen as suitable for + math, we can, as mentioned before, basically decide what approach we +follow. So, that is why we can pick up on this italic correction in a more +drastic way: we can add the correction to the width, thereby creating a nicely +bounded glyph, and moving the original correction to the right bottom kern, as +that is something we already support. In fact, this feature is already available, +we only had to add setting the right bottom kern. The good news is that we don't +need to waste time on trying to get something extra in the font format, which is +unlikely to happen anyway after two decades. + +It is worth noticing that when we were exploring this as part of using \METAPOST\ +to analyze and visualize these aspects, we also reviewed the \typ {wipeitalics} +tweak and wondered if, in retrospect, it might be a dangerous one when applied to +alphabets (for digits and blackboard bold letters it definitely makes +sense): it can make traditional super- and subscript anchoring less optimal. +However, for some fonts we found that improper bounding boxes can badly interfere +anyway: for instance the upright \quote {f} in EBGaramond sticks out left and +right, and has staircase kerns that make scripts overlap. The right top of the +shape sticks out a lot and that is because the text font variant is used. We already decided to +add a \typ {moveitalics} tweak that moves italic kerns into the +width and then setting a right bottom kern that compensates it that can be a +pretty good starting point for our further exploration of optimal kerns at the +corners. That tweak also fixes the side bearings (negative llx) and compensates +left kerns (when present) accordingly. An additional \typ {simplifykerns} tweak +can later migrate staircase kerns to simple kerns. + +So, does that free us from tweaks like \typ {dimensions} and \typ {kerns}? Not +completely. But we can forget about the italic correction +in most cases. We have to set up less lower right kerns and maybe correct a few. +It is just a more natural solution. So how about these kerns that we need to +define? After all, we also have to deal with proper top kerns, and like to add +kerns that are not there simply because the mentioned comprise between width, +italic and the combination was impossible. More about that in the next section. + +\stopsection + +\startsection[title=Kerning] + +In the next pictures we will try to explain more visual what we have in mind and +are experimenting with as we write this. In the traditional approach we have +shapes that can communicate the width, height, depth and italic correction to the +engine so that is what the engine can work with. The engine also has the +challenge to anchor subscripts and superscripts in a visual pleasing way. + +\startMPdefinitions + numeric UsedUnit ; UsedUnit = 1mm ; + numeric UsedWidth ; UsedWidth := 10UsedUnit ; + numeric UsedItalic ; UsedItalic := 2UsedUnit ; + numeric UsedScript ; UsedScript = 5UsedUnit; + picture LeftCharA ; LeftCharA := image( + draw origin -- (UsedWidth,UsedWidth) + withpen pencircle scaled 2UsedUnit + withcolor .4white ; + path p ; p := boundingbox currentpicture ; + draw rightboundary currentpicture + bottomenlarged -5UsedUnit + withpen pencircle scaled .5UsedUnit ; + setbounds currentpicture to p ; + draw origin + withpen pencircle scaled 1UsedUnit + withcolor .1white ; + setbounds currentpicture to boundingbox currentpicture + leftenlarged -UsedItalic + rightenlarged -UsedItalic ; + draw boundingbox currentpicture + withpen pencircle scaled .1UsedUnit ; + ) ; + picture RightCharA ; RightCharA := image( + draw (0,UsedWidth) -- (UsedWidth,0) + withpen pencircle scaled 2UsedUnit + withcolor .6white ; + path p ; p := boundingbox currentpicture ; + draw rightboundary currentpicture + bottomenlarged -5UsedUnit + withpen pencircle scaled .5UsedUnit ; + setbounds currentpicture to p ; + draw origin + withpen pencircle scaled 1UsedUnit + withcolor .1white ; + setbounds currentpicture to boundingbox currentpicture + leftenlarged -UsedItalic + rightenlarged -UsedItalic ; + draw boundingbox currentpicture + withpen pencircle scaled .1UsedUnit ; + ) ; + picture LeftCharB ; LeftCharB := image( + draw origin -- (UsedWidth,UsedWidth) + withpen pencircle scaled 2UsedUnit + withcolor .4white ; + path p ; p := boundingbox currentpicture ; + draw origin + withpen pencircle scaled 1UsedUnit + withcolor .1white ; + draw boundingbox currentpicture + withpen pencircle scaled .1UsedUnit ; + draw lrcorner p + shifted (-UsedItalic,0) + withpen pencircle scaled 1UsedUnit + withcolor .1white ; + draw urcorner p + withpen pencircle scaled 1UsedUnit + withcolor .1white ; + setbounds currentpicture to p ; + ) ; + picture RightCharB ; RightCharB := image( + draw (0,UsedWidth) -- (UsedWidth,0) + withpen pencircle scaled 2UsedUnit + withcolor .6white ; + path p ; p := boundingbox currentpicture ; + draw origin + withpen pencircle scaled 1UsedUnit + withcolor .1white ; + draw boundingbox currentpicture + withpen pencircle scaled .1UsedUnit ; + draw lrcorner p + shifted (-UsedItalic,0) + withpen pencircle scaled 1UsedUnit + withcolor .1white ; + draw urcorner p + withpen pencircle scaled 1mm + withcolor .1white ; + setbounds currentpicture to p ; + ) ; + picture SuperScript ; SuperScript := image( + draw unitsquare scaled UsedScript + shifted (0,-UsedScript/2) + ) ; + picture SubScript ; SubScript := image( + draw unitsquare scaled UsedScript + shifted (0,-UsedScript/2) + ) ; + def WidenResultA = + setbounds currentpicture to boundingbox currentpicture + leftenlarged 6UsedUnit + rightenlarged 6UsedUnit; + enddef ; + def WidenResultB = + setbounds currentpicture to boundingbox currentpicture + topenlarged .5UsedScript + leftenlarged 6UsedUnit + rightenlarged 6UsedUnit; + enddef ; +\stopMPdefinitions + +\startlinecorrection + \startcombination[nx=3,ny=1] + \startcontent + \startMPcode + draw LeftCharA ; + draw RightCharA xshifted (UsedWidth+UsedItalic+3UsedUnit) ; + WidenResultA ; + \stopMPcode + \stopcontent + \startcaption + two characters + \stopcaption + \startcontent + \startMPcode + draw LeftCharA ; + draw RightCharA xshifted UsedWidth ; + WidenResultA ; + \stopMPcode + \stopcontent + \startcaption + width only + \stopcaption + \startcontent + \startMPcode + draw LeftCharA ; + draw RightCharA xshifted (UsedWidth+UsedItalic) ; + WidenResultA ; + \stopMPcode + \stopcontent + \startcaption + with italic + \stopcaption + \stopcombination +\stoplinecorrection + +In this graphic we show two pseudo characters. The shown bounding box indicates +the width as seen by the engine. An example of such a shape is the math italic~f, +and as it is used a lot in formulas it is also one of the most hard ones to handle +when it comes to spacing: in nearly all fonts the right top sticks out and in +some fonts the left part also does that. Imagine how that works out with scripts, +fences and preceding characters. + +When we put two such characters together they will overlap, and this is why we need +to add the italic correction. That is also why the \TEX\ documentation speaks in +terms of \quotation {always add the italic correction to the width}. This also +means that we need to remove it occasionally, something that you will notice when +you study for instance the \LUATEX\ source, that has a mix of traditional and +\OPENTYPE\ code paths. Actually, compensating can either be done by changing the +width property of a glyph node or by explicitly adding a kern. In \LUAMETATEX\ we +always add real kerns because we can then trace better. + +The last graphic in the above set shows how we compensate the width for the bit +that sticks out. It also shows that we definitely need to take neighboring shapes +into account when we determine the width and italic correction, especially when +the later is {\em not} applied (read: removed). + +\startlinecorrection + \startcombination[nx=3,ny=1] + \startcontent + \startMPcode + draw LeftCharA ; + path p ; p := boundingbox currentpicture ; + draw SuperScript + shifted urcorner p xshifted UsedScript ; + draw SubScript + shifted lrcorner p xshifted UsedScript ; + WidenResultB ; + \stopMPcode + \stopcontent + \startcaption + kernel + \stopcaption + \startcontent + \startMPcode + draw LeftCharA ; + path p ; p := boundingbox currentpicture ; + draw SuperScript + shifted urcorner p ; + draw SubScript + shifted lrcorner p ; + WidenResultB ; + \stopMPcode + \stopcontent + \startcaption + subscript + \stopcaption + \startcontent + \startMPcode + draw LeftCharA ; + path p ; p := boundingbox currentpicture ; + draw SuperScript + shifted urcorner p + xshifted UsedItalic ; + draw SubScript + shifted lrcorner p ; + WidenResultB ; + \stopMPcode + \stopcontent + \startcaption + superscript + \stopcaption + \stopcombination +\stoplinecorrection + +Here we anchored a super- and subscript. The subscript position it tight to the +advance width, again indicated by the box. The superscript however is moved by +the italic correction and in the engine additional spacing before and after can +be applied as well, but we leave that for now. It will be clear that when the +font designer chooses the width and italic correction, the fact that scripts get +attached has to be taken into account. + +\startlinecorrection + \startcombination[nx=2,ny=1] + \startcontent + \startMPcode + draw LeftCharB ; + draw RightCharB xshifted (UsedWidth+UsedItalic+3UsedUnit) ; + WidenResultA ; + \stopMPcode + \stopcontent + \startcaption + two characters + \stopcaption + \startcontent + \startMPcode + draw LeftCharB ; + draw RightCharB xshifted (UsedWidth+UsedItalic) ; + WidenResultA ; + \stopMPcode + \stopcontent + \startcaption + width only + \stopcaption + \stopcombination +\stoplinecorrection + +In this graphic we combine the italic correction with the width. Keep in mind +that in these examples we use tight values but in practice that correction can +also add some extra right side bearing (white space). This addition is an +operation that we can do when loading a font. At the same time we also compensate +the left edge for which we can use the x coordinate of the left corner of the +glyphs real bounding box. The advance width starts at zero and that corner is +then left of the origin. By looking at shapes we concluded that in most cases +that shift is valid for usage in math where we don't need that visual overlap. In +fact, when we tested some of that we found that the results can be quite horrible +when you don't do that; not all fonts have left bottom kerning implemented. + +The dot at the right is actually indicating the old italic correction. Here we +let it sit on the edge but as mentioned there can be additional (or maybe less) +italic correction than tight. + +\startlinecorrection + \startcombination[nx=3,ny=1] + \startcontent + \startMPcode + draw LeftCharB ; + path p ; p := boundingbox currentpicture ; + draw SuperScript + shifted urcorner p xshifted UsedScript ; + draw SubScript + shifted lrcorner p xshifted UsedScript ; + WidenResultB ; + \stopMPcode + \stopcontent + \startcaption + kernel + \stopcaption + \startcontent + \startMPcode + draw LeftCharB ; + path p ; p := boundingbox currentpicture ; + draw SuperScript + shifted urcorner p ; + draw SubScript + shifted lrcorner p ; + WidenResultB ; + \stopMPcode + \stopcontent + \startcaption + superscript + \stopcaption + \startcontent + \startMPcode + draw LeftCharB ; + path p ; p := boundingbox currentpicture ; + draw SuperScript + shifted urcorner p ; + draw SubScript + shifted (-UsedItalic,0) + shifted lrcorner p ; + WidenResultB ; + \stopMPcode + \stopcontent + \startcaption + subscript + \stopcaption + \stopcombination +\stoplinecorrection + +Finally we add the scripts here. This time we position the superscript and +subscript at the top and bottom anchors. The bottom anchor is, as mentioned, the +old italic correction, and the top one currently just the edge. And this is what +our next project is about: identify the ideal anchors and use these instead. + +In the \CONTEXT\ goodie files (the files that tweak the math fonts runtime) we +can actually already set these top and bottom anchors and the engine will use +them when set. These kerns are not to be confused with the more complicated +staircase kerns. They are much simpler and lightweight. The fact that we already +have them makes it relatively easy to experiment with this. + +It must be noted that we talk about three kinds of kerns: inter character kerns, +corner kerns and staircase kerns. We can set them all up with tweaks but so far +we only did that for the most significant ones, like integrals. The question is: +can we automate this? We should be careful because the bad top accent anchors in +the \TEXGYRE\ fonts demonstrate how flawed heuristics can be. Interesting is that +the developers of these font used \METAPOST\ and are highly qualified in that +area. And for us using \METAPOST\ is also natural! + +The approach that we follow is somewhat interactive. When working on the math +update we like to chat (with zoom) about these matters. We discuss and explore +plenty and with these kerns we do the same. Because \METAPOST\ produces such nice +and crispy graphics, and because \METAFUN\ is well integrated into \CONTEXT\ we +can link all these subsystems and just look at what we get. A lot is about +visualization: if we discuss so called \quote {grayness} in the perspective of +kerning, we end up with calculating areas, then look at what it tells us and as a +next step figure out some heuristic. And of course we challenge each other into +new trickery. + +% THIS WILL BECOME A MODULE! + +\startluacode +local formatters = string.formatters + +local glyph = nil +local mpdata = nil + +local f_boundingbox = formatters["((%N,%N)--(%N,%N)--(%N,%N)--(%N,%N)--cycle)"] +local f_vertical = formatters["((%N,%N)--(%N,%N))"] + +function mp.lmt_glyphshape_start(id,character) + if type(id) == "string" then + id = fonts.definers.internal({ name = id } ,"") + end + local fontid = (id and id ~= 0 and id) or font.current() + local shapedata = fonts.hashes.shapes[fontid] -- by index + local characters = fonts.hashes.characters[fontid] -- by unicode + local descriptions = fonts.hashes.descriptions[fontid] -- by unicode + local shapeglyphs = shapedata.glyphs or { } + if type(character) == "string" and character ~= "" then + local hex = string.match(character,"^0x(.+)") + if hex then + character = tonumber(hex,16) + else + character = utf.byte(character) + end + else + character = tonumber(character) + end + local chardata = characters[character] + local descdata = descriptions[character] + if chardata then + glyph = shapeglyphs[chardata.index] + if glyph and (glyph.segments or glyph.sequence) and not glyph.paths then + local units = shapedata.units or 1000 + local factor = 100/units + local width = (descdata.width or 0) * factor + local height = descdata.boundingbox[4] * factor + local depth = descdata.boundingbox[2] * factor + local math = descdata.math + local italic = (math and math.italic or 0) * factor + local accent = (math and math.accent or 0) * factor + mpdata = { + paths = fonts.metapost.paths(glyph,factor), + boundingbox = fonts.metapost.boundingbox(glyph,factor), + baseline = fonts.metapost.baseline(glyph,factor), + width = width, + height = height, + depth = depth, + italic = italic, + accent = accent, + usedbox = f_boundingbox(0,depth,width,depth,width,height,0,height), + usedline = f_vertical(0,0,width,0), + } + end + else + print("NO",id,character) + end +end + +function mp.lmt_glyphshape_stop() + glyph = nil + mpdata = nil +end + +function mp.lmt_glyphshape_n() + if mpdata then + mp.print(#mpdata.paths) + else + mp.inject.numeric(0) + end +end + +function mp.lmt_glyphshape_path(i) + if mpdata then + mp.print(mpdata.paths[i]) + else + mp.inject.pair(0,0) + end +end + +function mp.lmt_glyphshape_boundingbox() + if mpdata then + mp.print(mpdata.boundingbox) + else + mp.inject.pair(0,0) + end +end +function mp.lmt_glyphshape_usedbox() + if mpdata then + mp.print(mpdata.usedbox) + else + mp.inject.pair(0,0) + end +end + +function mp.lmt_glyphshape_baseline() + if mpdata then + mp.print(mpdata.baseline) + else + mp.inject.pair(0,0) + end +end +function mp.lmt_glyphshape_usedline() + if mpdata then + mp.print(mpdata.usedline) + else + mp.inject.pair(0,0) + end +end + +function mp.lmt_glyphshape_width () mp.print(mpdata and mpdata.width or 0) end +function mp.lmt_glyphshape_depth () mp.print(mpdata and mpdata.depth or 0) end +function mp.lmt_glyphshape_height() mp.print(mpdata and mpdata.height or 0) end +function mp.lmt_glyphshape_italic() mp.print(mpdata and mpdata.italic or 0) end +function mp.lmt_glyphshape_accent() mp.print(mpdata and mpdata.accent or 0) end + +\stopluacode + +\startMPdefinitions + presetparameters "glyphshape" [ + % id = "", + % character = "", + shape = true, + boundingbox = false, + baseline = false, + usedline = true, + usedbox = true, + ] ; + +def lmt_glyphshape = applyparameters "glyphshape" "lmt_do_glyphshape" enddef ; + +vardef glyphshape_start(expr id, character) = + lua.mp.lmt_glyphshape_start(id, character) ; +enddef ; + +vardef glyphshape_stop = lua.mp.lmt_glyphshape_stop() ; enddef ; +vardef glyphshape_n = lua.mp.lmt_glyphshape_n() enddef ; +vardef glyphshape_path(expr i) = lua.mp.lmt_glyphshape_path(i) enddef ; +vardef glyphshape_boundingbox = lua.mp.lmt_glyphshape_boundingbox() enddef ; +vardef glyphshape_baseline = lua.mp.lmt_glyphshape_baseline() enddef ; +vardef glyphshape_usedbox = lua.mp.lmt_glyphshape_usedbox() enddef ; +vardef glyphshape_usedline = lua.mp.lmt_glyphshape_usedline() enddef ; +vardef glyphshape_width = lua.mp.lmt_glyphshape_width() enddef ; +vardef glyphshape_height = lua.mp.lmt_glyphshape_height() enddef ; +vardef glyphshape_depth = lua.mp.lmt_glyphshape_depth() enddef ; +vardef glyphshape_italic = lua.mp.lmt_glyphshape_italic() enddef ; +vardef glyphshape_accent = lua.mp.lmt_glyphshape_accent() enddef ; + +vardef lmt_do_glyphshape = + image ( + pushparameters "glyphshape" ; + lua.mp.lmt_glyphshape_start(getparameter "id", getparameter "character") ; + if getparameter "shape" : + draw for i=1 upto lua.mp.lmt_glyphshape_n() : + lua.mp.lmt_glyphshape_path(i) && + endfor cycle ; + fi ; + if getparameter "boundingbox" : + draw + lua.mp.lmt_glyphshape_boundingbox() + withcolor red + ; + fi ; + if getparameter "usedline" : + draw + lua.mp.lmt_glyphshape_usedline() + withcolor green + ; + fi ; + if getparameter "usedbox" : + draw + lua.mp.lmt_glyphshape_usedbox() + withcolor blue + ; + fi ; + lua.mp.lmt_glyphshape_stop() ; + popparameters ; + ) +enddef ; + +\stopMPdefinitions + +\startplacefigure[location=none] +\startMPcode[offset=1dk] +picture leftchar ; +picture rightchar ; +path leftbbox ; +path rightbbox ; +numeric leftitalic ; +numeric rightitalic ; +numeric leftaccent ; +numeric rightaccent ; + +numeric N ; N := 50 ; + +glyphshape_start("file:texgyrebonum-math.otf", "0x1D453") ; + leftchar := image (draw for i=1 upto glyphshape_n : glyphshape_path(i) && endfor cycle ;) ; + leftbbox := glyphshape_usedbox ; + leftaccent := glyphshape_accent ; + leftitalic := xpart urcorner leftbbox - glyphshape_italic ; +glyphshape_stop ; +glyphshape_start("file:texgyrebonum-math.otf", "0x1D45A") ; + rightchar := image (draw for i=1 upto glyphshape_n : glyphshape_path(i) && endfor cycle ;) ; + rightbbox := glyphshape_usedbox ; + rightaccent := glyphshape_accent ; + rightitalic := xpart urcorner rightbbox - glyphshape_italic ; +glyphshape_stop ; + +rightchar := rightchar xshifted (xpart lrcorner leftbbox) ; +rightbbox := rightbbox xshifted (xpart lrcorner leftbbox) ; + +rightaccent := rightaccent + xpart lrcorner leftbbox ; +rightitalic := rightitalic + xpart lrcorner leftbbox ; + +numeric d ; d := (xpart lrcorner leftbbox) - leftitalic ; +rightchar := rightchar shifted (d,0); +rightbbox := rightbbox shifted (d,0); + +draw leftbbox withcolor 0.5white ; +draw rightbbox withcolor 0.5white ; +draw leftchar withpen pencircle scaled 1 ; +draw rightchar withpen pencircle scaled 1 ; + +numeric miny, maxy ; + +miny := max(ypart lrcorner leftbbox, ypart llcorner rightbbox) ; +maxy := min(ypart urcorner leftbbox, ypart ulcorner rightbbox) ; + +path testv ; testv := ((0,miny) -- (0,maxy)) xshifted (xpart lrcorner leftbbox) ; + +% % testv := testv shifted (d,0); +% draw testv withcolor darkred ; + +path midpath, leftintersections, rightintersections ; +pair leftintersection[], rightintersection[] ; + +numeric yta ; yta := 0 ; +numeric minl ; minl := 1000 ; + +for i = 1 upto (N-1) : + midpath := (0, ypart point (i/N) along testv) -- (xpart urcorner rightbbox, ypart point (i/N) along testv); + for j within leftchar : + midpath := midpath cutbeforelast pathpart j ; + endfor + for j within rightchar : + midpath := midpath cutafterfirst pathpart j ; + endfor + + if ( (i = 1) or ((xpart point 1 of midpath) - (xpart point 0 of midpath) < minl) ) : + minl := (xpart point 1 of midpath) - (xpart point 0 of midpath) ; + fi + + if ((xpart point 0 of midpath) < eps) or ((xpart point 1 of midpath) > ((xpart urcorner rightbbox) - eps)) : + draw midpath withpen pencircle scaled 1 withcolor 0.1[white,darkgreen] withtransparency (1,0.5) ; + midpath := (point 0 of midpath) && cycle ; + fi + + draw midpath withcolor 0.4[white,darkgreen] ; + draw point 0 of midpath withpen pencircle scaled 1 withcolor darkgreen ; + draw point 1 of midpath withpen pencircle scaled 1.25 withcolor darkgreen ; + + yta := yta + (1/N)*((xpart point 1 of midpath) - (xpart point 0 of midpath)) ; +endfor + +drawarrow (origin -- ((xpart lrcorner leftbbox) - leftitalic,0)) shifted (urcorner leftbbox) withcolor "orange" ; +drawarrow (origin -- ((xpart lrcorner rightbbox) - rightitalic - d,0)) shifted (urcorner rightbbox) withcolor "orange" ; + +% draw (leftaccent, (ypart urcorner leftbbox )) withcolor "darkblue" withpen pencircle scaled 3 ; +% draw (rightaccent + d, (ypart urcorner rightbbox)) withcolor "darkblue" withpen pencircle scaled 3 ; + +\stopMPcode + +\stopplacefigure + + +We are sure that getting this next stage in the perfection of math typesetting in +\CONTEXT\ and \LUAMETATEX\ will take quite some time, but the good news is that +all machinery is in place. We also have to admit that it all might not work out +well, so that we stick to what we have now. But at least we had the fun then. And +it is also a nice example of both applying mathematics and programming graphics. + +That said, if it works out well, we can populate the goodie files with output +from \METAPOST, tweak a little when needed, and that saves us some time. One +danger is that when we try to improve rendering the whole system also evolves +which in turn will give different output, but we can always implement all this as +features because after all \CONTEXT\ is very much about configuration. And it +makes nice topics for articles and talks too! + +The kerns discussed in the previous paragraphs are not the ones that we +find in \OPENTYPE\ fonts. There we have \quote {staircase} kerns that stepwise go +up or down by height and kern. So, one can have different kerns depending on the +height and sort of follow the shape. This permits quite precise kerning between +for instance the right bottom of a kernel and left top of a subscript. So how is +that used in practice? The reference font Cambria has these kerns but close +inspection shows that these are not that accurate. Fortunately, we never enter +the danger zone with subscripts, because other parameters prevent that. If we look +at for instance Lucida and Garamond, then we see that their kerns are mostly used +as side bearing, and not really as staircase kerns. + +\usemodule[s][fonts-shapes] + +\startlinecorrection +\startcombination[nx=5,ny=1] + \startcontent + \ShowGlyphShape{name:cambria-math}{100bp}{0x1D6FD} + \stopcontent + \startcaption + \type {U+1D6FD} + \stopcaption + \startcontent + \ShowGlyphShape{name:cambria-math}{100bp}{0x003A4} + \stopcontent + \startcaption + \type {U+003A4} + \stopcaption + \startcontent + \ShowGlyphShape{name:cambria-math}{100bp}{0x1D4CC} + \stopcontent + \startcaption + \type {U+1D4CC} + \stopcaption + \startcontent + \ShowGlyphShape{name:cambria-math}{100bp}{0x1D6B8} + \stopcontent + \startcaption + \type {U+1D6B8} + \stopcaption + \startcontent + \ShowGlyphShape{name:cambria-math}{100bp}{0x1D70C} + \stopcontent + \startcaption + \type {U+1D70C} + \stopcaption +\stopcombination +\stoplinecorrection + +In these figures you see a few glyphs from cambria with staircase kerns and +although we show them small you will notice that some kern boundaries touch the +shape. As subscripts never go that high it goes unnoticed but it also shows that +sticking to the lowest boundary makes sense. + +We conclude that we can simplify these kerns, and just transform them into our +(upto four) corner kerns. It is unlikely that Cambria gets updates and that other +fonts become more advanced. One can even wonder if multiple steps really give +better results. The risk of overlap increases with more granularity because not +every pair of glyphs is checked. Also, the repertoire of math characters will +likely not grow and include shapes that differ much from what we can look at now. +Reducing these kerns to simple ones, that can easily be patched at will in a +goodie file, has advantages. We can even simplify the engine. + +\stopsection + +\startsection[title=Conclusion] + +So how can we summarize the above? The first conclusion is that we can only get +good results when we runtime patch fonts to suite the engine and our (\CONTEXT) +need. The second conclusion is that we should seriously consider to drop (read: +ignore) most math font parameter and|/|or to reorganize them. There is no +need to be conforming, because these parameters are often not that well +implemented (thumb in mouth). The third conclusion (or observation) is that we +should get rid of the excessive use of italic correction, and go for our new +corner kerns instead. Last, we can conclude that it makes sense to explore how we +can use \METAPOST\ to analyze the shapes in such a way that we can improve inter +character kerning, corner kerns and maybe even, in a limited way, staircase kerns. + +And, to come back to accents: very few characters need a top kern. Most can be +handled with centered anchors, and we need tweaks for margins and overshoot +anyway. The same is true for many other tweaks: they are there to stay. + +This is how we plan to go forward: + +\startitemize[packed] + \startitem + We pass no italic corrections in the math fonts to the engine, + but instead we have four dedicated simple corner kerns, top and + bottom anchors, and we also compensate negative left side bearing. We + should have gone that route earlier (as follow up on a \MKIV\ feature) + but were still in some backward compatibility mindset. + \stopitem + \startitem + The \LUAMETATEX\ math engine might then be simplified by removing all + code related to italic correction. Of course it hurts that we spent so + much time on that over the years. We can anyway disable engine options + related to italic correction in the \CONTEXT\ setup. Of course the engine + is less old school generic then but that is the price of progress. + \stopitem + \startitem + A default goodie file is applied that takes care of this when no goodie + file is provided. We could do some in the engine, but there is no real + need for that. We can simplify the mid 2022 goodie files because we have + to fix less glyphs. + \stopitem + \startitem + If we ever need italic correction (that is: backtrack) then we use the + (new) \type {\mccode} option code that can identity sloped shapes. But, + given that ignoring the correction between sloped shapes looks pretty bad, + we can as well forget about this. After all, italic correction never + really was about correcting italics, but more about anchoring scripts. + \stopitem + \startitem + Staircase kerns can be reduced to simple corner kerns and the engine can + be simplified a bit more. In the end, all we need is true widths and simple + corner kerns. + \stopitem + \startitem + We reorganize the math parameters and get rid of those that are not + really font design dependent. This also removes a bit of overlap. This will + be done as we document. + \stopitem + \startitem + Eventually we can remove tweaks that are no longer needed in the new + setup, which is a good thing as it also save us some documenting and + maintenance. + \stopitem +\stopitemize + +All this will happen in the perspective of \CONTEXT\ and \LUAMETATEX\ but we +expect that after a few years of usage we can with confidence come to some +conclusions that can trickle back in the other engines so that other macro +packages can benefit from a somewhat radical different but reliable approach to +math rendering, one that works well with the old and new fonts. + +\stopsection + +\stopchapter + +\stopcomponent diff --git a/doc/context/sources/general/manuals/ontarget/ontarget.tex b/doc/context/sources/general/manuals/ontarget/ontarget.tex index d17b09979..ba79a09bd 100644 --- a/doc/context/sources/general/manuals/ontarget/ontarget.tex +++ b/doc/context/sources/general/manuals/ontarget/ontarget.tex @@ -24,6 +24,7 @@ \component ontarget-makessense \component ontarget-alsomath \component ontarget-ridofjit + \component ontarget-gettingridof \stopbodymatter \stopdocument diff --git a/metapost/context/base/mpxl/mp-math.mpxl b/metapost/context/base/mpxl/mp-math.mpxl index 404d42160..3d9ad81d3 100644 --- a/metapost/context/base/mpxl/mp-math.mpxl +++ b/metapost/context/base/mpxl/mp-math.mpxl @@ -172,6 +172,16 @@ else : % decimal fi ; +%D Variant on post to the mailing list by MC: + +vardef atantwo(expr dy, dx) = + if dx == 0 : + if dy < 0 : - fi pi / 2 + else : + atan(dy/dx) if dx > 0 : if dy < 0 : - else : + fi pi fi + fi +enddef ; + permanent m_acos, m_acosh, m_asin, m_asinh, m_atan, m_atantwo, m_atanh, m_cbrt, m_ceil, m_copysign, m_cos, m_cosh, m_deg, m_erf, m_erfc, m_exp, m_exptwo, m_expm, m_fabs, diff --git a/metapost/context/base/mpxl/mp-tool.mpxl b/metapost/context/base/mpxl/mp-tool.mpxl index 7462b0ace..7b7814eef 100644 --- a/metapost/context/base/mpxl/mp-tool.mpxl +++ b/metapost/context/base/mpxl/mp-tool.mpxl @@ -675,12 +675,16 @@ vardef mfun_tool_striped_angle(expr option, p, asked_angle, asked_gap) text extr mask := shape rotated used_angle ; maximum := max (xpart llcorner mask, xpart urcorner mask, ypart llcorner mask, ypart urcorner mask) ; minimum := min (xpart llcorner mask, xpart urcorner mask, ypart llcorner mask, ypart urcorner mask) ; + % a hack: +maximum := maximum + max(xpart urcorner shape, ypart urcorner shape); +minimum := minimum - max(xpart urcorner shape, ypart urcorner shape); + % pattern := image ( if isinner : mfun_tool_striped_angle_action extra ; for s within shape : if stroked s or filled s : - clip currentpicture to pathpart s ; + clip currentpicture to pathpart s ; fi endfor ; else : @@ -741,6 +745,29 @@ def do_stripe_path_a (text asked_spec) (text asked_draw) (expr asked_path) text draw image(asked_draw asked_path asked_text) anglestriped(3,0,0) asked_spec ; enddef ; +%D A more efficient variant by Mikael: + +% path p ; p := fullcircle scaled 3cm && (unitsquare scaled 2cm shifted (4cm,4cm)) && cycle ; +% draw hatch(p,30,0.2cm) ; draw p ; + +vardef hatch(expr p, a, d) = + save thestripe, diag, b ; picture thestripe ; numeric diag ; path b ; + b := boundingbox p; + diag := 0.55 * ( abs((urcorner b) - (llcorner b)) ) ; + thestripe := image ( + draw (-diag,0) -- (diag, 0) && + for i = d step d until diag: + (-diag, i) -- (diag, i) && + (-diag,-i) -- (diag,-i) && + endfor nocycle + withpen currentpen ; + ) ; + thestripe := thestripe shifted center b ; + thestripe := thestripe rotatedaround(center b, a) ; + clip thestripe to p ; + thestripe +enddef ; + %D A few normalizing macros: % primarydef p xsized w = @@ -4350,12 +4377,12 @@ tertiarydef p cutbeforefirst q = begingroup ; save mfun_b, mfun_p ; path mfun_b, mfun_p ; mfun_b := sortedpath (p intersectiontimeslist q) ; if (point 0 of mfun_b) <> (-1,-1) : - mfun_p := subpath(xpart point 0 of mfun_b, infinity) of p; + mfun_p := subpath(xpart point 0 of mfun_b, length p) of p; else : mfun_p := p ; fi ; mfun_p - endgroup ; + endgroup enddef ; tertiarydef p cutafterfirst q = @@ -4367,7 +4394,7 @@ tertiarydef p cutafterfirst q = mfun_p := p ; fi ; mfun_p - endgroup ; + endgroup enddef ; @@ -4375,12 +4402,12 @@ tertiarydef p cutbeforelast q = begingroup ; save mfun_b, mfun_p ; path mfun_b, mfun_p ; mfun_b := sortedpath (p intersectiontimeslist q) ; if (point 0 of mfun_b) <> (-1,-1) : - mfun_p := subpath(xpart point (length mfun_b) of mfun_b, infinity) of p; + mfun_p := subpath(xpart point (length mfun_b) of mfun_b, length p) of p; else : mfun_p := p ; fi ; mfun_p - endgroup ; + endgroup enddef ; tertiarydef p cutafterlast q = @@ -4392,7 +4419,7 @@ tertiarydef p cutafterlast q = mfun_p := p ; fi ; mfun_p - endgroup ; + endgroup enddef ; % I don't want to define this path every time I make a demo: diff --git a/scripts/context/lua/mtx-fonts.lua b/scripts/context/lua/mtx-fonts.lua index 3fc8dba2b..c39b8907f 100644 --- a/scripts/context/lua/mtx-fonts.lua +++ b/scripts/context/lua/mtx-fonts.lua @@ -16,7 +16,7 @@ local lower, gsub = string.lower, string.gsub local concat = table.concat local write_nl = (logs and logs.writer) or (texio and texio.write_nl) or print -local otlversion = 3.120 +local otlversion = 3.121 local helpinfo = [[ diff --git a/scripts/context/lua/mtx-unicode.lua b/scripts/context/lua/mtx-unicode.lua index 3866fd86b..ad42797b7 100644 --- a/scripts/context/lua/mtx-unicode.lua +++ b/scripts/context/lua/mtx-unicode.lua @@ -255,8 +255,8 @@ function scripts.unicode.update() specials = specials, arabic = arabic, combining = combining, - uccode = uccode, - lccode = lccode, + uccode = uccode and uccode or nil, + lccode = lccode and lccode or nil, } characterdata[unicode] = char else @@ -477,7 +477,7 @@ function scripts.unicode.update() if first then local d = characterdata[first] if d then - local v = d.variants + -- local v = d.variants local v = rawget(d,"variants") if not v then v = { } @@ -634,13 +634,83 @@ end -- [0xFE01]="roundhand style", -- } +-- local variants_90={ +-- [0xFE00]="rotated 90 degrees", +-- } +-- +-- local variants_180={ +-- [0xFE01]="rotated 180 degrees", +-- } +-- +-- local variants_270={ +-- [0xFE02]="rotated 270 degrees", +-- } +-- +-- local variants_expanded={ +-- [0xFE00]="expanded", +-- } +-- +-- local variants_90_180={ +-- [0xFE00]="rotated 90 degrees", +-- [0xFE01]="rotated 180 degrees", +-- } +-- +-- local variants_90_180_270={ +-- [0xFE00]="rotated 90 degrees", +-- [0xFE01]="rotated 180 degrees", +-- [0xFE02]="rotated 270 degrees", +-- } +-- +-- local variants_180_270={ +-- [0xFE01]="rotated 180 degrees", +-- [0xFE02]="rotated 270 degrees", +-- } +-- +-- local variants_90_270={ +-- [0xFE00]="rotated 90 degrees", +-- [0xFE02]="rotated 270 degrees", +-- } + function scripts.unicode.save(filename) if preamble then local data = table.serialize(characters.data,"characters.data", { hexify = true, noquotes = true }) - data = gsub(data,"%{%s+%[0xFE0E%]=\"text style\",%s+%[0xFE0F%]=\"emoji style\",%s+%}", "variants_emoji") - data = gsub(data,"%{%s+%[0xFE00%]=\"corner%-justified form\",%s+%[0xFE01%]=\"centered form\",%s+%}","variants_forms") - data = gsub(data,"%{%s+%[0xFE00%]=\"chancery style\",%s+%[0xFE01%]=\"roundhand style\",%s+%}", "variants_style") - data = gsub(data,"%{%s+%[0xFE00%]=\"dotted form\",%s+%}", "variants_dotted") + data = gsub(data, + "%{%s+%[0xFE0E%]=\"text style\",%s+%[0xFE0F%]=\"emoji style\",%s+%}", + "variants_emoji" + ) + data = gsub(data, + "%{%s+%[0xFE00%]=\"corner%-justified form\",%s+%[0xFE01%]=\"centered form\",%s+%}", + "variants_forms" + ) + data = gsub(data, + "%{%s+%[0xFE00%]=\"chancery style\",%s+%[0xFE01%]=\"roundhand style\",%s+%}", + "variants_style" + ) + data = gsub(data, + "%{%s+%[0xFE00%]=\"dotted form\",%s+%}", + "variants_dotted" + ) + data = gsub(data, + "%{%s+%[0xFE00%]=\"expanded\",%s+%}", + "variants_expanded" + ) + data = gsub(data, + "%{%s+%[0xFE0%d%]=\"rotated (%d+) degrees\",%s+%}", + "variants_%1" + ) + data = gsub(data, + "%{%s+%[0xFE0%d%]=\"rotated (%d+) degrees\"," .. + "%s*%[0xFE0%d%]=\"rotated (%d+) degrees\"," .. + "%s+%}", + "variants_%1_%2" + ) + data = gsub(data, + "%{%s+%[0xFE0%d%]=\"rotated (%d+) degrees\"," .. + "%s*%[0xFE0%d%]=\"rotated (%d+) degrees\"," .. + "%s*%[0xFE0%d%]=\"rotated (%d+) degrees\"," .. + "%s+%}", + "variants_%1_%2_%3" + ) io.savedata(filename,preamble .. data) end end diff --git a/source/luametatex/source/README b/source/luametatex/source/README deleted file mode 100644 index 8d63e4393..000000000 --- a/source/luametatex/source/README +++ /dev/null @@ -1,39 +0,0 @@ -LuaMetaTeX - -This is a follow up on the LuaTeX project. The source is considered part of the ConTeXt distribution -and managed by the ConTeXt development team and the ConTeXt user group. That way we can guarantee -that the engine and this TeX macro package work together as expected. The idea is that users can -easily compile the source themselves and that way have a guaranteed long term (minimal) TeX based -installation. Because the management scripts are in Lua, only one binary is needed to serve the -ConTeXt distribution. - -In the source code we try to stay close to the ancestors, LuaTeX, pdfTeX, eTeX and TeX, but in the -meantime due to additions there is quite some diverge. There are new primitives and submechanisms, -there is more control over the inner workings, font handling is mostly delegated to Lua and there -is no built-in backend. The code base is all-inclusive and has no (nor will have) dependencies on -external libraries. - -Performance and memory consumption have been optimized and the additions (compared to LuaTeX) don't -have a negative impact. In spite of the extensions, we consider this a more lightweight version of -its ancestor and want to keep it that way. There are a few optional interfaces to the outside world -but ConTeXt will never depend on them for regular usage. - -Version numbering starts 2.00 so that there is no confusion with LuaTeX where the stable 1.00+ -version numbers now can bump with the yearly TeXlive updates. Backporting features to LuaTeX is yet -undecided (also because the codebase is now too different). The internal MetaPost library is an -enhanced version of the official one that ships with LuaTeX. Here we started with number 3.00 and -to what extend there will be backports to the 2.00+ library is yet unknown. We use Lua 5.4+ and try -to keep up to date with the latest greatest, also because the LuaMetaTeX-ConTeXt combination makes -for nice test enviroment. Starting with LuaMetaTeX version 2.10 the interfaces are considered -stable. Although we will fix bugs as fast as possible, we might end up with the same slow-paced -release cycle as traditional TeX. - -Bugs can be reported to the ConTeXt mailing lists (support or development) or the team members. Such -a report should come with a (MEW) ConTeXt .tex file that illustrates the issue. The code repository -is managed by the ConTeXt user group and its compile farm team (aka contextgarden built bot). - -All kind of aspects of the LuaMetaTeX engine, its development, experiment, ideas and implementation -have been (and are) reported in user group publications aas well as several documents in the ConTeXt -distribution. The mailing list archives and contextgarden wiki are also a source of information. - -Hans Hagen diff --git a/source/luametatex/source/lua/lmtfontlib.c b/source/luametatex/source/lua/lmtfontlib.c index 09429d98a..5004a9710 100644 --- a/source/luametatex/source/lua/lmtfontlib.c +++ b/source/luametatex/source/lua/lmtfontlib.c @@ -73,23 +73,6 @@ static int fontlib_aux_count_hash_items(lua_State *L) */ -/* -# define set_numeric_field_by_index(target,name,dflt) \ - lua_key_rawgeti(name); \ - target = (lua_type(L, -1) == LUA_TNUMBER) ? lmt_roundnumber(L, -1) : dflt ; \ - lua_pop(L, 1); - -# define set_boolean_field_by_index(target,name,dflt) \ - lua_key_rawgeti(name); \ - target = (lua_type(L, -1) == LUA_TBOOLEAN) ? lua_toboolean(L, -1) : dflt ; \ - lua_pop(L, 1); - -# define set_string_field_by_index(target,name) \ - lua_key_rawgeti(name); \ - target = (lua_type(L, -1) == LUA_TSTRING) ? lua_tostring(L, -1) : NULL ; \ - lua_pop(L, 1); -*/ - # define set_numeric_field_by_index(target,name,dflt) \ lua_push_key(name); \ target = (lua_rawget(L, -2) == LUA_TNUMBER) ? lmt_roundnumber(L, -1) : dflt ; \ @@ -219,9 +202,6 @@ static void fontlib_aux_read_lua_math_parameters(lua_State *L, int f) } lua_pop(L, 1); } - set_font_oldmath(f, 0); - } else { - set_font_oldmath(f, 1); } lua_pop(L, 1); } @@ -251,11 +231,6 @@ static void fontlib_aux_store_math_kerns(lua_State *L, int index, charinfo *co, for (lua_Integer l = 1; l <= k; l++) { if (lua_rawgeti(L, -1, l) == LUA_TTABLE) { scaled ht, krn; -// set_numeric_field_by_index(ht, height, min_infinity); -// set_numeric_field_by_index(krn, kern, min_infinity); -// if (krn > min_infinity && ht > min_infinity) { -// tex_add_charinfo_math_kern(co, id, ht, krn); -// } set_numeric_field_by_index(ht, height, 0); set_numeric_field_by_index(krn, kern, 0); if (krn || ht) { @@ -297,6 +272,8 @@ static void fontlib_aux_font_char_from_lua(lua_State *L, halfword f, int i, int tex_char_malloc_mathinfo(co); set_numeric_field_by_index(target, smaller, 0); set_charinfo_smaller(co, target); + set_numeric_field_by_index(target, mirror, 0); + set_charinfo_mirror(co, target); set_numeric_field_by_index(target, vitalic, 0); set_charinfo_vertical_italic(co, target); /* */ @@ -318,12 +295,15 @@ static void fontlib_aux_font_char_from_lua(lua_State *L, halfword f, int i, int set_numeric_field_by_index(target, bottommargin, 0); set_charinfo_bottom_margin(co, target); /* */ - // set_numeric_field_by_index(target, options, 0); - // set_charinfo_options(co, target); - set_numeric_field_by_index(target, topaccent, INT_MIN); - set_charinfo_top_accent(co, target); - set_numeric_field_by_index(target, bottomaccent, INT_MIN); - set_charinfo_bottom_accent(co, target); + set_numeric_field_by_index(target, topovershoot, 0); + set_charinfo_top_overshoot(co, target); + set_numeric_field_by_index(target, bottomovershoot, 0); + set_charinfo_bottom_overshoot(co, target); + /* */ + set_numeric_field_by_index(target, topanchor, INT_MIN); + set_charinfo_top_anchor(co, target); + set_numeric_field_by_index(target, bottomanchor, INT_MIN); + set_charinfo_bottom_anchor(co, target); set_numeric_field_by_index(target, flataccent, INT_MIN); set_charinfo_flat_accent(co, target); set_numeric_field_by_index(target, next, -1); @@ -574,8 +554,6 @@ static int lmt_font_from_lua(lua_State *L, int f) set_font_design_size(f, j); set_numeric_field_by_index(j, size, font_design_size(f)); set_font_size(f, j); - set_boolean_field_by_index(j, oldmath, 0); - set_font_oldmath(f, j); set_boolean_field_by_index(j, compactmath, 0); set_font_compactmath(f, j); set_numeric_field_by_index(j, mathcontrol, 0); @@ -594,12 +572,8 @@ static int lmt_font_from_lua(lua_State *L, int f) set_font_skew_char(f, j); set_boolean_field_by_index(no_math, nomath, 0); fontlib_aux_read_lua_parameters(L, f); - if (no_math) { - set_font_oldmath(f, 1); - } else { + if (! no_math) { fontlib_aux_read_lua_math_parameters(L, f); - set_boolean_field_by_index(j, oldmath, 0); - set_font_oldmath(f, j); } /*tex The characters. */ lua_push_key(characters); @@ -808,8 +782,6 @@ static int fontlib_setfont(lua_State *L) luaL_checktype(L, 2, LUA_TTABLE); if (! tex_is_valid_font(i)) { return luaL_error(L, "font with id %d is not a valid font", i); - // } else if (font_touched(i)) { - // return luaL_error(L, "font with id %d has been accessed already, changing it is forbidden", i); } else { lua_settop(L, 2); lmt_font_from_lua(L, i); diff --git a/source/luametatex/source/lua/lmtinterface.c b/source/luametatex/source/lua/lmtinterface.c index 1aef54563..bc546a9e2 100644 --- a/source/luametatex/source/lua/lmtinterface.c +++ b/source/luametatex/source/lua/lmtinterface.c @@ -82,35 +82,38 @@ void lmt_initialize_interface(void) # define set_group_code_value(n,k) lmt_interface.group_code_values[n] = (value_info) { .lua = lua_key_index(k), .name = lua_key(k), .id = n } - set_group_code_value(bottom_level_group, bottomlevel); - set_group_code_value(simple_group, simple); - set_group_code_value(hbox_group, hbox); - set_group_code_value(adjusted_hbox_group, adjustedhbox); - set_group_code_value(vbox_group, vbox); - set_group_code_value(vtop_group, vtop); - set_group_code_value(align_group, align); - set_group_code_value(no_align_group, noalign); - set_group_code_value(output_group, output); - set_group_code_value(math_group, math); - set_group_code_value(discretionary_group, discretionary); - set_group_code_value(insert_group, insert); - set_group_code_value(vadjust_group, vadjust); - set_group_code_value(vcenter_group, vcenter); - set_group_code_value(math_fraction_group, mathfraction); - set_group_code_value(math_operator_group, mathoperator); - set_group_code_value(math_choice_group, mathchoice); - set_group_code_value(also_simple_group, alsosimple); - set_group_code_value(semi_simple_group, semisimple); - set_group_code_value(math_simple_group, mathsimple); - set_group_code_value(math_shift_group, mathshift); - set_group_code_value(math_fence_group, mathfence); - set_group_code_value(local_box_group, localbox); - set_group_code_value(split_off_group, splitoff); - set_group_code_value(split_keep_group, splitkeep); - set_group_code_value(preamble_group, preamble); - set_group_code_value(align_set_group, alignset); - set_group_code_value(finish_row_group, finishrow); - set_group_code_value(lua_group, lua); + set_group_code_value(bottom_level_group, bottomlevel); + set_group_code_value(simple_group, simple); + set_group_code_value(hbox_group, hbox); + set_group_code_value(adjusted_hbox_group, adjustedhbox); + set_group_code_value(vbox_group, vbox); + set_group_code_value(vtop_group, vtop); + set_group_code_value(align_group, align); + set_group_code_value(no_align_group, noalign); + set_group_code_value(output_group, output); + set_group_code_value(math_group, mathsubformula); + set_group_code_value(math_component_group, mathcomponent); + set_group_code_value(math_stack_group, mathstack); + set_group_code_value(discretionary_group, discretionary); + set_group_code_value(insert_group, insert); + set_group_code_value(vadjust_group, vadjust); + set_group_code_value(vcenter_group, vcenter); + set_group_code_value(math_fraction_group, mathfraction); + set_group_code_value(math_radical_group, mathradical); + set_group_code_value(math_operator_group, mathoperator); + set_group_code_value(math_choice_group, mathchoice); + set_group_code_value(also_simple_group, alsosimple); + set_group_code_value(semi_simple_group, semisimple); + set_group_code_value(math_simple_group, mathsimple); + set_group_code_value(math_shift_group, mathshift); + set_group_code_value(math_fence_group, mathfence); + set_group_code_value(local_box_group, localbox); + set_group_code_value(split_off_group, splitoff); + set_group_code_value(split_keep_group, splitkeep); + set_group_code_value(preamble_group, preamble); + set_group_code_value(align_set_group, alignset); + set_group_code_value(finish_row_group, finishrow); + set_group_code_value(lua_group, lua); lmt_interface.par_context_values = lmt_aux_allocate_value_info(reset_par_context); diff --git a/source/luametatex/source/lua/lmtinterface.h b/source/luametatex/source/lua/lmtinterface.h index e55b03e84..3fd87db2f 100644 --- a/source/luametatex/source/lua/lmtinterface.h +++ b/source/luametatex/source/lua/lmtinterface.h @@ -484,6 +484,7 @@ make_lua_key(L, binradspacing);\ make_lua_key(L, binrelspacing);\ make_lua_key(L, boolean);\ make_lua_key(L, bottomaccent);\ +make_lua_key(L, bottomanchor);\ make_lua_key(L, bottomaccentvariant);\ make_lua_key(L, bothflexible);\ make_lua_key(L, bottom);\ @@ -491,6 +492,7 @@ make_lua_key(L, bottomleft);\ make_lua_key(L, bottomlevel);\ make_lua_key(L, bottommargin);\ make_lua_key(L, bottomright);\ +make_lua_key(L, bottomovershoot);\ make_lua_key(L, boundary);\ make_lua_key(L, box);\ make_lua_key(L, broken);\ @@ -879,11 +881,13 @@ make_lua_key(L, math_style);\ make_lua_key(L, mathtextchar);\ make_lua_key(L, mathchar);\ make_lua_key(L, mathchoice);\ +make_lua_key(L, mathcomponent);\ make_lua_key(L, MathConstants);\ make_lua_key(L, mathcontrol);\ make_lua_key(L, mathdir);\ make_lua_key(L, mathfence);\ make_lua_key(L, mathfraction);\ +make_lua_key(L, mathradical);\ make_lua_key(L, mathkerns);\ make_lua_key(L, MathLeading);\ make_lua_key(L, mathoperator);\ @@ -894,6 +898,8 @@ make_lua_key(L, mathshapekern);\ make_lua_key(L, mathshift);\ make_lua_key(L, mathsimple);\ make_lua_key(L, mathskip);\ +make_lua_key(L, mathstack);\ +make_lua_key(L, mathsubformula);\ make_lua_key(L, mathstyle);\ make_lua_key(L, medmuskip);\ make_lua_key(L, message);\ @@ -911,6 +917,7 @@ make_lua_key(L, middlepunctspacing);\ make_lua_key(L, middleradspacing);\ make_lua_key(L, middlerelspacing);\ make_lua_key(L, MinConnectorOverlap);\ +make_lua_key(L, mirror);\ make_lua_key(L, mkern);\ make_lua_key(L, mode);\ make_lua_key(L, modeline);\ @@ -956,7 +963,6 @@ make_lua_key(L, nucleus);\ make_lua_key(L, number);\ make_lua_key(L, numerator);\ make_lua_key(L, numeratorvariant);\ -make_lua_key(L, oldmath);\ make_lua_key(L, op);\ make_lua_key(L, opbinspacing);\ make_lua_key(L, opclosespacing);\ @@ -1094,6 +1100,7 @@ make_lua_key(L, protected_call);\ make_lua_key(L, protrudechars);\ make_lua_key(L, protrusion);\ make_lua_key(L, properties);\ +make_lua_key(L, proportional);\ make_lua_key(L, ptr);\ make_lua_key(L, punct);\ make_lua_key(L, punctbinspacing);\ @@ -1352,11 +1359,13 @@ make_lua_key(L, tolerant_call);\ make_lua_key(L, tolerant_protected_call);\ make_lua_key(L, top);\ make_lua_key(L, topaccent);\ +make_lua_key(L, topanchor);\ make_lua_key(L, topaccentvariant);\ make_lua_key(L, topleft);\ make_lua_key(L, topmargin);\ make_lua_key(L, topright);\ make_lua_key(L, topskip);\ +make_lua_key(L, topovershoot);\ make_lua_key(L, total);\ make_lua_key(L, tracingparagraphs);\ make_lua_key(L, trailer);\ @@ -1662,32 +1671,6 @@ extern void lmt_initialize_interface(void); # define lmt_toroundnumber lmt_roundnumber # define lmt_touroundnumber lmt_uroundnumber -/* -# define lua_set_string_by_key(L,a,b) \ - lua_pushstring(L, b ? b : ""); \ - lua_setfield(L, -2, a); - -# define lua_set_string_by_index(L,a,b) \ - lua_pushstring(L, b ? b : ""); \ - lua_rawseti(L, -2, a); - -# define lua_set_integer_by_key(L,a,b) \ - lua_pushinteger(L, b); \ - lua_setfield(L, -2, a); - -# define lua_set_integer_by_index(L,a,b) \ - lua_pushinteger(L, b); \ - lua_rawseti(L, -2, a); - -# define lua_set_boolean_by_key(L,a,b) \ - lua_pushboolean(L, b); \ - lua_setfield(L, -2, a); - -# define lua_set_boolean_by_index(L,a,b) \ - lua_pushboolean(L, b); \ - lua_rawseti(L, -2, a); -*/ - inline static void lua_set_string_by_key(lua_State *L, const char *a, const char *b) { lua_pushstring(L, b ? b : ""); diff --git a/source/luametatex/source/lua/lmtnodelib.c b/source/luametatex/source/lua/lmtnodelib.c index ff98a7064..7d9d7bcbe 100644 --- a/source/luametatex/source/lua/lmtnodelib.c +++ b/source/luametatex/source/lua/lmtnodelib.c @@ -715,8 +715,12 @@ static int nodelib_direct_getfam(lua_State *L) case delimiter_node: lua_pushinteger(L, delimiter_small_family(n)); break; - case fraction_noad: case simple_noad: + case radical_noad: + case fraction_noad: + case accent_noad: + case fence_noad: + /*tex Not all are used or useful at the tex end! */ lua_pushinteger(L, noad_family(n)); break; case rule_node: @@ -744,8 +748,12 @@ static int nodelib_direct_setfam(lua_State *L) case delimiter_node: delimiter_small_family(n) = lmt_tohalfword(L, 2); break; - case fraction_noad: case simple_noad: + case radical_noad: + case fraction_noad: + case accent_noad: + case fence_noad: + /*tex Not all are used or useful at the tex end! */ set_noad_family(n, lmt_tohalfword(L, 2)); break; case rule_node: @@ -6557,10 +6565,7 @@ static int nodelib_common_getfield(lua_State *L, int direct, halfword n) break; case insert_node: if (lua_key_eq(s, index)) { - halfword index = lmt_tohalfword(L, 3); - if (tex_valid_insert_id(index)) { - insert_index(n) = index; - } + lua_pushinteger(L, insert_index(n)); } else if (lua_key_eq(s, cost)) { lua_pushinteger(L, insert_float_cost(n)); } else if (lua_key_eq(s, depth)) { @@ -6647,6 +6652,8 @@ static int nodelib_common_getfield(lua_State *L, int direct, halfword n) lua_pushinteger(L, get_noad_left_class(n)); lua_pushinteger(L, get_noad_right_class(n)); return 3; + } else if (lua_key_eq(s, fam)) { + lua_pushinteger(L, noad_family(n)); } else { switch(t) { case simple_noad: @@ -6678,8 +6685,6 @@ static int nodelib_common_getfield(lua_State *L, int direct, halfword n) nodelib_push_direct_or_nil(L, fraction_right_delimiter(n)); } else if (lua_key_eq(s, middle)) { nodelib_push_direct_or_nil(L, fraction_middle_delimiter(n)); - } else if (lua_key_eq(s, fam)) { - lua_pushinteger(L, noad_family(n)); } else { lua_pushnil(L); } @@ -7321,10 +7326,11 @@ static int nodelib_common_setfield(lua_State *L, int direct, halfword n) set_noad_main_class(n, c); set_noad_left_class(n, lmt_opthalfword(L, 4, c)); set_noad_right_class(n, lmt_opthalfword(L, 5, c)); + } else if (lua_key_eq(s, fam)) { + set_noad_family(n, lmt_tohalfword(L, 3)); } else { switch (t) { case simple_noad: - // return nodelib_cantset(L, n, s); break; case radical_noad: if (lua_key_eq(s, left) || lua_key_eq(s, delimiter)) { @@ -7352,8 +7358,6 @@ static int nodelib_common_setfield(lua_State *L, int direct, halfword n) fraction_right_delimiter(n) = nodelib_direct_or_node_from_index(L, direct, 3); } else if (lua_key_eq(s, middle)) { fraction_middle_delimiter(n) = nodelib_direct_or_node_from_index(L, direct, 3); - } else if (lua_key_eq(s, fam)) { - set_noad_family(n, lmt_tohalfword(L, 3)); } else { goto CANTSET; } @@ -9856,9 +9860,9 @@ halfword lmt_node_list_from_lua(lua_State *L, int n) */ void lmt_begin_paragraph_callback( - int invmode, + int invmode, int *indented, - int context + int context ) { int callback_id = lmt_callback_defined(begin_paragraph_callback); @@ -9884,7 +9888,7 @@ void lmt_begin_paragraph_callback( } void lmt_paragraph_context_callback( - int context, + int context, int *ignore ) { @@ -9975,14 +9979,14 @@ void lmt_append_line_filter_callback( void lmt_node_filter_callback( int filterid, int extrainfo, - halfword head_node, - halfword *tail_node + halfword head, + halfword *tail ) { - if (head_node) { + if (head) { /*tex We start after head (temp). */ - halfword start_node = node_next(head_node); - if (start_node) { + halfword start = node_next(head); + if (start) { int callback_id = lmt_callback_defined(filterid); if (callback_id > 0) { lua_State *L = lmt_lua_state.lua_instance; @@ -9990,33 +9994,33 @@ void lmt_node_filter_callback( if (lmt_callback_okay(L, callback_id, &top)) { int i; /*tex We make sure we have no prev */ - node_prev(start_node) = null; + node_prev(start) = null; /*tex the action */ - lmt_node_list_to_lua(L, start_node); + lmt_node_list_to_lua(L, start); lmt_push_group_code(L, extrainfo); i = lmt_callback_call(L, 2, 1, top); if (i) { lmt_callback_error(L, top, i); } else { /*tex append to old head */ - halfword start_done = lmt_node_list_from_lua(L, -1); - tex_try_couple_nodes(head_node, start_done); + halfword list = lmt_node_list_from_lua(L, -1); + tex_try_couple_nodes(head, list); /*tex redundant as we set top anyway */ lua_pop(L, 2); /*tex find tail in order to update tail */ - start_node = node_next(head_node); - if (start_node) { + start = node_next(head); + if (start) { /*tex maybe just always slide (harmless and fast) */ - halfword last_node = node_next(start_node); - while (last_node) { - start_node = last_node; - last_node = node_next(start_node); + halfword last = node_next(start); + while (last) { + start = last; + last = node_next(start); } /*tex we're at the end now */ - *tail_node = start_node; + *tail = start; } else { /*tex we're already at the end */ - *tail_node = head_node; + *tail = head; } lmt_callback_wrapup(L, top); } @@ -10032,14 +10036,14 @@ void lmt_node_filter_callback( */ int lmt_linebreak_callback( - int is_broken, - halfword head_node, - halfword *new_head + int isbroken, + halfword head, + halfword *newhead ) { - if (head_node) { - halfword start_node = node_next(head_node); - if (start_node) { + if (head) { + halfword start = node_next(head); + if (start) { int callback_id = lmt_callback_defined(linebreak_filter_callback); if (callback_id > 0) { lua_State *L = lmt_lua_state.lua_instance; @@ -10047,17 +10051,17 @@ int lmt_linebreak_callback( if (callback_id > 0 && lmt_callback_okay(L, callback_id, &top)) { int i; int ret = 0; - node_prev(start_node) = null; - lmt_node_list_to_lua(L, start_node); - lua_pushboolean(L, is_broken); + node_prev(start) = null; + lmt_node_list_to_lua(L, start); + lua_pushboolean(L, isbroken); i = lmt_callback_call(L, 2, 1, top); if (i) { lmt_callback_error(L, top, i); } else { - halfword *p = lua_touserdata(L, -1); - if (p) { - int a = lmt_node_list_from_lua(L, -1); - tex_try_couple_nodes(*new_head, a); + halfword *result = lua_touserdata(L, -1); + if (result) { + halfword list = lmt_node_list_from_lua(L, -1); + tex_try_couple_nodes(*newhead, list); ret = 1; } lmt_callback_wrapup(L, top); @@ -10071,22 +10075,22 @@ int lmt_linebreak_callback( } void lmt_alignment_callback( - halfword head_node, + halfword head, halfword context, - halfword attr_list, + halfword attrlist, halfword preamble ) { - if (head_node || preamble) { + if (head || preamble) { int callback_id = lmt_callback_defined(alignment_filter_callback); if (callback_id > 0) { lua_State *L = lmt_lua_state.lua_instance; int top = 0; if (lmt_callback_okay(L, callback_id, &top)) { int i; - lmt_node_list_to_lua(L, head_node); + lmt_node_list_to_lua(L, head); lmt_push_alignment_context(L, context); - lmt_node_list_to_lua(L, attr_list); + lmt_node_list_to_lua(L, attrlist); lmt_node_list_to_lua(L, preamble); i = lmt_callback_call(L, 4, 0, top); if (i) { @@ -10106,16 +10110,16 @@ void lmt_local_box_callback( halfword rightbox, halfword middlebox, halfword linenumber, - scaled leftskip, - scaled rightskip, - scaled lefthang, - scaled righthang, - scaled indentation, - scaled parinitleftskip, - scaled parinitrightskip, - scaled parfillleftskip, - scaled parfillrightskip, - scaled overshoot + scaled leftskip, + scaled rightskip, + scaled lefthang, + scaled righthang, + scaled indentation, + scaled parinitleftskip, + scaled parinitrightskip, + scaled parfillleftskip, + scaled parfillrightskip, + scaled overshoot ) { if (linebox) { @@ -10160,11 +10164,11 @@ void lmt_local_box_callback( int lmt_append_to_vlist_callback( halfword box, int location, - halfword prev_depth, + halfword prevdepth, halfword *result, - int *next_depth, - int *prev_set, - int *check_depth + int *nextdepth, + int *prevset, + int *checkdepth ) { if (box) { @@ -10176,7 +10180,7 @@ int lmt_append_to_vlist_callback( int i; lmt_node_list_to_lua(L, box); lua_push_key_by_index(location); - lua_pushinteger(L, (int) prev_depth); + lua_pushinteger(L, (int) prevdepth); i = lmt_callback_call(L, 3, 3, top); if (i) { lmt_callback_error(L, top, i); @@ -10193,11 +10197,11 @@ int lmt_append_to_vlist_callback( break; } if (lua_type(L, -2) == LUA_TNUMBER) { - *next_depth = lmt_roundnumber(L, -2); - *prev_set = 1; + *nextdepth = lmt_roundnumber(L, -2); + *prevset = 1; } if (*result && lua_type(L, -1) == LUA_TBOOLEAN) { - *check_depth = lua_toboolean(L, -1); + *checkdepth = lua_toboolean(L, -1); } lmt_callback_wrapup(L, top); return 1; @@ -10214,28 +10218,28 @@ int lmt_append_to_vlist_callback( */ halfword lmt_hpack_filter_callback( - halfword head_node, + halfword head, scaled size, - int pack_type, + int packtype, int extrainfo, - int pack_direction, + int direction, halfword attr ) { - if (head_node) { + if (head) { int callback_id = lmt_callback_defined(hpack_filter_callback); if (callback_id > 0) { lua_State *L = lmt_lua_state.lua_instance; int top = 0; if (lmt_callback_okay(L, callback_id, &top)) { int i; - node_prev(head_node) = null; - lmt_node_list_to_lua(L, head_node); + node_prev(head) = null; + lmt_node_list_to_lua(L, head); lmt_push_group_code(L, extrainfo); lua_pushinteger(L, size); - lmt_push_pack_type(L, pack_type); - if (pack_direction >= 0) { - lua_pushinteger(L, pack_direction); + lmt_push_pack_type(L, packtype); + if (direction >= 0) { + lua_pushinteger(L, direction); } else { lua_pushnil(L); } @@ -10245,13 +10249,13 @@ halfword lmt_hpack_filter_callback( if (i) { lmt_callback_error(L, top, i); } else { - head_node = lmt_node_list_from_lua(L, -1); + head = lmt_node_list_from_lua(L, -1); lmt_callback_wrapup(L, top); } } } } - return head_node; + return head; } extern halfword lmt_packed_vbox_filter_callback( @@ -10282,30 +10286,30 @@ extern halfword lmt_packed_vbox_filter_callback( } halfword lmt_vpack_filter_callback( - halfword head_node, + halfword head, scaled size, - int pack_type, - scaled maxd, + int packtype, + scaled maxdepth, int extrainfo, - int pack_direction, + int direction, halfword attr ) { - if (head_node) { + if (head) { int callback_id = lmt_callback_defined(extrainfo == output_group ? pre_output_filter_callback : vpack_filter_callback); if (callback_id > 0) { lua_State *L = lmt_lua_state.lua_instance; int top = 0; if (lmt_callback_okay(L, callback_id, &top)) { int i; - node_prev(head_node) = null; - lmt_node_list_to_lua(L, head_node); + node_prev(head) = null; + lmt_node_list_to_lua(L, head); lmt_push_group_code(L, extrainfo); lua_pushinteger(L, size); - lmt_push_pack_type(L, pack_type); - lua_pushinteger(L, maxd); - if (pack_direction >= 0) { - lua_pushinteger(L, pack_direction); + lmt_push_pack_type(L, packtype); + lua_pushinteger(L, maxdepth); + if (direction >= 0) { + lua_pushinteger(L, direction); } else { lua_pushnil(L); } @@ -10314,11 +10318,11 @@ halfword lmt_vpack_filter_callback( if (i) { lmt_callback_error(L, top, i); } else { - head_node = lmt_node_list_from_lua(L, -1); + head = lmt_node_list_from_lua(L, -1); lmt_callback_wrapup(L, top); } } } } - return head_node; + return head; } diff --git a/source/luametatex/source/lua/lmtnodelib.h b/source/luametatex/source/lua/lmtnodelib.h index 6894104b2..c32be142d 100644 --- a/source/luametatex/source/lua/lmtnodelib.h +++ b/source/luametatex/source/lua/lmtnodelib.h @@ -18,21 +18,21 @@ extern halfword lmt_check_isdirectornode (lua_State *L, int i, int *isdirect); extern void lmt_initialize_properties (int set_size); extern halfword lmt_hpack_filter_callback( - halfword head_node, + halfword head, scaled size, - int pack_type, + int packtype, int extrainfo, - int d, + int direction, halfword a ); extern halfword lmt_vpack_filter_callback( - halfword head_node, + halfword head, scaled size, - int pack_type, - scaled maxd, + int packtype, + scaled depth, int extrainfo, - int d, + int direction, halfword a ); @@ -44,20 +44,20 @@ extern halfword lmt_packed_vbox_filter_callback( extern void lmt_node_filter_callback( int filterid, int extrainfo, - halfword head_node, - halfword *tail_node + halfword head, + halfword *tail ); extern int lmt_linebreak_callback( - int is_broken, - halfword head_node, - halfword *new_head + int isbroken, + halfword head, + halfword *newhead ); extern void lmt_alignment_callback( - halfword head_node, + halfword head, halfword context, - halfword attr_list, + halfword attrlist, halfword preamble ); @@ -67,26 +67,26 @@ extern void lmt_local_box_callback( halfword rightbox, halfword middlebox, halfword linenumber, - scaled leftskip, - scaled rightskip, - scaled lefthang, - scaled righthang, - scaled indentation, - scaled parinitleftskip, - scaled parinitrightskip, - scaled parfillleftskip, - scaled parfillrightskip, - scaled overshoot + scaled leftskip, + scaled rightskip, + scaled lefthang, + scaled righthang, + scaled indentation, + scaled parinitleftskip, + scaled parinitrightskip, + scaled parfillleftskip, + scaled parfillrightskip, + scaled overshoot ); extern int lmt_append_to_vlist_callback( halfword box, int location, - halfword prev_depth, + halfword prevdepth, halfword *result, - int *next_depth, - int *prev_set, - int *check_depth + int *nextdepth, + int *prevset, + int *checkdepth ); extern void lmt_begin_paragraph_callback( diff --git a/source/luametatex/source/lua/lmttexlib.c b/source/luametatex/source/lua/lmttexlib.c index 12510206a..d44127330 100644 --- a/source/luametatex/source/lua/lmttexlib.c +++ b/source/luametatex/source/lua/lmttexlib.c @@ -1392,27 +1392,6 @@ static int texlib_getdimen(lua_State *L) return 1; } -// static halfword texlib_aux_make_glue(lua_State *L, int top, int slot) -// { -// halfword value = copy_node(zero_glue); -// if (++slot <= top) { -// glue_amount(value) = lmt_toroundnumber(L, slot); -// if (++slot <= top) { -// glue_stretch(value) = lmt_toroundnumber(L, slot); -// if (++slot <= top) { -// glue_shrink(value) = lmt_toroundnumber(L, slot); -// if (++slot <= top) { -// glue_stretch_order(value) = lmt_tohalfword(L, slot); -// if (++slot <= top) { -// glue_shrink_order(value) = lmt_tohalfword(L, slot); -// } -// } -// } -// } -// } -// return value; -// } - static halfword texlib_aux_make_glue(lua_State *L, int top, int slot) { halfword value = tex_copy_node(zero_glue); @@ -2624,6 +2603,7 @@ static int texlib_aux_convert(lua_State *L, int cur_code) case insert_progress_code: /* arg */ case lua_code: /* arg complex */ case lua_escape_string_code: /* arg token list */ + /* case lua_token_string_code: */ /* arg token list */ case string_code: /* arg token */ case cs_string_code: /* arg token */ case detokenized_code: /* arg token */ @@ -4361,7 +4341,7 @@ static int texlib_runstring(lua_State *L) static int texlib_getmathdir(lua_State *L) { lua_pushinteger(L, math_direction_par); - return 0; + return 1; } static int texlib_setmathdir(lua_State *L) @@ -4824,6 +4804,7 @@ static int texlib_getnoadoptionvalues(lua_State *L) lua_push_key_at_index(L, auto, noad_option_auto); lua_push_key_at_index(L, unrolllist, noad_option_unroll_list); lua_push_key_at_index(L, followedbyspace, noad_option_followed_by_space); + lua_push_key_at_index(L, proportional, noad_option_proportional); return 1; } @@ -4943,6 +4924,7 @@ static int texlib_getmathclassoptionvalues(lua_State *L) lua_set_string_by_index(L, prefer_delimiter_dimensions_class_option, "preferdelimiterdimensions"); lua_set_string_by_index(L, auto_inject_class_option, "autoinject"); lua_set_string_by_index(L, remove_italic_correction_class_option, "removeitaliccorrection"); + lua_set_string_by_index(L, operator_italic_correction_class_option, "operatoritaliccorrection"); return 1; } @@ -5025,6 +5007,20 @@ static int texlib_getfrozenparvalues(lua_State *L) return 1; } +static int texlib_getkerneloptionvalues(lua_State *L) +{ + lua_createtable(L, 2, 6); + lua_set_string_by_index(L, math_kernel_no_italic_correction, "noitaliccorrection"); + lua_set_string_by_index(L, math_kernel_no_left_pair_kern, "noleftpairkern"); + lua_set_string_by_index(L, math_kernel_no_right_pair_kern, "norightpairkern"); + lua_set_string_by_index(L, math_kernel_auto_discretionary, "autodiscretionary"); + lua_set_string_by_index(L, math_kernel_full_discretionary, "fulldiscretionary"); + lua_set_string_by_index(L, math_kernel_ignored_character, "ignoredcharacter"); + lua_set_string_by_index(L, math_kernel_is_large_operator, "islargeoperator"); + lua_set_string_by_index(L, math_kernel_has_italic_shape, "hasitalicshape"); + return 1; +} + static int texlib_getshapingpenaltiesvalues(lua_State *L) { lua_createtable(L, 2, 2); @@ -5035,7 +5031,6 @@ static int texlib_getshapingpenaltiesvalues(lua_State *L) return 1; } - static int texlib_getprimitiveorigins(lua_State *L) { lua_createtable(L, 2, 1); @@ -5163,7 +5158,7 @@ static int texlib_getdiscstatevalues(lua_State *L) static int texlib_getmathcontrolvalues(lua_State *L) { - lua_createtable(L, 2, 19); + lua_createtable(L, 2, 21); lua_set_string_by_index(L, math_control_use_font_control, "usefontcontrol"); lua_set_string_by_index(L, math_control_over_rule, "overrule"); lua_set_string_by_index(L, math_control_under_rule, "underrule"); @@ -5185,6 +5180,8 @@ static int texlib_getmathcontrolvalues(lua_State *L) lua_set_string_by_index(L, math_control_analyze_script_nucleus_char, "analyzescriptnucleuschar"); lua_set_string_by_index(L, math_control_analyze_script_nucleus_list, "analyzescriptnucleuslist"); lua_set_string_by_index(L, math_control_analyze_script_nucleus_box, "analyzescriptnucleusbox"); + lua_set_string_by_index(L, math_control_accent_top_skew_with_offset, "accenttopskewwithoffset"); + lua_set_string_by_index(L, math_control_ignore_kern_dimensions, "ignorekerndimensions"); return 1; } @@ -5484,6 +5481,7 @@ static const struct luaL_Reg texlib_function_list[] = { { "getprimitiveorigins", texlib_getprimitiveorigins }, { "getfrozenparvalues", texlib_getfrozenparvalues }, { "getshapingpenaltiesvalues", texlib_getshapingpenaltiesvalues }, + { "getkerneloptionvalues", texlib_getkerneloptionvalues }, { "getspecialmathclassvalues", texlib_getspecialmathclassvalues }, { "getlargestusedmark", texlib_getlargestusedmark }, { "getoutputactive", texlib_getoutputactive }, diff --git a/source/luametatex/source/lua/lmttokenlib.c b/source/luametatex/source/lua/lmttokenlib.c index 896b22eec..ac69241ba 100644 --- a/source/luametatex/source/lua/lmttokenlib.c +++ b/source/luametatex/source/lua/lmttokenlib.c @@ -3146,9 +3146,9 @@ static int tokenlib_save_lua(lua_State *L) while (1) { --ptr; switch (save_type(ptr)) { - case level_boundary: + case level_boundary_save_type: goto SAVE; - case restore_lua: + case restore_lua_save_type: if (save_value(ptr) == f) { return 0; } else { @@ -3158,7 +3158,7 @@ static int tokenlib_save_lua(lua_State *L) } } SAVE: - tex_save_halfword_on_stack(restore_lua, f); + tex_save_halfword_on_stack(restore_lua_save_type, f); return 0; } diff --git a/source/luametatex/source/luacore/lua54/src/lobject.c b/source/luametatex/source/luacore/lua54/src/lobject.c index a2c006098..03e2798ca 100644 --- a/source/luametatex/source/luacore/lua54/src/lobject.c +++ b/source/luametatex/source/luacore/lua54/src/lobject.c @@ -62,7 +62,7 @@ static lua_Integer intarith (lua_State *L, int op, lua_Integer v1, case LUA_OPBOR: return intop(|, v1, v2); case LUA_OPBXOR: return intop(^, v1, v2); case LUA_OPSHL: return luaV_shiftl(v1, v2); - case LUA_OPSHR: return luaV_shiftl(v1, -v2); + case LUA_OPSHR: return luaV_shiftr(v1, v2); case LUA_OPUNM: return intop(-, 0, v1); case LUA_OPBNOT: return intop(^, ~l_castS2U(0), v1); default: lua_assert(0); return 0; diff --git a/source/luametatex/source/luacore/lua54/src/loslib.c b/source/luametatex/source/luacore/lua54/src/loslib.c index 3e20d622b..854dcf691 100644 --- a/source/luametatex/source/luacore/lua54/src/loslib.c +++ b/source/luametatex/source/luacore/lua54/src/loslib.c @@ -260,9 +260,7 @@ static int getfield (lua_State *L, const char *key, int d, int delta) { res = d; } else { - /* unsigned avoids overflow when lua_Integer has 32 bits */ - if (!(res >= 0 ? (lua_Unsigned)res <= (lua_Unsigned)INT_MAX + delta - : (lua_Integer)INT_MIN + delta <= res)) + if (!(res >= 0 ? res - delta <= INT_MAX : INT_MIN + delta <= res)) return luaL_error(L, "field '%s' is out-of-bound", key); res -= delta; } diff --git a/source/luametatex/source/luacore/lua54/src/lutf8lib.c b/source/luametatex/source/luacore/lua54/src/lutf8lib.c index e7bf098f6..3a5b9bc38 100644 --- a/source/luametatex/source/luacore/lua54/src/lutf8lib.c +++ b/source/luametatex/source/luacore/lua54/src/lutf8lib.c @@ -25,6 +25,9 @@ #define MAXUTF 0x7FFFFFFFu + +#define MSGInvalid "invalid UTF-8 code" + /* ** Integer type for decoded UTF-8 values; MAXUTF needs 31 bits. */ @@ -35,7 +38,8 @@ typedef unsigned long utfint; #endif -#define iscont(p) ((*(p) & 0xC0) == 0x80) +#define iscont(c) (((c) & 0xC0) == 0x80) +#define iscontp(p) iscont(*(p)) /* from strlib */ @@ -65,7 +69,7 @@ static const char *utf8_decode (const char *s, utfint *val, int strict) { int count = 0; /* to count number of continuation bytes */ for (; c & 0x40; c <<= 1) { /* while it needs continuation bytes... */ unsigned int cc = (unsigned char)s[++count]; /* read next byte */ - if ((cc & 0xC0) != 0x80) /* not a continuation byte? */ + if (!iscont(cc)) /* not a continuation byte? */ return NULL; /* invalid byte sequence */ res = (res << 6) | (cc & 0x3F); /* add lower 6 bits from cont. byte */ } @@ -140,7 +144,7 @@ static int codepoint (lua_State *L) { utfint code; s = utf8_decode(s, &code, !lax); if (s == NULL) - return luaL_error(L, "invalid UTF-8 code"); + return luaL_error(L, MSGInvalid); lua_pushinteger(L, code); n++; } @@ -190,16 +194,16 @@ static int byteoffset (lua_State *L) { "position out of bounds"); if (n == 0) { /* find beginning of current byte sequence */ - while (posi > 0 && iscont(s + posi)) posi--; + while (posi > 0 && iscontp(s + posi)) posi--; } else { - if (iscont(s + posi)) + if (iscontp(s + posi)) return luaL_error(L, "initial position is a continuation byte"); if (n < 0) { while (n < 0 && posi > 0) { /* move back */ do { /* find beginning of previous character */ posi--; - } while (posi > 0 && iscont(s + posi)); + } while (posi > 0 && iscontp(s + posi)); n++; } } @@ -208,7 +212,7 @@ static int byteoffset (lua_State *L) { while (n > 0 && posi < (lua_Integer)len) { do { /* find beginning of next character */ posi++; - } while (iscont(s + posi)); /* (cannot pass final '\0') */ + } while (iscontp(s + posi)); /* (cannot pass final '\0') */ n--; } } @@ -226,15 +230,15 @@ static int iter_aux (lua_State *L, int strict) { const char *s = luaL_checklstring(L, 1, &len); lua_Unsigned n = (lua_Unsigned)lua_tointeger(L, 2); if (n < len) { - while (iscont(s + n)) n++; /* skip continuation bytes */ + while (iscontp(s + n)) n++; /* go to next character */ } if (n >= len) /* (also handles original 'n' being negative) */ return 0; /* no more codepoints */ else { utfint code; const char *next = utf8_decode(s + n, &code, strict); - if (next == NULL) - return luaL_error(L, "invalid UTF-8 code"); + if (next == NULL || iscontp(next)) + return luaL_error(L, MSGInvalid); lua_pushinteger(L, n + 1); lua_pushinteger(L, code); return 2; @@ -253,7 +257,8 @@ static int iter_auxlax (lua_State *L) { static int iter_codes (lua_State *L) { int lax = lua_toboolean(L, 2); - luaL_checkstring(L, 1); + const char *s = luaL_checkstring(L, 1); + luaL_argcheck(L, !iscontp(s), 1, MSGInvalid); lua_pushcfunction(L, lax ? iter_auxlax : iter_auxstrict); lua_pushvalue(L, 1); lua_pushinteger(L, 0); diff --git a/source/luametatex/source/luacore/lua54/src/lvm.c b/source/luametatex/source/luacore/lua54/src/lvm.c index 614df0557..73a19ba9b 100644 --- a/source/luametatex/source/luacore/lua54/src/lvm.c +++ b/source/luametatex/source/luacore/lua54/src/lvm.c @@ -765,12 +765,10 @@ lua_Number luaV_modf (lua_State *L, lua_Number m, lua_Number n) { /* number of bits in an integer */ #define NBITS cast_int(sizeof(lua_Integer) * CHAR_BIT) + /* ** Shift left operation. (Shift right just negates 'y'.) */ -#define luaV_shiftr(x,y) luaV_shiftl(x,intop(-, 0, y)) - - lua_Integer luaV_shiftl (lua_Integer x, lua_Integer y) { if (y < 0) { /* shift right? */ if (y <= -NBITS) return 0; diff --git a/source/luametatex/source/luacore/lua54/src/lvm.h b/source/luametatex/source/luacore/lua54/src/lvm.h index 1bc16f3a5..dba1ad277 100644 --- a/source/luametatex/source/luacore/lua54/src/lvm.h +++ b/source/luametatex/source/luacore/lua54/src/lvm.h @@ -110,6 +110,11 @@ typedef enum { luaC_barrierback(L, gcvalue(t), v); } +/* +** Shift right is the same as shift left with a negative 'y' +*/ +#define luaV_shiftr(x,y) luaV_shiftl(x,intop(-, 0, y)) + LUAI_FUNC int luaV_equalobj (lua_State *L, const TValue *t1, const TValue *t2); diff --git a/source/luametatex/source/luametatex.h b/source/luametatex/source/luametatex.h index c2536f461..32fd78f6d 100644 --- a/source/luametatex/source/luametatex.h +++ b/source/luametatex/source/luametatex.h @@ -76,6 +76,7 @@ 2.09.35 : near the end of 2021 (so close to the 2.10 release date) 2.09.55 : in July 2022 (the official release of the new math engine) 2.10.00 : a few days before the ctx 2022 meeting (starting September 19) + 2.10.01 : mid October 2022 At some point the \CONTEXT\ group will be responsible for guaranteeing that the official version is what comes with \CONTEXT\ and that long term support and stabilty is guaranteed and that no @@ -86,9 +87,9 @@ # include "tex/textypes.h" # define luametatex_version 210 -# define luametatex_revision 00 -# define luametatex_version_string "2.10.00" -# define luametatex_development_id 20220918 +# define luametatex_revision 01 +# define luametatex_version_string "2.10.01" +# define luametatex_development_id 20221014 # define luametatex_name_camelcase "LuaMetaTeX" # define luametatex_name_lowercase "luametatex" diff --git a/source/luametatex/source/mp/mpc/mp.c b/source/luametatex/source/mp/mpc/mp.c index 0e9c4bf2d..993bf98fb 100644 --- a/source/luametatex/source/mp/mpc/mp.c +++ b/source/luametatex/source/mp/mpc/mp.c @@ -1882,6 +1882,8 @@ static const char *mp_op_string (int c) case mp_unequal_operation : return "<>"; case mp_concatenate_operation : return "&"; case mp_just_append_operation : return "&&"; + case mp_tolerant_concat_operation : return "&&&"; + case mp_tolerant_append_operation : return "&&&&"; case mp_rotated_operation : return "rotated"; case mp_slanted_operation : return "slanted"; case mp_scaled_operation : return "scaled"; @@ -17230,6 +17232,8 @@ static void mp_do_binary (MP mp, mp_node p, int c) break; case mp_concatenate_operation: case mp_just_append_operation: + case mp_tolerant_concat_operation: + case mp_tolerant_append_operation: if ((mp->cur_exp.type == mp_string_type) && (mp_type(p) == mp_string_type)) { mp_string str = mp_cat(mp, mp_get_value_str(p), cur_exp_str); delete_str_ref(cur_exp_str) ; @@ -21505,7 +21509,7 @@ static int mp_scan_path (MP mp) mp_left_type(pp) = mp_open_knot; mp_right_type(qq) = mp_open_knot; } - if (d == mp_ampersand_command && dd != mp_just_append_operation) { + if (d == mp_ampersand_command && dd != mp_just_append_operation && dd != mp_tolerant_concat_operation && dd != mp_tolerant_append_operation) { if (! (number_equal(path_q->x_coord, pp->x_coord)) || ! (number_equal(path_q->y_coord, pp->y_coord))) { mp_back_error( mp, @@ -21524,6 +21528,22 @@ static int mp_scan_path (MP mp) number_clone(pp->right_given, x); } if (d == mp_ampersand_command) { + if (dd == mp_tolerant_concat_operation || dd == mp_tolerant_append_operation) { + mp_number dx, dy; + set_number_from_subtraction(dx, path_q->x_coord, pp->x_coord); + set_number_from_subtraction(dy, path_q->y_coord, pp->y_coord); + number_abs(dx); + number_abs(dy); + if (number_lessequal(dx, epsilon_t) && number_lessequal(dy, epsilon_t)) { + set_number_half_from_addition(dx, path_q->x_coord, pp->x_coord); + set_number_half_from_addition(dy, path_q->y_coord, pp->y_coord); + number_clone(pp->left_x, dx); + number_clone(path_q->right_x, dx); + number_clone(pp->left_y, dy); + number_clone(path_q->right_y, dy); + } + dd = dd == mp_tolerant_concat_operation ? mp_concatenate_operation : mp_just_append_operation; + } if (dd == mp_just_append_operation) { mp_left_type(pp) = mp_explicit_knot; mp_right_type(path_q) = mp_explicit_knot; @@ -21927,6 +21947,8 @@ void mp_final_cleanup (MP mp) mp_primitive(mp, "mpversion", mp_nullary_command, mp_version_operation); mp_primitive(mp, "&", mp_ampersand_command, mp_concatenate_operation); mp_primitive(mp, "&&", mp_ampersand_command, mp_just_append_operation); + mp_primitive(mp, "&&&", mp_ampersand_command, mp_tolerant_concat_operation); + mp_primitive(mp, "&&&&", mp_ampersand_command, mp_tolerant_append_operation); mp_primitive(mp, "rotated", mp_secondary_binary_command, mp_rotated_operation); mp_primitive(mp, "slanted", mp_secondary_binary_command, mp_slanted_operation); mp_primitive(mp, "scaled", mp_secondary_binary_command, mp_scaled_operation); diff --git a/source/luametatex/source/mp/mpc/mp.h b/source/luametatex/source/mp/mpc/mp.h index 252a625aa..2542bffaa 100644 --- a/source/luametatex/source/mp/mpc/mp.h +++ b/source/luametatex/source/mp/mpc/mp.h @@ -606,6 +606,8 @@ typedef enum mp_name_type_type { mp_unequal_operation, mp_concatenate_operation, mp_just_append_operation, + mp_tolerant_concat_operation, + mp_tolerant_append_operation, mp_rotated_operation, mp_slanted_operation, mp_scaled_operation, diff --git a/source/luametatex/source/mp/mpw/mp.w b/source/luametatex/source/mp/mpw/mp.w index 017cc0fd7..a7a1a9b7d 100644 --- a/source/luametatex/source/mp/mpw/mp.w +++ b/source/luametatex/source/mp/mpw/mp.w @@ -2552,117 +2552,119 @@ use a function call), @d mp_min_of_operation mp_substring_operation @= -mp_true_operation, /* operation code for |true| */ -mp_false_operation, /* operation code for |false| */ -mp_null_picture_operation, /* operation code for |nullpicture| */ -mp_null_pen_operation, /* operation code for |nullpen| */ -mp_read_string_operation, /* operation code for |readstring| */ -mp_pen_circle_operation, /* operation code for |pencircle| */ -mp_normal_deviate_operation, /* operation code for |normaldeviate| */ -mp_read_from_operation, /* operation code for |readfrom| */ -mp_close_from_operation, /* operation code for |closefrom| */ -mp_odd_operation, /* operation code for |odd| */ -mp_known_operation, /* operation code for |known| */ -mp_unknown_operation, /* operation code for |unknown| */ -mp_not_operation, /* operation code for |not| */ -mp_decimal_operation, /* operation code for |decimal| */ -mp_reverse_operation, /* operation code for |reverse| */ -mp_uncycle_operation, /* operation code for |uncycle| */ -mp_make_path_operation, /* operation code for |makepath| */ -mp_make_pen_operation, /* operation code for |makepen| */ -mp_make_nep_operation, /* operation code for |makenep| */ -mp_convexed_operation, /* operation code for |convexed| */ -mp_uncontrolled_operation, /* operation code for |uncontrolled| */ -mp_oct_operation, /* operation code for |oct| */ -mp_hex_operation, /* operation code for |hex| */ -mp_ASCII_operation, /* operation code for |ASCII| */ -mp_char_operation, /* operation code for |char| */ -mp_length_operation, /* operation code for |length| */ -mp_turning_operation, /* operation code for |turningnumber| */ -mp_color_model_operation, /* operation code for |colormodel| */ -mp_path_part_operation, /* operation code for |pathpart| */ -mp_pen_part_operation, /* operation code for |penpart| */ -mp_dash_part_operation, /* operation code for |dashpart| */ -mp_prescript_part_operation, /* operation code for |prescriptpart| */ -mp_postscript_part_operation, /* operation code for |postscriptpart| */ -mp_stacking_part_operation, /* operation code for |stackingpart| */ -mp_sqrt_operation, /* operation code for |sqrt| */ -mp_m_exp_operation, /* operation code for |mexp| */ -mp_m_log_operation, /* operation code for |mlog| */ -mp_sin_d_operation, /* operation code for |sind| */ -mp_cos_d_operation, /* operation code for |cosd| */ -mp_floor_operation, /* operation code for |floor| */ -mp_uniform_deviate_operation, /* operation code for |uniformdeviate| */ -mp_ll_corner_operation, /* operation code for |llcorner| */ -mp_lr_corner_operation, /* operation code for |lrcorner| */ -mp_ul_corner_operation, /* operation code for |ulcorner| */ -mp_ur_corner_operation, /* operation code for |urcorner| */ -mp_center_of_operation, /* operation code for |centerof| */ -mp_center_of_mass_operation, /* operation code for |centerofmass| */ -mp_corners_operation, /* operation code for |corners| */ -mp_x_range_operation, /* operation code for |xrange| */ -mp_y_range_operation, /* operation code for |yrange| */ -mp_delta_point_operation, /* operation code for |deltapoint| */ -mp_delta_precontrol_operation, /* operation code for |deltaprecontrol| */ -mp_delta_postcontrol_operation,/* operation code for |deltapostcontrol| */ -mp_delta_direction_operation, /* operation code for |deltadirection| */ -mp_arc_length_operation, /* operation code for |arclength| */ -mp_angle_operation, /* operation code for |angle| */ -mp_cycle_operation, /* operation code for |cycle| */ -mp_no_cycle_operation, /* operation code for |nocycle| */ -mp_filled_operation, /* operation code for |filled| */ -mp_stroked_operation, /* operation code for |stroked| */ -mp_clipped_operation, /* operation code for |clipped| */ -mp_grouped_operation, /* operation code for |bounded| */ -mp_bounded_operation, /* operation code for |grouped| */ -mp_plus_operation, /* operation code for \.+ */ -mp_minus_operation, /* operation code for \.- */ -mp_times_operation, /* operation code for \.* */ -mp_over_operation, /* operation code for \./ */ -mp_power_operation, /* operation code for \.^ */ -mp_pythag_add_operation, /* operation code for |++| */ -mp_pythag_sub_operation, /* operation code for |+-+| */ -mp_or_operation, /* operation code for |or| */ -mp_and_operation, /* operation code for |and| */ -mp_less_than_operation, /* operation code for \.< */ -mp_less_or_equal_operation, /* operation code for |<=| */ -mp_greater_than_operation, /* operation code for \.> */ -mp_greater_or_equal_operation, /* operation code for |>=| */ -mp_equal_operation, /* operation code for \.= */ -mp_unequal_operation, /* operation code for |<>| */ -mp_concatenate_operation, /* operation code for \.\& */ -mp_just_append_operation, /* operation code for \.\&\& */ -mp_rotated_operation, /* operation code for |rotated| */ -mp_slanted_operation, /* operation code for |slanted| */ -mp_scaled_operation, /* operation code for |scaled| */ -mp_shifted_operation, /* operation code for |shifted| */ -mp_transformed_operation, /* operation code for |transformed| */ -mp_uncycled_operation, /* operation code for |uncycled| */ -mp_x_scaled_operation, /* operation code for |xscaled| */ -mp_y_scaled_operation, /* operation code for |yscaled| */ -mp_z_scaled_operation, /* operation code for |zscaled| */ -mp_intertimes_operation, /* operation code for |intersectiontimes| */ -mp_intertimes_list_operation, /* operation code for |intersectiontimeslist| */ -mp_double_dot_operation, /* operation code for improper |..| */ -mp_substring_operation, /* operation code for |substring| */ -mp_subpath_operation, /* operation code for |subpath| */ -mp_direction_time_operation, /* operation code for |directiontime| */ -mp_point_operation, /* operation code for |point| */ -mp_precontrol_operation, /* operation code for |precontrol| */ -mp_postcontrol_operation, /* operation code for |postcontrol| */ -mp_direction_operation, /* operation code for |direction| */ -mp_path_point_operation, /* operation code for |pathpoint| */ -mp_path_precontrol_operation, /* operation code for |pathprecontrol| */ -mp_path_postcontrol_operation, /* operation code for |pathpostcontrol| */ -mp_path_direction_operation, /* operation code for |pathdirection| */ -mp_pen_offset_operation, /* operation code for |penoffset| */ -mp_arc_time_operation, /* operation code for |arctime| */ -mp_arc_point_operation, /* operation code for |arcpoint| */ -mp_arc_point_list_operation, /* operation code for |arcpointlist| */ -mp_subarc_length_operation, /* operation code for |subarclength| */ -mp_version_operation, /* operation code for |mpversion| */ -mp_envelope_operation, /* operation code for |envelope| */ -mp_boundingpath_operation, /* operation code for |boundingpath| */ +mp_true_operation, /* operation code for |true| */ +mp_false_operation, /* operation code for |false| */ +mp_null_picture_operation, /* operation code for |nullpicture| */ +mp_null_pen_operation, /* operation code for |nullpen| */ +mp_read_string_operation, /* operation code for |readstring| */ +mp_pen_circle_operation, /* operation code for |pencircle| */ +mp_normal_deviate_operation, /* operation code for |normaldeviate| */ +mp_read_from_operation, /* operation code for |readfrom| */ +mp_close_from_operation, /* operation code for |closefrom| */ +mp_odd_operation, /* operation code for |odd| */ +mp_known_operation, /* operation code for |known| */ +mp_unknown_operation, /* operation code for |unknown| */ +mp_not_operation, /* operation code for |not| */ +mp_decimal_operation, /* operation code for |decimal| */ +mp_reverse_operation, /* operation code for |reverse| */ +mp_uncycle_operation, /* operation code for |uncycle| */ +mp_make_path_operation, /* operation code for |makepath| */ +mp_make_pen_operation, /* operation code for |makepen| */ +mp_make_nep_operation, /* operation code for |makenep| */ +mp_convexed_operation, /* operation code for |convexed| */ +mp_uncontrolled_operation, /* operation code for |uncontrolled| */ +mp_oct_operation, /* operation code for |oct| */ +mp_hex_operation, /* operation code for |hex| */ +mp_ASCII_operation, /* operation code for |ASCII| */ +mp_char_operation, /* operation code for |char| */ +mp_length_operation, /* operation code for |length| */ +mp_turning_operation, /* operation code for |turningnumber| */ +mp_color_model_operation, /* operation code for |colormodel| */ +mp_path_part_operation, /* operation code for |pathpart| */ +mp_pen_part_operation, /* operation code for |penpart| */ +mp_dash_part_operation, /* operation code for |dashpart| */ +mp_prescript_part_operation, /* operation code for |prescriptpart| */ +mp_postscript_part_operation, /* operation code for |postscriptpart| */ +mp_stacking_part_operation, /* operation code for |stackingpart| */ +mp_sqrt_operation, /* operation code for |sqrt| */ +mp_m_exp_operation, /* operation code for |mexp| */ +mp_m_log_operation, /* operation code for |mlog| */ +mp_sin_d_operation, /* operation code for |sind| */ +mp_cos_d_operation, /* operation code for |cosd| */ +mp_floor_operation, /* operation code for |floor| */ +mp_uniform_deviate_operation, /* operation code for |uniformdeviate| */ +mp_ll_corner_operation, /* operation code for |llcorner| */ +mp_lr_corner_operation, /* operation code for |lrcorner| */ +mp_ul_corner_operation, /* operation code for |ulcorner| */ +mp_ur_corner_operation, /* operation code for |urcorner| */ +mp_center_of_operation, /* operation code for |centerof| */ +mp_center_of_mass_operation, /* operation code for |centerofmass| */ +mp_corners_operation, /* operation code for |corners| */ +mp_x_range_operation, /* operation code for |xrange| */ +mp_y_range_operation, /* operation code for |yrange| */ +mp_delta_point_operation, /* operation code for |deltapoint| */ +mp_delta_precontrol_operation, /* operation code for |deltaprecontrol| */ +mp_delta_postcontrol_operation, /* operation code for |deltapostcontrol| */ +mp_delta_direction_operation, /* operation code for |deltadirection| */ +mp_arc_length_operation, /* operation code for |arclength| */ +mp_angle_operation, /* operation code for |angle| */ +mp_cycle_operation, /* operation code for |cycle| */ +mp_no_cycle_operation, /* operation code for |nocycle| */ +mp_filled_operation, /* operation code for |filled| */ +mp_stroked_operation, /* operation code for |stroked| */ +mp_clipped_operation, /* operation code for |clipped| */ +mp_grouped_operation, /* operation code for |bounded| */ +mp_bounded_operation, /* operation code for |grouped| */ +mp_plus_operation, /* operation code for \.+ */ +mp_minus_operation, /* operation code for \.- */ +mp_times_operation, /* operation code for \.* */ +mp_over_operation, /* operation code for \./ */ +mp_power_operation, /* operation code for \.^ */ +mp_pythag_add_operation, /* operation code for |++| */ +mp_pythag_sub_operation, /* operation code for |+-+| */ +mp_or_operation, /* operation code for |or| */ +mp_and_operation, /* operation code for |and| */ +mp_less_than_operation, /* operation code for \.< */ +mp_less_or_equal_operation, /* operation code for |<=| */ +mp_greater_than_operation, /* operation code for \.> */ +mp_greater_or_equal_operation, /* operation code for |>=| */ +mp_equal_operation, /* operation code for \.= */ +mp_unequal_operation, /* operation code for |<>| */ +mp_concatenate_operation, /* operation code for \.\& */ +mp_just_append_operation, /* operation code for \.\&\& */ +mp_tolerant_concat_operation, /* operation code for \.\&\&\& */ +mp_tolerant_append_operation, /* operation code for \.\&\&\&\& */ +mp_rotated_operation, /* operation code for |rotated| */ +mp_slanted_operation, /* operation code for |slanted| */ +mp_scaled_operation, /* operation code for |scaled| */ +mp_shifted_operation, /* operation code for |shifted| */ +mp_transformed_operation, /* operation code for |transformed| */ +mp_uncycled_operation, /* operation code for |uncycled| */ +mp_x_scaled_operation, /* operation code for |xscaled| */ +mp_y_scaled_operation, /* operation code for |yscaled| */ +mp_z_scaled_operation, /* operation code for |zscaled| */ +mp_intertimes_operation, /* operation code for |intersectiontimes| */ +mp_intertimes_list_operation, /* operation code for |intersectiontimeslist| */ +mp_double_dot_operation, /* operation code for improper |..| */ +mp_substring_operation, /* operation code for |substring| */ +mp_subpath_operation, /* operation code for |subpath| */ +mp_direction_time_operation, /* operation code for |directiontime| */ +mp_point_operation, /* operation code for |point| */ +mp_precontrol_operation, /* operation code for |precontrol| */ +mp_postcontrol_operation, /* operation code for |postcontrol| */ +mp_direction_operation, /* operation code for |direction| */ +mp_path_point_operation, /* operation code for |pathpoint| */ +mp_path_precontrol_operation, /* operation code for |pathprecontrol| */ +mp_path_postcontrol_operation, /* operation code for |pathpostcontrol| */ +mp_path_direction_operation, /* operation code for |pathdirection| */ +mp_pen_offset_operation, /* operation code for |penoffset| */ +mp_arc_time_operation, /* operation code for |arctime| */ +mp_arc_point_operation, /* operation code for |arcpoint| */ +mp_arc_point_list_operation, /* operation code for |arcpointlist| */ +mp_subarc_length_operation, /* operation code for |subarclength| */ +mp_version_operation, /* operation code for |mpversion| */ +mp_envelope_operation, /* operation code for |envelope| */ +mp_boundingpath_operation, /* operation code for |boundingpath| */ @ @c static const char *mp_op_string (int c) @@ -2765,6 +2767,8 @@ static const char *mp_op_string (int c) case mp_unequal_operation : return "<>"; case mp_concatenate_operation : return "&"; case mp_just_append_operation : return "&&"; + case mp_tolerant_concat_operation : return "&&&"; + case mp_tolerant_append_operation : return "&&&&"; case mp_rotated_operation : return "rotated"; case mp_slanted_operation : return "slanted"; case mp_scaled_operation : return "scaled"; @@ -21665,7 +21669,7 @@ static int mp_scan_path (MP mp) Join the partial paths and reset |p| and |q| to the head and tail of the result */ - if (d == mp_ampersand_command && dd != mp_just_append_operation) { + if (d == mp_ampersand_command && dd != mp_just_append_operation && dd != mp_tolerant_concat_operation && dd != mp_tolerant_append_operation) { if (! (number_equal(path_q->x_coord, pp->x_coord)) || ! (number_equal(path_q->y_coord, pp->y_coord))) { mp_back_error( mp, @@ -21687,6 +21691,22 @@ static int mp_scan_path (MP mp) } if (d == mp_ampersand_command) { /* Splice independent paths together */ + if (dd == mp_tolerant_concat_operation || dd == mp_tolerant_append_operation) { + mp_number dx, dy; + set_number_from_subtraction(dx, path_q->x_coord, pp->x_coord); + set_number_from_subtraction(dy, path_q->y_coord, pp->y_coord); + number_abs(dx); + number_abs(dy); + if (number_lessequal(dx, epsilon_t) && number_lessequal(dy, epsilon_t)) { + set_number_half_from_addition(dx, path_q->x_coord, pp->x_coord); + set_number_half_from_addition(dy, path_q->y_coord, pp->y_coord); + number_clone(pp->left_x, dx); + number_clone(path_q->right_x, dx); + number_clone(pp->left_y, dy); + number_clone(path_q->right_y, dy); + } + dd = dd == mp_tolerant_concat_operation ? mp_concatenate_operation : mp_just_append_operation; + } if (dd == mp_just_append_operation) { mp_left_type(pp) = mp_explicit_knot; mp_right_type(path_q) = mp_explicit_knot; @@ -22222,6 +22242,10 @@ mp_primitive(mp, "&", mp_ampersand_command, mp_concatenate_operation); @:!!!}{|\&| primitive@> mp_primitive(mp, "&&", mp_ampersand_command, mp_just_append_operation); @:!!!!!!}{|\&\&| primitive@> +mp_primitive(mp, "&&&", mp_ampersand_command, mp_tolerant_concat_operation); +@:!!!!!!!!!}{|\&\&\&| primitive@> +mp_primitive(mp, "&&&&", mp_ampersand_command, mp_tolerant_append_operation); +@:!!!!!!!!!!!!}{|\&\&\&\&| primitive@> mp_primitive(mp, "rotated", mp_secondary_binary_command, mp_rotated_operation); @:rotated_}{|rotated| primitive@> mp_primitive(mp, "slanted", mp_secondary_binary_command, mp_slanted_operation); @@ -24891,6 +24915,8 @@ static void mp_do_binary (MP mp, mp_node p, int c) break; case mp_concatenate_operation: case mp_just_append_operation: + case mp_tolerant_concat_operation: + case mp_tolerant_append_operation: if ((mp->cur_exp.type == mp_string_type) && (mp_type(p) == mp_string_type)) { mp_string str = mp_cat(mp, mp_get_value_str(p), cur_exp_str); delete_str_ref(cur_exp_str) ; diff --git a/source/luametatex/source/tex/texadjust.c b/source/luametatex/source/tex/texadjust.c index 279af8950..cb2f8c247 100644 --- a/source/luametatex/source/tex/texadjust.c +++ b/source/luametatex/source/tex/texadjust.c @@ -134,12 +134,12 @@ void tex_run_vadjust(void) scaled depthafter = 0; halfword attrlist = null; tex_scan_adjust_keys(&options, &code, &index, &depthbefore, &depthafter, &attrlist); - tex_set_saved_record(saved_adjust_item_location, saved_adjust_location, 0, code); - tex_set_saved_record(saved_adjust_item_options, saved_adjust_options, 0, options); - tex_set_saved_record(saved_adjust_item_index, saved_adjust_index, 0, index); - tex_set_saved_record(saved_adjust_item_attr_list, saved_adjust_attr_list, 0, attrlist); - tex_set_saved_record(saved_adjust_item_depth_before, saved_adjust_depth_before, 0, depthbefore); - tex_set_saved_record(saved_adjust_item_depth_after, saved_adjust_depth_after, 0, depthafter); + tex_set_saved_record(saved_adjust_item_location, adjust_location_save_type, 0, code); + tex_set_saved_record(saved_adjust_item_options, adjust_options_save_type, 0, options); + tex_set_saved_record(saved_adjust_item_index, adjust_index_save_type, 0, index); + tex_set_saved_record(saved_adjust_item_attr_list, adjust_attr_list_save_type, 0, attrlist); + tex_set_saved_record(saved_adjust_item_depth_before, adjust_depth_before_save_type, 0, depthbefore); + tex_set_saved_record(saved_adjust_item_depth_after, adjust_depth_after_save_type, 0, depthafter); lmt_save_state.save_stack_data.ptr += saved_adjust_n_of_items; tex_new_save_level(vadjust_group); tex_scan_left_brace(); diff --git a/source/luametatex/source/tex/texalign.c b/source/luametatex/source/tex/texalign.c index 207895a6d..ac7712870 100644 --- a/source/luametatex/source/tex/texalign.c +++ b/source/luametatex/source/tex/texalign.c @@ -549,12 +549,12 @@ static void tex_aux_scan_align_spec(quarterword c) } /*tex Now we're referenced. We need to preserve this over the group. */ add_attribute_reference(attrlist); - tex_set_saved_record(saved_align_specification, saved_box_spec, mode, amount); + tex_set_saved_record(saved_align_specification, box_spec_save_type, mode, amount); /* We save them but could put them in the state as we do for some anyway. */ - tex_set_saved_record(saved_align_reverse, saved_box_reverse, reverse, 0); - tex_set_saved_record(saved_align_discard, saved_box_discard, noskips ? 0 : discard, 0); - tex_set_saved_record(saved_align_noskips, saved_box_noskips, noskips, 0); - tex_set_saved_record(saved_align_callback, saved_box_callback, callback, 0); + tex_set_saved_record(saved_align_reverse, box_reverse_save_type, reverse, 0); + tex_set_saved_record(saved_align_discard, box_discard_save_type, noskips ? 0 : discard, 0); + tex_set_saved_record(saved_align_noskips, box_noskips_save_type, noskips, 0); + tex_set_saved_record(saved_align_callback, box_callback_save_type, callback, 0); lmt_save_state.save_stack_data.ptr += saved_align_n_of_items; tex_new_save_level(c); if (! brace) { diff --git a/source/luametatex/source/tex/texbuildpage.c b/source/luametatex/source/tex/texbuildpage.c index a0b5882dd..0e2883305 100644 --- a/source/luametatex/source/tex/texbuildpage.c +++ b/source/luametatex/source/tex/texbuildpage.c @@ -177,15 +177,6 @@ void tex_initialize_buildpage(void) |last_node_type| are similar. And finally, |insert_penalties| holds the sum of the penalties associated with all split and floating insertions. -*/ - -void tex_print_page_totals(void) -{ - tex_print_format("%P", page_total, page_stretch, page_filstretch, page_fillstretch, page_filllstretch, page_shrink); -} - -/*tex - Here is a procedure that is called when the |page_contents| is changing from |empty| to |inserts_only| or |box_there|. diff --git a/source/luametatex/source/tex/texbuildpage.h b/source/luametatex/source/tex/texbuildpage.h index 328bed2a1..20d8416f5 100644 --- a/source/luametatex/source/tex/texbuildpage.h +++ b/source/luametatex/source/tex/texbuildpage.h @@ -78,7 +78,6 @@ extern void tex_initialize_buildpage (void); extern void tex_initialize_pagestate (void); extern void tex_build_page (void); extern void tex_resume_after_output (void); -extern void tex_print_page_totals (void); /*tex The tail of the contribution list: */ diff --git a/source/luametatex/source/tex/texcommands.c b/source/luametatex/source/tex/texcommands.c index 3ac1a7b23..f0949b9ab 100644 --- a/source/luametatex/source/tex/texcommands.c +++ b/source/luametatex/source/tex/texcommands.c @@ -229,18 +229,11 @@ void tex_initialize_commands(void) tex_primitive(luatex_command, "localinterlinepenalty", internal_int_cmd, local_interline_penalty_code, internal_int_base); tex_primitive(luatex_command, "luacopyinputnodes", internal_int_cmd, copy_lua_input_nodes_code, internal_int_base); tex_primitive(luatex_command, "mathcheckfencesmode", internal_int_cmd, math_check_fences_mode_code, internal_int_base); - /* tex_primitive(luatex_command, "mathdelimitersmode", internal_int_cmd, math_delimiters_mode_code, internal_int_base); */ - /* tex_primitive(luatex_command, "mathfencesmode", internal_int_cmd, math_fences_mode_code, internal_int_base); */ tex_primitive(luatex_command, "mathslackmode", internal_int_cmd, math_slack_mode_code, internal_int_base); - /* tex_primitive(luatex_command, "mathflattenmode", internal_int_cmd, math_flatten_mode_code, internal_int_base); */ tex_primitive(luatex_command, "mathpenaltiesmode", internal_int_cmd, math_penalties_mode_code, internal_int_base); - /* tex_primitive(luatex_command, "mathrulethicknessmode", internal_int_cmd, math_rule_thickness_mode_code, internal_int_base); */ tex_primitive(luatex_command, "mathscriptsmode", internal_int_cmd, math_scripts_mode_code, internal_int_base); - /* tex_primitive(luatex_command, "mathscriptboxmode", internal_int_cmd, math_script_box_mode_code, internal_int_base); */ - /* tex_primitive(luatex_command, "mathscriptcharmode", internal_int_cmd, math_script_char_mode_code, internal_int_base); */ tex_primitive(luatex_command, "mathsurroundmode", internal_int_cmd, math_skip_mode_code, internal_int_base); tex_primitive(luatex_command, "mathdoublescriptmode", internal_int_cmd, math_double_script_mode_code, internal_int_base); - /* tex_primitive(luatex_command, "mathcontrolmode", internal_int_cmd, math_control_mode_code, internal_int_base); */ tex_primitive(luatex_command, "mathfontcontrol", internal_int_cmd, math_font_control_code, internal_int_base); tex_primitive(luatex_command, "mathdisplaymode", internal_int_cmd, math_display_mode_code, internal_int_base); tex_primitive(luatex_command, "mathdictgroup", internal_int_cmd, math_dict_group_code, internal_int_base); @@ -424,7 +417,6 @@ void tex_initialize_commands(void) tex_primitive(tex_command, "mathchar", math_char_number_cmd, math_char_number_code, 0); tex_primitive(luatex_command, "Umathchar", math_char_number_cmd, math_xchar_number_code, 0); tex_primitive(luatex_command, "Umathdict", math_char_number_cmd, math_dchar_number_code, 0); - /* tex_primitive(luatex_command, "Umathcharnum", math_char_number_cmd, math_uchar_number_code, 0); */ tex_primitive(luatex_command, "Umathclass", math_char_number_cmd, math_class_number_code, 0); tex_primitive(tex_command, "mathchoice", math_choice_cmd, math_choice_code, 0); @@ -668,6 +660,7 @@ void tex_initialize_commands(void) tex_primitive(luatex_command, "formatname", convert_cmd, format_name_code, 0); tex_primitive(luatex_command, "luabytecode", convert_cmd, lua_bytecode_code, 0); tex_primitive(luatex_command, "luaescapestring", convert_cmd, lua_escape_string_code, 0); + /* tex_primitive(luatex_command, "luatokenstring", convert_cmd, lua_token_string_code, 0); */ tex_primitive(luatex_command, "luafunction", convert_cmd, lua_function_code, 0); tex_primitive(luatex_command, "luatexbanner", convert_cmd, luatex_banner_code, 0); tex_primitive(luatex_command, "Uchar", convert_cmd, uchar_code, 0); @@ -700,6 +693,8 @@ void tex_initialize_commands(void) tex_primitive(luatex_command, "ifincsname", if_test_cmd, if_in_csname_code, 0); /* This is obsolete and might be dropped. */ tex_primitive(luatex_command, "ifabsnum", if_test_cmd, if_abs_int_code, 0); tex_primitive(luatex_command, "ifabsdim", if_test_cmd, if_abs_dim_code, 0); + tex_primitive(luatex_command, "ifzeronum", if_test_cmd, if_zero_int_code, 0); + tex_primitive(luatex_command, "ifzerodim", if_test_cmd, if_zero_dim_code, 0); tex_primitive(luatex_command, "ifchknum", if_test_cmd, if_chk_int_code, 0); tex_primitive(luatex_command, "ifchkdim", if_test_cmd, if_chk_dim_code, 0); tex_primitive(luatex_command, "ifcmpnum", if_test_cmd, if_cmp_int_code, 0); @@ -733,11 +728,7 @@ void tex_initialize_commands(void) tex_primitive(tex_command, "atopwithdelims", math_fraction_cmd, math_atop_delimited_code, 0); tex_primitive(tex_command, "over", math_fraction_cmd, math_over_code, 0); tex_primitive(tex_command, "overwithdelims", math_fraction_cmd, math_over_delimited_code, 0); - /* tex_primitive(luatex_command, "skewed", math_fraction_cmd, math_skewed_code, 0); */ /* makes no sense */ - /* tex_primitive(luatex_command, "skewedwithdelims", math_fraction_cmd, math_skewed_delimited_code, 0); */ /* makes no sense */ - /* tex_primitive(luatex_command, "stretched", math_fraction_cmd, math_stretched_code, 0); */ /* makes no sense */ - /* tex_primitive(luatex_command, "stretchedwithdelims", math_fraction_cmd, math_stretched_delimited_code, 0); */ /* makes no sense */ - + tex_primitive(luatex_command, "Uabove", math_fraction_cmd, math_u_above_code, 0); tex_primitive(luatex_command, "Uabovewithdelims", math_fraction_cmd, math_u_above_delimited_code, 0); tex_primitive(luatex_command, "Uatop", math_fraction_cmd, math_u_atop_code, 0); @@ -770,9 +761,7 @@ void tex_initialize_commands(void) tex_primitive(tex_command, "delcode", define_char_code_cmd, delcode_charcode, 0); tex_primitive(luatex_command, "Umathcode", define_char_code_cmd, extmathcode_charcode, 0); - /* tex_primitive(luatex_command, "Umathcodenum", define_char_code_cmd, extmathcodenum_charcode, 0); */ tex_primitive(luatex_command, "Udelcode", define_char_code_cmd, extdelcode_charcode, 0); - /* tex_primitive(luatex_command, "Udelcodenum", define_char_code_cmd, extdelcodenum_charcode, 0); */ tex_primitive(tex_command, "edef", def_cmd, expanded_def_code, 0); tex_primitive(tex_command, "def", def_cmd, def_code, 0); @@ -928,7 +917,9 @@ void tex_initialize_commands(void) tex_primitive(luatex_command, "allscriptstyles", math_style_cmd, all_script_styles, 0); tex_primitive(luatex_command, "allscriptscriptstyles", math_style_cmd, all_script_script_styles, 0); tex_primitive(luatex_command, "allmathstyles", math_style_cmd, all_math_styles, 0); + tex_primitive(luatex_command, "allmainstyles", math_style_cmd, all_main_styles, 0); tex_primitive(luatex_command, "allsplitstyles", math_style_cmd, all_split_styles, 0); + tex_primitive(luatex_command, "allunsplitstyles", math_style_cmd, all_unsplit_styles, 0); tex_primitive(luatex_command, "alluncrampedstyles", math_style_cmd, all_uncramped_styles, 0); tex_primitive(luatex_command, "allcrampedstyles", math_style_cmd, all_cramped_styles, 0); @@ -987,7 +978,6 @@ void tex_initialize_commands(void) /* tex_primitive(tex_command, "stringdef", shorthand_def_cmd, string_def_code, 0); */ tex_primitive(luatex_command, "Umathchardef", shorthand_def_cmd, math_xchar_def_code, 0); tex_primitive(luatex_command, "Umathdictdef", shorthand_def_cmd, math_dchar_def_code, 0); - /* tex_primitive(luatex_command, "Umathcharnumdef", shorthand_def_cmd, math_uchar_def_code, 0); */ tex_primitive(luatex_command, "attributedef", shorthand_def_cmd, attribute_def_code, 0); tex_primitive(luatex_command, "luadef", shorthand_def_cmd, lua_def_code, 0); tex_primitive(luatex_command, "integerdef", shorthand_def_cmd, integer_def_code, 0); @@ -1246,25 +1236,25 @@ void tex_initialize_commands(void) tex_primitive(no_command, "insertedpar", end_paragraph_cmd, inserted_end_paragraph_code, 0); tex_primitive(no_command, "newlinepar", end_paragraph_cmd, new_line_end_paragraph_code, 0); - /* tex_primitive(luatex_command, "linepar", undefined_cs_cmd, 0, 0); */ /*tex A user can define this one.*/ - - tex_primitive(tex_command, "endgroup", end_group_cmd, semi_simple_group_code, 0); - tex_primitive(luatex_command, "endsimplegroup", end_group_cmd, also_simple_group_code, 0); - tex_primitive(luatex_command, "endmathgroup", end_group_cmd, math_simple_group_code, 0); - - tex_primitive(tex_command, "relax", relax_cmd, relax_code, 0); - tex_primitive(luatex_command, "norelax", relax_cmd, no_relax_code, 0); - tex_primitive(no_command, "noexpandrelax", relax_cmd, no_expand_relax_code, 0); - - tex_primitive(tex_command, "fi", if_test_cmd, fi_code, 0); - tex_primitive(no_command, "noif", if_test_cmd, no_if_code, 0); - - tex_primitive(no_command, "always", prefix_cmd, always_code, 0); - - tex_primitive(tex_command, "nullfont", set_font_cmd, null_font, 0); - - tex_primitive(tex_command, "crcr", alignment_cmd, cr_cr_code, 0); - tex_primitive(tex_command, "cr", alignment_cmd, cr_code, 0); + /* tex_primitive(luatex_command, "linepar", undefined_cs_cmd, 0, 0); */ /*tex A user can define this one.*/ + + tex_primitive(tex_command, "endgroup", end_group_cmd, semi_simple_group_code, 0); + tex_primitive(luatex_command, "endsimplegroup", end_group_cmd, also_simple_group_code, 0); + tex_primitive(luatex_command, "endmathgroup", end_group_cmd, math_simple_group_code, 0); + + tex_primitive(tex_command, "relax", relax_cmd, relax_code, 0); + tex_primitive(luatex_command, "norelax", relax_cmd, no_relax_code, 0); + tex_primitive(no_command, "noexpandrelax", relax_cmd, no_expand_relax_code, 0); + + tex_primitive(tex_command, "fi", if_test_cmd, fi_code, 0); + tex_primitive(no_command, "noif", if_test_cmd, no_if_code, 0); + + tex_primitive(no_command, "always", prefix_cmd, always_code, 0); + + tex_primitive(tex_command, "nullfont", set_font_cmd, null_font, 0); + + tex_primitive(tex_command, "crcr", alignment_cmd, cr_cr_code, 0); + tex_primitive(tex_command, "cr", alignment_cmd, cr_code, 0); tex_aux_copy_deep_frozen_from_primitive(deep_frozen_cs_end_group_code, "endgroup"); tex_aux_copy_deep_frozen_from_primitive(deep_frozen_cs_relax_code, "relax"); diff --git a/source/luametatex/source/tex/texcommands.h b/source/luametatex/source/tex/texcommands.h index 66fabb47e..792e23662 100644 --- a/source/luametatex/source/tex/texcommands.h +++ b/source/luametatex/source/tex/texcommands.h @@ -189,8 +189,6 @@ typedef enum tex_command_code { during expansion of this serializer prefix. */ char_given_cmd, /*tex character code defined by |\chardef| */ - // math_char_given_cmd, /*tex math code defined by |\mathchardef| */ - // math_char_xgiven_cmd, /*tex math code defined by |\Umathchardef| or |\Umathcharnumdef| */ some_item_cmd, /*tex most recent item (|\lastpenalty|, |\lastkern|, |\lastskip| and more) */ /*tex The previous command was described as \quotation {the last that cannot be prefixed by @@ -429,35 +427,36 @@ typedef enum auxiliary_codes { # define last_auxiliary_code insert_mode_code typedef enum convert_codes { - number_code, /*tex command code for |\number| */ - to_integer_code, /*tex command code for |\tointeger| (also gobbles |\relax|) */ - to_hexadecimal_code, /*tex command code for |\tohexadecimal| */ - to_scaled_code, /*tex command code for |\toscaled| (also gobbles |\relax|) */ - to_sparse_scaled_code, /*tex command code for |\tosparsescaled| (also gobbles |\relax|) */ - to_dimension_code, /*tex command code for |\todimension| (also gobbles |\relax|) */ - to_sparse_dimension_code, /*tex command code for |\tosparsedimension| */ - to_mathstyle_code, /*tex command code for |\tomathstyle| */ - lua_code, /*tex command code for |\directlua| */ - lua_function_code, /*tex command code for |\luafunction| */ - lua_bytecode_code, /*tex command code for |\luabytecode| */ - expanded_code, /*tex command code for |\expanded| */ - semi_expanded_code, /*tex command code for |\constantexpanded| */ - string_code, /*tex command code for |\string| */ - cs_string_code, /*tex command code for |\csstring| */ - detokenized_code, /*tex command code for |\detokenized| */ - roman_numeral_code, /*tex command code for |\romannumeral| */ - meaning_code, /*tex command code for |\meaning| */ - meaning_full_code, /*tex command code for |\meaningfull| */ - meaning_less_code, /*tex command code for |\meaningless| */ - meaning_asis_code, /*tex command code for |\meaningasis| */ - uchar_code, /*tex command code for |\Uchar| */ - lua_escape_string_code, /*tex command code for |\luaescapestring| */ - font_name_code, /*tex command code for |\fontname| */ - font_specification_code, /*tex command code for |\fontspecification| */ - job_name_code, /*tex command code for |\jobname| */ - format_name_code, /*tex command code for |\AlephVersion| */ - luatex_banner_code, /*tex command code for |\luatexbanner| */ - font_identifier_code, /*tex command code for |tex.fontidentifier| (virtual) */ + number_code, /*tex command code for |\number| */ + to_integer_code, /*tex command code for |\tointeger| (also gobbles |\relax|) */ + to_hexadecimal_code, /*tex command code for |\tohexadecimal| */ + to_scaled_code, /*tex command code for |\toscaled| (also gobbles |\relax|) */ + to_sparse_scaled_code, /*tex command code for |\tosparsescaled| (also gobbles |\relax|) */ + to_dimension_code, /*tex command code for |\todimension| (also gobbles |\relax|) */ + to_sparse_dimension_code, /*tex command code for |\tosparsedimension| */ + to_mathstyle_code, /*tex command code for |\tomathstyle| */ + lua_code, /*tex command code for |\directlua| */ + lua_function_code, /*tex command code for |\luafunction| */ + lua_bytecode_code, /*tex command code for |\luabytecode| */ + expanded_code, /*tex command code for |\expanded| */ + semi_expanded_code, /*tex command code for |\constantexpanded| */ + string_code, /*tex command code for |\string| */ + cs_string_code, /*tex command code for |\csstring| */ + detokenized_code, /*tex command code for |\detokenized| */ + roman_numeral_code, /*tex command code for |\romannumeral| */ + meaning_code, /*tex command code for |\meaning| */ + meaning_full_code, /*tex command code for |\meaningfull| */ + meaning_less_code, /*tex command code for |\meaningless| */ + meaning_asis_code, /*tex command code for |\meaningasis| */ + uchar_code, /*tex command code for |\Uchar| */ + lua_escape_string_code, /*tex command code for |\luaescapestring| */ + /* lua_token_string_code, */ /*tex command code for |\luatokenstring| */ + font_name_code, /*tex command code for |\fontname| */ + font_specification_code, /*tex command code for |\fontspecification| */ + job_name_code, /*tex command code for |\jobname| */ + format_name_code, /*tex command code for |\AlephVersion| */ + luatex_banner_code, /*tex command code for |\luatexbanner| */ + font_identifier_code, /*tex command code for |tex.fontidentifier| (virtual) */ } convert_codes; # define first_convert_code number_code @@ -670,7 +669,6 @@ typedef enum shorthand_def_codes { math_char_def_code, /*tex |\mathchardef| */ math_xchar_def_code, /*tex |\Umathchardef| */ math_dchar_def_code, /*tex |\Umathdictdef| */ - /* math_uchar_def_code, */ /* |\Umathcharnumdef| */ count_def_code, /*tex |\countdef| */ attribute_def_code, /*tex |\attributedef| */ dimen_def_code, /*tex |\dimendef| */ @@ -700,7 +698,6 @@ typedef enum math_char_number_codes { math_char_number_code, /*tex |\mathchar| */ math_xchar_number_code, /*tex |\Umathchar| */ math_dchar_number_code, /*tex |\Umathdict| */ - /* math_uchar_number_code, */ /* |\Umathcharnum| */ math_class_number_code, /*tex |\Umathclass| */ } math_char_number_codes; @@ -1034,14 +1031,11 @@ typedef enum charcode_codes { hmcode_charcode, mathcode_charcode, extmathcode_charcode, - /* extmathcodenum_charcode, */ delcode_charcode, extdelcode_charcode, - /* extdelcodenum_charcode, */ } charcode_codes; # define first_charcode_code catcode_charcode -/*define last_charcode_code extdelcodenum_charcode */ # define last_charcode_code extdelcode_charcode typedef enum math_styles { @@ -1063,7 +1057,9 @@ typedef enum math_styles { all_script_styles, all_script_script_styles, all_math_styles, + all_main_styles, all_split_styles, + all_unsplit_styles, all_uncramped_styles, all_cramped_styles, } math_styles; diff --git a/source/luametatex/source/tex/texconditional.c b/source/luametatex/source/tex/texconditional.c index 95035f43e..b25bdfbbe 100644 --- a/source/luametatex/source/tex/texconditional.c +++ b/source/luametatex/source/tex/texconditional.c @@ -506,6 +506,11 @@ void tex_conditional_if(halfword code, int unless) } } goto RESULT; + case if_zero_int_code: + { + result = tex_scan_int(0, NULL) == 0; + } + goto RESULT; case if_abs_dim_code: case if_dim_code: /*tex @@ -533,6 +538,11 @@ void tex_conditional_if(halfword code, int unless) } } goto RESULT; + case if_zero_dim_code: + { + result = tex_scan_dimen(0, 0, 0, 0, NULL) == 0; + } + goto RESULT; case if_odd_code: /*tex Test if an integer is odd. */ { diff --git a/source/luametatex/source/tex/texconditional.h b/source/luametatex/source/tex/texconditional.h index f3de5dcdb..a0c22cd38 100644 --- a/source/luametatex/source/tex/texconditional.h +++ b/source/luametatex/source/tex/texconditional.h @@ -45,14 +45,19 @@ typedef enum if_test_codes { or_else_code, /*tex |\orelse| */ or_unless_code, /*tex |\orunless| */ - /*tex Here come the \if... codes: */ + /*tex + Here come the \if... codes. Some are just there to minimize tracing and are not faster, + like |\ifzerodim| (we can use |\ifcase| instead but not with |\unless|). + */ if_char_code, /*tex |\if| */ if_cat_code, /*tex |\ifcat| */ - if_abs_int_code, /*tex |\ifabsnum| */ if_int_code, /*tex |\ifnum| */ - if_abs_dim_code, /*tex |\ifabsdim| */ + if_abs_int_code, /*tex |\ifabsnum| */ + if_zero_int_code, /*tex |\ifzeronum|*/ if_dim_code, /*tex |\ifdim| */ + if_abs_dim_code, /*tex |\ifabsdim| */ + if_zero_dim_code, /*tex |\ifzerodim| */ if_odd_code, /*tex |\ifodd| */ if_vmode_code, /*tex |\ifvmode| */ if_hmode_code, /*tex |\ifhmode| */ @@ -93,7 +98,7 @@ typedef enum if_test_codes { if_has_toks_code, /*tex |\ifhastoks| */ if_has_xtoks_code, /*tex |\ifhasxtoks| */ if_has_char_code, /*tex |\ifhaschar| */ - if_insert_code /*tex |\ifinsert| */ + if_insert_code, /*tex |\ifinsert| */ // if_bitwise_and_code, /*tex |\ifbitwiseand| */ } if_test_codes; diff --git a/source/luametatex/source/tex/texdumpdata.c b/source/luametatex/source/tex/texdumpdata.c index 58f9e4442..dfac980c5 100644 --- a/source/luametatex/source/tex/texdumpdata.c +++ b/source/luametatex/source/tex/texdumpdata.c @@ -5,8 +5,8 @@ # include "luametatex.h" dump_state_info lmt_dump_state = { - .format_identifier = 0, - .format_name = 0 + .fingerprint = luametatex_format_fingerprint, + .padding = 0 }; /*tex @@ -54,9 +54,7 @@ dump_state_info lmt_dump_state = { static int tex_aux_report_dump_state(dumpstream f, int pos, const char *what) { int tmp = ftell(f); - tex_print_int(tmp - pos); - tex_print_char(' '); - tex_print_str(what); + tex_print_format("%i %s", tmp - pos, what); fflush(stdout); return tmp; } @@ -94,37 +92,26 @@ static void tex_aux_undump_fingerprint(dumpstream f) static void tex_aux_dump_final_check(dumpstream f) { - dump_int(f, lmt_dump_state.format_identifier); - dump_int(f, lmt_dump_state.format_name); dump_via_int(f, luametatex_format_fingerprint); } static void tex_aux_undump_final_check(dumpstream f) { int x; - undump_int(f, lmt_dump_state.format_identifier); - if (lmt_dump_state.format_identifier < 0 || lmt_dump_state.format_identifier > lmt_string_pool_state.string_pool_data.ptr) { - goto BAD; - } - undump_int(f, lmt_dump_state.format_name); - if (lmt_dump_state.format_name < 0 || lmt_dump_state.format_name > lmt_string_pool_state.string_pool_data.ptr) { - goto BAD; - } undump_int(f, x); if (x == luametatex_format_fingerprint) { return; + } else { + tex_fatal_undump_error("final fingerprint"); } - BAD: - tex_fatal_undump_error("final fingerprint"); } static void tex_aux_create_fmt_name(void) { lmt_print_state.selector = new_string_selector_code; - tex_print_format("%s %i.%i.%i",lmt_fileio_state.fmt_name, year_par, month_par, day_par); - lmt_dump_state.format_identifier = tex_make_string(); - tex_print_str(lmt_fileio_state.job_name); - lmt_dump_state.format_name = tex_make_string(); +// lmt_dump_state.format_identifier = tex_make_string(); +// lmt_dump_state.format_name = tex_make_string(); + tex_print_format("%s %i.%i.%i %s",lmt_fileio_state.fmt_name, year_par, month_par, day_par, lmt_fileio_state.job_name); lmt_print_state.selector = terminal_and_logfile_selector_code; } @@ -221,7 +208,7 @@ void tex_store_fmt_file(void) } tex_print_nlp(); - tex_print_format("Dumping format '%T' in file '%s': ", lmt_dump_state.format_identifier, lmt_fileio_state.fmt_name); + tex_print_format("Dumping format in file '%s': ", lmt_fileio_state.fmt_name); fflush(stdout); tex_compact_tokens(); @@ -322,10 +309,7 @@ int tex_load_fmt_file(void) void tex_initialize_dump_state(void) { - lmt_dump_state.format_name = get_nullstr(); - if (lmt_main_state.run_state == initializing_state) { - lmt_dump_state.format_identifier = tex_maketexstring(" (INITEX)"); - } else { - lmt_dump_state.format_identifier = 0; + if (! lmt_engine_state.dump_name) { + lmt_engine_state.dump_name = lmt_memory_strdup("initex"); } } diff --git a/source/luametatex/source/tex/texdumpdata.h b/source/luametatex/source/tex/texdumpdata.h index 6a9e11a7d..bea80869d 100644 --- a/source/luametatex/source/tex/texdumpdata.h +++ b/source/luametatex/source/tex/texdumpdata.h @@ -55,13 +55,13 @@ */ -# define luametatex_format_fingerprint 670 +# define luametatex_format_fingerprint 674 /* These end up in the string pool. */ typedef struct dump_state_info { - strnumber format_identifier; - strnumber format_name; + int fingerprint; + int padding; } dump_state_info; extern dump_state_info lmt_dump_state; diff --git a/source/luametatex/source/tex/texequivalents.c b/source/luametatex/source/tex/texequivalents.c index 7cc249a2e..291126fff 100644 --- a/source/luametatex/source/tex/texequivalents.c +++ b/source/luametatex/source/tex/texequivalents.c @@ -110,10 +110,7 @@ static void tex_aux_show_eqtb(halfword n); static void tex_aux_diagnostic_trace(halfword p, const char *s) { tex_begin_diagnostic(); - /* print_format ... */ - tex_print_char('{'); - tex_print_str(s); - tex_print_char(' '); + tex_print_format("{%s ", s); tex_aux_show_eqtb(p); tex_print_char('}'); tex_end_diagnostic(); @@ -449,8 +446,8 @@ void tex_new_save_level(quarterword c) /*tex We begin a new level of grouping. */ if (tex_room_on_save_stack()) { save_attribute_state_before(); - tex_set_saved_record(saved_group_line_number, saved_line_number, 0, lmt_input_state.input_line); - tex_set_saved_record(saved_group_level_boundary, level_boundary, cur_group, cur_boundary); + tex_set_saved_record(saved_group_line_number, line_number_save_type, 0, lmt_input_state.input_line); + tex_set_saved_record(saved_group_level_boundary, level_boundary_save_type, cur_group, cur_boundary); /*tex eventually we will have bumped |lmt_save_state.save_stack_data.ptr| by |saved_group_n_of_items|! */ ++lmt_save_state.save_stack_data.ptr; if (cur_level == max_quarterword) { @@ -510,7 +507,7 @@ static int tex_aux_save_value(int id) static int tex_aux_saved_box_spec(halfword *packing, halfword *amount) { - int i = tex_aux_found_save_type(saved_box_spec); + int i = tex_aux_found_save_type(box_spec_save_type); if (i) { *packing = saved_level(i); *amount = saved_value(i); @@ -595,7 +592,21 @@ void tex_show_save_groups(void) case output_group: tex_print_str_esc("output"); goto FOUND2; + // maybe: + // + // case math_group: + // case math_component_group: + // case math_stack_group: + // tex_print_str_esc(lmt_interface.group_code_values[cur_group].name); + // goto FOUND2; case math_group: + tex_print_str_esc("mathsubformula"); + goto FOUND2; + case math_component_group: + tex_print_str_esc("mathcomponent"); + goto FOUND2; + case math_stack_group: + tex_print_str_esc("mathstack"); goto FOUND2; case discretionary_group: tex_print_str_esc("discretionary"); @@ -605,6 +616,10 @@ void tex_show_save_groups(void) tex_print_str_esc("fraction"); tex_aux_show_group_count(tex_aux_save_value(saved_fraction_item_variant)); goto FOUND2; + case math_radical_group: + tex_print_str_esc("radical"); + tex_aux_show_group_count(tex_aux_save_value(radical_degree_done_save_type)); + goto FOUND2; case math_operator_group: tex_print_str_esc("operator"); tex_aux_show_group_count(tex_aux_save_value(saved_operator_item_variant)); @@ -634,10 +649,10 @@ void tex_show_save_groups(void) ++pointer; tex_print_str_esc("begingroup"); goto FOUND2; -//case math_simple_group: -// ++pointer; -// tex_print_str_esc("beginmathgroup"); -// goto FOUND2; + // case math_simple_group: + // ++pointer; + // tex_print_str_esc("beginmathgroup"); + // goto FOUND2; case math_shift_group: if (mode == mmode) { tex_print_char('$'); @@ -873,9 +888,9 @@ static void tex_aux_eq_save(halfword p, quarterword l) { if (tex_room_on_save_stack()) { if (l == level_zero) { - save_type(lmt_save_state.save_stack_data.ptr) = restore_zero; + save_type(lmt_save_state.save_stack_data.ptr) = restore_zero_save_type; } else { - save_type(lmt_save_state.save_stack_data.ptr) = restore_old_value; + save_type(lmt_save_state.save_stack_data.ptr) = restore_old_value_save_type; save_word(lmt_save_state.save_stack_data.ptr) = lmt_hash_state.eqtb[p]; } save_level(lmt_save_state.save_stack_data.ptr) = l; @@ -898,6 +913,8 @@ static void tex_aux_eq_save(halfword p, quarterword l) the case of glue refs that have work by ref count and token lists and node (lists) are always different so there we do no harm. + There is room for some optimization here. + */ inline static int tex_aux_equal_eq(halfword p, singleword cmd, singleword flag, halfword chr) @@ -948,8 +965,8 @@ inline static int tex_aux_equal_eq(halfword p, singleword cmd, singleword flag, case tolerant_protected_call_cmd: case tolerant_semi_protected_call_cmd: /*tex The initial token reference will do as it is unique. */ -// if (eq_value(p) == chr) { - if (eq_value(p) == chr && eq_level(p) == cur_level) { + // if (eq_value(p) == chr) { + if (eq_value(p) == chr && eq_level(p) == cur_level) { tex_delete_token_reference(eq_value(p)); return 1; } else { @@ -960,7 +977,7 @@ inline static int tex_aux_equal_eq(halfword p, singleword cmd, singleword flag, case register_box_reference_cmd: /*tex These are also references. */ if (eq_type(p) == cmd && eq_value(p) == chr && ! chr) { -// if (eq_type(p) == cmd && eq_value(p) == chr && ! chr && eq_level(p) == cur_level) { + // if (eq_type(p) == cmd && eq_value(p) == chr && ! chr && eq_level(p) == cur_level) { return 1; } else { /* play safe */ @@ -979,7 +996,7 @@ inline static int tex_aux_equal_eq(halfword p, singleword cmd, singleword flag, case register_toks_cmd: /*tex Again we have references. */ if (eq_value(p) == chr) { -// if (eq_value(p) == chr && eq_level(p) == cur_level) { + // if (eq_value(p) == chr && eq_level(p) == cur_level) { return 1; } else { return 0; @@ -996,7 +1013,7 @@ inline static int tex_aux_equal_eq(halfword p, singleword cmd, singleword flag, math file). */ if (eq_type(p) == cmd && eq_value(p) == chr) { -// if (eq_type(p) == cmd && eq_value(p) == chr && eq_level(p) == cur_level) { + // if (eq_type(p) == cmd && eq_value(p) == chr && eq_level(p) == cur_level) { return 1; } return 0; @@ -1344,15 +1361,6 @@ void tex_forced_define(int g, halfword p, singleword f, singleword t, halfword e } } -// void forced_define(int l, halfword p, singleword f, singleword t, halfword e) -// { -// eq_destroy(hash_state.eqtb[p]); -// set_eq_level(p, l); -// set_eq_type(p, t); -// set_eq_flag(p, f); -// set_eq_value(p, e); -// } - void tex_word_define(int g, halfword p, halfword w) { if (tex_aux_mutation_permitted(p)) { @@ -1430,7 +1438,7 @@ void tex_forced_word_define(int g, halfword p, singleword f, halfword w) void tex_save_for_after_group(halfword t) { if (cur_level > level_one && tex_room_on_save_stack()) { - save_type(lmt_save_state.save_stack_data.ptr) = insert_tokens; + save_type(lmt_save_state.save_stack_data.ptr) = insert_tokens_save_type; save_level(lmt_save_state.save_stack_data.ptr) = level_zero; save_value(lmt_save_state.save_stack_data.ptr) = t; ++lmt_save_state.save_stack_data.ptr; @@ -1498,9 +1506,9 @@ void tex_unsave(void) while (1) { --lmt_save_state.save_stack_data.ptr; switch (save_type(lmt_save_state.save_stack_data.ptr)) { - case level_boundary: + case level_boundary_save_type: goto DONE; - case restore_old_value: + case restore_old_value_save_type: { halfword p = save_value(lmt_save_state.save_stack_data.ptr); /*tex @@ -1535,7 +1543,7 @@ void tex_unsave(void) } break; } - case insert_tokens: + case insert_tokens_save_type: { /*tex A list starts a new input level (for now). */ halfword p = save_value(lmt_save_state.save_stack_data.ptr); @@ -1548,7 +1556,7 @@ void tex_unsave(void) } break; } - case restore_lua: + case restore_lua_save_type: { /* The same as lua_function_code in |textoken.c|. */ halfword p = save_value(lmt_save_state.save_stack_data.ptr); @@ -1566,7 +1574,7 @@ void tex_unsave(void) a = 1; break; } - case restore_zero: + case restore_zero_save_type: { halfword p = save_value(lmt_save_state.save_stack_data.ptr); if (eq_level(p) == level_one) { @@ -1946,11 +1954,11 @@ void tex_initialize_equivalents(void) int tex_located_save_value(int id) { int i = lmt_save_state.save_stack_data.ptr - 1; - while (save_type(i) != level_boundary) { + while (save_type(i) != level_boundary_save_type) { i--; } while (i < lmt_save_state.save_stack_data.ptr) { - if (save_type(i) == restore_old_value && save_value(i) == id) { + if (save_type(i) == restore_old_value_save_type && save_value(i) == id) { /* if (math_direction_par != save_value(i - 1)) { return 1; diff --git a/source/luametatex/source/tex/texequivalents.h b/source/luametatex/source/tex/texequivalents.h index aaf45d0c1..24a1729f9 100644 --- a/source/luametatex/source/tex/texequivalents.h +++ b/source/luametatex/source/tex/texequivalents.h @@ -526,22 +526,15 @@ typedef enum int_codes { math_eqno_gap_step_code, /*tex factor/1000 used for distance between eq and eqno */ math_display_skip_mode_code, math_scripts_mode_code, - /* math_script_box_mode_code, */ - /* math_script_char_mode_code, */ math_limits_mode_code, math_nolimits_mode_code, math_rules_mode_code, math_rules_fam_code, math_penalties_mode_code, math_check_fences_mode_code, - /* math_delimiters_mode_code, */ - /* math_fences_mode_code, */ - /* math_rule_thickness_mode_code, */ math_slack_mode_code, - /* math_flatten_mode_code, */ math_skip_mode_code, math_double_script_mode_code, - /* math_control_mode_code, */ math_font_control_code, math_display_mode_code, math_dict_group_code, @@ -723,7 +716,7 @@ typedef enum attribute_codes { # define eqtb_indirect_range(n) ((n < internal_glue_base) || ((n > eqtb_size) && (n <= lmt_hash_state.hash_data.top))) # define eqtb_out_of_range(n) ((n >= undefined_control_sequence) && ((n <= eqtb_size) || n > lmt_hash_state.hash_data.top)) -# define eqtb_valid_cs(n) ((n == 0) || (n > lmt_hash_state.hash_data.top) || ((n > frozen_control_sequence) && (n <= eqtb_size))) +# define eqtb_invalid_cs(n) ((n == 0) || (n > lmt_hash_state.hash_data.top) || ((n > frozen_control_sequence) && (n <= eqtb_size))) # define character_in_range(i) (i >= 0 && i <= max_character_code) # define catcode_in_range(i) (i >= 0 && i <= max_category_code) @@ -855,73 +848,79 @@ inline void tex_set_saved_record(halfword ptr, quarterword type, quarterword lev The rather explicit |save_| items indicate a type. They are sometimes used to lookup a specific field (when tracing). + + Todo: less of these, a few more generic ones, like count, dimen, etc */ typedef enum save_types { - restore_old_value, /*tex a value should be restored later */ - restore_zero, /*tex an undefined entry should be restored */ - insert_tokens, - restore_lua, - level_boundary, /*tex the beginning of a group */ + restore_old_value_save_type, /*tex a value should be restored later */ + restore_zero_save_type, /*tex an undefined entry should be restored */ + insert_tokens_save_type, + restore_lua_save_type, + level_boundary_save_type, /*tex the beginning of a group */ + /* */ + line_number_save_type, + /* */ + insert_index_save_type, /* */ - saved_line_number, + discretionary_count_save_type, /* */ - saved_insert_index, + text_direction_save_type, /* */ - saved_discretionary_count, + equation_number_location_save_type, /* */ - saved_text_direction, + choices_count_save_type, /* */ - saved_equation_number_location, + fraction_variant_save_type, + fraction_auto_style_save_type, + fraction_user_style_save_type, /* */ - saved_choices_count, + radical_degree_done_save_type, /* make this better: just types */ + radical_style_save_type, /* */ - saved_fraction_variant, - saved_fraction_auto_style, - saved_fraction_user_style, - saved_operator_variant, + operator_variant_save_type, /* */ - saved_attribute_list, + attribute_list_save_type, /* */ - saved_math_pointer, - saved_math_class, + math_pointer_save_type, + math_class_save_type, /* */ - saved_box_type, - saved_box_context, - saved_box_spec, - saved_box_direction, - saved_box_attr_list, - saved_box_pack, - saved_box_orientation, - saved_box_anchor, - saved_box_geometry, - saved_box_xoffset, - saved_box_yoffset, - saved_box_xmove, - saved_box_ymove, - saved_box_reverse, - saved_box_discard, - saved_box_noskips, - saved_box_callback, - saved_box_container, - saved_box_shift, - saved_box_source, - saved_box_target, - saved_box_axis, - saved_box_class, - saved_box_state, - saved_box_retain, + box_type_save_type, + box_context_save_type, + box_spec_save_type, + box_direction_save_type, + box_attr_list_save_type, + box_pack_save_type, + box_orientation_save_type, + box_anchor_save_type, + box_geometry_save_type, + box_xoffset_save_type, + box_yoffset_save_type, + box_xmove_save_type, + box_ymove_save_type, + box_reverse_save_type, + box_discard_save_type, + box_noskips_save_type, + box_callback_save_type, + box_container_save_type, + box_shift_save_type, + box_source_save_type, + box_target_save_type, + box_axis_save_type, + box_class_save_type, + box_state_save_type, + box_retain_save_type, /* */ - saved_local_box_location, - saved_local_box_index, - saved_local_box_options, + local_box_location_save_type, + local_box_index_save_type, + local_box_options_save_type, /* */ - saved_adjust_location, - saved_adjust_options, - saved_adjust_index, - saved_adjust_attr_list, - saved_adjust_depth_before, - saved_adjust_depth_after, + adjust_location_save_type, + adjust_options_save_type, + adjust_index_save_type, + adjust_attr_list_save_type, + adjust_depth_before_save_type, + adjust_depth_after_save_type, } save_types; /*tex Nota bena: |equiv_value| is the same as |equiv| but sometimes we use that name instead. */ @@ -966,12 +965,15 @@ typedef enum tex_group_codes { no_align_group, /*tex code for |\noalign| */ output_group, /*tex code for output routine */ math_group, /*tex code for, e.g., |\char'136| */ + math_stack_group, + math_component_group, discretionary_group, /*tex code for |\discretionary|' */ insert_group, /*tex code for |\insert| */ vadjust_group, /*tex code for |\vadjust| */ vcenter_group, /*tex code for |\vcenter| */ math_fraction_group, /*tex code for |\over| and friends */ math_operator_group, + math_radical_group, math_choice_group, /*tex code for |\mathchoice| */ also_simple_group, /*tex code for |\begingroup|\unknown|\egroup| */ semi_simple_group, /*tex code for |\begingroup|\unknown|\endgroup| */ @@ -1265,7 +1267,6 @@ extern void tex_forced_word_define (int g, halfword p, singleword flag, halfword # define math_skip_par glue_parameter(math_skip_code) # define math_skip_mode_par count_parameter(math_skip_mode_code) # define math_double_script_mode_par count_parameter(math_double_script_mode_code) -/*define math_control_mode_par count_parameter(math_control_mode_code) */ # define math_font_control_par count_parameter(math_font_control_code) # define math_display_mode_par count_parameter(math_display_mode_code) # define math_dict_group_par count_parameter(math_dict_group_code) @@ -1364,18 +1365,20 @@ extern void tex_forced_word_define (int g, halfword p, singleword flag, halfword # define end_line_char_inactive ((end_line_char_par < 0) || (end_line_char_par > 127)) -# define delimiter_factor_par count_parameter(delimiter_factor_code) -/*define post_binary_penalty_par count_parameter(post_binary_penalty_code) */ +/*tex + We keep these as reference but they are no longer equivalent to regular \TEX\ because we have + class based penalties instead. +*/ + +/*define post_binary_penalty_par count_parameter(post_binary_penalty_code) */ /*define post_relation_penalty_par count_parameter(post_relation_penalty_code) */ -/*define pre_binary_penalty_par count_parameter(pre_binary_penalty_code) */ -/*define pre_relation_penalty_par count_parameter(pre_relation_penalty_code) */ +/*define pre_binary_penalty_par count_parameter(pre_binary_penalty_code) */ +/*define pre_relation_penalty_par count_parameter(pre_relation_penalty_code) */ + +# define delimiter_factor_par count_parameter(delimiter_factor_code) # define math_penalties_mode_par count_parameter(math_penalties_mode_code) # define math_check_fences_par count_parameter(math_check_fences_mode_code) -/*define math_delimiters_mode_par count_parameter(math_delimiters_mode_code) */ -/*define math_fences_mode_par count_parameter(math_fences_mode_code) */ -/*define math_rule_thickness_mode_par count_parameter(math_rule_thickness_mode_code) */ # define math_slack_mode_par count_parameter(math_slack_mode_code) -/*define math_flatten_mode_par count_parameter(math_flatten_mode_code) */ # define null_delimiter_space_par dimen_parameter(null_delimiter_space_code) # define disable_spaces_par count_parameter(disable_spaces_code) # define glyph_options_par count_parameter(glyph_options_code) @@ -1388,8 +1391,6 @@ extern void tex_forced_word_define (int g, halfword p, singleword flag, halfword # define glyph_x_offset_par dimen_parameter(glyph_x_offset_code) # define glyph_y_offset_par dimen_parameter(glyph_y_offset_code) # define math_scripts_mode_par count_parameter(math_scripts_mode_code) -/*define math_script_box_mode_par count_parameter(math_script_box_mode_code) */ -/*define math_script_char_mode_par count_parameter(math_script_char_mode_code) */ # define math_limits_mode_par count_parameter(math_limits_mode_code) # define math_nolimits_mode_par count_parameter(math_nolimits_mode_code) # define math_rules_mode_par count_parameter(math_rules_mode_code) @@ -1457,19 +1458,6 @@ typedef enum shaping_penalties_mode_bits { # define tab_size_par dimen_parameter(tab_size_code) -/*define prev_graf_par cur_list.prev_graf */ -/*define prev_depth_par cur_list.prev_depth */ -/*define space_factor_par cur_list.space_factor */ - -/*define tail_par cur_list.tail */ -/*define head_par cur_list.head */ -/*define mode_par cur_list.mode */ -/*define dirs_par cur_list.dirs */ - -/*define incompleat_noad_par cur_list.incompleat_noad */ -/*define mode_line_par cur_list.mode_line */ -/*define delim_par cur_list.delim */ - # define par_shape_par specification_parameter(par_shape_code) # define inter_line_penalties_par specification_parameter(inter_line_penalties_code) # define club_penalties_par specification_parameter(club_penalties_code) @@ -1479,11 +1467,17 @@ typedef enum shaping_penalties_mode_bits { # define math_forward_penalties_par specification_parameter(math_forward_penalties_code) # define math_backward_penalties_par specification_parameter(math_backward_penalties_code) +/*tex + We keep these three as reference but because they are backend related they are basically + no-ops and ignored. +*/ + /*define h_offset_par dimen_parameter(h_offset_code) */ /*define v_offset_par dimen_parameter(v_offset_code) */ -# define px_dimen_par dimen_parameter(px_dimen_code) /*define mag_par count_parameter(mag_code) */ +# define px_dimen_par dimen_parameter(px_dimen_code) + # define max_dead_cycles_par count_parameter(max_dead_cycles_code) # define output_box_par count_parameter(output_box_code) # define holding_inserts_par count_parameter(holding_inserts_code) @@ -1596,7 +1590,6 @@ typedef enum hyphenation_mode_bits { /*define glue_data_par count_parameter(glue_data_code) */ # define cur_lang_par count_parameter(language_code) -/*define cur_font_par eq_value(current_font_sequence) */ # define cur_font_par count_parameter(font_code) typedef enum normalize_line_mode_bits { diff --git a/source/luametatex/source/tex/texerrors.c b/source/luametatex/source/tex/texerrors.c index 3252d2c50..bcc581f21 100644 --- a/source/luametatex/source/tex/texerrors.c +++ b/source/luametatex/source/tex/texerrors.c @@ -600,105 +600,18 @@ void tex_handle_error_message_only( in ConTeXt but I;'m nor that sure if users really need it. The english is probably the least problematic part of an error so first I will perfect the tracing bit. -*/ - -/* - %c int char - %s *char string - %q *char 'string' - %i int integer - %e backslash (tex escape) - %C int int symbolic representation of cmd chr - %E *char \cs - %S int tex cs string - %M int mode - %T int tex string - %% percent + Todo: a translation callback: |str, 1 => str|, or not. */ extern void tex_handle_error(error_types type, const char *format, ...) { + const char *str = NULL; va_list args; va_start(args, format); /* hm, weird, no number */ - /*tex Todo: a translation callback: |str, 1 => str|. */ tex_aux_start_error(); - while (1) { - int chr = *format++; - switch (chr) { - case '\0': - goto DONE; - case '%': - { - chr = *format++; - switch (chr) { - case '\0': - goto DONE; - case 'c': - tex_print_char(va_arg(args, int)); - break; - case 's': - tex_print_str(va_arg(args, char *)); - break; - case 'q': - tex_print_char('\''); - tex_print_str(va_arg(args, char *)); - tex_print_char('\''); - break; - case 'm': - tex_print_cs_checked(va_arg(args, int)); - break; - case 'i': - tex_print_int(va_arg(args, int)); - break; - case 'e': - tex_print_str_esc(NULL); - break; - case 'C': - { - int cmd = va_arg(args, int); - int val = va_arg(args, int); - tex_print_cmd_chr((singleword) cmd, val); /* inlining doesn't work */ - break; - } - case 'E': - tex_print_str_esc(va_arg(args, char *)); - break; - case 'S': - { - halfword cs = va_arg(args, int); - tex_print_cs(cs); - break; - } - case 'M': - { - halfword mode = va_arg(args, int); - tex_print_str(tex_string_mode(mode)); - break; - } - case 'T': - { - strnumber s = va_arg(args, int); - tex_print_tex_str(s); - break; - } - case '%': - tex_print_char('%'); - break; - default: - /* ignore bad one */ - break; - } - } - break; - default: - tex_print_char(chr); /* todo: utf */ - break; - } - } - DONE: - /*tex Todo: a translation callback: |str, 2 => str|. */ - tex_aux_update_help_text(va_arg(args, char *)); + tex_print_format_args(format, args); + tex_aux_update_help_text(str); tex_aux_do_handle_error_type(type); va_end(args); } diff --git a/source/luametatex/source/tex/texfont.c b/source/luametatex/source/tex/texfont.c index dd63044ec..605d6ff75 100644 --- a/source/luametatex/source/tex/texfont.c +++ b/source/luametatex/source/tex/texfont.c @@ -251,6 +251,7 @@ void tex_char_malloc_mathinfo(charinfo *ci) mi->top_right_math_kern_array = NULL; mi->bottom_right_math_kern_array = NULL; mi->bottom_left_math_kern_array = NULL; + /* zero annyway: */ mi->top_left_kern = 0; mi->top_right_kern = 0; mi->bottom_left_kern = 0; @@ -259,6 +260,9 @@ void tex_char_malloc_mathinfo(charinfo *ci) mi->right_margin = 0; mi->top_margin = 0; mi->bottom_margin = 0; + /* */ + mi->top_overshoot = INT_MIN; + mi->bottom_overshoot = INT_MIN; if (ci->math) { /*tex This seldom or probably never happens. */ tex_set_charinfo_vertical_parts(ci, NULL); @@ -399,28 +403,43 @@ int tex_math_char_exists(halfword f, int c, int size) a little. */ -int tex_get_math_char(halfword f, int c, int size, scaled *scale) +int tex_get_math_char(halfword f, int c, int size, scaled *scale, int direction) { int id = find_charinfo_id(f, c); texfont *tf = lmt_font_state.fonts[f]; - if (id && size && tf->compactmath) { - for (int i=1;i<=size;i++) { + if (id) { + /* */ + if (direction) { charinfo *ci = &tf->chardata[id]; - if (ci->math) { - int s = ci->math->smaller; - if (s && proper_char_index(f, s)) { - id = find_charinfo_id(f, s); - if (id) { - /* todo: trace */ - c = s; + int m = ci->math->mirror; + if (m && proper_char_index(f, m)) { + int mid = find_charinfo_id(f, m); + if (mid) { + id = mid; + c = m; + } + } + } + /* */ + if (size && tf->compactmath) { + for (int i=1;i<=size;i++) { + charinfo *ci = &tf->chardata[id]; + if (ci->math) { + int s = ci->math->smaller; + if (s && proper_char_index(f, s)) { + id = find_charinfo_id(f, s); + if (id) { + /* todo: trace */ + c = s; + } else { + break; + } } else { break; } } else { break; } - } else { - break; } } } @@ -430,11 +449,6 @@ int tex_get_math_char(halfword f, int c, int size, scaled *scale) *scale = 1000; } } - /* - if (! id && ! tf->oldmath) { - c = check_math_char(f, c, size); - } - */ return c; } @@ -688,7 +702,6 @@ void tex_create_null_font(void) int id = tex_new_font(); tex_set_font_name(id, "nullfont"); tex_set_font_original(id, "nullfont"); - /* set_font_touched(id, 1); */ } int tex_is_valid_font(halfword f) @@ -1562,48 +1575,6 @@ void tex_set_cur_font(halfword g, halfword f) update_tex_font(g, f); } -/*tex This prints a scaled real, rounded to five digits. */ - -static char *tex_aux_scaled_to_string(scaled s) -{ - static char result[16]; - int k = 0; - /*tex The amount of allowable inaccuracy: */ - scaled delta; - if (s < 0) { - /*tex Only print the sign, if negative */ - result[k++] = '-'; - s = -s; - } - { - int l = 0; - char digs[8] = { 0 }; - int n = s / unity; - /*tex Process the integer part: */ - do { - digs[l++] = (char) (n % 10); - n = n / 10;; - } while (n > 0); - while (l > 0) { - result[k++] = (char) (digs[--l] + '0'); - } - } - result[k++] = '.'; - s = 10 * (s % unity) + 5; - delta = 10; - do { - if (delta > unity) { - /*tex Round the last digit: */ - s = s + 0100000 - 050000; - } - result[k++] = (char) ('0' + (s / unity)); - s = 10 * (s % unity); - delta = delta * 10; - } while (s > delta); - result[k] = 0; - return (char *) result; -} - /*tex Because we do fonts in \LUA\ we can decide to drop this one and assume a definition using the @@ -1639,29 +1610,23 @@ int tex_tex_def_font(int a) /*tex Put the positive 'at' size into |s|. */ s = tex_scan_dimen(0, 0, 0, 0, NULL); if ((s <= 0) || (s >= 01000000000)) { - char msg[256]; - snprintf(msg, 255, - "Improper 'at' size (%spt), replaced by 10pt", - tex_aux_scaled_to_string(s) - ); tex_handle_error( normal_error_type, - msg, + "Improper 'at' size (%D), replaced by 10pt", + s, + pt_unit, "I can only handle fonts at positive sizes that are less than 2048pt, so I've\n" - "changed what you said to 10pt." ); + "changed what you said to 10pt." + ); s = 10 * unity; } } else if (tex_scan_keyword("scaled")) { s = tex_scan_int(0, NULL); if ((s <= 0) || (s > 32768)) { - char msg[256]; - snprintf(msg, 255, - "Illegal magnification has been changed to 1000 (%d)", - (int) s - ); tex_handle_error( normal_error_type, - msg, + "Illegal magnification has been changed to 1000 (%i)", + s, "The magnification ratio must be between 1 and 32768." ); s = -1000; @@ -1800,27 +1765,27 @@ halfword tex_char_vertical_italic_from_font(halfword f, halfword c) return ci->math ? ci->math->vertical_italic : INT_MIN; } -halfword tex_char_top_accent_from_font(halfword f, halfword c) +halfword tex_char_unchecked_top_anchor_from_font(halfword f, halfword c) { charinfo *ci = tex_aux_char_info(f, c); - return ci->math ? ci->math->top_accent : INT_MIN; + return ci->math ? ci->math->top_anchor : INT_MIN; } halfword tex_char_top_anchor_from_font(halfword f, halfword c) { - scaled n = tex_char_top_accent_from_font(f, c); + scaled n = tex_char_unchecked_top_anchor_from_font(f, c); return n == INT_MIN ? 0 : n; } -halfword tex_char_bot_accent_from_font(halfword f, halfword c) +halfword tex_char_unchecked_bottom_anchor_from_font(halfword f, halfword c) { charinfo *ci = tex_aux_char_info(f, c); - return ci->math ? ci->math->bottom_accent : INT_MIN; + return ci->math ? ci->math->bottom_anchor : INT_MIN; } -halfword tex_char_bot_anchor_from_font(halfword f, halfword c) +halfword tex_char_bottom_anchor_from_font(halfword f, halfword c) { - scaled n = tex_char_bot_accent_from_font(f, c); + scaled n = tex_char_unchecked_bottom_anchor_from_font(f, c); return n == INT_MIN ? 0 : n; } @@ -1890,6 +1855,18 @@ scaled tex_char_bottom_margin_from_font(halfword f, halfword c) return ci->math ? ci->math->bottom_margin : 0; } +scaled tex_char_top_overshoot_from_font(halfword f, halfword c) +{ + charinfo *ci = tex_aux_char_info(f, c); + return ci->math ? ci->math->top_overshoot : 0; +} + +scaled tex_char_bottom_overshoot_from_font(halfword f, halfword c) +{ + charinfo *ci = tex_aux_char_info(f, c); + return ci->math ? ci->math->bottom_overshoot : 0; +} + /* Nodes */ scaled tex_char_width_from_glyph(halfword g) diff --git a/source/luametatex/source/tex/texfont.h b/source/luametatex/source/tex/texfont.h index a13c6e13d..e5365a0be 100644 --- a/source/luametatex/source/tex/texfont.h +++ b/source/luametatex/source/tex/texfont.h @@ -80,15 +80,15 @@ typedef struct extinfo { typedef struct mathinfo { scaled vertical_italic; - scaled top_accent; - scaled bottom_accent; + scaled top_anchor; /* provided by the font, aka topaccent */ + scaled bottom_anchor; /* provided by context */ int smaller; scaled scale; - int flat_accent; - int top_left_math_kerns; - int top_right_math_kerns; - int bottom_right_math_kerns; - int bottom_left_math_kerns; + int flat_accent; /* flac feature code point */ + int top_left_math_kerns; /* size of array */ + int top_right_math_kerns; /* size of array */ + int bottom_right_math_kerns; /* size of array */ + int bottom_left_math_kerns; /* size of array */ extinfo *horizontal_parts; extinfo *vertical_parts; scaled *top_left_math_kern_array; @@ -104,6 +104,10 @@ typedef struct mathinfo { scaled right_margin; scaled top_margin; scaled bottom_margin; + scaled top_overshoot; + scaled bottom_overshoot; + int mirror; + int padding; } mathinfo; typedef struct charinfo { @@ -184,8 +188,6 @@ typedef struct texfont { char *original; /*tex for experimental new thingies */ int compactmath; - /*tex default to false when MathConstants not seen */ - int oldmath; /*tex this controls the engine */ int mathcontrol; int textcontrol; @@ -199,8 +201,6 @@ typedef struct texfont { /*tex all parameters, although only some are used */ int parameter_count; scaled *parameter_base; - /* */ - int padding; /*tex also special */ charinfo *left_boundary; charinfo *right_boundary; @@ -235,8 +235,6 @@ extern font_state_info lmt_font_state; # define font_design_size(a) lmt_font_state.fonts[a]->design_size # define font_first_character(a) lmt_font_state.fonts[a]->first_character # define font_last_character(a) lmt_font_state.fonts[a]->last_character -/*define font_touched(a) font_state.fonts[a]->touched */ -# define font_oldmath(a) lmt_font_state.fonts[a]->oldmath # define font_compactmath(a) lmt_font_state.fonts[a]->compactmath # define font_mathcontrol(a) lmt_font_state.fonts[a]->mathcontrol # define font_textcontrol(a) lmt_font_state.fonts[a]->textcontrol @@ -253,8 +251,6 @@ extern font_state_info lmt_font_state; # define set_font_design_size(a,b) lmt_font_state.fonts[a]->design_size = b # define set_font_first_character(a,b) lmt_font_state.fonts[a]->first_character = b # define set_font_last_character(a,b) lmt_font_state.fonts[a]->last_character = b -/*define set_font_touched(a,b) font_state.fonts[a]->touched = b */ -# define set_font_oldmath(a,b) lmt_font_state.fonts[a]->oldmath = b # define set_font_compactmath(a,b) lmt_font_state.fonts[a]->compactmath = b # define set_font_mathcontrol(a,b) lmt_font_state.fonts[a]->mathcontrol = b # define set_font_textcontrol(a,b) lmt_font_state.fonts[a]->textcontrol = b @@ -408,7 +404,7 @@ extern charinfo *tex_get_charinfo (halfword f, int c); extern int tex_char_exists (halfword f, int c); extern void tex_char_process (halfword f, int c); extern int tex_math_char_exists (halfword f, int c, int size); -extern int tex_get_math_char (halfword f, int c, int size, scaled *scale); +extern int tex_get_math_char (halfword f, int c, int size, scaled *scale, int direction); /*tex @@ -461,9 +457,10 @@ extern int tex_get_math_char (halfword f, int c, int size, scaled *scal # define set_charinfo_bottom_margin(ci,val) if (ci->math) { ci->math->bottom_margin = val; } # define set_charinfo_smaller(ci,val) if (ci->math) { ci->math->smaller = val; } +# define set_charinfo_mirror(ci,val) if (ci->math) { ci->math->mirror = val; } # define set_charinfo_vertical_italic(ci,val) if (ci->math) { ci->math->vertical_italic = val; } -# define set_charinfo_top_accent(ci,val) if (ci->math) { ci->math->top_accent = val; } -# define set_charinfo_bottom_accent(ci,val) if (ci->math) { ci->math->bottom_accent = val; } +# define set_charinfo_top_anchor(ci,val) if (ci->math) { ci->math->top_anchor = val; } +# define set_charinfo_bottom_anchor(ci,val) if (ci->math) { ci->math->bottom_anchor = val; } # define set_charinfo_flat_accent(ci,val) if (ci->math) { ci->math->flat_accent = val; } # define set_charinfo_top_left_kern(ci,val) if (ci->math) { ci->math->top_left_kern = val; } @@ -471,6 +468,9 @@ extern int tex_get_math_char (halfword f, int c, int size, scaled *scal # define set_charinfo_bottom_left_kern(ci,val) if (ci->math) { ci->math->bottom_left_kern = val; } # define set_charinfo_bottom_right_kern(ci,val) if (ci->math) { ci->math->bottom_right_kern = val; } +# define set_charinfo_top_overshoot(ci,val) if (ci->math) { ci->math->top_overshoot = val; } +# define set_charinfo_bottom_overshoot(ci,val) if (ci->math) { ci->math->bottom_overshoot = val; } + /*tex Setters: */ void tex_set_lpcode_in_font (halfword f, halfword c, halfword i); @@ -532,19 +532,22 @@ extern scaled tex_char_width_italic_from_glyph (halfword g); /* x/y sca extern scaledwhd tex_char_whd_from_glyph (halfword g); /* x/y scaled */ +extern halfword tex_char_unchecked_top_anchor_from_font (halfword f, halfword c); +extern halfword tex_char_unchecked_bottom_anchor_from_font (halfword f, halfword c); + extern halfword tex_char_vertical_italic_from_font (halfword f, halfword c); -extern halfword tex_char_top_accent_from_font (halfword f, halfword c); -extern halfword tex_char_bot_accent_from_font (halfword f, halfword c); extern halfword tex_char_flat_accent_from_font (halfword f, halfword c); - extern halfword tex_char_top_anchor_from_font (halfword f, halfword c); -extern halfword tex_char_bot_anchor_from_font (halfword f, halfword c); +extern halfword tex_char_bottom_anchor_from_font (halfword f, halfword c); extern scaled tex_char_left_margin_from_font (halfword f, halfword c); extern scaled tex_char_right_margin_from_font (halfword f, halfword c); extern scaled tex_char_top_margin_from_font (halfword f, halfword c); extern scaled tex_char_bottom_margin_from_font (halfword f, halfword c); +extern scaled tex_char_top_overshoot_from_font (halfword f, halfword c); +extern scaled tex_char_bottom_overshoot_from_font (halfword f, halfword c); + extern extinfo *tex_char_vertical_parts_from_font (halfword f, halfword c); extern extinfo *tex_char_horizontal_parts_from_font (halfword f, halfword c); diff --git a/source/luametatex/source/tex/texinserts.c b/source/luametatex/source/tex/texinserts.c index 874dcf24d..27b979e0f 100644 --- a/source/luametatex/source/tex/texinserts.c +++ b/source/luametatex/source/tex/texinserts.c @@ -443,7 +443,7 @@ void tex_undump_insert_data(dumpstream f) { void tex_run_insert(void) { - tex_set_saved_record(saved_insert_item_index, saved_insert_index, 0, tex_scan_insert_index()); + tex_set_saved_record(saved_insert_item_index, insert_index_save_type, 0, tex_scan_insert_index()); lmt_save_state.save_stack_data.ptr += saved_insert_n_of_items; tex_new_save_level(insert_group); tex_scan_left_brace(); diff --git a/source/luametatex/source/tex/texmaincontrol.c b/source/luametatex/source/tex/texmaincontrol.c index a1983ac4f..a44aa1167 100644 --- a/source/luametatex/source/tex/texmaincontrol.c +++ b/source/luametatex/source/tex/texmaincontrol.c @@ -93,7 +93,7 @@ inline scaled tex_aux_checked_dimen2(scaled v) /*tex These two helpers, of which the second one is still experimental, actually belong in another file so then might be moved. Watch how the first one has the |unsave| call! - */ +*/ static void tex_aux_fixup_directions_and_unsave(void) { @@ -171,7 +171,7 @@ static void tex_aux_out_of_range_error(halfword val, halfword max) runners finish what another started, for instance when we see a left brace, depending on state another runner can kick in. - */ +*/ static void tex_aux_adjust_space_factor(halfword chr) { @@ -414,7 +414,7 @@ static void tex_aux_set_lua_value(int a) { There is a special treatment for spaces when |space_factor <> 1000|. - */ +*/ static void tex_aux_run_math_space(void) { if (! disable_spaces_par) { @@ -797,9 +797,9 @@ static void tex_aux_scan_local_box(int code) { quarterword options = 0; halfword class = 0; tex_scan_local_boxes_keys(&options, &class); - tex_set_saved_record(saved_localbox_item_location, saved_local_box_location, 0, code); - tex_set_saved_record(saved_localbox_item_index, saved_local_box_index, 0, class); - tex_set_saved_record(saved_localbox_item_options, saved_local_box_options, 0, options); + tex_set_saved_record(saved_localbox_item_location, local_box_location_save_type, 0, code); + tex_set_saved_record(saved_localbox_item_index, local_box_index_save_type, 0, class); + tex_set_saved_record(saved_localbox_item_options, local_box_options_save_type, 0, options); lmt_save_state.save_stack_data.ptr += saved_localbox_n_of_items; tex_new_save_level(local_box_group); tex_scan_left_brace(); @@ -811,7 +811,7 @@ static void tex_aux_scan_local_box(int code) { static void tex_aux_finish_local_box(void) { tex_unsave(); - if (saved_type(saved_localbox_item_location - saved_localbox_n_of_items) == saved_local_box_location) { + if (saved_type(saved_localbox_item_location - saved_localbox_n_of_items) == local_box_location_save_type) { halfword p; halfword location = saved_value(saved_localbox_item_location - saved_localbox_n_of_items); quarterword options = (quarterword) saved_value(saved_localbox_item_options - saved_localbox_n_of_items); @@ -2227,7 +2227,7 @@ static void tex_aux_run_discretionary(void) } } DONE: - tex_set_saved_record(saved_discretionary_item_component, saved_discretionary_count, 0, 0); + tex_set_saved_record(saved_discretionary_item_component, discretionary_count_save_type, 0, 0); lmt_save_state.save_stack_data.ptr += saved_discretionary_n_of_items; tex_new_save_level(discretionary_group); tex_scan_left_brace(); @@ -2357,7 +2357,7 @@ static void tex_aux_finish_discretionary(void) p = node_next(cur_list.head); tex_pop_nest(); d = cur_list.tail; - if (saved_type(saved_discretionary_item_component - saved_discretionary_n_of_items) == saved_discretionary_count) { + if (saved_type(saved_discretionary_item_component - saved_discretionary_n_of_items) == discretionary_count_save_type) { switch (saved_value(saved_discretionary_item_component - saved_discretionary_n_of_items)) { case 0: if (n > 0) { @@ -2412,7 +2412,7 @@ static void tex_aux_finish_discretionary(void) default: break; } - tex_set_saved_record(saved_discretionary_item_component - saved_discretionary_n_of_items, saved_discretionary_count, 0, saved_value(saved_discretionary_item_component - saved_discretionary_n_of_items) + 1); + tex_set_saved_record(saved_discretionary_item_component - saved_discretionary_n_of_items, discretionary_count_save_type, 0, saved_value(saved_discretionary_item_component - saved_discretionary_n_of_items) + 1); tex_new_save_level(discretionary_group); tex_scan_left_brace(); tex_push_nest(); @@ -2558,6 +2558,8 @@ static void tex_aux_run_right_brace(void) tex_aux_finish_output(); break; case math_group: + case math_component_group: + case math_stack_group: tex_finish_math_group(); break; case discretionary_group: @@ -2575,6 +2577,9 @@ static void tex_aux_run_right_brace(void) case math_fraction_group: tex_finish_math_fraction(); break; + case math_radical_group: + tex_finish_math_radical(); + break; case math_operator_group: tex_finish_math_operator(); break; @@ -2962,35 +2967,33 @@ static void tex_aux_run_kern(void) static void tex_aux_run_kern(void) { halfword code = cur_chr; - halfword val = tex_scan_dimen(0, 0, 0, 0, NULL); switch (code) { - case normal_kern_code: - break; + /* not yet enabled and maybe it never wil be */ case h_kern_code: - if (cur_mode == mmode) { - break; - } else { - cur_tok = token_val(kern_cmd, normal_kern_code); - tex_aux_run_new_paragraph(); + if (cur_mode == vmode) { + tex_back_input(token_val(kern_cmd, normal_kern_code)); + tex_back_input(token_val(begin_paragraph_cmd, quitvmode_par_code)); return; + } else { + break; } - break; case v_kern_code: - if (cur_mode == mmode) { - break; - } else { - cur_tok = token_val(kern_cmd, normal_kern_code); - tex_aux_run_head_for_vmode(); + if (cur_mode == hmode) { + tex_back_input(token_val(kern_cmd, normal_kern_code)); + tex_back_input(token_val(end_paragraph_cmd, normal_end_paragraph_code)); return; - } - case non_zero_width_kern_code: - if (val) { + } else { break; - } else { - return; } } - tex_tail_append(tex_new_kern_node(val, explicit_kern_subtype)); + { + scaled val = tex_scan_dimen(0, 0, 0, 0, NULL); + if (code == non_zero_width_kern_code && ! val) { + return; + } else { + tex_tail_append(tex_new_kern_node(val, explicit_kern_subtype)); + } + } } static void tex_aux_run_mkern(void) @@ -3548,14 +3551,12 @@ inline static void tex_aux_update_register(int a, int level, halfword index, hal } break; case glue_val_level: -// tex_define(a, index, register_glue_reference_cmd, value); tex_define(a, index, cmd == internal_glue_cmd ? internal_glue_reference_cmd : register_glue_reference_cmd, value); if (is_frozen(a) && cmd == internal_glue_cmd && cur_mode == hmode) { tex_update_par_par(internal_glue_cmd, index - lmt_primitive_state.prim_data[cmd].offset); } break; case mu_val_level: -// tex_define(a, index, register_glue_reference_cmd, value); tex_define(a, index, cmd == internal_glue_cmd ? internal_mu_glue_reference_cmd : register_mu_glue_reference_cmd, value); break; default: @@ -4135,15 +4136,6 @@ static void tex_aux_set_shorthand_def(int a, int force) // tex_define(a, p, math_char_xgiven_cmd, math_packed_character(mval.class_value,mval.family_value,mval.character_value)); break; } - /* - case math_uchar_def_code: - { - mathcodeval mval = tex_scan_mathchar(umathnum_mathcode); - tex_define(a, p, mathspec_cmd, tex_new_math_spec(mval, umathnum_mathcode)); - // tex_define(a, p, math_char_xgiven_cmd, math_packed_character(mval.class_value,mval.family_value,mval.character_value)); - break; - } - */ case count_def_code: { halfword n = tex_scan_int_register_number(); @@ -4780,22 +4772,12 @@ static void tex_aux_set_define_char_code(int a) /* maybe make |a| already a bool case extmathcode_charcode: tex_scan_extdef_math_code((is_global(a)) ? level_one : cur_level, umath_mathcode); break; - /* - case extmathcodenum_charcode: - tex_scan_extdef_math_code((is_global(a)) ? level_one : cur_level, umathnum_mathcode); - break; - */ case delcode_charcode: tex_scan_extdef_del_code((is_global(a)) ? level_one : cur_level, tex_mathcode); break; case extdelcode_charcode: tex_scan_extdef_del_code((is_global(a)) ? level_one : cur_level, umath_mathcode); break; - /* - case extdelcodenum_charcode: - tex_scan_extdef_del_code((is_global(a)) ? level_one : cur_level, umathnum_mathcode); - break; - */ default: break; } @@ -5133,9 +5115,15 @@ static void tex_aux_set_math_parameter(int a) case all_math_styles: tex_set_all_styles(code, value, global_or_local(a), indirect); break; + case all_main_styles: + tex_set_main_styles(code, value, global_or_local(a), indirect); + break; case all_split_styles: tex_set_split_styles(code, value, global_or_local(a), indirect); break; + case all_unsplit_styles: + tex_set_unsplit_styles(code, value, global_or_local(a), indirect); + break; case all_uncramped_styles: tex_set_uncramped_styles(code, value, global_or_local(a), indirect); break; @@ -5492,12 +5480,15 @@ void tex_get_r_token(void) do { tex_get_token(); } while (cur_tok == space_token); - if (eqtb_valid_cs(cur_cs)) { + if (eqtb_invalid_cs(cur_cs)) { if (cur_cs == 0) { tex_back_input(cur_tok); } cur_tok = deep_frozen_protection_token; - /* moved down but this might interfere with input on the console */ + /*tex + Moved down but this might interfere with input on the console which we don't use + anyway. + */ tex_handle_error( insert_error_type, "Missing control sequence inserted", @@ -5506,6 +5497,20 @@ void tex_get_r_token(void) "mixing me up too badly.\n" ); goto RESTART; + // } else if (cur_cmd == cs_name_cmd && cur_chr == cs_name_code) { + // /*tex + // This permits + // |\someassignment\csname foo\endcsname| + // over + // |\expandafter\someassignment\csname foo\endcsname| + // but it actually doesn't happen that frequently so even if we measure a gain of some + // 10\percent on some cases (with millions of iterations) for now I will not enable this + // feature. Of course it is also incompatible but I don't expect anyone to redefine csname + // so it is actually a pretty safe extension. Of course it also reduces tracing. I will + // come back to it when I suspect a performance gain in \CONTEXT\ (or want my code to look + // better). + // */ + // cur_cs = tex_create_csname(); } } @@ -6007,9 +6012,7 @@ static void tex_aux_run_show_whatever(void) tex_begin_diagnostic(); } if (! content) { - tex_print_str("> \\box"); - tex_print_int(n); - tex_print_char('='); + tex_print_format("> \\box%i=",n); } if (r) { tex_show_box(r); @@ -6028,7 +6031,7 @@ static void tex_aux_run_show_whatever(void) } case show_the_code: { - halfword head = tex_the_value_toks(1, NULL, 0); + halfword head = tex_the_value_toks(the_code, NULL, 0); tex_print_nlp(); tex_print_str("> "); tex_show_token_list(head, null, default_token_show_max, 0); @@ -6381,9 +6384,6 @@ void tex_initialize_variables(void) math_pre_display_gap_factor_par = default_pre_display_gap; /* pre_binary_penalty_par = infinite_penalty; */ /* pre_relation_penalty_par = infinite_penalty; */ - /* math_script_box_mode_par = 1; */ - /* math_script_char_mode_par = 1; */ - /* math_flatten_mode_par = 1; */ /*tex We default to ord */ /* obsolete */ math_font_control_par = assumed_math_control; math_eqno_gap_step_par = default_eqno_gap_step; px_dimen_par = one_bp; diff --git a/source/luametatex/source/tex/texmath.c b/source/luametatex/source/tex/texmath.c index d38cbf182..52e200657 100644 --- a/source/luametatex/source/tex/texmath.c +++ b/source/luametatex/source/tex/texmath.c @@ -115,8 +115,6 @@ math_state_info lmt_math_state = { .size = 0, .level = 0, - /* .opentype = 1, */ - /* .padding = 0, */ .par_head = NULL, .fam_head = NULL, .last_left = 0, @@ -300,7 +298,7 @@ static void tex_aux_unsave_math(void) tex_unsave(); lmt_save_state.save_stack_data.ptr -= saved_math_n_of_items; tex_flush_node_list(lmt_dir_state.text_dir_ptr); - if (saved_type(saved_math_item_direction) == saved_text_direction) { + if (saved_type(saved_math_item_direction) == text_direction_save_type) { lmt_dir_state.text_dir_ptr = saved_value(saved_math_item_direction); } else { tex_confusion("unsave math"); @@ -329,9 +327,7 @@ void tex_flush_math(void) static void tex_aux_print_parameter(const char *what, halfword style, halfword param, halfword indirect, halfword value) { tex_begin_diagnostic(); - tex_print_char('{'); - tex_print_str(what); - tex_print_char(' '); + tex_print_format("{%s ", what); if (indirect >= 0 && indirect <= last_math_indirect) { tex_print_str(lmt_interface.math_indirect_values[indirect].name); tex_print_char(' '); @@ -365,7 +361,7 @@ static void tex_aux_print_parameter(const char *what, halfword style, halfword p static void tex_aux_print_fam(const char *what, halfword size, halfword fam) { tex_begin_diagnostic(); - tex_print_format("{%s %C %i=%F}", what, define_family_cmd, size, tex_fam_fnt(fam, size)); + tex_print_format("{%s %C family %i: %F}", what, define_family_cmd, size, fam, tex_fam_fnt(fam, size)); tex_end_diagnostic(); } @@ -384,10 +380,10 @@ void tex_def_fam_fnt(int fam, int size, int fnt, int level) sa_tree_item item; item.int_value = fnt; sa_set_item_4(lmt_math_state.fam_head, fam + (256 * size), item, level); - tex_fixup_math_parameters(fam, size, fnt, level); if (tracing_assigns_par > 1) { tex_aux_print_fam("assigning", size, fam); } + tex_fixup_math_parameters(fam, size, fnt, level); } static void tex_aux_unsave_math_fam_data(int gl) @@ -414,6 +410,7 @@ static void tex_aux_unsave_math_fam_data(int gl) void tex_def_math_parameter(int style, int param, scaled value, int level, int indirect) { sa_tree_item item1, item2; + int different = 1; if (level <= 1) { if (math_parameter_value_type(param) == math_muglue_parameter) { item1 = sa_get_item_8(lmt_math_state.par_head, (param + (math_parameter_max_range * style)), &item2); @@ -423,13 +420,19 @@ void tex_def_math_parameter(int style, int param, scaled value, int level, int i } } } - } - item1.int_value = value; - item2.int_value = indirect; - sa_set_item_8(lmt_math_state.par_head, (param + (math_parameter_max_range * style)), item1, item2, level); - if (tracing_assigns_par > 1) { - tex_aux_print_parameter("assigning", style, param, indirect, value); - } + } else { + /*tex Less tracing at the cost of a lookup. */ + item1 = sa_get_item_8(lmt_math_state.par_head, (param + (math_parameter_max_range * style)), &item2); + different = item1.int_value != value || item2.int_value != indirect; + } + // if (different) { // maybe + item1.int_value = value; + item2.int_value = indirect; + sa_set_item_8(lmt_math_state.par_head, (param + (math_parameter_max_range * style)), item1, item2, level); + if (different && tracing_assigns_par > 1) { + tex_aux_print_parameter("assigning", style, param, indirect, value); + } + // } } // mukern .. there is no mudimen @@ -790,7 +793,7 @@ quarterword tex_aux_set_math_char(halfword target, mathcodeval *mval, mathdictva halfword hmcode = tex_get_hm_code(mval->character_value); kernel_math_character(target) = mval->character_value; if (mval->class_value == math_use_current_family_code) { - kernel_math_family(target) = cur_fam_par_in_range ? cur_fam_par : 0; + kernel_math_family(target) = cur_fam_par_in_range ? cur_fam_par : mval->family_value; node_subtype(target) = ordinary_noad_subtype; } else { kernel_math_family(target) = mval->family_value; @@ -1183,7 +1186,7 @@ static void tex_aux_display_fraction_noad(halfword n, int threshold, int max) static void tex_aux_new_save_level_math(quarterword group) { halfword direction = math_direction_par; - tex_set_saved_record(saved_math_item_direction, saved_text_direction, 0, lmt_dir_state.text_dir_ptr); + tex_set_saved_record(saved_math_item_direction, text_direction_save_type, 0, lmt_dir_state.text_dir_ptr); lmt_save_state.save_stack_data.ptr += saved_math_n_of_items; lmt_dir_state.text_dir_ptr = tex_new_dir(normal_dir_subtype, direction); tex_new_save_level(group); @@ -1269,7 +1272,7 @@ void tex_run_math_initialize(void) void tex_run_math_equation_number(void) { if (tex_in_privileged_mode()) { if (cur_group == math_shift_group) { - tex_set_saved_record(saved_equation_number_item_location, saved_equation_number_location, 0, cur_chr); + tex_set_saved_record(saved_equation_number_item_location, equation_number_location_save_type, 0, cur_chr); lmt_save_state.save_stack_data.ptr += saved_equation_number_n_of_items; tex_aux_enter_ordinary_math(text_style); } else { @@ -1479,28 +1482,6 @@ static delcodeval tex_aux_scan_extdef_del_code(int extcode, int doclass) } } break; - /* - case umathnum_mathcode: - // |\Udelcodenum|: |"FF<21bits>|; the largest numeric value is $2^29-1$, but the top of - // bit 21 can't be used as it contains invalid USV's. - if (doclass) { - tex_confusion("umathnum mathcode"); - } else { - halfword v = tex_scan_int(0, NULL); - d.small.family_value = (short) math_family_part(v); - d.small.character_value = math_character_part(v); - if (d.small.family_value < 0 || d.small.family_value > max_math_family_index || d.small.character_value > max_math_character_code) { - tex_handle_error( - normal_error_type, - "Invalid delimiter code", - "I'm going to use 0 instead of that illegal code value." - ); - d.small.family_value = 0; - d.small.character_value = 0; - } - } - break; - */ default: /*tex Something's gone wrong! */ tex_confusion("unknown extcode, case 1"); @@ -1722,11 +1703,6 @@ static int tex_aux_scan_math(halfword target, halfword style, int usetextfont, h case math_xchar_number_code: mval = tex_scan_mathchar(umath_mathcode); break; - /* - case math_uchar_number_code: - mval = tex_scan_mathchar(umathnum_mathcode); - break; - */ default: tex_confusion("scan math char, case 1"); break; @@ -1760,10 +1736,10 @@ static int tex_aux_scan_math(halfword target, halfword style, int usetextfont, h if (nocomponent) { goto DEFAULT; } else { - tex_set_saved_record(saved_math_group_item_pointer, saved_math_pointer, 0, target); - tex_set_saved_record(saved_math_group_all_class, saved_math_class, 0, unset_noad_class); + tex_set_saved_record(saved_math_group_item_pointer, math_pointer_save_type, 0, target); + tex_set_saved_record(saved_math_group_all_class, math_class_save_type, 0, unset_noad_class); lmt_save_state.save_stack_data.ptr += saved_math_group_n_of_items; - tex_aux_push_math(math_group, style); + tex_aux_push_math(math_component_group, style); if (usetextfont) { tex_set_math_text_font(style, usetextfont); } @@ -1782,8 +1758,8 @@ static int tex_aux_scan_math(halfword target, halfword style, int usetextfont, h tex_back_input(cur_tok); tex_scan_left_brace(); SCAN_SUBFORMULA: - tex_set_saved_record(saved_math_group_item_pointer, saved_math_pointer, 0, target); - tex_set_saved_record(saved_math_group_all_class, saved_math_class, 0, all); + tex_set_saved_record(saved_math_group_item_pointer, math_pointer_save_type, 0, target); + tex_set_saved_record(saved_math_group_all_class, math_class_save_type, 0, all); lmt_save_state.save_stack_data.ptr += saved_math_group_n_of_items; tex_aux_push_math(math_group, style); toks = every_math_atom_par; @@ -2007,11 +1983,6 @@ int tex_scan_math_cmd_val(mathcodeval *mval, mathdictval *dval) *dval = tex_scan_mathdict(); *mval = tex_scan_mathchar(umath_mathcode); break; - /* - case math_uchar_number_code: - *mval = tex_scan_mathchar(umathnum_mathcode); - break; - */ default: /* no message yet */ return 0; @@ -2046,11 +2017,6 @@ int tex_scan_math_code_val(halfword code, mathcodeval *mval, mathdictval *dval) *dval = tex_scan_mathdict(); *mval = tex_scan_mathchar(umath_mathcode); break; - /* - case math_uchar_number_code: - *mval = tex_scan_mathchar(umathnum_mathcode); - break; - */ case math_class_number_code: { halfword family = cur_fam_par; @@ -2197,7 +2163,7 @@ static void tex_aux_math_math_component(halfword target, int append) case 'l': case 'L': if (tex_scan_mandate_keyword("all", 2)) { allclass = (quarterword) tex_scan_math_class_number(0); - if (! valid_math_class_code(subtype)) { + if (! valid_math_class_code(allclass)) { allclass = unset_noad_class; } } @@ -2212,7 +2178,7 @@ static void tex_aux_math_math_component(halfword target, int append) case 'e': case 'E': if (tex_scan_mandate_keyword("leftclass", 2)) { halfword c = tex_scan_math_class_number(0); - if (! valid_math_class_code(subtype)) { + if (! valid_math_class_code(c)) { c = ordinary_noad_subtype; } set_noad_left_class(target, c); @@ -2487,11 +2453,6 @@ static void tex_aux_scan_delimiter(halfword target, int code, int class) case math_xchar_number_code: mval = tex_scan_mathchar(umath_mathcode); break; - /* - case math_uchar_number_code: - mval = tex_scan_mathchar(umathnum_mathcode); - break; - */ default: tex_confusion("scan math char, case 1"); break; @@ -2723,27 +2684,12 @@ void tex_run_math_radical(void) } case root_radical_subtype: case rooted_radical_subtype: - /*tex - The trick with the |node_next(q)| is used by |scan_math| to decide whether it needs to - go on. This code looks a bit weird, is it okay? So, here we directly pick up the two - lists while in choices we go through the somewhat complex \quote {complete} group based - mechanism. - */ { - halfword q = tex_new_node(math_char_node, 0); - node_next(q) = radical; /* trick */ - radical_degree(radical) = q; - if (! tex_aux_scan_math(radical_degree(radical), tex_math_style_variant(style, math_parameter_degree_variant), 0, 0, 0, 0, unset_noad_class, unset_noad_class)) { - /*tex Actually it's always scriptscript I guess. */ - node_next(radical_degree(radical)) = null; - q = tex_new_node(math_char_node, 0); - noad_nucleus(radical) = q; - if (noad_style(radical) != style) { - /* We keep the style in the node for diagnostics. */ - tex_back_input(token_val(math_style_cmd, noad_style(radical))); - } - tex_aux_scan_math(q, tex_math_style_variant(style, math_parameter_radical_variant), 0, 0, 0, 0, unset_noad_class, unset_noad_class); - } + tex_set_saved_record(saved_radical_degree_done, radical_degree_done_save_type, 0, 0); + tex_set_saved_record(saved_radical_style, radical_style_save_type, 0, 0); + lmt_save_state.save_stack_data.ptr += saved_radical_n_of_items; + tex_aux_push_math(math_radical_group, tex_math_style_variant(style, math_parameter_degree_variant)); + tex_scan_left_brace(); break; } default : @@ -2756,6 +2702,29 @@ void tex_run_math_radical(void) } } +void tex_finish_math_radical(void) +{ + halfword whatever = tex_new_node(sub_mlist_node, 0); + tex_aux_unsave_math(); + if (saved_type(saved_radical_degree_done - saved_radical_n_of_items) == radical_degree_done_save_type) { + halfword content = tex_aux_finish_math_list(null); + halfword radical = cur_list.tail; + kernel_math_list(whatever) = content; + if (saved_value(saved_radical_degree_done - saved_radical_n_of_items)) { + noad_nucleus(radical) = whatever; + lmt_save_state.save_stack_data.ptr -= saved_radical_n_of_items; + } else { + halfword style = saved_value(saved_radical_style - saved_radical_n_of_items); + radical_degree(radical) = whatever; + tex_set_saved_record(saved_radical_degree_done - saved_radical_n_of_items, radical_degree_done_save_type, 0, 1); + tex_aux_push_math(math_radical_group, tex_math_style_variant(style, math_parameter_radical_variant)); + tex_scan_left_brace(); + } + } else { + tex_confusion("scan radical"); + } +} + void tex_run_math_accent(void) { mathcodeval t = tex_no_math_code(); @@ -2907,7 +2876,7 @@ void tex_run_math_choice(void) { } DONE: tex_tail_append(n); - tex_set_saved_record(saved_choice_item_count, saved_choices_count, 0, math_pre_break_choice); + tex_set_saved_record(saved_choice_item_count, choices_count_save_type, 0, math_pre_break_choice); lmt_save_state.save_stack_data.ptr += saved_choice_n_of_items; tex_aux_push_math(math_choice_group, cur_list.math_style); tex_scan_left_brace(); @@ -2918,7 +2887,7 @@ void tex_run_math_choice(void) { { halfword n = tex_new_node(choice_node, normal_choice_subtype); tex_tail_append(n); - tex_set_saved_record(saved_choice_item_count, saved_choices_count, 0, math_display_choice); + tex_set_saved_record(saved_choice_item_count, choices_count_save_type, 0, math_display_choice); lmt_save_state.save_stack_data.ptr += saved_choice_n_of_items; tex_aux_push_math(math_choice_group, display_style); tex_scan_left_brace(); @@ -2934,9 +2903,10 @@ void tex_run_math_choice(void) { tex_tail_append(n); noad_nucleus(n) = m; tex_scan_left_brace(); - tex_set_saved_record(0, saved_math_pointer, 0, m); - ++lmt_save_state.save_stack_data.ptr; - tex_aux_push_math(math_group, s); + tex_set_saved_record(saved_math_group_item_pointer, math_pointer_save_type, 0, m); + tex_set_saved_record(saved_math_group_all_class, math_class_save_type, 0, unset_noad_class); + lmt_save_state.save_stack_data.ptr += saved_math_group_n_of_items; + tex_aux_push_math(math_stack_group, s); break; } } @@ -2958,7 +2928,7 @@ void tex_finish_math_choice(void) tex_aux_unsave_math(); content = tex_aux_finish_math_list(null); /* We should just count and not rely on the next hackery test: */ - if (saved_type(saved_choice_item_count - saved_choice_n_of_items) == saved_choices_count) { + if (saved_type(saved_choice_item_count - saved_choice_n_of_items) == choices_count_save_type) { int choice = saved_value(saved_choice_item_count - saved_choice_n_of_items); int style = cur_list.math_style; switch (node_subtype(cur_list.tail)) { @@ -3000,7 +2970,7 @@ void tex_finish_math_choice(void) } break; } - tex_set_saved_record(saved_choice_item_count - saved_choice_n_of_items, saved_choices_count, 0, choice + 1); + tex_set_saved_record(saved_choice_item_count - saved_choice_n_of_items, choices_count_save_type, 0, choice + 1); tex_aux_push_math(math_choice_group, style); tex_scan_left_brace(); } else { @@ -3013,7 +2983,7 @@ void tex_finish_math_fraction(void) halfword content; tex_aux_unsave_math(); content = tex_aux_finish_math_list(null); - if (saved_type(saved_fraction_item_variant - saved_fraction_n_of_items) == saved_fraction_variant) { + if (saved_type(saved_fraction_item_variant - saved_fraction_n_of_items) == fraction_variant_save_type) { halfword over = saved_value(saved_fraction_item_variant - saved_fraction_n_of_items); halfword autostyle = saved_value(saved_fraction_item_autostyle - saved_fraction_n_of_items); halfword userstyle = saved_value(saved_fraction_item_userstyle - saved_fraction_n_of_items); @@ -3028,7 +2998,7 @@ void tex_finish_math_fraction(void) lmt_save_state.save_stack_data.ptr -= saved_fraction_n_of_items; return; } - tex_set_saved_record(saved_fraction_item_variant - saved_fraction_n_of_items, saved_fraction_variant, 0, over + 1); + tex_set_saved_record(saved_fraction_item_variant - saved_fraction_n_of_items, fraction_variant_save_type, 0, over + 1); tex_aux_push_math(math_fraction_group, autostyle); tex_scan_left_brace(); } else { @@ -3041,7 +3011,7 @@ void tex_finish_math_operator(void) halfword content; tex_aux_unsave_math(); content = tex_aux_finish_math_list(null); - if (saved_type(saved_operator_item_variant - saved_operator_n_of_items) == saved_operator_variant) { + if (saved_type(saved_operator_item_variant - saved_operator_n_of_items) == operator_variant_save_type) { halfword over = saved_value(saved_operator_item_variant - saved_operator_n_of_items); halfword fenced = cur_list.tail; switch (over) { @@ -3053,7 +3023,7 @@ void tex_finish_math_operator(void) lmt_save_state.save_stack_data.ptr -= saved_operator_n_of_items; return; } - tex_set_saved_record(saved_operator_item_variant - saved_operator_n_of_items, saved_operator_variant, 0, over + 1); + tex_set_saved_record(saved_operator_item_variant - saved_operator_n_of_items, operator_variant_save_type, 0, over + 1); tex_aux_push_math(math_operator_group, tex_math_style_variant(cur_list.math_style, math_parameter_subscript_variant)); tex_scan_left_brace(); } else { @@ -3469,11 +3439,11 @@ void tex_run_math_fraction(void) But here we can! For practical reasons we accept the rule related options and in principle we cold do with one command. */ - case math_u_atop_code: - case math_u_atop_delimited_code: case math_u_above_code: case math_u_above_delimited_code: goto OPTIONS; + case math_u_atop_code: + case math_u_atop_delimited_code: case math_u_over_code: case math_u_over_delimited_code: ruledone = 1; @@ -3485,7 +3455,7 @@ void tex_run_math_fraction(void) ruledone = 1; OPTIONS: while (1) { - switch (tex_scan_character("acefhnstvACEFHNSTV", 0, 1, 0)) { + switch (tex_scan_character("acefhnpstvACEFHNPSTV", 0, 1, 0)) { case 'a': case 'A': if (tex_scan_mandate_keyword("attr", 1)) { attrlist = tex_scan_attribute(attrlist); @@ -3500,10 +3470,17 @@ void tex_run_math_fraction(void) } break; case 'e': case 'E': + /* not used */ if (tex_scan_mandate_keyword("exact", 1)) { options |= noad_option_exact; } break; + case 'p': case 'P': + /* not used */ + if (tex_scan_mandate_keyword("proportional", 1)) { + options |= noad_option_proportional; + } + break; case 'n': case 'N': /*tex A bit over the top, three steps but a push back is still worse. */ if (tex_scan_character("oO", 0, 0, 0)) { @@ -3589,9 +3566,9 @@ void tex_run_math_fraction(void) In this case we need to pick up two math groups, and after some playing around using a variant of choices made most sense. */ - tex_set_saved_record(saved_fraction_item_variant, saved_fraction_variant, 0, math_numerator_above); - tex_set_saved_record(saved_fraction_item_autostyle, saved_fraction_auto_style, 0, autostyle); - tex_set_saved_record(saved_fraction_item_userstyle, saved_fraction_user_style, 0, userstyle); + tex_set_saved_record(saved_fraction_item_variant, fraction_variant_save_type, 0, math_numerator_above); + tex_set_saved_record(saved_fraction_item_autostyle, fraction_auto_style_save_type, 0, autostyle); + tex_set_saved_record(saved_fraction_item_userstyle, fraction_user_style_save_type, 0, userstyle); lmt_save_state.save_stack_data.ptr += saved_fraction_n_of_items; cur_list.math_flatten = 0; tex_aux_push_math(math_fraction_group, autostyle); @@ -4046,7 +4023,7 @@ void tex_run_math_fence(void) node_next(cur_list.head) = fence; cur_list.tail = fence; cur_list.delim = fence; - tex_set_saved_record(saved_operator_item_variant, saved_operator_variant, 0, math_limits_top); + tex_set_saved_record(saved_operator_item_variant, operator_variant_save_type, 0, math_limits_top); lmt_save_state.save_stack_data.ptr += saved_operator_n_of_items; tex_aux_push_math(math_operator_group, tex_math_style_variant(style, math_parameter_superscript_variant)); tex_scan_left_brace(); @@ -4054,7 +4031,6 @@ void tex_run_math_fence(void) break; case no_fence_side: { - /* halfword n = tex_new_node(simple_noad, math_fences_mode_par ? fenced_noad_subtype : inner_noad_subtype); */ halfword n = tex_new_node(simple_noad, fenced_noad_subtype); halfword l = tex_new_node(sub_mlist_node, 0); tex_tail_append(n); @@ -4508,7 +4484,7 @@ void tex_run_math_shift(void) { tex_aux_unsave_math(); /*tex now |cur_group = math_shift_group| */ lmt_save_state.save_stack_data.ptr -= saved_equation_number_n_of_items; - if (saved_type(saved_equation_number_item_location) == saved_equation_number_location) { + if (saved_type(saved_equation_number_item_location) == equation_number_location_save_type) { atleft = saved_value(saved_equation_number_item_location) == left_location_code; mode = cur_list.mode; p = tex_aux_finish_math_list(null); @@ -4994,6 +4970,13 @@ void tex_set_text_styles(halfword code, halfword value, halfword level, halfword tex_def_math_parameter(cramped_text_style, code, value, level, indirect); } +void tex_set_main_styles(halfword code, halfword value, halfword level, halfword indirect) +{ + for (int style = display_style; style <= cramped_text_style; style++) { + tex_def_math_parameter(style, code, value, level, indirect); + } +} + void tex_set_script_styles(halfword code, halfword value, halfword level, halfword indirect) { tex_def_math_parameter(script_style, code, value, level, indirect); @@ -5035,6 +5018,12 @@ void tex_set_split_styles(halfword code, halfword value, halfword level, halfwor tex_set_script_script_styles(code, 0, level, indirect); } +void tex_set_unsplit_styles(halfword code, halfword value, halfword level, halfword indirect) +{ + tex_set_script_styles (code, value, level, indirect); + tex_set_script_script_styles(code, value, level, indirect); +} + void tex_reset_all_styles(halfword level) { for (int code = math_parameter_atom_pairs_first; code <= math_parameter_atom_pairs_last; code++) { @@ -5263,26 +5252,23 @@ void tex_finalize_math_parameters(void) static void tex_aux_math_parameter_error(int style, int param, const char *name) { - char msg[256] = { 0 }; if (param >= 0) { - snprintf(msg, 256, "Math error: parameter '%s' with id %i in style %d is not set", name, param, style); + tex_handle_error( + normal_error_type, + "Math error: parameter '%s' with id %i in style %i is not set", + name, param, style, + "Sorry, but I can't typeset math unless various parameters have been set. This is\n" + "normally done by loading special math fonts into the math family slots. Your font\n" + "set is lacking at least the parameter mentioned earlier." + ); } else { - snprintf(msg, 256, "Math error: parameter '%s' style %d is not set", name, style); + tex_formatted_error("math", "invalid parameter '%s' in style %i", name, style); } - tex_handle_error( - normal_error_type, - msg, - "Sorry, but I can't typeset math unless various parameters have been set. This is\n" - "normally done by loading special math fonts into the math family slots. Your font\n" - "set is lacking at least the parameter mentioned earlier." - ); return; } /*tex - For the moment this is experimental. - */ inline static scaled tex_aux_max_scale(int style, int param) diff --git a/source/luametatex/source/tex/texmath.h b/source/luametatex/source/tex/texmath.h index 7dbd62b2e..e024a6ba2 100644 --- a/source/luametatex/source/tex/texmath.h +++ b/source/luametatex/source/tex/texmath.h @@ -23,8 +23,6 @@ typedef struct math_state_info { int size; /*tex Size code corresponding to |cur_style|. */ int level; /*tex Maybe we should expose this one. */ - /* int opentype; */ /*tex We just assume opentype now. */ - /* int padding; */ sa_tree par_head; sa_tree fam_head; halfword last_left; @@ -272,6 +270,7 @@ typedef enum math_class_options { prefer_delimiter_dimensions_class_option = 0x0080000, auto_inject_class_option = 0x0100000, remove_italic_correction_class_option = 0x0200000, + operator_italic_correction_class_option = 0x0400000, no_class_options = 0xF000000, } math_class_options; @@ -582,10 +581,12 @@ extern void tex_initialize_math_spacing (void); extern void tex_set_display_styles (halfword code, halfword value, halfword level, halfword indirect); extern void tex_set_text_styles (halfword code, halfword value, halfword level, halfword indirect); +extern void tex_set_main_styles (halfword code, halfword value, halfword level, halfword indirect); extern void tex_set_script_styles (halfword code, halfword value, halfword level, halfword indirect); extern void tex_set_script_script_styles (halfword code, halfword value, halfword level, halfword indirect); extern void tex_set_all_styles (halfword code, halfword value, halfword level, halfword indirect); extern void tex_set_split_styles (halfword code, halfword value, halfword level, halfword indirect); +extern void tex_set_unsplit_styles (halfword code, halfword value, halfword level, halfword indirect); extern void tex_set_uncramped_styles (halfword code, halfword value, halfword level, halfword indirect); extern void tex_set_cramped_styles (halfword code, halfword value, halfword level, halfword indirect); extern void tex_reset_all_styles (halfword level); @@ -652,6 +653,7 @@ extern void tex_run_math_italic_correction (void); extern void tex_finish_math_group (void); extern void tex_finish_math_choice (void); extern void tex_finish_math_fraction (void); +extern void tex_finish_math_radical (void); extern void tex_finish_math_operator (void); extern void tex_finish_display_alignment (halfword head, halfword tail, halfword prevdepth); @@ -677,6 +679,8 @@ typedef enum math_control_codes { math_control_analyze_script_nucleus_char = 0x040000, math_control_analyze_script_nucleus_list = 0x080000, math_control_analyze_script_nucleus_box = 0x100000, + math_control_accent_top_skew_with_offset = 0x200000, + math_control_ignore_kern_dimensions = 0x400000, /* for bad fonts (like xits fence depths) */ } math_control_codes; /*tex This is what we use for \OPENTYPE\ in \CONTEXT: */ @@ -699,6 +703,7 @@ typedef enum math_control_codes { | math_control_analyze_script_nucleus_char \ | math_control_analyze_script_nucleus_list \ | math_control_analyze_script_nucleus_box \ + | math_control_accent_top_skew_with_offset \ ) /*tex @@ -744,11 +749,23 @@ typedef enum saved_fraction_items { saved_fraction_n_of_items = 3, } saved_fraction_items; +typedef enum saved_radical_items { + saved_radical_degree_done = 0, + saved_radical_style = 1, + saved_radical_n_of_items = 2, +} saved_radical_items; + typedef enum saved_operator_items { saved_operator_item_variant = 0, saved_operator_n_of_items = 1, } saved_operator_items; +/*tex + These items are for regular groups, ustacks, atoms and such. We could make dedicated items + but in the end it means duplicatign code and we then also need to redo accents as these + check for the group, in which case we then have to intercept the lot. I might do it anyway. +*/ + typedef enum saved_math_group_items { saved_math_group_item_pointer = 0, saved_math_group_all_class = 1, diff --git a/source/luametatex/source/tex/texmathcodes.c b/source/luametatex/source/tex/texmathcodes.c index 7d80eac19..545013264 100644 --- a/source/luametatex/source/tex/texmathcodes.c +++ b/source/luametatex/source/tex/texmathcodes.c @@ -91,7 +91,7 @@ mathcodeval tex_mathchar_from_spec(int value) return mval; } -void tex_show_mathcode_value(mathcodeval mval, int extcode) +void tex_show_mathcode_value(mathcodeval mval, int extcode) /* todo: format option */ { tex_print_char('"'); if (extcode == tex_mathcode) { @@ -110,9 +110,7 @@ void tex_show_mathcode_value(mathcodeval mval, int extcode) static void tex_aux_show_mathcode(int n) { mathcodeval mval = tex_get_math_code(n); - tex_print_str_esc("Umathcode"); - tex_print_int(n); - tex_print_char('='); + tex_print_format("%eUmathcode%i=", n); tex_show_mathcode_value(mval, umath_mathcode); } @@ -207,9 +205,7 @@ static void tex_aux_undump_mathcode(dumpstream f) static void tex_aux_show_delcode(int n) { delcodeval dval = tex_get_del_code(n); - tex_print_str_esc("Udelcode"); - tex_print_int(n); - tex_print_char('='); + tex_print_format("%eUdelcode=", n); if (tex_has_del_code(dval)) { tex_print_char('"'); print_hex_digit_two(dval.small.family_value); diff --git a/source/luametatex/source/tex/texmlist.c b/source/luametatex/source/tex/texmlist.c index ac51d2c35..ddc3f0a6e 100644 --- a/source/luametatex/source/tex/texmlist.c +++ b/source/luametatex/source/tex/texmlist.c @@ -11,7 +11,7 @@ and extensibles are made from other glyphs, as in traditional \TEX\ fonts. In traditional \TEX\ the italic correction is added to the width of the glyph. This is part of - the engine design and this is also reflected in the widtn metric of the font. In \OPENTYPE\ math + the engine design and this is also reflected in the width metric of the font. In \OPENTYPE\ math this is different. There the italic correction had more explicit usage. The 1.7 spec says: \startitemize @@ -85,6 +85,58 @@ */ +/* + + There is a persistent issue with operators and italic correction. For n_ary ones the italic + correction is used for positioning scripts above or below (shifted horizontally) or + at the right top and bottom (also shifted horizontally). That assumes a proper width that + doesn't need italic correction itself. On the other hand, in the case of arbitrary characters + that want to be operators the italic correction can be part of th ewidth (take the |f| as + example). Now, the most problematic one is the integral and especially in Latin Modern where + it is very slanted. In \CONTEXT\ we use the left operator feature to deal with all this. + + We considered a special class for operators where italic correction is used for positioning + but in the end we rejected that. We now: + + \startitemize + \startitem + asume properly bounded characters (sum, product, integral) and most are upright anyway + \stopitem + \startitem + top and bottom scripts are centered + \stopitem + \startitem + right and left scripts are bound tight to the edge + \stopitem + \startitem + italic correction can be completely ignored + \stopitem + \startitem + top and bottom anchors (set up in the goodie) control optional displacements + \stopitem + \startitem + top right and top left kerns (set up in the goodie) control optional displacements + \stopitem + \stopitemize + + We already did the kerns for some fonts using information in the goodie file, and now we + also use the top and bottom anchors. In fact, the only real exception is Latin Modern, so + instead of messing up the code with exceptions and tricky controls we now have a few lines + in (basically) one goodie file. + + An class option can be set to add italic corrections to operators so in the case of the + integral, where it is used for positioning, it can then be used to calculate anchors, but + that is then done in the goodie file. Keep in mind that these anchors are an engine feature. + + For most math fonts all works out of the box, only fonts with highly asymetrical integral + signs are touched by this, but fonts like that likely need tweaks anyway. + + For the record: the specificaton only talks about possible application so we can basically do + as we like. All works fine for Cambria and the \TEX\ community didn't make sure that better + features were added (like anchors) for their shapes. + +*/ + # include "luametatex.h" /*tex @@ -179,6 +231,10 @@ inline void tex_math_wipe_kerns(kernset *kerns) { kerns->depth = 0; kerns->toptotal = 0; kerns->bottomtotal = 0; + kerns->dimensions = 0; + kerns->font = null_font; + kerns->character = 0; + kerns->padding = 0; } } @@ -192,13 +248,14 @@ inline void tex_math_copy_kerns(kernset *kerns, kernset *parent) { kerns->depth = parent->depth; kerns->toptotal = parent->toptotal; kerns->bottomtotal = parent->bottomtotal; + kerns->dimensions = parent->dimensions; + kerns->font = parent->font; + kerns->character = parent->character; } } /*tex - When the style changes, the following piece of program computes associated information: - */ inline static halfword tex_aux_set_style_to_size(halfword style) @@ -315,21 +372,17 @@ inline static scaled limited_rounded(double d) { } } -// inline static int tex_aux_has_opentype_metrics(halfword f) -// { -// return font_math_parameter_count(f) > 0 && ! font_oldmath(f); -// } - -inline static int tex_aux_math_engine_control(halfword fnt, halfword chr) +inline static int tex_aux_math_engine_control(halfword fnt, halfword control) { - if (fnt && (math_font_control_par & math_control_use_font_control) == math_control_use_font_control) { + // if (fnt && (math_font_control_par & math_control_use_font_control) == math_control_use_font_control) { + if (fnt && (font_mathcontrol(fnt) & math_control_use_font_control) == math_control_use_font_control) { /*tex This is only for old fonts and it might go away eventually. Not all control options relate to a font. */ - return (font_mathcontrol(fnt) & chr) == chr; + return (font_mathcontrol(fnt) & control) == control; } - return (math_font_control_par & chr) == chr; + return (math_font_control_par & control) == control; } /* @@ -397,7 +450,7 @@ halfword tex_math_font_char_dp(halfword fnt, halfword chr, halfword style) inline static halfword tex_aux_new_math_glyph(halfword fnt, halfword chr, quarterword subtype) { halfword scale = 1000; - halfword glyph = tex_new_glyph_node(subtype, fnt, tex_get_math_char(fnt, chr, lmt_math_state.size, &scale), null); /* todo: data */; + halfword glyph = tex_new_glyph_node(subtype, fnt, tex_get_math_char(fnt, chr, lmt_math_state.size, &scale, math_direction_par), null); /* todo: data */; set_glyph_options(glyph, glyph_options_par); glyph_scale(glyph) = tex_aux_math_glyph_scale(scale); glyph_x_scale(glyph) = glyph_x_scale_par; @@ -517,63 +570,19 @@ static inline int tex_aux_checked_right_kern(halfword list, halfword state, half } } -/*tex We no longer need this one: - - \starttyping - static halfword tex_aux_math_remove_italic_kern(halfword head, scaled *italic, const char *trace) - { - halfword tail = tex_tail_of_node_list(box_list(head)); - if (tail && node_type(tail) == kern_node && node_subtype(tail) == italic_kern_subtype && kern_amount(tail) == *italic) { - tex_aux_trace_kerns(tail, "removing italic kern", trace); - if (head == tail) { - head = null; - } else { - head = node_prev(tail); - node_next(node_prev(tail)) = null; - } - tex_flush_node(tail); - *italic = 0; - } - return head; - } - \starttyping - -*/ - -/*tex We no longer need this one: - - \starttyping - static void tex_aux_normalize_delimiters(halfword l, halfword r) - { - if (box_width(l) == null_delimiter_space_par) { - box_height(l) = box_height(r); - box_depth(l) = box_depth(r); - box_shift_amount(l) = box_shift_amount(r); - } else if (box_width(r) == null_delimiter_space_par) { - box_height(r) = box_height(l); - box_depth(r) = box_depth(l); - box_shift_amount(r) = box_shift_amount(l); - } - } - \starttyping - -*/ - static scaled tex_aux_check_rule_thickness(halfword target, int size, halfword *fam, halfword control, halfword param) { - /* if (math_rule_thickness_mode_par > 0) { */ - halfword family = noad_family(target); - if (family != unused_math_family) { - halfword font = tex_fam_fnt(family, size); - if (tex_aux_math_engine_control(font, control)) { - scaled thickness = tex_get_font_math_parameter(font, size, param); - if (thickness != undefined_math_parameter) { - *fam = family; - return thickness; - } + halfword family = noad_family(target); + if (family != unused_math_family) { + halfword font = tex_fam_fnt(family, size); + if (tex_aux_math_engine_control(font, control)) { + scaled thickness = tex_get_font_math_parameter(font, size, param); + if (thickness != undefined_math_parameter) { + *fam = family; + return thickness; } } - /* } */ + } return undefined_math_parameter; } @@ -585,6 +594,7 @@ static halfword tex_aux_fake_nucleus(quarterword cls) halfword q = tex_new_node(math_char_node, 0); set_noad_classes(n, cls); noad_nucleus(n) = q; + math_kernel_node_set_option(q, math_kernel_ignored_character); return n; } @@ -805,6 +815,9 @@ static halfword tex_aux_underbar(halfword box, scaled gap, scaled height, scaled \startitem accent placement \stopitem \stopitemize + We keep this as reference but oldmath handling has been replaces by options that determine code + paths. We actually assuem that \OPENTRYPE fonts are used anyway. The flag is gone. + In the traditional case an italic kern is always added and the |ic| variable is then passed to the caller. For a while we had an option to add the correction to the width but now we have the control options. So these are the options: @@ -854,43 +867,6 @@ static halfword tex_aux_char_box(halfword fnt, int chr, halfword att, scaled *ic return box; } -/*tex - - When we build an extensible character, it's handy to have the following subroutine, which puts - a given character on top of the characters already in box |b|: - -*/ - -// static scaled tex_aux_stack_into_box(halfword b, halfword f, int c, quarterword subtype, int horiziontal) -// { -// /*tex New node placed into |b|. Italic gets added to width in 8 bit fonts. */ -// halfword boxed = tex_aux_char_box(f, c, get_attribute_list(b), NULL, subtype); -// halfword glyph = box_list(boxed); -// if (horiziontal) { -// halfword list = box_list(b); -// if (list) { -// tex_couple_nodes(tex_tail_of_node_list(list), boxed); -// } else { -// box_list(b) = boxed; -// } -// if (box_height(b) < box_height(boxed)) { -// box_height(b) = box_height(boxed); -// } -// if (box_depth(b) < box_depth(boxed)) { -// box_depth(b) = box_depth(boxed); -// } -// return tex_char_width_from_glyph(glyph); -// } else { -// tex_try_couple_nodes(boxed, box_list(b)); -// box_list(b) = boxed; -// box_height(b) = box_height(boxed); -// if (box_width(b) < box_width(boxed)) { -// box_width(b) = box_width(boxed); -// } -// return tex_char_total_from_glyph(glyph); -// } -// } - /*tex There is no need to deal with an italic correction here. If there is one in an extensible we have a real weird font! So in this version we don't end up with a redicoulous amount of hlists @@ -1204,7 +1180,6 @@ halfword tex_make_extensible(halfword fnt, halfword chr, scaled target, scaled m initial = overlap; } if (advance == 0) { - /*tex for tfm fonts (so no need for scaling) */ 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); @@ -1224,7 +1199,6 @@ halfword tex_make_extensible(halfword fnt, halfword chr, scaled target, scaled m initial = overlap; } if (advance == 0) { - /*tex for tfm fonts (so no need for scaling) */ 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); @@ -1248,7 +1222,7 @@ halfword tex_make_extensible(halfword fnt, halfword chr, scaled target, scaled m for (extinfo *e = extensible; e; e = e->next) { if (e->extender == 0) { scaled progress; - scaled initial = horizontal ? tex_aux_math_x_size_scaled(fnt, e->start_overlap, size) : tex_aux_math_y_size_scaled(fnt,e->start_overlap, size); + scaled initial = horizontal ? tex_aux_math_x_size_scaled(fnt, e->start_overlap, size) : tex_aux_math_y_size_scaled(fnt, e->start_overlap, size); if (overlap < initial) { initial = overlap; } @@ -1542,12 +1516,25 @@ static halfword tex_aux_make_delimiter(halfword target, halfword delimiter, int } } if (! flat) { - /*tex A vertical variant. Todo: add a kern instead. */ + /*tex + We have a vertical variant. Case 1 deals with the fact that fonts can lie about their + dimensions which happens in tfm files where there are a limited number of heights and + depths. However, that doesn't work out well when we want to anchor script later on in + a more sophisticated way. Most \OPENTYPE\ fonts have proper heights and depth but there + are some that don't. Problems can show up when we use kerns (as \CONTEXT\ does via + goodie files) and the relevant class option has been enabled. In order to deal with the + problematic fonts we can disable this via a font option. The natural height and depth + are communicated via extremes and kerns. + + For fonts that have their shapes positioned properly around their axis case 1 doesn't + interfere but could as well be skipped. These shapes can also be used directly in + the input if needed (basically case 1 then becomes case 4). + */ switch (shift) { case 0: box_shift_amount(result) = tex_half_scaled(box_height(result) - box_depth(result)); break; - case 1: + case 1: box_shift_amount(result) = tex_half_scaled(box_height(result) - box_depth(result)); box_shift_amount(result) -= tex_aux_math_axis(size); break; @@ -2049,7 +2036,6 @@ static int tex_aux_fetch(halfword n, const char *where, halfword *f, halfword *c if (node_type(n) == glyph_node) { *f = glyph_font(n); *c = glyph_character(n); - /* lmt_math_state.opentype = tex_aux_has_opentype_metrics(*f); */ if (tex_char_exists(*f, *c)) { return 1; } else { @@ -2059,27 +2045,23 @@ static int tex_aux_fetch(halfword n, const char *where, halfword *f, halfword *c } else { *f = tex_fam_fnt(kernel_math_family(n), lmt_math_state.size); *c = kernel_math_character(n); - if (*f == null_font) { - char msg[256]; - snprintf(msg, 255, "\\%s%d is undefined in %s, font id %d, character %d)", - tex_aux_math_size_string(lmt_math_state.size), kernel_math_family(n), where, *f, *c - ); + if (math_kernel_node_has_option(n, math_kernel_ignored_character)) { + return 1; + } else if (*f == null_font) { tex_handle_error( normal_error_type, - msg, + "\\%s%i is undefined in %s, font id %i, character %i)", + tex_aux_math_size_string(lmt_math_state.size), kernel_math_family(n), where, *f, *c, "Somewhere in the math formula just ended, you used the stated character from an\n" "undefined font family. For example, plain TeX doesn't allow \\it or \\sl in\n" "subscripts. Proceed, and I'll try to forget that I needed that character." ); return 0; + } else if (tex_math_char_exists(*f, *c, lmt_math_state.size)) { + return 1; } else { - /* lmt_math_state.opentype = tex_aux_has_opentype_metrics(*f); */ - if (tex_math_char_exists(*f, *c, lmt_math_state.size)) { - return 1; - } else { - tex_char_warning(*f, *c); - return 0; - } + tex_char_warning(*f, *c); + return 0; } } } @@ -2302,6 +2284,8 @@ static void tex_aux_set_radical_kerns(delimiterextremes *extremes, kernset *kern if (tex_math_has_class_option(radical_noad_subtype, prefer_delimiter_dimensions_class_option)) { kerns->height = extremes->height; kerns->depth = extremes->depth; + kerns->dimensions = 1; + kerns->font = extremes->tfont; } } } @@ -2400,13 +2384,7 @@ static void tex_aux_make_root_radical(halfword target, int style, int size, kern if (width) { scaled before = tex_get_math_x_parameter_checked(style, math_parameter_radical_degree_before); scaled after = tex_get_math_x_parameter_checked(style, math_parameter_radical_degree_after); - /* scaled raise = tex_get_math_y_parameter_checked(style, math_parameter_radical_degree_raise); */ /* no! */ scaled raise = tex_get_math_parameter_checked(style, math_parameter_radical_degree_raise); - /* old: - if (-after > (width + before)) { - after = -(width + before); - } - new: */ if (-after > width) { before += -after - width; } @@ -2572,9 +2550,7 @@ static void tex_aux_make_over_delimiter(halfword target, int style, int size) } /*tex - This has the extensible delimiter |x| as a limit below |nucleus| box |y|. - */ static void tex_aux_make_under_delimiter(halfword target, int style, int size) @@ -2602,9 +2578,7 @@ static void tex_aux_make_under_delimiter(halfword target, int style, int size) } /*tex - This has the extensible delimiter |x| as a limit above |nucleus| box |y|. - */ static void tex_aux_make_delimiter_over(halfword target, int style, int size) @@ -2633,9 +2607,7 @@ static void tex_aux_make_delimiter_over(halfword target, int style, int size) } /*tex - This has the extensible delimiter |y| as a limit below a |nucleus| box |x|. - */ static void tex_aux_make_delimiter_under(halfword target, int style, int size) @@ -2727,7 +2699,7 @@ typedef enum math_accent_location_codes { stretch_accent_code = 8, } math_accent_location_codes; -static int tex_aux_compute_accent_skew(halfword target, int flags, scaled *s, halfword size) +static int tex_aux_compute_accent_skew(halfword target, int flags, scaled *skew, halfword size) { /*tex will be true if a top-accent is placed in |s| */ int absolute = 0; @@ -2742,21 +2714,21 @@ static int tex_aux_compute_accent_skew(halfword target, int flags, scaled *s, ha There is no bot_accent so let's assume that the shift also applies to bottom and overlay accents. */ - *s = tex_char_top_accent_from_font(fnt, chr); - if (*s != INT_MIN) { - *s = tex_aux_math_x_size_scaled(fnt, *s, size); + *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; } else { - *s = 0; + *skew = 0; } } else if (flags & top_accent_code) { - *s = tex_aux_math_x_size_scaled(fnt, tex_get_kern(fnt, chr, font_skew_char(fnt)), size); + *skew = tex_aux_math_x_size_scaled(fnt, tex_get_kern(fnt, chr, font_skew_char(fnt)), size); } else { - *s = 0; + *skew = 0; } if (tracing_math_par >= 2) { tex_begin_diagnostic(); - tex_print_format("[math: accent skew, font %i, chr %x, skew %D, absolute %i]", fnt, chr, *s, pt_unit, absolute); + tex_print_format("[math: accent skew, font %i, chr %x, skew %D, absolute %i]", fnt, chr, *skew, pt_unit, absolute); tex_end_diagnostic(); } break; @@ -2793,11 +2765,11 @@ static int tex_aux_compute_accent_skew(halfword target, int flags, scaled *s, ha if (p && ! node_next(p)) { switch (node_type(p)) { case accent_noad: - absolute = tex_aux_compute_accent_skew(p, flags, s, size); + absolute = tex_aux_compute_accent_skew(p, flags, skew, size); break; case simple_noad: if (! noad_has_following_scripts(p)) { - absolute = tex_aux_compute_accent_skew(p, flags, s, size); + absolute = tex_aux_compute_accent_skew(p, flags, skew, size); } break; } @@ -2812,12 +2784,14 @@ static int tex_aux_compute_accent_skew(halfword target, int flags, scaled *s, ha } return absolute; } + static void tex_aux_do_make_math_accent(halfword target, halfword accentfnt, halfword accentchr, int flags, int style, int size, scaled *accenttotal) { /*tex The width and height (without scripts) of base character: */ scaled baseheight = 0; // scaled basedepth = 0; scaled basewidth = 0; + scaled usedwidth = 0; /*tex The space to remove between accent and base: */ scaled delta = 0; scaled overshoot = 0; @@ -2825,11 +2799,14 @@ static void tex_aux_do_make_math_accent(halfword target, halfword accentfnt, hal halfword attrlist = node_attr(target); scaled fraction = accent_fraction(target) > 0 ? accent_fraction(target) : 1000; scaled skew = 0; + scaled offset = 0; halfword accent = null; halfword base = null; halfword result = null; halfword nucleus = noad_nucleus(target); halfword stretch = (flags & stretch_accent_code) == stretch_accent_code; + halfword basefnt = null_font; + halfword basechr = 0; /*tex Compute the amount of skew, or set |skew| to an alignment point. This will be true if a top-accent has been determined. @@ -2850,32 +2827,49 @@ static void tex_aux_do_make_math_accent(halfword target, halfword accentfnt, hal baseheight = box_height(base); // basedepth = box_depth(base); } - if (! absolute && tex_aux_math_engine_control(accentfnt, math_control_accent_skew_half)) { + if (base) { + halfword list = box_list(base); + if (list && node_type(list) == glyph_node) { + basefnt = glyph_font(list); + basechr = glyph_character(list); + } + } + if (stretch && absolute && (flags & top_accent_code) && tex_aux_math_engine_control(accentfnt, math_control_accent_top_skew_with_offset)) { + /*tex + This assumes a font that has been tuned for it. We used a privately made font (will be + in the \CONTEXT\ distribution) RalphSmithsFormalScript.otf (derived from the type one + font) for experimenting with top accents and these parameters. The idea is to have a + decent accent on the very slanted top (of e.g. A) that sticks out a little at the right + edge but still use glyphs with a proper boundingbox, so no messing around with italic + correction. Eventually this might become a more advanced (general) mechanism. Watch the + formula for calculating the used width. + */ + if (base && basefnt && basechr) { + offset = tex_char_top_overshoot_from_font(basefnt, basechr); + offset = offset == INT_MIN ? 0 : tex_aux_math_x_size_scaled(basefnt, offset, size); + } + usedwidth = 2 * ((skew < (basewidth - skew) ? skew : (basewidth - skew)) + offset); + } else if (! absolute && tex_aux_math_engine_control(accentfnt, math_control_accent_skew_half)) { skew = tex_half_scaled(basewidth); absolute = 1; + usedwidth = basewidth; + } else { + usedwidth = basewidth; } /*tex Todo: |w = w - loffset - roffset| but then we also need to add a few kerns so no hurry with that one. */ - if (stretch && (tex_char_width_from_font(accentfnt, accentchr) < basewidth)) { + if (stretch && (tex_char_width_from_font(accentfnt, accentchr) < usedwidth)) { /*tex Switch to a larger accent if available and appropriate */ scaled target = 0; if (flags & overlay_accent_code) { target = baseheight; } else { - target += basewidth; - if (base) { - /*tex Use larger margins, */ - halfword list = box_list(base); - if (list && node_type(list) == glyph_node) { - halfword basefnt = glyph_font(list); - halfword basechr = glyph_character(list); - if (basefnt && basechr) { - target += tex_aux_math_x_size_scaled(basefnt, tex_char_right_margin_from_font(basefnt, basechr), size); - target += tex_aux_math_x_size_scaled(basefnt, tex_char_left_margin_from_font(basefnt, basechr), size); - } - } + target += usedwidth; + if (base && basefnt && basechr) { + target += tex_aux_math_x_size_scaled(basefnt, tex_char_right_margin_from_font(basefnt, basechr), size); + target += tex_aux_math_x_size_scaled(basefnt, tex_char_left_margin_from_font(basefnt, basechr), size); } } if (fraction > 0) { @@ -2891,7 +2885,7 @@ static void tex_aux_do_make_math_accent(halfword target, halfword accentfnt, hal we don't step. */ halfword overlap = tex_get_math_x_parameter_checked(style, math_parameter_connector_overlap_min); - accent = tex_aux_get_delimiter_box(accentfnt, accentchr, basewidth, overlap, 1, attrlist); + accent = tex_aux_get_delimiter_box(accentfnt, accentchr, usedwidth, overlap, 1, attrlist); accent = register_extensible(accentfnt, accentchr, size, accent, attrlist); break; } else if (! tex_char_has_tag_from_font(accentfnt, accentchr, list_tag)) { @@ -2918,7 +2912,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); + accent = tex_aux_char_box(accentfnt, accentchr, attrlist, NULL, glyph_math_accent_subtype, basewidth, style); // usedwidth } if (accenttotal) { *accenttotal = box_total(accent); @@ -2931,7 +2925,7 @@ static void tex_aux_do_make_math_accent(halfword target, halfword accentfnt, hal halfword flatchr = tex_char_flat_accent_from_font(accentfnt, accentchr); if (flatchr != INT_MIN && flatchr != accentchr) { tex_flush_node(accent); - accent = tex_aux_char_box(accentfnt, flatchr, attrlist, NULL, glyph_math_accent_subtype, basewidth, style); + accent = tex_aux_char_box(accentfnt, flatchr, attrlist, NULL, glyph_math_accent_subtype, usedwidth, style); if (tracing_math_par >= 2) { tex_begin_diagnostic(); tex_print_format("[math: flattening accent, old %x, new %x]", accentchr, flatchr); @@ -2976,17 +2970,6 @@ static void tex_aux_do_make_math_accent(halfword target, halfword accentfnt, hal base = tex_aux_clean_box(nucleus, style, style, math_nucleus_list, 1, NULL); /* keep italic */ delta = delta + box_height(base) - baseheight; baseheight = box_height(base); - } else { - /*tex We have only pure math char nodes here:*/ - // halfword basefnt = tex_fam_fnt(math_family(nucleus), size); - // if (tex_aux_has_opentype_metrics(basefnt)) { - // halfword basechr = math_character(nucleus); - // if (math_kernel_node_has_option(nucleus, math_kernel_no_italic_correction)) { - // italic = 0; - // } else if (tex_aux_math_engine_control(basefnt, math_control_accent_italic_kern)) { - // italic = tex_aux_math_x_style_scaled(basefnt, tex_char_italic_from_font(basefnt, basechr), size); - // } - // } } /*tex The top accents of both characters are aligned. */ { @@ -2997,7 +2980,7 @@ 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_top_accent_from_font(accentfnt, accentchr); /* no bot accent key */ + anchor = tex_char_unchecked_top_anchor_from_font(accentfnt, accentchr); /* no bot accent key */ if (anchor != INT_MIN) { anchor = tex_aux_math_y_size_scaled(accentfnt, anchor, size); /* why y and not x */ } else { @@ -3064,14 +3047,6 @@ static void tex_aux_do_make_math_accent(halfword target, halfword accentfnt, hal box_shift_amount(result) = - delta; } box_width(result) += overshoot; - // if (italic) { - // /*tex - // The old font codepath has ic built in, but new font code doesn't so we add - // the correction here. - // */ - // tex_aux_math_insert_italic_kern(result, italic, nucleus, "accent"); - // box_width(result) += italic ; - // } kernel_math_list(nucleus) = result; node_type(nucleus) = sub_box_node; } @@ -3199,6 +3174,8 @@ static void tex_aux_wrap_fraction_result(halfword target, int style, int size, h if (tex_math_has_class_option(fraction_noad_subtype, prefer_delimiter_dimensions_class_option)) { kerns->height = extremes.height; kerns->depth = extremes.depth; + kerns->dimensions = 1; + kerns->font = extremes.tfont; } } /* tex_aux_normalize_delimiters(left, right); */ @@ -3220,16 +3197,24 @@ static void tex_aux_wrap_fraction_result(halfword target, int style, int size, h /*tex The numerator and denominator must be separated by a certain minimum clearance, called |clr| in the following program. The difference between |clr| and the actual clearance is |2 * delta|. + + In the case of a fraction line, the minimum clearance depends on the actual thickness of the + line but we've moved that elsewhere. This gap vs up/down is kindo f weird anyway. */ -static void tex_aux_calculate_fraction_shifts_stack(halfword target, int style, int size, halfword numerator, halfword denominator, scaled *shift_up, scaled *shift_down, scaled *delta) +static void tex_aux_calculate_fraction_shifts(halfword target, int style, int size, scaled *shift_up, scaled *shift_down, int up, int down) { - scaled clearance = tex_get_math_y_parameter_checked(style, math_parameter_stack_vgap); (void) size; - *shift_up = tex_get_math_y_parameter_checked(style, math_parameter_stack_num_up); - *shift_down = tex_get_math_y_parameter_checked(style, math_parameter_stack_denom_down); + *shift_up = tex_get_math_y_parameter_checked(style, up); + *shift_down = tex_get_math_y_parameter_checked(style, down); *shift_up = tex_round_xn_over_d(*shift_up, fraction_v_factor(target), 1000); *shift_down = tex_round_xn_over_d(*shift_down, fraction_v_factor(target), 1000); +} + +static void tex_aux_calculate_fraction_shifts_stack(halfword target, int style, int size, halfword numerator, halfword denominator, scaled *shift_up, scaled *shift_down, scaled *delta) +{ + scaled clearance = tex_get_math_y_parameter_checked(style, math_parameter_stack_vgap); + tex_aux_calculate_fraction_shifts(target, style, size, shift_up, shift_down, math_parameter_stack_num_up, math_parameter_stack_denom_down); *delta = tex_half_scaled(clearance - ((*shift_up - box_depth(numerator)) - (box_height(denominator) - *shift_down))); if (*delta > 0) { *shift_up += *delta; @@ -3237,11 +3222,6 @@ static void tex_aux_calculate_fraction_shifts_stack(halfword target, int style, } } -/*tex - In the case of a fraction line, the minimum clearance depends on the actual thickness of the - line. -*/ - static void tex_aux_calculate_fraction_shifts_normal(halfword target, int style, int size, halfword numerator, halfword denominator, scaled *shift_up, scaled *shift_down, scaled *delta) { scaled axis = tex_aux_math_axis(size); @@ -3249,26 +3229,17 @@ static void tex_aux_calculate_fraction_shifts_normal(halfword target, int style, scaled denominator_clearance = tex_get_math_y_parameter_checked(style, math_parameter_fraction_denom_vgap); scaled delta_up = 0; scaled delta_down = 0; - *shift_up = tex_get_math_y_parameter_checked(style, math_parameter_fraction_num_up); - *shift_down = tex_get_math_y_parameter_checked(style, math_parameter_fraction_denom_down); - *shift_up = tex_round_xn_over_d(*shift_up, fraction_v_factor(target), 1000); - *shift_down = tex_round_xn_over_d(*shift_down, fraction_v_factor(target), 1000); + tex_aux_calculate_fraction_shifts(target, style, size, shift_up, shift_down, math_parameter_fraction_num_up, math_parameter_fraction_denom_down); /* hm, delta is only set when we have a middle delimiter ... needs checking .. i should write this from scratch */ *delta = tex_half_scaled(tex_aux_math_given_y_scaled(fraction_rule_thickness(target))); - if (has_noad_option_exact(target)) { - delta_up = numerator_clearance - ((*shift_up - box_depth(numerator) ) - (axis + *delta)); - delta_down = denominator_clearance - ((*shift_down - box_height(denominator)) + (axis - *delta)); - } else { - // maybe this is just the old tex code path - scaled rule_thickness = tex_aux_math_given_y_scaled(fraction_rule_thickness(target)); - scaled rule_parameter = tex_get_math_y_parameter_checked(style, math_parameter_fraction_rule); - numerator_clearance = tex_ext_xn_over_d(numerator_clearance, rule_thickness, rule_parameter); - denominator_clearance = tex_ext_xn_over_d(denominator_clearance, rule_thickness, rule_parameter); - delta_up = numerator_clearance - ((*shift_up - box_depth(numerator) ) - (axis + *delta)); - delta_down = denominator_clearance - ((*shift_down - box_height(denominator)) + (axis - *delta)); + delta_up = numerator_clearance - ((*shift_up - box_depth(numerator) ) - (axis + *delta)); + delta_down = denominator_clearance - ((*shift_down - box_height(denominator)) + (axis - *delta)); + if (delta_up > 0) { + *shift_up += delta_up; + } + if (delta_down > 0) { + *shift_down += delta_down; } - *shift_up += delta_up; - *shift_down += delta_down; } static scaled tex_aux_check_fraction_rule(halfword target, int style, int size, int fractiontype, halfword *usedfam) @@ -3285,6 +3256,12 @@ static scaled tex_aux_check_fraction_rule(halfword target, int style, int size, } else if (fractiontype == above_fraction_subtype) { /*tex Bypassed by command. */ preferfont = 0; + if (has_noad_option_proportional(target)) { + /* We replaced the non |exact| code path by this one: */ + scaled text = tex_get_math_y_parameter_checked(text_style, math_parameter_fraction_rule); + scaled here = tex_get_math_y_parameter_checked(style, math_parameter_fraction_rule); + fraction_rule_thickness(target) = tex_ext_xn_over_d(fraction_rule_thickness(target), here, text); + } } else if (fraction_rule_thickness(target)) { /*tex Controlled by optional parameter. */ preferfont = 1; @@ -3296,7 +3273,7 @@ static scaled tex_aux_check_fraction_rule(halfword target, int style, int size, } } if (fraction_rule_thickness(target) == preset_rule_thickness) { - fraction_rule_thickness(target) = tex_get_math_y_parameter_checked(style, math_parameter_fraction_rule); + fraction_rule_thickness(target) = tex_get_math_y_parameter_checked(style, math_parameter_fraction_rule); } if (usedfam) { *usedfam = fam; @@ -3371,7 +3348,7 @@ static halfword tex_aux_make_skewed_fraction(halfword target, int style, int siz shift_up = shift_down; /*tex The |shift_up| value might change later. */ tex_aux_wrap_fraction_parts(target, style, size, &numerator, &denominator, 0); /*tex - Here we don't share code bnecause we're going horizontal. + Here we don't share code because we're going horizontal. */ if (! has_noad_option_noaxis(target)) { shift_up += tex_half_scaled(tex_aux_math_axis(size)); @@ -3582,9 +3559,8 @@ static halfword tex_aux_check_nucleus_complexity ( ); /* - For easy configuration ... fonts are somewhat inconsistent and the - values for italic correction run from 30 to 60\% of the width. - + For easy configuration ... fonts are somewhat inconsistent and the values for italic correction + run from 30 to 60\% of the width. */ static void tex_aux_get_shifts(int mode, int style, scaled delta, scaled *top, scaled *bot) @@ -3623,415 +3599,44 @@ static void tex_aux_get_shifts(int mode, int style, scaled delta, scaled *top, s } } -// static scaled tex_aux_make_op(halfword q, int style, int size, int italic, int forced_no_limits, kernset *kerns) -// { -// /*tex for historic reasons we have two flags .. because we need to adapt to the style */ -// int limits = has_noad_option_limits(q); -// int nolimits = has_noad_option_nolimits(q); -// if (! limits && ! nolimits && (style == display_style || style == cramped_display_style)) { -// nolimits = 0; -// limits = 1; -// noad_options(q) |= noad_option_limits; /* so we can track it */ -// } -// if (forced_no_limits) { -// nolimits = 1; -// } -// if (node_type(noad_nucleus(q)) == math_char_node) { -// halfword x; -// int shiftaxis = 0; -// halfword chr = null; -// halfword fnt = null; -// halfword autoleft = null; -// halfword autoright = null; -// halfword autosize = has_noad_option_auto(q); -// scaled openupheight = has_noad_option_openupheight(q) ? noad_height(q) : 0; -// scaled openupdepth = has_noad_option_openupdepth(q) ? noad_depth(q) : 0; -// if (has_noad_option_adapttoleft(q) && node_prev(q)) { -// autoleft = node_prev(q); -// if (node_type(autoleft) != simple_noad) { -// autoleft = null; -// } else { -// autoleft = noad_new_hlist(autoleft); -// } -// } -// if (has_noad_option_adapttoright(q) && node_next(q)) { -// autoright = noad_nucleus(node_next(q)); -// } -// tex_aux_fetch(noad_nucleus(q), "operator", &fnt, &chr); -// /*tex Nicer is actually to just test for |display_style|. */ -// if ((style < text_style) || autoleft || autoright || autosize) { -// /*tex Try to make it larger in displaystyle. */ -// scaled opsize = tex_get_math_parameter(style, math_parameter_operator_size, NULL); -// if ((autoleft || autoright || autosize) && (opsize == undefined_math_parameter)) { -// opsize = 0; -// } -// if (opsize != undefined_math_parameter) { -// /*tex Creating a temporary delimiter is the cleanest way. */ -// halfword y = tex_new_node(delimiter_node, 0); -// tex_attach_attribute_list_copy(y, noad_nucleus(q)); -// delimiter_small_family(y) = math_family(noad_nucleus(q)); -// delimiter_small_character(y) = math_character(noad_nucleus(q)); -// opsize = tex_aux_math_y_scaled(opsize, style); -// if (autoright) { -// /*tex We look ahead and preroll, |autoright| is a noad. */ -// scaledwhd siz = tex_natural_hsizes(autoright, null, 0.0, 0, 0); -// scaled total = siz.ht + siz.dp; -// if (total > opsize) { -// opsize = total; -// } -// } -// if (autoleft && box_total(autoleft) > opsize) { -// /*tex We look back and check, |autoleft| is a box. */ -// opsize = box_total(autoleft); -// } -// /* we need to check for overflow here */ -// opsize += limited_scaled(openupheight); -// opsize += openupdepth; -// x = tex_aux_make_delimiter(y, text_size, opsize, 0, style, ! has_noad_option_noaxis(q), noad_options(q), NULL, &italic, 0, has_noad_option_nooverflow(q), NULL); -// // if (italic) { -// // if (lmt_math_state.opentype) { -// // /*tex -// // As we never added italic correction we don't need to compensate. The ic -// // is stored in a special field of the node and applied in some occasions. -// // */ -// // } else if (noad_subscr(q) && ! has_noad_option_limits(q)) { /* todo: control option */ -// // /*tex -// // Here we (selectively) remove the italic correction that always gets added -// // in a traditional font. See (**). In \OPENTYPE\ mode we insert italic kerns, -// // but in traditional mode it's width manipulation. This actually makes sense -// // because those fonts have a fake width and the italic correction sets that -// // right. -// // */ -// // box_list(x) = tex_aux_math_remove_italic_kern(box_list(x), &italic, "operator"); -// // box_width(x) -= italic; -// // } -// // } -// } else { -// /*tex -// Where was the weird + 1 coming from? It tweaks the comparison. Anyway, because we -// do a lookup we don't need to scale the |total| and |opsize|. We have a safeguard -// against endless loops. -// */ -// opsize = tex_char_total_from_font(fnt, chr) + openupheight + openupdepth + 1; -// /* -// if (opsize) { -// opsize = tex_aux_math_y_style_scaled(fnt, opsize, size); // we compare unscaled -// } -// */ -// while (tex_char_tag_from_font(fnt, chr) == list_tag && tex_char_total_from_font(fnt, chr) < opsize) { -// halfword rem = tex_char_remainder_from_font(fnt, chr); -// if (chr != rem && tex_char_exists(fnt, rem)) { -// chr = rem; -// math_character(noad_nucleus(q)) = chr; -// } else { -// break; -// } -// } -// if (math_kernel_node_has_option(noad_nucleus(q), math_kernel_no_italic_correction)) { -// italic = 0; -// } else { -// italic = tex_aux_math_x_size_scaled(fnt, tex_char_italic_from_font(fnt, chr), size); -// } -// x = tex_aux_clean_box(noad_nucleus(q), style, style, math_nucleus_list, 0, NULL); -// // if (italic) { -// // if (lmt_math_state.opentype) { -// // /*tex we never added italic correction unless we had a |mlist_to_hlist| call. */ -// // } else if (noad_subscr(q) && ! has_noad_option_limits(q)) { /* todo: control option */ -// // box_list(x) = tex_aux_math_remove_italic_kern(box_list(x), &italic, "operator"); -// // box_width(x) -= italic; -// // } -// // } -// shiftaxis = 1; -// } -// } else { -// /*tex Non display style. */ -// italic = tex_aux_math_x_size_scaled(fnt, tex_char_italic_from_font(fnt, chr), size); -// x = tex_aux_clean_box(noad_nucleus(q), style, style, math_nucleus_list, 0, NULL); -// // if (italic) { -// // if (lmt_math_state.opentype) { -// // /*tex We never added italic correction, but it gets ignored anyway. */ -// // box_width(x) -= italic; -// // } else if (noad_subscr(q) && ! has_noad_option_limits(q)) { /* todo: control option, what does this assume from the font */ -// // /*tex remove italic correction */ -// // box_width(x) -= italic; -// // } -// // } -// box_height(x) += openupheight; -// box_depth(x) += openupdepth; -// shiftaxis = 1; -// } -// if (shiftaxis) { -// /*tex center vertically */ -// box_shift_amount(x) = tex_half_scaled(box_height(x) - box_depth(x)) - tex_aux_math_axis(size); -// } -// if ((node_type(x) == hlist_node) && (openupheight || openupdepth)) { -// box_shift_amount(x) -= openupheight/2; -// box_shift_amount(x) += openupdepth/2; -// } -// node_type(noad_nucleus(q)) = sub_box_node; -// math_list(noad_nucleus(q)) = x; -// } -// if (nolimits) { -// /*tex -// We end up here when there is an explicit directive or when we're in displaymode without -// an explicit directive. If in text mode we want to have this mode driven placement tweak -// we need to use the |\nolimits| directive. Beware: that mode might be changed to a font -// property or option itself. -// */ -// // if (lmt_math_state.opentype) { -// kernset localkerns = { .tr = 0, .br = 0, .tl = 0, .bl = 0 }; -// if (kerns) { -// localkerns.tr = kerns->tr; -// localkerns.br = kerns->br; -// localkerns.tl = kerns->tl; -// localkerns.bl = kerns->bl; -// } -// halfword p = tex_aux_check_nucleus_complexity(q, NULL, style, lmt_math_state.size, &localkerns); -// if (noad_has_scripts(q)) { -// scaled top = 0; /*tex Normally this would be: | delta|. */ -// scaled bot = 0; /*tex Normally this would be: |-delta|. */ -// if (localkerns.tr || localkerns.br) { -// italic = 0; -// } -// tex_aux_get_shifts(math_nolimits_mode_par, style, italic, &top, &bot); -// tex_aux_make_scripts(q, p, 0, style, top, bot, 0, &localkerns); -// } else { -// tex_aux_assign_new_hlist(q, p); -// } -// italic = 0; -// // } else { -// // /*tex similar code as in the caller */ -// // halfword p = tex_aux_check_nucleus_complexity(q, &italic, style, lmt_math_state.size, NULL); -// // if (noad_has_scripts(q)) { -// // tex_aux_make_scripts(q, p, italic, style, 0, 0); -// // } else { -// // tex_aux_assign_new_hlist(q, p); -// // } -// // } -// } else if (limits) { -// /*tex -// -// The following program builds a vlist box |v| for displayed limits. The width of the box -// is not affected by the fact that the limits may be skewed. -// -// We end up here when we have a limits directive or when that property is set because -// we're in displaymode. -// */ -// halfword nucleus = noad_nucleus(q); -// halfword x = tex_aux_clean_box(noad_supscr(q), tex_math_style_variant(style, math_parameter_superscript_variant), style, math_sup_list, 0, NULL); -// halfword y = tex_aux_clean_box(nucleus, style, style, math_nucleus_list, 0, NULL); -// halfword z = tex_aux_clean_box(noad_subscr(q), tex_math_style_variant(style, math_parameter_subscript_variant), style, math_sub_list, 0, NULL); -// halfword result = tex_new_null_box_node(vlist_node, math_modifier_list); -// tex_attach_attribute_list_copy(result, q); -// if (nucleus) { -// switch (node_type(nucleus)) { -// case sub_mlist_node: -// case sub_box_node: -// { -// halfword n = math_list(nucleus); -// if (! n) { -// /* kind of special */ -// } else if (node_type(n) == hlist_node) { -// /*tex just a not scaled char */ -// n = box_list(n); -// while (n) { -// if (node_type(n) == glyph_node && ! tex_has_glyph_option(n, glyph_option_no_italic_correction)) { -// if (tex_aux_math_engine_control(glyph_font(n), math_control_apply_boxed_italic_kern)) { -// italic = tex_aux_math_x_size_scaled(glyph_font(n), tex_char_italic_from_font(glyph_font(n), glyph_character(n)), size); -// } -// } -// n = node_next(n); -// } -// } else { -// /*tex This might need checking. */ -// while (n) { -// if (node_type(n) == fence_noad && noad_italic(n) > italic) { -// /*tex we can have dummies, the period ones */ -// italic = tex_aux_math_given_x_scaled(noad_italic(n)); -// } -// n = node_next(n); -// } -// } -// break; -// } -// case math_char_node: -// { -// halfword fnt = tex_fam_fnt(math_family(nucleus), size); -// halfword chr = math_character(nucleus); -// italic = tex_aux_math_x_size_scaled(fnt, tex_char_italic_from_font(fnt, chr), size); -// break; -// } -// } -// } -// /*tex We're still doing limits. */ -// { -// scaled halfitalic = tex_half_scaled(italic); -// scaled supwidth = box_width(x); -// scaled boxwidth = box_width(y); -// scaled subwidth = box_width(z); -// box_width(result) = boxwidth; -// if (supwidth > boxwidth) { -// boxwidth = supwidth; -// } -// if (subwidth > boxwidth) { -// boxwidth = subwidth; -// } -// box_width(result) = boxwidth; -// x = tex_aux_rebox(x, boxwidth, size); -// y = tex_aux_rebox(y, boxwidth, size); -// z = tex_aux_rebox(z, boxwidth, size); -// /*tex This is only (visually) ok for integrals, but other operators have no italic anyway. */ -// box_shift_amount(x) = halfitalic; -// box_shift_amount(z) = -halfitalic; -// if (math_limits_mode_par >= 1) { -// /*tex -// This option enforces the real dimensions and avoids longer limits to stick out -// which is a traditional \TEX\ feature. It's handy to have this for testing. Nicer -// would be to also adapt the width of the wrapped scripts but these are reboxed -// with centering so we keep that as it is. -// */ -// if (supwidth + halfitalic > boxwidth) { -// box_width(result) += supwidth + halfitalic - boxwidth; -// } -// if (subwidth + halfitalic > boxwidth) { -// box_x_offset(result) = subwidth + halfitalic - boxwidth; -// box_width(result) += box_x_offset(result); -// tex_set_box_geometry(result, offset_geometry); -// } -// } else { -// /*tex We keep the possible left and/or right overshoot of limits. */ -// } -// /*tex Here the target |v| is still empty but we do set the height and depth. */ -// box_height(result) = box_height(y); -// box_depth(result) = box_depth(y); -// } -// /*tex -// -// Attach the limits to |y| and adjust |height(v)|, |depth(v)| to account for -// their presence. -// -// We use |shift_up| and |shift_down| in the following program for the amount of -// glue between the displayed operator |y| and its limits |x| and |z|. -// -// The vlist inside box |v| will consist of |x| followed by |y| followed by |z|, -// with kern nodes for the spaces between and around them; |b| is baseline and |v| -// is the minumum gap. -// -// */ -// if (noad_supscr(q)) { -// scaled bgap = tex_get_math_y_parameter_checked(style, math_parameter_limit_above_bgap); -// scaled vgap = tex_get_math_y_parameter_checked(style, math_parameter_limit_above_vgap); -// scaled vkern = tex_get_math_y_parameter_checked(style, math_parameter_limit_above_kern); -// scaled vshift = bgap - box_depth(x); -// if (vshift < vgap) { -// vshift = vgap; -// } -// if (vshift) { -// halfword kern = tex_new_kern_node(vshift, vertical_math_kern_subtype); -// tex_attach_attribute_list_copy(kern, q); -// tex_couple_nodes(kern, y); -// tex_couple_nodes(x, kern); -// } else { -// tex_couple_nodes(y, x); -// } -// if (vkern) { -// halfword kern = tex_new_kern_node(vkern, vertical_math_kern_subtype); -// tex_attach_attribute_list_copy(kern, q); -// tex_couple_nodes(kern, x); -// box_list(result) = kern; -// } else { -// box_list(result) = x; -// } -// box_height(result) += vkern + box_total(x) + vshift; -// } else { -// box_list(x) = null; -// tex_flush_node(x); -// box_list(result) = y; -// } -// if (noad_subscr(q)) { -// scaled bgap = tex_get_math_y_parameter_checked(style, math_parameter_limit_below_bgap); -// scaled vgap = tex_get_math_y_parameter_checked(style, math_parameter_limit_below_vgap); -// scaled vkern = tex_get_math_y_parameter_checked(style, math_parameter_limit_below_kern); -// scaled vshift = bgap - box_height(z); -// if (vshift < vgap) { -// vshift = vgap; -// } -// if (vshift) { -// halfword kern = tex_new_kern_node(vshift, vertical_math_kern_subtype); -// tex_attach_attribute_list_copy(kern, q); -// tex_couple_nodes(y, kern); -// tex_couple_nodes(kern, z); -// } else { -// tex_couple_nodes(y, z); -// } -// if (vkern) { -// halfword kern = tex_new_kern_node(vkern, vertical_math_kern_subtype); -// tex_attach_attribute_list_copy(kern, q); -// tex_couple_nodes(z, kern); -// } -// box_depth(result) += vkern + box_total(z) + vshift; -// } else { -// box_list(z) = null; -// tex_flush_node(z); -// } -// if (noad_subscr(q)) { -// math_list(noad_subscr(q)) = null; -// tex_flush_node(noad_subscr(q)); -// noad_subscr(q) = null; -// } -// if (noad_supscr(q)) { -// math_list(noad_supscr(q)) = null; -// tex_flush_node(noad_supscr(q)); -// noad_supscr(q) = null; -// } -// tex_aux_assign_new_hlist(q, result); -// // if (lmt_math_state.opentype) { -// italic = 0; -// // } -// } else { -// /*tex -// We end up here when we're not in displaymode and don't have a (no)limits directive. -// */ -// } -// return italic; -// } - -static scaled tex_aux_op_no_limits(halfword target, int style, int size, int italic, kernset *kerns) +static scaled tex_aux_op_no_limits(halfword target, int style, int size, int italic, kernset *kerns, int forceitalics) { kernset localkerns ; - halfword p; + halfword kernel; (void) size; + (void) forceitalics; if (kerns) { tex_math_copy_kerns(&localkerns, kerns); } else { tex_math_wipe_kerns(&localkerns); } - p = tex_aux_check_nucleus_complexity(target, NULL, style, lmt_math_state.size, &localkerns); + kernel = tex_aux_check_nucleus_complexity(target, NULL, style, lmt_math_state.size, &localkerns); if (noad_has_scripts(target)) { - scaled top = 0; /*tex Normally this would be: | delta|. */ - scaled bot = 0; /*tex Normally this would be: |-delta|. */ + scaled topshift = 0; /*tex Normally this would be: | delta|. */ + scaled botshift = 0; /*tex Normally this would be: |-delta|. */ if (localkerns.topright || localkerns.bottomright) { italic = 0; } - tex_aux_get_shifts(math_nolimits_mode_par, style, italic, &top, &bot); - tex_aux_make_scripts(target, p, 0, style, top, bot, 0, &localkerns); + tex_aux_get_shifts(math_nolimits_mode_par, style, italic, &topshift, &botshift); + tex_aux_make_scripts(target, kernel, 0, style, topshift, botshift, 0, &localkerns); } else { - tex_aux_assign_new_hlist(target, p); + tex_aux_assign_new_hlist(target, kernel); } // italic = 0; return 0; } -static scaled tex_aux_op_do_limits(halfword target, int style, int size, int italic, kernset *kerns) +static scaled tex_aux_op_do_limits(halfword target, int style, int size, int italic, kernset *kerns, int forceitalics) { halfword nucleus = noad_nucleus(target); - halfword x = tex_aux_clean_box(noad_supscr(target), tex_math_style_variant(style, math_parameter_superscript_variant), style, math_sup_list, 0, NULL); - halfword y = tex_aux_clean_box(nucleus, style, style, math_nucleus_list, 0, NULL); - halfword z = tex_aux_clean_box(noad_subscr(target), tex_math_style_variant(style, math_parameter_subscript_variant), style, math_sub_list, 0, NULL); + halfword superscript = tex_aux_clean_box(noad_supscr(target), tex_math_style_variant(style, math_parameter_superscript_variant), style, math_sup_list, 0, NULL); + halfword kernel = tex_aux_clean_box(nucleus, style, style, math_nucleus_list, forceitalics, NULL); + halfword subscript = tex_aux_clean_box(noad_subscr(target), tex_math_style_variant(style, math_parameter_subscript_variant), style, math_sub_list, 0, NULL); halfword result = tex_new_null_box_node(vlist_node, math_modifier_list); (void) kerns; tex_attach_attribute_list_copy(result, target); if (nucleus) { + // todo: get rid of redundant italic calculation ... it is still a mess .. maybe use noad_italic .. then this whole branch can go switch (node_type(nucleus)) { case sub_mlist_node: case sub_box_node: @@ -4072,11 +3677,27 @@ static scaled tex_aux_op_do_limits(halfword target, int style, int size, int ita } } /*tex We're still doing limits. */ - { + if (noad_supscr(target) || noad_subscr(target)) { + scaled supwidth = box_width(superscript); + scaled boxwidth = box_width(kernel); + scaled subwidth = box_width(subscript); scaled halfitalic = tex_half_scaled(italic); - scaled supwidth = box_width(x); - scaled boxwidth = box_width(y); - scaled subwidth = box_width(z); + halfword topshift = halfitalic; + halfword bottomshift = halfitalic; + if (kerns && ! halfitalic) { + halfword fnt = kerns->font; + halfword chr = kerns->character; + if (fnt && chr) { + scaled t = tex_aux_math_x_size_scaled(fnt, tex_char_top_anchor_from_font(fnt, chr), size); + scaled b = tex_aux_math_x_size_scaled(fnt, tex_char_bottom_anchor_from_font(fnt, chr), size); + if (t) { + topshift = t - boxwidth; + } + if (b) { + bottomshift = boxwidth - b; + } + } + } box_width(result) = boxwidth; if (supwidth > boxwidth) { boxwidth = supwidth; @@ -4085,12 +3706,12 @@ static scaled tex_aux_op_do_limits(halfword target, int style, int size, int ita boxwidth = subwidth; } box_width(result) = boxwidth; - x = tex_aux_rebox(x, boxwidth, size); - y = tex_aux_rebox(y, boxwidth, size); - z = tex_aux_rebox(z, boxwidth, size); + superscript = tex_aux_rebox(superscript, boxwidth, size); + kernel = tex_aux_rebox(kernel, boxwidth, size); + subscript = tex_aux_rebox(subscript, boxwidth, size); /*tex This is only (visually) ok for integrals, but other operators have no italic anyway. */ - box_shift_amount(x) = halfitalic; - box_shift_amount(z) = -halfitalic; + box_shift_amount(superscript) = topshift; + box_shift_amount(subscript) = -bottomshift; if (math_limits_mode_par >= 1) { /*tex This option enforces the real dimensions and avoids longer limits to stick out @@ -4098,11 +3719,11 @@ static scaled tex_aux_op_do_limits(halfword target, int style, int size, int ita would be to also adapt the width of the wrapped scripts but these are reboxed with centering so we keep that as it is. */ - if (supwidth + halfitalic > boxwidth) { - box_width(result) += supwidth + halfitalic - boxwidth; + if (supwidth + topshift > boxwidth) { + box_width(result) += supwidth + topshift - boxwidth; } - if (subwidth + halfitalic > boxwidth) { - box_x_offset(result) = subwidth + halfitalic - boxwidth; + if (subwidth + bottomshift > boxwidth) { + box_x_offset(result) = subwidth + bottomshift - boxwidth; box_width(result) += box_x_offset(result); tex_set_box_geometry(result, offset_geometry); } @@ -4110,8 +3731,12 @@ static scaled tex_aux_op_do_limits(halfword target, int style, int size, int ita /*tex We keep the possible left and/or right overshoot of limits. */ } /*tex Here the target |v| is still empty but we do set the height and depth. */ - box_height(result) = box_height(y); - box_depth(result) = box_depth(y); + box_height(result) = box_height(kernel); + box_depth(result) = box_depth(kernel); + } else { + box_width(result) = box_width(kernel); + box_height(result) = box_height(kernel); + box_depth(result) = box_depth(kernel); } /*tex @@ -4126,61 +3751,61 @@ static scaled tex_aux_op_do_limits(halfword target, int style, int size, int ita is the minumum gap. */ - if (noad_supscr(target)) { + if (noad_supscr(target)) { scaled bgap = tex_get_math_y_parameter_checked(style, math_parameter_limit_above_bgap); scaled vgap = tex_get_math_y_parameter_checked(style, math_parameter_limit_above_vgap); scaled vkern = tex_get_math_y_parameter_checked(style, math_parameter_limit_above_kern); - scaled vshift = bgap - box_depth(x); + scaled vshift = bgap - box_depth(superscript); if (vshift < vgap) { vshift = vgap; } if (vshift) { halfword kern = tex_new_kern_node(vshift, vertical_math_kern_subtype); tex_attach_attribute_list_copy(kern, target); - tex_couple_nodes(kern, y); - tex_couple_nodes(x, kern); + tex_couple_nodes(kern, kernel); + tex_couple_nodes(superscript, kern); } else { - tex_couple_nodes(y, x); + tex_couple_nodes(kernel, superscript); } if (vkern) { halfword kern = tex_new_kern_node(vkern, vertical_math_kern_subtype); tex_attach_attribute_list_copy(kern, target); - tex_couple_nodes(kern, x); + tex_couple_nodes(kern, superscript); box_list(result) = kern; } else { - box_list(result) = x; + box_list(result) = superscript; } - box_height(result) += vkern + box_total(x) + vshift; + box_height(result) += vkern + box_total(superscript) + vshift; } else { - box_list(x) = null; - tex_flush_node(x); - box_list(result) = y; + box_list(superscript) = null; + tex_flush_node(superscript); + box_list(result) = kernel; } if (noad_subscr(target)) { scaled bgap = tex_get_math_y_parameter_checked(style, math_parameter_limit_below_bgap); scaled vgap = tex_get_math_y_parameter_checked(style, math_parameter_limit_below_vgap); scaled vkern = tex_get_math_y_parameter_checked(style, math_parameter_limit_below_kern); - scaled vshift = bgap - box_height(z); + scaled vshift = bgap - box_height(subscript); if (vshift < vgap) { vshift = vgap; } if (vshift) { halfword kern = tex_new_kern_node(vshift, vertical_math_kern_subtype); tex_attach_attribute_list_copy(kern, target); - tex_couple_nodes(y, kern); - tex_couple_nodes(kern, z); + tex_couple_nodes(kernel, kern); + tex_couple_nodes(kern, subscript); } else { - tex_couple_nodes(y, z); + tex_couple_nodes(kernel, subscript); } if (vkern) { halfword kern = tex_new_kern_node(vkern, vertical_math_kern_subtype); tex_attach_attribute_list_copy(kern, target); - tex_couple_nodes(z, kern); + tex_couple_nodes(subscript, kern); } - box_depth(result) += vkern + box_total(z) + vshift; + box_depth(result) += vkern + box_total(subscript) + vshift; } else { - box_list(z) = null; - tex_flush_node(z); + box_list(subscript) = null; + tex_flush_node(subscript); } if (noad_subscr(target)) { kernel_math_list(noad_subscr(target)) = null; @@ -4202,9 +3827,9 @@ static scaled tex_aux_op_do_limits(halfword target, int style, int size, int ita we have more fance fence support now. */ -static void tex_aux_op_wrapup(halfword target, int style, int size, int italic, kernset *kerns) +static scaled tex_aux_op_wrapup(halfword target, int style, int size, int italic, kernset *kerns, int forceitalics) { - halfword x; + halfword box; int shiftaxis = 0; halfword chr = null; halfword fnt = null; @@ -4256,7 +3881,7 @@ static void tex_aux_op_wrapup(halfword target, int style, int size, int italic, /* we need to check for overflow here */ opsize += limited_scaled(openupheight); opsize += openupdepth; - x = tex_aux_make_delimiter(target, y, text_size, opsize, 0, style, ! has_noad_option_noaxis(target), NULL, &italic, 0, has_noad_option_nooverflow(target), NULL, 0); + box = tex_aux_make_delimiter(target, y, text_size, opsize, 0, style, ! has_noad_option_noaxis(target), NULL, &italic, 0, has_noad_option_nooverflow(target), NULL, 0); } else { /*tex Where was the weird + 1 coming from? It tweaks the comparison. Anyway, because we @@ -4278,36 +3903,56 @@ static void tex_aux_op_wrapup(halfword target, int style, int size, int italic, break; } } - if (math_kernel_node_has_option(noad_nucleus(target), math_kernel_no_italic_correction)) { + if (math_kernel_node_has_option(noad_nucleus(target), math_kernel_no_italic_correction) && ! forceitalics) { italic = 0; - } else { + } else { italic = tex_aux_math_x_size_scaled(fnt, tex_char_italic_from_font(fnt, chr), size); } - x = tex_aux_clean_box(noad_nucleus(target), style, style, math_nucleus_list, 0, NULL); + box = tex_aux_clean_box(noad_nucleus(target), style, style, math_nucleus_list, 0, NULL); shiftaxis = 1; } } else { /*tex Non display style. */ italic = tex_aux_math_x_size_scaled(fnt, tex_char_italic_from_font(fnt, chr), size); - x = tex_aux_clean_box(noad_nucleus(target), style, style, math_nucleus_list, 0, NULL); - box_height(x) += openupheight; - box_depth(x) += openupdepth; + box = tex_aux_clean_box(noad_nucleus(target), style, style, math_nucleus_list, 0, NULL); + box_height(box) += openupheight; + box_depth(box) += openupdepth; shiftaxis = 1; } if (shiftaxis) { /*tex center vertically */ - box_shift_amount(x) = tex_half_scaled(box_height(x) - box_depth(x)) - tex_aux_math_axis(size); + box_shift_amount(box) = tex_half_scaled(box_height(box) - box_depth(box)) - tex_aux_math_axis(size); } - if ((node_type(x) == hlist_node) && (openupheight || openupdepth)) { - box_shift_amount(x) -= openupheight/2; - box_shift_amount(x) += openupdepth/2; + if ((node_type(box) == hlist_node) && (openupheight || openupdepth)) { + box_shift_amount(box) -= openupheight/2; + box_shift_amount(box) += openupdepth/2; + } + if (forceitalics && italic && box_list(box)) { + /*tex + This features is provided in case one abuses operators in weird ways and expects italic + correction to be part of the width. Maybe it should be an kernel option so that it can + be controlled locally. Now here we enter fuzzy specification teritory. For n-ary + operators we are supposed to use the italic correction for placements of vertical and + horizontal scripts (limits an nolimits) but when we patch the width that gets messy (we + now need to need to backtrack twice times half the correction). The bad news is that + there is no way to see if we have a n-ary unless we add a new class and only for the + lone slanted integrals in lm. So, instead we just zero the correction now. After all, + we can use a fence instead for these n-ary's. Actually there are probably not that many + slanted operators, so it' smore about using a letter as such. So, |italiic *= 2| became + |italic = 0|. + */ + tex_aux_math_insert_italic_kern(tex_tail_of_node_list(box_list(box)), italic, noad_nucleus(target), "operator"); + box_width(box) += italic; + italic = 0; } node_type(noad_nucleus(target)) = sub_box_node; - kernel_math_list(noad_nucleus(target)) = x; + kernel_math_list(noad_nucleus(target)) = box; + return italic; } static scaled tex_aux_make_op(halfword target, int style, int size, int italic, int limits_mode, kernset *kerns) { + int forceitalics = node_subtype(target) == operator_noad_subtype && tex_math_has_class_option(operator_noad_subtype, operator_italic_correction_class_option); if (limits_mode == limits_horizontal_mode) { /*tex We enforce this and it can't be overruled! */ } else if (! has_noad_option_limits(target) && ! has_noad_option_nolimits(target) && (style == display_style || style == cramped_display_style)) { @@ -4319,7 +3964,7 @@ static scaled tex_aux_make_op(halfword target, int style, int size, int italic, limits_mode = limits_vertical_mode; } if (node_type(noad_nucleus(target)) == math_char_node) { - tex_aux_op_wrapup(target, style, size, italic, kerns); + italic = tex_aux_op_wrapup(target, style, size, italic, kerns, forceitalics); } switch (limits_mode) { case limits_horizontal_mode: @@ -4329,7 +3974,7 @@ static scaled tex_aux_make_op(halfword target, int style, int size, int italic, we need to use the |\nolimits| directive. Beware: that mode might be changed to a font property or option itself. */ - return tex_aux_op_no_limits(target, style, size, italic, kerns); /* italic becomes zero */ + return tex_aux_op_no_limits(target, style, size, italic, kerns, forceitalics); /* italic becomes zero */ case limits_vertical_mode: /*tex @@ -4337,12 +3982,13 @@ static scaled tex_aux_make_op(halfword target, int style, int size, int italic, we're in displaymode. The following program builds a vlist box |v| for displayed limits. The width of the box is not affected by the fact that the limits may be skewed. */ - return tex_aux_op_do_limits(target, style, size, italic, kerns); /* italic becomes zero */ + return tex_aux_op_do_limits(target, style, size, italic, kerns, forceitalics); /* italic becomes zero */ default: /*tex - We end up here when we're not in displaymode and don't have a (no)limits directive. + We end up here when we're not in displaymode and don't have a (no)limits directive. + When called the wrong way we loose the nucleus. */ - return italic; /* italic is retained */ + return italic; /* italic is retained, happens very seldom */ } } @@ -4360,133 +4006,6 @@ static scaled tex_aux_make_op(halfword target, int style, int size, int italic, */ -/* How about: ord_noad_type_limits */ - -// inline static int tex_aux_is_simple_char_noad(halfword p) /* only old school characters */ -// { -// return (node_type(p) == simple_noad) && (node_type(noad_nucleus(p)) == math_char_node && tex_math_has_class_option(node_subtype(p), check_ligature_class_option)); -// } -// -// inline static int tex_aux_have_same_nucleus_fam(halfword p, halfword q) -// { -// return math_family(noad_nucleus(p)) == math_family(noad_nucleus(q)); -// } -// -// static void tex_aux_make_ord(halfword q, halfword size) -// { -// /*tex The left-side character for lig/kern testing. */ -// RESTART: -// /*tex We can end up here again after a ligature is built. */ -// if (! noad_has_following_scripts(q) && node_type(noad_nucleus(q)) == math_char_node) { -// halfword p = node_next(q); -// /*tex */ -// if (p && tex_aux_is_simple_char_noad(p) && tex_aux_have_same_nucleus_fam(p, q)) { -// halfword chr = null; -// halfword fnt = null; -// node_type(noad_nucleus(q)) = math_text_char_node; -// tex_aux_fetch(noad_nucleus(q), "ordinal", &fnt, &chr); -// if (tex_aux_math_engine_control(fnt, math_control_apply_ordinary_italic_kern)) { -// /* -// We don't have other kerns in opentype math fonts. There are however these -// staircase kerns that are dealt with elsewhere. But for new math fonts we do -// need to add italic correction. -// */ -// if (math_kernel_node_has_option(noad_nucleus(q), math_kernel_no_italic_correction)) { -// /* go on */ -// } else { -// scaled kern = tex_aux_math_x_size_scaled(fnt, tex_char_italic_from_font(fnt, math_character(noad_nucleus(q))), size); -// if (kern) { -// tex_aux_math_insert_italic_kern(q, kern, q, "ord"); -// } -// } -// } else if (tex_aux_math_engine_control(fnt, math_control_check_ligature_and_kern)) { -// if (tex_has_kern(fnt, chr) || tex_has_ligature(fnt, chr)) { -// /*tex -// -// Here we construct ligatures, quite unlikely in new math fonts so maybe we -// should just not go here for such fonts. -// -// If character |a| has a kern with |cur_c|, attach the kern after~|q|; or if -// it has a ligature with |cur_c|, combine noads |q| and~|p| appropriately; -// then |return| if the cursor has moved past a noad, or |goto restart|. -// -// Note that a ligature between an |ord_noad| and another kind of noad is -// replaced by an |ord_noad|, when the two noads collapse into one. -// -// We could make a parenthesis (say) change shape when it follows certain -// letters. Presumably a font designer will define such ligatures only when -// this convention makes sense. -// -// */ -// halfword nxt = math_character(noad_nucleus(p)); -// halfword slot; -// int type = tex_valid_ligature(chr, nxt, &slot); -// if (type >= 0) { -// switch (type) { -// case 1: /*tex \type{=:|} */ -// case 5: /*tex \type{=:|>} */ -// math_character(noad_nucleus(q)) = slot; -// break; -// case 2: /*tex \type{|=:} */ -// case 6: /*tex \type{|=:>} */ -// math_character(noad_nucleus(p)) = slot; -// break; -// case 3: /*tex \type{|=:|} */ -// case 7: /*tex \type{|=:|>} */ -// case 11: /*tex \type{|=:|>>} */ -// { -// halfword r = tex_new_node(simple_noad, ordinary_noad_subtype); -// halfword s = tex_new_node(math_char_node, 0); -// tex_attach_attribute_list_copy(r, q); -// tex_attach_attribute_list_copy(s, q); -// noad_nucleus(r) = s; -// math_character(noad_nucleus(r)) = slot; -// math_family(noad_nucleus(r)) = math_family(noad_nucleus(q)); -// tex_couple_nodes(q, r); -// tex_couple_nodes(r, p); -// if (type < 11) { -// node_type(noad_nucleus(r)) = math_char_node; -// } else { -// /*tex prevent combination */ -// node_type(noad_nucleus(r)) = math_text_char_node; -// } -// } -// break; -// default: /*tex |=:| */ -// tex_try_couple_nodes(q, node_next(p)); -// math_character(noad_nucleus(q)) = slot; -// noad_subscr(q) = noad_subscr(p); -// noad_supscr(q) = noad_supscr(p); -// noad_subscr(p) = null ; -// noad_supscr(p) = null ; -// tex_flush_node(p); -// break; -// } -// if (type > 3) { -// return; -// } else { -// node_type(noad_nucleus(q)) = math_char_node; -// goto RESTART; /*tex Inefficient but we never see this branch anyway. */ -// } -// } -// { -// // scaled kern = tex_aux_math_x_size_scaled(fnt, tex_valid_kern(chr, nxt), size); -// halfword nxtchr = null; -// halfword nxtfnt = null; -// tex_aux_fetch(noad_nucleus(p), "ordinal", &nxtfnt, &nxtchr); -// scaled kern = tex_get_kern(fnt, chr, nxtchr); -// if (kern) { -// tex_aux_math_insert_font_kern(q, kern, q, "ord"); -// return; -// } -// } -// } -// } -// } -// } -// } - - // $ \mathord {a} $ : ord -> nucleus -> mathchar // $ \mathord {ab} $ : ord -> nucleus -> submlist -> ord + ord @@ -4517,7 +4036,7 @@ static halfword tex_aux_check_ord(halfword current, halfword size, halfword next case sub_mlist_node: { // I'm not that motivated for this and it should be an engine option anyway then. - + // // halfword head = math_list(nucleus); // halfword tail = tex_tail_of_node_list(head); // // doesn't work @@ -5181,7 +4700,9 @@ static int tex_aux_get_sub_kern(halfword kernel, scriptdata *sub, scaled shift_d some freedom in dealing with them. This code is now a bit too complex due to some (probably by now) redundant analysis so at some - point I will rewrite it. + point I will rewrite it. Anyway, normally we don't end up in the next one because italic + correction already has been dealt with and thereby is zerood. In fact, if we end up here I need + to check why! */ @@ -5191,7 +4712,7 @@ inline static scaled tex_aux_insert_italic_now(halfword target, halfword kernel, case math_char_node: case math_text_char_node: { - halfword fam = noad_family(noad_nucleus(target)); + halfword fam = kernel_math_family(noad_nucleus(target)); if (fam != unused_math_family) { halfword fnt = tex_fam_fnt(fam, lmt_math_state.size); if (! tex_aux_math_engine_control(fnt, math_control_apply_script_italic_kern)) { @@ -5315,13 +4836,16 @@ static void tex_aux_make_scripts(halfword target, halfword kernel, scaled italic */ tex_aux_assign_new_hlist(target, kernel); kernelsize = tex_natural_hsizes(kernel, null, 0.0, 0, 0); - if (kerns) { - /* todo: option */ - if (kerns->height) { - kernelsize.ht = kerns->height; - } - if (kerns->depth) { - kernelsize.dp = kerns->depth; + if (kerns && kerns->dimensions) { + if (tex_aux_math_engine_control(kerns->font, math_control_ignore_kern_dimensions)) { + /* hack for bad xits fence depth */ + } else { + if (kerns->height) { + kernelsize.ht = kerns->height; + } + if (kerns->depth) { + kernelsize.dp = kerns->depth; + } } } switch (node_type(kernel)) { @@ -5609,7 +5133,8 @@ static void tex_aux_make_scripts(halfword target, halfword kernel, scaled italic } /* */ if (postsupdata.box) { - tex_aux_get_math_sup_shifts(postsupdata.box, style, &shift_up); + /* Do we still want to chain these sups or should we combine it? */ + tex_aux_get_math_sup_shifts(postsupdata.box, style, &shift_up); /* maybe only in else branch */ if (postsubdata.box) { tex_aux_get_math_sup_sub_shifts(postsupdata.box, postsubdata.box, style, &shift_up, &shift_down); tex_aux_get_sup_kern(kernel, &postsupdata, shift_up, supshift, &supkern, kerns); @@ -5705,6 +5230,7 @@ static void tex_aux_make_scripts(halfword target, halfword kernel, scaled italic } if (presubdata.box) { if (presupdata.box) { + /* Do we still want to chain these sups or should we combine it? */ tex_aux_get_math_sup_shifts(presupdata.box, style, &shift_up); tex_aux_get_math_sup_sub_shifts(presupdata.box, presubdata.box, style, &shift_up, &shift_down); prekern = box_width(presupdata.box); @@ -5834,7 +5360,7 @@ static halfword tex_aux_make_left_right(halfword target, int style, scaled max_d halfword lst; scaled delta = height + depth; tmp = tex_aux_make_delimiter(target, fence_delimiter_list(target), size, delta, 0, style, 0, &stack, &ic, 0, has_noad_option_nooverflow(target), extremes, 0); -/* do extremes here */ + /* do extremes here */ noad_italic(target) = ic; /*tex Beware, a stacked delimiter has a shift but no corrected height/depth (yet). @@ -5919,8 +5445,12 @@ static halfword tex_aux_make_left_right(halfword target, int style, scaled max_d if (tex_math_has_class_option(fenced_noad_subtype, prefer_delimiter_dimensions_class_option)) { kerns.height = extremes->height; kerns.depth = extremes->depth; + kerns.dimensions = 1; + kerns.font = extremes->tfont; + kerns.character = extremes->tchar; } } + /* returns italic, so maybe noad_italic(target) = ... */ tex_aux_make_op(target, style, size, ic, limits_unknown_mode, &kerns); /* otherwise a leak: */ kernel_math_list(s) = null; @@ -6156,10 +5686,6 @@ halfword tex_math_spacing_glue(halfword ltype, halfword rtype, halfword style) there. The delta parameter can have a value already. When it keeps it value the caller can add is as italic correction. However, when we have no scripts we do it here. - Also, in some cases a new glyph is made while we alredy have one. The fetch routine also sets - |lmt_math_state.opentype| so we can use it here. The complexity of the muxed machinery makes - this complexity test also complex. - */ static halfword tex_aux_check_nucleus_complexity(halfword target, scaled *italic, halfword style, halfword size, kernset *kerns) @@ -6295,15 +5821,19 @@ static halfword tex_aux_check_nucleus_complexity(halfword target, scaled *italic halfword list = kernel_math_list(nucleus); halfword package = null; halfword fenced = node_type(target) == simple_noad && node_subtype(target) == fenced_noad_subtype; + halfword last = fenced ? tex_tail_of_node_list(list) : null; int unpack = tex_math_has_class_option(node_subtype(target), unpack_class_option) || has_noad_option_unpacklist(target); - // todo: check has_noad_option_unpacklist vs hpack later - // halfword result = tex_mlist_to_hlist(list, fenced || has_noad_option_unpacklist(q), style, unset_noad_class, unset_noad_class); /*tex Here we're nesting. */ halfword result = tex_mlist_to_hlist(list, unpack, style, unset_noad_class, unset_noad_class, kerns); /*tex Here we're nesting. */ tex_aux_set_current_math_size(style); package = tex_hpack(result, 0, packing_additional, direction_unknown, holding_none_option); if (fenced) { node_subtype(package) = math_fence_list; - // } else if (has_noad_option_unpacklist(q)) { + if (list && node_type(list) == fence_noad && noad_analyzed(list) != unset_noad_class) { + set_noad_left_class(target, noad_analyzed(list)); + } + if (last && node_type(last) == fence_noad && noad_analyzed(last) != unset_noad_class) { + set_noad_right_class(target, noad_analyzed(last)); + } } else if (unpack) { node_subtype(package) = math_list_list; } else if (noad_class_main(target) == unset_noad_class) { @@ -6420,6 +5950,7 @@ static int tex_aux_make_fenced(halfword current, halfword current_style, halfwor if (nucleus) { halfword list = kernel_math_list(nucleus); if (list && node_type(list) == fence_noad && node_subtype(list) == left_operator_side) { + /* maybe use this more: */ fenceclasses->main = noad_class_main(list); fenceclasses->left = noad_class_left(list); fenceclasses->right = noad_class_right(list); @@ -6482,6 +6013,8 @@ static void tex_aux_finish_fenced(halfword current, halfword main_style, scaled if (tex_math_has_class_option(fenced_noad_subtype, prefer_delimiter_dimensions_class_option)) { kerns->height = extremes.height; kerns->depth = extremes.depth; + kerns->dimensions = 1; + kerns->font = extremes.tfont; } break; case right_fence_side: @@ -6623,8 +6156,7 @@ static void tex_aux_show_math_list(const char *fmt, halfword list) static void tex_aux_wrapup_nucleus_and_add_scripts(halfword current, halfword nxt, int current_style, halfword *italic, kernset *kerns) { - halfword p; - p = tex_aux_check_nucleus_complexity(current, italic, current_style, lmt_math_state.size, kerns); + halfword p = tex_aux_check_nucleus_complexity(current, italic, current_style, lmt_math_state.size, kerns); if (p && noad_source(current)) { switch (node_type(p)) { case hlist_node: @@ -6779,6 +6311,11 @@ static void tex_mlist_to_hlist_preroll_radicals(mliststate *state) } } +/*tex + At some point this will all change to well defined kernel/script/talic handling but then we no + longer are compatible. It depends on fonts being okay. We already have some dead brances. +*/ + static void tex_mlist_to_hlist_preroll_dimensions(mliststate *state) { halfword current = state->mlist; @@ -6854,7 +6391,7 @@ static void tex_mlist_to_hlist_preroll_dimensions(mliststate *state) noad_options(current) |= noad_option_no_limits; } } - PROCESS: + PROCESS: if ( // node_subtype(q) == operator_noad_subtype // || has_noad_option_limits(current) || has_noad_option_nolimits(current) @@ -6873,7 +6410,7 @@ static void tex_mlist_to_hlist_preroll_dimensions(mliststate *state) } /* tex_math_has_class_option(node_subtype(current),keep_correction_class_code) */ if (node_subtype(current) != operator_noad_subtype) { - italic = 0; + italic = 0; } if (fenceclasses.main != unset_noad_class) { noad_class_main(current) = fenceclasses.main; @@ -6962,52 +6499,7 @@ static void tex_mlist_to_hlist_preroll_dimensions(mliststate *state) superscript should be moved right with respect to a subscript when both are present. */ tex_aux_wrapup_nucleus_and_add_scripts(current, nxt, current_style, &italic, &localkerns); - // { - // kernset kerns; - // halfword p; - // tex_math_copy_kerns(&kerns, &localkerns); - // p = tex_aux_check_nucleus_complexity(current, &italic, current_style, lmt_math_state.size, &kerns); - // if (p && noad_source(current)) { - // switch (node_type(p)) { - // case hlist_node: - // case vlist_node: - // if (! box_source_anchor(p)) { - // box_source_anchor(p) = noad_source(current); - // tex_set_box_geometry(p, anchor_geometry); - // } - // break; - // default: - // /*tex Todo: maybe pack and assign! */ - // break; - // } - // } - // if (noad_has_scripts(current)) { - // scaled drop = 0; - // if (node_type(current) == accent_noad && noad_has_superscripts(current)) { - // drop = tex_get_math_y_parameter_default(current_style, math_parameter_accent_superscript_drop, 0); - // drop += scaledround(localkerns.toptotal * tex_get_math_parameter_default(current_style, math_parameter_accent_superscript_percent, 0) / 100.0); - // } - // tex_aux_make_scripts(current, p, italic, current_style, 0, 0, drop, &kerns); - // } else { - // /*tex - // Adding italic correction here is kind of fuzzy because some characters already have - // that built in. However, we also add it in the scripts so if it's optional here it - // also should be there. The compexity tester can have added it in which case delta - // is zero. - // */ - // if (nxt && italic) { - // if (node_type(nxt) == simple_noad && tex_math_has_class_option(node_subtype(nxt), no_italic_correction_class_option)) { - // italic = 0; - // } - // if (italic) { - // /* If we want it as option we need the fontor store it in the noad. */ - // tex_aux_math_insert_italic_kern(p, italic, current, "final"); - // } - // } - // tex_aux_assign_new_hlist(current, p); - // } - // } - CHECK_DIMENSIONS: + CHECK_DIMENSIONS: { scaledwhd siz = tex_natural_hsizes(noad_new_hlist(current), null, normal_glue_multiplier, normal_glue_sign, normal_glue_sign); if (siz.ht > state->max_height) { @@ -7017,7 +6509,7 @@ static void tex_mlist_to_hlist_preroll_dimensions(mliststate *state) state->max_depth = siz.dp; } } - DONE_WITH_NODE: + DONE_WITH_NODE: if ((node_type(current) == simple_noad) && noad_new_hlist(current)) { if (has_noad_option_phantom(current) || has_noad_option_void(current)) { noad_new_hlist(current) = tex_aux_make_list_phantom(noad_new_hlist(current), has_noad_option_void(current), get_attribute_list(current)); @@ -7060,6 +6552,7 @@ static void tex_mlist_to_hlist_finalize_list(mliststate *state) int recent_subtype = ordinary_noad_subtype; halfword current_style = state->main_style; halfword fenced = null; + halfword packedfence = null; halfword recent_left_slack = 0; halfword recent_right_slack = 0; halfword recent_class_overload = unset_noad_class; @@ -7132,6 +6625,9 @@ static void tex_mlist_to_hlist_finalize_list(mliststate *state) goto RESTART; } } else { + /*tex + Here we have a wrapped list of left, middle, right and content nodes. + */ current_subtype = node_subtype(current); current_left_slack = noad_left_slack(current); current_right_slack = noad_right_slack(current); @@ -7139,17 +6635,14 @@ static void tex_mlist_to_hlist_finalize_list(mliststate *state) switch (current_subtype) { case fenced_noad_subtype: { - // halfword list = noad_new_hlist(current); - // if (list && ! noad_nucleus(current) && ! noad_has_scripts(current)) { // scripts test will go - fenced = current; - if (get_noad_right_class(fenced) != unset_noad_class) { - current_subtype = get_noad_left_class(fenced); - } else if (get_noad_main_class(fenced) != unset_noad_class) { // needs testing by MS - current_subtype = get_noad_main_class(fenced); - } else { - current_subtype = open_noad_subtype; /* safeguard, see comment above */ - } - // } + fenced = current; + if (get_noad_right_class(fenced) != unset_noad_class) { + current_subtype = get_noad_left_class(fenced); + } else if (get_noad_main_class(fenced) != unset_noad_class) { // needs testing by MS + current_subtype = get_noad_main_class(fenced); + } else { + current_subtype = open_noad_subtype; /* safeguard, see comment above */ + } break; } default: @@ -7230,9 +6723,10 @@ static void tex_mlist_to_hlist_finalize_list(mliststate *state) current_subtype = fraction_noad_subtype; /* inner_noad_type */ break; case fence_noad: + /*tex Here we have a left, right, middle */ current_type = simple_noad; /*tex Same kind of fields. */ current_subtype = noad_analyzed(current); - fenced = current; + packedfence = current; break; case style_node: tex_aux_make_style(current, ¤t_style, ¤t_mu); @@ -7481,7 +6975,8 @@ static void tex_mlist_to_hlist_finalize_list(mliststate *state) /* curious */ } else if (node_type(l) == hlist_node && box_source_anchor(l)) { tex_couple_nodes(p, l); - } else if (fenced) { + } else if (packedfence) { + /*tex This branch probably can go away, see below. */ /*tex Watch out: we can have |[prescripts] [fencelist] [postscripts]| */ if (tex_math_has_class_option(fenced_noad_subtype, unpack_class_option)) { p = tex_aux_unroll_noad(p, l, math_fence_list); @@ -7518,6 +7013,7 @@ static void tex_mlist_to_hlist_finalize_list(mliststate *state) fenced = null; } noad_new_hlist(current) = null; + packedfence = null; } /*tex Append any |new_hlist| entries for |q|, and any appropriate penalties. We insert a @@ -7612,7 +7108,7 @@ halfword tex_mlist_to_hlist(halfword mlist, int penalties, int main_style, int b state.penalties = penalties; state.main_style = main_style; state.beginclass = beginclass == unset_noad_class ? math_begin_class : beginclass; - state.endclass = endclass == unset_noad_class ? math_end_class : endclass;; + state.endclass = endclass == unset_noad_class ? math_end_class : endclass; state.kerns = kerns; state.scale = glyph_scale_par; state.max_height = 0; diff --git a/source/luametatex/source/tex/texmlist.h b/source/luametatex/source/tex/texmlist.h index 1cb2a6cc7..720c85b4d 100644 --- a/source/luametatex/source/tex/texmlist.h +++ b/source/luametatex/source/tex/texmlist.h @@ -6,14 +6,18 @@ # define LMT_MLIST_H typedef struct kernset { - scaled topright; - scaled bottomright; - scaled topleft; - scaled bottomleft; - scaled height; - scaled depth; - scaled toptotal; - scaled bottomtotal; + scaled topright; + scaled bottomright; + scaled topleft; + scaled bottomleft; + scaled height; + scaled depth; + scaled toptotal; + scaled bottomtotal; + halfword dimensions; + halfword font; + halfword character; + halfword padding; } kernset; extern void tex_run_mlist_to_hlist (halfword p, halfword penalties, halfword style, int beginclass, int endclass); diff --git a/source/luametatex/source/tex/texnodes.c b/source/luametatex/source/tex/texnodes.c index 45e04dfd2..c627a07cb 100644 --- a/source/luametatex/source/tex/texnodes.c +++ b/source/luametatex/source/tex/texnodes.c @@ -2313,9 +2313,7 @@ static void tex_aux_show_attr_list(halfword p) tex_print_int(v); } } else { - tex_print_int(k); - tex_print_char('='); - tex_print_int(v); + tex_print_format("%i=%i", k, v); }; p = node_next(p); if (p) { @@ -2330,18 +2328,14 @@ void tex_print_name(halfword n, const char* what) { tex_print_str_esc(what); if (tracing_nodes_par > 0) { - tex_print_char('<'); - tex_print_int(n); - tex_print_char('>'); + tex_print_format("<%i>", n); } } static void tex_aux_print_subtype_and_attributes_str(halfword p, const char *n) { if (show_node_details_par > 0) { - tex_print_char('['); - tex_print_str(n); - tex_print_char(']'); + tex_print_format("[%s]",n); } if (show_node_details_par > 1 && tex_nodetype_has_attributes(node_type(p))) { tex_aux_show_attr_list(p); @@ -2415,9 +2409,7 @@ static void tex_print_node_and_details(halfword p) static void tex_aux_print_subtype_and_attributes_int(halfword p, halfword n) { if (show_node_details_par > 0) { \ - tex_print_char('['); - tex_print_int(n); - tex_print_char(']'); + tex_print_format("[%i]", n); } if (show_node_details_par > 1 && tex_nodetype_has_attributes(node_type(p))) { tex_aux_show_attr_list(p); @@ -2476,23 +2468,19 @@ void tex_aux_show_dictionary(halfword p, halfword properties, halfword group, ha lmt_run_callback(lmt_lua_state.lua_instance, callback_id, "Nddddd->R", p, properties, group, index, font, character, &s); tex_restore_cur_string(u); if (s) { - tex_print_str(", "); - tex_print_str(s); + tex_print_format(", %s", s); lmt_memory_free(s); return; } } if (properties) { - tex_print_str(", properties "); - tex_print_qhex(properties); + tex_print_format(", properties %x", properties); } if (group) { - tex_print_str(", group "); - tex_print_qhex(group); + tex_print_format(", group %x", group); } if (index) { - tex_print_str(", index "); - tex_print_qhex(index); + tex_print_format(", index %x", index); } } @@ -2537,120 +2525,87 @@ void tex_show_node_list(halfword p, int threshold, int max) } /* effective */ if (whd.wd) { - tex_print_str(", wd "); - tex_print_dimension(whd.wd, pt_unit); + tex_print_format(", wd %D", whd.wd, pt_unit); } if (whd.ht) { - tex_print_str(", ht "); - tex_print_dimension(whd.ht, pt_unit); + tex_print_format(", ht %D", whd.ht, pt_unit); } if (whd.dp) { - tex_print_str(", dp "); - tex_print_dimension(whd.dp, pt_unit); + tex_print_format(", dp %D", whd.dp, pt_unit); } if (whd.ic) { - tex_print_str(", ic "); - tex_print_dimension(whd.ic, pt_unit); + tex_print_format(", ic %D", whd.ic, pt_unit); } /* */ if (get_glyph_language(p)) { - tex_print_str(", language (n="); - tex_print_int(get_glyph_language(p)); - tex_print_str(",l="); - tex_print_int(get_glyph_lhmin(p)); - tex_print_str(",r="); - tex_print_int(get_glyph_rhmin(p)); - tex_print_char(')'); + tex_print_format(", language (n=%i,l=%i,r=%i)", get_glyph_language(p), get_glyph_lhmin(p), get_glyph_rhmin(p)); } if (get_glyph_script(p)) { - tex_print_str(", script "); - tex_print_int(get_glyph_script(p)); + tex_print_format(", script %i", get_glyph_script(p)); } if (get_glyph_hyphenate(p)) { - tex_print_str(", hyphenationmode "); - tex_print_qhex(get_glyph_hyphenate(p)); + tex_print_format(", hyphenationmode %x", get_glyph_hyphenate(p)); } if (glyph_x_offset(p)) { - tex_print_str(", xoffset "); - tex_print_dimension(glyph_x_offset(p), pt_unit); + tex_print_format(", xoffset %D", glyph_x_offset(p), pt_unit); } if (glyph_y_offset(p)) { - tex_print_str(", yoffset "); - tex_print_dimension(glyph_y_offset(p), pt_unit); + tex_print_format(", yoffset %D", glyph_y_offset(p), pt_unit); } if (glyph_left(p)) { - tex_print_str(", left "); - tex_print_dimension(glyph_left(p), pt_unit); + tex_print_format(", left %D", glyph_left(p), pt_unit); } if (glyph_right(p)) { - tex_print_str(", right "); - tex_print_dimension(glyph_right(p), pt_unit); + tex_print_format(", right %D", glyph_right(p), pt_unit); } if (glyph_raise(p)) { - tex_print_str(", raise "); - tex_print_dimension(glyph_raise(p), pt_unit); + tex_print_format(", raise %D", glyph_raise(p), pt_unit); } if (glyph_expansion(p)) { - tex_print_str(", expansion "); - tex_print_int(glyph_expansion(p)); + tex_print_format(", expansion %i", glyph_expansion(p)); } if (glyph_scale(p) && glyph_scale(p) != 1000) { - tex_print_str(", scale "); - tex_print_int(glyph_scale(p)); + tex_print_format(", scale %i", glyph_scale(p)); } if (glyph_x_scale(p) && glyph_x_scale(p) != 1000) { - tex_print_str(", xscale "); - tex_print_int(glyph_x_scale(p)); + tex_print_format(", xscale %i", glyph_x_scale(p)); } if (glyph_y_scale(p) && glyph_y_scale(p) != 1000) { - tex_print_str(", yscale "); - tex_print_int(glyph_y_scale(p)); + tex_print_format(", yscale %i", glyph_y_scale(p)); } if (glyph_data(p)) { - tex_print_str(", data "); - tex_print_int(glyph_data(p)); + tex_print_format(", data %i", glyph_data(p)); } if (glyph_state(p)) { - tex_print_str(", state "); - tex_print_int(glyph_state(p)); + tex_print_format(", state %i", glyph_state(p)); } if (glyph_options(p)) { - tex_print_str(", options "); - tex_print_qhex(glyph_options(p)); + tex_print_format(", options %x", glyph_options(p)); } if (glyph_discpart(p)) { - tex_print_str(", discpart "); - tex_print_int(glyph_discpart(p)); + tex_print_format(", discpart %i", glyph_discpart(p)); } tex_aux_show_dictionary(p, glyph_properties(p), glyph_group(p), glyph_index(p), glyph_font(p), glyph_character(p)); } - tex_print_str(", font "); - /* this could be a callback */ - tex_print_font_identifier(glyph_font(p)); /* for now consistent with others, might change */ - tex_print_str(", glyph "); - tex_print_char_identifier(glyph_character(p)); + tex_print_format(", font %F, glyph %U", glyph_font(p), glyph_character(p)); break; case hlist_node: case vlist_node: case unset_node: /*tex Display box |p|. */ if (box_width(p)) { - tex_print_str(", width "); - tex_print_dimension(box_width(p), pt_unit); + tex_print_format(", width %D", box_width(p), pt_unit); } if (box_height(p)) { - tex_print_str(", height "); - tex_print_dimension(box_height(p), pt_unit); + tex_print_format(", height %D", box_height(p), pt_unit); } if (box_depth(p)) { - tex_print_str(", depth "); - tex_print_dimension(box_depth(p), pt_unit); + tex_print_format(", depth %D", box_depth(p), pt_unit); } if (node_type(p) == unset_node) { /*tex Display special fields of the unset node |p|. */ if (box_span_count(p)) { - tex_print_str(", columns "); - tex_print_int(box_span_count(p) + 1); + tex_print_format(", columns %i", box_span_count(p) + 1); } if (box_glue_stretch(p)) { tex_print_str(", stretch "); @@ -2691,8 +2646,7 @@ void tex_show_node_list(halfword p, int threshold, int max) } } if (box_shift_amount(p) != 0) { - tex_print_str(", shifted "); - tex_print_dimension(box_shift_amount(p), pt_unit); + tex_print_format(", shifted %D", box_shift_amount(p), pt_unit); } if (valid_direction(box_dir(p))) { tex_print_str(", direction "); @@ -2703,41 +2657,30 @@ void tex_show_node_list(halfword p, int threshold, int max) } } if (box_geometry(p)) { - tex_print_str(", geometry "); - tex_print_qhex(box_geometry(p)); + tex_print_format(", geometry %x", box_geometry(p)); if (tex_has_box_geometry(p, orientation_geometry)) { - tex_print_str(", orientation "); - tex_print_qhex(box_orientation(p)); + tex_print_format(", orientation %x", box_orientation(p)); } if (tex_has_box_geometry(p, offset_geometry)) { - tex_print_str(", offset("); - tex_print_dimension(box_x_offset(p), pt_unit); - tex_print_char(','); - tex_print_dimension(box_y_offset(p), pt_unit); - tex_print_char(')'); + tex_print_format(", offset(%D,%D)", box_x_offset(p), pt_unit, box_y_offset(p), pt_unit); } if (tex_has_box_geometry(p, anchor_geometry)) { if (box_anchor(p)) { - tex_print_str(", anchor "); - tex_print_qhex(box_anchor(p)); + tex_print_format(", anchor %x", box_anchor(p)); } if (box_source_anchor(p)) { - tex_print_str(", source "); - tex_print_int(box_source_anchor(p)); + tex_print_format(", source %i", box_source_anchor(p)); } if (box_target_anchor(p)) { - tex_print_str(", target "); - tex_print_int(box_target_anchor(p)); + tex_print_format(", target %i", box_target_anchor(p)); } } } if (box_index(p)) { - tex_print_str(", index "); - tex_print_int(box_index(p)); + tex_print_format(", index %i", box_index(p)); } if (box_package_state(p)) { - tex_print_str(", state "); - tex_print_int(box_package_state(p)); + tex_print_format(", state %i", box_package_state(p)); } } tex_print_node_list(box_pre_adjusted(p), "preadjusted", threshold, max); @@ -2749,59 +2692,50 @@ void tex_show_node_list(halfword p, int threshold, int max) case rule_node: /*tex Display rule |p|. */ if (rule_width(p)) { - tex_print_str(", width "); - tex_print_rule_dimen(rule_width(p)); + tex_print_format(", width %R", rule_width(p)); } if (rule_height(p)) { - tex_print_str(", height "); - tex_print_rule_dimen(rule_height(p)); + tex_print_format(", height %R", rule_height(p)); } if (rule_depth(p)) { - tex_print_str(", depth "); - tex_print_rule_dimen(rule_depth(p)); + tex_print_format(", depth %R", rule_depth(p)); } if (rule_left(p)) { - tex_print_str(", left / top "); - tex_print_rule_dimen(rule_left(p)); + tex_print_format(", left / top %R", rule_left(p)); } if (rule_right(p)) { - tex_print_str(", right / bottom "); - tex_print_rule_dimen(rule_right(p)); + tex_print_format(", right / bottom %R", rule_right(p)); } if (rule_x_offset(p)) { - tex_print_str(", xoffset "); - tex_print_rule_dimen(rule_x_offset(p)); + tex_print_format(", xoffset %R", rule_x_offset(p)); } if (rule_y_offset(p)) { - tex_print_str(", yoffset "); - tex_print_rule_dimen(rule_y_offset(p)); + tex_print_format(", yoffset %R", rule_y_offset(p)); } if (rule_font(p)) { if (rule_font(p) < 0 || rule_font(p) >= rule_font_fam_offset) { - tex_print_str(", font "); - tex_print_font_identifier(rule_font(p)); + tex_print_format(", font %F", rule_font(p)); } else { - tex_print_str(", family "); - tex_print_int(rule_font(p) - rule_font_fam_offset); + tex_print_format(", family %i", rule_font(p) - rule_font_fam_offset); } } if (rule_character(p)) { - tex_print_str(", character "); - tex_print_char_identifier(rule_character(p)); + tex_print_format(", character %U", rule_character(p)); } break; case insert_node: /*tex Display insertion |p|. The natural size is the sum of height and depth. */ - tex_print_str(", index "); - tex_print_int(insert_index(p)); - tex_print_str(", total height "); - tex_print_dimension(insert_total_height(p), pt_unit); - tex_print_str(", max depth "); - tex_print_dimension(insert_max_depth(p), pt_unit); - tex_print_str(", split glue ("); - tex_print_specnode(insert_split_top(p), no_unit); - tex_print_str("), float cost "); - tex_print_int(insert_float_cost(p)); + tex_print_format( + ", index %i, total height %D, max depth %D, split glue (", + insert_index(p), + insert_total_height(p), pt_unit, + insert_max_depth(p), pt_unit + ); + tex_print_specnode(insert_split_top(p), no_unit); /* todo: formatter for specnode but what CHAR to use */ + tex_print_format( + "), float cost %i", + insert_float_cost(p) + ); tex_print_node_list(insert_list(p), "list", threshold, max); break; case dir_node: @@ -2861,8 +2795,8 @@ void tex_show_node_list(halfword p, int threshold, int max) if (tex_par_state_is_set(p, par_shaping_penalty_code) ) { v = par_shaping_penalty(p) ; if (v > 0) { tex_print_str(", shapingpenalty "); tex_print_int (v); } } } /* local boxes */ - v = tex_get_local_left_width(p) ; if (v) { tex_print_str(", leftboxwidth "); tex_print_dimension(v, pt_unit); } - v = tex_get_local_right_width(p) ; if (v) { tex_print_str(", rightboxwidth "); tex_print_dimension(v, pt_unit); } + v = tex_get_local_left_width(p) ; if (v) { tex_print_format(", leftboxwidth %D", v, pt_unit); } + v = tex_get_local_right_width(p) ; if (v) { tex_print_format(", rightboxwidth %D", v, pt_unit); } tex_print_node_list(par_box_left(p), "leftbox", threshold, max); tex_print_node_list(par_box_right(p), "rightbox", threshold, max); tex_print_node_list(par_box_middle(p), "middlebox", threshold, max); @@ -2870,8 +2804,7 @@ void tex_show_node_list(halfword p, int threshold, int max) break; case boundary_node: if (boundary_data(p)) { - tex_print_str(", data "); - tex_print_int(boundary_data(p)); + tex_print_format(", data %i", boundary_data(p)); } break; case whatsit_node: @@ -2915,27 +2848,22 @@ void tex_show_node_list(halfword p, int threshold, int max) tex_print_specnode(p, node_subtype(p) < conditional_math_glue ? pt_unit : mu_unit); /* was |no_unit : mu_unit| */ } if (glue_data(p)) { - tex_print_str(", data "); - tex_print_int(glue_data(p)); + tex_print_format(", data %i", glue_data(p)); } if (node_subtype(p) == space_skip_glue && glue_font(p)) { - tex_print_str(", font "); - tex_print_int(glue_font(p)); + tex_print_format(", font %i", glue_font(p)); } } break; case kern_node: /*tex Display kern |p| */ - tex_print_str(", amount "); - tex_print_dimension(kern_amount(p), pt_unit); if (node_subtype(p) != explicit_math_kern_subtype) { - tex_print_unit(pt_unit); + tex_print_format(", amount %D", kern_amount(p), pt_unit); if (kern_expansion(p)) { - tex_print_str(", expansion "); - tex_print_int(kern_expansion(p)); + tex_print_format(", expansion %i", kern_expansion(p)); } } else { - tex_print_unit(mu_unit); + tex_print_format(", amount %D", kern_amount(p), mu_unit); } break; case math_node: @@ -2944,38 +2872,31 @@ void tex_show_node_list(halfword p, int threshold, int max) tex_print_str(", glued "); tex_print_specnode(p, no_unit); } else if (math_surround(p)) { - tex_print_str(", surrounded "); - tex_print_dimension(math_surround(p), pt_unit); + tex_print_format(", surrounded %D", math_surround(p), pt_unit); } if (math_penalty(p)) { - tex_print_str(", penalty "); - tex_print_int(math_penalty(p)); + tex_print_format(", penalty %i", math_penalty(p)); } break; case penalty_node: /*tex Display penalty |p|. */ - tex_print_str(", amount "); - tex_print_int(penalty_amount(p)); + tex_print_format(", amount %i", penalty_amount(p)); break; case disc_node: if (disc_class(p) != unset_disc_class) { - tex_print_str(", class "); - tex_print_int(disc_class(p)); + tex_print_format(", class %i", disc_class(p)); } if (disc_options(p)) { - tex_print_str(", options "); - tex_print_qhex(disc_options(p)); + tex_print_format(", options %x", disc_options(p)); } - tex_print_str(", penalty "); - tex_print_int(disc_penalty(p)); + tex_print_format(", penalty %i", disc_penalty(p)); tex_print_node_list(disc_pre_break_head(p), "prebreaklist", threshold, max); tex_print_node_list(disc_post_break_head(p), "postbreaklist", threshold, max); tex_print_node_list(disc_no_break_head(p), "nobreaklist", threshold, max); break; case mark_node: /*tex Display mark |p|. */ - tex_print_str(", index "); - tex_print_int(mark_index(p)); + tex_print_format(", index %i", mark_index(p)); if (node_subtype(p) == reset_mark_value_code) { tex_print_str(", reset"); } else { @@ -2985,20 +2906,16 @@ void tex_show_node_list(halfword p, int threshold, int max) case adjust_node: /*tex Display adjustment |p|. */ if (adjust_options(p)) { - tex_print_str(", options "); - tex_print_qhex(adjust_options(p)); + tex_print_format(", options %x", adjust_options(p)); } if (adjust_index(p)) { - tex_print_str(", index "); - tex_print_int(adjust_index(p)); + tex_print_format(", index %i", adjust_index(p)); } if (has_adjust_option(p, adjust_option_depth_before) && adjust_depth_before(p)) { - tex_print_str(", depthbefore "); - tex_print_dimension(adjust_depth_before(p), pt_unit); + tex_print_format(", depthbefore %D", adjust_depth_before(p), pt_unit); } if (has_adjust_option(p, adjust_option_depth_after) &&adjust_depth_before(p)) { - tex_print_str(", depthafter "); - tex_print_dimension(adjust_depth_after(p), pt_unit); + tex_print_format(", depthafter %D", adjust_depth_after(p), pt_unit); } tex_print_node_list(adjust_list(p), "list", threshold, max); break; diff --git a/source/luametatex/source/tex/texnodes.h b/source/luametatex/source/tex/texnodes.h index f0d20e1e9..a20117ff8 100644 --- a/source/luametatex/source/tex/texnodes.h +++ b/source/luametatex/source/tex/texnodes.h @@ -1588,8 +1588,11 @@ typedef enum simple_choice_subtypes { \LL \stoptabulate - We can use smaller variables for style and class and then have one field available for - other usage so no need to grow. + We can use smaller variables for style and class and then have one field available for other + usage so no need to grow. + + As with other nodes, not all fields are used and|/|or can be set at the tex end but they are + available for usage at the \LUA\ end. Some have been used for experiments and stay around. */ @@ -1680,6 +1683,7 @@ typedef struct noad_classes { noad_class_main(n) = (singleword) unset_noad_class; \ noad_class_left(n) = (singleword) unset_noad_class; \ noad_class_right(n) = (singleword) unset_noad_class; \ + noad_analyzed(n) = (singleword) unset_noad_class; \ } while (0); # define set_noad_classes(n,c) do { \ @@ -1740,8 +1744,7 @@ typedef enum noad_options { noad_option_auto = 0x10000000, noad_option_unroll_list = 0x20000000, noad_option_followed_by_space = 0x40000000, - /* available: */ - noad_option_reserved = 0x80000000, + noad_option_proportional = 0x80000000, } noad_options; # define has_option(a,b) (((a) & (b)) == (b)) @@ -1796,6 +1799,7 @@ inline int has_noad_no_script_option(halfword n, halfword option) # 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)) /*tex In the meantime the codes and subtypes are in sync. The variable component does not really @@ -1995,6 +1999,9 @@ typedef enum math_kernel_options { math_kernel_no_right_pair_kern = 0x0004, math_kernel_auto_discretionary = 0x0008, math_kernel_full_discretionary = 0x0010, + math_kernel_ignored_character = 0x0020, + math_kernel_is_large_operator = 0x0040, + math_kernel_has_italic_shape = 0x0080, } math_kernel_options; # define math_kernel_node_size 5 @@ -2494,7 +2501,7 @@ inline static void tex_attach_attribute_list_attribute(halfword target, halfword if (is_global(a)) { \ int i; \ for (i = (lmt_save_state.save_stack_data.ptr - 1); i >= 0; i--) { \ - if (save_type(i) == saved_attribute_list) { \ + if (save_type(i) == attribute_list_save_type) { \ delete_attribute_reference(save_value(i)); \ save_value(i) = attribute_cache_disabled; \ } \ @@ -2508,7 +2515,7 @@ inline static void tex_attach_attribute_list_attribute(halfword target, halfword # define save_attribute_state_before() do { \ halfword c = current_attribute_state; \ - tex_set_saved_record(saved_attribute_item_list, saved_attribute_list, 0, c); \ + tex_set_saved_record(saved_attribute_item_list, attribute_list_save_type, 0, c); \ lmt_save_state.save_stack_data.ptr += saved_attribute_n_of_items; \ add_attribute_reference(c); \ } while (0) diff --git a/source/luametatex/source/tex/texpackaging.c b/source/luametatex/source/tex/texpackaging.c index 5942c1365..b2286cd71 100644 --- a/source/luametatex/source/tex/texpackaging.c +++ b/source/luametatex/source/tex/texpackaging.c @@ -300,35 +300,35 @@ static void tex_aux_scan_full_spec(quarterword c, quarterword spec_direction, in /*tex Now we're referenced. We need to preserve this over the group. */ add_attribute_reference(attrlist); /* */ - tex_set_saved_record(saved_full_spec_item_context, saved_box_context, 0, context); + tex_set_saved_record(saved_full_spec_item_context, box_context_save_type, 0, context); /*tex Traditionally these two are packed into one record: */ - tex_set_saved_record(saved_full_spec_item_packaging, saved_box_spec, spec_code, spec_amount); + tex_set_saved_record(saved_full_spec_item_packaging, box_spec_save_type, spec_code, spec_amount); /*tex Adjust |text_dir_ptr| for |scan_spec|: */ if (spec_direction != direction_unknown) { - tex_set_saved_record(saved_full_spec_item_direction, saved_box_direction, spec_direction, lmt_dir_state.text_dir_ptr); + tex_set_saved_record(saved_full_spec_item_direction, box_direction_save_type, spec_direction, lmt_dir_state.text_dir_ptr); lmt_dir_state.text_dir_ptr = tex_new_dir(normal_dir_subtype, spec_direction); } else { - tex_set_saved_record(saved_full_spec_item_direction, saved_box_direction, spec_direction, null); + tex_set_saved_record(saved_full_spec_item_direction, box_direction_save_type, spec_direction, null); } /* We could pack some in one record. */ - tex_set_saved_record(saved_full_spec_item_attr_list, saved_box_attr_list, 0, attrlist); - tex_set_saved_record(saved_full_spec_item_only_pack, saved_box_pack, 0, just_pack); - tex_set_saved_record(saved_full_spec_item_orientation, saved_box_orientation, 0, orientation); - tex_set_saved_record(saved_full_spec_item_anchor, saved_box_anchor, 0, anchor); - tex_set_saved_record(saved_full_spec_item_geometry, saved_box_geometry, 0, geometry); - tex_set_saved_record(saved_full_spec_item_xoffset, saved_box_xoffset, 0, xoffset); - tex_set_saved_record(saved_full_spec_item_yoffset, saved_box_yoffset, 0, yoffset); - tex_set_saved_record(saved_full_spec_item_xmove, saved_box_xmove, 0, xmove); - tex_set_saved_record(saved_full_spec_item_ymove, saved_box_ymove, 0, ymove); - tex_set_saved_record(saved_full_spec_item_reverse, saved_box_reverse, 0, reverse); - tex_set_saved_record(saved_full_spec_item_container, saved_box_container, 0, container); - tex_set_saved_record(saved_full_spec_item_shift, saved_box_shift, 0, shift); - tex_set_saved_record(saved_full_spec_item_source, saved_box_source, 0, source); - tex_set_saved_record(saved_full_spec_item_target, saved_box_target, 0, target); - tex_set_saved_record(saved_full_spec_item_axis, saved_box_axis, 0, axis); - tex_set_saved_record(saved_full_spec_item_class, saved_box_class, 0, mainclass); - tex_set_saved_record(saved_full_spec_item_state, saved_box_state, 0, state); - tex_set_saved_record(saved_full_spec_item_retain, saved_box_retain, 0, retain); + tex_set_saved_record(saved_full_spec_item_attr_list, box_attr_list_save_type, 0, attrlist); + tex_set_saved_record(saved_full_spec_item_only_pack, box_pack_save_type, 0, just_pack); + tex_set_saved_record(saved_full_spec_item_orientation, box_orientation_save_type, 0, orientation); + tex_set_saved_record(saved_full_spec_item_anchor, box_anchor_save_type, 0, anchor); + tex_set_saved_record(saved_full_spec_item_geometry, box_geometry_save_type, 0, geometry); + tex_set_saved_record(saved_full_spec_item_xoffset, box_xoffset_save_type, 0, xoffset); + tex_set_saved_record(saved_full_spec_item_yoffset, box_yoffset_save_type, 0, yoffset); + tex_set_saved_record(saved_full_spec_item_xmove, box_xmove_save_type, 0, xmove); + tex_set_saved_record(saved_full_spec_item_ymove, box_ymove_save_type, 0, ymove); + tex_set_saved_record(saved_full_spec_item_reverse, box_reverse_save_type, 0, reverse); + tex_set_saved_record(saved_full_spec_item_container, box_container_save_type, 0, container); + tex_set_saved_record(saved_full_spec_item_shift, box_shift_save_type, 0, shift); + tex_set_saved_record(saved_full_spec_item_source, box_source_save_type, 0, source); + tex_set_saved_record(saved_full_spec_item_target, box_target_save_type, 0, target); + tex_set_saved_record(saved_full_spec_item_axis, box_axis_save_type, 0, axis); + tex_set_saved_record(saved_full_spec_item_class, box_class_save_type, 0, mainclass); + tex_set_saved_record(saved_full_spec_item_state, box_state_save_type, 0, state); + tex_set_saved_record(saved_full_spec_item_retain, box_retain_save_type, 0, retain); lmt_save_state.save_stack_data.ptr += saved_full_spec_n_of_items; tex_new_save_level(c); if (! brace) { @@ -2287,13 +2287,13 @@ halfword tex_vpack(halfword p, scaled h, int m, scaled l, singleword pack_direct return r; } -halfword tex_filtered_vpack(halfword p, scaled h, int m, scaled l, int grp, halfword pack_direction, int just_pack, halfword attr, int state, int retain) +halfword tex_filtered_vpack(halfword p, scaled h, int m, scaled maxdepth, int grp, halfword direction, int just_pack, halfword attr, int state, int retain) { halfword q = p; if (! just_pack) { - q = lmt_vpack_filter_callback(q, h, m, l, grp, pack_direction, attr); + q = lmt_vpack_filter_callback(q, h, m, maxdepth, grp, direction, attr); } - q = tex_vpack(q, h, m, l, checked_direction_value(pack_direction), retain); + q = tex_vpack(q, h, m, maxdepth, checked_direction_value(direction), retain); if (q && normalize_par_mode_permitted(normalize_par_mode_par, flatten_v_leaders_mode) && ! is_box_package_state(state, package_u_leader_delayed)) { tex_flatten_leaders(q, NULL); } @@ -2376,7 +2376,7 @@ void tex_package(singleword nature) halfword context, spec, dirptr, attrlist, justpack, orientation, anchor, geometry, source, target, axis, mainclass, state, retain; scaled shift; int grp = cur_group; - scaled d = box_max_depth_par; + scaled maxdepth = box_max_depth_par; halfword boxnode = null; /*tex Aka |cur_box|. */ tex_unsave(); lmt_save_state.save_stack_data.ptr -= saved_full_spec_n_of_items; @@ -2405,7 +2405,7 @@ void tex_package(singleword nature) box_package_state(boxnode) = hbox_package_state; } else { boxnode = tex_filtered_vpack(node_next(cur_list.head), spec, saved_level(saved_full_spec_item_packaging), - d, grp, saved_level(saved_full_spec_item_direction), justpack, attrlist, state, retain); + maxdepth, grp, saved_level(saved_full_spec_item_direction), justpack, attrlist, state, retain); if (nature == vtop_code) { /*tex @@ -2414,21 +2414,21 @@ void tex_package(singleword nature) |hlist_node|, |vlist_node|, or |rule_node|; otherwise the |\vtop| height is zero. */ - scaled h = 0; - halfword p = box_list(boxnode); - if (p) { - switch (node_type(p)) { + scaled height = 0; + halfword list = box_list(boxnode); + if (list) { + switch (node_type(list)) { case hlist_node: case vlist_node: - h = box_height(p); + height = box_height(list); break; case rule_node: - h = rule_height(p); + height = rule_height(list); break; } } - box_depth(boxnode) = box_total(boxnode) - h; - box_height(boxnode) = h; + box_depth(boxnode) = box_total(boxnode) - height; + box_height(boxnode) = height; box_package_state(boxnode) = vtop_package_state; } else { box_package_state(boxnode) = vbox_package_state; @@ -3360,7 +3360,7 @@ void tex_begin_box(int boxcontext, scaled shift) break; } mode = code - vtop_code; - tex_set_saved_record(saved_full_spec_item_context, saved_box_context, 0, boxcontext); + tex_set_saved_record(saved_full_spec_item_context, box_context_save_type, 0, boxcontext); switch (abs(cur_list.mode)) { case vmode: spec_direction = dir_lefttoright; diff --git a/source/luametatex/source/tex/texpackaging.h b/source/luametatex/source/tex/texpackaging.h index 75d3d1653..b96d31353 100644 --- a/source/luametatex/source/tex/texpackaging.h +++ b/source/luametatex/source/tex/texpackaging.h @@ -114,7 +114,7 @@ extern scaled tex_left_marginkern (halfword p); extern scaled tex_right_marginkern (halfword p); extern halfword tex_filtered_hpack (halfword p, halfword qt, scaled w, int m, int grp, halfword d, int just_pack, halfword attr, int state, int retain); -extern halfword tex_filtered_vpack (halfword p, scaled h, int m, scaled l, int grp, halfword d, int just_pack, halfword attr, int state, int retain); +extern halfword tex_filtered_vpack (halfword p, scaled h, int m, scaled maxdepth, int grp, halfword direction, int just_pack, halfword attr, int state, int retain); extern scaledwhd tex_natural_hsizes (halfword p, halfword pp, glueratio g_mult, int g_sign, int g_order); extern scaledwhd tex_natural_vsizes (halfword p, halfword pp, glueratio g_mult, int g_sign, int g_order); diff --git a/source/luametatex/source/tex/texprinting.c b/source/luametatex/source/tex/texprinting.c index 005c2a3c8..9a7c1d729 100644 --- a/source/luametatex/source/tex/texprinting.c +++ b/source/luametatex/source/tex/texprinting.c @@ -150,48 +150,6 @@ void tex_print_ln(void) */ -// void tex_print_char(int s) -// { -// if (s < 0 || s > 255) { -// tex_formatted_warning("print", "weird character %i", s); -// } else if (s == new_line_char_par && (lmt_print_state.selector < pseudo_selector_code)) { -// tex_print_ln(); -// } else { -// switch (lmt_print_state.selector) { -// case no_print_selector_code: -// break; -// case terminal_selector_code: -// fputc(s, stdout); -// ++lmt_print_state.terminal_offset; -// break; -// case logfile_selector_code: -// fputc(s, lmt_print_state.logfile); -// ++lmt_print_state.logfile_offset; -// break; -// case terminal_and_logfile_selector_code: -// fputc(s, stdout); -// fputc(s, lmt_print_state.logfile); -// ++lmt_print_state.terminal_offset; -// ++lmt_print_state.logfile_offset; -// break; -// case pseudo_selector_code: -// if (lmt_print_state.tally < lmt_print_state.trick_count) { -// lmt_print_state.trick_buffer[lmt_print_state.tally % lmt_error_state.line_limits.size] = (unsigned char) s; -// } -// ++lmt_print_state.tally; -// break; -// case new_string_selector_code: -// tex_append_char((unsigned char) s); -// break; -// case luabuffer_selector_code: -// lmt_char_to_buffer((char) s); -// break; -// default: -// break; -// } -// } -// } - void tex_print_char(int s) { if (s < 0 || s > 255) { @@ -462,7 +420,7 @@ void tex_print_banner(void) stdout, "%s %s\n", lmt_engine_state.luatex_banner, - str_string(lmt_dump_state.format_identifier) + lmt_engine_state.dump_name ); } @@ -470,13 +428,12 @@ void tex_print_log_banner(void) { fprintf( lmt_print_state.logfile, - "engine: %s, format id: %s, time stamp: %d-%d-%d %d:%d, startup file: %s, job name: %s, dump name: %s", + "engine: %s, format id: %s, time stamp: %d-%d-%d %d:%d, startup file: %s, job name: %s", lmt_engine_state.luatex_banner, - str_string(lmt_dump_state.format_identifier), + lmt_engine_state.dump_name, year_par, month_par > 12 ? 0 : month_par, day_par, time_par / 60, time_par % 60, lmt_engine_state.startup_filename ? lmt_engine_state.startup_filename : "-", - lmt_engine_state.startup_jobname ? lmt_engine_state.startup_jobname : "-", - lmt_engine_state.dump_name ? lmt_engine_state.dump_name : "-" + lmt_engine_state.startup_jobname ? lmt_engine_state.startup_jobname : "-" ); } @@ -518,29 +475,6 @@ void tex_print_str_esc(const char *s) } } -/*tex - An array of digits in the range |0..15| is printed by |print_the_digs|. These digits are in the - reverse order: |dig[k-1]|$\,\ldots\,$|dig[0]|! -*/ - -// inline static void tex_print_decimal_digits(const unsigned char *digits, int k) -// { -// while (k-- > 0) { -// tex_print_char('0' + digits[k]); -// } -// } - -// inline static void tex_print_hexadecimal_digits(const unsigned char *digits, int k) -// { -// while (k-- > 0) { -// if (digits[k] < 10) { -// tex_print_char('0' + digits[k]); -// } else { -// tex_print_char('A' - 10 + digits[k]); -// } -// } -// } - /*tex The following procedure, which prints out the decimal representation of a given integer |n|, @@ -550,28 +484,6 @@ void tex_print_str_esc(const char *s) */ -// void tex_print_int(int n) -// { -// /*tex In the end a 0..9 fast path works out best. */ -// if (n >= 0 && n <= 9) { -// tex_print_char('0' + n); -// } else { -// /*tex index to current digit; we assume that $|n|<10^{23}$ */ -// int k = 0; -// unsigned char digits[24]; -// if (n < 0) { -// tex_print_char('-'); -// n = -n; -// } -// do { -// digits[k] = (unsigned char) (n % 10); -// n = n / 10; -// ++k; -// } while (n != 0); -// tex_print_decimal_digits(digits, k); -// } -// } - void tex_print_int(int n) { /*tex In the end a 0..9 fast path works out best; using |sprintf| is slower. */ @@ -695,19 +607,6 @@ void tex_print_sparse_dimension(scaled s, int unit) as an unsigned. */ -// void tex_print_hex(int n) -// { -// /*tex index to current digit; we assume that $0\L n<16^{22}$ */ -// int k = 0 ; -// unsigned char digits[24]; -// do { -// digits[k] = n % 16; -// n = n / 16; -// ++k; -// } while (n != 0); -// tex_print_hexadecimal_digits(digits, k); -// } - void tex_print_hex(int sn) { unsigned int n = (unsigned int) sn; @@ -989,6 +888,9 @@ void tex_print_mathspec(int p) 6 xyz \stoptyping + This is no longer the case: we now always print a full specification. The |\tracingfonts| + register will be dropped. + */ void tex_print_char_identifier(halfword c) // todo: use string_print_format @@ -1249,21 +1151,19 @@ void tex_print_levels(void) */ -extern void tex_print_format(const char *format, ...) +const char *tex_print_format_args(const char *format, va_list args) { - va_list args; - va_start(args, format); /* hm, weird, no number */ while (1) { int chr = *format++; switch (chr) { case '\0': - goto DONE; + return va_arg(args, char *); case '%': { chr = *format++; switch (chr) { case '\0': - goto DONE; + return va_arg(args, char *); case 'c': tex_print_char(va_arg(args, int)); break; @@ -1384,6 +1284,19 @@ extern void tex_print_format(const char *format, ...) } break; } + case 'Q': + { + scaled s = va_arg(args, scaled); + int u = va_arg(args, int); + tex_print_spec(s, u); + break; + } + case 'R': + { + halfword d = va_arg(args, int); + tex_print_rule_dimen(d); + break; + } case 'S': { halfword cs = va_arg(args, int); @@ -1424,13 +1337,19 @@ extern void tex_print_format(const char *format, ...) break; } } - DONE: +} + +void tex_print_format(const char *format, ...) +{ + va_list args; + va_start(args, format); /* hm, weird, no number */ + tex_print_format_args(format, args); va_end(args); } /*tex - Group codes were introcued in \ETEX\ but have been extended in the meantime in \LUATEX\ and + Group codes were introduced in \ETEX\ but have been extended in the meantime in \LUATEX\ and later again in \LUAMETATEX. We might have (even) more granularity in the future. Todo: combine this with an array of struct(id,name,lua) ... a rainy day + stack of new cd's job. diff --git a/source/luametatex/source/tex/texprinting.h b/source/luametatex/source/tex/texprinting.h index 61b7e45a2..b323b1ae5 100644 --- a/source/luametatex/source/tex/texprinting.h +++ b/source/luametatex/source/tex/texprinting.h @@ -50,64 +50,47 @@ typedef enum spec_units { */ -extern void tex_print_ln (void); /* always forces a newline */ -extern void tex_print_char (int s); -extern void tex_print_tex_str (int s); -extern void tex_print_tex_str_esc (strnumber s); -extern void tex_print_nlp (void); /* flushes a line if we're doing one */ -extern void tex_print_banner (void); -extern void tex_print_log_banner (void); -extern void tex_print_version_banner (void); -////// void tex_print_digits (const unsigned char *digits, int k); -extern void tex_print_int (int n); -extern void tex_print_hex (int n); -extern void tex_print_uhex (int n); -extern void tex_print_qhex (int n); -extern void tex_print_roman_int (int n); -extern void tex_print_current_string (void); -extern void tex_print_cs_checked (halfword p); /*tex Also does the |IMPOSSIBLE| etc. */ -extern void tex_print_cs (halfword p); /*tex Only does the undefined case. */ -extern void tex_print_cs_name (halfword p); /*tex Only prints known ones. */ -extern void tex_print_str (const char *s); -extern void tex_print_str_esc (const char *s); -extern void tex_print_dimension (scaled d, int unit); /*tex prints a dimension with pt */ -extern void tex_print_sparse_dimension (scaled d, int unit); /*tex prints a dimension with pt */ -extern void tex_print_unit (int unit); /*tex prints a glue component */ -extern void tex_print_glue (scaled d, int order, int unit); /*tex prints a glue component */ -extern void tex_print_spec (int p, int unit); /*tex prints a glue specification */ -extern void tex_print_fontspec (int p); -extern void tex_print_mathspec (int p); -extern void tex_print_font_identifier (halfword f); -extern void tex_print_font_specifier (halfword e); /*tex this is an eq table entry */ -extern void tex_print_font (halfword f); -extern void tex_print_char_identifier (halfword c); -extern void tex_print_token_list (const char *s, halfword p); /*tex prints token list data in braces */ -extern void tex_print_rule_dimen (scaled d); /*tex prints dimension in rule node */ -extern void tex_print_group (int e); -extern void tex_print_format (const char *format, ...); /*tex similar to the one we use for errors */ -extern void tex_begin_diagnostic (void); -extern void tex_print_levels (void); -extern void tex_end_diagnostic (void); -extern void tex_show_box (halfword p); -extern void tex_short_display (halfword p); /*tex prints highlights of list |p| */ - -extern void tex_print_message (const char *s); - - -/* -# define single_letter(A) \ - ((str_length(A)==1)|| \ - ((str_length(A)==4)&&*(str_string(A))>=0xF0)|| \ - ((str_length(A)==3)&&*(str_string(A))>=0xE0)|| \ - ((str_length(A)==2)&&*(str_string(A))>=0xC0)) - -# define is_active_cs(a) \ - (a && str_length(a)>3 && \ - ( *str_string(a) == 0xEF) && \ - (*(str_string(a)+1) == 0xBF) && \ - (*(str_string(a)+2) == 0xBF)) - -*/ +extern void tex_print_ln (void); /* always forces a newline */ +extern void tex_print_char (int s); +extern void tex_print_tex_str (int s); +extern void tex_print_tex_str_esc (strnumber s); +extern void tex_print_nlp (void); /* flushes a line if we're doing one */ +extern void tex_print_banner (void); +extern void tex_print_log_banner (void); +extern void tex_print_version_banner (void); +extern void tex_print_int (int n); +extern void tex_print_hex (int n); +extern void tex_print_uhex (int n); +extern void tex_print_qhex (int n); +extern void tex_print_roman_int (int n); +extern void tex_print_current_string (void); +extern void tex_print_cs_checked (halfword p); /*tex Also does the |IMPOSSIBLE| etc. */ +extern void tex_print_cs (halfword p); /*tex Only does the undefined case. */ +extern void tex_print_cs_name (halfword p); /*tex Only prints known ones. */ +extern void tex_print_str (const char *s); +extern void tex_print_str_esc (const char *s); +extern void tex_print_dimension (scaled d, int unit); /*tex prints a dimension with pt */ +extern void tex_print_sparse_dimension (scaled d, int unit); /*tex prints a dimension with pt */ +extern void tex_print_unit (int unit); /*tex prints a glue component */ +extern void tex_print_glue (scaled d, int order, int unit); /*tex prints a glue component */ +extern void tex_print_spec (int p, int unit); /*tex prints a glue specification */ +extern void tex_print_fontspec (int p); +extern void tex_print_mathspec (int p); +extern void tex_print_font_identifier (halfword f); +extern void tex_print_font_specifier (halfword e); /*tex this is an eq table entry */ +extern void tex_print_font (halfword f); +extern void tex_print_char_identifier (halfword c); +extern void tex_print_token_list (const char *s, halfword p); /*tex prints token list data in braces */ +extern void tex_print_rule_dimen (scaled d); /*tex prints dimension in rule node */ +extern void tex_print_group (int e); +extern void tex_print_format (const char *format, ...); /*tex similar to the one we use for errors */ +extern const char *tex_print_format_args (const char *format, va_list args); +extern void tex_begin_diagnostic (void); +extern void tex_print_levels (void); +extern void tex_end_diagnostic (void); +extern void tex_show_box (halfword p); +extern void tex_short_display (halfword p); /*tex prints highlights of list |p| */ +extern void tex_print_message (const char *s); inline static int tex_single_letter(strnumber s) { diff --git a/source/luametatex/source/tex/texscanning.c b/source/luametatex/source/tex/texscanning.c index 8f2dfa050..5dd34b3b6 100644 --- a/source/luametatex/source/tex/texscanning.c +++ b/source/luametatex/source/tex/texscanning.c @@ -168,60 +168,44 @@ inline static void tex_aux_downgrade_cur_val(int level, int succeeded, int negat and they don't downgrade, nor negate which saves a little testing. */ break; - // case int_val_level: - // case attr_val_level: - // case dimen_val_level: - // while (cur_val_level > level) { - // --cur_val_level; - // } - // if (negative) { - // negate(cur_val); - // } - // break; - // case glue_val_level: - // case mu_val_level: - // while (cur_val_level > level) { - // tex_aux_downgrade_cur_val(); /* cleaner is inline */ - // } - // if (succeeded == 1) { - // cur_val = new_glue_spec_node(cur_val); - // } - // if (negative) { - // negate(glue_amount(cur_val)); - // negate(glue_stretch(cur_val)); - // negate(glue_shrink(cur_val)); - // } - // break; - // default: - // /* this can't happen */ - // return 0; - default: - /*tex There is no real need for it being a loop, a test would do. */ - while (cur_val_level > level) { - /*tex Convert |cur_val| to a lower level. */ - switch (cur_val_level) { - case glue_val_level: - cur_val = glue_amount(cur_val); - break; - case mu_val_level : - tex_aux_mu_error(1); - break; - } - --cur_val_level; - } - if (cur_val_level == glue_val_level || cur_val_level == mu_val_level) { - if (succeeded == 1) { - cur_val = tex_new_glue_spec_node(cur_val); - } - if (negative) { - glue_amount(cur_val) = -glue_amount(cur_val); - glue_stretch(cur_val) = -glue_stretch(cur_val); - glue_shrink(cur_val) = -glue_shrink(cur_val); - } - } else if (negative) { - cur_val = -cur_val; - } - break; + case int_val_level: + case attr_val_level: + case dimen_val_level: + while (cur_val_level > level) { + --cur_val_level; + } + if (negative) { + cur_val = -cur_val; + } + break; + default: + /*tex There is no real need for it being a loop, a test would do. */ + while (cur_val_level > level) { + /*tex Convert |cur_val| to a lower level. */ + switch (cur_val_level) { + case glue_val_level: + case mu_val_level : + cur_val = glue_amount(cur_val); + break; + // case mu_val_level : + // tex_aux_mu_error(1); + // break; + } + --cur_val_level; + } + if (cur_val_level == glue_val_level || cur_val_level == mu_val_level) { + if (succeeded == 1) { + cur_val = tex_new_glue_spec_node(cur_val); + } + if (negative) { + glue_amount(cur_val) = -glue_amount(cur_val); + glue_stretch(cur_val) = -glue_stretch(cur_val); + glue_shrink(cur_val) = -glue_shrink(cur_val); + } + } else if (negative) { + cur_val = -cur_val; + } + break; } } @@ -1077,12 +1061,10 @@ static void tex_aux_set_cur_val_by_define_char_cmd(int chr) break; case mathcode_charcode: case extmathcode_charcode: - /* case extmathcodenum_charcode: */ chr = tex_get_math_code_number(index); break; case delcode_charcode: case extdelcode_charcode: - /* case extdelcodenum_charcode: */ chr = tex_get_del_code_number(index); break; default: @@ -1358,7 +1340,6 @@ static halfword tex_aux_scan_something_internal(halfword cmd, halfword chr, int if (tex_aux_valid_tok_level(level)) { cur_val = cur_chr; cur_val_level = font_val_level; - /* set_font_touched(cur_chr, 1); */ return cur_val; } else { break; @@ -3280,7 +3261,6 @@ halfword tex_scan_font_identifier(halfword *spec) case define_font_cmd: return cur_font_par; case set_font_cmd: - /* set_font_touched(cur_chr, 1); */ return cur_chr; case fontspec_cmd: { @@ -3295,7 +3275,6 @@ halfword tex_scan_font_identifier(halfword *spec) halfword siz = cur_chr; halfword fam = tex_scan_math_family_number(); halfword fnt = tex_fam_fnt(fam, siz); - /* set_font_touched(fnt, 1); */ return fnt; } case register_int_cmd: diff --git a/source/luametatex/source/tex/textoken.c b/source/luametatex/source/tex/textoken.c index 0d2415233..0bb0f3e45 100644 --- a/source/luametatex/source/tex/textoken.c +++ b/source/luametatex/source/tex/textoken.c @@ -169,7 +169,7 @@ void tex_compact_tokens(void) memset((void *) mapper, -1, ((size_t) lmt_token_memory_state.tokens_data.allocated) * sizeof(halfword)); memoryword *tokens = lmt_token_memory_state.tokens; /* also reset available */ - for (int cs = 0; cs < (eqtb_size + lmt_hash_state.hash_data.ptr); cs++) { + for (int cs = 0; cs < (eqtb_size + lmt_hash_state.hash_data.ptr + 1); cs++) { switch (eq_type(cs)) { case call_cmd: case protected_call_cmd: @@ -2114,27 +2114,24 @@ halfword tex_string_to_toks(const char *ss) |lua_str_toks| is almost identical, but it also escapes the three symbols that \LUA\ considers special while scanning a literal string. - - This changes the string |str_pool[b .. pool_ptr]| to a token list: - */ static halfword lmt_str_toks(lstring b) /* returns head */ { - /*tex index into string */ unsigned char *k = (unsigned char *) b.s; - /*tex tail of the token list */ - halfword h = null; - halfword p = null; + halfword head = null; + halfword tail = head; while (k < (unsigned char *) b.s + b.l) { - /*tex token being appended */ halfword t = aux_str2uni(k); k += utf8_size(t); if (t == ' ') { t = space_token; } else { if ((t == '\\') || (t == '"') || (t == '\'') || (t == 10) || (t == 13)) { - p = tex_store_new_token(p, escape_token); + tail = tex_store_new_token(tail, escape_token); + if (! head) { + head = tail; + } if (t == 10) { t = 'n'; } else if (t == 13) { @@ -2143,12 +2140,12 @@ static halfword lmt_str_toks(lstring b) /* returns head */ } t += other_token; } - p = tex_store_new_token(p, t); - if (! h) { - h = p; + tail = tex_store_new_token(tail, t); + if (! head) { + head = tail; } } - return h; + return head; } /*tex @@ -2801,20 +2798,36 @@ void tex_run_convert_tokens(halfword code) break; } case lua_escape_string_code: + /* case lua_token_string_code: */ /* for now rejected: could also be keyword */ { - lstring escstr; - int l = 0; - int e = lmt_token_state.in_lua_escape; + /* tex + If I would need it I could probably add support for catcode tables and verbose + serialization. Maybe we can use some of the other (more efficient) helpers when + we have a detokenize variant. We make sure that the escape character is a + backslash because these conversions can occur anywhere and are very much + related to \LUA\ calls. (Maybe it makes sense to pass it a argument to the + serializer.) + + A |\luatokenstring| primitive doesn't really make sense because \LUATEX\ lacks + it and |\luaescapestring| is a compatibility primitive. + */ + lstring str; + int length = 0; + int saved_in_lua_escape = lmt_token_state.in_lua_escape; + halfword saved_escape_char = escape_char_par; full_scanner_status saved_full_status = tex_save_full_scanner_status(); - halfword result = tex_scan_toks_expand(0, NULL, 0); + halfword result = tex_scan_toks_expand(0, NULL, 0); + /* halfword result = tex_scan_toks_expand(0, NULL, code == lua_token_string_code); */ lmt_token_state.in_lua_escape = 1; - escstr.s = (unsigned char *) tex_tokenlist_to_tstring(result, 0, &l, 0, 0, 0); - escstr.l = (unsigned) l; - lmt_token_state.in_lua_escape = e; + escape_char_par = '\\'; + str.s = (unsigned char *) tex_tokenlist_to_tstring(result, 0, &length, 0, 0, 0); + str.l = (unsigned) length; + lmt_token_state.in_lua_escape = saved_in_lua_escape; + escape_char_par = saved_escape_char; tex_delete_token_reference(result); /* boils down to flush_list */ tex_unsave_full_scanner_status(saved_full_status); - if (escstr.l) { - result = lmt_str_toks(escstr); + if (str.l) { + result = lmt_str_toks(str); tex_begin_inserted_list(result); } return; @@ -2855,7 +2868,7 @@ void tex_run_convert_tokens(halfword code) tex_open_log_file(); } push_selector; - tex_print_tex_str(lmt_dump_state.format_name); + tex_print_str(lmt_engine_state.dump_name); pop_selector; break; } @@ -2937,7 +2950,7 @@ strnumber tex_the_convert_string(halfword c, int i) tex_aux_print_job_name(); break; case format_name_code: - tex_print_tex_str(lmt_dump_state.format_name); + tex_print_str(lmt_engine_state.dump_name); break; case luatex_banner_code: tex_print_str(lmt_engine_state.luatex_banner); diff --git a/source/luametatex/source/utilities/auxfile.c b/source/luametatex/source/utilities/auxfile.c index 1aae0e691..0021cb229 100644 --- a/source/luametatex/source/utilities/auxfile.c +++ b/source/luametatex/source/utilities/auxfile.c @@ -254,16 +254,6 @@ } } - // int aux_is_readable(const char *filename) - // { - // struct stat finfo; - // FILE *f; - // return (stat(filename, &finfo) == 0) - // && S_ISREG(finfo.st_mode) - // && ((f = aux_utf8_fopen(filename, "r")) != NULL) - // && ! fclose(f); - // } - int aux_is_readable(const char *filename) { struct _stati64 info; diff --git a/source/luametatex/source/utilities/auxsparsearray.c b/source/luametatex/source/utilities/auxsparsearray.c index d9fa5e453..c3f2c7687 100644 --- a/source/luametatex/source/utilities/auxsparsearray.c +++ b/source/luametatex/source/utilities/auxsparsearray.c @@ -325,13 +325,6 @@ int sa_get_item_n(const sa_tree head, int n) } } -/* -void rawset_sa_item_4(sa_tree head, int n, sa_tree_item v) -{ - head->tree[LMT_SA_H_PART(n)][LMT_SA_M_PART(n)][LMT_SA_L_PART(n)] = v; -} -*/ - void sa_clear_stack(sa_tree a) { if (a) { diff --git a/source/luametatex/source/utilities/auxsparsearray.h b/source/luametatex/source/utilities/auxsparsearray.h index 0a4ce20f1..a1a902c54 100644 --- a/source/luametatex/source/utilities/auxsparsearray.h +++ b/source/luametatex/source/utilities/auxsparsearray.h @@ -57,14 +57,6 @@ typedef struct sparse_state_info { extern sparse_state_info lmt_sparse_state; -/* -typedef struct sa_mathblob { - unsigned int character_value:21; - unsigned int class_value:3; - unsigned int family_value:8; -} sa_mathblob; -*/ - typedef struct sa_mathblob { unsigned int class_value:math_class_bits; unsigned int family_value:math_family_bits; @@ -121,10 +113,6 @@ extern void sa_set_item_1 (sa_tree head, int n, int v, int gl); extern void sa_set_item_2 (sa_tree head, int n, int v, int gl); extern void sa_set_item_4 (sa_tree head, int n, sa_tree_item v, int gl); extern void sa_set_item_8 (sa_tree head, int n, sa_tree_item v1, sa_tree_item v2, int gl); -/* void sa_rawset_item_1 (sa_tree head, int n, sa_tree_item v); */ -/* void sa_rawset_item_2 (sa_tree head, int n, sa_tree_item v); */ -/* void sa_rawset_item_4 (sa_tree head, int n, sa_tree_item v); */ -/* void sa_rawset_item_8 (sa_tree head, int n, sa_tree_item v1, sa_tree_item v2); */ extern sa_tree sa_new_tree (int size, int bytes, sa_tree_item dflt); extern sa_tree sa_copy_tree (sa_tree head); extern void sa_destroy_tree (sa_tree head); diff --git a/source/luametatex/source/utilities/auxunistring.h b/source/luametatex/source/utilities/auxunistring.h index 1e6a997b9..4c5ee3639 100644 --- a/source/luametatex/source/utilities/auxunistring.h +++ b/source/luametatex/source/utilities/auxunistring.h @@ -16,4 +16,3 @@ extern size_t aux_utf8len (const char *text, size_t size); # define buffer_to_unichar(k) aux_str2uni((const unsigned char *)(lmt_fileio_state.io_buffer+k)) # endif - diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii index 545627d07..6bcff2af2 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{2022.09.16 14:39} +\newcontextversion{2022.10.14 10:13} %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 90eea4118..e02334f8d 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{2022.09.16 14:39} +\edef\contextversion{2022.10.14 10:13} %D For those who want to use this: diff --git a/tex/context/base/mkiv/char-def.lua b/tex/context/base/mkiv/char-def.lua index 57061735b..a5a21687b 100644 --- a/tex/context/base/mkiv/char-def.lua +++ b/tex/context/base/mkiv/char-def.lua @@ -45,6 +45,43 @@ local variants_dotted={ [0xFE00]="dotted form", } +local variants_90={ + [0xFE00]="rotated 90 degrees", +} + +local variants_180={ + [0xFE01]="rotated 180 degrees", +} + +local variants_270={ + [0xFE02]="rotated 270 degrees", +} + +local variants_expanded={ + [0xFE00]="expanded", +} + +local variants_90_180={ + [0xFE00]="rotated 90 degrees", + [0xFE01]="rotated 180 degrees", +} + +local variants_90_180_270={ + [0xFE00]="rotated 90 degrees", + [0xFE01]="rotated 180 degrees", + [0xFE02]="rotated 270 degrees", +} + +local variants_180_270={ + [0xFE01]="rotated 180 degrees", + [0xFE02]="rotated 270 degrees", +} + +local variants_90_270={ + [0xFE00]="rotated 90 degrees", + [0xFE02]="rotated 270 degrees", +} + characters = characters or { } characters.data={ @@ -480,9 +517,9 @@ characters.data={ direction="es", linebreak="hy", mathclass="ordinary", - mathgroup="binary arithmetic", mathextensible="h", mathfiller="relfill", + mathgroup="binary arithmetic", mathname="mathhyphen", mathsymbol=0x2212, synonyms={ "hyphen or minus sign", "hyphus" }, @@ -701,8 +738,8 @@ characters.data={ }, { class="relation", - name="Relbar", comment="useless", + name="Relbar", }, }, unicodeslot=0x3D, @@ -1048,8 +1085,8 @@ characters.data={ { adobename="asciicircum", category="sk", - comment="the Hat looks rediculous in most fonts", cjkwd="na", + comment="the Hat looks rediculous in most fonts", contextname="textasciicircum", description="CIRCUMFLEX ACCENT", direction="on", @@ -23219,6 +23256,7 @@ characters.data={ direction="l", indic="c", linebreak="al", + synonyms={ "bangla khanda ta" }, unicodeslot=0x9CE, }, [0x9D7]={ @@ -28096,6 +28134,13 @@ characters.data={ linebreak="al", unicodeslot=0xCF2, }, + [0xCF3]={ + category="mc", + description="KANNADA SIGN COMBINING ANUSVARA ABOVE RIGHT", + direction="l", + linebreak="cm", + unicodeslot=0xCF3, + }, [0xD00]={ category="mn", description="MALAYALAM SIGN COMBINING ANUSVARA ABOVE", @@ -30909,6 +30954,13 @@ characters.data={ linebreak="sa", unicodeslot=0xECD, }, + [0xECE]={ + category="mn", + description="LAO YAMAKKAN", + direction="nsm", + linebreak="sa", + unicodeslot=0xECE, + }, [0xED0]={ category="nd", description="LAO DIGIT ZERO", @@ -56408,7 +56460,7 @@ characters.data={ combining=0xEA, description="COMBINING DOUBLE CIRCUMFLEX ABOVE", direction="nsm", - linebreak="cm", + linebreak="gl", unicodeslot=0x1DCD, }, [0x1DCE]={ @@ -56784,7 +56836,7 @@ characters.data={ combining=0xE9, description="COMBINING DOUBLE INVERTED BREVE BELOW", direction="nsm", - linebreak="cm", + linebreak="gl", unicodeslot=0x1DFC, }, [0x1DFD]={ @@ -63092,7 +63144,7 @@ characters.data={ category="po", description="QUADRUPLE PRIME", direction="on", - linebreak="al", + linebreak="po", mathclass="prime", mathname="quadrupleprime", specials={ "compat", 0x2032, 0x2032, 0x2032, 0x2032 }, @@ -63195,6 +63247,7 @@ characters.data={ linebreak="al", mathclass="ghost", mathname="invisiblecomma", + synonyms={ "invisible comma" }, unicodeslot=0x2063, }, [0x2064]={ @@ -66926,8 +66979,8 @@ characters.data={ description="EMPTY SET", direction="on", linebreak="al", - mathgroup="constant set", mathclass="ordinary", + mathgroup="constant set", mathname="emptyset", synonyms={ "null set" }, unicodeslot=0x2205, @@ -67102,8 +67155,8 @@ characters.data={ }, { class="relation", - name="relbar", comment="useless", + name="relbar", }, }, unicodeslot=0x2212, @@ -159588,6 +159641,30 @@ characters.data={ linebreak="al", unicodeslot=0x10EB1, }, + [0x10EFD]={ + category="mn", + combining=0xDC, + description="ARABIC SMALL LOW WORD SAKTA", + direction="nsm", + linebreak="cm", + unicodeslot=0x10EFD, + }, + [0x10EFE]={ + category="mn", + combining=0xDC, + description="ARABIC SMALL LOW WORD QASR", + direction="nsm", + linebreak="cm", + unicodeslot=0x10EFE, + }, + [0x10EFF]={ + category="mn", + combining=0xDC, + description="ARABIC SMALL LOW WORD MADDA", + direction="nsm", + linebreak="cm", + unicodeslot=0x10EFF, + }, [0x10F00]={ category="lo", description="OLD SOGDIAN LETTER ALEPH", @@ -164352,6 +164429,27 @@ characters.data={ linebreak="cm", unicodeslot=0x1123E, }, + [0x1123F]={ + category="lo", + description="KHOJKI LETTER QA", + direction="l", + linebreak="al", + unicodeslot=0x1123F, + }, + [0x11240]={ + category="lo", + description="KHOJKI LETTER SHORT I", + direction="l", + linebreak="al", + unicodeslot=0x11240, + }, + [0x11241]={ + category="mn", + description="KHOJKI VOWEL SIGN VOCALIC R", + direction="nsm", + linebreak="cm", + unicodeslot=0x11241, + }, [0x11280]={ category="lo", description="MULTANI LETTER A", @@ -172828,6 +172926,76 @@ characters.data={ linebreak="al", unicodeslot=0x11AF8, }, + [0x11B00]={ + category="po", + description="DEVANAGARI HEAD MARK", + direction="l", + linebreak="bb", + unicodeslot=0x11B00, + }, + [0x11B01]={ + category="po", + description="DEVANAGARI HEAD MARK WITH HEADSTROKE", + direction="l", + linebreak="bb", + unicodeslot=0x11B01, + }, + [0x11B02]={ + category="po", + description="DEVANAGARI SIGN BHALE", + direction="l", + linebreak="bb", + unicodeslot=0x11B02, + }, + [0x11B03]={ + category="po", + description="DEVANAGARI SIGN BHALE WITH HOOK", + direction="l", + linebreak="bb", + unicodeslot=0x11B03, + }, + [0x11B04]={ + category="po", + description="DEVANAGARI SIGN EXTENDED BHALE", + direction="l", + linebreak="bb", + unicodeslot=0x11B04, + }, + [0x11B05]={ + category="po", + description="DEVANAGARI SIGN EXTENDED BHALE WITH HOOK", + direction="l", + linebreak="bb", + unicodeslot=0x11B05, + }, + [0x11B06]={ + category="po", + description="DEVANAGARI SIGN WESTERN FIVE-LIKE BHALE", + direction="l", + linebreak="bb", + unicodeslot=0x11B06, + }, + [0x11B07]={ + category="po", + description="DEVANAGARI SIGN WESTERN NINE-LIKE BHALE", + direction="l", + linebreak="bb", + unicodeslot=0x11B07, + }, + [0x11B08]={ + category="po", + description="DEVANAGARI SIGN REVERSED NINE-LIKE BHALE", + direction="l", + linebreak="bb", + unicodeslot=0x11B08, + }, + [0x11B09]={ + category="po", + description="DEVANAGARI SIGN MINDU", + direction="l", + linebreak="bb", + unicodeslot=0x11B09, + }, [0x11C00]={ category="lo", description="BHAIKSUKI LETTER A", @@ -175129,6 +175297,610 @@ characters.data={ linebreak="al", unicodeslot=0x11EF8, }, + [0x11F00]={ + category="mn", + description="KAWI SIGN CANDRABINDU", + direction="nsm", + linebreak="cm", + unicodeslot=0x11F00, + }, + [0x11F01]={ + category="mn", + description="KAWI SIGN ANUSVARA", + direction="nsm", + linebreak="cm", + unicodeslot=0x11F01, + }, + [0x11F02]={ + category="lo", + description="KAWI SIGN REPHA", + direction="l", + linebreak="al", + unicodeslot=0x11F02, + }, + [0x11F03]={ + category="mc", + description="KAWI SIGN VISARGA", + direction="l", + linebreak="cm", + unicodeslot=0x11F03, + }, + [0x11F04]={ + category="lo", + description="KAWI LETTER A", + direction="l", + linebreak="al", + unicodeslot=0x11F04, + }, + [0x11F05]={ + category="lo", + description="KAWI LETTER AA", + direction="l", + linebreak="al", + unicodeslot=0x11F05, + }, + [0x11F06]={ + category="lo", + description="KAWI LETTER I", + direction="l", + linebreak="al", + unicodeslot=0x11F06, + }, + [0x11F07]={ + category="lo", + description="KAWI LETTER II", + direction="l", + linebreak="al", + unicodeslot=0x11F07, + }, + [0x11F08]={ + category="lo", + description="KAWI LETTER U", + direction="l", + linebreak="al", + unicodeslot=0x11F08, + }, + [0x11F09]={ + category="lo", + description="KAWI LETTER UU", + direction="l", + linebreak="al", + unicodeslot=0x11F09, + }, + [0x11F0A]={ + category="lo", + description="KAWI LETTER VOCALIC R", + direction="l", + linebreak="al", + unicodeslot=0x11F0A, + }, + [0x11F0B]={ + category="lo", + description="KAWI LETTER VOCALIC RR", + direction="l", + linebreak="al", + unicodeslot=0x11F0B, + }, + [0x11F0C]={ + category="lo", + description="KAWI LETTER VOCALIC L", + direction="l", + linebreak="al", + unicodeslot=0x11F0C, + }, + [0x11F0D]={ + category="lo", + description="KAWI LETTER VOCALIC LL", + direction="l", + linebreak="al", + unicodeslot=0x11F0D, + }, + [0x11F0E]={ + category="lo", + description="KAWI LETTER E", + direction="l", + linebreak="al", + unicodeslot=0x11F0E, + }, + [0x11F0F]={ + category="lo", + description="KAWI LETTER AI", + direction="l", + linebreak="al", + unicodeslot=0x11F0F, + }, + [0x11F10]={ + category="lo", + description="KAWI LETTER O", + direction="l", + linebreak="al", + unicodeslot=0x11F10, + }, + [0x11F12]={ + category="lo", + description="KAWI LETTER KA", + direction="l", + linebreak="al", + unicodeslot=0x11F12, + }, + [0x11F13]={ + category="lo", + description="KAWI LETTER KHA", + direction="l", + linebreak="al", + unicodeslot=0x11F13, + }, + [0x11F14]={ + category="lo", + description="KAWI LETTER GA", + direction="l", + linebreak="al", + unicodeslot=0x11F14, + }, + [0x11F15]={ + category="lo", + description="KAWI LETTER GHA", + direction="l", + linebreak="al", + unicodeslot=0x11F15, + }, + [0x11F16]={ + category="lo", + description="KAWI LETTER NGA", + direction="l", + linebreak="al", + unicodeslot=0x11F16, + }, + [0x11F17]={ + category="lo", + description="KAWI LETTER CA", + direction="l", + linebreak="al", + unicodeslot=0x11F17, + }, + [0x11F18]={ + category="lo", + description="KAWI LETTER CHA", + direction="l", + linebreak="al", + unicodeslot=0x11F18, + }, + [0x11F19]={ + category="lo", + description="KAWI LETTER JA", + direction="l", + linebreak="al", + unicodeslot=0x11F19, + }, + [0x11F1A]={ + category="lo", + description="KAWI LETTER JHA", + direction="l", + linebreak="al", + unicodeslot=0x11F1A, + }, + [0x11F1B]={ + category="lo", + description="KAWI LETTER NYA", + direction="l", + linebreak="al", + unicodeslot=0x11F1B, + }, + [0x11F1C]={ + category="lo", + description="KAWI LETTER TTA", + direction="l", + linebreak="al", + unicodeslot=0x11F1C, + }, + [0x11F1D]={ + category="lo", + description="KAWI LETTER TTHA", + direction="l", + linebreak="al", + unicodeslot=0x11F1D, + }, + [0x11F1E]={ + category="lo", + description="KAWI LETTER DDA", + direction="l", + linebreak="al", + unicodeslot=0x11F1E, + }, + [0x11F1F]={ + category="lo", + description="KAWI LETTER DDHA", + direction="l", + linebreak="al", + unicodeslot=0x11F1F, + }, + [0x11F20]={ + category="lo", + description="KAWI LETTER NNA", + direction="l", + linebreak="al", + unicodeslot=0x11F20, + }, + [0x11F21]={ + category="lo", + description="KAWI LETTER TA", + direction="l", + linebreak="al", + unicodeslot=0x11F21, + }, + [0x11F22]={ + category="lo", + description="KAWI LETTER THA", + direction="l", + linebreak="al", + unicodeslot=0x11F22, + }, + [0x11F23]={ + category="lo", + description="KAWI LETTER DA", + direction="l", + linebreak="al", + unicodeslot=0x11F23, + }, + [0x11F24]={ + category="lo", + description="KAWI LETTER DHA", + direction="l", + linebreak="al", + unicodeslot=0x11F24, + }, + [0x11F25]={ + category="lo", + description="KAWI LETTER NA", + direction="l", + linebreak="al", + unicodeslot=0x11F25, + }, + [0x11F26]={ + category="lo", + description="KAWI LETTER PA", + direction="l", + linebreak="al", + unicodeslot=0x11F26, + }, + [0x11F27]={ + category="lo", + description="KAWI LETTER PHA", + direction="l", + linebreak="al", + unicodeslot=0x11F27, + }, + [0x11F28]={ + category="lo", + description="KAWI LETTER BA", + direction="l", + linebreak="al", + unicodeslot=0x11F28, + }, + [0x11F29]={ + category="lo", + description="KAWI LETTER BHA", + direction="l", + linebreak="al", + unicodeslot=0x11F29, + }, + [0x11F2A]={ + category="lo", + description="KAWI LETTER MA", + direction="l", + linebreak="al", + unicodeslot=0x11F2A, + }, + [0x11F2B]={ + category="lo", + description="KAWI LETTER YA", + direction="l", + linebreak="al", + unicodeslot=0x11F2B, + }, + [0x11F2C]={ + category="lo", + description="KAWI LETTER RA", + direction="l", + linebreak="al", + unicodeslot=0x11F2C, + }, + [0x11F2D]={ + category="lo", + description="KAWI LETTER LA", + direction="l", + linebreak="al", + unicodeslot=0x11F2D, + }, + [0x11F2E]={ + category="lo", + description="KAWI LETTER WA", + direction="l", + linebreak="al", + unicodeslot=0x11F2E, + }, + [0x11F2F]={ + category="lo", + description="KAWI LETTER SHA", + direction="l", + linebreak="al", + unicodeslot=0x11F2F, + }, + [0x11F30]={ + category="lo", + description="KAWI LETTER SSA", + direction="l", + linebreak="al", + unicodeslot=0x11F30, + }, + [0x11F31]={ + category="lo", + description="KAWI LETTER SA", + direction="l", + linebreak="al", + unicodeslot=0x11F31, + }, + [0x11F32]={ + category="lo", + description="KAWI LETTER HA", + direction="l", + linebreak="al", + unicodeslot=0x11F32, + }, + [0x11F33]={ + category="lo", + description="KAWI LETTER JNYA", + direction="l", + linebreak="al", + unicodeslot=0x11F33, + }, + [0x11F34]={ + category="mc", + description="KAWI VOWEL SIGN AA", + direction="l", + linebreak="cm", + unicodeslot=0x11F34, + }, + [0x11F35]={ + category="mc", + description="KAWI VOWEL SIGN ALTERNATE AA", + direction="l", + linebreak="cm", + unicodeslot=0x11F35, + }, + [0x11F36]={ + category="mn", + description="KAWI VOWEL SIGN I", + direction="nsm", + linebreak="cm", + unicodeslot=0x11F36, + }, + [0x11F37]={ + category="mn", + description="KAWI VOWEL SIGN II", + direction="nsm", + linebreak="cm", + unicodeslot=0x11F37, + }, + [0x11F38]={ + category="mn", + description="KAWI VOWEL SIGN U", + direction="nsm", + linebreak="cm", + unicodeslot=0x11F38, + }, + [0x11F39]={ + category="mn", + description="KAWI VOWEL SIGN UU", + direction="nsm", + linebreak="cm", + unicodeslot=0x11F39, + }, + [0x11F3A]={ + category="mn", + description="KAWI VOWEL SIGN VOCALIC R", + direction="nsm", + linebreak="cm", + unicodeslot=0x11F3A, + }, + [0x11F3E]={ + category="mc", + description="KAWI VOWEL SIGN E", + direction="l", + linebreak="cm", + unicodeslot=0x11F3E, + }, + [0x11F3F]={ + category="mc", + description="KAWI VOWEL SIGN AI", + direction="l", + linebreak="cm", + unicodeslot=0x11F3F, + }, + [0x11F40]={ + category="mn", + description="KAWI VOWEL SIGN EU", + direction="nsm", + linebreak="cm", + unicodeslot=0x11F40, + }, + [0x11F41]={ + category="mc", + combining=0x9, + description="KAWI SIGN KILLER", + direction="l", + linebreak="cm", + unicodeslot=0x11F41, + }, + [0x11F42]={ + category="mn", + combining=0x9, + description="KAWI CONJOINER", + direction="nsm", + linebreak="cm", + unicodeslot=0x11F42, + }, + [0x11F43]={ + category="po", + description="KAWI DANDA", + direction="l", + linebreak="ba", + unicodeslot=0x11F43, + }, + [0x11F44]={ + category="po", + description="KAWI DOUBLE DANDA", + direction="l", + linebreak="ba", + unicodeslot=0x11F44, + }, + [0x11F45]={ + category="po", + description="KAWI PUNCTUATION SECTION MARKER", + direction="l", + linebreak="id", + unicodeslot=0x11F45, + }, + [0x11F46]={ + category="po", + description="KAWI PUNCTUATION ALTERNATE SECTION MARKER", + direction="l", + linebreak="id", + unicodeslot=0x11F46, + }, + [0x11F47]={ + category="po", + description="KAWI PUNCTUATION FLOWER", + direction="l", + linebreak="id", + unicodeslot=0x11F47, + }, + [0x11F48]={ + category="po", + description="KAWI PUNCTUATION SPACE FILLER", + direction="l", + linebreak="id", + unicodeslot=0x11F48, + }, + [0x11F49]={ + category="po", + description="KAWI PUNCTUATION DOT", + direction="l", + linebreak="id", + unicodeslot=0x11F49, + }, + [0x11F4A]={ + category="po", + description="KAWI PUNCTUATION DOUBLE DOT", + direction="l", + linebreak="id", + unicodeslot=0x11F4A, + }, + [0x11F4B]={ + category="po", + description="KAWI PUNCTUATION TRIPLE DOT", + direction="l", + linebreak="id", + unicodeslot=0x11F4B, + }, + [0x11F4C]={ + category="po", + description="KAWI PUNCTUATION CIRCLE", + direction="l", + linebreak="id", + unicodeslot=0x11F4C, + }, + [0x11F4D]={ + category="po", + description="KAWI PUNCTUATION FILLED CIRCLE", + direction="l", + linebreak="id", + unicodeslot=0x11F4D, + }, + [0x11F4E]={ + category="po", + description="KAWI PUNCTUATION SPIRAL", + direction="l", + linebreak="id", + unicodeslot=0x11F4E, + }, + [0x11F4F]={ + category="po", + description="KAWI PUNCTUATION CLOSING SPIRAL", + direction="l", + linebreak="id", + unicodeslot=0x11F4F, + }, + [0x11F50]={ + category="nd", + description="KAWI DIGIT ZERO", + direction="l", + linebreak="nu", + unicodeslot=0x11F50, + }, + [0x11F51]={ + category="nd", + description="KAWI DIGIT ONE", + direction="l", + linebreak="nu", + unicodeslot=0x11F51, + }, + [0x11F52]={ + category="nd", + description="KAWI DIGIT TWO", + direction="l", + linebreak="nu", + unicodeslot=0x11F52, + }, + [0x11F53]={ + category="nd", + description="KAWI DIGIT THREE", + direction="l", + linebreak="nu", + unicodeslot=0x11F53, + }, + [0x11F54]={ + category="nd", + description="KAWI DIGIT FOUR", + direction="l", + linebreak="nu", + unicodeslot=0x11F54, + }, + [0x11F55]={ + category="nd", + description="KAWI DIGIT FIVE", + direction="l", + linebreak="nu", + unicodeslot=0x11F55, + }, + [0x11F56]={ + category="nd", + description="KAWI DIGIT SIX", + direction="l", + linebreak="nu", + unicodeslot=0x11F56, + }, + [0x11F57]={ + category="nd", + description="KAWI DIGIT SEVEN", + direction="l", + linebreak="nu", + unicodeslot=0x11F57, + }, + [0x11F58]={ + category="nd", + description="KAWI DIGIT EIGHT", + direction="l", + linebreak="nu", + unicodeslot=0x11F58, + }, + [0x11F59]={ + category="nd", + description="KAWI DIGIT NINE", + direction="l", + linebreak="nu", + unicodeslot=0x11F59, + }, [0x11FB0]={ category="lo", description="LISU LETTER YHA", @@ -185847,6 +186619,7 @@ characters.data={ direction="l", linebreak="al", unicodeslot=0x13091, + variants=variants_90, }, [0x13092]={ category="lo", @@ -185854,6 +186627,7 @@ characters.data={ direction="l", linebreak="al", unicodeslot=0x13092, + variants=variants_90, }, [0x13093]={ category="lo", @@ -185861,6 +186635,7 @@ characters.data={ direction="l", linebreak="al", unicodeslot=0x13093, + variants=variants_180, }, [0x13094]={ category="lo", @@ -186015,6 +186790,7 @@ characters.data={ direction="l", linebreak="al", unicodeslot=0x130A9, + variants=variants_180, }, [0x130AA]={ category="lo", @@ -186729,6 +187505,7 @@ characters.data={ direction="l", linebreak="al", unicodeslot=0x1310F, + variants=variants_90, }, [0x13110]={ category="lo", @@ -186785,6 +187562,7 @@ characters.data={ direction="l", linebreak="al", unicodeslot=0x13117, + variants=variants_270, }, [0x13118]={ category="lo", @@ -186820,6 +187598,7 @@ characters.data={ direction="l", linebreak="al", unicodeslot=0x1311C, + variants=variants_90, }, [0x1311D]={ category="lo", @@ -186855,6 +187634,7 @@ characters.data={ direction="l", linebreak="al", unicodeslot=0x13121, + variants=variants_90, }, [0x13122]={ category="lo", @@ -186897,6 +187677,7 @@ characters.data={ direction="l", linebreak="al", unicodeslot=0x13127, + variants=variants_90, }, [0x13128]={ category="lo", @@ -187023,6 +187804,7 @@ characters.data={ direction="l", linebreak="al", unicodeslot=0x13139, + variants=variants_90_270, }, [0x1313A]={ category="lo", @@ -187541,6 +188323,7 @@ characters.data={ direction="l", linebreak="al", unicodeslot=0x13183, + variants=variants_270, }, [0x13184]={ category="lo", @@ -187569,6 +188352,7 @@ characters.data={ direction="l", linebreak="al", unicodeslot=0x13187, + variants=variants_180, }, [0x13188]={ category="lo", @@ -187744,6 +188528,7 @@ characters.data={ direction="l", linebreak="al", unicodeslot=0x131A0, + variants=variants_90_270, }, [0x131A1]={ category="lo", @@ -187863,6 +188648,7 @@ characters.data={ direction="l", linebreak="al", unicodeslot=0x131B1, + variants=variants_90_180, }, [0x131B2]={ category="lo", @@ -187912,6 +188698,7 @@ characters.data={ direction="l", linebreak="al", unicodeslot=0x131B8, + variants=variants_90, }, [0x131B9]={ category="lo", @@ -187919,6 +188706,7 @@ characters.data={ direction="l", linebreak="al", unicodeslot=0x131B9, + variants=variants_90, }, [0x131BA]={ category="lo", @@ -187926,6 +188714,7 @@ characters.data={ direction="l", linebreak="al", unicodeslot=0x131BA, + variants=variants_270, }, [0x131BB]={ category="lo", @@ -188045,6 +188834,7 @@ characters.data={ direction="l", linebreak="al", unicodeslot=0x131CB, + variants=variants_90, }, [0x131CC]={ category="lo", @@ -188290,6 +189080,7 @@ characters.data={ direction="l", linebreak="al", unicodeslot=0x131EE, + variants=variants_180_270, }, [0x131EF]={ category="lo", @@ -188360,6 +189151,7 @@ characters.data={ direction="l", linebreak="al", unicodeslot=0x131F8, + variants=variants_180, }, [0x131F9]={ category="lo", @@ -188367,6 +189159,7 @@ characters.data={ direction="l", linebreak="al", unicodeslot=0x131F9, + variants=variants_90_180, }, [0x131FA]={ category="lo", @@ -188374,6 +189167,7 @@ characters.data={ direction="l", linebreak="al", unicodeslot=0x131FA, + variants=variants_90_180, }, [0x131FB]={ category="lo", @@ -188570,6 +189364,7 @@ characters.data={ direction="l", linebreak="al", unicodeslot=0x13216, + variants=variants_270, }, [0x13217]={ category="lo", @@ -189025,6 +189820,7 @@ characters.data={ direction="l", linebreak="al", unicodeslot=0x13257, + variants=variants_180, }, [0x13258]={ category="lo", @@ -189277,6 +190073,7 @@ characters.data={ direction="l", linebreak="al", unicodeslot=0x1327B, + variants=variants_270, }, [0x1327C]={ category="lo", @@ -189305,6 +190102,7 @@ characters.data={ direction="l", linebreak="al", unicodeslot=0x1327F, + variants=variants_90_180, }, [0x13280]={ category="lo", @@ -189347,6 +190145,7 @@ characters.data={ direction="l", linebreak="al", unicodeslot=0x13285, + variants=variants_90, }, [0x13286]={ category="lo", @@ -189396,6 +190195,7 @@ characters.data={ direction="l", linebreak="al", unicodeslot=0x1328C, + variants=variants_90, }, [0x1328D]={ category="lo", @@ -189564,6 +190364,7 @@ characters.data={ direction="l", linebreak="al", unicodeslot=0x132A4, + variants=variants_180_270, }, [0x132A5]={ category="lo", @@ -189606,6 +190407,7 @@ characters.data={ direction="l", linebreak="al", unicodeslot=0x132AA, + variants=variants_90, }, [0x132AB]={ category="lo", @@ -189837,6 +190639,7 @@ characters.data={ direction="l", linebreak="al", unicodeslot=0x132CB, + variants=variants_90, }, [0x132CC]={ category="lo", @@ -189956,6 +190759,7 @@ characters.data={ direction="l", linebreak="al", unicodeslot=0x132DC, + variants=variants_90, }, [0x132DD]={ category="lo", @@ -190033,6 +190837,7 @@ characters.data={ direction="l", linebreak="al", unicodeslot=0x132E7, + variants=variants_90_270, }, [0x132E8]={ category="lo", @@ -190047,6 +190852,7 @@ characters.data={ direction="l", linebreak="al", unicodeslot=0x132E9, + variants=variants_270, }, [0x132EA]={ category="lo", @@ -190152,6 +190958,7 @@ characters.data={ direction="l", linebreak="al", unicodeslot=0x132F8, + variants=variants_270, }, [0x132F9]={ category="lo", @@ -190187,6 +190994,7 @@ characters.data={ direction="l", linebreak="al", unicodeslot=0x132FD, + variants=variants_270, }, [0x132FE]={ category="lo", @@ -190222,6 +191030,7 @@ characters.data={ direction="l", linebreak="al", unicodeslot=0x13302, + variants=variants_270, }, [0x13303]={ category="lo", @@ -190229,6 +191038,7 @@ characters.data={ direction="l", linebreak="al", unicodeslot=0x13303, + variants=variants_270, }, [0x13304]={ category="lo", @@ -190257,6 +191067,7 @@ characters.data={ direction="l", linebreak="al", unicodeslot=0x13307, + variants=variants_90, }, [0x13308]={ category="lo", @@ -190264,6 +191075,7 @@ characters.data={ direction="l", linebreak="al", unicodeslot=0x13308, + variants=variants_180, }, [0x13309]={ category="lo", @@ -190320,6 +191132,7 @@ characters.data={ direction="l", linebreak="al", unicodeslot=0x13310, + variants=variants_270, }, [0x13311]={ category="lo", @@ -190327,6 +191140,7 @@ characters.data={ direction="l", linebreak="al", unicodeslot=0x13311, + variants=variants_270, }, [0x13312]={ category="lo", @@ -190334,6 +191148,7 @@ characters.data={ direction="l", linebreak="al", unicodeslot=0x13312, + variants=variants_180_270, }, [0x13313]={ category="lo", @@ -190341,6 +191156,7 @@ characters.data={ direction="l", linebreak="al", unicodeslot=0x13313, + variants=variants_180_270, }, [0x13314]={ category="lo", @@ -190348,6 +191164,7 @@ characters.data={ direction="l", linebreak="al", unicodeslot=0x13314, + variants=variants_180_270, }, [0x13315]={ category="lo", @@ -190397,6 +191214,7 @@ characters.data={ direction="l", linebreak="al", unicodeslot=0x1331B, + variants=variants_90_180, }, [0x1331C]={ category="lo", @@ -190404,6 +191222,7 @@ characters.data={ direction="l", linebreak="al", unicodeslot=0x1331C, + variants=variants_270, }, [0x1331D]={ category="lo", @@ -190439,6 +191258,7 @@ characters.data={ direction="l", linebreak="al", unicodeslot=0x13321, + variants=variants_180_270, }, [0x13322]={ category="lo", @@ -190446,6 +191266,7 @@ characters.data={ direction="l", linebreak="al", unicodeslot=0x13322, + variants=variants_90_180, }, [0x13323]={ category="lo", @@ -190551,6 +191372,7 @@ characters.data={ direction="l", linebreak="al", unicodeslot=0x13331, + variants=variants_180_270, }, [0x13332]={ category="lo", @@ -190621,6 +191443,7 @@ characters.data={ direction="l", linebreak="al", unicodeslot=0x1333B, + variants=variants_90, }, [0x1333C]={ category="lo", @@ -190628,6 +191451,7 @@ characters.data={ direction="l", linebreak="al", unicodeslot=0x1333C, + variants=variants_90, }, [0x1333D]={ category="lo", @@ -190726,6 +191550,7 @@ characters.data={ direction="l", linebreak="al", unicodeslot=0x1334A, + variants=variants_270, }, [0x1334B]={ category="lo", @@ -190887,6 +191712,7 @@ characters.data={ direction="l", linebreak="al", unicodeslot=0x13361, + variants=variants_270, }, [0x13362]={ category="lo", @@ -191013,6 +191839,7 @@ characters.data={ direction="l", linebreak="al", unicodeslot=0x13373, + variants=variants_270, }, [0x13374]={ category="lo", @@ -191041,6 +191868,7 @@ characters.data={ direction="l", linebreak="al", unicodeslot=0x13377, + variants=variants_90, }, [0x13378]={ category="lo", @@ -191048,6 +191876,7 @@ characters.data={ direction="l", linebreak="al", unicodeslot=0x13378, + variants=variants_90, }, [0x13379]={ category="lo", @@ -191083,6 +191912,7 @@ characters.data={ direction="l", linebreak="al", unicodeslot=0x1337D, + variants=variants_270, }, [0x1337E]={ category="lo", @@ -191139,6 +191969,7 @@ characters.data={ direction="l", linebreak="al", unicodeslot=0x13385, + variants=variants_270, }, [0x13386]={ category="lo", @@ -191279,6 +192110,7 @@ characters.data={ direction="l", linebreak="al", unicodeslot=0x13399, + variants=variants_90, }, [0x1339A]={ category="lo", @@ -191286,6 +192118,7 @@ characters.data={ direction="l", linebreak="al", unicodeslot=0x1339A, + variants=variants_90, }, [0x1339B]={ category="lo", @@ -191433,6 +192266,7 @@ characters.data={ direction="l", linebreak="al", unicodeslot=0x133AF, + variants=variants_270, }, [0x133B0]={ category="lo", @@ -191440,6 +192274,7 @@ characters.data={ direction="l", linebreak="al", unicodeslot=0x133B0, + variants=variants_270, }, [0x133B1]={ category="lo", @@ -191545,6 +192380,7 @@ characters.data={ direction="l", linebreak="al", unicodeslot=0x133BF, + variants=variants_270, }, [0x133C0]={ category="lo", @@ -191685,6 +192521,7 @@ characters.data={ direction="l", linebreak="al", unicodeslot=0x133D3, + variants=variants_90, }, [0x133D4]={ category="lo", @@ -191755,6 +192592,7 @@ characters.data={ direction="l", linebreak="al", unicodeslot=0x133DD, + variants=variants_270, }, [0x133DE]={ category="lo", @@ -191902,6 +192740,7 @@ characters.data={ direction="l", linebreak="al", unicodeslot=0x133F2, + variants=variants_90, }, [0x133F3]={ category="lo", @@ -191923,6 +192762,7 @@ characters.data={ direction="l", linebreak="al", unicodeslot=0x133F5, + variants=variants_90, }, [0x133F6]={ category="lo", @@ -191930,6 +192770,7 @@ characters.data={ direction="l", linebreak="al", unicodeslot=0x133F6, + variants=variants_90, }, [0x133F7]={ category="lo", @@ -192021,6 +192862,7 @@ characters.data={ direction="l", linebreak="al", unicodeslot=0x13403, + variants=variants_90, }, [0x13404]={ category="lo", @@ -192154,6 +192996,7 @@ characters.data={ direction="l", linebreak="al", unicodeslot=0x13416, + variants=variants_90, }, [0x13417]={ category="lo", @@ -192175,6 +193018,7 @@ characters.data={ direction="l", linebreak="al", unicodeslot=0x13419, + variants=variants_90_180_270, }, [0x1341A]={ category="lo", @@ -192182,6 +193026,7 @@ characters.data={ direction="l", linebreak="al", unicodeslot=0x1341A, + variants=variants_90, }, [0x1341B]={ category="lo", @@ -192245,6 +193090,7 @@ characters.data={ direction="l", linebreak="al", unicodeslot=0x13423, + variants=variants_90, }, [0x13424]={ category="lo", @@ -192308,6 +193154,7 @@ characters.data={ direction="l", linebreak="al", unicodeslot=0x1342C, + variants=variants_270, }, [0x1342D]={ category="lo", @@ -192322,6 +193169,14 @@ characters.data={ direction="l", linebreak="al", unicodeslot=0x1342E, + variants=variants_270, + }, + [0x1342F]={ + category="lo", + description="EGYPTIAN HIEROGLYPH V011D", + direction="l", + linebreak="al", + unicodeslot=0x1342F, }, [0x13430]={ category="cf", @@ -192386,6 +193241,213 @@ characters.data={ linebreak="cl", unicodeslot=0x13438, }, + [0x13439]={ + category="cf", + description="EGYPTIAN HIEROGLYPH INSERT AT MIDDLE", + direction="l", + linebreak="gl", + unicodeslot=0x13439, + }, + [0x1343A]={ + category="cf", + description="EGYPTIAN HIEROGLYPH INSERT AT TOP", + direction="l", + linebreak="gl", + unicodeslot=0x1343A, + }, + [0x1343B]={ + category="cf", + description="EGYPTIAN HIEROGLYPH INSERT AT BOTTOM", + direction="l", + linebreak="gl", + unicodeslot=0x1343B, + }, + [0x1343C]={ + category="cf", + description="EGYPTIAN HIEROGLYPH BEGIN ENCLOSURE", + direction="l", + linebreak="op", + unicodeslot=0x1343C, + }, + [0x1343D]={ + category="cf", + description="EGYPTIAN HIEROGLYPH END ENCLOSURE", + direction="l", + linebreak="cl", + unicodeslot=0x1343D, + }, + [0x1343E]={ + category="cf", + description="EGYPTIAN HIEROGLYPH BEGIN WALLED ENCLOSURE", + direction="l", + linebreak="op", + unicodeslot=0x1343E, + }, + [0x1343F]={ + category="cf", + description="EGYPTIAN HIEROGLYPH END WALLED ENCLOSURE", + direction="l", + linebreak="cl", + unicodeslot=0x1343F, + }, + [0x13440]={ + category="mn", + description="EGYPTIAN HIEROGLYPH MIRROR HORIZONTALLY", + direction="nsm", + linebreak="cm", + unicodeslot=0x13440, + }, + [0x13441]={ + category="lo", + description="EGYPTIAN HIEROGLYPH FULL BLANK", + direction="l", + linebreak="al", + unicodeslot=0x13441, + }, + [0x13442]={ + category="lo", + description="EGYPTIAN HIEROGLYPH HALF BLANK", + direction="l", + linebreak="al", + unicodeslot=0x13442, + }, + [0x13443]={ + category="lo", + description="EGYPTIAN HIEROGLYPH LOST SIGN", + direction="l", + linebreak="al", + unicodeslot=0x13443, + variants=variants_expanded, + }, + [0x13444]={ + category="lo", + description="EGYPTIAN HIEROGLYPH HALF LOST SIGN", + direction="l", + linebreak="al", + unicodeslot=0x13444, + variants=variants_expanded, + }, + [0x13445]={ + category="lo", + description="EGYPTIAN HIEROGLYPH TALL LOST SIGN", + direction="l", + linebreak="al", + unicodeslot=0x13445, + variants=variants_expanded, + }, + [0x13446]={ + category="lo", + description="EGYPTIAN HIEROGLYPH WIDE LOST SIGN", + direction="l", + linebreak="al", + unicodeslot=0x13446, + variants=variants_expanded, + }, + [0x13447]={ + category="mn", + description="EGYPTIAN HIEROGLYPH MODIFIER DAMAGED AT TOP START", + direction="nsm", + linebreak="cm", + unicodeslot=0x13447, + }, + [0x13448]={ + category="mn", + description="EGYPTIAN HIEROGLYPH MODIFIER DAMAGED AT BOTTOM START", + direction="nsm", + linebreak="cm", + unicodeslot=0x13448, + }, + [0x13449]={ + category="mn", + description="EGYPTIAN HIEROGLYPH MODIFIER DAMAGED AT START", + direction="nsm", + linebreak="cm", + unicodeslot=0x13449, + }, + [0x1344A]={ + category="mn", + description="EGYPTIAN HIEROGLYPH MODIFIER DAMAGED AT TOP END", + direction="nsm", + linebreak="cm", + unicodeslot=0x1344A, + }, + [0x1344B]={ + category="mn", + description="EGYPTIAN HIEROGLYPH MODIFIER DAMAGED AT TOP", + direction="nsm", + linebreak="cm", + unicodeslot=0x1344B, + }, + [0x1344C]={ + category="mn", + description="EGYPTIAN HIEROGLYPH MODIFIER DAMAGED AT BOTTOM START AND TOP END", + direction="nsm", + linebreak="cm", + unicodeslot=0x1344C, + }, + [0x1344D]={ + category="mn", + description="EGYPTIAN HIEROGLYPH MODIFIER DAMAGED AT START AND TOP", + direction="nsm", + linebreak="cm", + unicodeslot=0x1344D, + }, + [0x1344E]={ + category="mn", + description="EGYPTIAN HIEROGLYPH MODIFIER DAMAGED AT BOTTOM END", + direction="nsm", + linebreak="cm", + unicodeslot=0x1344E, + }, + [0x1344F]={ + category="mn", + description="EGYPTIAN HIEROGLYPH MODIFIER DAMAGED AT TOP START AND BOTTOM END", + direction="nsm", + linebreak="cm", + unicodeslot=0x1344F, + }, + [0x13450]={ + category="mn", + description="EGYPTIAN HIEROGLYPH MODIFIER DAMAGED AT BOTTOM", + direction="nsm", + linebreak="cm", + unicodeslot=0x13450, + }, + [0x13451]={ + category="mn", + description="EGYPTIAN HIEROGLYPH MODIFIER DAMAGED AT START AND BOTTOM", + direction="nsm", + linebreak="cm", + unicodeslot=0x13451, + }, + [0x13452]={ + category="mn", + description="EGYPTIAN HIEROGLYPH MODIFIER DAMAGED AT END", + direction="nsm", + linebreak="cm", + unicodeslot=0x13452, + }, + [0x13453]={ + category="mn", + description="EGYPTIAN HIEROGLYPH MODIFIER DAMAGED AT TOP AND END", + direction="nsm", + linebreak="cm", + unicodeslot=0x13453, + }, + [0x13454]={ + category="mn", + description="EGYPTIAN HIEROGLYPH MODIFIER DAMAGED AT BOTTOM AND END", + direction="nsm", + linebreak="cm", + unicodeslot=0x13454, + }, + [0x13455]={ + category="mn", + description="EGYPTIAN HIEROGLYPH MODIFIER DAMAGED", + direction="nsm", + linebreak="cm", + unicodeslot=0x13455, + }, [0x14400]={ category="lo", description="ANATOLIAN HIEROGLYPH A001", @@ -216633,6 +217695,14 @@ characters.data={ linebreak="id", unicodeslot=0x1B122, }, + [0x1B132]={ + category="lo", + cjkwd="w", + description="HIRAGANA LETTER SMALL KO", + direction="l", + linebreak="cj", + unicodeslot=0x1B132, + }, [0x1B150]={ category="lo", cjkwd="w", @@ -216657,6 +217727,14 @@ characters.data={ linebreak="cj", unicodeslot=0x1B152, }, + [0x1B155]={ + category="lo", + cjkwd="w", + description="KATAKANA LETTER SMALL KO", + direction="l", + linebreak="cj", + unicodeslot=0x1B155, + }, [0x1B164]={ category="lo", cjkwd="w", @@ -226073,6 +227151,146 @@ characters.data={ linebreak="al", unicodeslot=0x1D245, }, + [0x1D2C0]={ + category="no", + description="KAKTOVIK NUMERAL ZERO", + direction="l", + linebreak="al", + unicodeslot=0x1D2C0, + }, + [0x1D2C1]={ + category="no", + description="KAKTOVIK NUMERAL ONE", + direction="l", + linebreak="al", + unicodeslot=0x1D2C1, + }, + [0x1D2C2]={ + category="no", + description="KAKTOVIK NUMERAL TWO", + direction="l", + linebreak="al", + unicodeslot=0x1D2C2, + }, + [0x1D2C3]={ + category="no", + description="KAKTOVIK NUMERAL THREE", + direction="l", + linebreak="al", + unicodeslot=0x1D2C3, + }, + [0x1D2C4]={ + category="no", + description="KAKTOVIK NUMERAL FOUR", + direction="l", + linebreak="al", + unicodeslot=0x1D2C4, + }, + [0x1D2C5]={ + category="no", + description="KAKTOVIK NUMERAL FIVE", + direction="l", + linebreak="al", + unicodeslot=0x1D2C5, + }, + [0x1D2C6]={ + category="no", + description="KAKTOVIK NUMERAL SIX", + direction="l", + linebreak="al", + unicodeslot=0x1D2C6, + }, + [0x1D2C7]={ + category="no", + description="KAKTOVIK NUMERAL SEVEN", + direction="l", + linebreak="al", + unicodeslot=0x1D2C7, + }, + [0x1D2C8]={ + category="no", + description="KAKTOVIK NUMERAL EIGHT", + direction="l", + linebreak="al", + unicodeslot=0x1D2C8, + }, + [0x1D2C9]={ + category="no", + description="KAKTOVIK NUMERAL NINE", + direction="l", + linebreak="al", + unicodeslot=0x1D2C9, + }, + [0x1D2CA]={ + category="no", + description="KAKTOVIK NUMERAL TEN", + direction="l", + linebreak="al", + unicodeslot=0x1D2CA, + }, + [0x1D2CB]={ + category="no", + description="KAKTOVIK NUMERAL ELEVEN", + direction="l", + linebreak="al", + unicodeslot=0x1D2CB, + }, + [0x1D2CC]={ + category="no", + description="KAKTOVIK NUMERAL TWELVE", + direction="l", + linebreak="al", + unicodeslot=0x1D2CC, + }, + [0x1D2CD]={ + category="no", + description="KAKTOVIK NUMERAL THIRTEEN", + direction="l", + linebreak="al", + unicodeslot=0x1D2CD, + }, + [0x1D2CE]={ + category="no", + description="KAKTOVIK NUMERAL FOURTEEN", + direction="l", + linebreak="al", + unicodeslot=0x1D2CE, + }, + [0x1D2CF]={ + category="no", + description="KAKTOVIK NUMERAL FIFTEEN", + direction="l", + linebreak="al", + unicodeslot=0x1D2CF, + }, + [0x1D2D0]={ + category="no", + description="KAKTOVIK NUMERAL SIXTEEN", + direction="l", + linebreak="al", + unicodeslot=0x1D2D0, + }, + [0x1D2D1]={ + category="no", + description="KAKTOVIK NUMERAL SEVENTEEN", + direction="l", + linebreak="al", + unicodeslot=0x1D2D1, + }, + [0x1D2D2]={ + category="no", + description="KAKTOVIK NUMERAL EIGHTEEN", + direction="l", + linebreak="al", + unicodeslot=0x1D2D2, + }, + [0x1D2D3]={ + category="no", + description="KAKTOVIK NUMERAL NINETEEN", + direction="l", + linebreak="al", + unicodeslot=0x1D2D3, + }, [0x1D2E0]={ category="no", description="MAYAN NUMERAL ZERO", @@ -240727,6 +241945,48 @@ characters.data={ linebreak="al", unicodeslot=0x1DF1E, }, + [0x1DF25]={ + category="ll", + description="LATIN SMALL LETTER D WITH MID-HEIGHT LEFT HOOK", + direction="l", + linebreak="al", + unicodeslot=0x1DF25, + }, + [0x1DF26]={ + category="ll", + description="LATIN SMALL LETTER L WITH MID-HEIGHT LEFT HOOK", + direction="l", + linebreak="al", + unicodeslot=0x1DF26, + }, + [0x1DF27]={ + category="ll", + description="LATIN SMALL LETTER N WITH MID-HEIGHT LEFT HOOK", + direction="l", + linebreak="al", + unicodeslot=0x1DF27, + }, + [0x1DF28]={ + category="ll", + description="LATIN SMALL LETTER R WITH MID-HEIGHT LEFT HOOK", + direction="l", + linebreak="al", + unicodeslot=0x1DF28, + }, + [0x1DF29]={ + category="ll", + description="LATIN SMALL LETTER S WITH MID-HEIGHT LEFT HOOK", + direction="l", + linebreak="al", + unicodeslot=0x1DF29, + }, + [0x1DF2A]={ + category="ll", + description="LATIN SMALL LETTER T WITH MID-HEIGHT LEFT HOOK", + direction="l", + linebreak="al", + unicodeslot=0x1DF2A, + }, [0x1E000]={ category="mn", combining=0xE6, @@ -241031,6 +242291,510 @@ characters.data={ linebreak="cm", unicodeslot=0x1E02A, }, + [0x1E030]={ + category="lm", + description="MODIFIER LETTER CYRILLIC SMALL A", + direction="l", + linebreak="al", + specials={ "super", 0x430 }, + unicodeslot=0x1E030, + }, + [0x1E031]={ + category="lm", + description="MODIFIER LETTER CYRILLIC SMALL BE", + direction="l", + linebreak="al", + specials={ "super", 0x431 }, + unicodeslot=0x1E031, + }, + [0x1E032]={ + category="lm", + description="MODIFIER LETTER CYRILLIC SMALL VE", + direction="l", + linebreak="al", + specials={ "super", 0x432 }, + unicodeslot=0x1E032, + }, + [0x1E033]={ + category="lm", + description="MODIFIER LETTER CYRILLIC SMALL GHE", + direction="l", + linebreak="al", + specials={ "super", 0x433 }, + unicodeslot=0x1E033, + }, + [0x1E034]={ + category="lm", + description="MODIFIER LETTER CYRILLIC SMALL DE", + direction="l", + linebreak="al", + specials={ "super", 0x434 }, + unicodeslot=0x1E034, + }, + [0x1E035]={ + category="lm", + description="MODIFIER LETTER CYRILLIC SMALL IE", + direction="l", + linebreak="al", + specials={ "super", 0x435 }, + unicodeslot=0x1E035, + }, + [0x1E036]={ + category="lm", + description="MODIFIER LETTER CYRILLIC SMALL ZHE", + direction="l", + linebreak="al", + specials={ "super", 0x436 }, + unicodeslot=0x1E036, + }, + [0x1E037]={ + category="lm", + description="MODIFIER LETTER CYRILLIC SMALL ZE", + direction="l", + linebreak="al", + specials={ "super", 0x437 }, + unicodeslot=0x1E037, + }, + [0x1E038]={ + category="lm", + description="MODIFIER LETTER CYRILLIC SMALL I", + direction="l", + linebreak="al", + specials={ "super", 0x438 }, + unicodeslot=0x1E038, + }, + [0x1E039]={ + category="lm", + description="MODIFIER LETTER CYRILLIC SMALL KA", + direction="l", + linebreak="al", + specials={ "super", 0x43A }, + unicodeslot=0x1E039, + }, + [0x1E03A]={ + category="lm", + description="MODIFIER LETTER CYRILLIC SMALL EL", + direction="l", + linebreak="al", + specials={ "super", 0x43B }, + unicodeslot=0x1E03A, + }, + [0x1E03B]={ + category="lm", + description="MODIFIER LETTER CYRILLIC SMALL EM", + direction="l", + linebreak="al", + specials={ "super", 0x43C }, + unicodeslot=0x1E03B, + }, + [0x1E03C]={ + category="lm", + description="MODIFIER LETTER CYRILLIC SMALL O", + direction="l", + linebreak="al", + specials={ "super", 0x43E }, + unicodeslot=0x1E03C, + }, + [0x1E03D]={ + category="lm", + description="MODIFIER LETTER CYRILLIC SMALL PE", + direction="l", + linebreak="al", + specials={ "super", 0x43F }, + unicodeslot=0x1E03D, + }, + [0x1E03E]={ + category="lm", + description="MODIFIER LETTER CYRILLIC SMALL ER", + direction="l", + linebreak="al", + specials={ "super", 0x440 }, + unicodeslot=0x1E03E, + }, + [0x1E03F]={ + category="lm", + description="MODIFIER LETTER CYRILLIC SMALL ES", + direction="l", + linebreak="al", + specials={ "super", 0x441 }, + unicodeslot=0x1E03F, + }, + [0x1E040]={ + category="lm", + description="MODIFIER LETTER CYRILLIC SMALL TE", + direction="l", + linebreak="al", + specials={ "super", 0x442 }, + unicodeslot=0x1E040, + }, + [0x1E041]={ + category="lm", + description="MODIFIER LETTER CYRILLIC SMALL U", + direction="l", + linebreak="al", + specials={ "super", 0x443 }, + unicodeslot=0x1E041, + }, + [0x1E042]={ + category="lm", + description="MODIFIER LETTER CYRILLIC SMALL EF", + direction="l", + linebreak="al", + specials={ "super", 0x444 }, + unicodeslot=0x1E042, + }, + [0x1E043]={ + category="lm", + description="MODIFIER LETTER CYRILLIC SMALL HA", + direction="l", + linebreak="al", + specials={ "super", 0x445 }, + unicodeslot=0x1E043, + }, + [0x1E044]={ + category="lm", + description="MODIFIER LETTER CYRILLIC SMALL TSE", + direction="l", + linebreak="al", + specials={ "super", 0x446 }, + unicodeslot=0x1E044, + }, + [0x1E045]={ + category="lm", + description="MODIFIER LETTER CYRILLIC SMALL CHE", + direction="l", + linebreak="al", + specials={ "super", 0x447 }, + unicodeslot=0x1E045, + }, + [0x1E046]={ + category="lm", + description="MODIFIER LETTER CYRILLIC SMALL SHA", + direction="l", + linebreak="al", + specials={ "super", 0x448 }, + unicodeslot=0x1E046, + }, + [0x1E047]={ + category="lm", + description="MODIFIER LETTER CYRILLIC SMALL YERU", + direction="l", + linebreak="al", + specials={ "super", 0x44B }, + unicodeslot=0x1E047, + }, + [0x1E048]={ + category="lm", + description="MODIFIER LETTER CYRILLIC SMALL E", + direction="l", + linebreak="al", + specials={ "super", 0x44D }, + unicodeslot=0x1E048, + }, + [0x1E049]={ + category="lm", + description="MODIFIER LETTER CYRILLIC SMALL YU", + direction="l", + linebreak="al", + specials={ "super", 0x44E }, + unicodeslot=0x1E049, + }, + [0x1E04A]={ + category="lm", + description="MODIFIER LETTER CYRILLIC SMALL DZZE", + direction="l", + linebreak="al", + specials={ "super", 0xA689 }, + unicodeslot=0x1E04A, + }, + [0x1E04B]={ + category="lm", + description="MODIFIER LETTER CYRILLIC SMALL SCHWA", + direction="l", + linebreak="al", + specials={ "super", 0x4D9 }, + unicodeslot=0x1E04B, + }, + [0x1E04C]={ + category="lm", + description="MODIFIER LETTER CYRILLIC SMALL BYELORUSSIAN-UKRAINIAN I", + direction="l", + linebreak="al", + specials={ "super", 0x456 }, + unicodeslot=0x1E04C, + }, + [0x1E04D]={ + category="lm", + description="MODIFIER LETTER CYRILLIC SMALL JE", + direction="l", + linebreak="al", + specials={ "super", 0x458 }, + unicodeslot=0x1E04D, + }, + [0x1E04E]={ + category="lm", + description="MODIFIER LETTER CYRILLIC SMALL BARRED O", + direction="l", + linebreak="al", + specials={ "super", 0x4E9 }, + unicodeslot=0x1E04E, + }, + [0x1E04F]={ + category="lm", + description="MODIFIER LETTER CYRILLIC SMALL STRAIGHT U", + direction="l", + linebreak="al", + specials={ "super", 0x4AF }, + unicodeslot=0x1E04F, + }, + [0x1E050]={ + category="lm", + description="MODIFIER LETTER CYRILLIC SMALL PALOCHKA", + direction="l", + linebreak="al", + specials={ "super", 0x4CF }, + unicodeslot=0x1E050, + }, + [0x1E051]={ + category="lm", + description="CYRILLIC SUBSCRIPT SMALL LETTER A", + direction="l", + linebreak="al", + specials={ "sub", 0x430 }, + unicodeslot=0x1E051, + }, + [0x1E052]={ + category="lm", + description="CYRILLIC SUBSCRIPT SMALL LETTER BE", + direction="l", + linebreak="al", + specials={ "sub", 0x431 }, + unicodeslot=0x1E052, + }, + [0x1E053]={ + category="lm", + description="CYRILLIC SUBSCRIPT SMALL LETTER VE", + direction="l", + linebreak="al", + specials={ "sub", 0x432 }, + unicodeslot=0x1E053, + }, + [0x1E054]={ + category="lm", + description="CYRILLIC SUBSCRIPT SMALL LETTER GHE", + direction="l", + linebreak="al", + specials={ "sub", 0x433 }, + unicodeslot=0x1E054, + }, + [0x1E055]={ + category="lm", + description="CYRILLIC SUBSCRIPT SMALL LETTER DE", + direction="l", + linebreak="al", + specials={ "sub", 0x434 }, + unicodeslot=0x1E055, + }, + [0x1E056]={ + category="lm", + description="CYRILLIC SUBSCRIPT SMALL LETTER IE", + direction="l", + linebreak="al", + specials={ "sub", 0x435 }, + unicodeslot=0x1E056, + }, + [0x1E057]={ + category="lm", + description="CYRILLIC SUBSCRIPT SMALL LETTER ZHE", + direction="l", + linebreak="al", + specials={ "sub", 0x436 }, + unicodeslot=0x1E057, + }, + [0x1E058]={ + category="lm", + description="CYRILLIC SUBSCRIPT SMALL LETTER ZE", + direction="l", + linebreak="al", + specials={ "sub", 0x437 }, + unicodeslot=0x1E058, + }, + [0x1E059]={ + category="lm", + description="CYRILLIC SUBSCRIPT SMALL LETTER I", + direction="l", + linebreak="al", + specials={ "sub", 0x438 }, + unicodeslot=0x1E059, + }, + [0x1E05A]={ + category="lm", + description="CYRILLIC SUBSCRIPT SMALL LETTER KA", + direction="l", + linebreak="al", + specials={ "sub", 0x43A }, + unicodeslot=0x1E05A, + }, + [0x1E05B]={ + category="lm", + description="CYRILLIC SUBSCRIPT SMALL LETTER EL", + direction="l", + linebreak="al", + specials={ "sub", 0x43B }, + unicodeslot=0x1E05B, + }, + [0x1E05C]={ + category="lm", + description="CYRILLIC SUBSCRIPT SMALL LETTER O", + direction="l", + linebreak="al", + specials={ "sub", 0x43E }, + unicodeslot=0x1E05C, + }, + [0x1E05D]={ + category="lm", + description="CYRILLIC SUBSCRIPT SMALL LETTER PE", + direction="l", + linebreak="al", + specials={ "sub", 0x43F }, + unicodeslot=0x1E05D, + }, + [0x1E05E]={ + category="lm", + description="CYRILLIC SUBSCRIPT SMALL LETTER ES", + direction="l", + linebreak="al", + specials={ "sub", 0x441 }, + unicodeslot=0x1E05E, + }, + [0x1E05F]={ + category="lm", + description="CYRILLIC SUBSCRIPT SMALL LETTER U", + direction="l", + linebreak="al", + specials={ "sub", 0x443 }, + unicodeslot=0x1E05F, + }, + [0x1E060]={ + category="lm", + description="CYRILLIC SUBSCRIPT SMALL LETTER EF", + direction="l", + linebreak="al", + specials={ "sub", 0x444 }, + unicodeslot=0x1E060, + }, + [0x1E061]={ + category="lm", + description="CYRILLIC SUBSCRIPT SMALL LETTER HA", + direction="l", + linebreak="al", + specials={ "sub", 0x445 }, + unicodeslot=0x1E061, + }, + [0x1E062]={ + category="lm", + description="CYRILLIC SUBSCRIPT SMALL LETTER TSE", + direction="l", + linebreak="al", + specials={ "sub", 0x446 }, + unicodeslot=0x1E062, + }, + [0x1E063]={ + category="lm", + description="CYRILLIC SUBSCRIPT SMALL LETTER CHE", + direction="l", + linebreak="al", + specials={ "sub", 0x447 }, + unicodeslot=0x1E063, + }, + [0x1E064]={ + category="lm", + description="CYRILLIC SUBSCRIPT SMALL LETTER SHA", + direction="l", + linebreak="al", + specials={ "sub", 0x448 }, + unicodeslot=0x1E064, + }, + [0x1E065]={ + category="lm", + description="CYRILLIC SUBSCRIPT SMALL LETTER HARD SIGN", + direction="l", + linebreak="al", + specials={ "sub", 0x44A }, + unicodeslot=0x1E065, + }, + [0x1E066]={ + category="lm", + description="CYRILLIC SUBSCRIPT SMALL LETTER YERU", + direction="l", + linebreak="al", + specials={ "sub", 0x44B }, + unicodeslot=0x1E066, + }, + [0x1E067]={ + category="lm", + description="CYRILLIC SUBSCRIPT SMALL LETTER GHE WITH UPTURN", + direction="l", + linebreak="al", + specials={ "sub", 0x491 }, + unicodeslot=0x1E067, + }, + [0x1E068]={ + category="lm", + description="CYRILLIC SUBSCRIPT SMALL LETTER BYELORUSSIAN-UKRAINIAN I", + direction="l", + linebreak="al", + specials={ "sub", 0x456 }, + unicodeslot=0x1E068, + }, + [0x1E069]={ + category="lm", + description="CYRILLIC SUBSCRIPT SMALL LETTER DZE", + direction="l", + linebreak="al", + specials={ "sub", 0x455 }, + unicodeslot=0x1E069, + }, + [0x1E06A]={ + category="lm", + description="CYRILLIC SUBSCRIPT SMALL LETTER DZHE", + direction="l", + linebreak="al", + specials={ "sub", 0x45F }, + unicodeslot=0x1E06A, + }, + [0x1E06B]={ + category="lm", + description="MODIFIER LETTER CYRILLIC SMALL ES WITH DESCENDER", + direction="l", + linebreak="al", + specials={ "super", 0x4AB }, + unicodeslot=0x1E06B, + }, + [0x1E06C]={ + category="lm", + description="MODIFIER LETTER CYRILLIC SMALL YERU WITH BACK YER", + direction="l", + linebreak="al", + specials={ "super", 0xA651 }, + unicodeslot=0x1E06C, + }, + [0x1E06D]={ + category="lm", + description="MODIFIER LETTER CYRILLIC SMALL STRAIGHT U WITH STROKE", + direction="l", + linebreak="al", + specials={ "super", 0x4B1 }, + unicodeslot=0x1E06D, + }, + [0x1E08F]={ + category="mn", + combining=0xE6, + description="COMBINING CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I", + direction="nsm", + linebreak="cm", + unicodeslot=0x1E08F, + }, [0x1E100]={ category="lo", description="NYIAKENG PUACHUE HMONG LETTER MA", @@ -242170,6 +243934,304 @@ characters.data={ linebreak="pr", unicodeslot=0x1E2FF, }, + [0x1E4D0]={ + category="lo", + description="NAG MUNDARI LETTER O", + direction="l", + linebreak="al", + unicodeslot=0x1E4D0, + }, + [0x1E4D1]={ + category="lo", + description="NAG MUNDARI LETTER OP", + direction="l", + linebreak="al", + unicodeslot=0x1E4D1, + }, + [0x1E4D2]={ + category="lo", + description="NAG MUNDARI LETTER OL", + direction="l", + linebreak="al", + unicodeslot=0x1E4D2, + }, + [0x1E4D3]={ + category="lo", + description="NAG MUNDARI LETTER OY", + direction="l", + linebreak="al", + unicodeslot=0x1E4D3, + }, + [0x1E4D4]={ + category="lo", + description="NAG MUNDARI LETTER ONG", + direction="l", + linebreak="al", + unicodeslot=0x1E4D4, + }, + [0x1E4D5]={ + category="lo", + description="NAG MUNDARI LETTER A", + direction="l", + linebreak="al", + unicodeslot=0x1E4D5, + }, + [0x1E4D6]={ + category="lo", + description="NAG MUNDARI LETTER AJ", + direction="l", + linebreak="al", + unicodeslot=0x1E4D6, + }, + [0x1E4D7]={ + category="lo", + description="NAG MUNDARI LETTER AB", + direction="l", + linebreak="al", + unicodeslot=0x1E4D7, + }, + [0x1E4D8]={ + category="lo", + description="NAG MUNDARI LETTER ANY", + direction="l", + linebreak="al", + unicodeslot=0x1E4D8, + }, + [0x1E4D9]={ + category="lo", + description="NAG MUNDARI LETTER AH", + direction="l", + linebreak="al", + unicodeslot=0x1E4D9, + }, + [0x1E4DA]={ + category="lo", + description="NAG MUNDARI LETTER I", + direction="l", + linebreak="al", + unicodeslot=0x1E4DA, + }, + [0x1E4DB]={ + category="lo", + description="NAG MUNDARI LETTER IS", + direction="l", + linebreak="al", + unicodeslot=0x1E4DB, + }, + [0x1E4DC]={ + category="lo", + description="NAG MUNDARI LETTER IDD", + direction="l", + linebreak="al", + unicodeslot=0x1E4DC, + }, + [0x1E4DD]={ + category="lo", + description="NAG MUNDARI LETTER IT", + direction="l", + linebreak="al", + unicodeslot=0x1E4DD, + }, + [0x1E4DE]={ + category="lo", + description="NAG MUNDARI LETTER IH", + direction="l", + linebreak="al", + unicodeslot=0x1E4DE, + }, + [0x1E4DF]={ + category="lo", + description="NAG MUNDARI LETTER U", + direction="l", + linebreak="al", + unicodeslot=0x1E4DF, + }, + [0x1E4E0]={ + category="lo", + description="NAG MUNDARI LETTER UC", + direction="l", + linebreak="al", + unicodeslot=0x1E4E0, + }, + [0x1E4E1]={ + category="lo", + description="NAG MUNDARI LETTER UD", + direction="l", + linebreak="al", + unicodeslot=0x1E4E1, + }, + [0x1E4E2]={ + category="lo", + description="NAG MUNDARI LETTER UK", + direction="l", + linebreak="al", + unicodeslot=0x1E4E2, + }, + [0x1E4E3]={ + category="lo", + description="NAG MUNDARI LETTER UR", + direction="l", + linebreak="al", + unicodeslot=0x1E4E3, + }, + [0x1E4E4]={ + category="lo", + description="NAG MUNDARI LETTER E", + direction="l", + linebreak="al", + unicodeslot=0x1E4E4, + }, + [0x1E4E5]={ + category="lo", + description="NAG MUNDARI LETTER ENN", + direction="l", + linebreak="al", + unicodeslot=0x1E4E5, + }, + [0x1E4E6]={ + category="lo", + description="NAG MUNDARI LETTER EG", + direction="l", + linebreak="al", + unicodeslot=0x1E4E6, + }, + [0x1E4E7]={ + category="lo", + description="NAG MUNDARI LETTER EM", + direction="l", + linebreak="al", + unicodeslot=0x1E4E7, + }, + [0x1E4E8]={ + category="lo", + description="NAG MUNDARI LETTER EN", + direction="l", + linebreak="al", + unicodeslot=0x1E4E8, + }, + [0x1E4E9]={ + category="lo", + description="NAG MUNDARI LETTER ETT", + direction="l", + linebreak="al", + unicodeslot=0x1E4E9, + }, + [0x1E4EA]={ + category="lo", + description="NAG MUNDARI LETTER ELL", + direction="l", + linebreak="al", + unicodeslot=0x1E4EA, + }, + [0x1E4EB]={ + category="lm", + description="NAG MUNDARI SIGN OJOD", + direction="l", + linebreak="al", + unicodeslot=0x1E4EB, + }, + [0x1E4EC]={ + category="mn", + combining=0xE8, + description="NAG MUNDARI SIGN MUHOR", + direction="nsm", + linebreak="cm", + unicodeslot=0x1E4EC, + }, + [0x1E4ED]={ + category="mn", + combining=0xE8, + description="NAG MUNDARI SIGN TOYOR", + direction="nsm", + linebreak="cm", + unicodeslot=0x1E4ED, + }, + [0x1E4EE]={ + category="mn", + combining=0xDC, + description="NAG MUNDARI SIGN IKIR", + direction="nsm", + linebreak="cm", + unicodeslot=0x1E4EE, + }, + [0x1E4EF]={ + category="mn", + combining=0xE6, + description="NAG MUNDARI SIGN SUTUH", + direction="nsm", + linebreak="cm", + unicodeslot=0x1E4EF, + }, + [0x1E4F0]={ + category="nd", + description="NAG MUNDARI DIGIT ZERO", + direction="l", + linebreak="nu", + unicodeslot=0x1E4F0, + }, + [0x1E4F1]={ + category="nd", + description="NAG MUNDARI DIGIT ONE", + direction="l", + linebreak="nu", + unicodeslot=0x1E4F1, + }, + [0x1E4F2]={ + category="nd", + description="NAG MUNDARI DIGIT TWO", + direction="l", + linebreak="nu", + unicodeslot=0x1E4F2, + }, + [0x1E4F3]={ + category="nd", + description="NAG MUNDARI DIGIT THREE", + direction="l", + linebreak="nu", + unicodeslot=0x1E4F3, + }, + [0x1E4F4]={ + category="nd", + description="NAG MUNDARI DIGIT FOUR", + direction="l", + linebreak="nu", + unicodeslot=0x1E4F4, + }, + [0x1E4F5]={ + category="nd", + description="NAG MUNDARI DIGIT FIVE", + direction="l", + linebreak="nu", + unicodeslot=0x1E4F5, + }, + [0x1E4F6]={ + category="nd", + description="NAG MUNDARI DIGIT SIX", + direction="l", + linebreak="nu", + unicodeslot=0x1E4F6, + }, + [0x1E4F7]={ + category="nd", + description="NAG MUNDARI DIGIT SEVEN", + direction="l", + linebreak="nu", + unicodeslot=0x1E4F7, + }, + [0x1E4F8]={ + category="nd", + description="NAG MUNDARI DIGIT EIGHT", + direction="l", + linebreak="nu", + unicodeslot=0x1E4F8, + }, + [0x1E4F9]={ + category="nd", + description="NAG MUNDARI DIGIT NINE", + direction="l", + linebreak="nu", + unicodeslot=0x1E4F9, + }, [0x1E7E0]={ category="lo", description="ETHIOPIC SYLLABLE HHYA", @@ -258294,6 +260356,14 @@ characters.data={ linebreak="id", unicodeslot=0x1F6D7, }, + [0x1F6DC]={ + category="so", + cjkwd="w", + description="WIRELESS", + direction="on", + linebreak="id", + unicodeslot=0x1F6DC, + }, [0x1F6DD]={ category="so", cjkwd="w", @@ -259332,6 +261402,62 @@ characters.data={ linebreak="al", unicodeslot=0x1F773, }, + [0x1F774]={ + category="so", + description="LOT OF FORTUNE", + direction="on", + linebreak="id", + unicodeslot=0x1F774, + }, + [0x1F775]={ + category="so", + description="OCCULTATION", + direction="on", + linebreak="id", + unicodeslot=0x1F775, + }, + [0x1F776]={ + category="so", + description="LUNAR ECLIPSE", + direction="on", + linebreak="id", + unicodeslot=0x1F776, + }, + [0x1F77B]={ + category="so", + description="HAUMEA", + direction="on", + linebreak="id", + unicodeslot=0x1F77B, + }, + [0x1F77C]={ + category="so", + description="MAKEMAKE", + direction="on", + linebreak="id", + unicodeslot=0x1F77C, + }, + [0x1F77D]={ + category="so", + description="GONGGONG", + direction="on", + linebreak="id", + unicodeslot=0x1F77D, + }, + [0x1F77E]={ + category="so", + description="QUAOAR", + direction="on", + linebreak="id", + unicodeslot=0x1F77E, + }, + [0x1F77F]={ + category="so", + description="ORCUS", + direction="on", + linebreak="id", + unicodeslot=0x1F77F, + }, [0x1F780]={ category="so", description="BLACK LEFT-POINTING ISOSCELES RIGHT TRIANGLE", @@ -259956,6 +262082,13 @@ characters.data={ linebreak="id", unicodeslot=0x1F7D8, }, + [0x1F7D9]={ + category="so", + description="NINE POINTED WHITE STAR", + direction="on", + linebreak="id", + unicodeslot=0x1F7D9, + }, [0x1F7E0]={ category="so", cjkwd="w", @@ -263879,6 +266012,30 @@ characters.data={ linebreak="id", unicodeslot=0x1FA74, }, + [0x1FA75]={ + category="so", + cjkwd="w", + description="LIGHT BLUE HEART", + direction="on", + linebreak="id", + unicodeslot=0x1FA75, + }, + [0x1FA76]={ + category="so", + cjkwd="w", + description="GREY HEART", + direction="on", + linebreak="id", + unicodeslot=0x1FA76, + }, + [0x1FA77]={ + category="so", + cjkwd="w", + description="PINK HEART", + direction="on", + linebreak="id", + unicodeslot=0x1FA77, + }, [0x1FA78]={ category="so", cjkwd="w", @@ -263975,6 +266132,22 @@ characters.data={ linebreak="id", unicodeslot=0x1FA86, }, + [0x1FA87]={ + category="so", + cjkwd="w", + description="MARACAS", + direction="on", + linebreak="id", + unicodeslot=0x1FA87, + }, + [0x1FA88]={ + category="so", + cjkwd="w", + description="FLUTE", + direction="on", + linebreak="id", + unicodeslot=0x1FA88, + }, [0x1FA90]={ category="so", cjkwd="w", @@ -264207,6 +266380,30 @@ characters.data={ linebreak="id", unicodeslot=0x1FAAC, }, + [0x1FAAD]={ + category="so", + cjkwd="w", + description="FOLDING HAND FAN", + direction="on", + linebreak="id", + unicodeslot=0x1FAAD, + }, + [0x1FAAE]={ + category="so", + cjkwd="w", + description="HAIR PICK", + direction="on", + linebreak="id", + unicodeslot=0x1FAAE, + }, + [0x1FAAF]={ + category="so", + cjkwd="w", + description="KHANDA", + direction="on", + linebreak="id", + unicodeslot=0x1FAAF, + }, [0x1FAB0]={ category="so", cjkwd="w", @@ -264295,6 +266492,38 @@ characters.data={ linebreak="id", unicodeslot=0x1FABA, }, + [0x1FABB]={ + category="so", + cjkwd="w", + description="HYACINTH", + direction="on", + linebreak="id", + unicodeslot=0x1FABB, + }, + [0x1FABC]={ + category="so", + cjkwd="w", + description="JELLYFISH", + direction="on", + linebreak="id", + unicodeslot=0x1FABC, + }, + [0x1FABD]={ + category="so", + cjkwd="w", + description="WING", + direction="on", + linebreak="id", + unicodeslot=0x1FABD, + }, + [0x1FABF]={ + category="so", + cjkwd="w", + description="GOOSE", + direction="on", + linebreak="id", + unicodeslot=0x1FABF, + }, [0x1FAC0]={ category="so", cjkwd="w", @@ -264343,6 +266572,22 @@ characters.data={ linebreak="eb", unicodeslot=0x1FAC5, }, + [0x1FACE]={ + category="so", + cjkwd="w", + description="MOOSE", + direction="on", + linebreak="id", + unicodeslot=0x1FACE, + }, + [0x1FACF]={ + category="so", + cjkwd="w", + description="DONKEY", + direction="on", + linebreak="id", + unicodeslot=0x1FACF, + }, [0x1FAD0]={ category="so", cjkwd="w", @@ -264423,6 +266668,22 @@ characters.data={ linebreak="id", unicodeslot=0x1FAD9, }, + [0x1FADA]={ + category="so", + cjkwd="w", + description="GINGER ROOT", + direction="on", + linebreak="id", + unicodeslot=0x1FADA, + }, + [0x1FADB]={ + category="so", + cjkwd="w", + description="PEA POD", + direction="on", + linebreak="id", + unicodeslot=0x1FADB, + }, [0x1FAE0]={ category="so", cjkwd="w", @@ -264487,6 +266748,14 @@ characters.data={ linebreak="id", unicodeslot=0x1FAE7, }, + [0x1FAE8]={ + category="so", + cjkwd="w", + description="SHAKING FACE", + direction="on", + linebreak="id", + unicodeslot=0x1FAE8, + }, [0x1FAF0]={ category="so", cjkwd="w", @@ -264543,6 +266812,22 @@ characters.data={ linebreak="eb", unicodeslot=0x1FAF6, }, + [0x1FAF7]={ + category="so", + cjkwd="w", + description="LEFTWARDS PUSHING HAND", + direction="on", + linebreak="eb", + unicodeslot=0x1FAF7, + }, + [0x1FAF8]={ + category="so", + cjkwd="w", + description="RIGHTWARDS PUSHING HAND", + direction="on", + linebreak="eb", + unicodeslot=0x1FAF8, + }, [0x1FB00]={ category="so", description="BLOCK SEXTANT-1", diff --git a/tex/context/base/mkiv/char-ini.lua b/tex/context/base/mkiv/char-ini.lua index 9dcac8033..4deb21401 100644 --- a/tex/context/base/mkiv/char-ini.lua +++ b/tex/context/base/mkiv/char-ini.lua @@ -213,6 +213,7 @@ local blocks = allocate { ["arabic"] = { first = 0x00600, last = 0x006FF, otf="arab", description = "Arabic" }, ["arabicextendeda"] = { first = 0x008A0, last = 0x008FF, description = "Arabic Extended-A" }, ["arabicextendedb"] = { first = 0x00870, last = 0x0089F, description = "Arabic Extended-B" }, + ["arabicextendedc"] = { first = 0x10EC0, last = 0x10EFF, description = "Arabic Extended-C" }, ["arabicmathematicalalphabeticsymbols"] = { first = 0x1EE00, last = 0x1EEFF, description = "Arabic Mathematical Alphabetic Symbols" }, ["arabicpresentationformsa"] = { first = 0x0FB50, last = 0x0FDFF, otf="arab", description = "Arabic Presentation Forms-A" }, ["arabicpresentationformsb"] = { first = 0x0FE70, last = 0x0FEFF, otf="arab", description = "Arabic Presentation Forms-B" }, @@ -260,6 +261,7 @@ local blocks = allocate { ["cjkunifiedideographsextensione"] = { first = 0x2B820, last = 0x2CEAF, description = "CJK Unified Ideographs Extension E" }, ["cjkunifiedideographsextensionf"] = { first = 0x2CEB0, last = 0x2EBEF, description = "CJK Unified Ideographs Extension F" }, ["cjkunifiedideographsextensiong"] = { first = 0x30000, last = 0x3134F, description = "CJK Unified Ideographs Extension G" }, + ["cjkunifiedideographsextensionh"] = { first = 0x31350, last = 0x323AF, description = "CJK Unified Ideographs Extension H" }, ["combiningdiacriticalmarks"] = { first = 0x00300, last = 0x0036F, description = "Combining Diacritical Marks" }, ["combiningdiacriticalmarksextended"] = { first = 0x01AB0, last = 0x01AFF, description = "Combining Diacritical Marks Extended" }, ["combiningdiacriticalmarksforsymbols"] = { first = 0x020D0, last = 0x020FF, description = "Combining Diacritical Marks for Symbols" }, @@ -279,10 +281,12 @@ local blocks = allocate { ["cyrillicextendeda"] = { first = 0x02DE0, last = 0x02DFF, otf="cyrl", description = "Cyrillic Extended-A" }, ["cyrillicextendedb"] = { first = 0x0A640, last = 0x0A69F, otf="cyrl", description = "Cyrillic Extended-B" }, ["cyrillicextendedc"] = { first = 0x01C80, last = 0x01C8F, description = "Cyrillic Extended-C" }, + ["cyrillicextendedd"] = { first = 0x1E030, last = 0x1E08F, description = "Cyrillic Extended-D" }, ["cyrillicsupplement"] = { first = 0x00500, last = 0x0052F, otf="cyrl", description = "Cyrillic Supplement" }, ["deseret"] = { first = 0x10400, last = 0x1044F, otf="dsrt", description = "Deseret" }, ["devanagari"] = { first = 0x00900, last = 0x0097F, otf="deva", description = "Devanagari" }, ["devanagariextended"] = { first = 0x0A8E0, last = 0x0A8FF, description = "Devanagari Extended" }, + ["devanagariextendeda"] = { first = 0x11B00, last = 0x11B5F, description = "Devanagari Extended-A" }, ["digitsarabicindic"] = { first = 0x00660, last = 0x00669, math = true }, -- ["digitsbengali"] = { first = 0x009E6, last = 0x009EF, math = true }, ["digitsbold"] = { first = 0x1D7CE, last = 0x1D7D7, math = true }, @@ -314,7 +318,7 @@ local blocks = allocate { ["dominotiles"] = { first = 0x1F030, last = 0x1F09F, description = "Domino Tiles" }, ["duployan"] = { first = 0x1BC00, last = 0x1BC9F, description = "Duployan" }, ["earlydynasticcuneiform"] = { first = 0x12480, last = 0x1254F, description = "Early Dynastic Cuneiform" }, - ["egyptianhieroglyphformatcontrols"] = { first = 0x13430, last = 0x1343F, description = "Egyptian Hieroglyph Format Controls" }, + ["egyptianhieroglyphformatcontrols"] = { first = 0x13430, last = 0x1345F, description = "Egyptian Hieroglyph Format Controls" }, ["egyptianhieroglyphs"] = { first = 0x13000, last = 0x1342F, description = "Egyptian Hieroglyphs" }, ["elbasan"] = { first = 0x10500, last = 0x1052F, description = "Elbasan" }, ["elymaic"] = { first = 0x10FE0, last = 0x10FFF, description = "Elymaic" }, @@ -365,6 +369,7 @@ local blocks = allocate { ["ipaextensions"] = { first = 0x00250, last = 0x002AF, description = "IPA Extensions" }, ["javanese"] = { first = 0x0A980, last = 0x0A9DF, description = "Javanese" }, ["kaithi"] = { first = 0x11080, last = 0x110CF, description = "Kaithi" }, + ["kaktoviknumerals"] = { first = 0x1D2C0, last = 0x1D2DF, description = "Kaktovik Numerals" }, ["kanaextendeda"] = { first = 0x1B100, last = 0x1B12F, description = "Kana Extended-A" }, ["kanaextendedb"] = { first = 0x1AFF0, last = 0x1AFFF, description = "Kana Extended-B" }, ["kanasupplement"] = { first = 0x1B000, last = 0x1B0FF, description = "Kana Supplement" }, @@ -374,6 +379,7 @@ local blocks = allocate { ["katakana"] = { first = 0x030A0, last = 0x030FF, otf="kana", description = "Katakana" }, ["katakanaphoneticextensions"] = { first = 0x031F0, last = 0x031FF, otf="kana", description = "Katakana Phonetic Extensions" }, ["kayahli"] = { first = 0x0A900, last = 0x0A92F, description = "Kayah Li" }, + ["kawi"] = { first = 0x11F00, last = 0x11F5F, description = "Kawi" }, ["kharoshthi"] = { first = 0x10A00, last = 0x10A5F, otf="khar", description = "Kharoshthi" }, ["khitansmallscript"] = { first = 0x18B00, last = 0x18CFF, description = "Khitan Small Script" }, ["khmer"] = { first = 0x01780, last = 0x017FF, otf="khmr", description = "Khmer" }, @@ -456,6 +462,7 @@ local blocks = allocate { ["myanmarextendeda"] = { first = 0x0AA60, last = 0x0AA7F, description = "Myanmar Extended-A" }, ["myanmarextendedb"] = { first = 0x0A9E0, last = 0x0A9FF, description = "Myanmar Extended-B" }, ["nabataean"] = { first = 0x10880, last = 0x108AF, description = "Nabataean" }, + ["nagmundari"] = { first = 0x1E4D0, last = 0x1E4FF, description = "Nag Mundari" }, ["nandinagari"] = { first = 0x119A0, last = 0x119FF, description = "Nandinagari" }, ["newa"] = { first = 0x11400, last = 0x1147F, description = "Newa" }, ["newtailue"] = { first = 0x01980, last = 0x019DF, description = "New Tai Lue" }, @@ -585,7 +592,20 @@ local blocks = allocate { ["yiradicals"] = { first = 0x0A490, last = 0x0A4CF, otf="yi", description = "Yi Radicals" }, ["yisyllables"] = { first = 0x0A000, last = 0x0A48F, otf="yi", description = "Yi Syllables" }, ["zanabazarsquare"] = { first = 0x11A00, last = 0x11A4F, description = "Zanabazar Square" }, - ["znamennymusicalnotation"] = { first = 0x1CF00, last = 0x1CFCF, description = "Znamenny Musical Notation" } + ["znamennymusicalnotation"] = { first = 0x1CF00, last = 0x1CFCF, description = "Znamenny Musical Notation" }, + + -- we need this early on: + + ["lowercasecalligraphic"] = { first = 0x100000, last = 0x100019, math = true }, + ["uppercasecalligraphic"] = { first = 0x100020, last = 0x100039, math = true }, + ["lowercaseboldcalligraphic"] = { first = 0x100040, last = 0x100059, math = true }, + ["uppercaseboldcalligraphic"] = { first = 0x100060, last = 0x100079, math = true }, + -- ["lowercasesansgreek"] = { first = 0x100040, last = 0x100059, math = true }, -- reserved for future use + -- ["uppercasesansgreek"] = { first = 0x100060, last = 0x100079, math = true }, -- reserved for future use + -- ["lowercaseitalicsansgreek"] = { first = 0x100080, last = 0x100099, math = true }, -- reserved for future use + -- ["uppercaseitalicsansgreek"] = { first = 0x1000A0, last = 0x1000B9, math = true }, -- reserved for future use + -- ["lowercaseblackboarditalic"] = { first = 0x1000C0, last = 0x1000D9, math = true }, -- reserved for future use + -- ["uppercaseblackboarditalic"] = { first = 0x1000E0, last = 0x1000F9, math = true }, -- reserved for future use } -- moved from math-act.lua to here: diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv index 40594ad05..688232bf2 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{2022.09.16 14:39} +\newcontextversion{2022.10.14 10:13} %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 1de2ec104..7b5df628c 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{2022.09.16 14:39} +\edef\contextversion{2022.10.14 10:13} %D Kind of special: diff --git a/tex/context/base/mkiv/font-cff.lua b/tex/context/base/mkiv/font-cff.lua index 114d7dd07..4b60cd6c0 100644 --- a/tex/context/base/mkiv/font-cff.lua +++ b/tex/context/base/mkiv/font-cff.lua @@ -348,11 +348,11 @@ do top = 0 end + P("\10") / function() - result.strhw = stack[top] + result.stdhw = stack[top] top = 0 end + P("\11") / function() - result.strvw = stack[top] + result.stdvw = stack[top] top = 0 end + P("\13") / function() @@ -453,7 +453,7 @@ do top = 0 end + P("\10") / function() - result.bluesnap = stack[top] + result.blueshift = stack[top] top = 0 end + P("\11") / function() @@ -528,7 +528,7 @@ do -- the second variant is much faster. Not that it matters much as we don't see -- such numbers often. - local remap = { + local remap_1 = { ["\x00"] = "00", ["\x01"] = "01", ["\x02"] = "02", ["\x03"] = "03", ["\x04"] = "04", ["\x05"] = "05", ["\x06"] = "06", ["\x07"] = "07", ["\x08"] = "08", ["\x09"] = "09", ["\x0A"] = "0.", ["\x0B"] = "0E", ["\x0C"] = "0E-", ["\x0D"] = "0", ["\x0E"] = "0-", ["\x0F"] = "0", ["\x10"] = "10", ["\x11"] = "11", ["\x12"] = "12", ["\x13"] = "13", ["\x14"] = "14", ["\x15"] = "15", ["\x16"] = "16", ["\x17"] = "17", ["\x18"] = "18", ["\x19"] = "19", ["\x1A"] = "1.", ["\x1B"] = "1E", ["\x1C"] = "1E-", ["\x1D"] = "1", ["\x1E"] = "1-", ["\x1F"] = "1", ["\x20"] = "20", ["\x21"] = "21", ["\x22"] = "22", ["\x23"] = "23", ["\x24"] = "24", ["\x25"] = "25", ["\x26"] = "26", ["\x27"] = "27", ["\x28"] = "28", ["\x29"] = "29", ["\x2A"] = "2.", ["\x2B"] = "2E", ["\x2C"] = "2E-", ["\x2D"] = "2", ["\x2E"] = "2-", ["\x2F"] = "2", @@ -544,11 +544,18 @@ do ["\xC0"] = "E-0", ["\xC1"] = "E-1", ["\xC2"] = "E-2", ["\xC3"] = "E-3", ["\xC4"] = "E-4", ["\xC5"] = "E-5", ["\xC6"] = "E-6", ["\xC7"] = "E-7", ["\xC8"] = "E-8", ["\xC9"] = "E-9", ["\xCA"] = "E-.", ["\xCB"] = "E-E", ["\xCC"] = "E-E-", ["\xCD"] = "E-", ["\xCE"] = "E--", ["\xCF"] = "E-", ["\xD0"] = "-0", ["\xD1"] = "-1", ["\xD2"] = "-2", ["\xD3"] = "-3", ["\xD4"] = "-4", ["\xD5"] = "-5", ["\xD6"] = "-6", ["\xD7"] = "-7", ["\xD8"] = "-8", ["\xD9"] = "-9", ["\xDA"] = "-.", ["\xDB"] = "-E", ["\xDC"] = "-E-", ["\xDD"] = "-", ["\xDE"] = "--", ["\xDF"] = "-", } + local remap_2 = { + ["\x0F"] = "0", ["\x1F"] = "1", ["\x2F"] = "2", ["\x3F"] = "3", ["\x4F"] = "4", + ["\x5F"] = "5", ["\x6F"] = "6", ["\x7F"] = "7", ["\x8F"] = "8", ["\x9F"] = "9", + } + + local p_last_1 = S("\x0F\x1F\x2F\x3F\x4F\x5F\x6F\x7F\x8F\x9F\xAF\xBF") + local p_last_2 = R("\xF0\xFF") - local p_last = S("\x0F\x1F\x2F\x3F\x4F\x5F\x6F\x7F\x8F\x9F\xAF\xBF") - + R("\xF0\xFF") + -- tricky, we don't want to append last - local p_nibbles = P("\30") * Cs(((1-p_last)/remap)^0 * (P(1)/remap)) / function(n) + -- local p_nibbles = P("\30") * Cs(((1-p_last)/remap)^0 * (P(1)/remap)) / function(n) + local p_nibbles = P("\30") * Cs(((1-(p_last_1+p_last_2))/remap_1)^0 * (p_last_1/remap_2 + p_last_2/"")) / function(n) -- 0-9=digit a=. b=E c=E- d=reserved e=- f=finish top = top + 1 stack[top] = tonumber(n) or 0 @@ -2715,6 +2722,8 @@ function readers.cff(f,fontdata,specification) cffinfo.bluefuzz = data.bluefuzz cffinfo.stdhw = data.stdhw cffinfo.stdvw = data.stdvw + cffinfo.stemsnaph = data.stemsnaph + cffinfo.stemsnapv = data.stemsnapv end end cleanup(data,dictionaries) diff --git a/tex/context/base/mkiv/font-dsp.lua b/tex/context/base/mkiv/font-dsp.lua index 8f65ed9d9..1735b4cdc 100644 --- a/tex/context/base/mkiv/font-dsp.lua +++ b/tex/context/base/mkiv/font-dsp.lua @@ -2177,6 +2177,8 @@ do -- local usedlookups = false -- setmetatableindex("number") -- + local allsteps = { } -- new per 2022-09-25 + for lookupid=1,noflookups do local lookup = lookups[lookupid] local lookuptype = lookup.type @@ -2214,6 +2216,7 @@ do steps[nofsteps] = step local rules = step.rules if rules then + allsteps[#allsteps+1] = step -- new per 2022-09-25 for i=1,#rules do local rule = rules[i] local before = rule.before @@ -2337,11 +2340,14 @@ do end end - for i=lastsequence+1,nofsequences do - local sequence = sequences[i] - local steps = sequence.steps - for i=1,#steps do - local step = steps[i] + -- for i=lastsequence+1,nofsequences do + -- local sequence = sequences[i] + -- local steps = sequence.steps + -- for i=1,#steps do + -- local step = steps[i] + + for i=1,#allsteps do -- new per 2022-09-25 + local step = allsteps[i] -- new per 2022-09-25 local rules = step.rules if rules then for i=1,#rules do @@ -2419,7 +2425,7 @@ do end end end - end + -- end -- new per 2022-09-25 for i, n in sortedhash(sublookupcheck) do local l = lookups[i] @@ -2881,7 +2887,7 @@ local function readmathglyphinfo(f,fontdata,offset) if not math then glyph.math = { accent = accent } else - math.accent = accent + math.accent = accent -- will become math.topanchor end end end diff --git a/tex/context/base/mkiv/font-imp-italics.lua b/tex/context/base/mkiv/font-imp-italics.lua index 6c432d7cf..10a419daf 100644 --- a/tex/context/base/mkiv/font-imp-italics.lua +++ b/tex/context/base/mkiv/font-imp-italics.lua @@ -6,7 +6,7 @@ if not modules then modules = { } end modules ['font-imp-italics'] = { license = "see context related readme files" } -local next = next +local next, tonumber = next, tonumber local fonts = fonts local handlers = fonts.handlers @@ -14,11 +14,13 @@ local registerotffeature = handlers.otf.features.register local registerafmfeature = handlers.afm.features.register local function initialize(tfmdata,key,value) + local factor = tonumber(value) or 1 for unicode, character in next, tfmdata.characters do local olditalic = character.italic if olditalic and olditalic ~= 0 then - character.width = character.width + olditalic - character.italic = 0 + character.width = character.width + olditalic + character.italic = 0 + character.bottomright = -factor * olditalic end end end diff --git a/tex/context/base/mkiv/font-mis.lua b/tex/context/base/mkiv/font-mis.lua index c294bd638..5ae6659c5 100644 --- a/tex/context/base/mkiv/font-mis.lua +++ b/tex/context/base/mkiv/font-mis.lua @@ -21,7 +21,7 @@ local readers = otf.readers if readers then - otf.version = otf.version or 3.120 + otf.version = otf.version or 3.121 otf.cache = otf.cache or containers.define("fonts", "otl", otf.version, true) function fonts.helpers.getfeatures(name,save) diff --git a/tex/context/base/mkiv/font-osd.lua b/tex/context/base/mkiv/font-osd.lua index ecf8009f9..f35be2cd1 100644 --- a/tex/context/base/mkiv/font-osd.lua +++ b/tex/context/base/mkiv/font-osd.lua @@ -6,16 +6,6 @@ if not modules then modules = { } end modules ['font-osd'] = { -- script devanag license = "see context related readme files" } --- local experiment1 = false --- local experiment2 = false --- local experiment2b1 = false --- local experiment2b2 = false - --- experiments.register("fonts.indic.experiment1", function(v) experiment1 = v end) --- experiments.register("fonts.indic.experiment2", function(v) experiment2 = v end) --- experiments.register("fonts.indic.experiment2b1", function(v) experiment2b1 = v end) --- experiments.register("fonts.indic.experiment2b2", function(v) experiment2b2 = v end) - -- we need to check nbsphash (context only) -- A few remarks: @@ -1392,16 +1382,13 @@ local function reorder_one(head,start,stop,font,attr,nbspaces) end if reph or vattu then --- print(">>> has reph or vattu") local current = start local cns = nil local done = false while current ~= stop do --- print("\t>>> current ~= stop yet") local c = current local n = getnext(current) if ra[getchar(current)] and halant[getchar(n)] then --- print("\t\t>>> current ra; next halant") c = n n = getnext(n) local b, bn = base, base @@ -1415,7 +1402,6 @@ local function reorder_one(head,start,stop,font,attr,nbspaces) if getstate(current,s_rphf) then -- position Reph (Ra + H) after post-base 'matra' (if any) since these -- become marks on the 'matra', not on the base glyph --- print("\t\t\t>>> ra + halant form → reph") if b ~= current then if current == start then if head == start then @@ -1435,7 +1421,6 @@ local function reorder_one(head,start,stop,font,attr,nbspaces) end elseif cns and getnext(cns) ~= current then -- todo: optimize next -- position below-base Ra (vattu) following the consonants on which it is placed (either the base consonant or one of the pre-base consonants) --- print("\t\t\t>>> ra below base (vattu) → rkrf") local cp = getprev(current) local cnsn = getnext(cns) setlink(cp,n) @@ -1449,17 +1434,14 @@ local function reorder_one(head,start,stop,font,attr,nbspaces) current = getprev(n) end else --- print("\t\t>>> NOT! current ra; next halant") local char = getchar(current) if consonant[char] then --- print("\t\t\t>>> is consonant") cns = current local next = getnext(cns) if halant[getchar(next)] then cns = next end if not vatucache[char] then --- print("\t\t\t\t>>> is in vatucache") next = getnext(cns) while dependent_vowel[getchar(next)] do cns = next @@ -1467,7 +1449,6 @@ local function reorder_one(head,start,stop,font,attr,nbspaces) end end elseif char == c_nbsp then --- print("\t\t\t>>> is nbsp") nbspaces = nbspaces + 1 cns = current local next = getnext(cns) @@ -1936,8 +1917,6 @@ local function reorder_two(head,start,stop,font,attr,nbspaces) -- maybe do a pas reorderreph.coverage = { } -- use local rephbase[font] = { } -- use local --- print("!!!!!! reorder two ") - for i=1,#seqsubset do -- this can be done more efficient, the last test and less getnext @@ -2064,7 +2043,7 @@ local function reorder_two(head,start,stop,font,attr,nbspaces) -- maybe do a pas end end - local current, base, firstcons = start, nil, nil + local current, base, firstcons, subnotafterbase, postnotafterbase = start, nil, nil, nil, nil if getstate(start,s_rphf) then -- if syllable starts with Ra + H and script has 'Reph' then exclude Reph from candidates for base consonants @@ -2125,10 +2104,17 @@ local function reorder_two(head,start,stop,font,attr,nbspaces) -- maybe do a pas end end else -- not Stand Alone cluster --- print("!!!! not standalone cluster") local last = getnext(stop) while current ~= last do -- find base consonant local next = getnext(current) +-- IF PATCHED THEN +-- if current == subpos then +-- subnotafterbase = current +-- end +-- if current == postpos then +-- postnotafterbase = current +-- end +-- END if consonant[getchar(current)] then if not (current ~= stop and next ~= stop and halant[getchar(next)] and getchar(getnext(next)) == c_zwj) then if not firstcons then @@ -2138,6 +2124,14 @@ local function reorder_two(head,start,stop,font,attr,nbspaces) -- maybe do a pas local a = getstate(current) if not (a == s_blwf or a == s_pstf or (a ~= s_rphf and a ~= s_blwf and ra[getchar(current)])) then base = current +-- IF PATCHED THEN +-- if subnotafterbase then +-- subpos = base +-- end +-- if postnotafterbase then +-- postpos = base +-- end +-- END end end end @@ -2195,12 +2189,17 @@ local function reorder_two(head,start,stop,font,attr,nbspaces) -- maybe do a pas end end -- --- print("char: " .. char) --- if not moved[current] and dependent_vowel[char] then - if dependent_vowel[char] then --- print(">>!! dependent vowel") +-- IF PATCHED THEN +-- if dependent_vowel[char] then +-- ELSE + if not moved[current] and dependent_vowel[char] then +-- END if pre_mark[char] then -- or: if before_main or before_half +-- IF PATCHED THEN +-- -- nothing +-- ELSE moved[current] = true +-- END -- can be helper to remove one node local prev, next = getboth(current) setlink(prev,next) @@ -2251,6 +2250,13 @@ local function reorder_two(head,start,stop,font,attr,nbspaces) -- maybe do a pas end elseif above_mark[char] then -- after main consonant +-- IF PATCHED +-- target = subpos +-- if postpos == subpos then +-- postpos = current +-- end +-- subpos = current +-- ELSE target = basepos if subpos == basepos then subpos = current @@ -2259,6 +2265,7 @@ local function reorder_two(head,start,stop,font,attr,nbspaces) -- maybe do a pas postpos = current end basepos = current +-- END elseif below_mark[char] then -- after subjoined consonants target = subpos @@ -2502,12 +2509,16 @@ local function analyze_next_chars_one(c,font,variant) -- skip one dependent vowe if pre_mark[v] and not already_pre_mark then already_pre_mark = true elseif post_mark[v] and not already_post_mark then - if devanagarihash[font].conjuncts == "mixed" then - -- for messy fonts - return c - else - already_post_mark = true - end +-- IF PATCHED THEN +-- already_post_mark = true +-- ELSE + if devanagarihash[font].conjuncts == "mixed" then + -- for messy fonts + return c + else + already_post_mark = true + end +-- END elseif below_mark[v] and not already_below_mark then already_below_mark = true elseif above_mark[v] and not already_above_mark then @@ -2710,10 +2721,6 @@ local function analyze_next_chars_two(c,font) for k=1,#vowels do local v = vowels[k] if pre_mark[v] and not already_pre_mark then --- print(">>> pre_mark") --- if dependent_vowel[v] then --- print(">>>> dependent vowel") --- end already_pre_mark = true elseif above_mark[v] and not already_above_mark then already_above_mark = true @@ -2731,12 +2738,16 @@ local function analyze_next_chars_two(c,font) if pre_mark[v] and not already_pre_mark then already_pre_mark = true elseif post_mark[v] and not already_post_mark then - if devanagarihash[font].conjuncts == "mixed" then - -- for messy fonts - return c - else - already_post_mark = true - end +-- IF PATCHED THEN +-- already_post_mark = true +-- ELSE + if devanagarihash[font].conjuncts == "mixed" then + -- for messy fonts + return c + else + already_post_mark = true + end +-- END elseif below_mark[v] and not already_below_mark then already_below_mark = true elseif above_mark[v] and not already_above_mark then @@ -3068,15 +3079,12 @@ local function method_two(head,font,attr) end end if independent_vowel[char] then --- print("!!>>> independent_vowel") -- vowel-based syllable: [Ra+H]+V+[N]+[<[]+H+C|ZWJ+C>]+[{M}+[N]+[H]]+[SM]+[(VD)] current = analyze_next_chars_one(c,font,1) syllableend = current else --- print("!!>>> dependent vowel") local standalone = char == c_nbsp if standalone then --- print("!!>>> standalone") nbspaces = nbspaces + 1 local p = getprev(current) if not p then @@ -3090,12 +3098,10 @@ local function method_two(head,font,attr) end end if standalone then --- print("!!>>>>>>> next standalone") -- Stand Alone cluster (at the start of the word only): #[Ra+H]+NBSP+[N]+[<[]+H+C>]+[{M}+[N]+[H]]+[SM]+[(VD)] current = analyze_next_chars_one(c,font,2) syllableend = current elseif consonant[getchar(current)] then --- print("!!>>>>>>> a consonant") -- WHY current INSTEAD OF c ? -- Consonant syllable: {C+[N]+]|+H>} + C+[N]+[A] + [< H+[] | {M}+[N]+[H]>]+[SM]+[(VD)] current = analyze_next_chars_two(current,font) -- not c ! @@ -3104,7 +3110,6 @@ local function method_two(head,font,attr) end end if syllableend then --- print("!!!>>> syllable end") syllabe = syllabe + 1 local c = syllablestart local n = getnext(syllableend) diff --git a/tex/context/base/mkiv/font-otc.lua b/tex/context/base/mkiv/font-otc.lua index 67b77b111..f83c3e8ec 100644 --- a/tex/context/base/mkiv/font-otc.lua +++ b/tex/context/base/mkiv/font-otc.lua @@ -142,6 +142,12 @@ local function addfeature(data,feature,specifications,prepareonly) local descriptions = data.descriptions local resources = data.resources + + if not descriptions or not resources then + report_otf("missing specification") + return + end + local features = resources.features local sequences = resources.sequences diff --git a/tex/context/base/mkiv/font-otl.lua b/tex/context/base/mkiv/font-otl.lua index f36e533ca..9493bd03c 100644 --- a/tex/context/base/mkiv/font-otl.lua +++ b/tex/context/base/mkiv/font-otl.lua @@ -52,7 +52,7 @@ local report_otf = logs.reporter("fonts","otf loading") local fonts = fonts local otf = fonts.handlers.otf -otf.version = 3.120 -- beware: also sync font-mis.lua and in mtx-fonts +otf.version = 3.121 -- beware: also sync font-mis.lua and in mtx-fonts otf.cache = containers.define("fonts", "otl", otf.version, true) otf.svgcache = containers.define("fonts", "svg", otf.version, true) otf.pngcache = containers.define("fonts", "png", otf.version, true) diff --git a/tex/context/base/mkiv/font-ots.lua b/tex/context/base/mkiv/font-ots.lua index 7de108d4c..b3055976a 100644 --- a/tex/context/base/mkiv/font-ots.lua +++ b/tex/context/base/mkiv/font-ots.lua @@ -8,6 +8,11 @@ if not modules then modules = { } end modules ['font-ots'] = { -- sequences } --[[ldx-- +

I need to check the description at the microsoft site ... it has been improved +so maybe there are some interesting details there. Most below is based on old and +incomplete documentation and involved quite a bit of guesswork (checking with the +abstract uniscribe of those days. But changing things is tricky!

+

This module is a bit more split up that I'd like but since we also want to test with plain it has to be so. This module is part of and discussion about improvements and functionality mostly happens on the @@ -165,13 +170,8 @@ local forcepairadvance = false -- for testing local repeatablemultiples = context or false -directives.register("otf.forcediscretionaries",function(v) - forcediscretionaries = v -end) - -directives.register("otf.forcepairadvance",function(v) - forcepairadvance = v -end) +directives.register("otf.forcediscretionaries", function(v) forcediscretionaries = v end) +directives.register("otf.forcepairadvance", function(v) forcepairadvance = v end) local report_direct = logs.reporter("fonts","otf direct") local report_subchain = logs.reporter("fonts","otf subchain") @@ -197,7 +197,6 @@ local setboth = nuts.setboth local getid = nuts.getid local getstate = nuts.getstate local getsubtype = nuts.getsubtype -local setsubtype = nuts.setsubtype local getchar = nuts.getchar local setchar = nuts.setchar local getdisc = nuts.getdisc @@ -229,10 +228,10 @@ local ischar = nuts.ischar local usesfont = nuts.usesfont local insertnodeafter = nuts.insertafter -local copy_node = nuts.copy -local copy_node_list = nuts.copylist -local remove_node = nuts.remove -local find_node_tail = nuts.tail +local copynode = nuts.copy +local copynodelist = nuts.copylist +local removenode = nuts.remove +local findnodetail = nuts.tail local flushnodelist = nuts.flushlist local flushnode = nuts.flushnode local endofmath = nuts.endofmath @@ -244,12 +243,8 @@ local setmetatableindex = table.setmetatableindex local nextnode = nuts.traversers.node ------ zwnj = 0x200C ------ zwj = 0x200D - local nodecodes = nodes.nodecodes local glyphcodes = nodes.glyphcodes -local disccodes = nodes.disccodes local glyph_code = nodecodes.glyph local glue_code = nodecodes.glue @@ -261,8 +256,7 @@ local par_code = nodecodes.par local lefttoright_code = nodes.dirvalues.lefttoright local righttoleft_code = nodes.dirvalues.righttoleft -local discretionarydisc_code = disccodes.discretionary -local ligatureglyph_code = glyphcodes.ligature +local discretionarydisc_code = nodes.disccodes.discretionary local a_noligature = attributes.private("noligature") @@ -377,7 +371,7 @@ local function cref(dataset,sequence,index) return "no valid dataset" end local merged = sequence.merged and "merged " or "" - if index then + if index and index > 1 then return formatters["feature %a, type %a, %schain lookup %a, index %a"]( dataset[4],sequence.type,merged,sequence.name,index) else @@ -455,7 +449,7 @@ end local function appenddisc(disc,list) local pre, post, replace, pretail, posttail, replacetail = getdisc(disc,true) local posthead = list - local replacehead = copy_node_list(list) + local replacehead = copynodelist(list) if post then setlink(posttail,posthead) else @@ -483,7 +477,6 @@ local function markstoligature(head,start,stop,char) end resetinjection(base) setchar(base,char) - setsubtype(base,ligatureglyph_code) setcomponents(base,start) setlink(prev,base,next) flushcomponents(start) @@ -536,7 +529,6 @@ local function toligature(head,start,stop,char,dataset,sequence,skiphash,discfou end resetinjection(base) setchar(base,char) - setsubtype(base,ligatureglyph_code) setcomponents(base,comp) setlink(prev,base,next) if not discfound then @@ -560,7 +552,7 @@ local function toligature(head,start,stop,char,dataset,sequence,skiphash,discfou if trace_marks then logwarning("%s: keep ligature mark %s, gets index %s",pref(dataset,sequence),gref(char),getligaindex(start)) end - local n = copy_node(start) + local n = copynode(start) copyinjection(n,start) -- is this ok ? we position later anyway head, current = insertnodeafter(head,current,n) -- unlikely that mark has components elseif trace_marks then @@ -634,67 +626,68 @@ end local function multiple_glyphs(head,start,multiple,skiphash,what,stop) -- what to do with skiphash matches here local nofmultiples = #multiple if nofmultiples > 0 then + local first = start resetinjection(start) setchar(start,multiple[1]) if nofmultiples > 1 then - local sn = getnext(start) - for k=2,nofmultiples do + -- local sn = getnext(start) + for i=2,nofmultiples do -- untested: -- -- while ignoremarks and marks[getchar(sn)] then -- local sn = getnext(sn) -- end - local n = copy_node(start) -- ignore components + local n = copynode(start) -- ignore components resetinjection(n) - setchar(n,multiple[k]) + setchar(n,multiple[i]) insertnodeafter(head,start,n) start = n end - if what ~= true and repeatablemultiples then - -- This is just some experimental code; we might introduce gsub_extensible - -- some day instead. Beware: when we have a feature that mixes alternates and - -- multiples we need to make sure we don't handle the alternate string values - -- here. This might eventually become an lmtx only feature. - local kind = type(what) - local m, f, l - if kind == "string" then - local what, n = string.match(what,"^repeat(.-)[:=](%d+)$") - if what == "middle" then - m = tonumber(n) - elseif what == "first" then - f = tonumber(n) - elseif what == "last" then - l = tonumber(n) - end - elseif kind == "table" then - -- won't happen because currently we don't split these values - m = what.middle - f = what.first - l = what.last + end + if what ~= true and repeatablemultiples then + -- This is just some experimental code; we might introduce gsub_extensible + -- some day instead. Beware: when we have a feature that mixes alternates and + -- multiples we need to make sure we don't handle the alternate string values + -- here. + local kind = type(what) + local m, f, l + if kind == "string" then + local what, n = string.match(what,"^repeat(.-)[:=](%d+)$") + if what == "middle" then + m = tonumber(n) + elseif what == "first" then + f = tonumber(n) + elseif what == "last" then + l = tonumber(n) end - if f or m or l then - if m and m > 1 and nofmultiples == 3 then - local middle = getnext(first) - for i=2,m do - local n = copynode(middle) -- ignore components - resetinjection(n) - insertnodeafter(head,first,n) - end + elseif kind == "table" then + -- won't happen because currently we don't split these values + m = what.middle + f = what.first + l = what.last + end + if f or m or l then + if m and m > 1 and nofmultiples == 3 then + local middle = getnext(first) + for i=2,m do + local n = copynode(middle) -- ignore components + resetinjection(n) + insertnodeafter(head,first,n) end - if f and f > 1 then - for i=2,f do - local n = copynode(first) -- ignore components - resetinjection(n) - insertnodeafter(head,first,n) - end + end + if f and f > 1 then + for i=2,f do + local n = copynode(first) -- ignore components + resetinjection(n) + insertnodeafter(head,first,n) end - if l and l > 1 then - for i=2,l do - local n = copynode(start) -- ignore components - resetinjection(n) - insertnodeafter(head,start,n) - start = n - end + end + if l and l > 1 then + for i=2,l do + local n = copynode(start) -- ignore components + resetinjection(n) + insertnodeafter(head,start,n) + start = n end end end @@ -894,9 +887,9 @@ function handlers.gsub_ligature(head,start,dataset,sequence,ligature,rlmode,skip local prev = getprev(start) if stop then setnext(stop) - local copy = copy_node_list(start) + local copy = copynodelist(start) local tail = stop -- was: getprev(stop) -- Kai: needs checking on your samples - local liat = find_node_tail(copy) + local liat = findnodetail(copy) if pre then setlink(liat,pre) end @@ -907,7 +900,7 @@ function handlers.gsub_ligature(head,start,dataset,sequence,ligature,rlmode,skip replace = start else setnext(start) - local copy = copy_node(start) + local copy = copynode(start) if pre then setlink(copy,pre) end @@ -1321,7 +1314,7 @@ as less as needed but that would also make the code even more messy.

-- To be done (example needed): what if > 1 steps --- this is messy: do we need this disc checking also in alternaties? +-- this is messy: do we need this disc checking also in alternates? local function reportzerosteps(dataset,sequence) logwarning("%s: no steps",cref(dataset,sequence)) @@ -1357,7 +1350,7 @@ function chainprocs.gsub_remove(head,start,stop,dataset,sequence,currentlookup,r if trace_chains then logprocess("%s: removing character %s",cref(dataset,sequence,chainindex),gref(getchar(start))) end - head, start = remove_node(head,start,true) + head, start = removenode(head,start,true) return head, getprev(start), true end @@ -1952,7 +1945,7 @@ do if not userkern then -- generic local setkern = nuts.setkern -- not injections.setkern userkern = function(k) - local n = copy_node(thekern) + local n = copynode(thekern) setkern(n,k) return n end @@ -1994,12 +1987,11 @@ end local noflags = { false, false, false, false } -local function chainrun(head,start,last,dataset,sequence,rlmode,skiphash,ck) +local function chainrun(head,start,last,dataset,sequence,rlmode,skiphash,ck,where) local size = ck[5] - ck[4] + 1 local chainlookups = ck[6] local done = false - -- current match if chainlookups then -- Lookups can be like { 1, false, 3 } or { false, 2 } or basically anything and @@ -2010,23 +2002,30 @@ local function chainrun(head,start,last,dataset,sequence,rlmode,skiphash,ck) -- if nofchainlookups > size then -- -- bad rules -- end - local chainlookup = chainlookups[1] - for j=1,#chainlookup do - local chainstep = chainlookup[j] - local chainkind = chainstep.type - local chainproc = chainprocs[chainkind] - if chainproc then - local ok - -- HH: chainindex 1 added here (for KAI to check too), there are weird ligatures e.g. - -- char + mark -> char where mark has to disappear - head, start, ok = chainproc(head,start,last,dataset,sequence,chainstep,rlmode,skiphash,1) - if ok then - done = true + if chainlookup then + for j=1,#chainlookup do + local chainstep = chainlookup[j] + if chainstep then + local chainkind = chainstep.type + local chainproc = chainprocs[chainkind] + if chainproc then + local ok + -- HH: chainindex 1 added here (for KAI to check too), there are weird ligatures e.g. + -- char + mark -> char where mark has to disappear + head, start, ok = chainproc(head,start,last,dataset,sequence,chainstep,rlmode,skiphash,1) + if ok then + done = true + end + else + logprocess("%s: %s is not yet supported (1)",cref(dataset,sequence),chainkind) + end + else + logprocess("%s: has an issue (1)",cref(dataset,sequence)) end - else - logprocess("%s: %s is not yet supported (1)",cref(dataset,sequence),chainkind) end + else + -- whatever end else @@ -2067,23 +2066,28 @@ local function chainrun(head,start,last,dataset,sequence,rlmode,skiphash,ck) if chainlookup then for j=1,#chainlookup do local chainstep = chainlookup[j] - local chainkind = chainstep.type - local chainproc = chainprocs[chainkind] - if chainproc then - local ok, n - head, start, ok, n = chainproc(head,start,last,dataset,sequence,chainstep,rlmode,skiphash,i) - -- messy since last can be changed ! - if ok then - done = true - if n and n > 1 and i + n > nofchainlookups then - -- this is a safeguard, we just ignore the rest of the lookups - i = size -- prevents an advance - break + if chainstep then + local chainkind = chainstep.type + local chainproc = chainprocs[chainkind] + if chainproc then + local ok, n + head, start, ok, n = chainproc(head,start,last,dataset,sequence,chainstep,rlmode,skiphash,i) + -- messy since last can be changed ! + if ok then + done = true + if n and n > 1 and i + n > nofchainlookups then + -- this is a safeguard, we just ignore the rest of the lookups + i = size -- prevents an advance + break + end end + else + -- actually an error + logprocess("%s: %s is not yet supported (2)",cref(dataset,sequence),chainkind) end else -- actually an error - logprocess("%s: %s is not yet supported (2)",cref(dataset,sequence),chainkind) + logprocess("%s: has an issue (2)",cref(dataset,sequence)) end end else @@ -2111,7 +2115,7 @@ local function chainrun(head,start,last,dataset,sequence,rlmode,skiphash,ck) else done = true if trace_contexts then - logprocess("%s: skipping match",cref(dataset,sequence)) + logprocess("%s: skipping match @ %i",cref(dataset,sequence),where) end end end @@ -2141,6 +2145,8 @@ local function chaindisk(head,start,dataset,sequence,rlmode,skiphash,ck) local last = start local prev = getprev(start) local hasglue = false + local useddisc = nil -- new 2022-09-25 + local usedstart = start -- new 2022-09-25 -- fishy: so we can overflow and then go on in the sweep? -- todo : id can also be glue_code as we checked spaces @@ -2211,7 +2217,7 @@ local function chaindisk(head,start,dataset,sequence,rlmode,skiphash,ck) tail = prev setprev(current,sweepnode) else - tail = find_node_tail(head) + tail = findnodetail(head) end setnext(sweepnode,current) setprev(head) @@ -2302,15 +2308,14 @@ local function chaindisk(head,start,dataset,sequence,rlmode,skiphash,ck) end end end + local done = false if lookaheaddisc then - local cf = start local cl = getprev(lookaheaddisc) local cprev = getprev(start) local insertedmarks = 0 - while cprev do local char = ischar(cf,currentfont) if char and marks[char] then @@ -2329,13 +2334,13 @@ local function chaindisk(head,start,dataset,sequence,rlmode,skiphash,ck) head = lookaheaddisc end local pre, post, replace = getdisc(lookaheaddisc) - local new = copy_node_list(cf) -- br, how often does that happen + local new = copynodelist(cf) -- br, how often does that happen local cnew = new if pre then - setlink(find_node_tail(cf),pre) + setlink(findnodetail(cf),pre) end if replace then - local tail = find_node_tail(new) + local tail = findnodetail(new) setlink(tail,replace) end for i=1,insertedmarks do @@ -2349,14 +2354,14 @@ local function chaindisk(head,start,dataset,sequence,rlmode,skiphash,ck) end if not notmatchpre[lookaheaddisc] then local ok = false - cf, start, ok = chainrun(cf,start,cl,dataset,sequence,rlmode,skiphash,ck) + cf, start, ok = chainrun(cf,start,cl,dataset,sequence,rlmode,skiphash,ck,1) if ok then done = true end end if not notmatchreplace[lookaheaddisc] then local ok = false - new, cnew, ok = chainrun(new,cnew,clast,dataset,sequence,rlmode,skiphash,ck) + new, cnew, ok = chainrun(new,cnew,clast,dataset,sequence,rlmode,skiphash,ck,2) if ok then done = true end @@ -2367,16 +2372,14 @@ local function chaindisk(head,start,dataset,sequence,rlmode,skiphash,ck) setdisc(lookaheaddisc,cf,post,new) end start = getprev(lookaheaddisc) + useddisc = lookaheaddisc -- new 2022-09-25 sweephead[cf] = getnext(clast) or false sweephead[new] = getnext(cl) or false - elseif backtrackdisc then - local cf = getnext(backtrackdisc) local cl = start local cnext = getnext(start) local insertedmarks = 0 - while cnext do local char = ischar(cnext,currentfont) if char and marks[char] then @@ -2391,8 +2394,8 @@ local function chaindisk(head,start,dataset,sequence,rlmode,skiphash,ck) setprev(cf) setnext(cl) local pre, post, replace, pretail, posttail, replacetail = getdisc(backtrackdisc,true) - local new = copy_node_list(cf) - local cnew = find_node_tail(new) + local new = copynodelist(cf) + local cnew = findnodetail(new) for i=1,insertedmarks do cnew = getprev(cnew) end @@ -2402,14 +2405,14 @@ local function chaindisk(head,start,dataset,sequence,rlmode,skiphash,ck) end if not notmatchpost[backtrackdisc] then local ok = false - cf, start, ok = chainrun(cf,start,last,dataset,sequence,rlmode,skiphash,ck) + cf, start, ok = chainrun(cf,start,last,dataset,sequence,rlmode,skiphash,ck,3) if ok then done = true end end if not notmatchreplace[backtrackdisc] then local ok = false - new, cnew, ok = chainrun(new,cnew,clast,dataset,sequence,rlmode,skiphash,ck) + new, cnew, ok = chainrun(new,cnew,clast,dataset,sequence,rlmode,skiphash,ck,4) if ok then done = true end @@ -2430,33 +2433,57 @@ local function chaindisk(head,start,dataset,sequence,rlmode,skiphash,ck) setdisc(backtrackdisc,pre,post,replace) end start = getprev(backtrackdisc) + useddisc = backtrackdisc -- new 2022-09-25 sweephead[post] = getnext(clast) or false sweephead[replace] = getnext(last) or false - else local ok = false - head, start, ok = chainrun(head,start,last,dataset,sequence,rlmode,skiphash,ck) + head, start, ok = chainrun(head,start,last,dataset,sequence,rlmode,skiphash,ck,5) if ok then done = true end end - - return head, start, done + if useddisc and start ~= usedstart then -- make this option per font -- new 2022-09-25 + start = getnext(start) -- new 2022-09-25 + end -- new 2022-09-25 + return head, start, done, useddisc -- new 2022-09-25 end -local function chaintrac(head,start,dataset,sequence,rlmode,skiphash,ck,match,discseen,sweepnode) - local rule = ck[1] - local lookuptype = ck[8] or ck[2] - local nofseq = #ck[3] - local first = ck[4] - local last = ck[5] - local char = getchar(start) - logwarning("%s: rule %s %s at char %s for (%s,%s,%s) chars, lookuptype %a, %sdisc seen, %ssweeping", - cref(dataset,sequence),rule,match and "matches" or "nomatch", - gref(char),first-1,last-first+1,nofseq-last,lookuptype, - discseen and "" or "no ", sweepnode and "" or "not ") +local chaintrac do + + local level = 0 + local last = { } + + chaintrac = function(head,start,dataset,sequence,rlmode,skiphash,ck,match,discseen,sweepnode) + if dataset then + level = level + 1 + last[level] = start + local rule = ck[1] + local lookuptype = ck[8] or ck[2] + local nofseq = #ck[3] -- ck[3].n + local first = ck[4] + local last = ck[5] + local char = getchar(start) + logwarning("+ %i : %s: rule %s %s at char %s for (%s,%s,%s) chars, lookuptype %a, %sdisc seen, %ssweeping", + level,cref(dataset,sequence),rule,match and "matches" or "nomatch", + gref(char),first-1,last-first+1,nofseq-last,lookuptype, + discseen and "" or "no ", sweepnode and "" or "not ") + else + -- (start,done) + local what = start and "done" or "continue" + local where = head == last[level] and "same" or "different" + local char = getchar(head) + if char then + logwarning("- %i : %s at char %s, %s node",level,what,gref(char),where) + else + logwarning("- %i : %s, %s node",level,what,where) + end + level = level - 1 + end + end + end -- The next one is quite optimized but still somewhat slow, fonts like ebgaramond @@ -2470,6 +2497,9 @@ end -- the previous disc .. such be it ( with only f done) local function handle_contextchain(head,start,dataset,sequence,contexts,rlmode,skiphash) + if not contexts then + return head, start, false + end -- optimizing for rlmode gains nothing local sweepnode = sweepnode local sweeptype = sweeptype @@ -2510,10 +2540,10 @@ local function handle_contextchain(head,start,dataset,sequence,contexts,rlmode,s for k=1,nofcontexts do -- does this disc mess work well with n > 1 - local ck = contexts[k] - local seq = ck[3] - local f = ck[4] -- first current -local last = start + local ck = contexts[k] + local seq = ck[3] + local f = ck[4] -- first current + local last = start if not startchar or not seq[f][startchar] then -- report("no hit in %a at %i of %i contexts",sequence.type,k,nofcontexts) goto next @@ -2524,7 +2554,7 @@ local last = start else local l = ck[5] -- last current local current = start --- local last = start + -- local last = start -- current match @@ -2638,7 +2668,7 @@ local last = start -- before if f > 1 then - if startprev then + -- if startprev then -- new 2022-09-25 local prev = startprev if prereplace and prev == checkdisc then prev = getprev(sweepnode) @@ -2762,9 +2792,9 @@ local last = start else goto next end - else - goto next - end + -- else -- new 2022-09-25 + -- goto next -- new 2022-09-25 + -- end -- new 2022-09-25 end -- after @@ -2888,24 +2918,25 @@ local last = start end end end - if trace_contexts then chaintrac(head,start,dataset,sequence,rlmode,skipped and skiphash,ck,true,discseen,sweepnode) end if discseen or sweepnode then + -- When we process a disc we can collapse and therefore we backtrack one node (start) and + -- reprocess. This is needed because there might be more in the collapsed list. head, start, done = chaindisk(head,start,dataset,sequence,rlmode,skipped and skiphash,ck) else - head, start, done = chainrun(head,start,last,dataset,sequence,rlmode,skipped and skiphash,ck) + head, start, done = chainrun(head,start,last,dataset,sequence,rlmode,skipped and skiphash,ck,6) + end + if trace_contexts then + chaintrac(start,done) end if done then break -- else -- next context end - ::next:: - -- if trace_chains then - -- chaintrac(head,start,dataset,sequence,rlmode,skipped and skiphash,ck,false,discseen,sweepnode) - -- end + ::next:: end if discseen then notmatchpre = { } @@ -2924,21 +2955,46 @@ handlers.gsub_reversecontextchain = handle_contextchain handlers.gpos_contextchain = handle_contextchain handlers.gpos_context = handle_contextchain --- this needs testing +-- local function chained_contextchain(head,start,stop,dataset,sequence,currentlookup,rlmode,skiphash) +-- local steps = currentlookup.steps +-- local nofsteps = currentlookup.nofsteps +-- if nofsteps > 1 then +-- reportmoresteps(dataset,sequence) +-- end +-- -- probably wrong +-- local l = steps[1].coverage[getchar(start)] +-- if l then +-- return handle_contextchain(head,start,dataset,sequence,l,rlmode,skiphash) +-- else +-- return head, start, false +-- end +-- end +-- new 2022-09-25 + local function chained_contextchain(head,start,stop,dataset,sequence,currentlookup,rlmode,skiphash) local steps = currentlookup.steps local nofsteps = currentlookup.nofsteps - if nofsteps > 1 then - reportmoresteps(dataset,sequence) - end - -- probably wrong - local l = steps[1].coverage[getchar(start)] - if l then - return handle_contextchain(head,start,dataset,sequence,l,rlmode,skiphash) + local char = getchar(start) + if nofsteps == 1 then + local s = steps[1] + local l = s.coverage[char] + if l then + return handle_contextchain(head,start,dataset,sequence,l,rlmode,skiphash) + end else - return head, start, false + for i=1,nofsteps do + local s = steps[i] + local l = s.coverage[char] + if l then + local h, s, d = handle_contextchain(head,start,dataset,sequence,l,rlmode,skiphash) + if d then + return h, s, d + end + end + end end + return head, start, false end chainprocs.gsub_context = chained_contextchain @@ -3077,7 +3133,7 @@ do -- overcome local limit end -- Functions like kernrun, comprun etc evolved over time and in the end look rather --- complex. It's a bit of a compromis between extensive copying and creating subruns. +-- complex. It's a bit of a compromise between extensive copying and creating subruns. -- The logic has been improved a lot by Kai and Ivo who use complex fonts which -- really helped to identify border cases on the one hand and get insight in the diverse -- ways fonts implement features (not always that consistent and efficient). At the same @@ -3184,7 +3240,8 @@ local function kernrun(disc,k_run,font,attr,...) if done and trace_testruns then report_disc("done",disc) end - return nextstart, done + -- return nextstart, done + return nextstart end -- fonts like ebgaramond do ligatures this way (less efficient than e.g. dejavu which @@ -3237,12 +3294,19 @@ local function comprun(disc,c_run,...) -- vararg faster than the whole list setdisc(disc,pre,post,replace) end -- - return getnext(disc), renewed + -- return getnext(disc), renewed + return getnext(disc) end -- if we can hyphenate in a lig then unlikely a lig so we -- could have a option here to ignore lig +local test_flatten_start = 2 -- must start at 2 according to Kai + +directives.register("otf.testrun.forceflatten", function(v) + test_flatten_start = v and 1 or 2 +end) + local function testrun(disc,t_run,c_run,...) if trace_testruns then report_disc("test",disc) @@ -3271,7 +3335,7 @@ local function testrun(disc,t_run,c_run,...) local d = d_replace > d_post and d_replace or d_post local head = getnext(disc) -- is: next local tail = head - for i=2,d do -- must start at 2 according to Kai + for i=test_flatten_start,d do local nx = getnext(tail) local id = getid(nx) if id == disc_code then @@ -3286,7 +3350,7 @@ local function testrun(disc,t_run,c_run,...) next = getnext(tail) setnext(tail) setprev(head) - local new = copy_node_list(head) + local new = copynodelist(head) if posttail then setlink(posttail,head) else @@ -3359,7 +3423,8 @@ local function testrun(disc,t_run,c_run,...) end end -- next can have changed (copied list) - return getnext(disc), renewed + -- return getnext(disc), renewed + return getnext(disc) end -- 1{2{\oldstyle\discretionary{3}{4}{5}}6}7\par @@ -3882,7 +3947,7 @@ do -- the before and after lists in the loader. But first I need to see a font that uses multiple -- matches. -- - local start = find_node_tail(head) + local start = findnodetail(head) local rlmode = 0 -- how important is this .. do we need to check for dir? local merged = steps.merged while start do @@ -3968,17 +4033,13 @@ do start = getnext(start) elseif id == disc_code then if not discs or discs[start] == true then - local ok if gpossing then - start, ok = kernrun(start,k_run_single, font,attr,lookupcache,step,dataset,sequence,rlmode,skiphash,handler) + start = kernrun(start,k_run_single, font,attr,lookupcache,step,dataset,sequence,rlmode,skiphash,handler) elseif forcetestrun then - start, ok = testrun(start,t_run_single,c_run_single,font,attr,lookupcache,step,dataset,sequence,rlmode,skiphash,handler) + start = testrun(start,t_run_single,c_run_single,font,attr,lookupcache,step,dataset,sequence,rlmode,skiphash,handler) else - start, ok = comprun(start,c_run_single, font,attr,lookupcache,step,dataset,sequence,rlmode,skiphash,handler) + start = comprun(start,c_run_single, font,attr,lookupcache,step,dataset,sequence,rlmode,skiphash,handler) end - -- if ok then - -- done = true - -- end else start = getnext(start) end @@ -4052,17 +4113,13 @@ do start = getnext(start) elseif id == disc_code then if not discs or discs[start] == true then - local ok if gpossing then - start, ok = kernrun(start,k_run_multiple, font,attr,steps,nofsteps,dataset,sequence,rlmode,skiphash,handler) + start = kernrun(start,k_run_multiple, font,attr,steps,nofsteps,dataset,sequence,rlmode,skiphash,handler) elseif forcetestrun then - start, ok = testrun(start,t_run_multiple,c_run_multiple,font,attr,steps,nofsteps,dataset,sequence,rlmode,skiphash,handler) + start = testrun(start,t_run_multiple,c_run_multiple,font,attr,steps,nofsteps,dataset,sequence,rlmode,skiphash,handler) else - start, ok = comprun(start,c_run_multiple, font,attr,steps,nofsteps,dataset,sequence,rlmode,skiphash,handler) + start = comprun(start,c_run_multiple, font,attr,steps,nofsteps,dataset,sequence,rlmode,skiphash,handler) end - -- if ok then - -- done = true - -- end else start = getnext(start) end @@ -4184,7 +4241,7 @@ do start = getnext(start) -- elseif id == par_code and startofpar(start) then -- rlparmode, rlmode = pardirstate(start) - -- start = getnext(start) + -- start = nxt else start = getnext(start) end @@ -4274,8 +4331,8 @@ registerotffeature { } } --- Moved here (up) a bit. This doesn't really belong in generic so it will --- move to a context module some day. +-- Moved here (up) a bit. This doesn't really belong in generic so it will move to a +-- context module some day. local function markinitializer(tfmdata,value) local properties = tfmdata.properties diff --git a/tex/context/base/mkiv/font-shp.lua b/tex/context/base/mkiv/font-shp.lua index 2ca3011a5..cab4b7540 100644 --- a/tex/context/base/mkiv/font-shp.lua +++ b/tex/context/base/mkiv/font-shp.lua @@ -17,7 +17,7 @@ local pfb = fonts.handlers.pfb local hashes = fonts.hashes local identifiers = hashes.identifiers -local version = otf.version or 0.011 +local version = otf.version or 0.013 local shapescache = containers.define("fonts", "shapes", version, true) local streamscache = containers.define("fonts", "streams", version, true) diff --git a/tex/context/base/mkiv/math-dir.lua b/tex/context/base/mkiv/math-dir.lua index f26324ed9..f0298d243 100644 --- a/tex/context/base/mkiv/math-dir.lua +++ b/tex/context/base/mkiv/math-dir.lua @@ -142,6 +142,7 @@ function directions.processmath(head) -- style, penalties return processmath(head) end end + return head end function directions.setmath(n) diff --git a/tex/context/base/mkiv/mult-low.lua b/tex/context/base/mkiv/mult-low.lua index e8ce240f0..e4566b7e4 100644 --- a/tex/context/base/mkiv/mult-low.lua +++ b/tex/context/base/mkiv/mult-low.lua @@ -101,9 +101,9 @@ return { "adjustnodecode", "ligaturenodecode", "discretionarynodecode", "whatsitnodecode", "mathnodecode", "gluenodecode", "kernnodecode", "penaltynodecode", "unsetnodecode", "mathsnodecode", -- - "charifcode", "catifcode", "numifcode", "dimifcode", "oddifcode", "vmodeifcode", "hmodeifcode", - "mmodeifcode", "innerifcode", "voidifcode", "hboxifcode", "vboxifcode", "xifcode", "eofifcode", - "trueifcode", "falseifcode", "caseifcode", "definedifcode", "csnameifcode", "fontcharifcode", + -- "charifcode", "catifcode", "numifcode", "dimifcode", "oddifcode", "vmodeifcode", "hmodeifcode", + -- "mmodeifcode", "innerifcode", "voidifcode", "hboxifcode", "vboxifcode", "xifcode", "eofifcode", + -- "trueifcode", "falseifcode", "caseifcode", "definedifcode", "csnameifcode", "fontcharifcode", -- "overrulemathcontrolcode", "underrulemathcontrolcode", "radicalrulemathcontrolcode", "fractionrulemathcontrolcode", "accentskewhalfmathcontrolcode", "accentskewapplymathcontrolcode", "applyordinarykernpairmathcontrolcode", @@ -112,10 +112,11 @@ return { "applytextitalickernmathcontrolcode", "applyscriptitalickernmathcontrolcode", "checkspaceitalickernmathcontrolcode", "checktextitalickernmathcontrolcode", "analyzescriptnucleuscharmathcontrolcode", "analyzescriptnucleuslistmathcontrolcode", "analyzescriptnucleusboxmathcontrolcode", + "accenttopskewwithoffsetmathcontrolcode", "ignorekerndimensionsmathcontrolcode", -- "noligaturingglyphoptioncode", "nokerningglyphoptioncode", "noexpansionglyphoptioncode", "noprotrusionglyphoptioncode", "noleftkerningglyphoptioncode", "noleftligaturingglyphoptioncode", "norightkerningglyphoptioncode", "norightligaturingglyphoptioncode", - "noitaliccorrectionglyphoptioncode", + "noitaliccorrectionglyphoptioncode", "islargeoperatorglyphoptioncode", "hasitalicshapeglyphoptioncode", -- "normalparcontextcode", "vmodeparcontextcode", "vboxparcontextcode", "vtopparcontextcode", "vcenterparcontextcode", "vadjustparcontextcode", "insertparcontextcode", "outputparcontextcode", "alignparcontextcode", @@ -217,6 +218,7 @@ return { "flattenclassoptioncode", "omitpenaltyclassoptioncode", "unpackclassoptioncode", "raiseprimeclassoptioncode", "carryoverlefttopkernclassoptioncode", "carryoverleftbottomkernclassoptioncode", "carryoverrighttopkernclassoptioncode", "carryoverrightbottomkernclassoptioncode", "preferdelimiterdimensionsclassoptioncode", "autoinjectclassoptioncode", "removeitaliccorrectionclassoptioncode", + "operatoritaliccorrectionclassoptioncode", -- "noligaturingglyphoptioncode", "nokerningglyphoptioncode", "noleftligatureglyphoptioncode", "noleftkernglyphoptioncode", "norightligatureglyphoptioncode", "norightkernglyphoptioncode", diff --git a/tex/context/base/mkiv/mult-prm.lua b/tex/context/base/mkiv/mult-prm.lua index 546b93af3..60fb704d4 100644 --- a/tex/context/base/mkiv/mult-prm.lua +++ b/tex/context/base/mkiv/mult-prm.lua @@ -164,6 +164,8 @@ return { "Umathradicaldegreeafter", "Umathradicaldegreebefore", "Umathradicaldegreeraise", + "Umathradicalextensibleafter", + "Umathradicalextensiblebefore", "Umathradicalkern", "Umathradicalrule", "Umathradicalvariant", @@ -256,12 +258,14 @@ return { "aligntab", "allcrampedstyles", "alldisplaystyles", + "allmainstyles", "allmathstyles", "allscriptscriptstyles", "allscriptstyles", "allsplitstyles", "alltextstyles", "alluncrampedstyles", + "allunsplitstyles", "atendofgroup", "atendofgrouped", "attribute", @@ -411,6 +415,8 @@ return { "ifparameters", "ifrelax", "iftok", + "ifzerodim", + "ifzeronum", "ignorearguments", "ignorepars", "immediate", diff --git a/tex/context/base/mkiv/pack-cut.mkiv b/tex/context/base/mkiv/pack-cut.mkiv index 84c14d648..533440efd 100644 --- a/tex/context/base/mkiv/pack-cut.mkiv +++ b/tex/context/base/mkiv/pack-cut.mkiv @@ -102,9 +102,8 @@ \vss}% \hss}} -\unexpanded\def\makecutbox#1% - {\bgroup - \d_pack_cutmarks_height\ht#1% +\unexpanded\def\makecutbox#1% not grouped ! + {\d_pack_cutmarks_height\ht#1% \d_pack_cutmarks_depth \dp#1% \d_pack_cutmarks_width \wd#1% \setbox#1\hpack @@ -155,8 +154,7 @@ \box#1}% \wd#1\d_pack_cutmarks_width \ht#1\d_pack_cutmarks_height - \dp#1\d_pack_cutmarks_depth - \egroup} + \dp#1\d_pack_cutmarks_depth} \unexpanded\def\cuthbox{\hpack\bgroup\dowithnextbox{\makecutbox\nextbox\flushnextbox\egroup}\hbox} \unexpanded\def\cutvbox{\vpack\bgroup\dowithnextbox{\makecutbox\nextbox\flushnextbox\egroup}\vbox} diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf index fb4443218..982b677cd 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 d75e37cee..9469ffdf0 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/mkiv/strc-doc.lua b/tex/context/base/mkiv/strc-doc.lua index d613d1aa7..7a79a7121 100644 --- a/tex/context/base/mkiv/strc-doc.lua +++ b/tex/context/base/mkiv/strc-doc.lua @@ -168,9 +168,9 @@ end local lastsaved = 0 function sections.save(sectiondata) -local sectiondata = helpers.simplify(sectiondata) -- maybe done earlier - local numberdata = sectiondata.numberdata - local ntobesaved = #tobesaved + local sectiondata = helpers.simplify(sectiondata) -- maybe done earlier + local numberdata = sectiondata.numberdata + local ntobesaved = #tobesaved if not numberdata or sectiondata.metadata.nolist then -- stay else diff --git a/tex/context/base/mkiv/strc-lst.lua b/tex/context/base/mkiv/strc-lst.lua index 865c44624..4a190132b 100644 --- a/tex/context/base/mkiv/strc-lst.lua +++ b/tex/context/base/mkiv/strc-lst.lua @@ -263,6 +263,14 @@ function lists.addto(t) -- maybe more more here (saves parsing at the tex end) if r and not r.section then r.section = structures.sections.currentid() end + local b = r and t.block + if r and not b then + local s = r.section + if s then + s = structures.sections.tobesaved[s] + r.block = s and s.block or nil + end + end local i = r and r.internal or 0 -- brrr if r and kind and name then local tag = tags.getid(kind,name) @@ -834,6 +842,7 @@ filters[v_default] = function(specification) -- is named for i=1,#collected do local v = collected[i] local r = v.references +-- inspect(v) if r and (not block or not r.block or pblock == r.block) then local sectionnumber = sections[r.section] if sectionnumber then diff --git a/tex/context/base/mkiv/type-set.mkiv b/tex/context/base/mkiv/type-set.mkiv index 3447c4e6e..269d41966 100644 --- a/tex/context/base/mkiv/type-set.mkiv +++ b/tex/context/base/mkiv/type-set.mkiv @@ -132,6 +132,7 @@ \definefilesynonym [type-imp-coloredsheep.mkiv] [type-imp-koeielettersot.mkiv] \definefilesynonym [type-imp-koeieletters.mkiv] [type-imp-koeielettersot.mkiv] +%definefilesynonym [type-imp-xits.mkiv] [type-imp-stix.mkiv] \definefilesynonym [type-imp-stixtwo.mkiv] [type-imp-stix.mkiv] \definefilesynonym [type-imp-ibmplex.mkiv] [type-imp-plex.mkiv] diff --git a/tex/context/base/mkxl/anch-pgr.lmt b/tex/context/base/mkxl/anch-pgr.lmt index 5ef6ecacb..575d4e906 100644 --- a/tex/context/base/mkxl/anch-pgr.lmt +++ b/tex/context/base/mkxl/anch-pgr.lmt @@ -34,6 +34,7 @@ local context = context local implement = interfaces.implement local texgetcount = tex.getcount +local texiscount = tex.iscount local getmacro = tokens.getters.macro local expandasvalue = tex.expandasvalue @@ -61,6 +62,8 @@ local f_pair = formatters["(%p,%p)"] local f_path = formatters["%--t--cycle"] local f_pair_i = formatters["(%r,%r)"] -- rounded +local c_realpageno = texiscount("realpageno") + graphics = graphics or { } local backgrounds = { } graphics.backgrounds = backgrounds @@ -254,7 +257,7 @@ end nodes.handlers.textbackgrounds = function(head,where,parent) -- we have hlistdir and local dir -- todo enable action in register index = index + 1 - realpage = texgetcount("realpageno") + realpage = texgetcount(c_realpageno) return processranges(a_textbackground,flush,head,parent) end @@ -1214,7 +1217,7 @@ backgrounds.fetchmultipar = fetchmultipar local function getwhatever(action) local tags = scanmpstring() local anchor = scanmpstring() - local page = texgetcount("realpageno") + local page = texgetcount(c_realpageno) if tags == "self" then tags = expandasvalue(string_value,"mpcategoryparameter",true,"self") elseif type(tags) == "string" then diff --git a/tex/context/base/mkxl/anch-pos.lmt b/tex/context/base/mkxl/anch-pos.lmt index fc668f699..6488a2fd7 100644 --- a/tex/context/base/mkxl/anch-pos.lmt +++ b/tex/context/base/mkxl/anch-pos.lmt @@ -65,6 +65,8 @@ local tex = tex local texgetdimen = tex.getdimen local texgetcount = tex.getcount local texgetinteger = tex.getintegervalue or tex.getcount +local texiscount = tex.iscount +local texisdimen = tex.isdimen local texsetcount = tex.setcount local texget = tex.get local texsp = tex.sp @@ -133,15 +135,19 @@ local default = { -- not r and paragraphs etc } } -local f_b_tag = formatters["b:%s"] -local f_e_tag = formatters["e:%s"] -local f_p_tag = formatters["p:%s"] ------ f_w_tag = formatters["w:%s"] +local f_b_tag = formatters["b:%s"] +local f_e_tag = formatters["e:%s"] +local f_p_tag = formatters["p:%s"] +----- f_w_tag = formatters["w:%s"] -local f_region = formatters["region:%s"] +local f_region = formatters["region:%s"] -local f_tag_three = formatters["%s:%s:%s"] -local f_tag_two = formatters["%s:%s"] +local f_tag_three = formatters["%s:%s:%s"] +local f_tag_two = formatters["%s:%s"] + +local c_realpageno = texiscount("realpageno") +local d_strutht = texisdimen("strutht") +local d_strutdp = texisdimen("strutdp") -- Because positions are set with a delay we cannot yet make the tree -- so that -- is a finalizer step. But, we already have a dual split. @@ -902,7 +908,7 @@ local function enhance(data) data.y = y ~= 0 and y or nil end if data.p == true then - data.p = texgetcount("realpageno") -- we should use a variable set in otr + data.p = texgetcount(c_realpageno) -- we should use a variable set in otr end if data.c == true then data.c = column @@ -1075,7 +1081,7 @@ local function b_region(specification) local x, y = getpos() last.x = x ~= 0 and x or nil last.y = y ~= 0 and y or nil - last.p = texgetcount("realpageno") + last.p = texgetcount(c_realpageno) insert(regions,tag) -- todo: fast stack region = tag end @@ -1117,7 +1123,7 @@ local function setregionbox(n,tag,index,k,lo,ro,to,bo,column) -- kind -- these auto regions (comning from framed). Too messy and the split in the -- setter is fast enough. tobesaved[tag] = { - -- p = texgetcount("realpageno"), -- we copy them + -- p = texgetcount(c_realpageno), -- we copy them x = 0, y = 0, w = w ~= 0 and w or nil, @@ -1191,6 +1197,8 @@ end do + local c_anch_positions_paragraph = texiscount("c_anch_positions_paragraph") + local nofparagraphs = 0 local function enhancepar_1(data) @@ -1205,7 +1213,7 @@ do if y ~= 0 then data.y = y end - data.p = texgetcount("realpageno") -- we should use a variable set in otr + data.p = texgetcount(c_realpageno) -- we should use a variable set in otr if column then data.c = column end @@ -1253,7 +1261,7 @@ do if y ~= 0 then data.y = y end - data.p = texgetcount("realpageno") -- we should use a variable set in otr + data.p = texgetcount(c_realpageno) if column then data.c = column end @@ -1268,10 +1276,10 @@ do name = "parpos", actions = function() nofparagraphs = nofparagraphs + 1 - texsetcount("global","c_anch_positions_paragraph",nofparagraphs) + texsetcount("global",c_anch_positions_paragraph,nofparagraphs) local name = f_p_tag(nofparagraphs) - local h = texgetdimen("strutht") - local d = texgetdimen("strutdp") + local h = texgetdimen(d_strutht) + local d = texgetdimen(d_strutdp) -- local top = texgetnest("top","head") local nxt = top.next @@ -1429,8 +1437,8 @@ do public = true, protected = true, actions = function(name) - local h = texgetdimen("strutht") - local d = texgetdimen("strutdp") + local h = texgetdimen(d_strutht) + local d = texgetdimen(d_strutdp) local spec = { p = true, c = column, @@ -1453,8 +1461,8 @@ do public = true, protected = true, actions = function(name,kind) - local h = texgetdimen("strutht") - local d = texgetdimen("strutdp") + local h = texgetdimen(d_strutht) + local d = texgetdimen(d_strutdp) local spec = { k = kind, p = true, @@ -1476,7 +1484,7 @@ end function jobpositions.getreserved(tag,n) if tag == v_column then - local fulltag = f_tag_three(tag,texgetcount("realpageno"),n or 1) + local fulltag = f_tag_three(tag,texgetcount(c_realpageno),n or 1) local data = collected[fulltag] if data then return data, fulltag @@ -1484,7 +1492,7 @@ function jobpositions.getreserved(tag,n) tag = v_text end if tag == v_text then - local fulltag = f_tag_two(tag,texgetcount("realpageno")) + local fulltag = f_tag_two(tag,texgetcount(c_realpageno)) return collected[fulltag] or false, fulltag end return collected[tag] or false, tag @@ -2257,7 +2265,7 @@ implement { public = true, protected = true, actions = function(list) - doifelse(onsamepage(list,tostring(texgetcount("realpageno")))) + doifelse(onsamepage(list,tostring(texgetcount(c_realpageno)))) end } diff --git a/tex/context/base/mkxl/anch-pos.mkxl b/tex/context/base/mkxl/anch-pos.mkxl index fef8e54f6..f8891eb33 100644 --- a/tex/context/base/mkxl/anch-pos.mkxl +++ b/tex/context/base/mkxl/anch-pos.mkxl @@ -17,10 +17,19 @@ %D early, but starting in 2012 more dramatic changes started to happen, especially %D in relation to background graphics. It will probably take some time to settle. -\registerctxluafile{anch-pos}{autosuffix} - \unprotect +\newcount\c_anch_column % will be delegated to lua +\newcount\c_anch_text % will be delegated to lua +\newcount\c_anch_free +\newtoks \t_anch_positions_tracers +\newcount\c_anch_positions_paragraph + +\newbox \b_anch_position +\newif \ifpositioning % sort of public + +\registerctxluafile{anch-pos}{autosuffix} + %D The first application of positional information was embedded graphics. Since we %D are interacting with text, it made sense to take the current line height and %D depth into account too. This is why we have position macros for simple positions @@ -43,8 +52,8 @@ % \dosetpositionstrut #1 % defined at lua end % \dosetpositionstrutkind #1#2 % defined at lua end -\newbox\b_anch_position -\newif \ifpositioning % sort of public +% see top: \newbox\b_anch_position +% see top: \newif \ifpositioning % sort of public \mutable\let\currentposition \empty \mutable\let\currentpositionaction\empty @@ -282,8 +291,8 @@ \permanent\def\textanchor {text:\the\realpageno} \permanent\def\regionanchor{region:0} -\newcount\c_anch_column % will be delegated to lua -\newcount\c_anch_text % will be delegated to lua +% see top: \newcount\c_anch_column % will be delegated to lua +% see top: \newcount\c_anch_text % will be delegated to lua % beware we need to pass \somethingexpanded or { } @@ -336,7 +345,7 @@ \expandafter\gobblesixarguments \fi} -\newcount\c_anch_free +% see top: \newcount\c_anch_free \protected\def\anch_mark_tagged_box_free_yes#1#2#3#4#5#6% only needed when positions {\global\advance\c_anch_free\plusone % could be done at the lua end @@ -408,8 +417,8 @@ %D can keep track of them. This mechanism is activated automatically based on %D information collected in the previous pass. -\newtoks \t_anch_positions_tracers -\newcount\c_anch_positions_paragraph +% see top: \newtoks \t_anch_positions_tracers +% see top: \newcount\c_anch_positions_paragraph \permanent\protected\def\tracepositions {\the\t_anch_positions_tracers} diff --git a/tex/context/base/mkxl/buff-ini.lmt b/tex/context/base/mkxl/buff-ini.lmt index 985c834ff..1d4722531 100644 --- a/tex/context/base/mkxl/buff-ini.lmt +++ b/tex/context/base/mkxl/buff-ini.lmt @@ -573,7 +573,7 @@ local function savebuffer(list,name,prefix,option,directory) -- name is optional if directory ~= "" and dir.makedirs(directory) then name = file.join(directory,name) end - io.savedata(name,replacenewlines(content),"\n",option == v_append) + savedata(name,replacenewlines(content),"\n",option == v_append) end implement { diff --git a/tex/context/base/mkxl/cont-new.mkxl b/tex/context/base/mkxl/cont-new.mkxl index 5fb6ae5b6..e8f8e5e2e 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{2022.09.16 14:39} +\newcontextversion{2022.10.14 10:13} %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 cd7075d5e..bf5dd9a07 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{2022.09.16 14:39} +\immutable\edef\contextversion{2022.10.14 10:13} %overloadmode 1 % check frozen / warning %overloadmode 2 % check frozen / error diff --git a/tex/context/base/mkxl/core-env.lmt b/tex/context/base/mkxl/core-env.lmt index 486beeec4..f5b382f12 100644 --- a/tex/context/base/mkxl/core-env.lmt +++ b/tex/context/base/mkxl/core-env.lmt @@ -135,30 +135,30 @@ end) tex.isdefined = isdefined -function tex.isdimen(name) - local hit = cache[name] - return hit.command == dimencode and hit.index or true -end - -function tex.iscount(name) - local hit = cache[name] - return hit.command == countcode and hit.index or true -end - -function tex.istoken(name) - local hit = cache[name] - return hit.command == tokencode and hit.index or true -end - -function tex.isskip(name) - local hit = cache[name] - return hit.command == skipcode and hit.index or true -end - -function tex.ismuskip(name) - local hit = cache[name] - return hit.command == muskipcode and hit.index or true -end +-- function tex.isdimen(name) +-- local hit = cache[name] +-- return hit.command == dimencode and hit.index or true +-- end +-- +-- function tex.iscount(name) +-- local hit = cache[name] +-- return hit.command == countcode and hit.index or true +-- end +-- +-- function tex.istoken(name) +-- local hit = cache[name] +-- return hit.command == tokencode and hit.index or true +-- end +-- +-- function tex.isskip(name) +-- local hit = cache[name] +-- return hit.command == skipcode and hit.index or true +-- end +-- +-- function tex.ismuskip(name) +-- local hit = cache[name] +-- return hit.command == muskipcode and hit.index or true +-- end function tex.type(name) return types[cache[name].command] or "macro" diff --git a/tex/context/base/mkxl/core-uti.lmt b/tex/context/base/mkxl/core-uti.lmt index 2266119de..d533de5f3 100644 --- a/tex/context/base/mkxl/core-uti.lmt +++ b/tex/context/base/mkxl/core-uti.lmt @@ -448,8 +448,8 @@ end) function statistics.formatruntime(runtime) if not environment.initex then -- else error when testing as not counters yet -- stoptiming(statistics) -- to be sure - local shipped = texgetcount('nofshipouts') - local pages = texgetcount('realpageno') + local shipped = texgetcount("nofshipouts") + local pages = texgetcount("realpageno") if pages > shipped then pages = shipped end diff --git a/tex/context/base/mkxl/font-con.lmt b/tex/context/base/mkxl/font-con.lmt index ddaf8afb1..319d5fe48 100644 --- a/tex/context/base/mkxl/font-con.lmt +++ b/tex/context/base/mkxl/font-con.lmt @@ -533,12 +533,6 @@ function constructors.scale(tfmdata,specification) targetparameters.scriptscale = scriptscale targetparameters.scriptscriptscale = scriptscriptscale - -- todo: maybe retrofit to font-con.lua - - local oldmath = properties.oldmath - targetproperties.oldmath = oldmath - target.oldmath = oldmath - local mathcontrol = properties.mathcontrol targetproperties.mathcontrol = mathcontrol target.mathcontrol = mathcontrol @@ -706,10 +700,26 @@ function constructors.scale(tfmdata,specification) if vi and vi ~= 0 then chr.vitalic = vi*hdelta end - local va = character.accent +-- local va = character.accent +-- if va and not chr.topanchor then +-- chr.topanchor = va +-- end + local va = character.topanchor + if va then + chr.topanchor = va*vdelta + end + va = character.bottomanchor if va then - chr.topaccent = va*vdelta + chr.bottomanchor = va*vdelta end + local vo = character.topovershoot + if vo then + chr.topovershoot = vo*hdelta + end + -- vo = character.bottomovershoot + -- if vo then + -- chr.bottomovershoot = vo*hdelta + -- end if stackmath then -- not ok yet local mk = character.mathkerns if mk then @@ -755,6 +765,10 @@ function constructors.scale(tfmdata,specification) if sm then chr.smaller = sm end + local mi = character.mirror + if mi then + chr.mirror = mi + end local fa = character.flataccent if fa then chr.flataccent = fa diff --git a/tex/context/base/mkxl/font-ctx.lmt b/tex/context/base/mkxl/font-ctx.lmt index 585547cbf..75572e089 100644 --- a/tex/context/base/mkxl/font-ctx.lmt +++ b/tex/context/base/mkxl/font-ctx.lmt @@ -1221,23 +1221,23 @@ do -- else too many locals "integer", }, actions = function ( - global, -- \ifx\fontclass\empty\s!false\else\s!true\fi - cs, -- {#csname}% - str, -- \somefontfile - size, -- \d_font_scaled_font_size - inheritancemode, -- \c_font_feature_inheritance_mode - classfeatures, -- \m_font_class_features - fontfeatures, -- \m_font_features - classfallbacks, -- \m_font_class_fallbacks - fontfallbacks, -- \m_font_fallbacks - mathsize, -- \fontface - textsize, -- \d_font_scaled_text_face - classgoodies, -- \m_font_class_goodies - goodies, -- \m_font_goodies - classdesignsize, -- \m_font_class_designsize - fontdesignsize, -- \m_font_designsize - scaledfontmode -- \scaledfontmode - ) + global, -- \ifx\fontclass\empty\s!false\else\s!true\fi + cs, -- {#csname}% + str, -- \somefontfile + size, -- \d_font_scaled_font_size + inheritancemode, -- \c_font_feature_inheritance_mode + classfeatures, -- \m_font_class_features + fontfeatures, -- \m_font_features + classfallbacks, -- \m_font_class_fallbacks + fontfallbacks, -- \m_font_fallbacks + mathsize, -- \fontface + textsize, -- \d_font_scaled_text_face + classgoodies, -- \m_font_class_goodies + goodies, -- \m_font_goodies + classdesignsize, -- \m_font_class_designsize + fontdesignsize, -- \m_font_designsize + scaledfontmode -- \scaledfontmode + ) if trace_defining then report_defining("start stage two: %s, size %s, features %a & %a, mode %a",str,size,classfeatures,fontfeatures,inheritancemode) end @@ -1397,7 +1397,7 @@ do -- else too many locals busy = false mathematics.finishfallbacks(tfmdata,specification,fallbacks) tfmdata.original = specification.specification -constructors.beforepassingfonttotex(tfmdata) + constructors.beforepassingfonttotex(tfmdata) local id = definefont(tfmdata,properties.id) csnames[id] = specification.cs properties.id = id -- already set diff --git a/tex/context/base/mkxl/font-imp-effects.lmt b/tex/context/base/mkxl/font-imp-effects.lmt index 38d86498a..8dce81087 100644 --- a/tex/context/base/mkxl/font-imp-effects.lmt +++ b/tex/context/base/mkxl/font-imp-effects.lmt @@ -238,11 +238,12 @@ local function manipulateeffect(tfmdata) parameters.hshift = hshift parameters.vshift = vshift for unicode, character in next, characters do - local oldwidth = character.width - local oldheight = character.height - local olddepth = character.depth - local olditalic = character.italic - local oldtopaccent = character.topaccent + local oldwidth = character.width + local oldheight = character.height + local olddepth = character.depth + local olditalic = character.italic + local oldtopanchor = character.topanchor + local oldbottomanchor = character.bottomanchor if oldwidth and oldwidth > 0 then character.width = oldwidth + wdelta end @@ -252,13 +253,16 @@ local function manipulateeffect(tfmdata) if olddepth and olddepth > 0 then character.depth = olddepth + ddelta end - if olditalic or oldtopaccent then + if olditalic or oldtopaccent or oldbottomaccent then local factor = character.width / oldwidth if olditalic and olditalic > 0 then character.italic = olditalic * factor end - if oldtopaccent and oldtopaccent > 0 then - character.topaccent = oldtopaccent * factor + if oldtopanchor and oldtopanchor > 0 then + character.topanchor = oldtopanchor * factor + end + if oldbottomanchor and oldbottomanchor > 0 then + character.bottomanchor = oldbottomanchor * factor end end end diff --git a/tex/context/base/mkxl/font-imp-math.lmt b/tex/context/base/mkxl/font-imp-math.lmt index 9811cb7c8..04fe5c04c 100644 --- a/tex/context/base/mkxl/font-imp-math.lmt +++ b/tex/context/base/mkxl/font-imp-math.lmt @@ -224,30 +224,6 @@ registerotffeature { -- end -- end -local function initialize(tfmdata,value) - if value then - local rawdata = tfmdata.shared.rawdata - local rawresources = rawdata and rawdata.resources - local mathconstants = rawresources.mathconstants - if mathconstants then - tfmdata.properties.oldmath = true - end - end -end - -registerotffeature { - name = "oldmath", - description = "deal with fake opentype fonts", - -- manipulators = { - -- base = manipulate, - -- node = manipulate, - -- }, - initializers = { - base = initialize, - node = initialize, - } -} - local function initialize(tfmdata,value) if type(value) == "string" then local rawdata = tfmdata.shared.rawdata @@ -318,46 +294,45 @@ registerotffeature { -- is. So the quick and dirty solution is: -- -- add copies in private slots --- use a pseudo feature to acess those +-- use a pseudo feature to access those -- and optionally afterwards replace the original slots -local coverage = { } - -local function initialize(tfmdata,value) - if value then - if not next(coverage) then - for k, char in next, mathematics.alphabets.sr.tf.lcletters do - coverage[char] = 0xFE800 + k - end - for k, char in next, mathematics.alphabets.sr.tf.ucletters do - coverage[char] = 0xFE800 + k - end - fonts.handlers.otf.addfeature { - name = "savemathscripts", - type = "substitution", - data = coverage, - } - end - local characters = tfmdata.characters - local descriptions = tfmdata.descriptions - for char, private in next, coverage do - local data = characters[char] - if data and not characters[private] then - -- otherwise we need a virtual - characters [private] = copytable(data) - descriptions[private] = copytable(descriptions[char]) - end - end - end -end - -registerotffeature { - name = "copymathscripts", - description = "copy math script", - prepend = 1, - initializers = { - base = initialize, - node = initialize, - } -} - +-- local coverage = { } +-- +-- local function initialize(tfmdata,value) +-- if value then +-- if not next(coverage) then +-- for k, char in next, mathematics.alphabets.sr.tf.lcletters do +-- coverage[char] = 0xFE800 + k +-- end +-- for k, char in next, mathematics.alphabets.sr.tf.ucletters do +-- coverage[char] = 0xFE800 + k +-- end +-- fonts.handlers.otf.addfeature { +-- name = "savemathscripts", +-- type = "substitution", +-- data = coverage, +-- } +-- end +-- local characters = tfmdata.characters +-- local descriptions = tfmdata.descriptions +-- for char, private in next, coverage do +-- local data = characters[char] +-- if data and not characters[private] then +-- -- otherwise we need a virtual +-- characters [private] = copytable(data) +-- descriptions[private] = copytable(descriptions[char]) +-- end +-- end +-- end +-- end +-- +-- registerotffeature { +-- name = "copymathscripts", +-- description = "copy math script", +-- prepend = 1, +-- initializers = { +-- base = initialize, +-- node = initialize, +-- } +-- } diff --git a/tex/context/base/mkxl/font-ini.mklx b/tex/context/base/mkxl/font-ini.mklx index 473f37da2..67663b7db 100644 --- a/tex/context/base/mkxl/font-ini.mklx +++ b/tex/context/base/mkxl/font-ini.mklx @@ -657,8 +657,8 @@ % 4:x{\definedfont[Serif sa 4]x}\par % 5:x{\definedfont[Serif sa 5]x}\par -\permanent\def\safontscale{\number\dimexpr\v_font_size_absolute\relax} -\permanent\def\mofontscale{\number\dimexpr\font_basics_set_mapped_fontsize\v_font_size_absolute\relax} +% \permanent\def\safontscale{\number\dimexpr\v_font_size_absolute\relax} +% \permanent\def\mofontscale{\number\dimexpr\font_basics_set_mapped_fontsize\v_font_size_absolute\relax} \mutable\let\somefontname \s!unknown \mutable\let\somefontspec \s!unknown @@ -991,7 +991,7 @@ \newif\ifskipfontcharacteristics \skipfontcharacteristicstrue -\tracingfonts\plussix % +% \tracingfonts\plussix % %D When fontclasses are used, we define the font global, since namespaces are %D used. Otherwise we parse the specs each time. diff --git a/tex/context/base/mkxl/font-mat.mklx b/tex/context/base/mkxl/font-mat.mklx index 20925157b..0f3a2a222 100644 --- a/tex/context/base/mkxl/font-mat.mklx +++ b/tex/context/base/mkxl/font-mat.mklx @@ -15,6 +15,26 @@ \unprotect +%D The original (\MKIV) approach to bidi is that we have two extra families for +%D regular, bold and pseudobold: +%D +%D regular normal=0 l2r=1 r2l=2 +%D bold normal=3 l2r=4 r2l=5 +%D pseudobold normal=6 l2r=7 r2l=8 +%D +%D where l2r is just an alias. Because we're now using the mirror lookup (like +%D we do a smaller lookup) in the engine we not just have: +%D +%D regular normal=0 +%D bold normal=3 +%D pseudobold normal=6 +%D +%D And when one can wonder if pseudobold is needed (just bolden); we can then +%D actually go down to only two families. It is one of these cases when it hurts +%D to throw away a nice old mechanism that worked quite well so here we keep it +%D commented. For what it's worth: this variant switches a bit faster too and +%D produces less logging but I doubt if anyone will notice that. + %D Be nice: \ifdefined\??fontinstanceready \else \installcorenamespace{fontinstanceready} \fi @@ -55,16 +75,16 @@ % todo: \c_font_fam_mr \aliased\let\c_font_fam_mr \zerocount % math regular -\aliased\let\c_font_fam_mr_lr\plusone % math regular l2r -\aliased\let\c_font_fam_mr_rl\plustwo % math regular r2l +%aliased\let\c_font_fam_mr_lr\plusone % math regular l2r +%aliased\let\c_font_fam_mr_rl\plustwo % math regular r2l \aliased\let\c_font_fam_mb \plusthree % math bold -\aliased\let\c_font_fam_mb_lr\plusfour % math bold l2r -\aliased\let\c_font_fam_mb_rl\plusfive % math bold r2l +%aliased\let\c_font_fam_mb_lr\plusfour % math bold l2r +%aliased\let\c_font_fam_mb_rl\plusfive % math bold r2l \definesystemattribute[mathfamily][public] -\newconditional\c_font_bidirectional_mathstrategy % can be default, not that much overhead: \settrue\c_font_bidirectional_mathstrategy +%newconditional\c_font_bidirectional_mathstrategy % can be default, not that much overhead: \settrue\c_font_bidirectional_mathstrategy \newconditional\c_font_complete_bold_mathstrategy \settrue\c_font_complete_bold_mathstrategy % \frozen ... @@ -106,9 +126,12 @@ \mutable\let\fontfamily\relax % for now public but it is a helper +\newconditional\c_math_last_family_set + \def\font_helpers_set_math_family_indeed_normal#mrtag#family% \fontface etc are also used later on {\let\savedfontbody\fontbody \let\fontfamily#family% + \settrue\c_math_last_family_set % the order is important as we depend on known id's when completing fonts % enabling is needed when we have fallbacks which spoils the families \let\mathsizesuffix\mathscriptscriptsuffix\let\fontface\!!plusthree @@ -139,6 +162,7 @@ \def\font_helpers_set_math_family_indeed_compact#mrtag#family% \fontface etc are also used later on {\let\savedfontbody\fontbody \let\fontfamily#family% + \settrue\c_math_last_family_set \font_helpers_set_math_family_set_scales_compact % the order is important as we depend on known id's when completing fonts % enabling is needed when we have fallbacks which spoils the families @@ -163,6 +187,7 @@ \let\defaultfontclass\fontclass % else truefontname falls back on the wrong one \let\savedfontbody\fontbody \let\fontfamily#familytag% + \settrue\c_math_last_family_set \font_helpers_set_math_family_set_scales_normal \let\mathsizesuffix\mathscriptscriptsuffix\let\fontface\!!plusthree \font_helpers_set_math_family_bold_a\scriptscriptfont#mbfam#mrfam% defines @@ -183,6 +208,7 @@ \let\defaultfontclass\fontclass % else truefontname falls back on the wrong one \let\savedfontbody\fontbody \let\fontfamily#familytag% + \settrue\c_math_last_family_set \let\mathsizesuffix\mathtextsuffix \let\fontface\!!plusone \font_helpers_set_math_family_bold_a\textfont #mbfam#mrfam% defines \font_helpers_set_math_family_bold_a\textfont #mbfam#mrfam% enables @@ -309,77 +335,114 @@ \let\m_font_fallbacks\empty \let\m_font_goodies \empty -\appendtoks % can be analyzed once - % why here .. - %\edef\m_font_class_direction{\ifcsname\??fontclass\fontclass\s!mm\s!direction\endcsname\csname\??fontclass\fontclass\s!mm\s!direction\endcsname\fi}% - \edef\m_font_class_direction{\begincsname\??fontclass\fontclass\s!mm\s!direction\endcsname}% - % ... - \ifx\m_font_class_direction\v!both - \settrue\c_font_bidirectional_mathstrategy - \else - \setfalse\c_font_bidirectional_mathstrategy - \fi -\to \t_font_math_strategies - -\def\font_helpers_bidirectional_mathstrategy_yes - {\font_helpers_set_math_family\c_font_fam_mr_lr\s!mrlr - \font_helpers_set_math_family\c_font_fam_mr_rl\s!mrrl - \ifnum\fontid\textfont\c_font_fam_mr=\fontid\textfont\c_font_fam_mr_lr\else - \font_helpers_bidirectional_mathstrategy_yes_changed - \fi} - -\def\font_helpers_bidirectional_mathstrategy_yes_changed - {\textfont \c_font_fam_mr\textfont \c_font_fam_mr_lr - \scriptfont \c_font_fam_mr\scriptfont \c_font_fam_mr_lr - \scriptscriptfont\c_font_fam_mr\scriptscriptfont\c_font_fam_mr_lr} - -\def\font_helpers_bidirectional_mathstrategy_nop - {\font_helpers_set_math_family\c_font_fam_mr\s!mr - \ifnum\fontid\textfont\c_font_fam_mr_rl=\fontid\textfont\c_font_fam_mr\else - \font_helpers_bidirectional_mathstrategy_nop_changed - \fi} - -\def\font_helpers_bidirectional_mathstrategy_nop_changed - {\textfont \c_font_fam_mr_lr\textfont \c_font_fam_mr - \scriptfont \c_font_fam_mr_lr\scriptfont \c_font_fam_mr - \scriptscriptfont\c_font_fam_mr_lr\scriptscriptfont\c_font_fam_mr - \textfont \c_font_fam_mr_rl\textfont \c_font_fam_mr - \scriptfont \c_font_fam_mr_rl\scriptfont \c_font_fam_mr - \scriptscriptfont\c_font_fam_mr_rl\scriptscriptfont\c_font_fam_mr} +% \appendtoks % can be analyzed once +% % why here .. +% %\edef\m_font_class_direction{\ifcsname\??fontclass\fontclass\s!mm\s!direction\endcsname\csname\??fontclass\fontclass\s!mm\s!direction\endcsname\fi}% +% \edef\m_font_class_direction{\begincsname\??fontclass\fontclass\s!mm\s!direction\endcsname}% +% % ... +% \ifx\m_font_class_direction\v!both +% \settrue\c_font_bidirectional_mathstrategy +% \else +% \setfalse\c_font_bidirectional_mathstrategy +% \fi +% \to \t_font_math_strategies +% +% \def\font_helpers_bidirectional_mathstrategy_yes +% {\font_helpers_set_math_family\c_font_fam_mr_lr\s!mrlr +% \font_helpers_set_math_family\c_font_fam_mr_rl\s!mrrl +% \ifnum\fontid\textfont\c_font_fam_mr=\fontid\textfont\c_font_fam_mr_lr\else +% \font_helpers_bidirectional_mathstrategy_yes_changed +% \fi} +% +% \def\font_helpers_bidirectional_mathstrategy_yes_changed +% {\textfont \c_font_fam_mr\textfont \c_font_fam_mr_lr +% \scriptfont \c_font_fam_mr\scriptfont \c_font_fam_mr_lr +% \scriptscriptfont\c_font_fam_mr\scriptscriptfont\c_font_fam_mr_lr} +% +% \def\font_helpers_bidirectional_mathstrategy_nop +% {\font_helpers_set_math_family\c_font_fam_mr\s!mr +% \ifnum\fontid\textfont\c_font_fam_mr_rl=\fontid\textfont\c_font_fam_mr\else +% \font_helpers_bidirectional_mathstrategy_nop_changed +% \fi} +% +% \def\font_helpers_bidirectional_mathstrategy_nop +% {\font_helpers_set_math_family\c_font_fam_mr\s!mr} +% +% \def\font_helpers_bidirectional_mathstrategy_nop_changed +% {\textfont \c_font_fam_mr_lr\textfont \c_font_fam_mr +% \scriptfont \c_font_fam_mr_lr\scriptfont \c_font_fam_mr +% \scriptscriptfont\c_font_fam_mr_lr\scriptscriptfont\c_font_fam_mr +% \textfont \c_font_fam_mr_rl\textfont \c_font_fam_mr +% \scriptfont \c_font_fam_mr_rl\scriptfont \c_font_fam_mr +% \scriptscriptfont\c_font_fam_mr_rl\scriptscriptfont\c_font_fam_mr} +% +% \appendtoks +% \ifconditional\c_font_bidirectional_mathstrategy +% \font_helpers_bidirectional_mathstrategy_yes +% \else +% \font_helpers_bidirectional_mathstrategy_nop +% \fi +% \to \t_font_math_strategies \appendtoks - \ifconditional\c_font_bidirectional_mathstrategy - \font_helpers_bidirectional_mathstrategy_yes - \else - \font_helpers_bidirectional_mathstrategy_nop - \fi + \font_helpers_set_math_family\c_font_fam_mr\s!mr \to \t_font_math_strategies -\def\font_helpers_complete_bold_mathstrategy_yes_bidi - {\font_helpers_set_math_family_bold\c_font_fam_mb_lr\s!mblr\c_font_fam_mr_lr - \font_helpers_set_math_family_bold\c_font_fam_mb_rl\s!mbrl\c_font_fam_mr_rl - \ifnum\fontid\textfont\c_font_fam_mb=\fontid\textfont\c_font_fam_mb_lr\else - \font_helpers_complete_bold_mathstrategy_yes_bidi_changed - \fi} - -\def\font_helpers_complete_bold_mathstrategy_yes_bidi_changed - {\textfont \c_font_fam_mb\textfont \c_font_fam_mb_lr - \scriptfont \c_font_fam_mb\scriptfont \c_font_fam_mb_lr - \scriptscriptfont\c_font_fam_mb\scriptscriptfont\c_font_fam_mb_lr} +% \def\font_helpers_complete_bold_mathstrategy_yes_bidi +% {\font_helpers_set_math_family_bold\c_font_fam_mb_lr\s!mblr\c_font_fam_mr_lr +% \font_helpers_set_math_family_bold\c_font_fam_mb_rl\s!mbrl\c_font_fam_mr_rl +% \ifnum\fontid\textfont\c_font_fam_mb=\fontid\textfont\c_font_fam_mb_lr\else +% \font_helpers_complete_bold_mathstrategy_yes_bidi_changed +% \fi} +% +% \def\font_helpers_complete_bold_mathstrategy_yes_bidi_changed +% {\textfont \c_font_fam_mb\textfont \c_font_fam_mb_lr +% \scriptfont \c_font_fam_mb\scriptfont \c_font_fam_mb_lr +% \scriptscriptfont\c_font_fam_mb\scriptscriptfont\c_font_fam_mb_lr} +% +% \def\font_helpers_complete_bold_mathstrategy_yes +% {\font_helpers_set_math_family_bold\c_font_fam_mb\s!mb\c_font_fam_mr\relax +% \ifnum\fontid\textfont\c_font_fam_mb_rl=\fontid\textfont\c_font_fam_mb\else +% \font_helpers_complete_bold_mathstrategy_yes_changed +% \fi} +% +% \def\font_helpers_complete_bold_mathstrategy_yes_changed +% {\textfont \c_font_fam_mb_rl\textfont \c_font_fam_mb +% \scriptfont \c_font_fam_mb_rl\scriptfont \c_font_fam_mb +% \scriptscriptfont\c_font_fam_mb_rl\scriptscriptfont\c_font_fam_mb +% \textfont \c_font_fam_mb_lr\textfont \c_font_fam_mb +% \scriptfont \c_font_fam_mb_lr\scriptfont \c_font_fam_mb +% \scriptscriptfont\c_font_fam_mb_lr\scriptscriptfont\c_font_fam_mb} +% +% \def\font_helpers_complete_bold_mathstrategy_nop +% {\ifnum\fontid\textfont\c_font_fam_mb=\fontid\textfont\c_font_fam_mr\else +% \font_helpers_complete_bold_mathstrategy_nop_changed +% \fi} +% +% \def\font_helpers_complete_bold_mathstrategy_nop_changed +% {\textfont \c_font_fam_mb \textfont \c_font_fam_mr +% \scriptfont \c_font_fam_mb \scriptfont \c_font_fam_mr +% \scriptscriptfont\c_font_fam_mb \scriptscriptfont\c_font_fam_mr +% \textfont \c_font_fam_mb_lr\textfont \c_font_fam_mr_lr +% \scriptfont \c_font_fam_mb_lr\scriptfont \c_font_fam_mr_lr +% \scriptscriptfont\c_font_fam_mb_lr\scriptscriptfont\c_font_fam_mr_lr +% \textfont \c_font_fam_mb_rl\textfont \c_font_fam_mr_rl +% \scriptfont \c_font_fam_mb_rl\scriptfont \c_font_fam_mr_rl +% \scriptscriptfont\c_font_fam_mb_rl\scriptscriptfont\c_font_fam_mr_rl} +% +% \def\font_helpers_apply_complete_bold_mathstrategy +% {\ifconditional\c_font_complete_bold_mathstrategy +% \ifconditional\c_font_bidirectional_mathstrategy +% \font_helpers_complete_bold_mathstrategy_yes_bidi +% \else +% \font_helpers_complete_bold_mathstrategy_yes +% \fi +% \else +% \font_helpers_complete_bold_mathstrategy_nop +% \fi} \def\font_helpers_complete_bold_mathstrategy_yes - {\font_helpers_set_math_family_bold\c_font_fam_mb\s!mb\c_font_fam_mr\relax - \ifnum\fontid\textfont\c_font_fam_mb_rl=\fontid\textfont\c_font_fam_mb\else - \font_helpers_complete_bold_mathstrategy_yes_changed - \fi} - -\def\font_helpers_complete_bold_mathstrategy_yes_changed - {\textfont \c_font_fam_mb_rl\textfont \c_font_fam_mb - \scriptfont \c_font_fam_mb_rl\scriptfont \c_font_fam_mb - \scriptscriptfont\c_font_fam_mb_rl\scriptscriptfont\c_font_fam_mb - \textfont \c_font_fam_mb_lr\textfont \c_font_fam_mb - \scriptfont \c_font_fam_mb_lr\scriptfont \c_font_fam_mb - \scriptscriptfont\c_font_fam_mb_lr\scriptscriptfont\c_font_fam_mb} + {\font_helpers_set_math_family_bold\c_font_fam_mb\s!mb\c_font_fam_mr\relax} \def\font_helpers_complete_bold_mathstrategy_nop {\ifnum\fontid\textfont\c_font_fam_mb=\fontid\textfont\c_font_fam_mr\else @@ -389,21 +452,11 @@ \def\font_helpers_complete_bold_mathstrategy_nop_changed {\textfont \c_font_fam_mb \textfont \c_font_fam_mr \scriptfont \c_font_fam_mb \scriptfont \c_font_fam_mr - \scriptscriptfont\c_font_fam_mb \scriptscriptfont\c_font_fam_mr - \textfont \c_font_fam_mb_lr\textfont \c_font_fam_mr_lr - \scriptfont \c_font_fam_mb_lr\scriptfont \c_font_fam_mr_lr - \scriptscriptfont\c_font_fam_mb_lr\scriptscriptfont\c_font_fam_mr_lr - \textfont \c_font_fam_mb_rl\textfont \c_font_fam_mr_rl - \scriptfont \c_font_fam_mb_rl\scriptfont \c_font_fam_mr_rl - \scriptscriptfont\c_font_fam_mb_rl\scriptscriptfont\c_font_fam_mr_rl} + \scriptscriptfont\c_font_fam_mb \scriptscriptfont\c_font_fam_mr} \def\font_helpers_apply_complete_bold_mathstrategy {\ifconditional\c_font_complete_bold_mathstrategy - \ifconditional\c_font_bidirectional_mathstrategy - \font_helpers_complete_bold_mathstrategy_yes_bidi - \else - \font_helpers_complete_bold_mathstrategy_yes - \fi + \font_helpers_complete_bold_mathstrategy_yes \else \font_helpers_complete_bold_mathstrategy_nop \fi} @@ -420,27 +473,33 @@ \fam\zerocount % all characters and symbols are in this family \to \everymathematics +% \protected\def\font_helpers_synchronize_math_family_mr +% {\c_attr_mathfamily\ifconditional\c_font_bidirectional_mathstrategy +% \ifconditional\c_math_right_to_left +% \plustwo +% \else +% \plusone +% \fi +% \else +% \zerocount +% \fi} +% +% \protected\def\font_helpers_synchronize_math_family_mb +% {\c_attr_mathfamily\ifconditional\c_font_bidirectional_mathstrategy +% \ifconditional\c_math_right_to_left +% \ifconditional\c_font_pseudo_bold_math_state\pluseight\else\plusfive\fi +% \else +% \ifconditional\c_font_pseudo_bold_math_state\plusseven\else\plusfour\fi +% \fi +% \else +% \ifconditional\c_font_pseudo_bold_math_state\plussix\else\plusthree\fi +% \fi} + \protected\def\font_helpers_synchronize_math_family_mr - {\c_attr_mathfamily\ifconditional\c_font_bidirectional_mathstrategy - \ifconditional\c_math_right_to_left - \plustwo - \else - \plusone - \fi - \else - \zerocount - \fi} + {\c_attr_mathfamily\zerocount} \protected\def\font_helpers_synchronize_math_family_mb - {\c_attr_mathfamily\ifconditional\c_font_bidirectional_mathstrategy - \ifconditional\c_math_right_to_left - \ifconditional\c_font_pseudo_bold_math_state\pluseight\else\plusfive\fi - \else - \ifconditional\c_font_pseudo_bold_math_state\plusseven\else\plusfour\fi - \fi - \else - \ifconditional\c_font_pseudo_bold_math_state\plussix\else\plusthree\fi - \fi} + {\c_attr_mathfamily\ifconditional\c_font_pseudo_bold_math_state\plussix\else\plusthree\fi} \installcorenamespace{fontmathsynchronizer} \installcorenamespace{fontmathstoredstrategy} @@ -471,7 +530,6 @@ \fi \to \t_font_math_strategies -%def\font_helpers_synchronize_math_bold_strategy{\csname\??fontmathstoredstrategy\fontclass\endcsname} \def\font_helpers_synchronize_math_bold_strategy{\begincsname\??fontmathstoredstrategy\fontclass\endcsname} \newconditional\c_font_pseudo_bold_math_state @@ -569,4 +627,19 @@ \permanent\protected\def\setmscale#1{\ifmmode\scaledmathstyle\numericscale#1\relax\fi} +%D This is nasty, as the engine only stores the last set family parameters (per style) which +%D in our case can be bold. + +\def\font_helpers_synchronize_math_parameters + {\textfont \zerocount\textfont \zerocount + \scriptfont \zerocount\scriptfont \zerocount + \scriptscriptfont\zerocount\scriptscriptfont\zerocount + \setfalse\c_math_last_family_set} + +\appendtoks + \ifconditional\c_math_last_family_set + \font_helpers_synchronize_math_parameters + \fi +\to\everybodyfont + \protect \endinput diff --git a/tex/context/base/mkxl/font-mps.lmt b/tex/context/base/mkxl/font-mps.lmt index 9a123a25e..7afc48d0f 100644 --- a/tex/context/base/mkxl/font-mps.lmt +++ b/tex/context/base/mkxl/font-mps.lmt @@ -46,6 +46,14 @@ function metapost.boundingbox(d,factor) return f_boundingbox(llx,lly,urx,lly,urx,ury,llx,ury) end +function metapost.baseline(d,factor) + local bounds = d.boundingbox + local factor = factor or 1 + local llx = factor*bounds[1] + local urx = factor*bounds[3] + return f_vertical(llx,0,urx,0) +end + function metapost.widthline(d,factor) local bounds = d.boundingbox local factor = factor or 1 diff --git a/tex/context/base/mkxl/font-otl.lmt b/tex/context/base/mkxl/font-otl.lmt index 85b32470b..b7889fc05 100644 --- a/tex/context/base/mkxl/font-otl.lmt +++ b/tex/context/base/mkxl/font-otl.lmt @@ -52,7 +52,7 @@ local report_otf = logs.reporter("fonts","otf loading") local fonts = fonts local otf = fonts.handlers.otf -otf.version = 3.120 -- beware: also sync font-mis.lua and in mtx-fonts +otf.version = 3.121 -- beware: also sync font-mis.lua and in mtx-fonts otf.cache = containers.define("fonts", "otl", otf.version, true) otf.svgcache = containers.define("fonts", "svg", otf.version, true) otf.pngcache = containers.define("fonts", "png", otf.version, true) @@ -426,9 +426,9 @@ local function copytotfm(data,cache_id) character.vitalic = vitalic end -- - local accent = m.accent -- taccent? - if accent then - character.accent = accent + local topanchor = m.topanchor or m.accent -- for now + if topanchor then + character.topanchor = topanchor end -- local kerns = m.kerns @@ -766,14 +766,14 @@ end -- moved from font-oth.lua, todo: also afm -local function getgsub(tfmdata,k,kind,value) +local function getgsub(tfmdata,k,kind,value,script,language) local shared = tfmdata.shared local rawdata = shared and shared.rawdata if rawdata then local sequences = rawdata.resources.sequences if sequences then local properties = tfmdata.properties - local validlookups, lookuplist = otf.collectlookups(rawdata,kind,properties.script,properties.language) + local validlookups, lookuplist = otf.collectlookups(rawdata,kind,script or properties.script,language or properties.language) if validlookups then -- local choice = tonumber(value) or 1 -- no random here (yet) for i=1,#lookuplist do @@ -797,8 +797,8 @@ end otf.getgsub = getgsub -- returns value, gsub_kind -function otf.getsubstitution(tfmdata,k,kind,value) - local found, kind = getgsub(tfmdata,k,kind,value) +function otf.getsubstitution(tfmdata,k,kind,value,script,language) + local found, kind = getgsub(tfmdata,k,kind,value,script,language) if not found then -- elseif kind == "gsub_single" then @@ -812,16 +812,16 @@ end otf.getalternate = otf.getsubstitution -function otf.getmultiple(tfmdata,k,kind) - local found, kind = getgsub(tfmdata,k,kind) +function otf.getmultiple(tfmdata,k,kind,value,script,language) + local found, kind = getgsub(tfmdata,k,kind,value,script,language) if found and kind == "gsub_multiple" then return found end return { k } end -function otf.getkern(tfmdata,left,right,kind) - local kerns = getgsub(tfmdata,left,kind or "kern",true) -- for now we use getsub +function otf.getkern(tfmdata,left,right,kind,value,script,language) + local kerns = getgsub(tfmdata,left,kind or "kern",true,script,language) -- for now we use getsub if kerns then local found = kerns[right] local kind = type(found) diff --git a/tex/context/base/mkxl/font-ots.lmt b/tex/context/base/mkxl/font-ots.lmt index 2ab52a35a..73c9b7c56 100644 --- a/tex/context/base/mkxl/font-ots.lmt +++ b/tex/context/base/mkxl/font-ots.lmt @@ -169,13 +169,8 @@ local forcepairadvance = false -- for testing local repeatlastmultiple = context and true -directives.register("otf.forcediscretionaries",function(v) - forcediscretionaries = v -end) - -directives.register("otf.forcepairadvance",function(v) - forcepairadvance = v -end) +directives.register("otf.forcediscretionaries", function(v) forcediscretionaries = v end) +directives.register("otf.forcepairadvance", function(v) forcepairadvance = v end) local report_direct = logs.reporter("fonts","otf direct") local report_subchain = logs.reporter("fonts","otf subchain") @@ -200,7 +195,6 @@ local getboth = nuts.getboth local setboth = nuts.setboth local getid = nuts.getid local getstate = nuts.getstate -local setsubtype = nuts.setsubtype local getchar = nuts.getchar local setchar = nuts.setchar local getdisc = nuts.getdisc @@ -264,7 +258,6 @@ local lefttoright_code = nodes.dirvalues.lefttoright local righttoleft_code = nodes.dirvalues.righttoleft local discretionarydisc_code = nodes.disccodes.discretionary ------ ligatureglyph_code = glyphcodes.ligature local injections = nodes.injections local setmark = injections.setmark @@ -299,9 +292,9 @@ local marks = false local classes = false local currentfont = false local currentdynamic = false -local currentscale = 1000 -- false -local currentxscale = 1000 -- false -local currentyscale = 1000 -- false +local currentscale = 1000 +local currentxscale = 1000 +local currentyscale = 1000 local factor = 0 local threshold = 0 local checkmarks = false @@ -503,7 +496,6 @@ local function markstoligature(head,start,stop,char) end resetinjection(base) setchar(base,char) - -- setsubtype(base,ligatureglyph_code) setcomponents(base,start) setlink(prev,base,next) flushcomponents(start) @@ -525,7 +517,7 @@ local glyphoptioncodes = tex.glyphoptioncodes local no_left_ligature_code = glyphoptioncodes.noleftligature local no_right_ligature_code = glyphoptioncodes.norightligature -local no_left_kern_code = glyphoptioncodes.noleftkern +----- no_left_kern_code = glyphoptioncodes.noleftkern local no_right_kern_code = glyphoptioncodes.norightkern local hasglyphoption = nuts.hasglyphoption @@ -558,7 +550,7 @@ local function toligature(head,start,stop,char,dataset,sequence,skiphash,discfou if start == stop and getchar(start) == char and not hasmarks then resetinjection(start) setchar(start,char) --- fonts.collections.direct(start) + -- fonts.collections.direct(start) return head, start end if inhibited(start,stop) then @@ -575,9 +567,8 @@ local function toligature(head,start,stop,char,dataset,sequence,skiphash,discfou end resetinjection(base) setchar(base,char) --- fonts.collections.direct(base) + -- fonts.collections.direct(base) setoptions(base,getoptions(start) | getoptions(stop)) -- maybe only lig options - -- setsubtype(base,ligatureglyph_code) setcomponents(base,comp) setlink(prev,base,next) if not discfound then @@ -1379,7 +1370,7 @@ as less as needed but that would also make the code even more messy.

-- To be done (example needed): what if > 1 steps --- this is messy: do we need this disc checking also in alternaties? +-- this is messy: do we need this disc checking also in alternates? local function reportzerosteps(dataset,sequence) logwarning("%s: no steps",cref(dataset,sequence)) @@ -2058,9 +2049,7 @@ local function setdiscchecked(d,pre,post,replace) setdisc(d,pre,post,replace) end -local noflags = { false, false, false, false } - -local function chainrun(head,start,last,dataset,sequence,rlmode,skiphash,ck) +local function chainrun(head,start,last,dataset,sequence,rlmode,skiphash,ck,where) local size = ck[5] - ck[4] + 1 local chainlookups = ck[6] @@ -2076,26 +2065,30 @@ local function chainrun(head,start,last,dataset,sequence,rlmode,skiphash,ck) -- -- bad rules -- end local chainlookup = chainlookups[1] - for j=1,#chainlookup do - local chainstep = chainlookup[j] - if chainstep then - local chainkind = chainstep.type - local chainproc = chainprocs[chainkind] - if chainproc then - local ok - -- HH: chainindex 1 added here (for KAI to check too), there are weird ligatures e.g. - -- char + mark -> char where mark has to disappear - -- head, start, ok = chainproc(head,start,last,dataset,sequence,chainstep,rlmode,skiphash,1) - head, start, ok = chainproc(head,start,last,dataset,sequence,chainstep,rlmode,skiphash) - if ok then - done = true + if chainlookup then + for j=1,#chainlookup do + local chainstep = chainlookup[j] + if chainstep then + local chainkind = chainstep.type + local chainproc = chainprocs[chainkind] + if chainproc then + local ok + -- HH: chainindex 1 added here (for KAI to check too), there are weird ligatures e.g. + -- char + mark -> char where mark has to disappear + -- head, start, ok = chainproc(head,start,last,dataset,sequence,chainstep,rlmode,skiphash,1) + head, start, ok = chainproc(head,start,last,dataset,sequence,chainstep,rlmode,skiphash) + if ok then + done = true + end + else + logprocess("%s: %s is not yet supported (1)",cref(dataset,sequence),chainkind) end else - logprocess("%s: %s is not yet supported (1)",cref(dataset,sequence),chainkind) + logprocess("%s: has an issue (1)",cref(dataset,sequence)) end - else - logprocess("%s: has an issue (1)",cref(dataset,sequence)) end + else + -- whatever end else @@ -2185,7 +2178,7 @@ local function chainrun(head,start,last,dataset,sequence,rlmode,skiphash,ck) else done = true if trace_contexts then - logprocess("%s: skipping match",cref(dataset,sequence)) + logprocess("%s: skipping match @ %i",cref(dataset,sequence),where) end end end @@ -2215,6 +2208,8 @@ local function chaindisk(head,start,dataset,sequence,rlmode,skiphash,ck) local last = start local prev = getprev(start) local hasglue = false + local useddisc = nil -- new 2022-09-25 + local usedstart = start -- new 2022-09-25 -- fishy: so we can overflow and then go on in the sweep? -- todo : id can also be glue_code as we checked spaces @@ -2376,15 +2371,14 @@ local function chaindisk(head,start,dataset,sequence,rlmode,skiphash,ck) end end end + local done = false if lookaheaddisc then - local cf = start local cl = getprev(lookaheaddisc) local cprev = getprev(start) local insertedmarks = 0 - while cprev do local nxt, char = isnextchar(cf,currentfont,currentdynamic,currentscale,currentxscale,currentyscale) if char and marks[char] then @@ -2423,14 +2417,14 @@ local function chaindisk(head,start,dataset,sequence,rlmode,skiphash,ck) end if not notmatchpre[lookaheaddisc] then local ok = false - cf, start, ok = chainrun(cf,start,cl,dataset,sequence,rlmode,skiphash,ck) + cf, start, ok = chainrun(cf,start,cl,dataset,sequence,rlmode,skiphash,ck,1) if ok then done = true end end if not notmatchreplace[lookaheaddisc] then local ok = false - new, cnew, ok = chainrun(new,cnew,clast,dataset,sequence,rlmode,skiphash,ck) + new, cnew, ok = chainrun(new,cnew,clast,dataset,sequence,rlmode,skiphash,ck,2) if ok then done = true end @@ -2441,16 +2435,14 @@ local function chaindisk(head,start,dataset,sequence,rlmode,skiphash,ck) setdisc(lookaheaddisc,cf,post,new) end start = getprev(lookaheaddisc) + useddisc = lookaheaddisc -- new 2022-09-25 sweephead[cf] = getnext(clast) or false sweephead[new] = getnext(cl) or false - elseif backtrackdisc then - local cf = getnext(backtrackdisc) local cl = start local cnext = getnext(start) local insertedmarks = 0 - while cnext do local nxt, char = isnextchar(cnext,currentfont,currentdynamic,currentscale,currentxscale,currentyscale) if char and marks[char] then @@ -2476,14 +2468,14 @@ local function chaindisk(head,start,dataset,sequence,rlmode,skiphash,ck) end if not notmatchpost[backtrackdisc] then local ok = false - cf, start, ok = chainrun(cf,start,last,dataset,sequence,rlmode,skiphash,ck) + cf, start, ok = chainrun(cf,start,last,dataset,sequence,rlmode,skiphash,ck,3) if ok then done = true end end if not notmatchreplace[backtrackdisc] then local ok = false - new, cnew, ok = chainrun(new,cnew,clast,dataset,sequence,rlmode,skiphash,ck) + new, cnew, ok = chainrun(new,cnew,clast,dataset,sequence,rlmode,skiphash,ck,4) if ok then done = true end @@ -2504,33 +2496,57 @@ local function chaindisk(head,start,dataset,sequence,rlmode,skiphash,ck) setdisc(backtrackdisc,pre,post,replace) end start = getprev(backtrackdisc) + useddisc = backtrackdisc -- new 2022-09-25 sweephead[post] = getnext(clast) or false sweephead[replace] = getnext(last) or false - else local ok = false - head, start, ok = chainrun(head,start,last,dataset,sequence,rlmode,skiphash,ck) + head, start, ok = chainrun(head,start,last,dataset,sequence,rlmode,skiphash,ck,5) if ok then done = true end end - - return head, start, done + if useddisc and start ~= usedstart then -- make this option per font -- new 2022-09-25 + start = getnext(start) -- new 2022-09-25 + end -- new 2022-09-25 + return head, start, done, useddisc -- new 2022-09-25 end -local function chaintrac(head,start,dataset,sequence,rlmode,skiphash,ck,match,discseen,sweepnode) - local rule = ck[1] - local lookuptype = ck[8] or ck[2] - local nofseq = #ck[3] - local first = ck[4] - local last = ck[5] - local char = getchar(start) - logwarning("%s: rule %s %s at char %s for (%s,%s,%s) chars, lookuptype %a, %sdisc seen, %ssweeping", - cref(dataset,sequence),rule,match and "matches" or "nomatch", - gref(char),first-1,last-first+1,nofseq-last,lookuptype, - discseen and "" or "no ", sweepnode and "" or "not ") +local chaintrac do + + local level = 0 + local last = { } + + chaintrac = function(head,start,dataset,sequence,rlmode,skiphash,ck,match,discseen,sweepnode) + if dataset then + level = level + 1 + last[level] = start + local rule = ck[1] + local lookuptype = ck[8] or ck[2] + local nofseq = #ck[3] -- ck[3].n + local first = ck[4] + local last = ck[5] + local char = getchar(start) + logwarning("+ %i : %s: rule %s %s at char %s for (%s,%s,%s) chars, lookuptype %a, %sdisc seen, %ssweeping", + level,cref(dataset,sequence),rule,match and "matches" or "nomatch", + gref(char),first-1,last-first+1,nofseq-last,lookuptype, + discseen and "" or "no ", sweepnode and "" or "not ") + else + -- (start,done) + local what = start and "done" or "continue" + local where = head == last[level] and "same" or "different" + local char = getchar(head) + if char then + logwarning("- %i : %s at char %s, %s node",level,what,gref(char),where) + else + logwarning("- %i : %s, %s node",level,what,where) + end + level = level - 1 + end + end + end -- The next one is quite optimized but still somewhat slow, fonts like ebgaramond @@ -2544,6 +2560,9 @@ end -- the previous disc .. such be it ( with only f done) local function handle_contextchain(head,start,dataset,sequence,contexts,rlmode,skiphash) + if not contexts then + return head, start, false + end -- optimizing for rlmode gains nothing local sweepnode = sweepnode local sweeptype = sweeptype @@ -2579,17 +2598,17 @@ local function handle_contextchain(head,start,dataset,sequence,contexts,rlmode,s -- fonts can have many steps (each doing one check) or many contexts -- todo: make a per-char cache so that we have small contexts (when we have a context - -- n == 1 and otherwise it can be more so we can even distingish n == 1 or more) + -- n == 1 and otherwise it can be more so we can even distinguish n == 1 or more) local nofcontexts = contexts.n -- #contexts local startchar = nofcontext == 1 or ischar(start,currentfont) -- already checked for k=1,nofcontexts do -- does this disc mess work well with n > 1 - local ck = contexts[k] - local seq = ck[3] - local f = ck[4] -- first current -local last = start + local ck = contexts[k] + local seq = ck[3] + local f = ck[4] -- first current + local last = start if not startchar or not seq[f][startchar] then -- report("no hit in %a at %i of %i contexts",sequence.type,k,nofcontexts) goto next @@ -2600,7 +2619,9 @@ local last = start else local l = ck[5] -- last current local current = start --- local last = start + -- local last = start + + -- current match if l > f then -- before/current/after | before/current | current/after @@ -2712,7 +2733,7 @@ local last = start -- before if f > 1 then - if startprev then + -- if startprev then -- new 2022-09-25 local prev = startprev if prereplace and prev == checkdisc then prev = getprev(sweepnode) @@ -2837,9 +2858,9 @@ local last = start else goto next end - else - goto next - end + -- else -- new 2022-09-25 + -- goto next -- new 2022-09-25 + -- end -- new 2022-09-25 end -- after @@ -2968,19 +2989,21 @@ local last = start chaintrac(head,start,dataset,sequence,rlmode,skipped and skiphash,ck,true,discseen,sweepnode) end if discseen or sweepnode then + -- When we process a disc we can collapse and therefore we backtrack one node (start) and + -- reprocess. This is needed because there might be more in the collapsed list. head, start, done = chaindisk(head,start,dataset,sequence,rlmode,skipped and skiphash,ck) else - head, start, done = chainrun(head,start,last,dataset,sequence,rlmode,skipped and skiphash,ck) + head, start, done = chainrun(head,start,last,dataset,sequence,rlmode,skipped and skiphash,ck,6) + end + if trace_contexts then + chaintrac(start,done) end if done then break -- else -- next context end - ::next:: - -- if trace_chains then - -- chaintrac(head,start,dataset,sequence,rlmode,skipped and skiphash,ck,false,discseen,sweepnode) - -- end + ::next:: end if discseen then notmatchpre = { } @@ -2999,21 +3022,46 @@ handlers.gsub_reversecontextchain = handle_contextchain handlers.gpos_contextchain = handle_contextchain handlers.gpos_context = handle_contextchain --- this needs testing +-- local function chained_contextchain(head,start,stop,dataset,sequence,currentlookup,rlmode,skiphash) +-- local steps = currentlookup.steps +-- local nofsteps = currentlookup.nofsteps +-- if nofsteps > 1 then +-- reportmoresteps(dataset,sequence) +-- end +-- -- probably wrong +-- local l = steps[1].coverage[getchar(start)] +-- if l then +-- return handle_contextchain(head,start,dataset,sequence,l,rlmode,skiphash) +-- else +-- return head, start, false +-- end +-- end +-- new 2022-09-25 + local function chained_contextchain(head,start,stop,dataset,sequence,currentlookup,rlmode,skiphash) local steps = currentlookup.steps local nofsteps = currentlookup.nofsteps - if nofsteps > 1 then - reportmoresteps(dataset,sequence) - end - -- probably wrong - local l = steps[1].coverage[getchar(start)] - if l then - return handle_contextchain(head,start,dataset,sequence,l,rlmode,skiphash) + local char = getchar(start) + if nofsteps == 1 then + local s = steps[1] + local l = s.coverage[char] + if l then + return handle_contextchain(head,start,dataset,sequence,l,rlmode,skiphash) + end else - return head, start, false + for i=1,nofsteps do + local s = steps[i] + local l = s.coverage[char] + if l then + local h, s, d = handle_contextchain(head,start,dataset,sequence,l,rlmode,skiphash) + if d then + return h, s, d + end + end + end end + return head, start, false end chainprocs.gsub_context = chained_contextchain @@ -3152,7 +3200,7 @@ do -- overcome local limit end -- Functions like kernrun, comprun etc evolved over time and in the end look rather --- complex. It's a bit of a compromis between extensive copying and creating subruns. +-- complex. It's a bit of a compromise between extensive copying and creating subruns. -- The logic has been improved a lot by Kai and Ivo who use complex fonts which -- really helped to identify border cases on the one hand and get insight in the diverse -- ways fonts implement features (not always that consistent and efficient). At the same @@ -3259,7 +3307,7 @@ local function kernrun(disc,k_run,...) if done and trace_testruns then report_disc("done",disc) end --- return nextstart, done + -- return nextstart, done return nextstart end @@ -3313,7 +3361,7 @@ local function comprun(disc,c_run,...) -- vararg faster than the whole list setdisc(disc,pre,post,replace) end -- --- return getnext(disc), renewed + -- return getnext(disc), renewed return getnext(disc) end @@ -3442,7 +3490,7 @@ local function testrun(disc,t_run,c_run,...) end end -- next can have changed (copied list) --- return getnext(disc), renewed + -- return getnext(disc), renewed return getnext(disc) end @@ -3978,20 +4026,13 @@ do start = nxt elseif id == disc_code then if not discs or discs[start] == true then --- local ok if gpossing then --- start, ok = kernrun(start,k_run_single, lookupcache,step,dataset,sequence,rlmode,skiphash,handler) start = kernrun(start,k_run_single, lookupcache,step,dataset,sequence,rlmode,skiphash,handler) elseif forcetestrun then --- start, ok = testrun(start,t_run_single,c_run_single,lookupcache,step,dataset,sequence,rlmode,skiphash,handler) start = testrun(start,t_run_single,c_run_single,lookupcache,step,dataset,sequence,rlmode,skiphash,handler) else --- start, ok = comprun(start,c_run_single, lookupcache,step,dataset,sequence,rlmode,skiphash,handler) start = comprun(start,c_run_single, lookupcache,step,dataset,sequence,rlmode,skiphash,handler) end - -- if ok then - -- done = true - -- end else start = nxt end @@ -4002,7 +4043,7 @@ do start = nxt -- elseif id == par_code and startofpar(start) then -- rlparmode, rlmode = pardirstate(start) - -- start = nxt + -- start = nxt else start = nxt end @@ -4051,15 +4092,11 @@ do start = nxt elseif id == disc_code then if not discs or discs[start] == true then --- local ok if gpossing then --- start, ok = kernrun(start,k_run_multiple, steps,nofsteps,dataset,sequence,rlmode,skiphash,handler) start = kernrun(start,k_run_multiple, steps,nofsteps,dataset,sequence,rlmode,skiphash,handler) elseif forcetestrun then --- start, ok = testrun(start,t_run_multiple,c_run_multiple,steps,nofsteps,dataset,sequence,rlmode,skiphash,handler) start = testrun(start,t_run_multiple,c_run_multiple,steps,nofsteps,dataset,sequence,rlmode,skiphash,handler) else --- start, ok = comprun(start,c_run_multiple, steps,nofsteps,dataset,sequence,rlmode,skiphash,handler) start = comprun(start,c_run_multiple, steps,nofsteps,dataset,sequence,rlmode,skiphash,handler) end else @@ -4098,9 +4135,6 @@ do currentfont = font currentdynamic = false --- currentscale = false --- currentxscale = false --- currentyscale = false currentscale = 1000 currentxscale = 1000 currentyscale = 1000 @@ -4191,7 +4225,7 @@ do start = nxt -- elseif id == par_code and startofpar(start) then -- rlparmode, rlmode = pardirstate(start) - -- start = nxt + -- start = nxt else start = nxt end diff --git a/tex/context/base/mkxl/font-pre.mkxl b/tex/context/base/mkxl/font-pre.mkxl index 3c7a01857..8cb0b5b6c 100644 --- a/tex/context/base/mkxl/font-pre.mkxl +++ b/tex/context/base/mkxl/font-pre.mkxl @@ -427,10 +427,6 @@ language=dflt, script=math] -\definefontfeature - [oldmath] - [oldmath=yes] - \ifdefined\mathnolimitsmode \mathnolimitsmode\plusone % font driven (only opentype) \fi diff --git a/tex/context/base/mkxl/grph-trf.mkxl b/tex/context/base/mkxl/grph-trf.mkxl index a08cec904..0f1458873 100644 --- a/tex/context/base/mkxl/grph-trf.mkxl +++ b/tex/context/base/mkxl/grph-trf.mkxl @@ -117,7 +117,7 @@ \setupcurrentscale[#2]% \fi % - \dowithnextboxcs\grph_scale_finish\hbox} + \dowithnextboxcs\grph_scale_finish\naturalhbox} % intercept direction \def\grph_scale_finish {% todo: p_scale_ diff --git a/tex/context/base/mkxl/lpdf-ano.lmt b/tex/context/base/mkxl/lpdf-ano.lmt index 85fe050a2..b0d398457 100644 --- a/tex/context/base/mkxl/lpdf-ano.lmt +++ b/tex/context/base/mkxl/lpdf-ano.lmt @@ -386,6 +386,8 @@ local v_minheight = variables.minheight local v_fit = variables.fit local v_tight = variables.tight +local c_realpageno = tex.iscount("realpageno") + -- nicer is to create dictionaries and set properties but it's a bit overkill -- The problem with the following settings is that they are guesses: we never know @@ -466,7 +468,7 @@ end) local function flushdestination(specification) local names = specification.names local view = specification.view - local r = pdfpagereference(texgetcount("realpageno")) + local r = pdfpagereference(c_realpageno) if (references.innermethod ~= v_name) and (view == defaultview or not view or view == "") then r = pagedestinations[r] else @@ -1079,7 +1081,7 @@ end function specials.deltapage(var,actions) local p = tonumber(var.operation) if p then - p = references.checkedrealpage(p + texgetcount("realpageno")) + p = references.checkedrealpage(p + texgetcount(c_realpageno)) return pdflinkpage(p) end end diff --git a/tex/context/base/mkxl/lpdf-emb.lmt b/tex/context/base/mkxl/lpdf-emb.lmt index 6932879e7..3ce288b48 100644 --- a/tex/context/base/mkxl/lpdf-emb.lmt +++ b/tex/context/base/mkxl/lpdf-emb.lmt @@ -872,6 +872,7 @@ do FontName = basefont, Flags = 4, FontBBox = fontbbox, +-- FontMatrix = pdfarray { 0.001, 0, 0, 0.001, 0, 0 }, Ascent = scale(ascender), Descent = scale(descender), ItalicAngle = round(italicangle or 0), @@ -971,7 +972,6 @@ do return int4tag .. tointeger4(n) end - local e = false local z = byte("0") local dp = 10 local ep = 11 @@ -985,6 +985,7 @@ do local s = fg(v) local t = { [0] = realtag } local n = 0 + local e = false for s in gmatch(s,".") do if s == "e" or s == "E" then e = true @@ -1027,6 +1028,73 @@ do return t end + -- -- An alternative + -- + -- local fg = formatters["%0.14gE%i"] + -- + -- todictreal = function(v) + -- local E = 0 + -- if v >= 10.0 then + -- while v >= 10.0 do + -- v = v / 10.0 + -- E = E + 1 + -- end + -- elseif v < 1.0 then + -- while v < 1.0 do + -- v = v * 10.0 + -- E = E - 1 + -- end + -- end + -- local s = fg(v,E) + -- local t = { [0] = realtag } + -- local n = 0 + -- local e = false + -- for s in gmatch(s,".") do + -- if s == "e" or s == "E" then + -- e = true + -- elseif s == "+" then + -- -- skip + -- elseif s == "-" then + -- n = n + 1 + -- if e then + -- t[n] = em + -- e = false + -- else + -- t[n] = mn + -- end + -- else + -- if e then + -- n = n + 1 + -- t[n] = ep + -- e = false + -- end + -- n = n + 1 + -- if s == "." then + -- t[n] = dp + -- else + -- t[n] = byte(s) - z + -- end + -- end + -- end + -- n = n + 1 + -- t[n] = es + -- if (n % 2) ~= 0 then + -- n = n + 1 + -- t[n] = es + -- end + -- local j = 0 + -- for i=1,n,2 do + -- j = j + 1 + -- t[j] = char(t[i]*0x10+t[i+1]) + -- end + -- -- print(v,s) + -- -- for i=0,j do + -- -- print(string.format("%02X",utf.byte(t[i]))) + -- -- end + -- t = concat(t,"",0,j) + -- return t + -- end + todictnumber = function(n) if not n or n == 0 then return todictinteger(0) @@ -1063,7 +1131,8 @@ do local function todictdeltas(t) local r = { } for i=1,#t do - r[i] = todictnumber(t[i]-(t[i-1] or 0)) +-- r[i] = todictnumber(t[i]-(t[i-1] or 0)) + r[i] = todictnumber(t[i]+(t[i-1] or 0)) end return concat(r) end @@ -1140,7 +1209,7 @@ do -- local charstrings = fontfile.charstrings local nofglyphs = #charstrings + 1 - local fontmatrix = { 0.001, 0, 0, 0.001, 0, 0 } -- todo +-- local fontmatrix = { 0.001, 0, 0, 0.001, 0, 0 } -- todo local fontbbox = fontfile.fontbbox local defaultwidth = cffinfo.defaultwidth or 0 local nominalwidth = cffinfo.nominalwidth or 0 @@ -1153,6 +1222,8 @@ do local bluefuzz = cffinfo.bluefuzz local stdhw = cffinfo.stdhw local stdvw = cffinfo.stdvw + local stemsnaph = cffinfo.stemsnaph + local stemsnapv = cffinfo.stemsnapv -- if defaultwidth == 0 then defaultwidth = nil end if nomimalwidth == 0 then nominalwidth = nil end @@ -1163,8 +1234,10 @@ do if bluescale then bluescale = todictnumber(bluescale) end if blueshift then blueshift = todictnumber(blueshift) end if bluefuzz then bluefuzz = todictnumber(bluefuzz) end - if stdhw then stdhw = todictdeltas(stdhw) end - if stdvw then stdvw = todictdeltas(stdvw) end + if stemsnaph then stemsnaph = todictarray(stemsnaph) end + if stemsnapv then stemsnapv = todictarray(stemsnapv) end + if stdhw then stdhw = todictnumber(stdhw) end + if stdvw then stdvw = todictnumber(stdvw) end -- local fontversion = todictstring(fontfile,fontheader.fontversion or "uknown version") local familyname = todictstring(fontfile,cffinfo.familyname or names.family or basefontname) @@ -1177,7 +1250,7 @@ do local underlineposition = todictnumber(cffinfo.underlineposition) local underlinethickness = todictnumber(cffinfo.underlinethickness) local charstringtype = todictnumber(2) - local fontmatrix = todictarray(fontmatrix) +-- local fontmatrix = todictarray(fontmatrix) local ros = todictstring(fontfile,"Adobe") -- registry .. todictstring(fontfile,"Identity") -- identity .. todictnumber(0) -- supplement @@ -1191,18 +1264,21 @@ do -- local defaultwidthx = todictnumber(defaultwidth) local nominalwidthx = todictnumber(nominalwidth) + -- the order of the blues is important! local private = "" - .. (defaultwidthx and (defaultwidthx .. todictkey(20)) or "") - .. (nominalwidthx and (nominalwidthx .. todictkey(21)) or "") - .. (bluevalues and (bluevalues .. todictkey(6)) or "") - .. (otherblues and (otherblues .. todictkey(7)) or "") - .. (familyblues and (familyblues .. todictkey(8)) or "") - .. (familyotherblues and (familyotherblues .. todictkey(9)) or "") - .. (bluescale and (bluescale .. todictkey(12,9)) or "") - .. (blueshift and (blueshift .. todictkey(12,10)) or "") - .. (bluefuzz and (bluefuzz .. todictkey(12,11)) or "") - .. (stdhw and (stdhw .. todictkey(12,12)) or "") - .. (stdvw and (stdvw .. todictkey(12,13)) or "") + .. (bluevalues and (bluevalues .. todictkey( 6)) or "") + .. (otherblues and (otherblues .. todictkey( 7)) or "") + .. (familyblues and (familyblues .. todictkey( 8)) or "") + .. (familyotherblues and (familyotherblues .. todictkey( 9)) or "") + .. (bluescale and (bluescale .. todictkey(12, 9)) or "") + .. (blueshift and (blueshift .. todictkey(12,10)) or "") + .. (bluefuzz and (bluefuzz .. todictkey(12,11)) or "") + .. (stdhw and (stdhw .. todictkey(10)) or "") + .. (stdvw and (stdvw .. todictkey(11)) or "") + .. (stemsnaph and (stemsnaph .. todictkey(12,12)) or "") + .. (stemsnapv and (stemsnapv .. todictkey(12,13)) or "") + .. (defaultwidthx and (defaultwidthx .. todictkey(20)) or "") + .. (nominalwidthx and (nominalwidthx .. todictkey(21)) or "") local privatesize = todictnumber(#private) local privatespec = privatesize .. privateoffset -- @@ -1245,7 +1321,7 @@ do .. underlineposition .. todictkey(12, 3) .. underlinethickness .. todictkey(12, 4) .. charstringtype .. todictkey(12, 6) - .. fontmatrix .. todictkey(12, 7) +-- .. fontmatrix .. todictkey(12, 7) .. strokewidth .. todictkey(12, 8) .. topvars } @@ -1272,6 +1348,10 @@ do -- -- fdselect -- + -- see printer mail thread / experiments with Leah Neukirchen: some printers + -- (probaby with an old GS on board) need this matrix because oitherwise they + -- accumulate the top one (resulting in very tiny invisible results) + -- local fdselect = tocardinal1(3) -- format .. tocardinal2(1) -- n of ranges @@ -1301,8 +1381,8 @@ do offset = writestring(target,private,offset,"private") -- local fdarray = { - fontname .. todictkey(12,38) - .. privatespec .. todictkey(18) + fontname .. todictkey(12,38) + .. privatespec .. todictkey(18) -- case 1 } fdarrayoffset = todictoffset(offset) offset = writeindex(target,fdarray,offset,"fdarray") @@ -1314,19 +1394,18 @@ do .. charsetoffset .. todictkey(15) .. fdarrayoffset .. todictkey(12,36) .. fdselectoffset .. todictkey(12,37) - .. privatespec .. todictkey(18) + .. privatespec .. todictkey(18) -- case 2 target[dictof] = topdict .. topvars -- target = concat(target) -- if trace_details then - -- local name = "temp.cff" - -- report_fonts("saving %a",name) - -- io.savedata(name,target) - -- inspect(fonts.handlers.otf.readers.cffcheck(name)) + -- local name = "temp.cff" + -- report_fonts("saving %a",name) + -- io.savedata(name,target) + -- inspect(fonts.handlers.otf.readers.cffcheck(name)) -- end return target end - end -- todo: check widths (missing a decimal) @@ -1468,6 +1547,7 @@ do FontName = basefont, Flags = 4, FontBBox = fontbbox, +-- FontMatrix = pdfarray { 0.001, 0, 0, 0.001, 0, 0 }, Ascent = scale(ascender), Descent = scale(descender), ItalicAngle = round(italicangle or 0), diff --git a/tex/context/base/mkxl/lpdf-lmt.lmt b/tex/context/base/mkxl/lpdf-lmt.lmt index bf1142119..d937e3dea 100644 --- a/tex/context/base/mkxl/lpdf-lmt.lmt +++ b/tex/context/base/mkxl/lpdf-lmt.lmt @@ -202,6 +202,7 @@ local usedfontstreams = { } local usedindices = setmetatableindex(function(t,k) local n = 0 +-- n = 31 local v = setmetatableindex(function(tt,kk) if n >= 0xFFFF then report_fonts("registering character index: overflow in hash %a, todo: use overflow font") @@ -2488,11 +2489,12 @@ end do - local names = { } - local cache = { } - local nofpages = 0 + local names = { } + local cache = { } + local nofpages = 0 - local texgetcount = tex.getcount + local texgetcount = tex.getcount + local c_realpageno = tex.iscount("realpageno") pdfreserveobject = function(name) nofobjects = nofobjects + 1 @@ -2511,7 +2513,7 @@ do pdfpagereference = function(n,complete) -- true | false | nil | n [true,false] if n == true or not n then complete = n - n = texgetcount("realpageno") + n = texgetcount(c_realpageno) end if n > nofpages then nofpages = n diff --git a/tex/context/base/mkxl/lpdf-rul.lmt b/tex/context/base/mkxl/lpdf-rul.lmt index ca38dcaa8..2c8227be9 100644 --- a/tex/context/base/mkxl/lpdf-rul.lmt +++ b/tex/context/base/mkxl/lpdf-rul.lmt @@ -146,9 +146,7 @@ FakeRule(RuleWidth,RuleHeight,RuleDepth,RuleThickness,RuleColor); setdimen("d_rule_h", h) setdimen("d_rule_v", v) setdimen("d_rule_line", p.line or 65536) --- setdimen("d_rule_offset", p.offset or 0) setdimen("d_rule_offset", (p.offset or 0) * 65536) --- setmacro("m_rule_factor", (p.factor or 0) * bpfactor) -- needs checking setdimen("d_rule_factor", (p.factor or 0)) -- needs checking setmacro("m_rule_option", p.option or "") setmacro("m_rule_direction", p.direction or lefttoright_code) diff --git a/tex/context/base/mkxl/math-act.lmt b/tex/context/base/mkxl/math-act.lmt index f0b132d66..7fb4f9b9f 100644 --- a/tex/context/base/mkxl/math-act.lmt +++ b/tex/context/base/mkxl/math-act.lmt @@ -23,6 +23,11 @@ local trace_tweaking = false trackers.register("math.tweaks", function(v) local report_math = logs.reporter("mathematics","initializing") local report_mathtweak = logs.reporter("mathematics","tweak") +local getfontoffamily = tex.getfontoffamily +local fontcharacters = fonts.hashes.characters +local chardata = characters.data +local extensibles = mathematics.extensibles + local context = context local commands = commands local mathematics = mathematics @@ -166,28 +171,6 @@ function mathematics.checkaccentbaseheight(target,original) end end --- function mathematics.checkprivateparameters(target,original) --- local mathparameters = target.mathparameters --- if mathparameters then --- local parameters = target.parameters --- local properties = target.properties --- if parameters then --- local size = parameters.size --- if size then --- -- gone --- elseif properties then --- report_math("invalid parameters in font %a",properties.fullname or "?") --- else --- report_math("invalid parameters in font") --- end --- elseif properties then --- report_math("no parameters in font %a",properties.fullname or "?") --- else --- report_math("no parameters and properties in font") --- end --- end --- end - function mathematics.overloadparameters(target,original) if use_math_goodies then local mathparameters = target.mathparameters @@ -200,6 +183,8 @@ function mathematics.overloadparameters(target,original) if mathematics then local parameters = mathematics.parameters local bigslots = mathematics.bigslots or mathematics.bigs +-- inspect(parameters) +-- print("before",mathparameters.AxisHeight) if parameters then if trace_defining then report_math("overloading math parameters in %a @ %p",target.properties.fullname,target.parameters.size) @@ -222,6 +207,7 @@ function mathematics.overloadparameters(target,original) end mathparameters[name] = newvalue end +-- print("after ",mathparameters.AxisHeight) for name, value in next, parameters do local tvalue = type(value) if tvalue == "string" then @@ -265,7 +251,7 @@ local function report_tweak(fmt,target,original,...) (target and target .shared.rawdata.metadata) local parameters = target.parameters report_mathtweak( - "%a, size %p, math size %i, %s", + "%a, size %P, math size %i, %s", metadata and metadata.fontname or "unknown", parameters.size or 655360, parameters.mathsize or 1, @@ -276,6 +262,39 @@ local function report_tweak(fmt,target,original,...) end end +mathtweaks.subsets = { + acenorsuvxz = { 0x1D44E, 0x1D450, 0x1D452, 0x1D45B, 0x1D45C, 0x1D45F, 0x1D460, 0x1D462, 0x1D463, 0x1D465, 0x1D467 }, + bhklt = { 0x1D44F, 0x1D455, 0x1D458, 0x1D459, 0x1D461 }, + d = { 0x1D451 }, + f = { 0x1D453 }, + gjqy = { 0x1D454, 0x1D457, 0x1D45E, 0x1D466 }, + i = { 0x1D456 }, + mw = { 0x1D45A, 0x1D464 }, + p = { 0x1D45D }, + dotless = { 0x00049, 0x0004A, 0x00131, 0x00237, 0x1D6A4, 0x1D6A5 }, + integrals = { 0x0222B, 0x0222C, 0x0222D, 0x0222E, 0x0222F, 0x02230, 0x02231, 0x02232, 0x02233, 0x02A0B, 0x02A0C, 0x02A0D, 0x02A0E, 0x02A0F, 0x02A10, 0x02A11, 0x02A12, 0x02A13, 0x02A14, 0x02A15, 0x02A16, 0x02A17, 0x02A18, 0x02A19, 0x02A1A, 0x02A1B, 0x02A1C }, +} + +local function getalso(target,original) + local also = target.tweakalso -- maybe + if not also then + also = { } + for k, v in sortedhash(target.characters) do + local u = v.unicode + if u and k ~= u then + local a = also[u] + if a then + a[#a+1] = k + else + also[u] = { k } + end + end + end + target.tweakalso = also + end + return also +end + -- { -- tweak = "dimensions", -- list = { @@ -398,32 +417,33 @@ do extend = factor, }, v) end - local original = v.original - if not original then + local originalslot = v.original + if not originalslot then local delta = v.delta if delta then - original = k + delta + originalslot = k + delta end end - if original then - original = mathgaps[original] or original - local data = targetcharacters[original] + if originalslot then + originalslot = mathgaps[originalslot] or originalslot + local data = targetcharacters[originalslot] if data then data = copytable(data) - data.unicode = original + data.unicode = originalslot targetcharacters[k] = data character = data else - report_mathtweak("no slot %U",original) + report_mathtweak("no slot %U",originalslot) return end end -- - local width = character.width - local height = character.height - local depth = character.depth - local italic = character.italic - local topaccent = character.topaccent + local width = character.width + local height = character.height + local depth = character.depth + local italic = character.italic + local topanchor = character.topanchor + local bottomanchor = character.bottomanchor -- local widthfactor = v.width local heightfactor = v.height @@ -442,7 +462,7 @@ do if advancefactor then character.advance = advancefactor * width else - character.advance = width -- so advance is oldwidth + character.advance = character.advance or width -- so advance is oldwidth end if widthfactor then character.width = widthfactor * width @@ -470,8 +490,11 @@ do end end if anchorfactor then - character.topaccent = anchorfactor * (topaccent or width) + character.topanchor = anchorfactor * (topanchor or width) end +-- if anchorfactor then +-- character.bottomaccent = anchorfactor * (bottomanchor or width) +-- end -- begin experiment local line = v.wline if line then @@ -573,6 +596,18 @@ do end +do + + function mathtweaks.showinfo(target,original,parameters) + local mathparameters = target.mathparameters + for k, v in sortedhash(mathparameters) do + report_mathtweak("%s : %s",k,v) + end + end + +end + + do function mathtweaks.wipevariants(target,original,parameters) @@ -581,6 +616,8 @@ do local targetcharacters = target.characters -- local originalcharacters = original.characters local count = 0 + -- local also = getalso(target,original) + -- local done = { } for k, v in sortedhash(list) do local ori = targetcharacters[k] local nxt = ori.next @@ -675,17 +712,6 @@ do -- maybe we'll have a different name - mathtweaks.subsets = { - acenorsuvxz = { 0x1D44E, 0x1D450, 0x1D452, 0x1D45B, 0x1D45C, 0x1D45F, 0x1D460, 0x1D462, 0x1D463, 0x1D465, 0x1D467 }, - bhklt = { 0x1D44F, 0x1D455, 0x1D458, 0x1D459, 0x1D461 }, - d = { 0x1D451 }, - f = { 0x1D453 }, - gjqy = { 0x1D454, 0x1D457, 0x1D45E, 0x1D466 }, - i = { 0x1D456 }, - mw = { 0x1D45A, 0x1D464}, - p = { 0x1D45D }, - } - function mathtweaks.kernpairs(target,original,parameters) local list = parameters.list if list then @@ -749,37 +775,11 @@ end do - -- What a mess ... should be a different alphabet. - - local function expand(target,original,list,selector,feature) - if feature then - local getsubstitution = fonts.handlers.otf.getsubstitution - for _, char in next, list do - local variant = getsubstitution(original,char,feature,true) - if variant then - mathematics.addvariant(target,char,variant,selector) - end - end - else - for i, char in next, list do - mathematics.addvariant(target,char,0xFE800+i,selector) - end - end - end - function mathtweaks.variants(target,original,parameters) - local feature = parameters.feature - local selector = parameters.selector - local kind = parameters.kind - if kind == "script" then - if selector then - expand(target,original,mathematics.alphabets.sr.tf.lcletters,selector,feature) - expand(target,original,mathematics.alphabets.sr.tf.ucletters,selector,feature) - end - end + report_mathtweak("todo: remove 'variants' tweak from goodie file") end - mathtweaks.variant = mathtweaks.variants + mathtweaks.variant = mathtweaks.variants end @@ -1052,86 +1052,307 @@ do local factor = tonumber(parameters.factor) or 0 if factor ~= 0 then for k, v in next, targetcharacters do - local a = v.topaccent + local a = v.topanchor if a and a > 0 then - v.topaccent = a * factor + v.topanchor = a * factor end end end end - -- local default = { - -- "digitsnormal", - -- "lowercasedoublestruck", - -- "uppercasedoublestruck", - -- } + mathtweaks.fixaccents = mathtweaks.fixanchors + +end + +do + + -- actually this should be a an engine feature driven by category because we don't + -- want this in display mode .. only a test for MS and HH + + local issymbol = characters.is_symbol + + function mathtweaks.oldstylemath(target,original,parameters) + local characters = target.characters + local axis = target.mathparameters.AxisHeight + local delta = (parameters.factor or .1) * axis + target.mathparameters.AxisHeight = (axis - delta) + for k, v in sortedhash(characters) do + if issymbol[k] then -- quick hack, engine knows + v.yoffset = -delta + v.height = (v.height or 0) - delta + v.depth = (v.depth or 0) - delta + end + end + end - local function wipe(target,original,parameters,field) - local targetcharacters = target.characters +end + +do + + function mathtweaks.simplifykerns(target,original,parameters) + local characters = target.characters + local simplified = 0 + for k, v in sortedhash(characters) do + local mathkerns = v.mathkerns + if mathkerns then + local k = mathkerns.topleft + if k then + k = k[#k].kern + if k then + v.topleft = k + end + end + local k = mathkerns.topright + if k then + k = k[#k].kern + if k then + v.topright = k + end + end + local k = mathkerns.bottomleft + if k then + k = k[1].kern -- todo get value at baseline + if k then + v.bottomleft = k + end + end + local k = mathkerns.bottomright + if k then + k = k[1].kern -- todo get value at baseline + if k then + v.bottomright = k + end + end + v.mathkerns = nil + simplified = simplified + 1 + end + end + if simplified == 0 then + report_tweak("no need to simplify mathkerns",target,original) + elseif trace_tweaking then + report_tweak("%i mathkerns simplified",target,original,simplified) + end + end + +end + +do + + local function wipe(target,original,parameters,field,move,integrals) + local targetcharacters = target.characters + local targetdescriptions = target.descriptions + local factor = target.parameters.factor + local correct = parameters.correct + local function getllx(u) + local d = targetdescriptions[u] + if d then + local b = d.boundingbox + if b then + local llx = b[1] + if llx < 0 then + return - llx + end + end + end + return false + end local function step(s,l) - local done = false while s do - local c = targetcharacters[mathgaps[s] or s] + local u = mathgaps[s] or s + local c = targetcharacters[u] if c then - local v = c[field] - if v then - if trace_tweaking then - if l then - report_tweak("removing %a in range %a from %C",target,original,field,l,s) + if field == "topanchor" then + if c.topanchor then + c.topanchor = nil + else + goto smaller + end + else + local done = false + local italic = c.italic + if move then + local width = c.width or 0 + c.advance = width + if correct then + local llx = getllx(u) + if llx then + local topanchor = c.topanchor + llx = llx * factor + width = width + llx + c.xoffset = llx + if topanchor then + c.topanchor = topanchor + llx + end +-- if c.bottomleft or c.topleft then +-- print("BEFORE",c.bottomleft,c.topleft,llx) +-- c.bottomleft = (c.bottomleft or 0) - llx +-- c.topleft = (c.topleft or 0) - llx +-- print("AFTER",c.bottomleft,c.topleft,llx) +-- else + c.bottomleft = (c.bottomleft or 0) - llx + c.topleft = (c.topleft or 0) - llx +-- end + done = true + end + end + if italic and italic ~= 0 then + c.width = width + italic +-- print(">>>",bottomright) + c.bottomright = - italic +-- c.bottomright = c.bottomright - italic + done = true else - report_tweak("removing %a from %C",target,original,field,s) + c.width = width end end - c[field] = nil - done = true + if italic then + c.italic = nil + done = true + end + if not done then + goto smaller + end end + if trace_tweaking then + if l then + report_tweak("%s %a in range %a from %C","removing",target,original,field,l,s) + else + report_tweak("%s %a from %C","removing",target,original,field,s) + end + end + goto smaller + ::smaller:: s = c.smaller else break end end - return done end local list = parameters.list -- todo: ranges - -- if list == "default" then - -- list = default - -- else if type(list) == "string" then list = { list } end for i=1,#list do local l = list[i] - local r = blocks[l] - if r then - local done = false - for i=r.first,r.last do - if step(i,l) then - done = true - end - end - if not done and trace_tweaking then - report_mathtweak("there is no need to remove %a range %a",field,l) + if type(l) == "table" then + for i=1,#l do + step(i,l[i]) end else - stepper(l,step) + local r = blocks[l] + if r then + for i=r.first,r.last do + step(i,l) + end + else + stepper(l,step) + end end end end function mathtweaks.wipeanchors(target,original,parameters) - wipe(target,original,parameters,"topaccent") + wipe(target,original,parameters,"topanchor") end + mathtweaks.wipeaccents = mathtweaks.wipeanchors + function mathtweaks.wipeitalics(target,original,parameters) wipe(target,original,parameters,"italic") end + function mathtweaks.moveitalics(target,original,parameters) + wipe(target,original,parameters,"italic",true) + end + -- function mathtweaks.fixdigits(target,original,parameters) -- mathtweaks.fixanchors(target,original,{ list = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 } }) -- end end +do + + function mathtweaks.topanchors(target,original,parameters) + local characters = target.characters + local list = parameters.list + if list then + for k, v in sortedhash(list) do + local c = characters[k] + if c then + local w = c.width + if w and w ~= 0 then + c.topanchor = v * w + if trace_tweaking then + -- todo + end + end + end + end + -- todo: small + end + end + + mathtweaks.topaccents = mathtweaks.topanchors + + function mathtweaks.limits(target,original,parameters) + local characters = target.characters + local list = parameters.list + if list then + local factor = parameters.factor or 1 + local also = getalso(target,original) + local done = { } + local function relocate(u,factor) + if done[u] then + return + end + done[u] = true + local c = characters[u] + if c then + local italic = c.italic + if italic and italic ~= 0 then + local width = c.width or 0 + local half = (italic/2) * factor + c.topanchor = width + half + c.bottomanchor = width - half + c.bottomright = - italic + c.italic = nil + if trace_tweaking then + -- todo + end + end + local s = c.smaller + if s then + relocate(s,factor) + end + local n = c.next + if n then + relocate(n,factor) + end + if also then + local a = also[u] + if a then + for i=1,#a do + relocate(a[i],factor) + end + end + end + end + end + if #list > 0 then + for i=1,#list do + relocate(list[i],factor) + end + else + for k, v in sortedhash(list) do + relocate(k,tonumber(v) or factor) + end + end + end + end + +end + do -- musical timestamp: March 2022, Antonio Sanches (Bad Hombre), live performance in NL @@ -1178,12 +1399,14 @@ do local characters = target.characters local function setone(unicode,data) local chardata = characters[mathgaps[unicode] or unicode] - local width = chardata.width or 0 - local total = (chardata.height or 0) + (chardata.depth or 0) - local k = data.left ; if k and k ~= 0 then chardata.leftmargin = k * width end - local k = data.right ; if k and k ~= 0 then chardata.rightmargin = k * width end - local k = data.top ; if k and k ~= 0 then chardata.topmargin = k * total end - local k = data.bottom ; if k and k ~= 0 then chardata.bottommargin = k * total end + if chardata then + local width = chardata.width or 0 + local total = (chardata.height or 0) + (chardata.depth or 0) + local k = data.left ; if k and k ~= 0 then chardata.leftmargin = k * width end + local k = data.right ; if k and k ~= 0 then chardata.rightmargin = k * width end + local k = data.top ; if k and k ~= 0 then chardata.topmargin = k * total end + local k = data.bottom ; if k and k ~= 0 then chardata.bottommargin = k * total end + end end for unicode, data in next, margins do setone(unicode,data) -- withscriptcode(tfmdata,unicode,data,kernone) @@ -1398,39 +1621,39 @@ end do - local addprivate = fonts.helpers.addprivate - local privateslot = fonts.helpers.privateslot - - -- function mathtweaks.addrules(target,original,parameters) - -- local characters = target.characters - -- local height = target.mathparameters.OverbarRuleThickness - -- local depth = target.mathparameters.UnderbarRuleThickness - -- local width = target.parameters.emwidth/2 - -- local step = 0.8 * width - -- characters[0x203E] = { -- over - -- width = width, - -- height = height, - -- depth = 0, - -- unicode = 0x203E, - -- commands = { { "rule", height, width } }, - -- hparts = { - -- { advance = width, ["end"] = step, glyph = 0x203E, start = 0 }, - -- { advance = width, ["end"] = 0, glyph = 0x203E, start = step, extender = 1 }, - -- } - -- } - -- characters[0x0332] = { -- under - -- width = width, - -- height = 0, - -- depth = depth, - -- yoffset = -depth, - -- unicode = 0x0332, - -- commands = { { "rule", height, width } }, - -- hparts = { - -- { advance = width, ["end"] = step, glyph = 0x0332, start = 0 }, - -- { advance = width, ["end"] = 0, glyph = 0x0332, start = step, extender = 1 }, - -- } - -- } - -- end + local addprivate = fonts.helpers.addprivate + local privateslot = fonts.helpers.privateslot + + -- function mathtweaks.addrules(target,original,parameters) + -- local characters = target.characters + -- local height = target.mathparameters.OverbarRuleThickness + -- local depth = target.mathparameters.UnderbarRuleThickness + -- local width = target.parameters.emwidth/2 + -- local step = 0.8 * width + -- characters[0x203E] = { -- over + -- width = width, + -- height = height, + -- depth = 0, + -- unicode = 0x203E, + -- commands = { { "rule", height, width } }, + -- hparts = { + -- { advance = width, ["end"] = step, glyph = 0x203E, start = 0 }, + -- { advance = width, ["end"] = 0, glyph = 0x203E, start = step, extender = 1 }, + -- } + -- } + -- characters[0x0332] = { -- under + -- width = width, + -- height = 0, + -- depth = depth, + -- yoffset = -depth, + -- unicode = 0x0332, + -- commands = { { "rule", height, width } }, + -- hparts = { + -- { advance = width, ["end"] = step, glyph = 0x0332, start = 0 }, + -- { advance = width, ["end"] = 0, glyph = 0x0332, start = step, extender = 1 }, + -- } + -- } + -- end function mathtweaks.addrules(target,original,parameters) local characters = target.characters @@ -1787,6 +2010,9 @@ end do + -- mirror + -- smaller + local list = { 0x221A, } @@ -1802,11 +2028,19 @@ do end data.height = depth data.depth = height +if data.rorrim then + -- the original does the magic +else data.yoffset = depth - height +end + end + local smaller = data.smaller + if smaller then + fix(target,original,characters,smaller) end - local small = data.smaller - if small then - fix(target,original,characters,small) + local mirror = data.mirror + if mirror then + fix(target,original,characters,mirror) end end end @@ -1821,6 +2055,70 @@ do end +do + + local done = nil + + local function fix(target,original,characters,unicode,axis) + if done[unicode] then + return + end + done[unicode] = true + local data = characters[unicode] + if data then + local height = data.height or 0 + local depth = data.depth or 0 + if trace_tweaking then + report_tweak("swapping height and depth of %U",target,original,unicode) + end + local half = (height + depth)/2 + if data.rorrim then + -- the original does the magic + else + data.yoffset = depth - (half - axis) + end + height = half + axis + depth = half - axis + data.height = height + data.depth = depth + local smaller = data.smaller + if smaller then + fix(target,original,characters,smaller,axis) + end + local mirror = data.mirror + if mirror then + fix(target,original,characters,mirror,axis) + end + local next = data.next + if next then + fix(target,original,characters,next,axis) + end + end + end + + function mathtweaks.fixoldschool(target,original,parameters) + local characters = target.characters + local list = mathtweaks.subsets.integrals + local also = getalso(target,original) + local axis = target.mathparameters.AxisHeight + done = { } + for i=1,#list do + local unicode = list[i] + fix(target,original,characters,unicode,axis) + end + if also then + local a = also[u] + if a then + for i=1,#a do + fix(target,original,characters,a[i],axis) + end + end + end + done = nil + end + +end + do local list = { 0x2061, 0x2062, 0x2063, 0x2064 } @@ -1896,12 +2194,12 @@ characters[hat] = copytable(characters[0x0302]) -- TODO local alias = entry[1] local stretchingdata = characters[stretching] if stretchingdata and stretchingdata.width == 0 then - local topaccent = stretchingdata.topaccent or 0 - local width = -topaccent - topaccent = width/2 + local topanchor = stretchingdata.topanchor or 0 + local width = -topanchor + topanchor = width/2 stretchingdata.width = width - stretchingdata.topaccent = topaccent - stretchingdata.commands = { rightcommand[width + topaccent], charcommand[stretching] } + stretchingdata.topanchor = topanchor + stretchingdata.commands = { rightcommand[width + topanchor], charcommand[stretching] } if trace_tweaking then report_tweak("width of initial extensible accent %U set",target,original,stretching) end @@ -1925,7 +2223,7 @@ characters[hat] = copytable(characters[0x0302]) -- TODO local flataccent = last.flataccent if flataccent then characters[flataccent].extensible = true - end + end break end end @@ -1947,7 +2245,7 @@ characters[hat] = copytable(characters[0x0302]) -- TODO depth = stretchingdata.depth, next = stretchingdata.next, commands = { charcommand[stretching] }, - topaccent = stretchingdata.topaccent, + topanchor = stretchingdata.topanchor, -- unicode = stretching, -- when we aliasize to combiners unicode = alias, -- when we keep the original } @@ -2018,7 +2316,9 @@ do local linewidth = target.MathConstants.RadicalRuleThickness -- make option local basechar = characters[radical] local baseheight = basechar.height +/2 local basedepth = basechar.depth +/2 local basetotal = baseheight + basedepth local used = baseheight -- @@ -2188,7 +2488,7 @@ do } } if trace_tweaking then - report_tweak("fourier %U added using %U",target,original,basecode,fourier) + report_tweak("fourier %U added using %U",target,original,basecode,fouriercode) end end end @@ -2284,17 +2584,17 @@ do function mathtweaks.fixellipses(target,original,parameters) local characters = target.characters local function fix(normal,raised) - local normalone = characters[normal] - if normalone then - local raisedone = copytable(normalone) - characters[raised] = raisedone - raisedone.unicode = weird - local height = raisedone.height + local normaldata = characters[normal] + if normaldata then + local raiseddata = copytable(normaldata) + characters[raised] = raiseddata + raiseddata.unicode = raised + local height = raiseddata.height local yoffset = (parameters.yoffset or 2) * height - raisedone.yoffset = yoffset - raisedone.height = height + yoffset + raiseddata.yoffset = yoffset + raiseddata.height = height + yoffset if trace_tweaking then - report_tweak("taking %U from %U",target,original,weird,normal) + report_tweak("taking %U from %U",target,original,raised,normal) end end end @@ -2356,6 +2656,163 @@ do end +do + + -- We started with the list that xits has in rtlm but most of them can be derived from + -- the database, and others need to be added. + + -- Checked while watching/listening to Dave Matthews Band: The Central Park Concert + -- (with superb solos by Warren Haynes), a DVD I bought around when we started with the + -- LUATEX advanture. + + local mirrors = { + + [0x0002F] = true, -- slashes + [0x0005C] = true, + [0x000F7] = true, + + [0x02032] = true, -- primes + [0x02033] = true, + [0x02034] = true, + [0x02057] = true, + [0x02035] = true, + [0x02036] = true, + [0x02037] = true, + + [0x0221A] = true, -- radicals + [0x0221B] = true, + [0x0221C] = true, + [0x0221D] = true, + + [0x0222B] = true, -- integrals + [0x0222C] = true, + [0x0222D] = true, + [0x0222E] = true, + [0x0222F] = true, + [0x02230] = true, + [0x02231] = true, + [0x02232] = true, + [0x02233] = true, + + [0x02A0A] = true, -- seen in xits (to be checked) + [0x02A0B] = true, + [0x02A0C] = true, + [0x02A0D] = true, + [0x02A0E] = true, + + [0x02140] = true, + [0x02201] = true, + [0x02202] = true, + [0x02203] = true, + [0x02204] = true, + [0x02211] = true, + + [0x02239] = true, + [0x0225F] = true, + [0x0228C] = true, + [0x022A7] = true, + [0x022AA] = true, + [0x022AC] = true, + [0x022AD] = true, + [0x022AE] = true, + [0x022AF] = true, + [0x022F5] = true, + [0x022F8] = true, + [0x022F9] = true, + [0x022FF] = true, + [0x02320] = true, + [0x02321] = true, + [0x027C0] = true, + [0x029DC] = true, + [0x029F4] = true, + + [0x02A0F] = true, + [0x02A10] = true, + [0x02A11] = true, + [0x02A12] = true, + [0x02A13] = true, + [0x02A14] = true, + [0x02A15] = true, + [0x02A16] = true, + [0x02A17] = true, + [0x02A18] = true, + [0x02A19] = true, + [0x02A1A] = true, + [0x02A1B] = true, + [0x02A1C] = true, + [0x02A20] = true, + + [0x02A74] = true, + [0x02AA3] = true, + [0x02AE2] = true, + [0x02AE6] = true, + [0x1D715] = true, + } + + local new = fonts.helpers.newprivateslot + + local function add(target,original,characters,unicode,what) + local data = characters[unicode] + if data then + if not data.mirror then + local slot = new("mirror."..unicode) + local mirror = copytable(data) + data.mirror = slot + mirror.rorrim = unicode -- so we can check later + mirror.commands = { + { "offset", data.width, 0, unicode, -1, 1 } + } + if trace_tweaking then + report_tweak("adding mirror %U (%s)",target,original,unicode,what) + end + characters[slot] = mirror + elseif trace_tweaking then + report_tweak("skipping mirror %U (%s)",target,original,unicode,what) + end + local hparts = data.hparts + if hparts then + for i=1,#hparts do + add(target,original,characters,hparts[i],"hpart") + end + end + local vparts = data.vparts + if vparts then + for i=1,#vparts do + add(target,original,characters,vparts[i],"vpart") + end + end + local smaller = data.smaller + if smaller then + add(target,original,characters,"smaller") + end + local next = data.next + if next then + add(target,original,characters,next,"next") + end + end + end + + -- todo: also check the rtlm table if present + + function mathtweaks.addmirrors(target,original,parameters) + local characters = target.characters + for unicode, detail in sortedhash(characters) do + local data = chardata[unicode] + if data and data.mirror then + add(target,original,characters,unicode,"mirror") + end + end + for unicode, detail in sortedhash(mirrors) do + if characters[unicode] then + add(target,original,characters,unicode,"character") + elseif trace_tweaking then + report_tweak("ignoring mirror %U (%s)",target,original,unicode,what) + end + end + end + +end + do local reported = { } @@ -2380,6 +2837,215 @@ do report_tweak() end reported[fontname] = true + target.tweakversion = version + end + end + end + +end + +do + + function mathtweaks.diagnose(target,original,parameters) + local characters = target.characters + for k, v in sortedhash(characters) do + local italic = v.italic + if italic then + report_tweak("italics: %U %p",target,original,k,italic) + end + end +-- inspect(characters[0xF0929]) + end + +end + +do + + function mathtweaks.setoptions(target,original,parameters) + local setlist = parameters.set or parameters.list + local resetlist = parameters.reset + if setlist or resetlist then + local properties = target.properties + local codes = tex.mathcontrolcodes + local oldcontrol = tex.get("mathfontcontrol") + local newcontrol = oldcontrol + -- todo: reset + if resetlist then + for i=1,#resetlist do + local v = tonumber(codes[resetlist[i]]) + if v then + newcontrol = newcontrol & (not v) + end + end + end + if setlist then + for i=1,#setlist do + local v = tonumber(codes[setlist[i]]) + if v then + newcontrol = newcontrol | v + end + end + end + newcontrol = newcontrol | codes.usefontcontrol + properties.mathcontrol = newcontrol + target.mathcontrol = newcontrol + if trace_tweaking then + report_tweak("forcing math font options 0x%08X instead of 0x08X",target,original,newcontrol,oldcontrol) + end + end + end + +end + +do + + function mathtweaks.setovershoots(target,original,parameters) + local list = parameters.list + if list then + local characters = target.characters + local emwidth = target.parameters.quad + for i=1,#list do + local entry = list[i] + local target = entry.target + local top = entry.topovershoot + local quad = entry.quad + if target and top then + local range = blocks[target] + if range then + if quad then + quad = emwidth + end + for r = range.first, range.last do + local unicode = mathgaps[r] or r + local data = characters[unicode] + if data then + data.topovershoot = top * (quad or data.width or 0) + end + end + if trace_tweaking then + report_mathtweak("setting overshoots for %a",target) + end + end + end + end + end + end + + -- there is no real need for thios but let's play nice with memory anyway + + local efindex = 0 + local effects = setmetatableindex (function (t,k) + efindex = efindex + 1 + local v = "tweakreplacealphabets" .. efindex + local e = fonts.specifiers.presetcontext(v,"",k) + -- print(k,v,e) + t[k] = v + return v + end) + + function mathtweaks.replacealphabets(target,original,parameters) + local feature = parameters.feature + local features = target.specification.features.normal + if not feature or features[feature] == true then + local list = parameters.list + if list then + local definedfont = fonts.definers.internal + local copiedglyph = fonts.handlers.vf.math.copy_glyph +-- does a deep copy, including parts and so + local getsubstitution = fonts.handlers.otf.getsubstitution + local fontdata = fonts.hashes.identifiers + -- + local fonts = target.fonts + local size = target.size + local characters = target.characters + -- compact: size = 655360 + if not fonts then + fonts = { } + target.fonts = fonts + end + if #fonts == 0 then + fonts[1] = { id = 0, size = size } -- self, will be resolved later + end + for i=1,#list do + local entry = list[i] + local filename = entry.filename + local feature = entry.feature + local thesource = entry.source + local thetarget = entry.target or thesource + if thesource and thetarget then + local sourcerange = type(thesource) == "table" and thesource or blocks[thesource] -- .gaps + local targetrange = type(thetarget) == "table" and thetarget or blocks[thetarget] -- .gaps + if sourcerange and targetrange then + local firsttarget = targetrange.first + local firstsource = sourcerange.first + local lastsource = sourcerange.last or firstsource + if firstsource and firsttarget then + local offset = firsttarget - firstsource + local topovershoot = entry.topovershoot + if filename then + local rscale = entry.rscale or 1 -- todo + size = size * rscale -- maybe use scale in vf command + -- load font, todo: set language and script, the effect hack is ugly + local fullname = filename + local effect = features.effect + if effect then + fullname = fullname .. "*" .. effects["effect={"..effect.."}"] + end + local id = definedfont { + name = fullname, + size = size, + } + local chars = fontchars[id] + local dropin = fontdata[id] + local index = #fonts + 1 + fonts[index] = { id = id, size = size } + -- copy characters + for s=firstsource,lastsource do + local t = s + offset + local sourceunicode = mathgaps[s] or s + local targetunicode = mathgaps[t] or t + if feature then + sourceunicode = getsubstitution(dropin,sourceunicode,feature,true,"math","dflt") or sourceunicode + end + if trace_tweaking then + report_mathtweak("copying %s %U from file %a to %s %U",thesource,sourceunicode,filename,thetarget,targetunicode) + end + characters[targetunicode] = copiedglyph(target,characters,chars,sourceunicode,index) + end + elseif feature then + for s=firstsource,lastsource do + local t = s + offset + local sourceunicode = mathgaps[s] or s + local targetunicode = mathgaps[t] or t + local variant = getsubstitution(original,sourceunicode,feature,true,"math","dflt") + local data = characters[variant] + if data then + if trace_tweaking then + report_mathtweak("copying %s %U from feature %a to %s %U",thesource,sourceunicode,feature,thetarget,targetunicode) + end + characters[targetunicode] = copytable(data) + end + end + else + for s=firstsource,lastsource do + local t = s + offset + local sourceunicode = mathgaps[s] or s + local targetunicode = mathgaps[t] or t + local data = characters[sourceunicode] + if data then + if trace_tweaking then + report_mathtweak("copying %s %U to %s %U",thesource,sourceunicode,thetarget,targetunicode) + end + characters[targetunicode] = copytable(data) + end + end + end + else + -- error + end + end + end + end end end end @@ -2418,7 +3084,10 @@ local function applytweaks(when,target,original) if type(tweak) == "table" then local action = mathtweaks[tweak.tweak or ""] if action then - if original then + local version = tweak.version + if version and version ~= target.tweakversion then + report_math("skipping tweak %a version %a",tweak.tweak,version) + elseif original then action(target,original,tweak) else action(target,tweak) @@ -2456,6 +3125,65 @@ function mathematics.tweakaftercopyingfont(target,original) end end +do + + local defaults = { + { + source = "uppercasescript", + target = "uppercasecalligraphic", + }, + { + source = "lowercasescript", + target = "lowercasecalligraphic", + }, + { + source = "uppercaseboldscript", + target = "uppercaseboldcalligraphic", + }, + { + source = "lowercaseboldscript", + target = "lowercaseboldcalligraphic", + }, + } + + function mathematics.checkaftercopyingfont(target,original) + local mathparameters = target.mathparameters -- why not hasmath + if mathparameters then + local characters = target.characters + -- + for i=1,#defaults do + -- we assume no ssty here yet .. todo + local default = defaults[i] + local block = blocks[default.target] + local first = block.first + local last = block.last + if not characters[mathgaps[first] or last] then + mathtweaks.replacealphabets(target,original,{ + tweak = "replacealphabets", + list = { default } + }) + end + end + -- + local addvariant = mathematics.addvariant + local function register(old,new) + for i, cold in next, old do + local cnew = new[i] + addvariant(target,cold,cold,0xFE00) + addvariant(target,cnew,cnew,0xFE01) + addvariant(target,cnew,cold,0xFE00) + addvariant(target,cold,cnew,0xFE01) + end + end + local sr = mathematics.alphabets.sr.tf + local ca = mathematics.alphabets.ca.tf + register(sr.ucletters,ca.ucletters) + register(sr.lcletters,ca.lcletters) + end + end + +end + function mathematics.beforepassingfonttotex(target) if use_math_goodies then local mathparameters = target.mathparameters -- why not hasmath @@ -2472,20 +3200,13 @@ sequencers.appendaction("mathparameters","system","mathematics.checkaccentbasehe sequencers.appendaction("beforecopyingcharacters","system","mathematics.tweakbeforecopyingfont") sequencers.appendaction("aftercopyingcharacters", "system","mathematics.tweakaftercopyingfont") +sequencers.appendaction("aftercopyingcharacters", "system","mathematics.checkaftercopyingfont") sequencers.appendaction("beforepassingfonttotex", "system","mathematics.beforepassingfonttotex") -- no, it's a feature now (see good-mth): -- -- sequencers.appendaction("aftercopyingcharacters", "system","mathematics.overloaddimensions") --- helpers - -local getfontoffamily = tex.getfontoffamily - -local fontcharacters = fonts.hashes.characters -local chardata = characters.data -local extensibles = mathematics.extensibles - -- we use numbers at the tex end (otherwise we could stick to chars) local e_left = extensibles.left @@ -2657,7 +3378,7 @@ function mathematics.finishfallbacks(target,specification,fallbacks) if trace_collecting then report_math("adding fallback characters to font %a",specification.hash) end - local definedfont = fonts.definers.internal + ----- definedfont = fonts.definers.internal local copiedglyph = fonts.handlers.vf.math.copy_glyph local fonts = target.fonts local size = specification.size -- target.size diff --git a/tex/context/base/mkxl/math-ali.mkxl b/tex/context/base/mkxl/math-ali.mkxl index b6b037117..af6b48cee 100644 --- a/tex/context/base/mkxl/math-ali.mkxl +++ b/tex/context/base/mkxl/math-ali.mkxl @@ -1011,12 +1011,12 @@ \ifmmode\stopimath\fi \hfil \aligntab - \hskip\mathcasesparameter\c!distance\relax + \kern\mathcasesparameter\c!distance\relax % hskip \math_cases_strut % looks better \aligncontent \hfil \aligntab - \hskip\mathcasesparameter\c!numberdistance\relax + \kern\mathcasesparameter\c!numberdistance\relax % hskip \span\math_text_in_eqalign{\aligncontent}% \crcr} % todo: number @@ -1286,7 +1286,7 @@ \math_matrix_anchor % \ifdim\d_math_eqalign_distance>\zeropoint % \ifbitwiseand\c_math_matrix_anchor_mode\plustwo - % \hskip.5\d_math_eqalign_distance + % \kern.5\d_math_eqalign_distance % \fi % \fi \fi} @@ -1296,7 +1296,7 @@ \ifcase\c_math_matrix_anchor_mode\else % \ifdim\d_math_eqalign_distance>\zeropoint % \ifbitwiseand\c_math_matrix_anchor_mode\plusfour - % \hskip.5\d_math_eqalign_distance + % \kern.5\d_math_eqalign_distance % \fi % \fi \math_matrix_anchor @@ -1312,7 +1312,7 @@ \aligntab \aligntab \math_matrix_anchor - \hskip.5\d_math_eqalign_distance % kern + \kern.5\d_math_eqalign_distance % hskip \aligncontent \aligntab \global\advance\c_math_eqalign_column\plusone @@ -1358,27 +1358,40 @@ \dousecolorparameter\p_rulecolor \fi} -% \noaligned\permanent\tolerant\protected\def\math_matrix_HL[#1]#*% -% {\noalign\bgroup -% \math_matrix_check_rule[#1]% -% \divide\scratchdimen\plustwo -% \autorule\s!height\scratchdimen\s!depth\scratchdimen\relax -% \egroup} -% -% \permanent\tolerant\protected\def\math_matrix_VL[#1]#*% -% {\NC -% \math_matrix_check_rule[#1]% -% \divide\d_math_eqalign_distance\plustwo -% \hskip-\d_math_eqalign_distance -% \autorule\s!width\scratchdimen\relax -% \hskip-\d_math_eqalign_distance -% \NC} - % These offset are an experiment so we abuse some existing keys or we have to % cook up new ones. Maybe we then should provide small medium big halfline etc. % but all depends on actual demand for this feature. +% Musical timestamp VL, NL, SL: Bad Hombre II by Antonio Sanches +% +% \startformula +% \startmatrix[left=\left(,right=\right)] +% \NC 0 \NL 0 \NC 0 \NC 2x \NC 1 \NC 0 \NC 0 \NL \NR +% \NC 0 \VL 0 \NC 0 \NC 0 \NC 2x \NC 0 \NC 0 \NL \NR +% \NC 0 \VL 0 \NC 0 \NC 0 \NC 0 \NC 3x \NC 0 \NL \NR +% \NC 0 \NL 0 \NC 0 \NC 0 \NC 0 \NC 0 \NC 4x \VL \NR +% \stopmatrix +% \stopformula +% +% \startformula +% \startmatrix[left=\left(,right=\right)] +% \SL[3] \NL \NL \NL \NL \NL \NR +% \VL 2x \NL 1 \NL 0 \VL 0 \NL 0 \NL 0 \NL 0 \NL \NR +% \VL 0 \NL 2x \NL 1 \VL 0 \NL 0 \NL 0 \NL 0 \NL \NR +% \VL 0 \NL 0 \NL 2x \VL 0 \NL 0 \NL 0 \NL 0 \NL \NR +% \SL[5] \NL \NL \NL \NR +% \NL 0 \NL 0 \NL 0 \VL 2x \NL 1 \VL 0 \NL 0 \NL \NR +% \NL 0 \NL 0 \NL 0 \VL 0 \NL 2x \VL 0 \NL 0 \NL \NR +% \NL \NL \NL \SL[3] \NL \NL \NR +% \NL 0 \NL 0 \NL 0 \NL 0 \NL 0 \VL 3x \VL 0 \NL \NR +% \NL \NL \NL \NL \NL \SL[2] \NL \NR +% \NL 0 \NL 0 \NL 0 \NL 0 \NL 0 \NL 0 \VL 3x \VL \NR +% \NL \NL \NL \NL \NL \NL \SL[1] \NL \NR +% \stopmatrix +% \stopformula + \definesystemattribute[mathalignmentvrule][public] +\definesystemattribute[mathalignmenthrule][public] \setupmathmatrix [%c!toffset=\zeropoint, @@ -1417,32 +1430,136 @@ \fi \egroup} -\protected\def\math_matrix_vertical_rule#1% - {\math_matrix_check_rule[#1]% +\protected\def\math_matrix_vertical_rule_indeed#1#2% + {\math_matrix_check_rule[#2]% \enablematrixrules - \vrule + #1 \s!attr \mathalignmentvruleattribute\plusone \s!width \scratchdimen \s!top -\dimexpr\mathmatrixparameter\c!toffset\relax \s!bottom-\dimexpr\mathmatrixparameter\c!boffset\relax \relax} +\protected\def\math_matrix_vertical_rule_yes{\math_matrix_vertical_rule_indeed\vrule } +\protected\def\math_matrix_vertical_rule_nop{\math_matrix_vertical_rule_indeed\novrule} + +\installcorenamespace{mathmatrixrulealternative} + +\newboundary\c_math_matrix_vl_boundary +%newboundary\c_math_matrix_sl_boundary + +\protected\def\math_matrix_horizontal_rule_indeed#1#2% + {\math_matrix_check_rule[#2]% + \global\setfalse\c_math_matrix_first + \global\settrue\c_math_matrix_sl_seen + \enablematrixrules + \leaders#1% + \s!attr \mathalignmenthruleattribute\plusone + \s!height .5\scratchdimen + \s!depth .5\scratchdimen + % \s!top -\dimexpr\mathmatrixparameter\c!toffset\relax + % \s!bottom-\dimexpr\mathmatrixparameter\c!boffset\relax + \hfilll + \kern\dimexpr.5\d_math_eqalign_distance\relax + \aligntab} + +\protected\def\math_matrix_horizontal_rule_yes{\math_matrix_horizontal_rule_indeed\hrule } +\protected\def\math_matrix_horizontal_rule_nop{\math_matrix_horizontal_rule_indeed\nohrule} + +\def\math_matrix_hrule_progress_rest#1% + {\expandedloop + \plusone + \numexpr(\ifchknum#1\or#1\else\c_math_matrix_columns\fi)*\plustwo+\minusone\relax + \plusone + {\span\omit}}% + +\def\math_matrix_hrule_progress_first#1% + {\expandedloop + \plusone + \numexpr(\ifchknum#1\or#1\else\c_math_matrix_columns\fi+\minusone)*\plustwo+\plusone\relax + \plusone + {\span\omit}}% + +\def\math_matrix_hrule_progress + {\NL + \ifconditional\c_math_matrix_first + \expandafter\math_matrix_hrule_progress_first + \else + \expandafter\math_matrix_hrule_progress_rest + \fi} + +\tolerant\permanent\protected\def\SL[#1]#*[#2]#*% [n] [name] | [name] | [n] + {\ifcsname\??mathmatrixrulealternative#2\endcsname + \lastnamedcs{#1}{#2}% + \orelse\ifcsname\??mathmatrixrulealternative#1\endcsname + \lastnamedcs{#2}{#1}% + \else + \csname\??mathmatrixrulealternative\v!auto\endcsname{#1}{#2}% + \fi} + +\defcsname\??mathmatrixrulealternative\v!auto\endcsname#1#2% + {\math_matrix_hrule_progress{#1}% + \ifnum\c_math_matrix_first=\zerocount + \kern-\dimexpr\linewidth\relax + \else + \kern-\dimexpr.5\d_math_eqalign_distance+\linewidth\relax + \fi + \math_matrix_horizontal_rule_yes{#2}% + %boundary\c_math_matrix_sl_boundary + \enforced\let\NR\math_matrix_NL_NR} \permanent\tolerant\protected\def\math_matrix_VL[#1]#*% {\span\omit - \hskip.5\d_math_eqalign_distance - \math_matrix_vertical_rule{#1}% - \hskip.5\d_math_eqalign_distance - \aligntab} + \ifconditional\c_math_matrix_first\else + \kern.5\d_math_eqalign_distance % hskip + \fi + \math_matrix_vertical_rule_yes{#1}% + \kern.5\d_math_eqalign_distance % hskip + \global\setfalse\c_math_matrix_first + \aligntab + \boundary\c_math_matrix_vl_boundary + \enforced\let\NR\math_matrix_NL_NR + } + +\permanent\tolerant\protected\def\math_matrix_NL[#1]#*% + {\span\omit + \ifconditional\c_math_matrix_first\else + \kern.5\d_math_eqalign_distance % hskip + \fi + \math_matrix_vertical_rule_nop{#1}% + \kern.5\d_math_eqalign_distance % hskip + \global\setfalse\c_math_matrix_first + \aligntab + \boundary\c_math_matrix_vl_boundary + \enforced\let\NR\math_matrix_NL_NR} + +\permanent\protected\def\math_matrix_NL_NR + {\ifnum\lastboundary=\c_math_matrix_vl_boundary + \ifconditional \c_math_matrix_sl_seen + \kern-1.5\d_math_eqalign_distance % hskip + \else + \kern-.5\d_math_eqalign_distance % hskip + \fi + \fi + \math_matrix_anchor_last + \math_matrix_stop_row + \math_matrix_pickup + \crcr + \math_matrix_start_row} + +\appendtoks + \enforced\let\NL\math_matrix_NL + \global\setfalse\c_math_matrix_sl_seen +\to \everymathmatrix \permanent\tolerant\protected\def\math_matrix_VC[#1]#*% {\NC - \math_matrix_vertical_rule{#1}% + \math_matrix_vertical_rule_yes{#1}% \NC} \permanent\tolerant\protected\def\math_matrix_VT[#1]#*% {\span\omit - \math_matrix_vertical_rule{#1}% + \math_matrix_vertical_rule_yes{#1}% \aligntab} \def\math_matrix_start_row @@ -1531,6 +1648,7 @@ callback \s!attr \mathmatrixornamentattribute "10 \s!attr \mathalignmentvruleattribute \plusone + \s!attr \mathalignmenthruleattribute \plusone \bgroup % preamble \span\math_matrix_preamble @@ -2300,7 +2418,7 @@ \hpack to \displaywidth\bgroup \hss \strc_math_flush_number_box - \hskip\d_framed_locator_ro + \kern\d_framed_locator_ro \egroup \egroup \strc_math_flush_box_framed_fit_inline} @@ -2308,7 +2426,7 @@ \def\strc_math_number_left_overflow_inside {\setbox\b_strc_math_display\vpack\bgroup \hpack to \displaywidth\bgroup - % \hskip\d_framed_locator_lo + % \kern\d_framed_locator_lo \strc_math_flush_number_box \hss \egroup @@ -2722,7 +2840,7 @@ \ifzeropt\scratchdimen\else\kern\scratchdimen\fi \setbox\scratchbox\hbox{\mathsimplealignparameter\c!text}% \ifvoid\scratchbox\else - \hskip\mathsimplealignparameter\c!textdistance + \kern\mathsimplealignparameter\c!textdistance % hskip \vcenter{\box\scratchbox}% \fi \egroup diff --git a/tex/context/base/mkxl/math-del.mklx b/tex/context/base/mkxl/math-del.mklx index edfd77de2..cfb8dc5d2 100644 --- a/tex/context/base/mkxl/math-del.mklx +++ b/tex/context/base/mkxl/math-del.mklx @@ -105,6 +105,13 @@ [fourier] [\c!right=\delimitedrighttildeuc] +% \definemathdelimited +% [bannuity] +% [%topoffset=.2\exheight, +% \c!strut=no, +% \c!rightmargin=.05\emwidth, +% \c!right=\delimitedrightanutityuc] + % $ \autofences \fourier{(z+\frac12)} + \courier{(z+\frac12)} + \xourier{(z+\frac12)} $ \protect \endinput diff --git a/tex/context/base/mkxl/math-fbk.lmt b/tex/context/base/mkxl/math-fbk.lmt index 185bb0d55..052f15f50 100644 --- a/tex/context/base/mkxl/math-fbk.lmt +++ b/tex/context/base/mkxl/math-fbk.lmt @@ -168,7 +168,7 @@ end -- a few examples: -local addextra = mathematics.extras.add +-- local addextra = mathematics.extras.add -- addextra(0xFE350) -- MATHEMATICAL DOUBLE ARROW LEFT END -- addextra(0xFE351) -- MATHEMATICAL DOUBLE ARROW MIDDLE PART @@ -395,7 +395,7 @@ local addextra = mathematics.extras.add -- local height = target.parameters.xheight / 2 -- local c, done = accent_to_extensible(target,private,data.original,unicode,height,0,nil,-height,unicode) -- if done then --- c.topaccent = nil -- or maybe also all the others +-- c.topanchor = nil -- or maybe also all the others -- end -- return c -- end diff --git a/tex/context/base/mkxl/math-fen.mkxl b/tex/context/base/mkxl/math-fen.mkxl index 7cb775294..b3c85070f 100644 --- a/tex/context/base/mkxl/math-fen.mkxl +++ b/tex/context/base/mkxl/math-fen.mkxl @@ -53,6 +53,7 @@ \c!source=\zerocount, \c!height=\zeropoint, \c!depth=\zeropoint, + \c!distance=\zerocount, \c!factor=\v!auto] \appendtoks @@ -314,7 +315,66 @@ \installlocalcurrenthandler \??mathfences {mathfence} -\tolerant\protected\def\math_fenced_fenced#1#*[#2]% +%D The horizontal text variant was introduced for Alan Braslau. Because this is not +%D used that often we only support double text arguments. +%D +%D Musical timestamp: I am The Moon by Tedeschi Trucks Band + +% \definemathfence [tupdownarrows] [text] [\c!left="2191,\c!right="2193] + +\protected\def\math_fenced_horizontal_common#1#2#3#4% \Uwhatever class symbol source + {\c_math_fenced_class\mathfenceparameter#2\relax + \edef\p_fence{#3}% + #1% \Uleft \Umiddle \Uleft + \usedcolorparameterattributes{\mathfenceparameter\c!color}% + \s!leftclass \mathunspacedcode + \s!rightclass \mathunspacedcode + \s!class \mathunspacedcode + \s!source \numexpr\namedboxanchor{\mathfenceparameter#4}\relax + \Udelimiter\mathghostcode\fam\p_fence} + +\tolerant\protected\def\math_fenced_horizontal#1#*[#2]#:#*#3#4% + {% \csname math\mathfenceparameter\c!mathclass\endcsname + \mathord \bgroup % class here + \setlocalmathfencecurrent{#1}% \edef\currentmathfence{#1}% + \setupcurrentmathfence[#2]% + % \usemathstyleparameter\mathfenceparameter\c!mathstyle + \setmathsmalltextbox\scratchboxone\hbox{\usemathfencestyleandcolor\c!leftstyle \c!leftcolor #3}% + \setmathsmalltextbox\scratchboxtwo\hbox{\usemathfencestyleandcolor\c!rightstyle\c!rightcolor#4}% + \let\math_fenced_common\math_fenced_horizontal_common + \edef\p_fenced_middle{\mathfenceparameter\c!middle}% + \ifempty\p_fenced_middle\else + \letmathfenceparameter\c!left \p_fenced_middle + \letmathfenceparameter\c!right\zerocount + \fi + \scratchdistance\mathfenceparameter\c!distance + \box\scratchboxone + \kern\scratchdistance + \math_fenced_fenced_start\currentmathfence + \math_fenced_fenced_stop \currentmathfence + \kern\scratchdistance + \box\scratchboxtwo + \egroup} + +\tolerant\protected\def\math_fenced_fenced#1% + {\ifcstok{\namedmathfenceparameter{#1}\c!text}\v!yes % not the best keyword + \expandafter\math_fenced_horizontal + \else + \expandafter\math_fenced_vertical + \fi{#1}} + +% two step because we don't want to define text itself as command + +\definemathfence + [\v!text] + +\setupmathfence + [\v!text] + [\c!text=\v!yes, + \c!command=\v!yes, + \c!distance=.125\emwidth] + +\tolerant\protected\def\math_fenced_vertical#1#*[#2]% {\begingroup %{\beginmathgroup \setlocalmathfencecurrent{#1}% \edef\currentmathfence{#1}% @@ -1129,4 +1189,14 @@ \setmathoptions\mathmiddlecode bor \autoinjectclassoptioncode \relax} +%D New (to be completed): + +% $x + \tupdownarrows{left}{right} + x$ +% $x + \tdownuparrows{left}{right} + x$ +% $x + \tupanddownarrows[color=red,leftcolor=green,rightcolor=blue]{left}{right} + x$ + +\definemathfence [tupanddownarrows] [\v!text] [\c!left="2191,\c!right="2193] +\definemathfence [tupdownarrows] [\v!text] [\c!left="21C5,\c!right=0] +\definemathfence [tdownuparrows] [\v!text] [\c!middle="21F5] + \protect diff --git a/tex/context/base/mkxl/math-fnt.lmt b/tex/context/base/mkxl/math-fnt.lmt index 1901d79ae..cd4976900 100644 --- a/tex/context/base/mkxl/math-fnt.lmt +++ b/tex/context/base/mkxl/math-fnt.lmt @@ -50,13 +50,15 @@ local function register_extensible(font,char,style,box) local private = fonts.helpers.setboxdirectly(font,unicode,box) -- we saved a scaled glyph stream so we now use an unscaled one ... local g = new_glyph(font,private,al) + if fonts.hashes.properties[font].compactmath then + nuts.setscales(g,1000,1000,1000) + end local n = new_hlist(g) -- if newcommands then oldchar.commands = newcommands end -- - -- local newchar = { -- unicode = unicode, -- width = wd, @@ -77,7 +79,6 @@ local function register_extensible(font,char,style,box) -- end -- end -- addcharacters(font, { [private] = newchar }) - -- so the dimensions of the box don't match the glyph scale! setwhd(n,wd,ht,dp) setattrlst(n,al) diff --git a/tex/context/base/mkxl/math-frc.mkxl b/tex/context/base/mkxl/math-frc.mkxl index c0ef58c27..42e665f75 100644 --- a/tex/context/base/mkxl/math-frc.mkxl +++ b/tex/context/base/mkxl/math-frc.mkxl @@ -269,8 +269,8 @@ \Udelimiter\zerocount\fam\scratchcountertwo} \defcsname\??fractionmethods\v!vertical \v!auto \v!none\endcsname{\Uover} \defcsname\??fractionmethods\v!vertical \v!auto \endcsname{\Uoverwithdelims - \Udelimiter\zerocount\fam\scratchcounterone - \Udelimiter\zerocount\fam\scratchcountertwo} + \Udelimiter\zerocount\fam\scratchcounterone + \Udelimiter\zerocount\fam\scratchcountertwo} \defcsname\??fractionmethods\v!vertical \v!symbol \v!none\endcsname{\Ustretched \Udelimiter\zerocount\fam\scratchcounterthree} \defcsname\??fractionmethods\v!vertical \v!symbol \endcsname{\Ustretchedwithdelims @@ -452,34 +452,20 @@ \to \everysetupmathfraction \def\math_fraction_set_threshold_inline_auto - {\Umathfractiondelsize\textstyle \maxdimen - \Umathfractiondelsize\scriptstyle \maxdimen - \Umathfractiondelsize\scriptscriptstyle\maxdimen -\Umathfractiondelsize\crampedtextstyle \Umathfractiondelsize\textstyle -\Umathfractiondelsize\crampedscriptstyle \Umathfractiondelsize\scriptstyle -\Umathfractiondelsize\crampedscriptscriptstyle\Umathfractiondelsize\scriptscriptstyle - } + {\Umathfractiondelsize\allmathstyles\maxdimen} \def\math_fraction_set_threshold_display_auto - {\Umathfractiondelsize\displaystyle \maxdimen -\Umathfractiondelsize\crampeddisplaystyle \Umathfractiondelsize\displaystyle - } + {\Umathfractiondelsize\alldisplaystyles\maxdimen} \def\math_fraction_set_threshold_inline_ratio {\edef\p_threshold{\mathfractionparameter\c!inlinethreshold}% - \Umathfractiondelsize\textstyle \p_threshold\dimexpr\textface\relax - \Umathfractiondelsize\scriptstyle \p_threshold\dimexpr\scriptface\relax - \Umathfractiondelsize\scriptscriptstyle\p_threshold\dimexpr\scriptscriptface\relax -\Umathfractiondelsize\crampedtextstyle \Umathfractiondelsize\textstyle -\Umathfractiondelsize\crampedscriptstyle \Umathfractiondelsize\scriptstyle -\Umathfractiondelsize\crampedscriptscriptstyle\Umathfractiondelsize\scriptscriptstyle - } + \Umathfractiondelsize\alltextstyles \p_threshold\dimexpr\textface\relax + \Umathfractiondelsize\allscriptstyles \p_threshold\dimexpr\scriptface\relax + \Umathfractiondelsize\allscriptscriptstyles\p_threshold\dimexpr\scriptscriptface\relax} \def\math_fraction_set_threshold_display_ratio {\edef\p_threshold{\mathfractionparameter\c!displaythreshold}% - \Umathfractiondelsize\displaystyle \p_threshold\dimexpr\textface\relax -\Umathfractiondelsize\crampeddisplaystyle \Umathfractiondelsize\displaystyle - } + \Umathfractiondelsize\alldisplaystyles\p_threshold\dimexpr\textface\relax} \setupmathfractions [\c!inlinethreshold=.25, % no unit but fraction diff --git a/tex/context/base/mkxl/math-ini.mkxl b/tex/context/base/mkxl/math-ini.mkxl index bf674068a..d13c2447c 100644 --- a/tex/context/base/mkxl/math-ini.mkxl +++ b/tex/context/base/mkxl/math-ini.mkxl @@ -55,7 +55,7 @@ \registerctxluafile{math-ini}{autosuffix} \registerctxluafile{math-dim}{autosuffix} -% \registerctxluafile{math-act}{autosuffix} +%registerctxluafile{math-act}{autosuffix} \registerctxluafile{math-ext}{} \registerctxluafile{math-vfu}{autosuffix} \registerctxluafile{math-ttv}{} @@ -65,7 +65,7 @@ \registerctxluafile{math-noa}{autosuffix} \registerctxluafile{math-tag}{autosuffix} \registerctxluafile{math-fbk}{autosuffix} -\registerctxluafile{math-dir}{} +%registerctxluafile{math-dir}{} \registerctxluafile{math-spa}{autosuffix} \registerctxluafile{math-fnt}{autosuffix} \registerctxluafile{math-pre}{autosuffix} @@ -107,6 +107,8 @@ +\analyzescriptnucleuscharmathcontrolcode +\analyzescriptnucleuslistmathcontrolcode +\analyzescriptnucleusboxmathcontrolcode + +\accenttopskewwithoffsetmathcontrolcode + % +\ignorekerndimensionsmathcontrolcode % xits needs this (bad depth of fences) \relax % \mathpenaltiesmode\plusone @@ -513,8 +515,22 @@ \defaultmathclassoptions % +\checkligatureclassoptioncode +\checkkernpairclassoptioncode + % up to Mikael to decide, ok with italic chars, maybe less so with raw ints: + % +\operatoritaliccorrectionclassoptioncode \relax +% we tweak away weird italics so only special cases see this: +% +% \def\IntOr{\Umathchar\mathordinarycode"00"00222B } +% \def\IntOp{\Umathchar\mathoperatorcode"00"00222B } +% +% \showglyphs \showfontitalics +% $\IntOp\limits x \quad \IntOp\limits^1_2 x \quad \IntOp\nolimits^1_2 x $\blank +% $\IntOr\limits x \quad \IntOr\limits^1_2 x \quad \IntOr\nolimits^1_2 x $\blank +% +% $\mathop{f} (x) \quad \mathop{f}\limits (x) \quad \mathop{f}\nolimits (x)$\blank +% $\mathop{f}^a_b (x) \quad \mathop{f}\limits^a_b (x) \quad \mathop{f}\nolimits^a_b (x)$\blank + \setmathoptions\mathbinarycode\numexpr \defaultmathclassoptions +\lookaheadforendclassoptioncode @@ -1099,318 +1115,317 @@ \startsetups math:spacing:presets \resetmathspacing % - % \inherited\setmathspacing \mathordinarycode \mathordinarycode \allmathstyles \zeromuskip - \inherited\setmathspacing \mathordinarycode \mathoperatorcode \allmathstyles \thinmuskip - \inherited\setmathspacing \mathordinarycode \mathbinarycode \allsplitstyles \medmuskip - \inherited\setmathspacing \mathordinarycode \mathbinarycode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathordinarycode \mathrelationcode \allsplitstyles \thickmuskip - \inherited\setmathspacing \mathordinarycode \mathrelationcode \allscriptstyles \pettymuskip - % \inherited\setmathspacing \mathordinarycode \mathopencode \allmathstyles \zeromuskip - \inherited\setmathspacing \mathordinarycode \mathmiddlecode \allsplitstyles \thickmuskip - \inherited\setmathspacing \mathordinarycode \mathmiddlecode \allscriptstyles \pettymuskip - % \inherited\setmathspacing \mathordinarycode \mathclosecode \allmathstyles \zeromuskip - % \inherited\setmathspacing \mathordinarycode \mathpunctuationcode \allmathstyles \zeromuskip - \inherited\setmathspacing \mathordinarycode \mathconstructcode \allsplitstyles \thinmuskip - \inherited\setmathspacing \mathordinarycode \mathconstructcode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathordinarycode \mathellipsiscode \allsplitstyles \thinmuskip - \inherited\setmathspacing \mathordinarycode \mathellipsiscode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathordinarycode \mathfractioncode \allsplitstyles \tinymuskip - \inherited\setmathspacing \mathordinarycode \mathfractioncode \allscriptstyles \pettymuskip - % \inherited\setmathspacing \mathordinarycode \mathradicalcode \allsplitstyles \tinymuskip % 220705 Results in an unwanted space - % \inherited\setmathspacing \mathordinarycode \mathradicalcode \allscriptstyles \pettymuskip % 220705 Results in an unwanted space - % - \inherited\setmathspacing \mathoperatorcode \mathordinarycode \allmathstyles \thinmuskip - \inherited\setmathspacing \mathoperatorcode \mathoperatorcode \allmathstyles \thinmuskip - % \inherited\setmathspacing \mathoperatorcode \mathbinarycode \allmathstyles \ zeromuskip - \inherited\setmathspacing \mathoperatorcode \mathrelationcode \allsplitstyles \thickmuskip - \inherited\setmathspacing \mathoperatorcode \mathrelationcode \allscriptstyles \pettymuskip - % \inherited\setmathspacing \mathoperatorcode \mathopencode \allmathstyles \zeromuskip - \inherited\setmathspacing \mathoperatorcode \mathmiddlecode \allsplitstyles \thickmuskip - \inherited\setmathspacing \mathoperatorcode \mathmiddlecode \allscriptstyles \pettymuskip - % \inherited\setmathspacing \mathoperatorcode \mathclosecode \allmathstyles \zeromuskip - % \inherited\setmathspacing \mathoperatorcode \mathpunctuationcode \allmathstyles \zeromuskip - \inherited\setmathspacing \mathoperatorcode \mathconstructcode \allsplitstyles \thinmuskip - \inherited\setmathspacing \mathoperatorcode \mathconstructcode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathoperatorcode \mathellipsiscode \allsplitstyles \thinmuskip - \inherited\setmathspacing \mathoperatorcode \mathellipsiscode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathoperatorcode \mathfractioncode \allmathstyles \thinmuskip - \inherited\setmathspacing \mathoperatorcode \mathradicalcode \allmathstyles \thinmuskip + % \inherited\setmathspacing \mathordinarycode \mathordinarycode \allmathstyles \zeromuskip + \inherited\setmathspacing \mathordinarycode \mathoperatorcode \allmathstyles \thinmuskip + \inherited\setmathspacing \mathordinarycode \mathbinarycode \allsplitstyles \medmuskip + \inherited\setmathspacing \mathordinarycode \mathbinarycode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathordinarycode \mathrelationcode \allsplitstyles \thickmuskip + \inherited\setmathspacing \mathordinarycode \mathrelationcode \allunsplitstyles \pettymuskip + % \inherited\setmathspacing \mathordinarycode \mathopencode \allmathstyles \zeromuskip + \inherited\setmathspacing \mathordinarycode \mathmiddlecode \allsplitstyles \thickmuskip + \inherited\setmathspacing \mathordinarycode \mathmiddlecode \allunsplitstyles \pettymuskip + % \inherited\setmathspacing \mathordinarycode \mathclosecode \allmathstyles \zeromuskip + % \inherited\setmathspacing \mathordinarycode \mathpunctuationcode \allmathstyles \zeromuskip + \inherited\setmathspacing \mathordinarycode \mathconstructcode \allsplitstyles \thinmuskip + \inherited\setmathspacing \mathordinarycode \mathconstructcode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathordinarycode \mathellipsiscode \allsplitstyles \thinmuskip + \inherited\setmathspacing \mathordinarycode \mathellipsiscode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathordinarycode \mathfractioncode \allsplitstyles \tinymuskip + \inherited\setmathspacing \mathordinarycode \mathfractioncode \allunsplitstyles \pettymuskip + % \inherited\setmathspacing \mathordinarycode \mathradicalcode \allsplitstyles \tinymuskip % 220705 Results in an unwanted space + % \inherited\setmathspacing \mathordinarycode \mathradicalcode \allunsplitstyles \pettymuskip % 220705 Results in an unwanted space % - \inherited\setmathspacing \mathbinarycode \mathordinarycode \allsplitstyles \medmuskip - \inherited\setmathspacing \mathbinarycode \mathordinarycode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathbinarycode \mathoperatorcode \allsplitstyles \medmuskip - \inherited\setmathspacing \mathbinarycode \mathoperatorcode \allscriptstyles \pettymuskip - %% \inherited\setmathspacing \mathbinarycode \mathbinarycode \allmathstyles \zeromuskip - %% \inherited\setmathspacing \mathbinarycode \mathrelationcode \allmathstyles \zeromuskip - \inherited\setmathspacing \mathbinarycode \mathopencode \allsplitstyles \medmuskip - \inherited\setmathspacing \mathbinarycode \mathopencode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathbinarycode \mathmiddlecode \allsplitstyles \thickmuskip - \inherited\setmathspacing \mathbinarycode \mathmiddlecode \allscriptstyles \pettymuskip - %% \inherited\setmathspacing \mathbinarycode \mathclosecode \allmathstyles \zeromuskip - \inherited\setmathspacing \mathbinarycode \mathpunctuationcode \allsplitstyles \medmuskip - \inherited\setmathspacing \mathbinarycode \mathpunctuationcode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathbinarycode \mathconstructcode \allsplitstyles \medmuskip - \inherited\setmathspacing \mathbinarycode \mathconstructcode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathbinarycode \mathellipsiscode \allsplitstyles \medmuskip - \inherited\setmathspacing \mathbinarycode \mathellipsiscode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathbinarycode \mathfractioncode \allsplitstyles \medmuskip - \inherited\setmathspacing \mathbinarycode \mathfractioncode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathbinarycode \mathradicalcode \allsplitstyles \medmuskip - \inherited\setmathspacing \mathbinarycode \mathradicalcode \allscriptstyles \pettymuskip + \inherited\setmathspacing \mathoperatorcode \mathordinarycode \allmathstyles \thinmuskip + \inherited\setmathspacing \mathoperatorcode \mathoperatorcode \allmathstyles \thinmuskip + % \inherited\setmathspacing \mathoperatorcode \mathbinarycode \allmathstyles \zeromuskip + \inherited\setmathspacing \mathoperatorcode \mathrelationcode \allsplitstyles \thickmuskip + \inherited\setmathspacing \mathoperatorcode \mathrelationcode \allunsplitstyles \pettymuskip + % \inherited\setmathspacing \mathoperatorcode \mathopencode \allmathstyles \zeromuskip + \inherited\setmathspacing \mathoperatorcode \mathmiddlecode \allsplitstyles \thickmuskip + \inherited\setmathspacing \mathoperatorcode \mathmiddlecode \allunsplitstyles \pettymuskip + % \inherited\setmathspacing \mathoperatorcode \mathclosecode \allmathstyles \zeromuskip + % \inherited\setmathspacing \mathoperatorcode \mathpunctuationcode \allmathstyles \zeromuskip + \inherited\setmathspacing \mathoperatorcode \mathconstructcode \allsplitstyles \thinmuskip + \inherited\setmathspacing \mathoperatorcode \mathconstructcode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathoperatorcode \mathellipsiscode \allsplitstyles \thinmuskip + \inherited\setmathspacing \mathoperatorcode \mathellipsiscode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathoperatorcode \mathfractioncode \allmathstyles \thinmuskip + \inherited\setmathspacing \mathoperatorcode \mathradicalcode \allmathstyles \thinmuskip % - \inherited\setmathspacing \mathrelationcode \mathordinarycode \allsplitstyles \thickmuskip - \inherited\setmathspacing \mathrelationcode \mathordinarycode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathrelationcode \mathoperatorcode \allsplitstyles \thickmuskip - \inherited\setmathspacing \mathrelationcode \mathoperatorcode \allscriptstyles \pettymuskip - %% \inherited\setmathspacing \mathrelationcode \mathbinarycode \allmathstyles \zeromuskip - % \inherited\setmathspacing \mathrelationcode \mathrelationcode \allmathstyles \zeromuskip - \inherited\setmathspacing \mathrelationcode \mathopencode \allsplitstyles \thickmuskip - \inherited\setmathspacing \mathrelationcode \mathopencode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathrelationcode \mathmiddlecode \allsplitstyles \thickmuskip - \inherited\setmathspacing \mathrelationcode \mathmiddlecode \allscriptstyles \thinmuskip - % \inherited\setmathspacing \mathrelationcode \mathclosecode \allmathstyles \zeromuskip - \inherited\setmathspacing \mathrelationcode \mathpunctuationcode \allsplitstyles \thickmuskip - \inherited\setmathspacing \mathrelationcode \mathpunctuationcode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathrelationcode \mathconstructcode \allsplitstyles \thickmuskip - \inherited\setmathspacing \mathrelationcode \mathconstructcode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathrelationcode \mathellipsiscode \allsplitstyles \thickmuskip - \inherited\setmathspacing \mathrelationcode \mathellipsiscode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathrelationcode \mathfractioncode \allsplitstyles \thickmuskip - \inherited\setmathspacing \mathrelationcode \mathfractioncode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathrelationcode \mathradicalcode \allsplitstyles \thickmuskip - \inherited\setmathspacing \mathrelationcode \mathradicalcode \allscriptstyles \pettymuskip + \inherited\setmathspacing \mathbinarycode \mathordinarycode \allsplitstyles \medmuskip + \inherited\setmathspacing \mathbinarycode \mathordinarycode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathbinarycode \mathoperatorcode \allsplitstyles \medmuskip + \inherited\setmathspacing \mathbinarycode \mathoperatorcode \allunsplitstyles \pettymuskip + %% \inherited\setmathspacing \mathbinarycode \mathbinarycode \allmathstyles \zeromuskip + %% \inherited\setmathspacing \mathbinarycode \mathrelationcode \allmathstyles \zeromuskip + \inherited\setmathspacing \mathbinarycode \mathopencode \allsplitstyles \medmuskip + \inherited\setmathspacing \mathbinarycode \mathopencode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathbinarycode \mathmiddlecode \allsplitstyles \thickmuskip + \inherited\setmathspacing \mathbinarycode \mathmiddlecode \allunsplitstyles \pettymuskip + %% \inherited\setmathspacing \mathbinarycode \mathclosecode \allmathstyles \zeromuskip + \inherited\setmathspacing \mathbinarycode \mathpunctuationcode \allsplitstyles \medmuskip + \inherited\setmathspacing \mathbinarycode \mathpunctuationcode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathbinarycode \mathconstructcode \allsplitstyles \medmuskip + \inherited\setmathspacing \mathbinarycode \mathconstructcode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathbinarycode \mathellipsiscode \allsplitstyles \medmuskip + \inherited\setmathspacing \mathbinarycode \mathellipsiscode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathbinarycode \mathfractioncode \allsplitstyles \medmuskip + \inherited\setmathspacing \mathbinarycode \mathfractioncode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathbinarycode \mathradicalcode \allsplitstyles \medmuskip + \inherited\setmathspacing \mathbinarycode \mathradicalcode \allunsplitstyles \pettymuskip % - % \inherited\setmathspacing \mathopencode \mathordinarycode \allmathstyles \zeromuskip - % \inherited\setmathspacing \mathopencode \mathoperatorcode \allmathstyles \zeromuskip - % \inherited\setmathspacing \mathopencode \mathbinarycode \allmathstyles \zeromuskip - % \inherited\setmathspacing \mathopencode \mathrelationcode \allmathstyles \zeromuskip - % \inherited\setmathspacing \mathopencode \mathopencode \allmathstyles \zeromuskip - % \inherited\setmathspacing \mathopencode \mathmiddlecode \allmathstyles \zeromuskip - % \inherited\setmathspacing \mathopencode \mathclosecode \allmathstyles \zeromuskip - % \inherited\setmathspacing \mathopencode \mathpunctuationcode \allmathstyles \zeromuskip - % \inherited\setmathspacing \mathopencode \mathconstructcode \allmathstyles \zeromuskip - % \inherited\setmathspacing \mathopencode \mathellipsiscode \allmathstyles \zeromuskip - \inherited\setmathspacing \mathopencode \mathfractioncode \allmathstyles \pettymuskip - % \inherited\setmathspacing \mathopencode \mathradicalcode \allmathstyles \zeromuskip + \inherited\setmathspacing \mathrelationcode \mathordinarycode \allsplitstyles \thickmuskip + \inherited\setmathspacing \mathrelationcode \mathordinarycode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathrelationcode \mathoperatorcode \allsplitstyles \thickmuskip + \inherited\setmathspacing \mathrelationcode \mathoperatorcode \allunsplitstyles \pettymuskip + %% \inherited\setmathspacing \mathrelationcode \mathbinarycode \allmathstyles \zeromuskip + % \inherited\setmathspacing \mathrelationcode \mathrelationcode \allmathstyles \zeromuskip + \inherited\setmathspacing \mathrelationcode \mathopencode \allsplitstyles \thickmuskip + \inherited\setmathspacing \mathrelationcode \mathopencode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathrelationcode \mathmiddlecode \allsplitstyles \thickmuskip + \inherited\setmathspacing \mathrelationcode \mathmiddlecode \allunsplitstyles \thinmuskip + % \inherited\setmathspacing \mathrelationcode \mathclosecode \allmathstyles \zeromuskip + \inherited\setmathspacing \mathrelationcode \mathpunctuationcode \allsplitstyles \thickmuskip + \inherited\setmathspacing \mathrelationcode \mathpunctuationcode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathrelationcode \mathconstructcode \allsplitstyles \thickmuskip + \inherited\setmathspacing \mathrelationcode \mathconstructcode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathrelationcode \mathellipsiscode \allsplitstyles \thickmuskip + \inherited\setmathspacing \mathrelationcode \mathellipsiscode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathrelationcode \mathfractioncode \allsplitstyles \thickmuskip + \inherited\setmathspacing \mathrelationcode \mathfractioncode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathrelationcode \mathradicalcode \allsplitstyles \thickmuskip + \inherited\setmathspacing \mathrelationcode \mathradicalcode \allunsplitstyles \pettymuskip % - \inherited\setmathspacing \mathclosecode \mathordinarycode \allmathstyles \tinymuskip - \inherited\setmathspacing \mathclosecode \mathoperatorcode \allmathstyles \thinmuskip - \inherited\setmathspacing \mathclosecode \mathbinarycode \allsplitstyles \medmuskip - \inherited\setmathspacing \mathclosecode \mathbinarycode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathclosecode \mathrelationcode \allsplitstyles \thickmuskip - \inherited\setmathspacing \mathclosecode \mathrelationcode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathclosecode \mathopencode \alltextstyles \tinymuskip - \inherited\setmathspacing \mathclosecode \mathopencode \alldisplaystyles\thinmuskip - \inherited\setmathspacing \mathclosecode \mathopencode \allscriptstyles \pettymuskip - % \inherited\setmathspacing \mathclosecode \mathmiddlecode \allmathstyles \zeromuskip - % \inherited\setmathspacing \mathclosecode \mathclosecode \allmathstyles \zeromuskip - % \inherited\setmathspacing \mathclosecode \mathpunctuationcode \allmathstyles \zeromuskip - \inherited\setmathspacing \mathclosecode \mathconstructcode \allsplitstyles \thinmuskip - \inherited\setmathspacing \mathclosecode \mathconstructcode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathclosecode \mathfactorialcode \allmathstyles \zeromuskip - \inherited\setmathspacing \mathclosecode \mathellipsiscode \allsplitstyles \thinmuskip - \inherited\setmathspacing \mathclosecode \mathellipsiscode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathclosecode \mathfractioncode \allsplitstyles \thinmuskip - \inherited\setmathspacing \mathclosecode \mathfractioncode \allscriptstyles \pettymuskip - % \inherited\setmathspacing \mathclosecode \mathradicalcode \allmathstyles \zeromuskip + % \inherited\setmathspacing \mathopencode \mathordinarycode \allmathstyles \zeromuskip + % \inherited\setmathspacing \mathopencode \mathoperatorcode \allmathstyles \zeromuskip + % \inherited\setmathspacing \mathopencode \mathbinarycode \allmathstyles \zeromuskip + % \inherited\setmathspacing \mathopencode \mathrelationcode \allmathstyles \zeromuskip + % \inherited\setmathspacing \mathopencode \mathopencode \allmathstyles \zeromuskip + % \inherited\setmathspacing \mathopencode \mathmiddlecode \allmathstyles \zeromuskip + % \inherited\setmathspacing \mathopencode \mathclosecode \allmathstyles \zeromuskip + % \inherited\setmathspacing \mathopencode \mathpunctuationcode \allmathstyles \zeromuskip + % \inherited\setmathspacing \mathopencode \mathconstructcode \allmathstyles \zeromuskip + % \inherited\setmathspacing \mathopencode \mathellipsiscode \allmathstyles \zeromuskip + \inherited\setmathspacing \mathopencode \mathfractioncode \allmathstyles \pettymuskip + % \inherited\setmathspacing \mathopencode \mathradicalcode \allmathstyles \zeromuskip % - \inherited\setmathspacing \mathpunctuationcode \mathordinarycode \allsplitstyles \medmuskip - \inherited\setmathspacing \mathpunctuationcode \mathordinarycode \allscriptstyles \thinmuskip - \inherited\setmathspacing \mathpunctuationcode \mathoperatorcode \allsplitstyles \medmuskip - \inherited\setmathspacing \mathpunctuationcode \mathoperatorcode \allscriptstyles \thinmuskip - % \inherited\setmathspacing \mathpunctuationcode \mathbinarycode \allmathstyles \zeromuskip - \inherited\setmathspacing \mathpunctuationcode \mathrelationcode \allsplitstyles \medmuskip - \inherited\setmathspacing \mathpunctuationcode \mathrelationcode \allscriptstyles \thinmuskip - \inherited\setmathspacing \mathpunctuationcode \mathopencode \allsplitstyles \medmuskip - \inherited\setmathspacing \mathpunctuationcode \mathopencode \allscriptstyles \thinmuskip - \inherited\setmathspacing \mathpunctuationcode \mathmiddlecode \allsplitstyles \thickmuskip - \inherited\setmathspacing \mathpunctuationcode \mathmiddlecode \allscriptstyles \thinmuskip - \inherited\setmathspacing \mathpunctuationcode \mathclosecode \allsplitstyles \medmuskip - \inherited\setmathspacing \mathpunctuationcode \mathclosecode \allscriptstyles \thinmuskip - \inherited\setmathspacing \mathpunctuationcode \mathpunctuationcode \allsplitstyles \medmuskip - \inherited\setmathspacing \mathpunctuationcode \mathpunctuationcode \allscriptstyles \thinmuskip - \inherited\setmathspacing \mathpunctuationcode \mathconstructcode \allsplitstyles \medmuskip - \inherited\setmathspacing \mathpunctuationcode \mathconstructcode \allscriptstyles \thinmuskip - \inherited\setmathspacing \mathpunctuationcode \mathellipsiscode \allsplitstyles \medmuskip - \inherited\setmathspacing \mathpunctuationcode \mathellipsiscode \allscriptstyles \thinmuskip - \inherited\setmathspacing \mathpunctuationcode \mathfractioncode \allsplitstyles \medmuskip - \inherited\setmathspacing \mathpunctuationcode \mathfractioncode \allscriptstyles \thinmuskip - \inherited\setmathspacing \mathpunctuationcode \mathradicalcode \allsplitstyles \medmuskip - \inherited\setmathspacing \mathpunctuationcode \mathradicalcode \allscriptstyles \thinmuskip + \inherited\setmathspacing \mathclosecode \mathordinarycode \allmathstyles \tinymuskip + \inherited\setmathspacing \mathclosecode \mathoperatorcode \allmathstyles \thinmuskip + \inherited\setmathspacing \mathclosecode \mathbinarycode \allsplitstyles \medmuskip + \inherited\setmathspacing \mathclosecode \mathbinarycode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathclosecode \mathrelationcode \allsplitstyles \thickmuskip + \inherited\setmathspacing \mathclosecode \mathrelationcode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathclosecode \mathopencode \alltextstyles \tinymuskip + \inherited\setmathspacing \mathclosecode \mathopencode \alldisplaystyles \thinmuskip + \inherited\setmathspacing \mathclosecode \mathopencode \allunsplitstyles \pettymuskip + % \inherited\setmathspacing \mathclosecode \mathmiddlecode \allmathstyles \zeromuskip + % \inherited\setmathspacing \mathclosecode \mathclosecode \allmathstyles \zeromuskip + % \inherited\setmathspacing \mathclosecode \mathpunctuationcode \allmathstyles \zeromuskip + \inherited\setmathspacing \mathclosecode \mathconstructcode \allsplitstyles \thinmuskip + \inherited\setmathspacing \mathclosecode \mathconstructcode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathclosecode \mathfactorialcode \allmathstyles \zeromuskip + \inherited\setmathspacing \mathclosecode \mathellipsiscode \allsplitstyles \thinmuskip + \inherited\setmathspacing \mathclosecode \mathellipsiscode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathclosecode \mathfractioncode \allsplitstyles \thinmuskip + \inherited\setmathspacing \mathclosecode \mathfractioncode \allunsplitstyles \pettymuskip + % \inherited\setmathspacing \mathclosecode \mathradicalcode \allmathstyles \zeromuskip % - \inherited\setmathspacing \mathconstructcode \mathordinarycode \allsplitstyles \thinmuskip - \inherited\setmathspacing \mathconstructcode \mathordinarycode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathconstructcode \mathoperatorcode \allmathstyles \thinmuskip - \inherited\setmathspacing \mathconstructcode \mathbinarycode \allsplitstyles \medmuskip - \inherited\setmathspacing \mathconstructcode \mathbinarycode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathconstructcode \mathrelationcode \allsplitstyles \thickmuskip - \inherited\setmathspacing \mathconstructcode \mathrelationcode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathconstructcode \mathopencode \allsplitstyles \thinmuskip - \inherited\setmathspacing \mathconstructcode \mathopencode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathconstructcode \mathmiddlecode \allsplitstyles \thickmuskip - \inherited\setmathspacing \mathconstructcode \mathmiddlecode \allscriptstyles \pettymuskip - % \inherited\setmathspacing \mathconstructcode \mathclosecode \allmathstyles \zeromuskip - \inherited\setmathspacing \mathconstructcode \mathpunctuationcode \allsplitstyles \thinmuskip - \inherited\setmathspacing \mathconstructcode \mathpunctuationcode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathconstructcode \mathconstructcode \allsplitstyles \thinmuskip - \inherited\setmathspacing \mathconstructcode \mathconstructcode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathconstructcode \mathfractioncode \allsplitstyles \thinmuskip - \inherited\setmathspacing \mathconstructcode \mathfractioncode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathconstructcode \mathradicalcode \allsplitstyles \thinmuskip - \inherited\setmathspacing \mathconstructcode \mathradicalcode \allscriptstyles \pettymuskip + \inherited\setmathspacing \mathpunctuationcode \mathordinarycode \allsplitstyles \medmuskip + \inherited\setmathspacing \mathpunctuationcode \mathordinarycode \allunsplitstyles \thinmuskip + \inherited\setmathspacing \mathpunctuationcode \mathoperatorcode \allsplitstyles \medmuskip + \inherited\setmathspacing \mathpunctuationcode \mathoperatorcode \allunsplitstyles \thinmuskip + % \inherited\setmathspacing \mathpunctuationcode \mathbinarycode \allmathstyles \zeromuskip + \inherited\setmathspacing \mathpunctuationcode \mathrelationcode \allsplitstyles \medmuskip + \inherited\setmathspacing \mathpunctuationcode \mathrelationcode \allunsplitstyles \thinmuskip + \inherited\setmathspacing \mathpunctuationcode \mathopencode \allsplitstyles \medmuskip + \inherited\setmathspacing \mathpunctuationcode \mathopencode \allunsplitstyles \thinmuskip + \inherited\setmathspacing \mathpunctuationcode \mathmiddlecode \allsplitstyles \thickmuskip + \inherited\setmathspacing \mathpunctuationcode \mathmiddlecode \allunsplitstyles \thinmuskip + \inherited\setmathspacing \mathpunctuationcode \mathclosecode \allsplitstyles \medmuskip + \inherited\setmathspacing \mathpunctuationcode \mathclosecode \allunsplitstyles \thinmuskip + \inherited\setmathspacing \mathpunctuationcode \mathpunctuationcode \allsplitstyles \medmuskip + \inherited\setmathspacing \mathpunctuationcode \mathpunctuationcode \allunsplitstyles \thinmuskip + \inherited\setmathspacing \mathpunctuationcode \mathconstructcode \allsplitstyles \medmuskip + \inherited\setmathspacing \mathpunctuationcode \mathconstructcode \allunsplitstyles \thinmuskip + \inherited\setmathspacing \mathpunctuationcode \mathellipsiscode \allsplitstyles \medmuskip + \inherited\setmathspacing \mathpunctuationcode \mathellipsiscode \allunsplitstyles \thinmuskip + \inherited\setmathspacing \mathpunctuationcode \mathfractioncode \allsplitstyles \medmuskip + \inherited\setmathspacing \mathpunctuationcode \mathfractioncode \allunsplitstyles \thinmuskip + \inherited\setmathspacing \mathpunctuationcode \mathradicalcode \allsplitstyles \medmuskip + \inherited\setmathspacing \mathpunctuationcode \mathradicalcode \allunsplitstyles \thinmuskip % - \inherited\setmathspacing \mathellipsiscode \mathordinarycode \allsplitstyles \thinmuskip - \inherited\setmathspacing \mathellipsiscode \mathordinarycode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathellipsiscode \mathoperatorcode \allmathstyles \thinmuskip - \inherited\setmathspacing \mathellipsiscode \mathbinarycode \allsplitstyles \medmuskip - \inherited\setmathspacing \mathellipsiscode \mathbinarycode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathellipsiscode \mathrelationcode \allsplitstyles \thickmuskip - \inherited\setmathspacing \mathellipsiscode \mathrelationcode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathellipsiscode \mathopencode \allsplitstyles \thinmuskip - \inherited\setmathspacing \mathellipsiscode \mathopencode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathellipsiscode \mathmiddlecode \allsplitstyles \thickmuskip - \inherited\setmathspacing \mathellipsiscode \mathmiddlecode \allscriptstyles \pettymuskip - % \inherited\setmathspacing \mathellipsiscode \mathclosecode \allmathstyles \zeromuskip - \inherited\setmathspacing \mathellipsiscode \mathpunctuationcode \allsplitstyles \thinmuskip - \inherited\setmathspacing \mathellipsiscode \mathpunctuationcode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathellipsiscode \mathconstructcode \allsplitstyles \thinmuskip - \inherited\setmathspacing \mathellipsiscode \mathconstructcode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathellipsiscode \mathellipsiscode \allsplitstyles \thinmuskip - \inherited\setmathspacing \mathellipsiscode \mathellipsiscode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathellipsiscode \mathfractioncode \allsplitstyles \thinmuskip - \inherited\setmathspacing \mathellipsiscode \mathfractioncode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathellipsiscode \mathradicalcode \allsplitstyles \thinmuskip - \inherited\setmathspacing \mathellipsiscode \mathradicalcode \allscriptstyles \pettymuskip + \inherited\setmathspacing \mathconstructcode \mathordinarycode \allsplitstyles \thinmuskip + \inherited\setmathspacing \mathconstructcode \mathordinarycode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathconstructcode \mathoperatorcode \allmathstyles \thinmuskip + \inherited\setmathspacing \mathconstructcode \mathbinarycode \allsplitstyles \medmuskip + \inherited\setmathspacing \mathconstructcode \mathbinarycode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathconstructcode \mathrelationcode \allsplitstyles \thickmuskip + \inherited\setmathspacing \mathconstructcode \mathrelationcode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathconstructcode \mathopencode \allsplitstyles \thinmuskip + \inherited\setmathspacing \mathconstructcode \mathopencode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathconstructcode \mathmiddlecode \allsplitstyles \thickmuskip + \inherited\setmathspacing \mathconstructcode \mathmiddlecode \allunsplitstyles \pettymuskip + % \inherited\setmathspacing \mathconstructcode \mathclosecode \allmathstyles \zeromuskip + \inherited\setmathspacing \mathconstructcode \mathpunctuationcode \allsplitstyles \thinmuskip + \inherited\setmathspacing \mathconstructcode \mathpunctuationcode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathconstructcode \mathconstructcode \allsplitstyles \thinmuskip + \inherited\setmathspacing \mathconstructcode \mathconstructcode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathconstructcode \mathfractioncode \allsplitstyles \thinmuskip + \inherited\setmathspacing \mathconstructcode \mathfractioncode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathconstructcode \mathradicalcode \allsplitstyles \thinmuskip + \inherited\setmathspacing \mathconstructcode \mathradicalcode \allunsplitstyles \pettymuskip % + \inherited\setmathspacing \mathellipsiscode \mathordinarycode \allsplitstyles \thinmuskip + \inherited\setmathspacing \mathellipsiscode \mathordinarycode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathellipsiscode \mathoperatorcode \allmathstyles \thinmuskip + \inherited\setmathspacing \mathellipsiscode \mathbinarycode \allsplitstyles \medmuskip + \inherited\setmathspacing \mathellipsiscode \mathbinarycode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathellipsiscode \mathrelationcode \allsplitstyles \thickmuskip + \inherited\setmathspacing \mathellipsiscode \mathrelationcode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathellipsiscode \mathopencode \allsplitstyles \thinmuskip + \inherited\setmathspacing \mathellipsiscode \mathopencode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathellipsiscode \mathmiddlecode \allsplitstyles \thickmuskip + \inherited\setmathspacing \mathellipsiscode \mathmiddlecode \allunsplitstyles \pettymuskip + % \inherited\setmathspacing \mathellipsiscode \mathclosecode \allmathstyles \zeromuskip + \inherited\setmathspacing \mathellipsiscode \mathpunctuationcode \allsplitstyles \thinmuskip + \inherited\setmathspacing \mathellipsiscode \mathpunctuationcode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathellipsiscode \mathconstructcode \allsplitstyles \thinmuskip + \inherited\setmathspacing \mathellipsiscode \mathconstructcode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathellipsiscode \mathellipsiscode \allsplitstyles \thinmuskip + \inherited\setmathspacing \mathellipsiscode \mathellipsiscode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathellipsiscode \mathfractioncode \allsplitstyles \thinmuskip + \inherited\setmathspacing \mathellipsiscode \mathfractioncode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathellipsiscode \mathradicalcode \allsplitstyles \thinmuskip + \inherited\setmathspacing \mathellipsiscode \mathradicalcode \allunsplitstyles \pettymuskip % - \inherited\setmathspacing \mathfractioncode \mathordinarycode \allsplitstyles \tinymuskip - \inherited\setmathspacing \mathfractioncode \mathordinarycode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathfractioncode \mathoperatorcode \allsplitstyles \medmuskip - \inherited\setmathspacing \mathfractioncode \mathoperatorcode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathfractioncode \mathbinarycode \allsplitstyles \medmuskip - \inherited\setmathspacing \mathfractioncode \mathbinarycode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathfractioncode \mathrelationcode \allsplitstyles \thickmuskip - \inherited\setmathspacing \mathfractioncode \mathrelationcode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathfractioncode \mathopencode \allsplitstyles \thinmuskip - \inherited\setmathspacing \mathfractioncode \mathopencode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathfractioncode \mathmiddlecode \allsplitstyles \thickmuskip - \inherited\setmathspacing \mathfractioncode \mathmiddlecode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathfractioncode \mathclosecode \allmathstyles \pettymuskip - \inherited\setmathspacing \mathfractioncode \mathpunctuationcode \allsplitstyles \tinymuskip - \inherited\setmathspacing \mathfractioncode \mathpunctuationcode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathfractioncode \mathtextpunctuationcode \allmathstyles \tinymuskip - \inherited\setmathspacing \mathfractioncode \mathconstructcode \allsplitstyles \thinmuskip - \inherited\setmathspacing \mathfractioncode \mathconstructcode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathfractioncode \mathellipsiscode \allsplitstyles \thinmuskip - \inherited\setmathspacing \mathfractioncode \mathellipsiscode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathfractioncode \mathfractioncode \allsplitstyles \thinmuskip - \inherited\setmathspacing \mathfractioncode \mathfractioncode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathfractioncode \mathradicalcode \allsplitstyles \tinymuskip - \inherited\setmathspacing \mathfractioncode \mathradicalcode \allscriptstyles \pettymuskip + \inherited\setmathspacing \mathfractioncode \mathordinarycode \allsplitstyles \tinymuskip + \inherited\setmathspacing \mathfractioncode \mathordinarycode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathfractioncode \mathoperatorcode \allsplitstyles \medmuskip + \inherited\setmathspacing \mathfractioncode \mathoperatorcode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathfractioncode \mathbinarycode \allsplitstyles \medmuskip + \inherited\setmathspacing \mathfractioncode \mathbinarycode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathfractioncode \mathrelationcode \allsplitstyles \thickmuskip + \inherited\setmathspacing \mathfractioncode \mathrelationcode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathfractioncode \mathopencode \allsplitstyles \thinmuskip + \inherited\setmathspacing \mathfractioncode \mathopencode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathfractioncode \mathmiddlecode \allsplitstyles \thickmuskip + \inherited\setmathspacing \mathfractioncode \mathmiddlecode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathfractioncode \mathclosecode \allmathstyles \pettymuskip + \inherited\setmathspacing \mathfractioncode \mathpunctuationcode \allsplitstyles \tinymuskip + \inherited\setmathspacing \mathfractioncode \mathpunctuationcode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathfractioncode \mathtextpunctuationcode \allmathstyles \tinymuskip + \inherited\setmathspacing \mathfractioncode \mathconstructcode \allsplitstyles \thinmuskip + \inherited\setmathspacing \mathfractioncode \mathconstructcode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathfractioncode \mathellipsiscode \allsplitstyles \thinmuskip + \inherited\setmathspacing \mathfractioncode \mathellipsiscode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathfractioncode \mathfractioncode \allsplitstyles \thinmuskip + \inherited\setmathspacing \mathfractioncode \mathfractioncode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathfractioncode \mathradicalcode \allsplitstyles \tinymuskip + \inherited\setmathspacing \mathfractioncode \mathradicalcode \allunsplitstyles \pettymuskip % - \inherited\setmathspacing \mathradicalcode \mathordinarycode \allsplitstyles \tinymuskip - \inherited\setmathspacing \mathradicalcode \mathordinarycode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathradicalcode \mathoperatorcode \allmathstyles \thinmuskip - \inherited\setmathspacing \mathradicalcode \mathbinarycode \allsplitstyles \medmuskip - \inherited\setmathspacing \mathradicalcode \mathbinarycode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathradicalcode \mathrelationcode \allsplitstyles \thickmuskip - \inherited\setmathspacing \mathradicalcode \mathrelationcode \allscriptstyles \pettymuskip - % \inherited\setmathspacing \mathradicalcode \mathopencode \allmathstyles \zeromuskip - \inherited\setmathspacing \mathradicalcode \mathmiddlecode \allsplitstyles \thickmuskip - \inherited\setmathspacing \mathradicalcode \mathmiddlecode \allscriptstyles \pettymuskip - % \inherited\setmathspacing \mathradicalcode \mathclosecode \allmathstyles \zeromuskip - \inherited\setmathspacing \mathradicalcode \mathpunctuationcode \allsplitstyles \pettymuskip - \inherited\setmathspacing \mathradicalcode \mathpunctuationcode \allscriptstyles \tinymuskip - \inherited\setmathspacing \mathradicalcode \mathconstructcode \allsplitstyles \thinmuskip - \inherited\setmathspacing \mathradicalcode \mathconstructcode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathradicalcode \mathellipsiscode \allsplitstyles \thinmuskip - \inherited\setmathspacing \mathradicalcode \mathellipsiscode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathradicalcode \mathfractioncode \allsplitstyles \tinymuskip - \inherited\setmathspacing \mathradicalcode \mathfractioncode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathradicalcode \mathradicalcode \allsplitstyles \thinmuskip - \inherited\setmathspacing \mathradicalcode \mathradicalcode \allscriptstyles \pettymuskip + \inherited\setmathspacing \mathradicalcode \mathordinarycode \allsplitstyles \tinymuskip + \inherited\setmathspacing \mathradicalcode \mathordinarycode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathradicalcode \mathoperatorcode \allmathstyles \thinmuskip + \inherited\setmathspacing \mathradicalcode \mathbinarycode \allsplitstyles \medmuskip + \inherited\setmathspacing \mathradicalcode \mathbinarycode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathradicalcode \mathrelationcode \allsplitstyles \thickmuskip + \inherited\setmathspacing \mathradicalcode \mathrelationcode \allunsplitstyles \pettymuskip + % \inherited\setmathspacing \mathradicalcode \mathopencode \allmathstyles \zeromuskip + \inherited\setmathspacing \mathradicalcode \mathmiddlecode \allsplitstyles \thickmuskip + \inherited\setmathspacing \mathradicalcode \mathmiddlecode \allunsplitstyles \pettymuskip + % \inherited\setmathspacing \mathradicalcode \mathclosecode \allmathstyles \zeromuskip + \inherited\setmathspacing \mathradicalcode \mathpunctuationcode \allsplitstyles \pettymuskip + \inherited\setmathspacing \mathradicalcode \mathpunctuationcode \allunsplitstyles \tinymuskip + \inherited\setmathspacing \mathradicalcode \mathconstructcode \allsplitstyles \thinmuskip + \inherited\setmathspacing \mathradicalcode \mathconstructcode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathradicalcode \mathellipsiscode \allsplitstyles \thinmuskip + \inherited\setmathspacing \mathradicalcode \mathellipsiscode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathradicalcode \mathfractioncode \allsplitstyles \tinymuskip + \inherited\setmathspacing \mathradicalcode \mathfractioncode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathradicalcode \mathradicalcode \allsplitstyles \thinmuskip + \inherited\setmathspacing \mathradicalcode \mathradicalcode \allunsplitstyles \pettymuskip % - \inherited\setmathspacing \mathmiddlecode \mathordinarycode \allsplitstyles \thickmuskip - \inherited\setmathspacing \mathmiddlecode \mathordinarycode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathmiddlecode \mathoperatorcode \allmathstyles \thickmuskip - \inherited\setmathspacing \mathmiddlecode \mathbinarycode \allsplitstyles \medmuskip - \inherited\setmathspacing \mathmiddlecode \mathbinarycode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathmiddlecode \mathrelationcode \allsplitstyles \thickmuskip - \inherited\setmathspacing \mathmiddlecode \mathrelationcode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathmiddlecode \mathopencode \allsplitstyles \thickmuskip - \inherited\setmathspacing \mathmiddlecode \mathopencode \allsplitstyles \pettymuskip - \inherited\setmathspacing \mathmiddlecode \mathmiddlecode \allsplitstyles \thickmuskip - \inherited\setmathspacing \mathmiddlecode \mathmiddlecode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathmiddlecode \mathclosecode \allsplitstyles \thickmuskip - \inherited\setmathspacing \mathmiddlecode \mathclosecode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathmiddlecode \mathpunctuationcode \allsplitstyles \thickmuskip - \inherited\setmathspacing \mathmiddlecode \mathpunctuationcode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathmiddlecode \mathconstructcode \allsplitstyles \thickmuskip - \inherited\setmathspacing \mathmiddlecode \mathconstructcode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathmiddlecode \mathellipsiscode \allsplitstyles \thickmuskip - \inherited\setmathspacing \mathmiddlecode \mathellipsiscode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathmiddlecode \mathfractioncode \allsplitstyles \thickmuskip - \inherited\setmathspacing \mathmiddlecode \mathfractioncode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathmiddlecode \mathradicalcode \allsplitstyles \thickmuskip - \inherited\setmathspacing \mathmiddlecode \mathradicalcode \allmathstyles \pettymuskip + \inherited\setmathspacing \mathmiddlecode \mathordinarycode \allsplitstyles \thickmuskip + \inherited\setmathspacing \mathmiddlecode \mathordinarycode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathmiddlecode \mathoperatorcode \allmathstyles \thickmuskip + \inherited\setmathspacing \mathmiddlecode \mathbinarycode \allsplitstyles \medmuskip + \inherited\setmathspacing \mathmiddlecode \mathbinarycode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathmiddlecode \mathrelationcode \allsplitstyles \thickmuskip + \inherited\setmathspacing \mathmiddlecode \mathrelationcode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathmiddlecode \mathopencode \allsplitstyles \thickmuskip + \inherited\setmathspacing \mathmiddlecode \mathopencode \allsplitstyles \pettymuskip + \inherited\setmathspacing \mathmiddlecode \mathmiddlecode \allsplitstyles \thickmuskip + \inherited\setmathspacing \mathmiddlecode \mathmiddlecode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathmiddlecode \mathclosecode \allsplitstyles \thickmuskip + \inherited\setmathspacing \mathmiddlecode \mathclosecode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathmiddlecode \mathpunctuationcode \allsplitstyles \thickmuskip + \inherited\setmathspacing \mathmiddlecode \mathpunctuationcode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathmiddlecode \mathconstructcode \allsplitstyles \thickmuskip + \inherited\setmathspacing \mathmiddlecode \mathconstructcode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathmiddlecode \mathellipsiscode \allsplitstyles \thickmuskip + \inherited\setmathspacing \mathmiddlecode \mathellipsiscode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathmiddlecode \mathfractioncode \allsplitstyles \thickmuskip + \inherited\setmathspacing \mathmiddlecode \mathfractioncode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathmiddlecode \mathradicalcode \allsplitstyles \thickmuskip + \inherited\setmathspacing \mathmiddlecode \mathradicalcode \allmathstyles \pettymuskip % - \inherited\setmathspacing \mathclosecode \mathdifferentialcode \allsplitstyles \thinmuskip - \inherited\setmathspacing \mathclosecode \mathdifferentialcode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathordinarycode \mathdifferentialcode \allsplitstyles \thinmuskip - \inherited\setmathspacing \mathordinarycode \mathdifferentialcode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathfactorialcode \mathordinarycode \allsplitstyles \thinmuskip - \inherited\setmathspacing \mathfactorialcode \mathordinarycode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathfactorialcode \mathfactorialcode \allmathstyles \zeromuskip + \inherited\setmathspacing \mathclosecode \mathdifferentialcode \allsplitstyles \thinmuskip + \inherited\setmathspacing \mathclosecode \mathdifferentialcode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathordinarycode \mathdifferentialcode \allsplitstyles \thinmuskip + \inherited\setmathspacing \mathordinarycode \mathdifferentialcode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathfactorialcode \mathordinarycode \allsplitstyles \thinmuskip + \inherited\setmathspacing \mathfactorialcode \mathordinarycode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathfactorialcode \mathfactorialcode \allmathstyles \zeromuskip % - \inherited\setmathspacing \mathopencode \mathconstructcode \allmathstyles \thinmuskip - \inherited\setmathspacing \mathconstructcode \mathclosecode \allmathstyles \thinmuskip + \inherited\setmathspacing \mathopencode \mathconstructcode \allmathstyles \thinmuskip + \inherited\setmathspacing \mathconstructcode \mathclosecode \allmathstyles \thinmuskip % - \inherited\setmathspacing \mathdimensioncode \mathdimensioncode \allmathstyles \zeromuskip - \inherited\setmathspacing \mathordinarycode \mathdimensioncode \allsplitstyles \thinmuskip - \inherited\setmathspacing \mathordinarycode \mathdimensioncode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathdigitcode \mathdimensioncode \allsplitstyles \thinmuskip - \inherited\setmathspacing \mathdigitcode \mathdimensioncode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathclosecode \mathdimensioncode \allsplitstyles \thinmuskip - \inherited\setmathspacing \mathclosecode \mathdimensioncode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathfunctioncode \mathbinarycode \allsplitstyles \medmuskip - \inherited\setmathspacing \mathfunctioncode \mathbinarycode \allscriptstyles \pettymuskip + \inherited\setmathspacing \mathdimensioncode \mathdimensioncode \allmathstyles \zeromuskip + \inherited\setmathspacing \mathordinarycode \mathdimensioncode \allsplitstyles \thinmuskip + \inherited\setmathspacing \mathordinarycode \mathdimensioncode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathdigitcode \mathdimensioncode \allsplitstyles \thinmuskip + \inherited\setmathspacing \mathdigitcode \mathdimensioncode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathclosecode \mathdimensioncode \allsplitstyles \thinmuskip + \inherited\setmathspacing \mathclosecode \mathdimensioncode \allunsplitstyles \pettymuskip + \inherited\setmathspacing \mathfunctioncode \mathbinarycode \allsplitstyles \medmuskip + \inherited\setmathspacing \mathfunctioncode \mathbinarycode \allunsplitstyles \pettymuskip % % \im{1\unit{hour} 20 \unit{minute} 56 \unit{second}} % - \inherited\setmathspacing \mathdimensioncode \mathdigitcode \allmathstyles \thickmuskip + \inherited\setmathspacing \mathdimensioncode \mathdigitcode \allmathstyles \thickmuskip + % + \inherited\setmathspacing \mathfakecode \mathallcode \allmathstyles \tinymuskip + \inherited\setmathspacing \mathallcode \mathfakecode \allmathstyles \tinymuskip % - \inherited\setmathspacing \mathfakecode \mathallcode \allmathstyles \tinymuskip - \inherited\setmathspacing \mathallcode \mathfakecode \allmathstyles \tinymuskip + \inherited\setmathspacing \mathtextpunctuationcode \mathordinarycode \allmathstyles \mathinterwordmuskip + \inherited\setmathspacing \mathtextpunctuationcode \mathoperatorcode \allmathstyles \mathinterwordmuskip + \inherited\setmathspacing \mathtextpunctuationcode \mathbinarycode \allmathstyles \mathinterwordmuskip + \inherited\setmathspacing \mathtextpunctuationcode \mathrelationcode \allmathstyles \mathinterwordmuskip + \inherited\setmathspacing \mathtextpunctuationcode \mathopencode \allmathstyles \mathinterwordmuskip + \inherited\setmathspacing \mathtextpunctuationcode \mathmiddlecode \allmathstyles \mathinterwordmuskip + \inherited\setmathspacing \mathtextpunctuationcode \mathclosecode \allmathstyles \mathinterwordmuskip + \inherited\setmathspacing \mathtextpunctuationcode \mathpunctuationcode \allmathstyles \mathinterwordmuskip + \inherited\setmathspacing \mathtextpunctuationcode \mathconstructcode \allmathstyles \mathinterwordmuskip + \inherited\setmathspacing \mathtextpunctuationcode \mathellipsiscode \allmathstyles \mathinterwordmuskip + \inherited\setmathspacing \mathtextpunctuationcode \mathfractioncode \allmathstyles \mathinterwordmuskip + \inherited\setmathspacing \mathtextpunctuationcode \mathradicalcode \allmathstyles \mathinterwordmuskip + \inherited\setmathspacing \mathtextpunctuationcode \mathdifferentialcode \allmathstyles \mathinterwordmuskip + \inherited\setmathspacing \mathtextpunctuationcode \mathpunctuationcode \allmathstyles \mathinterwordmuskip % - \inherited\setmathspacing \mathtextpunctuationcode \mathordinarycode \allmathstyles \mathinterwordmuskip - \inherited\setmathspacing \mathtextpunctuationcode \mathoperatorcode \allmathstyles \mathinterwordmuskip - \inherited\setmathspacing \mathtextpunctuationcode \mathbinarycode \allmathstyles \mathinterwordmuskip - \inherited\setmathspacing \mathtextpunctuationcode \mathrelationcode \allmathstyles \mathinterwordmuskip - \inherited\setmathspacing \mathtextpunctuationcode \mathopencode \allmathstyles \mathinterwordmuskip - \inherited\setmathspacing \mathtextpunctuationcode \mathmiddlecode \allmathstyles \mathinterwordmuskip - \inherited\setmathspacing \mathtextpunctuationcode \mathclosecode \allmathstyles \mathinterwordmuskip - \inherited\setmathspacing \mathtextpunctuationcode \mathpunctuationcode \allmathstyles \mathinterwordmuskip - \inherited\setmathspacing \mathtextpunctuationcode \mathconstructcode \allmathstyles \mathinterwordmuskip - \inherited\setmathspacing \mathtextpunctuationcode \mathellipsiscode \allmathstyles \mathinterwordmuskip - \inherited\setmathspacing \mathtextpunctuationcode \mathfractioncode \allmathstyles \mathinterwordmuskip - \inherited\setmathspacing \mathtextpunctuationcode \mathradicalcode \allmathstyles \mathinterwordmuskip - \inherited\setmathspacing \mathtextpunctuationcode \mathdifferentialcode \allmathstyles \mathinterwordmuskip - \inherited\setmathspacing \mathtextpunctuationcode \mathpunctuationcode \allmathstyles \mathinterwordmuskip - - \inherited\setmathspacing \mathordinarycode \mathtextpunctuationcode \allmathstyles \tinymuskip - \inherited\setmathspacing \mathoperatorcode \mathtextpunctuationcode \allmathstyles \tinymuskip - \inherited\setmathspacing \mathbinarycode \mathtextpunctuationcode \allmathstyles \tinymuskip - \inherited\setmathspacing \mathrelationcode \mathtextpunctuationcode \allmathstyles \tinymuskip - \inherited\setmathspacing \mathopencode \mathtextpunctuationcode \allmathstyles \tinymuskip - \inherited\setmathspacing \mathmiddlecode \mathtextpunctuationcode \allmathstyles \tinymuskip - \inherited\setmathspacing \mathclosecode \mathtextpunctuationcode \allmathstyles \tinymuskip - \inherited\setmathspacing \mathpunctuationcode \mathtextpunctuationcode \allmathstyles \tinymuskip - \inherited\setmathspacing \mathconstructcode \mathtextpunctuationcode \allmathstyles \tinymuskip - \inherited\setmathspacing \mathellipsiscode \mathtextpunctuationcode \allmathstyles \tinymuskip - \inherited\setmathspacing \mathfractioncode \mathtextpunctuationcode \allmathstyles \tinymuskip - \inherited\setmathspacing \mathradicalcode \mathtextpunctuationcode \allmathstyles \tinymuskip - \inherited\setmathspacing \mathdifferentialcode \mathtextpunctuationcode \allmathstyles \tinymuskip - \inherited\setmathspacing \mathpunctuationcode \mathtextpunctuationcode \allmathstyles \tinymuskip + \inherited\setmathspacing \mathordinarycode \mathtextpunctuationcode \allmathstyles \tinymuskip + \inherited\setmathspacing \mathoperatorcode \mathtextpunctuationcode \allmathstyles \tinymuskip + \inherited\setmathspacing \mathbinarycode \mathtextpunctuationcode \allmathstyles \tinymuskip + \inherited\setmathspacing \mathrelationcode \mathtextpunctuationcode \allmathstyles \tinymuskip + \inherited\setmathspacing \mathopencode \mathtextpunctuationcode \allmathstyles \tinymuskip + \inherited\setmathspacing \mathmiddlecode \mathtextpunctuationcode \allmathstyles \tinymuskip + \inherited\setmathspacing \mathclosecode \mathtextpunctuationcode \allmathstyles \tinymuskip + \inherited\setmathspacing \mathpunctuationcode \mathtextpunctuationcode \allmathstyles \tinymuskip + \inherited\setmathspacing \mathconstructcode \mathtextpunctuationcode \allmathstyles \tinymuskip + \inherited\setmathspacing \mathellipsiscode \mathtextpunctuationcode \allmathstyles \tinymuskip + \inherited\setmathspacing \mathfractioncode \mathtextpunctuationcode \allmathstyles \tinymuskip + \inherited\setmathspacing \mathradicalcode \mathtextpunctuationcode \allmathstyles \tinymuskip + \inherited\setmathspacing \mathdifferentialcode \mathtextpunctuationcode \allmathstyles \tinymuskip + \inherited\setmathspacing \mathpunctuationcode \mathtextpunctuationcode \allmathstyles \tinymuskip \stopsetups \directsetup{math:spacing:default} @@ -1506,10 +1521,12 @@ \permanent\protected\def\math_upright {\setmathattribute\s!regular\s!tf\setmathfontstylealternate\s!tf} \permanent\protected\def\math_italic {\setmathattribute\s!regular\s!it\setmathfontstylealternate\s!it} -\permanent\protected\def\math_script {\setmathalphabet \s!script \setmathfontstylealternate\s!script\setmathvariant\s!handwriting} -\permanent\protected\def\math_calligraphic{\setmathalphabet \s!script \setmathfontstylealternate\s!script\setmathvariant\s!calligraphy} -\permanent\protected\def\math_fraktur {\setmathalphabet \s!fraktur \setmathfontstylealternate\s!fraktur} -\permanent\protected\def\math_blackboard {\setmathalphabet \s!blackboard\setmathfontstylealternate\s!blackboard} +%permanent\protected\def\math_script {\setmathalphabet \s!script \setmathfontstylealternate\s!script\setmathvariant\s!handwriting} +%permanent\protected\def\math_calligraphic{\setmathalphabet \s!script \setmathfontstylealternate\s!script\setmathvariant\s!calligraphy} +\permanent\protected\def\math_script {\setmathalphabet \s!script \setmathfontstylealternate\s!script} +\permanent\protected\def\math_calligraphic{\setmathalphabet \s!calligraphic\setmathfontstylealternate\s!calligraphic} +\permanent\protected\def\math_fraktur {\setmathalphabet \s!fraktur \setmathfontstylealternate\s!fraktur} +\permanent\protected\def\math_blackboard {\setmathalphabet \s!blackboard \setmathfontstylealternate\s!blackboard} \permanent\protected\def\mathupright {\mathgroupedcommandcs\math_upright } \permanent\protected\def\mathitalic {\mathgroupedcommandcs\math_italic } @@ -1804,14 +1821,12 @@ % using \s!font \mathstylefontid\mathstyle\fam would needs expansion and guesswork \appendtoks - \Umathruleheight\alltextstyles \strutheightfactor\fontspecifiedsize\textfont \zerocount - \Umathruledepth \alltextstyles \strutdepthfactor \fontspecifiedsize\textfont \zerocount + \Umathruleheight\allmainstyles \strutheightfactor\fontspecifiedsize\textfont \zerocount + \Umathruledepth \allmainstyles \strutdepthfactor \fontspecifiedsize\textfont \zerocount \Umathruleheight\allscriptstyles \strutheightfactor\fontspecifiedsize\scriptfont \zerocount \Umathruledepth \allscriptstyles \strutdepthfactor \fontspecifiedsize\scriptfont \zerocount \Umathruleheight\allscriptscriptstyles\strutheightfactor\fontspecifiedsize\scriptscriptfont\zerocount \Umathruledepth \allscriptscriptstyles\strutdepthfactor \fontspecifiedsize\scriptscriptfont\zerocount - \Umathruleheight\alldisplaystyles \Umathruleheight\textstyle - \Umathruledepth \alldisplaystyles \Umathruledepth \textstyle \to \everybodyfont \protected\def\math_strut @@ -2364,26 +2379,26 @@ \math_basics_synchronize_direction \to \everyswitchmathematics -% experimental (needed for an article) - -\installcorenamespace {mathbidi} - -\newcount\c_math_bidi - -\def\math_bidi_enable {\clf_setmathdirection\plusone \relax\c_math_bidi\plusone} -\def\math_bidi_disable{\clf_setmathdirection\zerocount\relax\c_math_bidi\attributeunsetvalue} - -\letcsname\??mathbidi\v!yes\endcsname\math_bidi_enable -\letcsname\??mathbidi\v!no \endcsname\math_bidi_disable - -\appendtoks - \edef\p_bidi{\mathematicsparameter\c!bidi}% still needed ? - \ifcsname\??mathbidi\p_bidi\endcsname\lastnamedcs\else\math_bidi_disable\fi -\to \everysetupmathematics +% experimental (needed for an article) .. this is is no longer neded -\appendtoks - \c_attr_mathbidi\ifconditional\c_math_right_to_left\c_math_bidi\else\attributeunsetvalue\fi -\to \everyswitchmathematics +% \installcorenamespace {mathbidi} +% +% \newcount\c_math_bidi +% +% \def\math_bidi_enable {\clf_setmathdirection\plusone \relax\c_math_bidi\plusone} +% \def\math_bidi_disable{\clf_setmathdirection\zerocount\relax\c_math_bidi\attributeunsetvalue} +% +% \letcsname\??mathbidi\v!yes\endcsname\math_bidi_enable +% \letcsname\??mathbidi\v!no \endcsname\math_bidi_disable +% +% \appendtoks +% \edef\p_bidi{\mathematicsparameter\c!bidi}% still needed ? +% \ifcsname\??mathbidi\p_bidi\endcsname\lastnamedcs\else\math_bidi_disable\fi +% \to \everysetupmathematics +% +% \appendtoks +% \c_attr_mathbidi\ifconditional\c_math_right_to_left\c_math_bidi\else\attributeunsetvalue\fi +% \to \everyswitchmathematics %D Delayed: greek. %D diff --git a/tex/context/base/mkxl/math-map.lmt b/tex/context/base/mkxl/math-map.lmt index f411505f2..d0a1410a1 100644 --- a/tex/context/base/mkxl/math-map.lmt +++ b/tex/context/base/mkxl/math-map.lmt @@ -66,7 +66,7 @@ local context = context -- todo: allocate -mathematics.styles = allocate { "regular", "sansserif", "monospaced", "fraktur", "script", "blackboard" } +mathematics.styles = allocate { "regular", "sansserif", "monospaced", "fraktur", "script", "calligraphic", "blackboard" } mathematics.alternatives = allocate { "normal", "bold", "italic", "bolditalic" } mathematics.sets = allocate { "ucletters", "lcletters", "digits", "ucgreek", "lcgreek", "symbols" } @@ -520,58 +520,95 @@ local script = { bi = script_bf, } +local calligraphic_tf = { + digits = tovector(regular_tf.digits), + ucletters = toupper(0x100020), + lcletters = tolower(0x100000), + lcgreek = tovector(regular_tf.lcgreek), + ucgreek = tovector(regular_tf.ucgreek), + symbols = tovector(regular_tf.symbols), +} + +local calligraphic_bf = { + digits = tovector(regular_bf.digits), + ucletters = toupper(0x100060), + lcletters = tolower(0x100040), + lcgreek = tovector(regular_bf.lcgreek), + ucgreek = tovector(regular_bf.ucgreek), + symbols = tovector(regular_bf.symbols), +} + +local calligraphic = { + tf = calligraphic_tf, + bf = calligraphic_bf, + it = calligraphic_tf, + bi = calligraphic_bf, +} + local alphabets = allocate { - regular = regular, - sansserif = sansserif, - monospaced = monospaced, - blackboard = blackboard, - fraktur = fraktur, - script = script, -} - -alphabets.tt = tovector(monospaced) -alphabets.ss = tovector(sansserif) -alphabets.rm = tovector(regular) -alphabets.bb = tovector(blackboard) -alphabets.fr = tovector(fraktur) -alphabets.sr = tovector(script) - -monospaced.normal = tovector(monospaced_tf) -monospaced.italic = tovector(monospaced_it) -monospaced.bold = tovector(monospaced_bf) -monospaced.bolditalic = tovector(monospaced_bi) - -sansserif.normal = tovector(sansserif_tf) -sansserif.italic = tovector(sansserif_it) -sansserif.bold = tovector(sansserif_bf) -sansserif.bolditalic = tovector(sansserif_bi) - -regular.normal = tovector(regular_tf) -regular.italic = tovector(regular_it) -regular.bold = tovector(regular_bf) -regular.bolditalic = tovector(regular_bi) - -blackboard.normal = tovector(blackboard_tf) -blackboard.italic = tovector(blackboard_tf) -blackboard.bold = tovector(blackboard_tf) -blackboard.bolditalic = tovector(blackboard_tf) - -fraktur.normal = tovector(fraktur_tf) -fraktur.italic = tovector(fraktur_bf) -fraktur.bold = tovector(fraktur_tf) -fraktur.bolditalic = tovector(fraktur_bf) - -alphabets.serif = tovector(regular) -alphabets.type = tovector(monospaced) -alphabets.teletype = tovector(monospaced) - -mathematics.alphabets = alphabets - -local mathremap = allocate { } -mathematics.mapremap = mathremap - -local boldmap = allocate { } -mathematics.boldmap = boldmap + regular = regular, + sansserif = sansserif, + monospaced = monospaced, + blackboard = blackboard, + fraktur = fraktur, + script = script, + calligraphic = calligraphic, +} + +alphabets.tt = tovector(monospaced) +alphabets.ss = tovector(sansserif) +alphabets.rm = tovector(regular) +alphabets.bb = tovector(blackboard) +alphabets.fr = tovector(fraktur) +alphabets.sr = tovector(script) +alphabets.ca = tovector(calligraphic) + +monospaced.normal = tovector(monospaced_tf) +monospaced.italic = tovector(monospaced_it) +monospaced.bold = tovector(monospaced_bf) +monospaced.bolditalic = tovector(monospaced_bi) + +sansserif.normal = tovector(sansserif_tf) +sansserif.italic = tovector(sansserif_it) +sansserif.bold = tovector(sansserif_bf) +sansserif.bolditalic = tovector(sansserif_bi) + +regular.normal = tovector(regular_tf) +regular.italic = tovector(regular_it) +regular.bold = tovector(regular_bf) +regular.bolditalic = tovector(regular_bi) + +blackboard.normal = tovector(blackboard_tf) +blackboard.italic = tovector(blackboard_tf) +blackboard.bold = tovector(blackboard_tf) +blackboard.bolditalic = tovector(blackboard_tf) + +fraktur.normal = tovector(fraktur_tf) +fraktur.italic = tovector(fraktur_bf) +fraktur.bold = tovector(fraktur_tf) +fraktur.bolditalic = tovector(fraktur_bf) + +script.normal = tovector(script_tf) +script.italic = tovector(script_bf) +script.bold = tovector(script_tf) +script.bolditalic = tovector(script_bf) + +calligraphic.normal = tovector(calligraphic_tf) +calligraphic.italic = tovector(calligraphic_bf) +calligraphic.bold = tovector(calligraphic_tf) +calligraphic.bolditalic = tovector(calligraphic_bf) + +alphabets.serif = tovector(regular) +alphabets.type = tovector(monospaced) +alphabets.teletype = tovector(monospaced) + +mathematics.alphabets = alphabets + +local mathremap = allocate { } +mathematics.mapremap = mathremap + +local boldmap = allocate { } +mathematics.boldmap = boldmap -- all math (a bit of redundancy here) (sorted for tracing) @@ -704,10 +741,11 @@ implement { actions = function(alphabet) if texgetmode() == mathmode_code then -- local r = mathremap[mathalphabet] - local r = mathremap[texgetattribute(mathalphabet)] + local a = texgetattribute(mathalphabet) + local r = mathremap[a] local style = r and r.style or "tf" local data = alphabets[alphabet][style] - texsetattribute(mathalphabet,data and data.attribute or texattribute[mathalphabet]) + texsetattribute(mathalphabet,data and data.attribute or a) end end } @@ -805,7 +843,7 @@ end -- begin of experiment -local fallback = { +local stylefallbacks = { tf = "bf", it = "bi", bf = "tf", @@ -813,12 +851,12 @@ local fallback = { } function mathematics.fallbackstyleattr(attribute) - local r = mathremap[attribute] - local alphabet = r.alphabet or "regular" - local style = r.style or "tf" - local fback = fallback[style] - if fback then - local data = alphabets[alphabet][fback] + local redirect = mathremap[attribute] + local alphabet = redirect.alphabet or "regular" + local style = redirect.style or "tf" + local fallback = stylefallbacks[style] + if fallback then + local data = alphabets[alphabet][fallback] if data then local attr = data.attribute return attribute ~= attr and attr diff --git a/tex/context/base/mkxl/math-noa.lmt b/tex/context/base/mkxl/math-noa.lmt index a754f6f39..30b7b0448 100644 --- a/tex/context/base/mkxl/math-noa.lmt +++ b/tex/context/base/mkxl/math-noa.lmt @@ -683,13 +683,14 @@ end do - local a_mathalphabet = privateattribute("mathalphabet") - local a_mathgreek = privateattribute("mathgreek") + local a_mathalphabet = privateattribute("mathalphabet") + local a_mathgreek = privateattribute("mathgreek") - local relocate = { } + local relocate = { } - local remapalphabets = mathematics.remapalphabets - local fallbackstyleattr = mathematics.fallbackstyleattr + local remapalphabets = mathematics.remapalphabets + local fallbackstyleattr = mathematics.fallbackstyleattr + local fallbackalphabetattr = mathematics.fallbackalphabetattr local function report_remap(tag,id,old,new,extra) if new then diff --git a/tex/context/base/mkxl/math-rad.mklx b/tex/context/base/mkxl/math-rad.mklx index 04d6bfbba..9dfc80d13 100644 --- a/tex/context/base/mkxl/math-rad.mklx +++ b/tex/context/base/mkxl/math-rad.mklx @@ -242,13 +242,13 @@ \scratchdimen \wd\scratchbox \scratchtopoffset \dimexpr\scratchoffset+\dp\nextbox\relax \scratchbottomoffset\dimexpr\scratchoffset+\ht\nextbox/2\relax - \hpack to \scratchdimen{\hss\box\nextbox\hskip\scratchoffset}% - \hskip-\scratchdimen + \hpack to \scratchdimen{\hss\box\nextbox\kern\scratchoffset}% + \kern-\scratchdimen \lower\dimexpr\scratchtopoffset\box\scratchbox% \ifx\currentmathradicaldegree\empty \else \setbox\scratchbox\mathstylehbox{\scriptscriptstyle\currentmathradicaldegree\hss}% \wd\scratchbox\scratchdimen - \hskip-\scratchdimen + \kern-\scratchdimen \raise\dimexpr\scratchbottomoffset\box\scratchbox \fi \endgroup} @@ -296,7 +296,7 @@ % the width of the graphic determines the width of the final result \setbox\scratchbox\hpack{\uniqueMPgraphic{\p_mp}}% todo: add code key + tag \hpack to \wd\scratchbox{\hss\box\nextbox\hss}% - \hskip-\wd\scratchbox + \kern-\wd\scratchbox \box\scratchbox \endgroup} diff --git a/tex/context/base/mkxl/math-stc.mklx b/tex/context/base/mkxl/math-stc.mklx index 2ddfa24fd..828115f83 100644 --- a/tex/context/base/mkxl/math-stc.mklx +++ b/tex/context/base/mkxl/math-stc.mklx @@ -75,6 +75,9 @@ % at the lua end and some checking: use \mathhorizontalcode or \mathextensiblecode % but in practice arrows etc are not used that often +% At some point we can consider to use the more natural \LUAMETATEX\ features but the +% problem is that we lack proper support in fonts and we also have less control. + \installcorenamespace {mathextensiblefallbacks} % currently no italic correction ... problem is that we don't know yet if we have an italic @@ -1059,6 +1062,7 @@ \definemathextensible [\v!reverse] [xrightharpoondown] ["21C1] \definemathextensible [\v!reverse] [xrightharpoonup] ["21C0] \definemathextensible [\v!reverse] [xrightoverleftarrow] ["21C4] +\definemathextensible [\v!reverse] [xleftoverrightarrow] ["21C6] \definemathextensible [\v!reverse] [xleftrightharpoons] ["21CB] \definemathextensible [\v!reverse] [xrightleftharpoons] ["21CC] \definemathextensible [\v!reverse] [xtriplerel] ["2261] @@ -1081,6 +1085,7 @@ \definemathextensible [\v!mathematics] [mrightharpoondown] ["21C1] \definemathextensible [\v!mathematics] [mrightharpoonup] ["21C0] \definemathextensible [\v!mathematics] [mrightoverleftarrow] ["21C4] +\definemathextensible [\v!mathematics] [mleftoverrightarrow] ["21C6] \definemathextensible [\v!mathematics] [mleftrightharpoons] ["21CB] \definemathextensible [\v!mathematics] [mrightleftharpoons] ["21CC] \definemathextensible [\v!mathematics] [mtriplerel] ["2261] @@ -1103,6 +1108,7 @@ \definemathextensible [\v!text] [trightharpoondown] ["21C1] \definemathextensible [\v!text] [trightharpoonup] ["21C0] \definemathextensible [\v!text] [trightoverleftarrow] ["21C4] +\definemathextensible [\v!text] [tleftoverrightarrow] ["21C6] \definemathextensible [\v!text] [tleftrightharpoons] ["21CB] \definemathextensible [\v!text] [trightleftharpoons] ["21CC] \definemathextensible [\v!text] [ttriplerel] ["2261] @@ -1184,6 +1190,7 @@ \definemathextensible [\v!chemistry] [cleftarrow] ["2190] \definemathextensible [\v!chemistry] [crightarrow] ["2192] \definemathextensible [\v!chemistry] [crightoverleftarrow] ["21C4] +\definemathextensible [\v!chemistry] [cleftoverrightarrow] ["21C6] % for the moment: @@ -1208,6 +1215,7 @@ \immutable\protected\def\rightarrowfill {\math_stackers_hacked_fill \relbar \relbar \rightarrow} \immutable\protected\def\leftarrowfill {\math_stackers_hacked_fill \leftarrow \relbar \relbar } \immutable\protected\def\rightoverleftarrowfill{\math_stackers_hacked_fill \ctxdoublearrowfillleftend\ctxdoublearrowfillmiddlepart\ctxdoublearrowfillrightend} +\immutable\protected\def\leftoverrightarrowfill{\math_stackers_hacked_fill \ctxdoublearrowfillrightend\ctxdoublearrowfillmiddlepart\ctxdoublearrowfillleftend} \immutable\protected\def\equalfill {\math_stackers_hacked_fill \Relbar \Relbar \Relbar} \immutable\protected\def\Rightarrowfill {\math_stackers_hacked_fill \Relbar \Relbar \Rightarrow} \immutable\protected\def\Leftarrowfill {\math_stackers_hacked_fill \Leftarrow \Relbar \Relbar} @@ -1247,6 +1255,7 @@ \defineextensiblefiller [rightharpoondownfill] ["21C1] \defineextensiblefiller [rightharpoonupfill] ["21C0] \defineextensiblefiller [rightoverleftarrowfill] ["21C4] +\defineextensiblefiller [leftoverrightarrowfill] ["21C6] %defineextensiblefiller [leftrightharpoonsfill] ["21CB] % yet undefined %defineextensiblefiller [rightleftharpoonsfill] ["21CC] % yet undefined \defineextensiblefiller [triplerelfill] ["2261] @@ -1303,7 +1312,7 @@ [\v!symbol] [\c!voffset=-.3\mathexheight, \c!hoffset=\zeropoint, - \c!mathclass=ord, + \c!mathclass=\s!ordinary, \c!topoffset=.4\mathemwidth, % poor man's italic correction \c!middlecommand=\mathematics] diff --git a/tex/context/base/mkxl/math-vfu.lmt b/tex/context/base/mkxl/math-vfu.lmt index c58906a10..906c9ccf6 100644 --- a/tex/context/base/mkxl/math-vfu.lmt +++ b/tex/context/base/mkxl/math-vfu.lmt @@ -631,8 +631,9 @@ local function copy_glyph(main,target,original,unicode,slot) height = olddata.height, depth = olddata.depth, italic = olddata.italic, - topaccent = olddata.topaccent, + topanchor = olddata.topanchor, kerns = olddata.kerns, + mathkerns = olddata.mathkerns, tounicode = olddata.tounicode, commands = { { "slot", slot, unicode } }, } @@ -646,7 +647,9 @@ local function copy_glyph(main,target,original,unicode,slot) height = oldnextdata.height, depth = oldnextdata.depth, italic = oldnextdata.italic, - topaccent = oldnextdata.topaccent, + topanchor = oldnextdata.topanchor, + kerns = olddata.kerns, + mathkerns = olddata.mathkerns, tounicode = olddata.tounicode, commands = { { "slot", slot, nextglyph } }, } @@ -982,7 +985,7 @@ function vfmath.define(specification,set,goodies) if skewchar then local k = kerns[skewchar] if k then - t.topaccent = width/2 + k + t.topanchor = width/2 + k end end characters[unicode] = t @@ -1131,8 +1134,6 @@ function vfmath.define(specification,set,goodies) report_virtual("loading and virtualizing font %a at size %p took %0.3f seconds",name,size,os.clock()-start) end -- - -- main.oldmath = true - -- -- We bypass the scaler so ... -- main.MathConstants = main.mathconstants diff --git a/tex/context/base/mkxl/mult-sys.mkxl b/tex/context/base/mkxl/mult-sys.mkxl index 38d2c0633..636c15363 100644 --- a/tex/context/base/mkxl/mult-sys.mkxl +++ b/tex/context/base/mkxl/mult-sys.mkxl @@ -160,6 +160,7 @@ \definesystemconstant {class} \definesystemconstant {leftclass} \definesystemconstant {rightclass} +\definesystemconstant {calligraphic} \definesystemconstant {clone} \definesystemconstant {close} \definesystemconstant {cmyk} diff --git a/tex/context/base/mkxl/node-ali.lmt b/tex/context/base/mkxl/node-ali.lmt index 9209a520b..4b52f2d4b 100644 --- a/tex/context/base/mkxl/node-ali.lmt +++ b/tex/context/base/mkxl/node-ali.lmt @@ -30,6 +30,7 @@ local getlist = nuts.getlist local setlist = nuts.setlist local setattrlist = nuts.setattrlist local setprop = nuts.setprop +local getprop = nuts.getprop local getfont = nuts.getfont local getchar = nuts.getchar local addmargins = nuts.addmargins @@ -626,16 +627,24 @@ deltas = { } do local a_mathalignmentvrule = attributes.private("mathalignmentvrule") + local a_mathalignmenthrule = attributes.private("mathalignmenthrule") - local function first_pass(head,attr,preamble) + -- these loops will be combined + + local dp = { } + local ht = { } + + local function vrule_pass(head,attr,preamble) + local i = 0 for row, id, subtype, list in nextlist, head do if id == hlist_code and subtype == row_code then + i = i + 1 + local prv, nxt = getboth(row) for cell, id, subtype, list in nextlist, list do if list then for n, id, subtype in nextrule, list do local signal = getattr(n,a_mathalignmentvrule) if signal then - local prv, nxt = getboth(row) if prv then if getid(prv) ~= rule_code or not getattr(prv,a_mathalignmentvrule) then prv = nil @@ -646,20 +655,65 @@ do nxt = nil end end - setoffsets(n,nil,nil,not prv and 0 or nil,not nxt and 0 or nil) + local top = not prv and 0 or nil + local bot = not nxt and 0 or nil + setoffsets(n,nil,nil,d and -d or top,h and -h or bot) + end + end + end + end + end + end + end + + local function hrule_pass(head,attr,preamble) + local i = 0 + for row, id, subtype, list in nextlist, head do + if id == hlist_code and subtype == row_code then + i = i + 1 + local height = 0 + local depth = 0 + local done = false + for cell, id, subtype, list in nextlist, list do + if list then + for n, id, subtype in nextglue, list do + local signal = getattr(n,a_mathalignmenthrule) + if signal then + local w, h, d = getwhd(n) + if h and d then + if h > height then + height = h + end + if d > depth then + depth = d + end + done = true + end end end end end + if done then + setheight(row,height) + setdepth(row,depth) + dp[i] = height + ht[i] = depth + end end end end function nodes.handlers.mathmatrixrules(head,where,attr,preamble) if where == "wrapup" then + dp = { } + ht = { } + local signal = getattr(attr,a_mathalignmenthrule) + if signal == 0x01 then -- matrix + hrule_pass(head,attr,preamble) + end local signal = getattr(attr,a_mathalignmentvrule) - if signal == 1 then -- matrix - first_pass(head,attr,preamble) + if signal == 0x01 then -- matrix + vrule_pass(head,attr,preamble) end end end diff --git a/tex/context/base/mkxl/node-ini.lmt b/tex/context/base/mkxl/node-ini.lmt index 53bd082af..34028fa2e 100644 --- a/tex/context/base/mkxl/node-ini.lmt +++ b/tex/context/base/mkxl/node-ini.lmt @@ -226,6 +226,8 @@ local texsetintegervalue = tex.setintegervalue for i=0,nodecodes.glyph do texsetintegervalue(nodecodes[i] .. "nodecode",i,"immutable") end +texsetintegervalue("tempnodecode",nodecodes.temp,"immutable") -- can happen in tables + for i=0,#gluecodes do texsetintegervalue(gluecodes[i] .. "subtypecode",i,"immutable") end diff --git a/tex/context/base/mkxl/pack-box.mkxl b/tex/context/base/mkxl/pack-box.mkxl index 28c1a42f0..ecd793056 100644 --- a/tex/context/base/mkxl/pack-box.mkxl +++ b/tex/context/base/mkxl/pack-box.mkxl @@ -1199,7 +1199,7 @@ \fi \global\setbox\scratchcounterone\hpack\bgroup \unhbox\scratchcounterone - \hskip-\wd\nextbox + \kern-\wd\nextbox \box\nextbox \egroup \endgroup}} diff --git a/tex/context/base/mkxl/pack-cut.mkxl b/tex/context/base/mkxl/pack-cut.mkxl index 0cd06ed43..1e23a97e3 100644 --- a/tex/context/base/mkxl/pack-cut.mkxl +++ b/tex/context/base/mkxl/pack-cut.mkxl @@ -13,6 +13,8 @@ \unprotect +% to be redone in a more modern way + %D \macros %D {makecutbox, cuthbox, cutvbox, cutvtop} %D @@ -101,9 +103,8 @@ \vss}% \hss}} -\permanent\protected\def\makecutbox#1% - {\bgroup - \d_pack_cutmarks_height\ht#1% +\permanent\protected\def\makecutbox#1% not grouped ! + {\d_pack_cutmarks_height\ht#1% \d_pack_cutmarks_depth \dp#1% \d_pack_cutmarks_width \wd#1% \setbox#1\hpack @@ -155,7 +156,7 @@ \wd#1\d_pack_cutmarks_width \ht#1\d_pack_cutmarks_height \dp#1\d_pack_cutmarks_depth - \egroup} + \box#1} \permanent\protected\def\cuthbox{\hpack\bgroup\dowithnextbox{\makecutbox\nextbox\flushnextbox\egroup}\hbox} \permanent\protected\def\cutvbox{\vpack\bgroup\dowithnextbox{\makecutbox\nextbox\flushnextbox\egroup}\vbox} diff --git a/tex/context/base/mkxl/pack-mrl.mkxl b/tex/context/base/mkxl/pack-mrl.mkxl index 7a04f3904..b4339b0b2 100644 --- a/tex/context/base/mkxl/pack-mrl.mkxl +++ b/tex/context/base/mkxl/pack-mrl.mkxl @@ -181,7 +181,7 @@ \s!depth \scratchdepth \relax \ifzeropt\scratchdistance\else - \hskip\scratchdistance + \kern\scratchdistance % hskip \fi} \installcorenamespace{blackruletype} @@ -648,7 +648,7 @@ {\llap {\usetextrulesstyleandcolor\c!style\c!color #1% - \hskip\leftmargindistance}} + \kern\leftmargindistance}} % hskip {\color[\directtextrulesparameter\c!rulecolor] {\vrule \s!height\scratchheight @@ -794,7 +794,7 @@ \strut #2% \hfill\directfillinrulesparameter\c!separator - \hskip\scratchdistance + \kern\scratchdistance % hskip \egroup \fi \setupwhitespace[\v!big]% diff --git a/tex/context/base/mkxl/pack-pos.mkxl b/tex/context/base/mkxl/pack-pos.mkxl index aee22081f..e2fd1c8f8 100644 --- a/tex/context/base/mkxl/pack-pos.mkxl +++ b/tex/context/base/mkxl/pack-pos.mkxl @@ -90,7 +90,7 @@ \vbox to \d_pack_positioning_y_dimension {\vskip\d_pack_positioning_y_offset \hbox to \d_pack_positioning_x_dimension - {\hskip\d_pack_positioning_x_offset + {\kern\d_pack_positioning_x_offset \box\b_pack_positioning \hfill} \vfill}% @@ -145,7 +145,7 @@ {\offinterlineskip % else we get an empty line \vskip\d_pack_positioning_y_position \hbox to \zeropoint - {\hskip\d_pack_positioning_x_position + {\kern\d_pack_positioning_x_position \box\nextbox \hss} \vss}% diff --git a/tex/context/base/mkxl/pack-rul.lmt b/tex/context/base/mkxl/pack-rul.lmt index f81a672d2..c2183c1ad 100644 --- a/tex/context/base/mkxl/pack-rul.lmt +++ b/tex/context/base/mkxl/pack-rul.lmt @@ -35,6 +35,8 @@ local equationlist_code = listcodes.equation local texsetdimen = tex.setdimen local texsetcount = tex.setcount +local texisdimen = tex.isdimen +local texiscount = tex.iscount local implement = interfaces.implement @@ -52,8 +54,6 @@ local getdirection = nuts.getdirection local setshift = nuts.setshift local setwidth = nuts.setwidth local getwidth = nuts.getwidth --- local setboxglue = nuts.setboxglue --- local getboxglue = nuts.getboxglue local setboxglue = nuts.setglue local getboxglue = nuts.getglue @@ -73,6 +73,13 @@ directives.register("framed.checkmath",function(v) checkformath = v end) -- expe -- beware: dir nodes and pseudostruts can end up on lines of their own +local c_framednoflines = texiscount("framednoflines") +local d_framedfirstheight = texisdimen("framedfirstheight") +local d_framedlastdepth = texisdimen("framedlastdepth") +local d_framedminwidth = texisdimen("framedminwidth") +local d_framedmaxwidth = texisdimen("framedmaxwidth") +local d_framedaveragewidth = texisdimen("framedaveragewidth") + local function doreshapeframedbox(n,resync) if resync then resync = drivers.converters.resyncbox @@ -148,7 +155,7 @@ local function doreshapeframedbox(n,resync) setlist(p) flushnode(p) elseif checkformath and subtype == equationlist_code then - -- display formulas use a shift + -- display formulas use a shift .. actually we never have display mode if nofnonzero == 1 then setshift(h,0) end @@ -172,12 +179,12 @@ local function doreshapeframedbox(n,resync) end end end - texsetcount("global","framednoflines",noflines) - texsetdimen("global","framedfirstheight",firstheight or 0) -- also signal - texsetdimen("global","framedlastdepth",lastdepth or 0) - texsetdimen("global","framedminwidth",minwidth) - texsetdimen("global","framedmaxwidth",maxwidth) - texsetdimen("global","framedaveragewidth",averagewidth) + texsetcount("global",c_framednoflines,noflines) + texsetdimen("global",d_framedfirstheight,firstheight or 0) -- also signal + texsetdimen("global",d_framedlastdepth,lastdepth or 0) + texsetdimen("global",d_framedminwidth,minwidth) + texsetdimen("global",d_framedmaxwidth,maxwidth) + texsetdimen("global",d_framedaveragewidth,averagewidth) end local function doanalyzeframedbox(n) @@ -206,9 +213,9 @@ local function doanalyzeframedbox(n) end end end - texsetcount("global","framednoflines",noflines) - texsetdimen("global","framedfirstheight",firstheight or 0) - texsetdimen("global","framedlastdepth",lastdepth or 0) + texsetcount("global",c_framednoflines,noflines) + texsetdimen("global",d_framedfirstheight,firstheight or 0) + texsetdimen("global",d_framedlastdepth,lastdepth or 0) end implement { name = "doreshapeframedbox", actions = doreshapeframedbox, arguments = "integer" } diff --git a/tex/context/base/mkxl/pack-rul.mkxl b/tex/context/base/mkxl/pack-rul.mkxl index 803d83bf3..b06e8f57c 100644 --- a/tex/context/base/mkxl/pack-rul.mkxl +++ b/tex/context/base/mkxl/pack-rul.mkxl @@ -18,6 +18,13 @@ %D packaging and expansion we also keep tracing reasonable. For instance, multiple %D stacked backgrounds can slow down a run if not optimized this way. +\newcount\framednoflines +\newdimen\framedfirstheight +\newdimen\framedlastdepth +\newdimen\framedminwidth +\newdimen\framedmaxwidth +\newdimen\framedaveragewidth + \registerctxluafile{pack-rul}{autosuffix,optimize} \unprotect @@ -703,7 +710,7 @@ \def\pack_framed_stroked_box_normal_closed {\hpack\bgroup \scratchdimen.5\d_framed_linewidth - \hskip\scratchdimen + \kern\scratchdimen \clf_framedoutline \dimexpr\d_framed_target_wd-\d_framed_linewidth\relax \dimexpr\d_framed_target_ht-\scratchdimen\relax @@ -2323,12 +2330,12 @@ %D It is possible to let the frame macro calculate the width of a centered box %D automatically (\type {fit}). When doing so, we need to reshape the box: -\newcount\framednoflines -\newdimen\framedfirstheight -\newdimen\framedlastdepth -\newdimen\framedminwidth -\newdimen\framedmaxwidth -\newdimen\framedaveragewidth +% \newcount\framednoflines +% \newdimen\framedfirstheight +% \newdimen\framedlastdepth +% \newdimen\framedminwidth +% \newdimen\framedmaxwidth +% \newdimen\framedaveragewidth \def\pack_framed_reshape_reset {\framednoflines \zerocount diff --git a/tex/context/base/mkxl/page-box.mklx b/tex/context/base/mkxl/page-box.mklx index 56cb73f7a..a65989222 100644 --- a/tex/context/base/mkxl/page-box.mklx +++ b/tex/context/base/mkxl/page-box.mklx @@ -79,10 +79,19 @@ % {\boxxoffset#box\dimexpr\boxxoffset#box\doifbothsides++-\backoffset\relax % \boxyoffset#box\dimexpr\boxyoffset#box-\topoffset\relax} +% \def\page_boxes_apply_offset % #box +% {\unless\ifzeropt\topoffset % we can't do an unless here +% \expandafter\page_boxes_apply_offset_indeed +% \orunless\ifzeropt\backoffset +% \expandafter\page_boxes_apply_offset_indeed +% \else +% \expandafter\gobbleoneargument +% \fi} + \def\page_boxes_apply_offset % #box - {\unless\ifzeropt\topoffset + {\unless\ifdim\topoffset=\zeropoint \expandafter\page_boxes_apply_offset_indeed - \orunless\ifzeropt\backoffset + \orunless\ifdim\backoffset=\zeropoint \expandafter\page_boxes_apply_offset_indeed \else \expandafter\gobbleoneargument @@ -100,9 +109,9 @@ \def\page_boxes_apply_replicate_indeed#box% {\setbox#box\vpack {\offinterlineskip - \dorecurse{\layoutparameter\c!ny} + \dorecurse{\layoutparameter\c!ny}% {\hpack{\dorecurse{\layoutparameter\c!nx}{\copy#box\kern\layoutparameter\c!dx}\unskip}% - \vskip\layoutparameter\c!dy} + \vskip\layoutparameter\c!dy}% \unskip}} \def\page_boxes_apply_orientate_paper#box% diff --git a/tex/context/base/mkxl/spac-ver.lmt b/tex/context/base/mkxl/spac-ver.lmt index 7884a111c..283109f03 100644 --- a/tex/context/base/mkxl/spac-ver.lmt +++ b/tex/context/base/mkxl/spac-ver.lmt @@ -56,6 +56,8 @@ local texsetcount = tex.setcount local texnest = tex.nest local texgetbox = tex.getbox +local tg = texgetdimen + local buildpage = tex.triggerbuildpage local variables = interfaces.variables @@ -69,13 +71,6 @@ local v_split = variables.split local v_min = variables.min local v_max = variables.max local v_none = variables.none -local v_line = variables.line -local v_noheight = variables.noheight -local v_nodepth = variables.nodepth -local v_line = variables.line -local v_halfline = variables.halfline -local v_line_m = "-" .. v_line -local v_halfline_m = "-" .. v_halfline local v_first = variables.first local v_last = variables.last local v_top = variables.top @@ -115,6 +110,11 @@ local a_skiporder = attributes.private('skiporder') local a_snapmethod = attributes.private('snapmethod') local a_snapvbox = attributes.private('snapvbox') +local d_bodyfontstrutheight = tex.isdimen("bodyfontstrutheight") +local d_bodyfontstrutdepth = tex.isdimen("bodyfontstrutdepth") +local d_globalbodyfontstrutheight = tex.isdimen("globalbodyfontstrutheight") +local d_globalbodyfontstrutdepth = tex.isdimen("globalbodyfontstrutdepth") + local nuts = nodes.nuts local tonut = nuts.tonut @@ -357,6 +357,13 @@ end local snap_hlist do + local v_noheight = variables.noheight + local v_nodepth = variables.nodepth + local v_line = variables.line + local v_halfline = variables.halfline + local v_line_m = "-" .. v_line + local v_halfline_m = "-" .. v_halfline + local floor = math.floor local ceil = math.ceil @@ -397,24 +404,24 @@ local snap_hlist do local snapht, snapdp if method[v_local] then -- snapping is done immediately here - snapht = texgetdimen("bodyfontstrutheight") - snapdp = texgetdimen("bodyfontstrutdepth") + snapht = texgetdimen(d_bodyfontstrutheight) + snapdp = texgetdimen(d_bodyfontstrutdepth) if t then t[#t+1] = formatters["local: snapht %p snapdp %p"](snapht,snapdp) end elseif method[v_global] then - snapht = texgetdimen("globalbodyfontstrutheight") - snapdp = texgetdimen("globalbodyfontstrutdepth") + snapht = texgetdimen(d_globalbodyfontstrutheight) + snapdp = texgetdimen(d_globalbodyfontstrutdepth) if t then t[#t+1] = formatters["global: snapht %p snapdp %p"](snapht,snapdp) end else -- maybe autolocal -- snapping might happen later in the otr - snapht = texgetdimen("globalbodyfontstrutheight") - snapdp = texgetdimen("globalbodyfontstrutdepth") - local lsnapht = texgetdimen("bodyfontstrutheight") - local lsnapdp = texgetdimen("bodyfontstrutdepth") + snapht = texgetdimen(d_globalbodyfontstrutheight) + snapdp = texgetdimen(d_globalbodyfontstrutdepth) + local lsnapht = texgetdimen(d_bodyfontstrutheight) + local lsnapdp = texgetdimen(d_bodyfontstrutdepth) if snapht ~= lsnapht and snapdp ~= lsnapdp then snapht, snapdp = lsnapht, lsnapdp end @@ -672,7 +679,7 @@ local snap_hlist do local lines = (ch+cd)/snaphtdp if t then local original = (h+d)/snaphtdp - local whatever = (ch+cd)/(texgetdimen("globalbodyfontstrutheight") + texgetdimen("globalbodyfontstrutdepth")) + local whatever = (ch+cd)/(texgetdimen(d_globalbodyfontstrutheight) + texgetdimen(d_globalbodyfontstrutdepth)) t[#t+1] = formatters["final lines : %p -> %p (%p)"](original,lines,whatever) t[#t+1] = formatters["final height: %p -> %p"](h,ch) t[#t+1] = formatters["final depth : %p -> %p"](d,cd) @@ -1699,10 +1706,10 @@ do -- if trace_vsnapping then report_snapper("global ht/dp = %p/%p, local ht/dp = %p/%p", - texgetdimen("globalbodyfontstrutheight"), - texgetdimen("globalbodyfontstrutdepth"), - texgetdimen("bodyfontstrutheight"), - texgetdimen("bodyfontstrutdepth") + texgetdimen(d_globalbodyfontstrutheight), + texgetdimen(d_globalbodyfontstrutdepth), + texgetdimen(d_bodyfontstrutheight), + texgetdimen(d_bodyfontstrutdepth) ) end if trace then diff --git a/tex/context/base/mkxl/spac-ver.mkxl b/tex/context/base/mkxl/spac-ver.mkxl index 28a1151fb..7ab80d6a9 100644 --- a/tex/context/base/mkxl/spac-ver.mkxl +++ b/tex/context/base/mkxl/spac-ver.mkxl @@ -15,6 +15,14 @@ \unprotect +\newskip \bodyfontlineheight % why a skip +\newdimen \bodyfontstrutheight +\newdimen \bodyfontstrutdepth + +\newskip \globalbodyfontlineheight % why a skip +\newdimen \globalbodyfontstrutheight +\newdimen \globalbodyfontstrutdepth + \registerctxluafile{spac-ver}{autosuffix,optimize} % todo: use usernodes ? @@ -1396,13 +1404,13 @@ \installcorenamespace{gridsnapperattributes} \installcorenamespace{gridsnappersets} -\newskip \bodyfontlineheight -\newdimen \bodyfontstrutheight -\newdimen \bodyfontstrutdepth +% \newskip \bodyfontlineheight % see top +% \newdimen \bodyfontstrutheight % see top +% \newdimen \bodyfontstrutdepth % see top -\newskip \globalbodyfontlineheight % why a skip -\newdimen \globalbodyfontstrutheight -\newdimen \globalbodyfontstrutdepth +% \newskip \globalbodyfontlineheight % see top +% \newdimen \globalbodyfontstrutheight % see top +% \newdimen \globalbodyfontstrutdepth % see top \permanent\def\snappedvboxattribute{\ifgridsnapping attr\snapvboxattribute\c_attr_snapmethod\fi} \permanent\def\setlocalgridsnapping{\ifgridsnapping \c_attr_snapvbox \c_attr_snapmethod\fi} diff --git a/tex/context/base/mkxl/strc-lst.mklx b/tex/context/base/mkxl/strc-lst.mklx index 785d566cf..c04d68fa7 100644 --- a/tex/context/base/mkxl/strc-lst.mklx +++ b/tex/context/base/mkxl/strc-lst.mklx @@ -146,7 +146,7 @@ \scratchcounter\clf_addtolist references { internal \locationcount - % block {\currentsectionblock} + % block {\currentsectionblock} % needed for publications (can be get from section) % section structures.sections.currentid() % location {\p_location} } diff --git a/tex/context/base/mkxl/strc-ref.lmt b/tex/context/base/mkxl/strc-ref.lmt index 7ad20fa34..32c2a5429 100644 --- a/tex/context/base/mkxl/strc-ref.lmt +++ b/tex/context/base/mkxl/strc-ref.lmt @@ -54,6 +54,7 @@ local implement = interfaces.implement local ctx_latelua = context.latelua +local texiscount = tex.iscount local texgetcount = tex.getcount local texsetcount = tex.setcount local texconditionals = tex.conditionals @@ -124,6 +125,11 @@ local currentreference = nil local txtcatcodes = catcodes.numbers.txtcatcodes -- or just use "txtcatcodes" +local c_realpageno = texiscount("realpageno") +local c_locationcount = texiscount("locationcount") +local c_locationorder = texiscount("locationorder") +local c_lastdestinationattribute = texiscount("lastdestinationattribute") + local context = context local ctx_pushcatcodes = context.pushcatcodes @@ -294,7 +300,7 @@ local function referredpage(n) end end -- fallback - return texgetcount("realpageno") + return texgetcount(c_realpageno) end references.referredpage = referredpage @@ -304,7 +310,7 @@ function references.registerpage(n) -- called in the backend code if n > maxreferred then maxreferred = n end - tobereferred[n] = texgetcount("realpageno") + tobereferred[n] = texgetcount(c_realpageno) end end @@ -323,14 +329,14 @@ local function setnextorder(kind,name) lastorder = (ok[name] or 0) + 1 ok[name] = lastorder end - texsetcount("global","locationorder",lastorder) + texsetcount("global",c_locationorder,lastorder) end local function setnextinternal(kind,name) setnextorder(kind,name) -- always incremented with internal - local n = texgetcount("locationcount") + 1 - texsetcount("global","locationcount",n) + local n = texgetcount(c_locationcount) + 1 + texsetcount("global",c_locationcount,n) return n end @@ -433,12 +439,12 @@ end -- function references.enhance(prefix,tag) -- local l = tobesaved[prefix][tag] -- if l then --- l.references.realpage = texgetcount("realpageno") +-- l.references.realpage = texgetcount(c_realpageno) -- end -- end local function synchronizepage(reference) -- non public helper - reference.realpage = texgetcount("realpageno") + reference.realpage = texgetcount(c_realpageno) if jobpositions.used() then reference.x, reference.y = getpos() end @@ -2040,7 +2046,7 @@ local function setinternalreference(specification) if internal then -- new destinationattributes[internal] = destination end - texsetcount("lastdestinationattribute",destination) + texsetcount(c_lastdestinationattribute,destination) return destination end @@ -2107,7 +2113,7 @@ function references.setandgetattribute(data) -- maybe do internal automatically } or unsetvalue end end - texsetcount("lastdestinationattribute",attr) + texsetcount(c_lastdestinationattribute,attr) return attr end @@ -2685,7 +2691,7 @@ function references.checkedrealpage(r) realpageofpage(r) -- just initialize end if not r then - return texgetcount("realpageno") + return texgetcount(c_realpageno) elseif r < 1 then return 1 elseif r > nofrealpages then @@ -2780,7 +2786,7 @@ end function specials.deltapage(var,actions) local p = tonumber(var.operation) if p then - p = references.checkedrealpage(p + texgetcount("realpageno")) + p = references.checkedrealpage(p + texgetcount(c_realpageno)) var.r = p actions.realpage = actions.realpage or p -- first wins end diff --git a/tex/context/base/mkxl/strc-ref.mklx b/tex/context/base/mkxl/strc-ref.mklx index 07c8c2c1b..012d9d92d 100644 --- a/tex/context/base/mkxl/strc-ref.mklx +++ b/tex/context/base/mkxl/strc-ref.mklx @@ -27,6 +27,14 @@ \writestatus{loading}{ConTeXt Structure Macros / Cross Referencing} +\newif \iflocation +\newcount\locationcount +\newcount\locationorder +\newbox \locationbox + +\newcount\lastreferenceattribute +\newcount\lastdestinationattribute + \registerctxluafile{strc-rsc}{autosuffix} \registerctxluafile{strc-ref}{autosuffix} \registerctxluafile{node-ref}{autosuffix,optimize} @@ -137,8 +145,8 @@ %D Actually there is not much difference between a text and a full reference, but %D it's the concept that counts. The low level implementation is: -\newcount\lastreferenceattribute -\newcount\lastdestinationattribute +% sett top : \newcount\lastreferenceattribute +% sett top : \newcount\lastdestinationattribute \def\strc_references_finish#prefix#reference#internal% gets expanded anyway {\normalexpanded{\clf_deferredenhancereference{#prefix}{#reference}}} @@ -803,10 +811,10 @@ %D %D We could do this in \LUA\ \unknown -\newif \iflocation -\newcount\locationcount -\newcount\locationorder -\newbox \locationbox +% seet top: \newif \iflocation +% seet top: \newcount\locationcount +% seet top: \newcount\locationorder +% seet top: \newbox \locationbox \appendtoks \locationfalse diff --git a/tex/context/base/mkxl/strc-reg.lmt b/tex/context/base/mkxl/strc-reg.lmt index a45f23bf0..85198a151 100644 --- a/tex/context/base/mkxl/strc-reg.lmt +++ b/tex/context/base/mkxl/strc-reg.lmt @@ -34,6 +34,7 @@ local processors = typesetters.processors local splitprocessor = processors.split local texgetcount = tex.getcount +local texiscount = tex.iscount local variables = interfaces.variables local v_forward = variables.forward @@ -67,6 +68,9 @@ local setmetatableindex = table.setmetatableindex local absmaxlevel = 5 -- \c_strc_registers_maxlevel +local c_realpageno = texiscount("realpageno") +local c_locationcount = texiscount("locationcount") + local h_prefixpage = helpers.prefixpage local h_prefixlastpage = helpers.prefixlastpage local h_title = helpers.title @@ -564,7 +568,7 @@ local function storeregister(rawdata) -- metadata, references, entries -- local internal = references.internal if not internal then - internal = texgetcount("locationcount") -- we assume that it has been set + internal = texgetcount(c_locationcount) -- we assume that it has been set references.internal = internal end -- @@ -606,7 +610,7 @@ local function enhanceregister(specification) local data = saved.metadata.notsaved and collected[name] or saved local entry = data.entries[n] if entry then - entry.references.realpage = texgetcount("realpageno") + entry.references.realpage = texgetcount(c_realpageno) end end @@ -621,7 +625,7 @@ local function extendregister(name,tag,rawdata) -- maybe do lastsection internal local entry = data.entries[tag] if entry then local references = entry.references - references.lastrealpage = texgetcount("realpageno") + references.lastrealpage = texgetcount(c_realpageno) references.lastsection = currentid() if rawdata then local userdata = rawdata.userdata diff --git a/tex/context/base/mkxl/strc-reg.mkxl b/tex/context/base/mkxl/strc-reg.mkxl index 22b1202db..b0f50ecfd 100644 --- a/tex/context/base/mkxl/strc-reg.mkxl +++ b/tex/context/base/mkxl/strc-reg.mkxl @@ -1068,11 +1068,14 @@ % \applyprocessor{#1}{\registerparameter\c!pagecommand{#4}}% % \fi} +\let\currentregisterrealpage\!!zerocount % todo: more general accessor + \permanent\protected\def\withregisterpagecommand#1#2#3#4% {\ifcase#3\relax {\tt [entry\space not\space flushed]}% \else \def\currentregisterpageindex{#2}% + \def\currentregisterrealpage{#3}% \iflocation \strc_references_goto_internal{\applyprocessor{#1}{\registerparameter\c!pagecommand{#4}}}[internal(#2)]% \else diff --git a/tex/context/base/mkxl/syst-ini.mkxl b/tex/context/base/mkxl/syst-ini.mkxl index 0c5251373..96bdde764 100644 --- a/tex/context/base/mkxl/syst-ini.mkxl +++ b/tex/context/base/mkxl/syst-ini.mkxl @@ -990,7 +990,8 @@ %D \ifzeropt \somedimen ... \else ... \fi %D \stoptyping -\aliased\let\ifzeropt\ifcase +\aliased\let\ifzeropt\ifzerodim % was \let\ifzeropt\ifcase +\aliased\let\ifzero \ifzeronum % was \let\ifzeropt\ifcase % these token list helpers might move to syst-aux.mkiv % @@ -1254,8 +1255,8 @@ %D For a while we will keep these useless numbers as for instance tikz checks for them: -\immutable\integerdef\eTeXversion 2 -\immutable\def \eTeXrevision {2} +\immutable\integerdef\eTeXversion 2 +\immutable\def \eTeXrevision {.2} % there is a funny period here % %D Just in case users use this (or some styles still have it): diff --git a/tex/context/base/mkxl/tabl-tbl.mkxl b/tex/context/base/mkxl/tabl-tbl.mkxl index 4d4037ff6..851984bea 100644 --- a/tex/context/base/mkxl/tabl-tbl.mkxl +++ b/tex/context/base/mkxl/tabl-tbl.mkxl @@ -407,11 +407,11 @@ % \protected % we can expand this one \def\tabl_tabulate_inject_pre_skip#1% {\ifdim#1>\zeropoint - \kern#1\relax % was \hskip + \kern#1\relax % hskip \orelse\ifnum\c_tabl_tabulate_column=\zerocount \ifconditional\c_tabl_tabulate_autorulespacing \ifcase\c_tabl_tabulate_has_rule_spec_first\else - \kern\s_tabl_tabulate_first\relax % was \hskip + \kern\s_tabl_tabulate_first\relax % hskip \fi \fi \fi} @@ -423,7 +423,7 @@ \orelse\ifnum\c_tabl_tabulate_columns=\c_tabl_tabulate_nofcolumns \ifconditional\c_tabl_tabulate_autorulespacing \ifcase\c_tabl_tabulate_has_rule_spec_last\else - \kern\s_tabl_tabulate_last\relax % was \hskip + \kern\s_tabl_tabulate_last\relax % hskip \fi \fi \fi} diff --git a/tex/context/base/mkxl/task-ini.lmt b/tex/context/base/mkxl/task-ini.lmt index 9c90aba02..17555d7e2 100644 --- a/tex/context/base/mkxl/task-ini.lmt +++ b/tex/context/base/mkxl/task-ini.lmt @@ -122,7 +122,7 @@ appendaction("math", "normalizers", "noads.handlers.dictionaries", appendaction("math", "normalizers", "noads.handlers.suspicious", nil, "nonut", "enabled" ) appendaction("math", "builders", "builders.kernel.mlisttohlist", nil, "nut", "enabled" ) -- mandate -appendaction("math", "builders", "typesetters.directions.processmath", nil, "nut", "disabled" ) +------------("math", "builders", "typesetters.directions.processmath", nil, "nut", "disabled" ) appendaction("math", "builders", "noads.handlers.makeup", nil, "nonut", "disabled" ) ------------("math", "builders", "noads.handlers.align", nil, "nonut", "enabled" ) diff --git a/tex/context/base/mkxl/type-set.mkxl b/tex/context/base/mkxl/type-set.mkxl index a14a99630..ae07bd914 100644 --- a/tex/context/base/mkxl/type-set.mkxl +++ b/tex/context/base/mkxl/type-set.mkxl @@ -134,6 +134,7 @@ \definefilesynonym [type-imp-coloredsheep.mkiv] [type-imp-koeielettersot.mkiv] \definefilesynonym [type-imp-koeieletters.mkiv] [type-imp-koeielettersot.mkiv] +\definefilesynonym [type-imp-xits.mkiv] [type-imp-stix.mkiv] \definefilesynonym [type-imp-stixtwo.mkiv] [type-imp-stix.mkiv] \definefilesynonym [type-imp-ibmplex.mkiv] [type-imp-plex.mkiv] diff --git a/tex/context/fonts/mkiv/asana-math.lfg b/tex/context/fonts/mkiv/asana-math.lfg index 934f9e0f0..379dd014f 100644 --- a/tex/context/fonts/mkiv/asana-math.lfg +++ b/tex/context/fonts/mkiv/asana-math.lfg @@ -30,6 +30,8 @@ -- local integral_top = { topright = 0.05 } -- local integral_bottom = { bottomright = -0.25 } +local common = fonts.goodies.load("common-math.lfg") +local presets = common.mathematics.tweaks.presets return { name = "asana-math", @@ -49,7 +51,7 @@ return { -- StretchStackGapAboveMin = less, -- StretchStackGapBelowMin = less, -- StretchStackTopShiftUp = less, - NoLimitSupFactor = -200, + NoLimitSupFactor = 200, NoLimitSubFactor = 1200, AccentBaseDepth = 300, RadicalDegreeBottomRaisePercent = 70, @@ -65,6 +67,12 @@ return { expected = "Version 000.958", message = "this font is not supported", }, + { + tweak = "addmirrors", + }, + presets.matheulercalligraphic { rscale = 1 }, + presets.mathrsfscript { rscale = 1 }, + presets.mathxitsarabic { rscale = 0.95 }, { tweak = "dimensions", list = { @@ -103,7 +111,10 @@ return { { tweak = "fixellipses", }, - + { + tweak = "setoptions", + set = { "ignorekerndimensions" } + }, }, }, bigslots = { diff --git a/tex/context/fonts/mkiv/bonum-math.lfg b/tex/context/fonts/mkiv/bonum-math.lfg index c09b55c20..508293f19 100644 --- a/tex/context/fonts/mkiv/bonum-math.lfg +++ b/tex/context/fonts/mkiv/bonum-math.lfg @@ -17,10 +17,12 @@ local dimensions, kerns if CONTEXTLMTXMODE == 0 then end --- When set this will bypass the italic correction hackery! -local integral_variants = { bottomright = -0.20 } -local integral_top = { topright = 0.05 } -local integral_bottom = { bottomright = -0.30 } +local integral_variants = { bottomright = -0.20 } +local integral_top = { topright = 0.05 } +local integral_bottom = { bottomright = -0.30 } + +local common = fonts.goodies.load("common-math.lfg") +local presets = common.mathematics.tweaks.presets return { name = "bonum-math", @@ -34,19 +36,19 @@ return { NoLimitSubFactor = 900, AccentTopShiftUp = -15, FlattenedAccentTopShiftUp = -15, - -- AccentExtendMargin = 50, + -- AccentExtendMargin = 50, AccentBaseDepth = 50, RadicalDegreeBottomRaisePercent = 60, - RadicalRuleThickness = 66, -- 72 in font + RadicalRuleThickness = 66, -- 72 in font DelimiterPercent = 90, DelimiterShortfall = 400, DisplayOperatorMinHeight = 1900, -- 1250 in font -- AccentSuperscriptDrop = 100, - -- AccentSuperscriptPercent = 20, - -- PrimeRaisePercent = 50, - PrimeRaiseComposedPercent = 0, - -- PrimeShiftUp = 0, - -- PrimeBaselineDropMax = 0, + -- AccentSuperscriptPercent = 20, + -- PrimeRaisePercent = 50, + PrimeRaiseComposedPercent = 0, + -- PrimeShiftUp = 0, + -- PrimeBaselineDropMax = 0, }, tweaks = { aftercopying = { @@ -55,125 +57,79 @@ return { expected = "Version 1.005", }, { + tweak = "fixprimes", + -- scale = 0.8, + -- smaller = true, + factor = 1,--1.1 + }, + { + tweak = "addmirrors", + }, + { + tweak = "replacealphabets", + -- feature = "mathbeta", -- we always replace + list = { + { + source = { first = 0x003B1 }, + filename = "texgyrebonummath-companion.otf", + }, + { + source = { first = 0x1D6FC }, + filename = "texgyrebonummath-companion.otf", + }, + }, + }, + presets.matheulercalligraphic { rscale = 0.98 }, + presets.mathrsfscript { rscale = 0.98 }, + presets.mathxitsarabic { rscale = 1 }, + presets.moveitalics { correct = true }, + { + -- For some alphabets we remove italic correction. + -- tweak = "wipeitalics", + list = { + "digitsbold", + "digitsdoublestruck", + "digitsmonospace", + "digitsnormal", + "digitssansserifbold", + "digitssansserifnormal", + "lowercasebold", + "lowercaseboldfraktur", + "lowercasedoublestruck", + "lowercasefraktur", + "lowercasemonospace", + -- "lowercasenormal", + "lowercasesansserifbold", + -- "lowercasesansserifnormal", + "lowercasegreeknormal", + "uppercasebold", + "uppercaseboldfraktur", + "uppercasedoublestruck", + "uppercasefraktur", + "uppercasegreekbold", + "uppercasegreeknormal", + "uppercasegreeksansserifbold", + "uppercasemonospace", + "uppercasesansserifbold", + "uppercasesanserifnormal", -- some remain + }, + }, + { + -- tweak = "topaccents", + list = { + [0x1D453] = 0.7, -- f + }, + }, + { + tweak = "limits", + list = { + [0x0222B] = 1.5, + }, + }, + { + -- We need to check these, are the tweaks necessary or not? tweak = "dimensions", list = { - [0x00393] = { xoffset = -0.05, width = 0.875, italic = 0 }, -- \Gamma - [0x00394] = { xoffset = -0.05, width = 0.875, italic = 0 }, -- \Delta - [0x00398] = { xoffset = -0.05, width = 0.9, italic = 0 }, -- \Theta - [0x0039B] = { xoffset = -0.075, width = 0.85, italic = 0 }, -- \Lambda - [0x0039E] = { xoffset = -0.075, width = 0.85, italic = 0 }, -- \Xi - [0x003A0] = { xoffset = -0.075, width = 0.85, italic = 0 }, -- \Pi - [0x003A3] = { xoffset = -0.075, width = 0.85, italic = 0 }, -- \Sigma - [0x003A5] = { xoffset = -0.075, width = 0.85, italic = 0 }, -- \Upsilon - [0x003A6] = { xoffset = -0.05, width = 0.9, italic = 0 }, -- \Phi - [0x003A8] = { xoffset = -0.05, width = 0.9, italic = 0 }, -- \Psi - [0x003A9] = { xoffset = -0.05, width = 0.9, italic = 0 }, -- \Omega - [0x02202] = { xoffset = -0.075, width = 0.825, italic = 0 }, -- \partial - [0x1D43A] = { xoffset = -0.1, width = 1, italic = 0 }, -- G - [0x1D442] = { xoffset = -0.1, width = 1, italic = 0 }, -- O - [0x1D444] = { xoffset = -0.05, width = 1.025, italic = 0 }, -- Q - [0x1D44E] = { xoffset = -0.05, width = 1.1, italic = 0, anchor = 0.8 }, -- a - [0x1D44F] = { xoffset = -0.05, width = 1.1, italic = 0 }, -- b - [0x1D450] = { xoffset = -0.05, width = 1.1, italic = 0, anchor = 0.9 }, -- c - [0x1D451] = { xoffset = -0.05, width = 1.1, italic = 0, anchor = 0.75 }, -- d - [0x1D452] = { xoffset = -0.05, width = 1.1, italic = 0, anchor = 0.9 }, -- e - [0x1D453] = { xoffset = 0.45, width = 1.9, italic = 0.45, anchor = 1.1 }, -- f - [0x1D454] = { xoffset = 0.05, width = 1.1, italic = 0, anchor = 0.9 }, -- g - [0x0210E] = { xoffset = -0.1, width = 1.05, italic = 0, anchor = 1.15 }, -- h - [0x1D456] = { xoffset = -0.2, width = 1.1, italic = 0 }, -- i - [0x1D457] = { xoffset = 0.6, width = 1.7, italic = 0.45 }, -- j - [0x1D458] = { xoffset = -0.05, width = 1.1, italic = 0, anchor = 1.15 }, -- k - [0x1D459] = { xoffset = -0.15, width = 1.1, italic = 0, anchor = 0.8 }, -- l - [0x1D45A] = { xoffset = -0.05, width = 1, italic = 0 }, -- m - [0x1D45B] = { xoffset = -0.1, width = 1, italic = 0, anchor = 0.9 }, -- n - [0x1D45C] = { xoffset = -0.05, width = 1.1, italic = 0, anchor = 0.9 }, -- o - [0x1D45D] = { xoffset = 0, width = 1.05, italic = 0 }, -- p - [0x1D45E] = { xoffset = -0.05, width = 1.05, italic = 0, anchor = 0.9 }, -- q - [0x1D45F] = { xoffset = -0.1, width = 1.15, italic = 0, anchor = 0.9 }, -- r - [0x1D460] = { xoffset = -0.05, width = 1.05, italic = 0 }, -- s - [0x1D461] = { xoffset = -0.15, width = 1.2, italic = 0, anchor = 0.9 }, -- t - [0x1D462] = { xoffset = -0.1, width = 1.05, italic = 0, anchor = 0.85 }, -- u - [0x1D463] = { xoffset = -0.1, width = 1.05, italic = 0, anchor = 0.85 }, -- v - [0x1D464] = { xoffset = -0.05, width = 1.05, italic = 0, anchor = 0.95 }, -- w - [0x1D465] = { xoffset = 0, width = 1.175, italic = 0, anchor = 0.9 }, -- x - [0x1D466] = { xoffset = -0.05, width = 1.05, italic = 0 }, -- y - [0x1D467] = { xoffset = -0.05, width = 1.1, italic = 0, anchor = 0.9 }, -- z - [0x1D6FC] = { xoffset = -0.075, width = 0.825, italic = 0 }, -- \alpha - [0x1D6FD] = { xoffset = 0, width = 0.9, italic = 0, anchor = 1.05 }, -- \beta - [0x1D6FE] = { xoffset = -0.075, width = 0.85, italic = 0.05, anchor = 1.05 }, -- \gamma - [0x1D6FF] = { xoffset = -0.1, width = 0.85, italic = 0 }, -- \delta - [0x1D716] = { xoffset = -0.1, width = 0.85, italic = 0 }, -- \epsilon - [0x1D700] = { xoffset = -0.1, width = 0.85, italic = 0 }, -- \varepsilon - [0x1D701] = { xoffset = -0.1, width = 0.85, italic = 0 }, -- \zeta - [0x1D702] = { xoffset = -0.1, width = 0.85, italic = 0, anchor = 1.05 }, -- \eta - [0x1D703] = { xoffset = -0.1, width = 0.85, italic = 0 }, -- \theta - [0x1D717] = { xoffset = -0.075, width = 0.85, italic = 0, anchor = 1.03 }, -- \vartheta - [0x1D704] = { xoffset = -0.1, width = 0.9, italic = 0, anchor = 1.05 }, -- \iota - [0x1D705] = { xoffset = -0.075, width = 0.85, italic = 0 }, -- \kappa - [0x1D706] = { xoffset = -0.075, width = 0.85, italic = 0, anchor = 1.05 }, -- \lambda - [0x1D707] = { xoffset = -0.075, width = 0.85, italic = 0, anchor = 1.03 }, -- \mu - [0x1D708] = { xoffset = -0.075, width = 0.85, italic = 0, anchor = 1.03 }, -- \nu - [0x1D709] = { xoffset = -0.075, width = 0.85, italic = 0 }, -- \xi - [0x1D70A] = { xoffset = -0.075, width = 0.85, italic = 0, anchor = 1.03 }, -- \omicron - [0x1D70B] = { xoffset = -0.075, width = 0.85, italic = 0 }, -- \pi - [0x1D71B] = { xoffset = -0.07, width = 0.85, italic = 0 }, -- \varpi - [0x1D70C] = { xoffset = -0.075, width = 0.85, italic = 0 }, -- \rho - [0x1D71A] = { xoffset = -0.075, width = 0.85, italic = 0 }, -- \varrho - [0x1D70D] = { xoffset = -0.075, width = 0.85, italic = 0, anchor = 1.02 }, -- \varsigma - [0x1D70E] = { xoffset = -0.075, width = 0.85, italic = 0 }, -- \sigma - [0x1D70F] = { xoffset = -0.08, width = 0.85, italic = 0, anchor = 1.05 }, -- \tau - [0x1D710] = { xoffset = -0.08, width = 0.85, italic = 0, anchor = 1.03 }, -- \upsilon - [0x1D719] = { xoffset = -0.075, width = 0.85, italic = 0 }, -- \phi - [0x1D711] = { xoffset = -0.075, width = 0.85, italic = 0, anchor = 1.02 }, -- \varphi - [0x1D712] = { xoffset = -0.075, width = 0.85, italic = 0 }, -- \chi - [0x1D713] = { xoffset = -0.075, width = 0.85, italic = 0 }, -- \psi - [0x1D714] = { xoffset = -0.05, width = 0.875, italic = 0 }, -- \omega - -- [0x1D718] = { xoffset = -0.075, width = 0.85, italic = 0, anchor = 1.03 }, -- \varkappa - [0x1D719] = { xoffset = -0.075, width = 0.85, italic = 0 }, -- \phi - [0x1D41B] = { xoffset = 0, width = 1, italic = 0, anchor = 1.5 }, -- bold lowercase upright b - [0x1D41D] = { xoffset = 0, width = 1, italic = 0, anchor = 0.6 }, -- bold lowercase upright d - [0x1D41F] = { xoffset = 0, width = 1.25, italic = 0, anchor = 0.8 }, -- bold lowercase upright f - [0x1D420] = { xoffset = 0, width = 1, italic = 0, anchor = 0.6 }, -- bold lowercase upright g - [0x1D421] = { xoffset = 0, width = 1, italic = 0, anchor = 1.5 }, -- bold lowercase upright h - [0x1D424] = { xoffset = 0, width = 1, italic = 0, anchor = 1.5 }, -- bold lowercase upright k - [0x1D425] = { xoffset = 0, width = 1, italic = 0, anchor = 0.75 }, -- bold lowercase upright l - [0x1D42A] = { xoffset = 0, width = 1, italic = 0, anchor = 0.9 }, -- bold lowercase upright q - [0x1D42B] = { xoffset = 0, width = 1, italic = 0, anchor = 0.9 }, -- bold lowercase upright r - [0x1D42C] = { xoffset = 0, width = 1, italic = 0, anchor = 0.9 }, -- bold lowercase upright s - -- [0x1D482] = { xoffset = 0, width = 1, italic = 0, anchor = 0.9 }, -- bold lowercase italic a - -- [0x1D483] = { xoffset = 0, width = 1, italic = 0, anchor = 1.1 }, -- bold lowercase italic b - -- [0x1D484] = { xoffset = 0, width = 1, italic = 0, anchor = 0.95 }, -- bold lowercase italic c - -- [0x1D485] = { xoffset = 0, width = 1, italic = 0, anchor = 0.75 }, -- bold lowercase italic d - -- [0x1D486] = { xoffset = 0, width = 1, italic = 0, anchor = 0.95 }, -- bold lowercase italic e - -- [0x1D487] = { xoffset = 0, width = 1, italic = 0, anchor = 0.95 }, -- bold lowercase italic f - -- [0x1D488] = { xoffset = 0, width = 1, italic = 0, anchor = 0.9 }, -- bold lowercase italic g - -- [0x1D489] = { xoffset = 0, width = 1, italic = 0, anchor = 1.2 }, -- bold lowercase italic h - -- [0x1D48A] = { xoffset = 0, width = 1, italic = 0, anchor = 0.6 }, -- bold lowercase italic i - -- [0x1D48B] = { xoffset = 0, width = 1, italic = 0, anchor = 0.8 }, -- bold lowercase italic j - -- [0x1D48C] = { xoffset = 0, width = 1, italic = 0, anchor = 1.2 }, -- bold lowercase italic k - -- [0x1D48D] = { xoffset = 0, width = 1, italic = 0, anchor = 0.9 }, -- bold lowercase italic l - -- [0x1D492] = { xoffset = 0, width = 1, italic = 0, anchor = 0.85 }, -- bold lowercase italic q - -- [0x1D493] = { xoffset = 0, width = 1, italic = 0, anchor = 0.9 }, -- bold lowercase italic r - -- [0x1D497] = { xoffset = 0, width = 1, italic = 0, anchor = 0.9 }, -- bold lowercase italic v - -- [0x1D499] = { xoffset = 0, width = 1.1, italic = 0, anchor = 0.9 }, -- bold lowercase italic x - -- [0x1D49A] = { xoffset = 0, width = 1, italic = 0, anchor = 0.95 }, -- bold lowercase italic y - -- [0x1D49B] = { xoffset = 0, width = 1, italic = 0, anchor = 1.1 }, -- bold lowercase italic z - [0x1D743] = { xoffset = 0, width = 1, italic = 0, anchor = 1.7 }, -- bold lowercase italic greek xi - [0x1D435] = { anchor = 1.05 }, -- italic B - [0x1D436] = { xoffset = -0.1, anchor = 0.7 }, -- italic C - [0x1D437] = { anchor = 1.25 }, -- italic D - [0x1D43A] = { anchor = 0.8 }, -- italic G - [0x1D442] = { anchor = 0.85 }, -- italic O - [0x1D443] = { anchor = 1.1 }, -- italic P - [0x1D444] = { anchor = 0.85 }, -- italic Q - [0x1D445] = { xoffset = -0.025, width = 1.05, anchor = 1.05 }, -- italic R - [0x1D446] = { xoffset = -0.05, anchor = 0.85 }, -- italic S - [0x1D447] = { xoffset = -0.05, width = 1.05, italic = 0.7, anchor = 0.9, }, -- italic T - [0x1D448] = { xoffset = -0.125, italic = 0.3, anchor = 0.9, }, -- italic U - [0x1D449] = { xoffset = -0.125, italic = 0.3, anchor = 0.9, }, -- italic V - [0x1D44A] = { xoffset = -0.075, italic = 0.3, anchor = 0.9, }, -- italic W - [0x1D44C] = { xoffset = -0.075, width = 1.1, italic = 0.35, anchor = 0.9, }, -- italic Y - ["lowercasefraktur"] = { width = 1.25, extend = 1.25, @@ -195,71 +151,28 @@ return { { tweak = "kerns", list = { - [0x2F] = { - topleft = -0.2, - bottomright = -0.2, - }, - ["0x2F.variants.*"] = { - topleft = -0.2, - bottomright = -0.2, - }, - -- [0x28] = { -- left parenthesis. No! - -- topleft = -0.1, - -- bottomleft = -0.1, - -- }, - -- [0x29] = { -- right parenthesis. No! - -- topright = -0.1, - -- bottomright = -0.1, - -- all = true, - -- }, - [0x7D] = { - topright = -0.05, - bottomright = -0.05, - }, -- right brace variants - ["0x7D.variants.*"] = { - topright = -0.05, - bottomright = -0.05, - }, -- right brace variants - ["0x7D.parts.top"] = { - topright = -0.15, - }, -- right brace top - ["0x7D.parts.bottom"] = { - bottomright = -0.15, - }, -- right brace bottom - [0x29] = { - topright = -0.1, - bottomright = -0.1, - }, -- right parenthesis variants - ["0x29.variants.*"] = { - topright = -0.1, - bottomright = -0.1, - }, -- right parenthesis variants - ["0x29.parts.top"] = { - topright = -0.15, - }, -- right parenthesis top - ["0x29.parts.bottom"] = { - bottomright = -0.15, - }, -- right parenthesis bottom - -- radical - [0x221A] = { - topright = 0.2, - bottomright = 0.2, - }, - ["0x221A.variants.*"] = { - topright = 0.2, - bottomright = 0.2, - }, - ["0x221A.parts.top"] = { - topright = 0.2, - }, - ["0x221A.parts.bottom"] = { - bottomright = 0.2, - }, - -- angle - [0x27E9] = { topright = -0.1, bottomright = -0.1 }, - ["0x27E9.variants.*"] = { topright = -0.2, bottomright = -0.2 }, - [0x27EB] = { topright = -0.1, bottomright = -0.1 }, - ["0x27EB.variants.*"] = { topright = -0.2, bottomright = -0.2 }, + [0x002F] = { topleft = -0.2, bottomright = -0.2 }, + ["0x002F.variants.*"] = { topleft = -0.2, bottomright = -0.2 }, + -- No! + -- [0x0028] = { topleft = -0.1, bottomleft = -0.1 }, -- left parenthesis + -- [0x0029] = { topright = -0.1, bottomright = -0.1, all = true }, -- right parenthesis + -- + [0x007D] = { topright = -0.05, bottomright = -0.05 }, -- right brace variants + ["0x7D.variants.*"] = { topright = -0.05, bottomright = -0.05 }, -- right brace variants + ["0x7D.parts.top"] = { topright = -0.15, }, -- right brace top + ["0x7D.parts.bottom"] = { bottomright = -0.15 }, -- right brace bottom + [0x0029] = { topright = -0.15, bottomright = -0.15 }, -- right parenthesis variants + ["0x29.variants.*"] = { topright = -0.15, bottomright = -0.15 }, -- right parenthesis variants + ["0x29.parts.top"] = { topright = -0.15, }, -- right parenthesis top + ["0x29.parts.bottom"] = { bottomright = -0.15 }, -- right parenthesis bottom -- radical + [0x221A] = { topright = 0.2, bottomright = 0.2 }, + ["0x221A.variants.*"] = { topright = 0.2, bottomright = 0.2 }, + ["0x221A.parts.top"] = { topright = 0.2, }, + ["0x221A.parts.bottom"] = { bottomright = 0.2 }, + [0x27E9] = { topright = -0.1, bottomright = -0.1 }, -- angle + ["0x27E9.variants.*"] = { topright = -0.2, bottomright = -0.2 }, + [0x27EB] = { topright = -0.1, bottomright = -0.1 }, + ["0x27EB.variants.*"] = { topright = -0.2, bottomright = -0.2 }, -- [0x222B] = integral_variants, ["0x222B.variants.*"] = integral_variants, ["0x222B.parts.top"] = integral_top, ["0x222B.parts.bottom"] = integral_bottom, [0x222C] = integral_variants, ["0x222C.variants.*"] = integral_variants, ["0x222C.parts.top"] = integral_top, ["0x222C.parts.bottom"] = integral_bottom, @@ -270,10 +183,8 @@ return { [0x2231] = integral_variants, ["0x2231.variants.*"] = integral_variants, ["0x2231.parts.top"] = integral_top, ["0x2231.parts.bottom"] = integral_bottom, [0x2232] = integral_variants, ["0x2232.variants.*"] = integral_variants, ["0x2232.parts.top"] = integral_top, ["0x2232.parts.bottom"] = integral_bottom, [0x2233] = integral_variants, ["0x2233.variants.*"] = integral_variants, ["0x2233.parts.top"] = integral_top, ["0x2233.parts.bottom"] = integral_bottom, - }, }, - -- Accents are a mess. We migrate the extensibles from the combiners to the base accent -- and then need to tweak the width (which is auto set because it was zero with a large -- accent anchor offset). First we copy and fix. @@ -321,183 +232,143 @@ return { tweak = "copyaccents", }, -- So far for the accents. - { - -- For upright alphabets, we unset the anchor. - -- This means that accents are placed - -- centered over the character. - -- Should be on top - tweak = "wipeanchors", - list = { - "digitsbold", - "digitsdoublestruck", - "digitsmonospace", - "digitsnormal", - "digitssansserifbold", - "digitssansserifnormal", - "lowercasebold", - "lowercaseboldfraktur", - "lowercasedoublestruck", - "lowercasefraktur", - "lowercasegreekbold", - "lowercasegreeknormal", - "lowercasegreeksansserifbold", - "lowercasemonospace", - "lowercasenormal", - "lowercasesansserifbold", - "lowercasesansserifnormal", - "uppercasebold", - "uppercaseboldfraktur", - "uppercasedoublestruck", - "uppercasefraktur", - "uppercasegreekbold", - "uppercasegreeknormal", - "uppercasegreeksansserifbold", - "uppercasemonospace", - "uppercasenormal", - "uppercasesansserifbold", - "uppercasesansserifnormal", - }, - }, - { - -- For non-italic alphabets we remove italic correction. - tweak = "wipeitalics", - list = { - "digitsbold", - "digitsdoublestruck", - "digitsmonospace", - "digitsnormal", - "digitssansserifbold", - "digitssansserifnormal", - "lowercasebold", - "lowercaseboldfraktur", - "lowercasedoublestruck", - "lowercasefraktur", - "lowercasemonospace", - -- "lowercasenormal", - "lowercasesansserifbold", - -- "lowercasesansserifnormal", - "lowercasegreeknormal", - "uppercasebold", - "uppercaseboldfraktur", - "uppercasedoublestruck", - "uppercasefraktur", - "uppercasegreekbold", - "uppercasegreeknormal", - "uppercasegreeksansserifbold", - "uppercasemonospace", - "uppercasesansserifbold", - "uppercasesanserifnormal", -- some remain + -- For upright alphabets, we unset the anchor. This means that accents are placed + -- centered over the character. Should be on top. + tweak = "wipeanchors", + list = { + "digitsbold", + "digitsdoublestruck", + "digitsmonospace", + "digitsnormal", + "digitssansserifbold", + "digitssansserifnormal", + "lowercasebold", + "lowercaseboldfraktur", + "lowercasedoublestruck", + "lowercasefraktur", + "lowercasegreekbold", + "lowercasegreeknormal", + "lowercasegreeksansserifbold", + "lowercasemonospace", +-- "lowercasenormal", + "lowercasesansserifbold", + "lowercasesansserifnormal", + "uppercasebold", + "uppercaseboldfraktur", + "uppercasedoublestruck", + "uppercasefraktur", + "uppercasegreekbold", + "uppercasegreeknormal", + "uppercasegreeksansserifbold", + "uppercasemonospace", + "uppercasenormal", + "uppercasesansserifbold", + "uppercasesansserifnormal", }, - }, - { - -- This one fakes margins to get larger/smaller accents - -- with for example \widetilde. + }, + { + -- This one fakes margins to get larger/smaller accents with for example the + -- \widetilde. tweak = "margins", list = { - [0x1D7DC] = { left = -.1, right = -.1 }, -- doublestruck 4 - - [0x1D712] = { left = -.1, right = -.1 }, -- italic chi - [0x1D713] = { left = -.1, right = -.1 }, -- italic psi - [0x1D714] = { left = -.1, right = -.1 }, -- italic omega - - [0x003B1] = { left = -.1, right = -.1 }, -- upfight alpha - [0x003B3] = { left = -.1, right = -.1 }, -- upfight gamma - [0x003BA] = { left = -.1, right = -.1 }, -- upfight kappa - [0x003BC] = { left = -.1, right = -.1 }, -- upfight mu - [0x003C0] = { left = -.1, right = -.1 }, -- upfight pi - [0x003C3] = { left = -.1, right = -.1 }, -- upfight sigma - [0x003C5] = { left = -.1, right = -.1 }, -- upfight upsilon - [0x003C6] = { left = -.1, right = -.1 }, -- upfight phi - [0x003C8] = { left = -.1, right = -.1 }, -- upfight psi - [0x003C9] = { left = -.1, right = -.1 }, -- upfight omega + [0x1D7DC] = { left = -.1, right = -.1 }, -- doublestruck 4 + + [0x1D712] = { left = -.1, right = -.1 }, -- italic chi + [0x1D713] = { left = -.1, right = -.1 }, -- italic psi + [0x1D714] = { left = -.1, right = -.1 }, -- italic omega + + [0x003B1] = { left = -.1, right = -.1 }, -- upfight alpha + [0x003B3] = { left = -.1, right = -.1 }, -- upfight gamma + [0x003BA] = { left = -.1, right = -.1 }, -- upfight kappa + [0x003BC] = { left = -.1, right = -.1 }, -- upfight mu + [0x003C0] = { left = -.1, right = -.1 }, -- upfight pi + [0x003C3] = { left = -.1, right = -.1 }, -- upfight sigma + [0x003C5] = { left = -.1, right = -.1 }, -- upfight upsilon + [0x003C6] = { left = -.1, right = -.1 }, -- upfight phi + [0x003C8] = { left = -.1, right = -.1 }, -- upfight psi + [0x003C9] = { left = -.1, right = -.1 }, -- upfight omega -- Greek lowercase sans (bold, italic) can be improved - [0x1D451] = { left = -.1, right = -.1 }, -- italic d - [0x1D453] = { left = -.1, right = -.1 }, -- italic f + [0x1D451] = { left = -.1, right = -.1 }, -- italic d + [0x1D453] = { left = -.1, right = -.1 }, -- italic f - [0x00394] = { left = .1, right = .1 }, -- upfight Delta - [0x003A3] = { left = .1, right = .1 }, -- upfight Sigma + [0x00394] = { left = .1, right = .1 }, -- upfight Delta + [0x003A3] = { left = .1, right = .1 }, -- upfight Sigma - -- [0x0004A] = { left = .1, right = .1 }, -- J - [0x00046] = { left = .1, right = .1 }, -- F - [0x0004C] = { left = .1, right = .1 }, -- L - [0x00050] = { left = .1, right = .1 }, -- P - [0x00053] = { left = .1, right = .1 }, -- S - [0x00054] = { left = .1, right = .1 }, -- T - [0x0005A] = { left = .1, right = .1 }, -- Z + -- [0x0004A] = { left = .1, right = .1 }, -- J + [0x00046] = { left = .1, right = .1 }, -- F + [0x0004C] = { left = .1, right = .1 }, -- L + [0x00050] = { left = .1, right = .1 }, -- P + [0x00053] = { left = .1, right = .1 }, -- S + [0x00054] = { left = .1, right = .1 }, -- T + [0x0005A] = { left = .1, right = .1 }, -- Z [0x1D43D] = { left = -.1, right = -.1 }, -- italic J -- [0x1D448] = { left = -.05, right = -.05 }, -- italic U -- [0x1D449] = { left = -.05, right = -.05 }, -- italic V [0x1D44B] = { left = -.05, right = -.05 }, -- italic X - -- [0x1D487] = { left = -.2, right = -.2 }, -- bold italic f - -- [0x1D489] = { left = -.2, right = -.2 }, -- bold italic h - -- [0x1D496] = { left = -.1, right = -.1 }, -- bold italic u - -- [0x1D499] = { left = -.1, right = -.1 }, -- bold italic x - - -- [0x1D711] = { left = -.1, right = -.1 }, -- italic varphi - -- [0x1D713] = { left = -.1, right = -.1 }, -- italic psi - - -- [0x1D659] = { left = -.1, right = -.1 }, -- sans bold italic d - -- [0x1D65C] = { left = -.1, right = -.1 }, -- sans bold italic g - - -- [0x1D409] = { left = .1, right = .1 }, -- bold upright J - -- [0x1D412] = { left = .1, right = .1 }, -- bold upright S - - -- [0x1D509] = { left = .1, right = .1 }, -- fraktur F - -- [0x1D50C] = { left = .1, right = .1 }, -- fraktur I - -- [0x1D50D] = { left = .1, right = .1 }, -- fraktur J - -- [0x1D51D] = { left = .1, right = .1 }, -- fraktur Z - - -- [0x1D538] = { left = .1, right = .1 }, -- doublestruck A - -- [0x1D539] = { left = .1, right = .1 }, -- doublestruck B - -- [0x1D53C] = { left = .1, right = .1 }, -- doublestruck E - -- [0x1D53D] = { left = .1, right = .1 }, -- doublestruck F - -- [0x1D541] = { left = .1, right = .1 }, -- doublestruck J - -- [0x1D542] = { left = .1, right = .1 }, -- doublestruck K - -- [0x1D543] = { left = .1, right = .1 }, -- doublestruck L - -- [0x1D547] = { left = .1, right = .1 }, -- doublestruck P - -- [0x1D549] = { left = .1, right = .1 }, -- doublestruck R - -- [0x1D54A] = { left = .1, right = .1 }, -- doublestruck S - -- [0x1D54B] = { left = .1, right = .1 }, -- doublestruck T - -- [0x1D54D] = { left = .1, right = .1 }, -- doublestruck V - -- [0x1D550] = { left = .1, right = .1 }, -- doublestruck Y - - -- [0x1D506] = { left = .1, right = .1 }, -- fraktur C - - -- [0x00393] = { left = .1, right = .1 }, -- upfight Gamma - -- [0x00396] = { left = .1, right = .1 }, -- upfight Zeta - - -- [0x1D5D8] = { left = .1, right = .1 }, -- sans bold E - -- [0x1D5D9] = { left = .1, right = .1 }, -- sans bold F - -- [0x1D5DD] = { left = .2, right = .2 }, -- sans bold J -- nope - -- [0x1D5DF] = { left = .1, right = .1 }, -- sans bold L - -- [0x1D5E6] = { left = .1, right = .1 }, -- sans bold S - - -- [0x1D61A] = { left = .1, right = .1 }, -- sans italic S - - -- [0x1D5A2] = { left = .1, right = .1 }, -- sans C - -- [0x1D5A4] = { left = .1, right = .1 }, -- sans E - -- [0x1D5A5] = { left = .1, right = .1 }, -- sans F - -- [0x1D5AB] = { left = .1, right = .1 }, -- sans L -- nope - -- [0x1D5AF] = { left = .1, right = .1 }, -- sans P - -- [0x1D5B2] = { left = .1, right = .1 }, -- sans S - -- [0x1D5B9] = { left = .1, right = .1 }, -- sans Z - - -- [0x1D4A0] = { left = .1, right = .1 }, -- script E - -- [0x1D4AE] = { left = .1, right = .1 }, -- script S - -- [0x1D4B4] = { left = .1, right = .1 }, -- script Y + -- [0x1D487] = { left = -.2, right = -.2 }, -- bold italic f + -- [0x1D489] = { left = -.2, right = -.2 }, -- bold italic h + -- [0x1D496] = { left = -.1, right = -.1 }, -- bold italic u + -- [0x1D499] = { left = -.1, right = -.1 }, -- bold italic x + + -- [0x1D711] = { left = -.1, right = -.1 }, -- italic varphi + -- [0x1D713] = { left = -.1, right = -.1 }, -- italic psi + + -- [0x1D659] = { left = -.1, right = -.1 }, -- sans bold italic d + -- [0x1D65C] = { left = -.1, right = -.1 }, -- sans bold italic g + + -- [0x1D409] = { left = .1, right = .1 }, -- bold upright J + -- [0x1D412] = { left = .1, right = .1 }, -- bold upright S + + -- [0x1D509] = { left = .1, right = .1 }, -- fraktur F + -- [0x1D50C] = { left = .1, right = .1 }, -- fraktur I + -- [0x1D50D] = { left = .1, right = .1 }, -- fraktur J + -- [0x1D51D] = { left = .1, right = .1 }, -- fraktur Z + + -- [0x1D538] = { left = .1, right = .1 }, -- doublestruck A + -- [0x1D539] = { left = .1, right = .1 }, -- doublestruck B + -- [0x1D53C] = { left = .1, right = .1 }, -- doublestruck E + -- [0x1D53D] = { left = .1, right = .1 }, -- doublestruck F + -- [0x1D541] = { left = .1, right = .1 }, -- doublestruck J + -- [0x1D542] = { left = .1, right = .1 }, -- doublestruck K + -- [0x1D543] = { left = .1, right = .1 }, -- doublestruck L + -- [0x1D547] = { left = .1, right = .1 }, -- doublestruck P + -- [0x1D549] = { left = .1, right = .1 }, -- doublestruck R + -- [0x1D54A] = { left = .1, right = .1 }, -- doublestruck S + -- [0x1D54B] = { left = .1, right = .1 }, -- doublestruck T + -- [0x1D54D] = { left = .1, right = .1 }, -- doublestruck V + -- [0x1D550] = { left = .1, right = .1 }, -- doublestruck Y + + -- [0x1D506] = { left = .1, right = .1 }, -- fraktur C + + -- [0x00393] = { left = .1, right = .1 }, -- upfight Gamma + -- [0x00396] = { left = .1, right = .1 }, -- upfight Zeta + + -- [0x1D5D8] = { left = .1, right = .1 }, -- sans bold E + -- [0x1D5D9] = { left = .1, right = .1 }, -- sans bold F + -- [0x1D5DD] = { left = .2, right = .2 }, -- sans bold J -- nope + -- [0x1D5DF] = { left = .1, right = .1 }, -- sans bold L + -- [0x1D5E6] = { left = .1, right = .1 }, -- sans bold S + + -- [0x1D61A] = { left = .1, right = .1 }, -- sans italic S + + -- [0x1D5A2] = { left = .1, right = .1 }, -- sans C + -- [0x1D5A4] = { left = .1, right = .1 }, -- sans E + -- [0x1D5A5] = { left = .1, right = .1 }, -- sans F + -- [0x1D5AB] = { left = .1, right = .1 }, -- sans L -- nope + -- [0x1D5AF] = { left = .1, right = .1 }, -- sans P + -- [0x1D5B2] = { left = .1, right = .1 }, -- sans S + -- [0x1D5B9] = { left = .1, right = .1 }, -- sans Z + + -- [0x1D4A0] = { left = .1, right = .1 }, -- script E + -- [0x1D4AE] = { left = .1, right = .1 }, -- script S + -- [0x1D4B4] = { left = .1, right = .1 }, -- script Y }, }, - { - tweak = "fixprimes", - -- scale = 0.8, - -- smaller = true, - factor = 1,--1.1 - }, { tweak = "addprivates", -- list = { @@ -531,6 +402,9 @@ return { list = { [0x3D] = { squeeze = .85, yoffset = .0975 } } }, { + -- Do we need these in the future? + -- Maybe a more general setup? + -- Maybe "reset llx" tweak = "kernpairs", list = { [mathematics.tweaks.subsets.acenorsuvxz] = { @@ -565,27 +439,23 @@ return { [0x1D45F] = { -- r [0x1D460] = -.1, -- s }, --- [mathematics.tweaks.subsets.acenorsuvxz] = { --- [mathematics.tweaks.subsets.acenorsuvxz] = 2, --- }, --- [0x1D452] = { --- [0x1D453] = -.05, --- [0x1D465] = -.3, --- }, --- [0x1D453] = { --- [0x1D453] = -.1, --- [0x1D454] = -.1, --- [0x1D465] = -.3, --- }, --- [0x1D465] = { --- [0x1D465] = .1, --- } - } + -- [mathematics.tweaks.subsets.acenorsuvxz] = { + -- [mathematics.tweaks.subsets.acenorsuvxz] = 2, + -- }, + -- [0x1D452] = { + -- [0x1D453] = -.05, + -- [0x1D465] = -.3, + -- }, + -- [0x1D453] = { + -- [0x1D453] = -.1, + -- [0x1D454] = -.1, + -- [0x1D465] = -.3, + -- }, + -- [0x1D465] = { + -- [0x1D465] = .1, + -- } + } }, - -- { - -- tweak = "fixanchors", - -- factor = .5, - -- }, { tweak = "addbars", advance = 0.275, @@ -619,3 +489,124 @@ return { -- \alpha is looking like an italic a. The one from Dejavu could perhaps be an alternative? -- No hvariants in 772 + + + + +-- From the dimension tweak: +-- [0x00393] = { xoffset = -0.05, width = 0.875, italic = 0 }, -- \Gamma +-- [0x00394] = { xoffset = -0.05, width = 0.875, italic = 0 }, -- \Delta +-- [0x00398] = { xoffset = -0.05, width = 0.9, italic = 0 }, -- \Theta +-- [0x0039B] = { xoffset = -0.075, width = 0.85, italic = 0 }, -- \Lambda +-- [0x0039E] = { xoffset = -0.075, width = 0.85, italic = 0 }, -- \Xi +-- [0x003A0] = { xoffset = -0.075, width = 0.85, italic = 0 }, -- \Pi +-- [0x003A3] = { xoffset = -0.075, width = 0.85, italic = 0 }, -- \Sigma +-- [0x003A5] = { xoffset = -0.075, width = 0.85, italic = 0 }, -- \Upsilon +-- [0x003A6] = { xoffset = -0.05, width = 0.9, italic = 0 }, -- \Phi +-- [0x003A8] = { xoffset = -0.05, width = 0.9, italic = 0 }, -- \Psi +-- [0x003A9] = { xoffset = -0.05, width = 0.9, italic = 0 }, -- \Omega +-- [0x02202] = { xoffset = -0.075, width = 0.825, italic = 0 }, -- \partial +-- [0x1D43A] = { xoffset = -0.1, width = 1, italic = 0 }, -- G +-- [0x1D442] = { xoffset = -0.1, width = 1, italic = 0 }, -- O +-- [0x1D444] = { xoffset = -0.05, width = 1.025, italic = 0 }, -- Q +-- -- [0x1D44E] = { xoffset = -0.05, width = 1.1, italic = 0, anchor = 0.8 }, -- a +-- -- [0x1D44F] = { xoffset = -0.05, width = 1.1, italic = 0 }, -- b +-- -- [0x1D450] = { xoffset = -0.05, width = 1.1, italic = 0, anchor = 0.9 }, -- c +-- -- [0x1D451] = { xoffset = -0.05, width = 1.1, italic = 0, anchor = 0.75 }, -- d +-- -- [0x1D452] = { xoffset = -0.05, width = 1.1, italic = 0, anchor = 0.9 }, -- e +-- -- [0x1D453] = { xoffset = 0.45, width = 1.9, italic = 0.45, anchor = 1.1 }, -- f +-- -- [0x1D454] = { xoffset = 0.05, width = 1.1, italic = 0, anchor = 0.9 }, -- g +-- -- [0x0210E] = { xoffset = -0.1, width = 1.05, italic = 0, anchor = 1.15 }, -- h +-- -- [0x1D456] = { xoffset = -0.2, width = 1.1, italic = 0 }, -- i +-- -- [0x1D457] = { xoffset = 0.6, width = 1.7, italic = 0.45 }, -- j +-- -- [0x1D458] = { xoffset = -0.05, width = 1.1, italic = 0, anchor = 1.15 }, -- k +-- -- [0x1D459] = { xoffset = -0.15, width = 1.1, italic = 0, anchor = 0.8 }, -- l +-- -- [0x1D45A] = { xoffset = -0.05, width = 1, italic = 0 }, -- m +-- -- [0x1D45B] = { xoffset = -0.1, width = 1, italic = 0, anchor = 0.9 }, -- n +-- -- [0x1D45C] = { xoffset = -0.05, width = 1.1, italic = 0, anchor = 0.9 }, -- o +-- -- [0x1D45D] = { width = 1.05, italic = 0 }, -- p +-- -- [0x1D45E] = { xoffset = -0.05, width = 1.05, italic = 0, anchor = 0.9 }, -- q +-- -- [0x1D45F] = { xoffset = -0.1, width = 1.15, italic = 0, anchor = 0.9 }, -- r +-- -- [0x1D460] = { xoffset = -0.05, width = 1.05, italic = 0 }, -- s +-- -- [0x1D461] = { xoffset = -0.15, width = 1.2, italic = 0, anchor = 0.9 }, -- t +-- -- [0x1D462] = { xoffset = -0.1, width = 1.05, italic = 0, anchor = 0.85 }, -- u +-- -- [0x1D463] = { xoffset = -0.1, width = 1.05, italic = 0, anchor = 0.85 }, -- v +-- -- [0x1D464] = { xoffset = -0.05, width = 1.05, italic = 0, anchor = 0.95 }, -- w +-- -- [0x1D465] = { width = 1.175, italic = 0, anchor = 0.9 }, -- x +-- -- [0x1D466] = { xoffset = -0.05, width = 1.05, italic = 0 }, -- y +-- -- [0x1D467] = { xoffset = -0.05, width = 1.1, italic = 0, anchor = 0.9 }, -- z +-- [0x1D6FC] = { xoffset = -0.075, width = 0.825, italic = 0 }, -- \alpha +-- [0x1D6FD] = { width = 0.9, italic = 0, anchor = 1.05 }, -- \beta +-- [0x1D6FE] = { xoffset = -0.075, width = 0.85, italic = 0.05, anchor = 1.05 }, -- \gamma +-- [0x1D6FF] = { xoffset = -0.1, width = 0.85, italic = 0 }, -- \delta +-- [0x1D716] = { xoffset = -0.1, width = 0.85, italic = 0 }, -- \epsilon +-- [0x1D700] = { xoffset = -0.1, width = 0.85, italic = 0 }, -- \varepsilon +-- [0x1D701] = { xoffset = -0.1, width = 0.85, italic = 0 }, -- \zeta +-- [0x1D702] = { xoffset = -0.1, width = 0.85, italic = 0, anchor = 1.05 }, -- \eta +-- [0x1D703] = { xoffset = -0.1, width = 0.85, italic = 0 }, -- \theta +-- [0x1D717] = { xoffset = -0.075, width = 0.85, italic = 0, anchor = 1.03 }, -- \vartheta +-- [0x1D704] = { xoffset = -0.1, width = 0.9, italic = 0, anchor = 1.05 }, -- \iota +-- [0x1D705] = { xoffset = -0.075, width = 0.85, italic = 0 }, -- \kappa +-- [0x1D706] = { xoffset = -0.075, width = 0.85, italic = 0, anchor = 1.05 }, -- \lambda +-- [0x1D707] = { xoffset = -0.075, width = 0.85, italic = 0, anchor = 1.03 }, -- \mu +-- [0x1D708] = { xoffset = -0.075, width = 0.85, italic = 0, anchor = 1.03 }, -- \nu +-- [0x1D709] = { xoffset = -0.075, width = 0.85, italic = 0 }, -- \xi +-- [0x1D70A] = { xoffset = -0.075, width = 0.85, italic = 0, anchor = 1.03 }, -- \omicron +-- [0x1D70B] = { xoffset = -0.075, width = 0.85, italic = 0 }, -- \pi +-- [0x1D71B] = { xoffset = -0.07, width = 0.85, italic = 0 }, -- \varpi +-- [0x1D70C] = { xoffset = -0.075, width = 0.85, italic = 0 }, -- \rho +-- [0x1D71A] = { xoffset = -0.075, width = 0.85, italic = 0 }, -- \varrho +-- [0x1D70D] = { xoffset = -0.075, width = 0.85, italic = 0, anchor = 1.02 }, -- \varsigma +-- [0x1D70E] = { xoffset = -0.075, width = 0.85, italic = 0 }, -- \sigma +-- [0x1D70F] = { xoffset = -0.08, width = 0.85, italic = 0, anchor = 1.05 }, -- \tau +-- [0x1D710] = { xoffset = -0.08, width = 0.85, italic = 0, anchor = 1.03 }, -- \upsilon +-- [0x1D719] = { xoffset = -0.075, width = 0.85, italic = 0 }, -- \phi +-- [0x1D711] = { xoffset = -0.075, width = 0.85, italic = 0, anchor = 1.02 }, -- \varphi +-- [0x1D712] = { xoffset = -0.075, width = 0.85, italic = 0 }, -- \chi +-- [0x1D713] = { xoffset = -0.075, width = 0.85, italic = 0 }, -- \psi +-- [0x1D714] = { xoffset = -0.05, width = 0.875, italic = 0 }, -- \omega +-- -- [0x1D718] = { xoffset = -0.075, width = 0.85, italic = 0, anchor = 1.03 }, -- \varkappa +-- [0x1D719] = { xoffset = -0.075, width = 0.85, italic = 0 }, -- \phi +-- [0x1D41B] = { width = 1, italic = 0, anchor = 1.5 }, -- bold lowercase upright b +-- [0x1D41D] = { width = 1, italic = 0, anchor = 0.6 }, -- bold lowercase upright d +-- [0x1D41F] = { width = 1.25, italic = 0, anchor = 0.8 }, -- bold lowercase upright f +-- [0x1D420] = { width = 1, italic = 0, anchor = 0.6 }, -- bold lowercase upright g +-- [0x1D421] = { width = 1, italic = 0, anchor = 1.5 }, -- bold lowercase upright h +-- [0x1D424] = { width = 1, italic = 0, anchor = 1.5 }, -- bold lowercase upright k +-- [0x1D425] = { width = 1, italic = 0, anchor = 0.75 }, -- bold lowercase upright l +-- [0x1D42A] = { width = 1, italic = 0, anchor = 0.9 }, -- bold lowercase upright q +-- [0x1D42B] = { width = 1, italic = 0, anchor = 0.9 }, -- bold lowercase upright r +-- [0x1D42C] = { width = 1, italic = 0, anchor = 0.9 }, -- bold lowercase upright s +-- -- [0x1D482] = { width = 1, italic = 0, anchor = 0.9 }, -- bold lowercase italic a +-- -- [0x1D483] = { width = 1, italic = 0, anchor = 1.1 }, -- bold lowercase italic b +-- -- [0x1D484] = { width = 1, italic = 0, anchor = 0.95 }, -- bold lowercase italic c +-- -- [0x1D485] = { width = 1, italic = 0, anchor = 0.75 }, -- bold lowercase italic d +-- -- [0x1D486] = { width = 1, italic = 0, anchor = 0.95 }, -- bold lowercase italic e +-- -- [0x1D487] = { width = 1, italic = 0, anchor = 0.95 }, -- bold lowercase italic f +-- -- [0x1D488] = { width = 1, italic = 0, anchor = 0.9 }, -- bold lowercase italic g +-- -- [0x1D489] = { width = 1, italic = 0, anchor = 1.2 }, -- bold lowercase italic h +-- -- [0x1D48A] = { width = 1, italic = 0, anchor = 0.6 }, -- bold lowercase italic i +-- -- [0x1D48B] = { width = 1, italic = 0, anchor = 0.8 }, -- bold lowercase italic j +-- -- [0x1D48C] = { width = 1, italic = 0, anchor = 1.2 }, -- bold lowercase italic k +-- -- [0x1D48D] = { width = 1, italic = 0, anchor = 0.9 }, -- bold lowercase italic l +-- -- [0x1D492] = { width = 1, italic = 0, anchor = 0.85 }, -- bold lowercase italic q +-- -- [0x1D493] = { width = 1, italic = 0, anchor = 0.9 }, -- bold lowercase italic r +-- -- [0x1D497] = { width = 1, italic = 0, anchor = 0.9 }, -- bold lowercase italic v +-- -- [0x1D499] = { width = 1.1, italic = 0, anchor = 0.9 }, -- bold lowercase italic x +-- -- [0x1D49A] = { width = 1, italic = 0, anchor = 0.95 }, -- bold lowercase italic y +-- -- [0x1D49B] = { width = 1, italic = 0, anchor = 1.1 }, -- bold lowercase italic z +-- [0x1D743] = { width = 1, italic = 0, anchor = 1.7 }, -- bold lowercase italic greek xi +-- -- [0x1D435] = { anchor = 1.05 }, -- italic B +-- -- [0x1D436] = { xoffset = -0.1, anchor = 0.7 }, -- italic C +-- -- [0x1D437] = { anchor = 1.25 }, -- italic D +-- -- [0x1D43A] = { anchor = 0.8 }, -- italic G +-- -- [0x1D442] = { anchor = 0.85 }, -- italic O +-- -- [0x1D443] = { anchor = 1.1 }, -- italic P +-- -- [0x1D444] = { anchor = 0.85 }, -- italic Q +-- -- [0x1D445] = { xoffset = -0.025, width = 1.05, anchor = 1.05 }, -- italic R +-- -- [0x1D446] = { xoffset = -0.05, anchor = 0.85 }, -- italic S +-- -- [0x1D447] = { xoffset = -0.05, width = 1.05, italic = 0.7, anchor = 0.9, }, -- italic T +-- -- [0x1D448] = { xoffset = -0.125, italic = 0.3, anchor = 0.9, }, -- italic U +-- -- [0x1D449] = { xoffset = -0.125, italic = 0.3, anchor = 0.9, }, -- italic V +-- -- [0x1D44A] = { xoffset = -0.075, italic = 0.3, anchor = 0.9, }, -- italic W +-- -- [0x1D44C] = { xoffset = -0.075, width = 1.1, italic = 0.35, anchor = 0.9, }, -- italic Y diff --git a/tex/context/fonts/mkiv/cambria-math.lfg b/tex/context/fonts/mkiv/cambria-math.lfg index 2207c0645..8f9cf73b9 100644 --- a/tex/context/fonts/mkiv/cambria-math.lfg +++ b/tex/context/fonts/mkiv/cambria-math.lfg @@ -46,11 +46,14 @@ end -- local integral_top = { topright = 0.05 } -- local integral_bottom = { bottomright = -0.30 } +local common = fonts.goodies.load("common-math.lfg") +local presets = common.mathematics.tweaks.presets + return { name = "cambria-math", version = "1.00", comment = "Goodies that complement cambria.", - author = "Hans Hagen", + author = "Hans Hagen & Mikael Sundqvist", copyright = "ConTeXt development team", mathematics = { parameters = { @@ -72,38 +75,16 @@ return { tweaks = { aftercopying = { { - tweak = "dimensions", - list = { - - -- [0x00060] = { yoffset = -0.1 }, -- grave - -- [0x000B4] = { yoffset = -0.1 }, -- acute - -- [0x002C6] = { yoffset = -0.1 }, -- hat - -- [0x002DC] = { yoffset = -0.1 }, -- tilde - -- [0x000AF] = { yoffset = -0.1 }, -- bar - -- [0x002D8] = { yoffset = -0.15 }, -- breve - -- [0x002D9] = { yoffset = -0.15 }, -- dot - -- [0x000A8] = { yoffset = -0.1 }, -- ddot - -- [0x020DB] = { yoffset = -0.05 }, -- dddot - -- [0x002C7] = { yoffset = -0.1 }, -- check - -- [0x020D7] = { yoffset = -0.05 }, -- vec - - -- [0x00300] = { yoffset = -0.12, all=true }, -- widegrave - -- [0x00301] = { yoffset = -0.12, all=true }, -- wideacute - -- [0x00302] = { yoffset = -0.12, all=true }, -- widehat - -- [0x00303] = { yoffset = -0.12, all=true }, -- widetilde - -- [0x00304] = { yoffset = -0.12, all=true }, -- widebar - -- [0x00306] = { yoffset = -0.12, all=true }, -- widebreve - -- [0x00307] = { yoffset = -0.025, all=true }, -- widedot - -- [0x00308] = { yoffset = -0.025, all=true }, -- wideddot - -- [0x020DB] = { yoffset = -0.1, all=true }, -- widedddot - -- [0x0030A] = { yoffset = -0.12, all=true }, -- widering - -- [0x0030C] = { yoffset = -0.12, all=true }, -- widecheck - - [0x1D43D] = { xoffset = 0.25, width = 1.15, italic = 0.2 }, -- J - [0x1D487] = { anchor = 0.8 }, -- bold lower case italic f - -- [0x1D487] = { xoffset = 0, width = 1, italic = 0, anchor = 1.3 }, -- bold lower case italic f - - }, + tweak = "addmirrors", + }, + presets.matheulercalligraphic { rscale = 0.97 }, + presets.mathrsfscript { rscale = 0.97 }, + presets.mathxitsarabic { rscale = 0.95 }, + { + tweak = "simplifykerns", + }, + presets.moveitalics { + correct = true }, { tweak = "kerns", @@ -264,3 +245,40 @@ return { kernpairs = kernpairs, }, } + + +-- Old + -- { + -- tweak = "dimensions", + -- list = { + + -- -- [0x00060] = { yoffset = -0.1 }, -- grave + -- -- [0x000B4] = { yoffset = -0.1 }, -- acute + -- -- [0x002C6] = { yoffset = -0.1 }, -- hat + -- -- [0x002DC] = { yoffset = -0.1 }, -- tilde + -- -- [0x000AF] = { yoffset = -0.1 }, -- bar + -- -- [0x002D8] = { yoffset = -0.15 }, -- breve + -- -- [0x002D9] = { yoffset = -0.15 }, -- dot + -- -- [0x000A8] = { yoffset = -0.1 }, -- ddot + -- -- [0x020DB] = { yoffset = -0.05 }, -- dddot + -- -- [0x002C7] = { yoffset = -0.1 }, -- check + -- -- [0x020D7] = { yoffset = -0.05 }, -- vec + + -- -- [0x00300] = { yoffset = -0.12, all=true }, -- widegrave + -- -- [0x00301] = { yoffset = -0.12, all=true }, -- wideacute + -- -- [0x00302] = { yoffset = -0.12, all=true }, -- widehat + -- -- [0x00303] = { yoffset = -0.12, all=true }, -- widetilde + -- -- [0x00304] = { yoffset = -0.12, all=true }, -- widebar + -- -- [0x00306] = { yoffset = -0.12, all=true }, -- widebreve + -- -- [0x00307] = { yoffset = -0.025, all=true }, -- widedot + -- -- [0x00308] = { yoffset = -0.025, all=true }, -- wideddot + -- -- [0x020DB] = { yoffset = -0.1, all=true }, -- widedddot + -- -- [0x0030A] = { yoffset = -0.12, all=true }, -- widering + -- -- [0x0030C] = { yoffset = -0.12, all=true }, -- widecheck + + -- [0x1D43D] = { xoffset = 0.25, width = 1.15, italic = 0.2 }, -- J + -- [0x1D487] = { anchor = 0.8 }, -- bold lower case italic f + -- -- [0x1D487] = { xoffset = 0, width = 1, italic = 0, anchor = 1.3 }, -- bold lower case italic f + + -- }, + -- }, diff --git a/tex/context/fonts/mkiv/common-math.lfg b/tex/context/fonts/mkiv/common-math.lfg new file mode 100644 index 000000000..d97511e76 --- /dev/null +++ b/tex/context/fonts/mkiv/common-math.lfg @@ -0,0 +1,106 @@ +return { + name = "common-math", + version = "1.00", + comment = "Goodies that complement pagella.", + author = "Hans Hagen & Mikael Sundqvist", + copyright = "ConTeXt development team", + mathematics = { + tweaks = { + presets = { + matheulercalligraphic = function(parameters) + return { + tweak = "replacealphabets", + feature = "matheulercalligraphic", + list = { + { + source = "uppercasescript", + target = "uppercasecalligraphic", + filename = "euler.otf", + rscale = parameters.rscale, + }, + { + source = "uppercaseboldscript", + target = "uppercaseboldcalligraphic", + filename = "euler.otf", + rscale = parameters.rscale, + }, + }, + } + end, + mathrsfscript = function(parameters) + return { + tweak = "replacealphabets", + feature = "mathrsfscript", + list = { + { + source = "uppercasescript", + target = "uppercasescript", + filename = "ralphsmithsformalscript-companion.otf", + rscale = parameters.rscale, + feature = "ss01", + }, + { + source = "uppercaseboldscript", + target = "uppercaseboldscript", + filename = "ralphsmithsformalscript-companion.otf", + rscale = parameters.rscale, + feature = "ss01", + }, + }, + } + end, + mathxitsarabic = function(parameters) + return { + tweak = "replacealphabets", + feature = "mathxitsarabic", + list = { + { + source = "arabicmathematicalalphabeticsymbols", + target = "arabicmathematicalalphabeticsymbols", + filename = "xitsmath-companion.otf", + rscale = parameters.rscale, + }, + { + source = "digitsarabicindic", + target = "digitsarabicindic", + filename = "xitsmath-companion.otf", + rscale = parameters.rscale, + }, + { + source = "digitsextendedarabicindic", + target = "digitsextendedarabicindic", + filename = "xitsmath-companion.otf", + rscale = parameters.rscale, + }, + }, + } + end, + moveitalics = function(parameters) + return { + tweak = "moveitalics", + correct = parameters.correct, + list = { + "lowercasenormal", + "lowercaseitalic", + "lowercasebold", + "lowercasebolditalic", + "lowercasegreeknormal", + "lowercasegreekitalic", + "lowercasegreekbold", + "lowercasegreekbolditalic", + "uppercasenormal", + "uppercaseitalic", + "uppercasebold", + "uppercasebolditalic", + "uppercasegreeknormal", + "uppercasegreekitalic", + "uppercasegreekbold", + "uppercasegreekbolditalic", + mathematics.tweaks.subsets.dotless, + } + } + end, + }, + }, + }, +} diff --git a/tex/context/fonts/mkiv/concrete-math.lfg b/tex/context/fonts/mkiv/concrete-math.lfg index ff55d353d..fd2d5caad 100644 --- a/tex/context/fonts/mkiv/concrete-math.lfg +++ b/tex/context/fonts/mkiv/concrete-math.lfg @@ -1,10 +1,13 @@ -- this file might go away and is for experiments only +local common = fonts.goodies.load("common-math.lfg") +local presets = common.mathematics.tweaks.presets + return { name = "concrete-math", version = "1.00", comment = "Goodies that complement concrete math.", - author = "Hans Hagen", + author = "Hans Hagen & Mikael Sundqvist", copyright = "ConTeXt development team", mathematics = { parameters = { @@ -16,20 +19,21 @@ return { }, tweaks = { aftercopying = { - -- { - -- tweak = "fixprimes", - -- factor = 0.9, - -- }, { - tweak = "kerns", - list = { - [0x2F] = { - topleft = -0.2, - -- bottomleft = 0, - -- topright = 0, - bottomright = -0.2, - }, + tweak = "fixprimes", + factor = 0.9, }, + -- there are circular variants +-- { +-- tweak = "addmirrors", +-- }, +-- presets.matheulercalligraphic { rscale = 0.97 }, +-- presets.mathrsfscript { rscale = 0.95 }, + { + tweak = "kerns", + list = { + [0x002F] = { topleft = -0.2, bottomright = -0.2 }, + }, }, { tweak = "fixellipses", @@ -44,10 +48,12 @@ return { { tweak = "addequals", }, - - + { + tweak = "setoptions", + set = { "ignorekerndimensions" } }, }, + }, bigslots = { 1, 2, 3, 4 }, diff --git a/tex/context/fonts/mkiv/dejavu-math.lfg b/tex/context/fonts/mkiv/dejavu-math.lfg index c2e909aef..d18082b85 100644 --- a/tex/context/fonts/mkiv/dejavu-math.lfg +++ b/tex/context/fonts/mkiv/dejavu-math.lfg @@ -10,11 +10,11 @@ local dimensions, kerns if CONTEXTLMTXMODE == 0 then end --- When set this will bypass the italic correction hackery! local integral_variants = { bottomright = -0.20 } --- local integral_top = { topright = 0.05 } local integral_bottom = { bottomright = -0.25 } +local common = fonts.goodies.load("common-math.lfg") +local presets = common.mathematics.tweaks.presets return { name = "dejavu-math", @@ -27,78 +27,55 @@ return { NoLimitSupFactor = 0, NoLimitSubFactor = 900, FractionRuleThickness = 60, - AccentTopShiftUp = -25, - FlattenedAccentTopShiftUp = -25, - -- AccentExtendMargin = 50, + AccentTopShiftUp = -25, + FlattenedAccentTopShiftUp = -25, + -- AccentExtendMargin = 50, AccentBaseDepth = 30, RadicalDegreeBottomRaisePercent = 62, - RadicalRuleThickness = 46, -- 52 in font + RadicalRuleThickness = 46, -- 52 in font DelimiterPercent = 90, DelimiterShortfall = 400, DisplayOperatorMinHeight = 1800, -- 1333 in font - -- PrimeRaisePercent = 50, -- 50 default - PrimeRaiseComposedPercent = 10, -- 25 default + -- PrimeRaisePercent = 50, -- 50 default + PrimeRaiseComposedPercent = 10, -- 25 default }, tweaks = { aftercopying = { { tweak = "version", expected = "Version 1.106", + }, + { + tweak = "fixprimes", + scale = 0.85, + -- smaller = true, + factor = 1, }, { - tweak = "dimensions", - list = { - [0x1D44E] = { xoffset = 0, width = 1, italic = 0, anchor = 0.9 }, -- a - -- [0x1D449] = { xoffset = 0, width = .8, italic = .2 }, - -- [0x1D44A] = { xoffset = 0, width = .8, italic = .2 }, - ["0x1D449:0x1D44A"] = { xoffset = 0, width = .8, italic = .2 }, - } + tweak = "addmirrors", }, + presets.matheulercalligraphic { rscale = 1.02 }, + presets.mathrsfscript { rscale = 1.02 }, + presets.mathxitsarabic { rscale = 1.05 }, + presets.moveitalics { correct = true }, { tweak = "kerns", list = { - [0x2F] = { - topleft = -0.2, - -- bottomleft = 0, - -- topright = 0, - bottomright = -0.2, - }, - ["0x7D.parts.top"] = { - topright = -0.15, - }, -- right brace top - ["0x7D.parts.bottom"] = { - bottomright = -0.15, - }, -- right brace bottom - ["0x7D.variants.*"] = { - topright = -0.05, - bottomright = -0.05, - }, -- right brace variants - ["0x29.parts.top"] = { - topright = -0.15, - }, -- right parenthesis top - ["0x29.parts.bottom"] = { - bottomright = -0.15, - }, -- right parenthesis bottom - ["0x29.variants.*"] = { - topright = -0.1, - bottomright = -0.1, - }, -- right parenthesis variants - ["0x221A.parts.top"] = { - topright = 0.2, - }, -- right radical top - ["0x221A.parts.bottom"] = { - bottomright = 0.2, - }, -- right radical bottom - ["0x221A.variants.*"] = { - topright = 0.2, - bottomright = 0.2, - }, -- right radical variants - -- angle - [0x27E9] = { topright = -0.1, bottomright = -0.1 }, - ["0x27E9.variants.*"] = { topright = -0.2, bottomright = -0.2 }, - [0x27EB] = { topright = -0.1, bottomright = -0.1 }, - ["0x27EB.variants.*"] = { topright = -0.2, bottomright = -0.2 }, - + [0x002F] = { topleft = -0.2, bottomright = -0.2 }, + ["0x7D.parts.top"] = { topright = -0.15, }, -- right brace top + ["0x7D.parts.bottom"] = { bottomright = -0.15 }, -- right brace bottom + ["0x7D.variants.*"] = { topright = -0.05, bottomright = -0.05 }, -- right brace variants + ["0x29.parts.top"] = { topright = -0.15, }, -- right parenthesis top + ["0x29.parts.bottom"] = { bottomright = -0.15 }, -- right parenthesis bottom + ["0x29.variants.*"] = { topright = -0.1, bottomright = -0.1 }, -- right parenthesis variants + ["0x221A.parts.top"] = { topright = 0.2, }, -- right radical top + ["0x221A.parts.bottom"] = { bottomright = 0.2 }, -- right radical bottom + ["0x221A.variants.*"] = { topright = 0.2, bottomright = 0.2 }, -- right radical variants + [0x27E9] = { topright = -0.1, bottomright = -0.1 }, -- angle + ["0x27E9.variants.*"] = { topright = -0.2, bottomright = -0.2 }, + [0x27EB] = { topright = -0.1, bottomright = -0.1 }, + ["0x27EB.variants.*"] = { topright = -0.2, bottomright = -0.2 }, + -- ["0x222B.variants.*"] = integral_variants, ["0x222B.parts.top"] = integral_top, ["0x222B.parts.bottom"] = integral_bottom, ["0x222C.variants.*"] = integral_variants, ["0x222C.parts.top"] = integral_top, ["0x222C.parts.bottom"] = integral_bottom, ["0x222D.variants.*"] = integral_variants, ["0x222D.parts.top"] = integral_top, ["0x222D.parts.bottom"] = integral_bottom, @@ -125,9 +102,9 @@ return { { tweak = "dimensions", list = { - [0x00302] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widehat - [0x00303] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widetilde - [0x00306] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widebreve + [0x00302] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widehat + [0x00303] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widetilde + [0x00306] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widebreve [0x0030C] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widecheck }, }, @@ -136,20 +113,18 @@ return { { tweak = "dimensions", list = { - -- here we want to apply to all - -- [0x00300] = { yoffset = -0.02, height = .95, all = true }, -- widegrave : 0x0060 - -- [0x00301] = { yoffset = -0.02, height = .95, all = true }, -- wideacute : 0x00B4 - -- [0x00302] = { yoffset = -0.03, height = .95, all = true }, -- widehat : 0x02C6 - -- [0x00303] = { yoffset = -0.02, height = .95, all = true }, -- widetilde : 0x02DC - -- [0x00306] = { yoffset = -0.03, height = .95, all = true }, -- widebre : 0x02D8 - -- [0x0030A] = { yoffset = 0.00, height = .95, all = true }, -- widering : 0x02DA - -- [0x0030C] = { yoffset = -0.03, height = .95, all = true }, -- widecheck : 0x02C7 - - -- [0x00304] = { yoffset = -0.05, height = .95, all = true }, -- widebar : 0x00AF - - -- [0x00307] = { yoffset = -0.03, height = .95, all = true }, -- widedot : 0x02D9 - -- [0x00308] = { yoffset = -0.03, height = .95, all = true }, -- wideddot : 0x00A8 - [0x020DB] = { yoffset = 0.015, height = .95, all = true }, -- widedddot : 0x20DB (self) + -- here we want to apply to all + -- [0x00300] = { yoffset = -0.02, height = .95, all = true }, -- widegrave : 0x0060 + -- [0x00301] = { yoffset = -0.02, height = .95, all = true }, -- wideacute : 0x00B4 + -- [0x00302] = { yoffset = -0.03, height = .95, all = true }, -- widehat : 0x02C6 + -- [0x00303] = { yoffset = -0.02, height = .95, all = true }, -- widetilde : 0x02DC + -- [0x00306] = { yoffset = -0.03, height = .95, all = true }, -- widebre : 0x02D8 + -- [0x0030A] = { yoffset = 0.00, height = .95, all = true }, -- widering : 0x02DA + -- [0x0030C] = { yoffset = -0.03, height = .95, all = true }, -- widecheck : 0x02C7 + -- [0x00304] = { yoffset = -0.05, height = .95, all = true }, -- widebar : 0x00AF + -- [0x00307] = { yoffset = -0.03, height = .95, all = true }, -- widedot : 0x02D9 + -- [0x00308] = { yoffset = -0.03, height = .95, all = true }, -- wideddot : 0x00A8 + [0x020DB] = { yoffset = 0.015, height = .95, all = true }, -- widedddot : 0x20DB (self) }, }, -- We now copy these to the not wide slots so that we can set these to stretch as well, @@ -157,12 +132,10 @@ return { { tweak = "copyaccents", }, - -- So far for the accents. - { tweak = "fixprimes", - -- scale = 0.9, - -- smaller = true, + -- scale = 0.9, + -- smaller = true, factor = 0.8, }, { @@ -191,7 +164,7 @@ return { tweak = "addequals", }, { - tweak = "addfourier", + tweak = "addfourier", variant = 1, }, }, @@ -209,3 +182,16 @@ return { kerns = kerns, }, } + + + +-- Old + -- { + -- tweak = "dimensions", + -- list = { + -- [0x1D44E] = { width = 1, italic = 0, anchor = 0.9 }, -- a + -- -- [0x1D449] = { width = .8, italic = .2 }, + -- -- [0x1D44A] = { width = .8, italic = .2 }, + -- ["0x1D449:0x1D44A"] = { width = .8, italic = .2 }, + -- } + -- }, diff --git a/tex/context/fonts/mkiv/erewhon-math.lfg b/tex/context/fonts/mkiv/erewhon-math.lfg index 71ff64648..fe8bb7108 100644 --- a/tex/context/fonts/mkiv/erewhon-math.lfg +++ b/tex/context/fonts/mkiv/erewhon-math.lfg @@ -1,10 +1,13 @@ -- This file might go away and is for experiments only. +local common = fonts.goodies.load("common-math.lfg") +local presets = common.mathematics.tweaks.presets + return { name = "erewhon-math", version = "1.00", comment = "Goodies that complement erewhon math.", - author = "Hans Hagen", + author = "Hans Hagen & Mikael Sundqvist", copyright = "ConTeXt development team", mathematics = { parameters = { @@ -21,60 +24,36 @@ return { }, tweaks = { aftercopying = { - { - tweak = "kerns", - list = { - [0x2F] = { - topleft = -0.15, - -- bottomleft = 0, - -- topright = 0, - bottomright = -0.15, - }, - - ["0x7D.parts.top"] = { - topright = -0.15, - }, -- right brace top - ["0x7D.parts.bottom"] = { - bottomright = -0.15, - }, -- right brace bottom - ["0x7D.variants.*"] = { - topright = -0.05, - bottomright = -0.05, - }, -- right brace variants - ["0x29.parts.top"] = { - topright = -0.1, - }, -- right parenthesis top - ["0x29.parts.bottom"] = { - bottomright = -0.1, - }, -- right parenthesis bottom - ["0x29.variants.*"] = { - topright = -0.1, - bottomright = -0.1, - }, -- right parenthesis variants - ["0x221A.parts.top"] = { - topright = 0.2, - }, -- right radical top - ["0x221A.parts.bottom"] = { - bottomright = 0.2, - }, -- right radical bottom - ["0x221A.variants.*"] = { - topright = 0.2, - bottomright = 0.2, - }, -- right radical variants - - -- angle - [0x27E9] = { topright = -0.1, bottomright = -0.1 }, - ["0x27E9.variants.*"] = { topright = -0.2, bottomright = -0.2 }, - [0x27EB] = { topright = -0.1, bottomright = -0.1 }, - ["0x27EB.variants.*"] = { topright = -0.2, bottomright = -0.2 }, - - }, - }, { tweak = "fixprimes", factor = 0.9, scale = 0.9, }, + { + tweak = "addmirrors", + }, + presets.matheulercalligraphic { rscale = 0.93 }, + presets.mathrsfscript { rscale = 0.93 }, + presets.mathxitsarabic { rscale = 0.90 }, + { + tweak = "kerns", + list = { + [0x002F] = { topleft = -0.15, bottomright = -0.15 }, + ["0x7D.parts.top"] = { topright = -0.15, }, -- right brace top + ["0x7D.parts.bottom"] = { bottomright = -0.15 }, -- right brace bottom + ["0x7D.variants.*"] = { topright = -0.05, bottomright = -0.05 }, -- right brace variants + ["0x29.parts.top"] = { topright = -0.1, }, -- right parenthesis top + ["0x29.parts.bottom"] = { bottomright = -0.1 }, -- right parenthesis bottom + ["0x29.variants.*"] = { topright = -0.1, bottomright = -0.1 }, -- right parenthesis variants + ["0x221A.parts.top"] = { topright = 0.2, }, -- right radical top + ["0x221A.parts.bottom"] = { bottomright = 0.2 }, -- right radical bottom + ["0x221A.variants.*"] = { topright = 0.2, bottomright = 0.2 }, -- right radical variants + [0x27E9] = { topright = -0.1, bottomright = -0.1 }, -- angle + ["0x27E9.variants.*"] = { topright = -0.2, bottomright = -0.2 }, + [0x27EB] = { topright = -0.1, bottomright = -0.1 }, + ["0x27EB.variants.*"] = { topright = -0.2, bottomright = -0.2 }, + }, + }, { tweak = "checkspacing", }, @@ -93,6 +72,10 @@ return { { tweak = "addequals", }, + { + tweak = "setoptions", + set = { "ignorekerndimensions" } + }, }, }, bigslots = { diff --git a/tex/context/fonts/mkiv/garamond-math.lfg b/tex/context/fonts/mkiv/garamond-math.lfg index 7c1e7ab22..a0a0700f5 100644 --- a/tex/context/fonts/mkiv/garamond-math.lfg +++ b/tex/context/fonts/mkiv/garamond-math.lfg @@ -1,3 +1,6 @@ +local common = fonts.goodies.load("common-math.lfg") +local presets = common.mathematics.tweaks.presets + return { name = "ebgaramond", version = "1.00", @@ -11,17 +14,17 @@ return { FractionRuleThickness = 60, OverbarRuleThickness = 60, UnderbarRuleThickness = 60, - AccentTopShiftUp = -75, - FlattenedAccentTopShiftUp = -75, - -- AccentExtendMargin = 50, + AccentTopShiftUp = -75, + FlattenedAccentTopShiftUp = -75, + -- AccentExtendMargin = 50, -- AccentBaseHeight = 0, AccentBaseDepth = 75, - -- RadicalRuleThickness = 50, -- 50 in font + -- RadicalRuleThickness = 50, -- 50 in font DelimiterPercent = 90, DelimiterShortfall = 400, -- DisplayOperatorMinHeight = 1800, -- 1300 in font (only one) - PrimeRaisePercent = 85, -- 50 default - -- PrimeRaiseComposedPercent = 25, -- 25 default + PrimeRaisePercent = 85, -- 50 default + -- PrimeRaiseComposedPercent = 25, -- 25 default }, tweaks = { aftercopying = { @@ -29,123 +32,118 @@ return { tweak = "version", expected = "Version 2019-08-16", }, + { + tweak = "fixprimes", + scale = 0.95, + -- smaller = true, + factor = 0.95, + -- fake = 0.75, + }, + { + tweak = "addmirrors", + }, + presets.matheulercalligraphic { rscale = 0.95 }, + presets.mathrsfscript { rscale = 0.95 }, + presets.mathxitsarabic { rscale = 0.80 }, + { + tweak = "oldstylemath", + factor = 0, + }, + { + tweak = "simplifykerns", + }, + presets.moveitalics { + correct = true + }, + { + tweak = "topanchors", + list = { + [0x1D453] = 0.88, -- italic f + }, + }, + { + tweak = "limits", + factor = 1.5, + list = mathematics.tweaks.subsets.integrals, + }, { tweak = "dimensions", list = { - -- offset width italic - -- -- [0x00060] = { yoffset = -0.1 }, -- grave - -- -- [0x000B4] = { yoffset = -0.1 }, -- acute - -- [0x002C6] = { yoffset = -0.1 }, -- hat - -- [0x002DC] = { yoffset = -0.1 }, -- tilde - -- -- [0x000AF] = { yoffset = -0.1 }, -- bar - -- [0x002D8] = { yoffset = -0.15 }, -- breve - -- [0x002D9] = { yoffset = -0.15 }, -- dot - -- -- [0x000A8] = { yoffset = -0.1 }, -- ddot - -- [0x020DB] = { yoffset = -0.115 }, -- dddot - -- [0x002C7] = { yoffset = -0.1 }, -- check - -- [0x020D7] = { yoffset = -0.1 }, -- vec - - -- [0x00300] = { yoffset = -0.12 , all = true }, -- widegrave - -- [0x00301] = { yoffset = -0.12 , all = true }, -- wideacute - -- [0x00302] = { yoffset = -0.12 , all = true }, -- widehat - -- [0x00303] = { yoffset = -0.12 , all = true }, -- widetilde - -- [0x00304] = { yoffset = -0.12 , all = true }, -- widebar - -- [0x00306] = { yoffset = -0.12 , all = true }, -- widebreve - -- [0x00307] = { yoffset = -0.12 , all = true }, -- widedot - -- [0x00308] = { yoffset = -0.12 , all = true }, -- wideddot - -- -- [0x020DB] = { yoffset = -0.1 , all = true }, -- widedddot - -- [0x0030A] = { yoffset = -0.12 , all = true }, -- widering - -- [0x0030C] = { yoffset = -0.12 , all = true }, -- widecheck - - -- [0x002C6] = { scale =.85, yoffset = .1, width = .85, height = .935 }, -- hat - - [0x00393] = { xoffset = 0.05, width = 1.05, italic = 0.075 }, -- \Gamma - -- [0x003A6] = { xoffset = 0.05, width = 1.05, italic = 0 }, -- \Phi difficult! - [0x003A8] = { xoffset = 0.05, width = 1.05, italic = 0.075 }, -- \Psi - [0x02113] = { xoffset = 0, width = 1, italic = 0.075 }, -- \ell - [0x1D436] = { xoffset = 0, width = 1, italic = 0.05 }, -- C - [0x1D43D] = { xoffset = 0.3, width = 1.4, italic = 0.1 }, -- J - [0x1D44B] = { xoffset = 0, width = 1, italic = 0.05 }, -- X - [0x1D44F] = { xoffset = 0, width = 1, italic = 0, 1.25 }, -- b - [0x1D450] = { xoffset = 0, width = 1.1, italic = 0 }, -- c - [0x1D451] = { xoffset = 0, width = 1, italic = 0.05, 0.8 }, -- d - [0x1D452] = { xoffset = 0, width = 1.1, italic = 0.05 }, -- e - [0x1D453] = { xoffset = 0.15, width = 1.15, italic = 0.1, 1.2 }, -- f - [0x1D454] = { xoffset = 0.1, width = 1.2, italic = 0.1 }, -- g - [0x0210E] = { xoffset = 0, width = 1.1, italic = 0, 1.4 }, -- h - [0x1D457] = { xoffset = 0.2, width = 1.25, italic = 0.05 }, -- j - [0x1D458] = { xoffset = 0, width = 1, italic = 0, 1.25 }, -- k - [0x1D459] = { xoffset = 0, width = 1, italic = 0.05 }, -- l - [0x1D45D] = { xoffset = 0.15, width = 1.15, italic = 0, 1.4 }, -- p - [0x1D45E] = { xoffset = 0, width = 1.05, italic = 0 }, -- q - [0x1D45F] = { xoffset = 0, width = 1.05, italic = 0 }, -- r - [0x1D461] = { xoffset = 0, width = 1, italic = 0.1 }, -- t - [0x1D465] = { xoffset = 0.05, width = 1.1, italic = 0.05 }, -- x - [0x1D466] = { xoffset = 0.2, width = 1.2, italic = 0, 1.35 }, -- y - [0x1D6FD] = { xoffset = 0.05, width = 1.1, italic = 0.05 }, -- \beta - [0x1D6FE] = { xoffset = 0, width = 1.05, italic = 0 }, -- \gamma - [0x1D6FF] = { xoffset = 0, width = 1, italic = 0.1 }, -- \delta - [0x1D716] = { xoffset = 0, width = 1.1, italic = 0 }, -- \epsilon - [0x1D700] = { xoffset = 0, width = 1.1, italic = 0 }, -- \varepsilon - [0x1D701] = { xoffset = 0, width = 1, italic = 0.15 }, -- \zeta - [0x1D703] = { xoffset = 0, width = 1, italic = 0.1 }, -- \theta - [0x1D705] = { xoffset = 0, width = 1, italic = 0.1 }, -- \kappa - [0x1D706] = { xoffset = 0.05, width = 1.1, italic = 0 }, -- \lambda - [0x1D707] = { xoffset = 0.05, width = 1.05, italic = 0 }, -- \mu - [0x1D708] = { xoffset = 0, width = 1.1, italic = 0 }, -- \nu - [0x1D709] = { xoffset = 0, width = 1.1, italic = 0 }, -- \xi - [0x1D70B] = { xoffset = 0, width = 1.05, italic = 0 }, -- \pi - [0x1D70C] = { xoffset = 0.2, width = 1.2, italic = 0 }, -- \rho - [0x1D70E] = { xoffset = 0, width = 1, italic = 0.1 }, -- \sigma - [0x1D70F] = { xoffset = 0.05, width = 1.05, italic = 0.1 }, -- \tau - [0x1D712] = { xoffset = 0.15, width = 1.2, italic = 0.05 }, -- \chi - [0x1D713] = { xoffset = 0.05, width = 1.05, italic = 0.05 }, -- \psi + -- for older entries, see bottom of file + [0x1D453] = { width = 1.1, }, -- italic f }, }, { tweak = "kerns", list = { - [0x2F] = { - topleft = -0.2, - -- bottomleft = 0, - -- topright = 0, - bottomright = -0.2, - }, - ["0x7D.parts.top"] = { - topright = -0.15, - }, -- right brace top - ["0x7D.parts.bottom"] = { - bottomright = -0.15, - }, -- right brace bottom - ["0x7D.variants.*"] = { - topright = -0.05, - bottomright = -0.05, - }, -- right brace variants - ["0x29.parts.top"] = { - topright = -0.25, - }, -- right parenthesis top - ["0x29.parts.bottom"] = { - bottomright = -0.25, - }, -- right parenthesis bottom - ["0x29.variants.*"] = { - topright = -0.2, - bottomright = -0.2, - }, -- right parenthesis variants - ["0x221A.parts.top"] = { - topright = 0.2, - }, -- right radical top - ["0x221A.parts.bottom"] = { - bottomright = 0.2, - }, -- right radical bottom - ["0x221A.variants.*"] = { - topright = 0.2, - bottomright = 0.2, - }, -- right radical variants - -- angle - [0x27E9] = { topright = -0.1, bottomright = -0.1 }, - ["0x27E9.variants.*"] = { topright = -0.2, bottomright = -0.2 }, - [0x27EB] = { topright = -0.1, bottomright = -0.1 }, - ["0x27EB.variants.*"] = { topright = -0.2, bottomright = -0.2 }, + [0x002F] = { topleft = -0.2, bottomright = -0.2 }, + ["0x7D.parts.top"] = { topright = -0.15, }, -- right brace top + ["0x7D.parts.bottom"] = { bottomright = -0.15 }, -- right brace bottom + ["0x7D.variants.*"] = { topright = -0.05, bottomright = -0.05 }, -- right brace variants + ["0x29.parts.top"] = { topright = -0.25, }, -- right parenthesis top + ["0x29.parts.bottom"] = { bottomright = -0.25 }, -- right parenthesis bottom + ["0x29.variants.*"] = { topright = -0.2, bottomright = -0.2 }, -- right parenthesis variants + ["0x221A.parts.top"] = { topright = 0.2, }, -- right radical top + ["0x221A.parts.bottom"] = { bottomright = 0.2 }, -- right radical bottom + ["0x221A.variants.*"] = { topright = 0.2, bottomright = 0.2 }, -- right radical variants -- angle + [0x27E9] = { topright = -0.1, bottomright = -0.1 }, + ["0x27E9.variants.*"] = { topright = -0.2, bottomright = -0.2 }, + [0x27EB] = { topright = -0.1, bottomright = -0.1 }, + ["0x27EB.variants.*"] = { topright = -0.2, bottomright = -0.2 }, + }, + }, + { + -- to be considered + -- tweak = "kernpairs", + list = { + [mathematics.tweaks.subsets.gjqy] = { + [mathematics.tweaks.subsets.f] = -.1, + [0x1D70C] = -.1, -- italic \rho + }, + [mathematics.tweaks.subsets.bhklt] = { + [mathematics.tweaks.subsets.f] = -.25, + [0x1D70C] = -.25, -- italic \rho + }, + [mathematics.tweaks.subsets.d] = { + [mathematics.tweaks.subsets.f] = -.25, + [0x1D70C] = -.25, -- italic \rho + }, + [mathematics.tweaks.subsets.f] = { + [mathematics.tweaks.subsets.f] = -.25, + [0x1D70C] = -.25, -- italic \rho + [mathematics.tweaks.subsets.gjqy] = -.25, + [mathematics.tweaks.subsets.bhklt] = -.1, + [mathematics.tweaks.subsets.d] = -.25, + [mathematics.tweaks.subsets.i] = -.25, + [mathematics.tweaks.subsets.mw] = -.25, + [mathematics.tweaks.subsets.p] = -.25, + [mathematics.tweaks.subsets.acenorsuvxz] = -.25, + [mathematics.tweaks.subsets.dotless] = -.25, + }, + [mathematics.tweaks.subsets.i] = { + [mathematics.tweaks.subsets.f] = -.25, + [0x1D70C] = -.25, -- italic \rho + }, + [mathematics.tweaks.subsets.mw] = { + [mathematics.tweaks.subsets.f] = -.25, + [0x1D70C] = -.25, -- italic \rho + }, + [mathematics.tweaks.subsets.p] = { + [mathematics.tweaks.subsets.f] = -.25, + [0x1D70C] = -.25, -- italic \rho + }, + [mathematics.tweaks.subsets.acenorsuvxz] = { + [mathematics.tweaks.subsets.f] = -.25, + [0x1D70C] = -.25, -- italic \rho + }, + [mathematics.tweaks.subsets.dotless] = { + [mathematics.tweaks.subsets.f] = -.25, + [0x1D70C] = -.25, -- italic \rho + }, + -- "uppercaseitalic" = { + -- [mathematics.tweaks.subsets.f] = -.25, + -- [0x1D70C] = -.25, -- italic \rho + -- }, }, }, -- Accents are a mess. We migrate the extensibles from the combiners to the base accent @@ -155,16 +153,16 @@ return { tweak = "extendaccents", }, { - tweak = "fixaccents", + tweak = "fixanchors", }, -- First we set the dimensions of the initial accent which started out as zero but we want -- a proper width. { tweak = "dimensions", list = { - -- [0x00302] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widehat - -- [0x00303] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widetilde - -- [0x00306] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widebreve + -- [0x00302] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widehat + -- [0x00303] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widetilde + -- [0x00306] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widebreve -- [0x0030C] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widecheck }, }, @@ -195,13 +193,37 @@ return { tweak = "copyaccents", }, -- So far for the accents. - { - tweak = "fixprimes", - scale = 0.9, - -- smaller = true, - factor = 0.9, - -- fake = 0.75, + -- For non-italic alphabets we remove italic correction. + -- This one is/will become obsolete + -- tweak = "wipeitalics", + list = { + "digitsbold", + "digitsdoublestruck", + "digitsmonospace", + "digitsnormal", + "digitssansserifbold", + "digitssansserifnormal", + -- "lowercasebold", + "lowercaseboldfraktur", + "lowercasedoublestruck", + "lowercasefraktur", + "lowercasemonospace", + -- "lowercasenormal", + "lowercasesansserifbold", + -- "lowercasesansserifnormal", + -- "lowercasegreeknormal", + -- "uppercasebold", + "uppercaseboldfraktur", + "uppercasedoublestruck", + "uppercasefraktur", + "uppercasegreekbold", + "uppercasegreeknormal", + "uppercasegreeksansserifbold", + "uppercasemonospace", + "uppercasesansserifbold", + "uppercasesanserifnormal", -- some remain + }, }, { tweak = "checkspacing", @@ -229,6 +251,9 @@ return { tweak = "addfourier", variant = 1, }, + { + tweak = "diagnose", + }, }, }, alternates = { @@ -248,3 +273,81 @@ return { } + + +-- Some old entries: + + -- { + -- tweak = "dimensions", + -- list = { + -- -- offset width italic + -- -- -- [0x00060] = { yoffset = -0.1 }, -- grave + -- -- -- [0x000B4] = { yoffset = -0.1 }, -- acute + -- -- [0x002C6] = { yoffset = -0.1 }, -- hat + -- -- [0x002DC] = { yoffset = -0.1 }, -- tilde + -- -- -- [0x000AF] = { yoffset = -0.1 }, -- bar + -- -- [0x002D8] = { yoffset = -0.15 }, -- breve + -- -- [0x002D9] = { yoffset = -0.15 }, -- dot + -- -- -- [0x000A8] = { yoffset = -0.1 }, -- ddot + -- -- [0x020DB] = { yoffset = -0.115 }, -- dddot + -- -- [0x002C7] = { yoffset = -0.1 }, -- check + -- -- [0x020D7] = { yoffset = -0.1 }, -- vec + + -- -- [0x00300] = { yoffset = -0.12 , all = true }, -- widegrave + -- -- [0x00301] = { yoffset = -0.12 , all = true }, -- wideacute + -- -- [0x00302] = { yoffset = -0.12 , all = true }, -- widehat + -- -- [0x00303] = { yoffset = -0.12 , all = true }, -- widetilde + -- -- [0x00304] = { yoffset = -0.12 , all = true }, -- widebar + -- -- [0x00306] = { yoffset = -0.12 , all = true }, -- widebreve + -- -- [0x00307] = { yoffset = -0.12 , all = true }, -- widedot + -- -- [0x00308] = { yoffset = -0.12 , all = true }, -- wideddot + -- -- -- [0x020DB] = { yoffset = -0.1 , all = true }, -- widedddot + -- -- [0x0030A] = { yoffset = -0.12 , all = true }, -- widering + -- -- [0x0030C] = { yoffset = -0.12 , all = true }, -- widecheck + + -- -- [0x002C6] = { scale =.85, yoffset = .1, width = .85, height = .935 }, -- hat + + -- [0x00393] = { xoffset = 0.05, width = 1.05, italic = 0.075 }, -- \Gamma + -- -- [0x003A6] = { xoffset = 0.05, width = 1.05, italic = 0 }, -- \Phi difficult! + -- [0x003A8] = { xoffset = 0.05, width = 1.05, italic = 0.075 }, -- \Psi + -- [0x02113] = { width = 1, italic = 0.075 }, -- \ell + -- [0x1D436] = { width = 1, italic = 0.05 }, -- C + -- [0x1D43D] = { xoffset = 0.3, width = 1.4, italic = 0.1 }, -- J + -- [0x1D44B] = { width = 1, italic = 0.05 }, -- X + -- [0x1D44F] = { width = 1, italic = 0, }, -- b + -- [0x1D450] = { width = 1.1, italic = 0 }, -- c + -- [0x1D451] = { width = 1, italic = 0.05, }, -- d + -- [0x1D452] = { width = 1.1, italic = 0.05 }, -- e + -- [0x00066] = { width = 1.4, italic = 0.0, }, -- f + -- [0x1D453] = { xoffset = 0.15, width = 1.15, italic = 0.1, }, -- f + -- [0x1D454] = { xoffset = 0.1, width = 1.2, italic = 0.1 }, -- g + -- [0x0210E] = { width = 1.1, italic = 0, }, -- h + -- [0x1D457] = { xoffset = 0.2, width = 1.25, italic = 0.05 }, -- j + -- [0x1D458] = { width = 1, italic = 0, }, -- k + -- [0x1D459] = { width = 1, italic = 0.05 }, -- l + -- [0x1D45D] = { xoffset = 0.15, width = 1.15, italic = 0, }, -- p + -- [0x1D45E] = { width = 1.05, italic = 0 }, -- q + -- [0x1D45F] = { width = 1.05, italic = 0 }, -- r + -- [0x1D461] = { width = 1, italic = 0.1 }, -- t + -- [0x1D465] = { xoffset = 0.05, width = 1.1, italic = 0.05 }, -- x + -- [0x1D466] = { xoffset = 0.2, width = 1.2, italic = 0, }, -- y + -- [0x1D6FD] = { xoffset = 0.05, width = 1.1, italic = 0.05 }, -- \beta + -- [0x1D6FE] = { width = 1.05, italic = 0 }, -- \gamma + -- [0x1D6FF] = { width = 1, italic = 0.1 }, -- \delta + -- [0x1D716] = { width = 1.1, italic = 0 }, -- \epsilon + -- [0x1D700] = { width = 1.1, italic = 0 }, -- \varepsilon + -- [0x1D701] = { width = 1, italic = 0.15 }, -- \zeta + -- [0x1D703] = { width = 1, italic = 0.1 }, -- \theta + -- [0x1D705] = { width = 1, italic = 0.1 }, -- \kappa + -- [0x1D706] = { xoffset = 0.05, width = 1.1, italic = 0 }, -- \lambda + -- [0x1D707] = { xoffset = 0.05, width = 1.05, italic = 0 }, -- \mu + -- [0x1D708] = { width = 1.1, italic = 0 }, -- \nu + -- [0x1D709] = { width = 1.1, italic = 0 }, -- \xi + -- [0x1D70B] = { width = 1.05, italic = 0 }, -- \pi + -- [0x1D70C] = { xoffset = 0.2, width = 1.2, italic = 0 }, -- \rho + -- [0x1D70E] = { width = 1, italic = 0.1 }, -- \sigma + -- [0x1D70F] = { xoffset = 0.05, width = 1.05, italic = 0.1 }, -- \tau + -- [0x1D712] = { xoffset = 0.15, width = 1.2, italic = 0.05 }, -- \chi + -- [0x1D713] = { xoffset = 0.05, width = 1.05, italic = 0.05 }, -- \psi + -- }, + -- }, diff --git a/tex/context/fonts/mkiv/generic-math.lfg b/tex/context/fonts/mkiv/generic-math.lfg index 490ad1416..214e479e0 100644 --- a/tex/context/fonts/mkiv/generic-math.lfg +++ b/tex/context/fonts/mkiv/generic-math.lfg @@ -102,6 +102,17 @@ return { -- [0x21CC] = false, } }, +-- { +-- tweak = "limits", +-- factor = 1.5, +-- list = { +-- [0x0222B] = true, +-- [0x0222C] = 1.45, +-- [0x0222D] = true, +-- [0x0222E] = true, +-- [0x0222F] = true, +-- }, +-- }, { -- For upright alphabets, we unset the anchor. -- This means that accents are placed @@ -171,6 +182,18 @@ return { "uppercasesanserifnormal", }, }, + -- { + -- comment = "example" + -- tweak = "action", + -- action = function(target,original,parameters) mathematics.tweaks.fixdimensions(target, original, parameters) + -- list = fixes, -- one of the parameters + -- }, + -- { + -- comment = "example" + -- tweak = "action", + -- action = mathematics.tweaks.fixdimensions, + -- list = fixes, -- one of the parameters + -- }, { -- This one fakes margins to get larger/smaller accents -- with for example \widetilde. @@ -179,6 +202,10 @@ return { list = { }, }, + -- { + -- tweak = "fixanchors", + -- factor = .5, + -- }, { tweak = "addrules", }, diff --git a/tex/context/fonts/mkiv/kpfonts-math.lfg b/tex/context/fonts/mkiv/kpfonts-math.lfg index c0b019f79..ed50baf3b 100644 --- a/tex/context/fonts/mkiv/kpfonts-math.lfg +++ b/tex/context/fonts/mkiv/kpfonts-math.lfg @@ -1,3 +1,6 @@ +local common = fonts.goodies.load("common-math.lfg") +local presets = common.mathematics.tweaks.presets + return { name = "kpfonts-math", version = "1.00", @@ -11,12 +14,12 @@ return { -- AccentBaseHeight = 0, AccentBaseDepth = 30, RadicalDegreeBottomRaisePercent = 70, - -- RadicalRuleThickness = 50, -- 50 in font + -- RadicalRuleThickness = 50, -- 50 in font DelimiterPercent = 90, DelimiterShortfall = 400, -- DisplayOperatorMinHeight = 1800, -- 1500 in font (only one) - PrimeRaisePercent = 25, -- 50 default - -- PrimeRaiseComposedPercent = 25, -- 25 default + PrimeRaisePercent = 25, -- 50 default + -- PrimeRaiseComposedPercent = 25, -- 25 default }, tweaks = { aftercopying = { @@ -27,51 +30,22 @@ return { { tweak = "dimensions", list = { - [0x2A3F] = { - factor = 0.84625, - } + [0x2A3F] = { factor = 0.84625 } }, }, { tweak = "kerns", list = { - [0x2F] = { - topleft = -0.2, - -- bottomleft = 0, - -- topright = 0, - bottomright = -0.2, - }, - - ["0x7D.parts.top"] = { - topright = -0.25, - }, -- right brace top - ["0x7D.parts.bottom"] = { - bottomright = -0.25, - }, -- right brace bottom - ["0x7D.variants.*"] = { - topright = -0.1, - bottomright = -0.1, - }, -- right brace variants - ["0x29.parts.top"] = { - topright = -0.05, - }, -- right parenthesis top - ["0x29.parts.bottom"] = { - bottomright = -0.05, - }, -- right parenthesis bottom - ["0x29.variants.*"] = { - topright = -0.05, - bottomright = -0.05, - }, -- right parenthesis variants - ["0x221A.parts.top"] = { - topright = 0.2, - }, -- right radical top - ["0x221A.parts.bottom"] = { - bottomright = 0.2, - }, -- right radical bottom - ["0x221A.variants.*"] = { - topright = 0.2, - bottomright = 0.2, - }, -- right radical variants + [0x002F] = { topleft = -0.2, bottomright = -0.2 }, + ["0x7D.parts.top"] = { topright = -0.25 }, -- right brace top + ["0x7D.parts.bottom"] = { bottomright = -0.25 }, -- right brace bottom + ["0x7D.variants.*"] = { topright = -0.1, bottomright = -0.1 }, -- right brace variants + ["0x29.parts.top"] = { topright = -0.05 }, -- right parenthesis top + ["0x29.parts.bottom"] = { bottomright = -0.05 }, -- right parenthesis bottom + ["0x29.variants.*"] = { topright = -0.05, bottomright = -0.05 }, -- right parenthesis variants + ["0x221A.parts.top"] = { topright = 0.2 }, -- right radical top + ["0x221A.parts.bottom"] = { bottomright = 0.2 }, -- right radical bottom + ["0x221A.variants.*"] = { topright = 0.2, bottomright = 0.2 }, -- right radical variants }, }, @@ -83,6 +57,34 @@ return { -- fake = 0.75, -- replace multiples with this width proportion -- -- keep = true, -- keep the text size prime (aka minute) -- }, + { + tweak = "addmirrors", + }, + { + -- kpfonts have calligraphic at private slots + tweak = "replacealphabets", + list = { + { + source = "uppercasescript", + target = "uppercasecalligraphic", + }, + { + source = { first = 0x0E7E1, last = 0x0E7FA }, + target = "uppercasecalligraphic", + }, + { + source = "uppercaseboldscript", + target = "uppercaseboldcalligraphic", + }, + { + source = { first = 0x0E701, last = 0x0E71A }, + target = "uppercaseboldcalligraphic", + }, + }, + }, + presets.matheulercalligraphic { rscale = 0.95 }, + presets.mathrsfscript { rscale = 0.95 }, + presets.mathxitsarabic { rscale = 0.92 }, { tweak = "checkspacing", }, @@ -96,8 +98,9 @@ return { tweak = "addrules", }, { + -- This will be fixed. Check if new version comes out! tweak = "addbars", - advance = 0.025, + advance = 0.5, }, { tweak = "addactuarian", @@ -105,6 +108,10 @@ return { { tweak = "addequals", }, + { + tweak = "setoptions", + set = { "ignorekerndimensions" } + }, }, }, alternates = { diff --git a/tex/context/fonts/mkiv/libertinus-math.lfg b/tex/context/fonts/mkiv/libertinus-math.lfg index 77d0161e3..ea6a27cad 100644 --- a/tex/context/fonts/mkiv/libertinus-math.lfg +++ b/tex/context/fonts/mkiv/libertinus-math.lfg @@ -4,6 +4,11 @@ -- fix-feature or just disable ssty, but we have to revert to a runtime fix. Lucky me that I didn't -- remove that hardly needed 'tweaks' mechanism yet. +-- The italic x has a rectangular piece in its eye (redundant point) + +local common = fonts.goodies.load("common-math.lfg") +local presets = common.mathematics.tweaks.presets + return { name = "libertinus-math", version = "1.00", @@ -20,17 +25,17 @@ return { UnderbarRuleThickness = 50, AccentTopShiftUp = -35, FlattenedAccentTopShiftUp = -35, - -- AccentExtendMargin = 50, + -- AccentExtendMargin = 50, -- AccentTopShiftUp = 0, AccentBaseDepth = 10, RadicalDegreeBottomRaisePercent = 60, RadicalKernAfterDegree = -425, - -- RadicalRuleThickness = 40, -- 40 in font + -- RadicalRuleThickness = 40, -- 40 in font DelimiterPercent = 90, DelimiterShortfall = 400, -- DisplayOperatorMinHeight = 1800, -- 1250 in font (only one) - PrimeRaisePercent = 70, -- 50 default - PrimeRaiseComposedPercent = 10, -- 25 default + PrimeRaisePercent = 70, -- 50 default + PrimeRaiseComposedPercent = 10, -- 25 default }, tweaks = { aftercopying = { @@ -40,85 +45,56 @@ return { expected = "Version 7.040", }, { - tweak = "dimensions", - list = { - -- [0x00060] = { yoffset = -0.075 }, -- grave - -- [0x000B4] = { yoffset = -0.075 }, -- acute - -- [0x002C6] = { yoffset = -0.075 }, -- hat - -- [0x002DC] = { yoffset = -0.075 }, -- tilde - -- -- [0x000AF] = { yoffset = -0.1 }, -- bar - -- [0x002D8] = { yoffset = -0.075 }, -- breve - -- [0x002D9] = { yoffset = -0.05 }, -- dot - -- [0x000A8] = { yoffset = -0.02 }, -- ddot - -- [0x020DB] = { yoffset = -0.02 }, -- dddot - -- [0x002DA] = { yoffset = -0.1 }, -- ring - -- -- [0x002C7] = { yoffset = -0.1 }, -- check - -- [0x020D7] = { yoffset = -0.1 }, -- vec - - -- [0x00300] = { yoffset = -0.1, all = true }, -- widegrave - -- [0x00301] = { yoffset = -0.1, all = true }, -- wideacute - -- [0x00302] = { yoffset = -0.1, all = true }, -- widehat - -- [0x00303] = { yoffset = -0.09, all = true }, -- widetilde - -- -- [0x00304] = { yoffset = -0.12, all = true }, -- widebar - -- [0x00306] = { yoffset = -0.05, all = true }, -- widebreve - -- [0x00307] = { yoffset = -0.02, all = true }, -- widedot - -- [0x00308] = { yoffset = -0.02, all = true }, -- wideddot - -- -- [0x020DB] = { yoffset = -0.1, all = true }, -- widedddot - -- [0x0030A] = { yoffset = -0.12, all = true }, -- widering - -- [0x0030C] = { yoffset = -0.04, all = true }, -- widecheck - - -- [0x1D44F] = { width = 1, italic = 0, anchor = 1.5 }, -- b (6.8) - -- [0x1D451] = { width = 1, italic = 0, anchor = 1.2 }, -- d (6.8) - -- [0x0210E] = { width = 1, italic = 0, anchor = 1.5 }, -- h (6.8) - -- [0x1D458] = { width = 1, italic = 0, anchor = 1.5 }, -- k (6.8) - }, + tweak = "addmirrors", + }, + presets.matheulercalligraphic { rscale = 0.92 }, + presets.mathrsfscript { rscale = 0.92 }, + presets.mathxitsarabic { rscale = 0.85 }, + { + tweak = "simplifykerns", + }, + { + -- When it makes sense we get rid of italics. + tweak = "moveitalics", + correct = true, + list = { + "lowercasenormal", + "lowercaseitalic", + "lowercasebold", + "lowercasebolditalic", + "lowercasegreeknormal", + "lowercasegreekitalic", + "lowercasegreekbold", + "lowercasegreekbolditalic", + "uppercasenormal", + "uppercaseitalic", + "uppercasebold", + "uppercasebolditalic", + "uppercasegreeknormal", + "uppercasegreekitalic", + "uppercasegreekbold", + "uppercasegreekbolditalic", + mathematics.tweaks.subsets.dotless, + } }, + { tweak = "kerns", list = { - [0x2F] = { - topleft = -0.15, - -- bottomleft = 0, - -- topright = 0, - bottomright = -0.15, - }, - - ["0x7D.parts.top"] = { - topright = -0.2, - }, -- right brace top - ["0x7D.parts.bottom"] = { - bottomright = -0.2, - }, -- right brace bottom - -- ["0x7D.variants.*"] = { - -- topright = -0.05, - -- bottomright = -0.05, - -- }, -- right brace variants - ["0x29.parts.top"] = { - topright = -0.15, - }, -- right parenthesis top - ["0x29.parts.bottom"] = { - bottomright = -0.15, - }, -- right parenthesis bottom - ["0x29.variants.*"] = { - topright = -0.15, - bottomright = -0.15, - }, -- right parenthesis variants - ["0x221A.parts.top"] = { - topright = 0.2, - }, -- right radical top - ["0x221A.parts.bottom"] = { - bottomright = 0.2, - }, -- right radical bottom - ["0x221A.variants.*"] = { - topright = 0.2, - bottomright = 0.2, - }, -- right radical variants - - -- angle - [0x27E9] = { topright = -0.1, bottomright = -0.1 }, - ["0x27E9.variants.*"] = { topright = -0.2, bottomright = -0.2 }, - [0x27EB] = { topright = -0.1, bottomright = -0.1 }, - ["0x27EB.variants.*"] = { topright = -0.2, bottomright = -0.2 }, + [0x002F] = { topleft = -0.15, bottomright = -0.15 }, + ["0x7D.parts.top"] = { topright = -0.2, }, -- right brace top + ["0x7D.parts.bottom"] = { bottomright = -0.2 }, -- right brace bottom + -- ["0x7D.variants.*"] = { topright = -0.05, bottomright = -0.05 }, -- right brace variants + ["0x29.parts.top"] = { topright = -0.15, }, -- right parenthesis top + ["0x29.parts.bottom"] = { bottomright = -0.15 }, -- right parenthesis bottom + ["0x29.variants.*"] = { topright = -0.15, bottomright = -0.15 }, -- right parenthesis variants + ["0x221A.parts.top"] = { topright = 0.2, }, -- right radical top + ["0x221A.parts.bottom"] = { bottomright = 0.2 }, -- right radical bottom + ["0x221A.variants.*"] = { topright = 0.2, bottomright = 0.2 }, -- right radical variants + [0x27E9] = { topright = -0.1, bottomright = -0.1 }, -- angle + ["0x27E9.variants.*"] = { topright = -0.2, bottomright = -0.2 }, + [0x27EB] = { topright = -0.1, bottomright = -0.1 }, + ["0x27EB.variants.*"] = { topright = -0.2, bottomright = -0.2 }, }, }, @@ -148,19 +124,17 @@ return { tweak = "dimensions", list = { -- here we want to apply to all - -- [0x00300] = { yoffset = -0.02, height = .95, all = true }, -- widegrave : 0x0060 - -- [0x00301] = { yoffset = -0.02, height = .95, all = true }, -- wideacute : 0x00B4 - -- [0x00302] = { yoffset = -0.03, height = .95, all = true }, -- widehat : 0x02C6 - -- [0x00303] = { yoffset = -0.02, height = .95, all = true }, -- widetilde : 0x02DC - -- [0x00306] = { yoffset = -0.03, height = .95, all = true }, -- widebre : 0x02D8 - -- [0x0030A] = { yoffset = 0.00, height = .95, all = true }, -- widering : 0x02DA - -- [0x0030C] = { yoffset = -0.03, height = .95, all = true }, -- widecheck : 0x02C7 - - -- [0x00304] = { yoffset = -0.05, height = .95, all = true }, -- widebar : 0x00AF - - -- [0x00307] = { yoffset = -0.03, height = .95, all = true }, -- widedot : 0x02D9 - -- [0x00308] = { yoffset = -0.03, height = .95, all = true }, -- wideddot : 0x00A8 - -- [0x020DB] = { yoffset = -0.015, height = .95, all = true }, -- widedddot : 0x20DB (self) + -- [0x00300] = { yoffset = -0.02, height = .95, all = true }, -- widegrave : 0x0060 + -- [0x00301] = { yoffset = -0.02, height = .95, all = true }, -- wideacute : 0x00B4 + -- [0x00302] = { yoffset = -0.03, height = .95, all = true }, -- widehat : 0x02C6 + -- [0x00303] = { yoffset = -0.02, height = .95, all = true }, -- widetilde : 0x02DC + -- [0x00306] = { yoffset = -0.03, height = .95, all = true }, -- widebre : 0x02D8 + -- [0x0030A] = { yoffset = 0.00, height = .95, all = true }, -- widering : 0x02DA + -- [0x0030C] = { yoffset = -0.03, height = .95, all = true }, -- widecheck : 0x02C7 + -- [0x00304] = { yoffset = -0.05, height = .95, all = true }, -- widebar : 0x00AF + -- [0x00307] = { yoffset = -0.03, height = .95, all = true }, -- widedot : 0x02D9 + -- [0x00308] = { yoffset = -0.03, height = .95, all = true }, -- wideddot : 0x00A8 + -- [0x020DB] = { yoffset = -0.015, height = .95, all = true }, -- widedddot : 0x20DB (self) }, }, -- We now copy these to the not wide slots so that we can set these to stretch as well, @@ -169,8 +143,6 @@ return { tweak = "copyaccents", }, -- So far for the accents. - - { tweak = "fixprimes", scale = 0.9, @@ -203,6 +175,10 @@ return { tweak = "addfourier", variant = 1, }, + { + tweak = "setoptions", + set = { "ignorekerndimensions" } + }, }, }, bigslots = { @@ -210,3 +186,40 @@ return { }, }, } + +-- Old values + -- { + -- tweak = "dimensions", + -- list = { + -- -- [0x00060] = { yoffset = -0.075 }, -- grave + -- -- [0x000B4] = { yoffset = -0.075 }, -- acute + -- -- [0x002C6] = { yoffset = -0.075 }, -- hat + -- -- [0x002DC] = { yoffset = -0.075 }, -- tilde + -- -- [0x000AF] = { yoffset = -0.1 }, -- bar + -- -- [0x002D8] = { yoffset = -0.075 }, -- breve + -- -- [0x002D9] = { yoffset = -0.05 }, -- dot + -- -- [0x000A8] = { yoffset = -0.02 }, -- ddot + -- -- [0x020DB] = { yoffset = -0.02 }, -- dddot + -- -- [0x002DA] = { yoffset = -0.1 }, -- ring + -- -- [0x002C7] = { yoffset = -0.1 }, -- check + -- -- [0x020D7] = { yoffset = -0.1 }, -- vec + + -- -- [0x00300] = { yoffset = -0.1, all = true }, -- widegrave + -- -- [0x00301] = { yoffset = -0.1, all = true }, -- wideacute + -- -- [0x00302] = { yoffset = -0.1, all = true }, -- widehat + -- -- [0x00303] = { yoffset = -0.09, all = true }, -- widetilde + -- -- [0x00304] = { yoffset = -0.12, all = true }, -- widebar + -- -- [0x00306] = { yoffset = -0.05, all = true }, -- widebreve + -- -- [0x00307] = { yoffset = -0.02, all = true }, -- widedot + -- -- [0x00308] = { yoffset = -0.02, all = true }, -- wideddot + -- -- [0x020DB] = { yoffset = -0.1, all = true }, -- widedddot + -- -- [0x0030A] = { yoffset = -0.12, all = true }, -- widering + -- -- [0x0030C] = { yoffset = -0.04, all = true }, -- widecheck + + -- -- [0x1D44F] = { width = 1, italic = 0, anchor = 1.5 }, -- b (6.8) + -- -- [0x1D451] = { width = 1, italic = 0, anchor = 1.2 }, -- d (6.8) + -- -- [0x0210E] = { width = 1, italic = 0, anchor = 1.5 }, -- h (6.8) + -- -- [0x1D458] = { width = 1, italic = 0, anchor = 1.5 }, -- k (6.8) + -- }, + -- }, + diff --git a/tex/context/fonts/mkiv/lm.lfg b/tex/context/fonts/mkiv/lm.lfg index 1d81e0b77..355b583d1 100644 --- a/tex/context/fonts/mkiv/lm.lfg +++ b/tex/context/fonts/mkiv/lm.lfg @@ -1,6 +1,9 @@ -- In order to be able to use beta math fonts, we use our own file name and -- always remap. +local common = fonts.goodies.load("common-math.lfg") +local presets = common.mathematics.tweaks.presets + local dimensions, kerns if CONTEXTLMTXMODE == 0 then local kern_150 = { bottomright = { { kern = -150 } } } @@ -76,8 +79,14 @@ return { DelimiterPercent = 90, DelimiterShortfall = 400, -- DisplayOperatorMinHeight = 1800, -- 1300 in font (only one) - PrimeRaisePercent = 60, -- 50 default - PrimeRaiseComposedPercent = 15, -- 25 default + PrimeRaisePercent = 60, + PrimeRaiseComposedPercent = 15, + -- SubSuperscriptGapMin = 160, -- 160 in font + SuperscriptBaselineDropMax = 250, -- 250 in font + -- SuperscriptBottomMaxWithSubscript = 344, -- 344 in font + -- SuperscriptBottomMin = 108, -- 108 in font + SuperscriptShiftUp = 363, -- 363 in font + SuperscriptShiftUpCramped = 89, -- 289 in font }, tweaks = { aftercopying = { @@ -85,6 +94,13 @@ return { tweak = "version", expected = "Version 1.958", }, + { + tweak = "addmirrors", + }, + presets.matheulercalligraphic { rscale = 1 }, + presets.mathrsfscript { rscale = 1 }, + presets.mathxitsarabic { rscale = 0.88 }, + presets.moveitalics { correct = true }, { tweak = "dimensions", list = { @@ -447,7 +463,7 @@ return { -- "lowercasedoublestruck", -- "lowercasefraktur", "lowercasemonospace", - "lowercasenormal", + -- "lowercasenormal", -- "lowercasesansserifbold", -- "lowercasesansserifnormal", -- "lowercasegreeknormal", @@ -550,6 +566,9 @@ return { { tweak = "fixradicals", }, + { + tweak = "addprivates", + }, { tweak = "addscripts", }, diff --git a/tex/context/fonts/mkiv/lucida-opentype-math.lfg b/tex/context/fonts/mkiv/lucida-opentype-math.lfg index 372d8cce2..97cf97ab1 100644 --- a/tex/context/fonts/mkiv/lucida-opentype-math.lfg +++ b/tex/context/fonts/mkiv/lucida-opentype-math.lfg @@ -1,3 +1,5 @@ +local common = fonts.goodies.load("common-math.lfg") +local presets = common.mathematics.tweaks.presets local dimensions, kerns if CONTEXTLMTXMODE == 0 then -- local kern_250 = { bottomright = { { kern = -250 } }, force = true } @@ -42,75 +44,83 @@ return { NoLimitSupFactor = 0, NoLimitSubFactor = 900, FractionRuleThickness = 55, - -- AccentTopShiftUp = 0, - -- FlattenedAccentTopShiftUp = 0, - -- AccentExtendMargin = 50, + -- AccentTopShiftUp = 0, + -- FlattenedAccentTopShiftUp = 0, + -- AccentExtendMargin = 50, -- AccentBaseHeight = 650, AccentBaseDepth = 150, RadicalDegreeBottomRaisePercent = 50, RadicalKernAfterDegree = -600, - -- RadicalRuleThickness = 35, -- 40 in font (46 in demi) + -- RadicalRuleThickness = 35, -- 40 in font (46 in demi) DelimiterPercent = 90, DelimiterShortfall = 400, -- DisplayOperatorMinHeight = 1800, -- 1300 in font (only one) - PrimeRaisePercent = 60, -- 50 default - PrimeRaiseComposedPercent = 50, -- 25 default + PrimeRaisePercent = 60, -- 50 default + PrimeRaiseComposedPercent = 50, -- 25 default +-- AxisHeight = 325, }, tweaks = { aftercopying = { { tweak = "version", - expected = "Version 1.802", + expected = "Version 1.803", }, - -- { - -- tweak = "substitutes", - -- list = { - -- [0x2264] = "ss03", - -- [0x2265] = "ss03", - -- } - -- }, - -- \definefontfeature[mathlucida][copymathscripts=yes] - -- \definefontfeature[mathlucida][copymathscripts=yes,ss04=yes] - -- 0xFEOO should be chancery style, if present { - tweak = "variants", - kind = "script", - feature = "ss04",-- this changes to chancery style for lucida - -- feature = false, -- use the saved ones (see typescript) - selector = 0xFE00, + tweak = "fixoldschool", + version = "Version 1.802", }, - -- 0xFEO1 should be roundhand style, if present +-- { +-- tweak = "showinfo", +-- version = "Version 1.803", +-- }, { - tweak = "variants", - kind = "script", - selector = 0xFE01, + tweak = "addmirrors", + }, + presets.mathxitsarabic { + rscale = 1.05 + }, + { + tweak = "replacealphabets", + list = { + { + source = "uppercasescript", + target = "uppercasecalligraphic", + feature = "ss04", + }, + }, + }, + { + tweak = "dimensions", + version = "Version 1.802", + list = { + -- The < and > are slightly too small. We scale them by 867/795 + ["0x003C"] = { scale = 1.09057, width = 1.09057, height = 1.09057 }, + ["0x003E"] = { scale = 1.09057, width = 1.09057, height = 1.09057 }, + -- The = is too big if in ss03. We scale it by 795/867 (not working like this) + -- ["0x003D.ss03"] = { scale = 0.916955, width = 0.916955, height = 0.916955 }, + }, }, { tweak = "dimensions", list = { - -- these we fix here + -- these we fix here. Remove when we have new version of Lucida ["0x23DC.parts.1"] = { xoffset = -0.075, height = .4, yoffset = -0.6 }, ["0x23DC.parts.2"] = { height = .4, yoffset = -0.6 }, ["0x23DC.parts.3"] = { xoffset = 0.075, height = .4, yoffset = -0.6 }, ["0x23DD.parts.1"] = { xoffset = -0.075, depth = .8, yoffset = 0.2 }, ["0x23DD.parts.2"] = { depth = .8, yoffset = 0.2 }, ["0x23DD.parts.3"] = { xoffset = 0.075, depth = .8, yoffset = 0.2 }, - -- The < and > are slightly too small. We scale them by 867/795 - ["0x003C"] = { scale = 1.09057, width = 1.09057, height = 1.09057 }, - ["0x003E"] = { scale = 1.09057, width = 1.09057, height = 1.09057 }, - -- The = is too big if in ss03. We scale it by 795/867 (not working like this) - -- ["0x003D.ss03"] = { scale = 0.916955, width = 0.916955, height = 0.916955 }, -- these are done later using the AccentBase* parameters -- [0x23DC] = { height = .2, yoffset = -0.8 }, -- [0x23DD] = { depth = .6, yoffset = 0.4 }, - + -- -- ["0x7C.variants.1"] = { squeeze = 0.75, height = 0.75, depth = 0.75 }, -- ["0x7C.variants.2"] = { squeeze = 0.75, height = 0.75, depth = 0.75 }, -- ["0x7C.variants.3"] = { squeeze = 0.75, height = 0.75, depth = 0.75 }, -- ["0x7C.variants.4"] = { squeeze = 0.75, height = 0.75, depth = 0.75 }, -- going zero makes them be ignored - ["0x7C.variants.3"]={ squeeze = 0.90, height = 0.90, depth = 0.90 }, - ["0x7C.variants.4"]={ squeeze = 0.80, height = 0.80, depth = 0.80 }, + ["0x7C.variants.3"] = { squeeze = 0.90, height = 0.90, depth = 0.90 }, + ["0x7C.variants.4"] = { squeeze = 0.80, height = 0.80, depth = 0.80 }, }, }, -- Accents are a mess. We migrate the extensibles from the combiners to the base accent @@ -127,10 +137,10 @@ return { { tweak = "dimensions", list = { - -- [0x00302] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widehat - -- [0x00303] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widetilde - -- [0x00306] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widebreve - -- [0x0030C] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widecheck + -- [0x00302] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widehat + -- [0x00303] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widetilde + -- [0x00306] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widebreve + -- [0x0030C] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widecheck }, }, -- Then we deal with all offsets and heights in one go. So we treat the initial accent @@ -138,20 +148,18 @@ return { { tweak = "dimensions", list = { - -- here we want to apply to all - -- [0x00300] = { yoffset = -0.02, height = .95, all = true }, -- widegrave : 0x0060 - -- [0x00301] = { yoffset = -0.02, height = .95, all = true }, -- wideacute : 0x00B4 - -- [0x00302] = { yoffset = -0.03, height = .95, all = true }, -- widehat : 0x02C6 - -- [0x00303] = { yoffset = -0.02, height = .95, all = true }, -- widetilde : 0x02DC - -- [0x00306] = { yoffset = -0.03, height = .95, all = true }, -- widebre : 0x02D8 - -- [0x0030A] = { yoffset = 0.00, height = .95, all = true }, -- widering : 0x02DA - -- [0x0030C] = { yoffset = -0.03, height = .95, all = true }, -- widecheck : 0x02C7 - - -- [0x00304] = { yoffset = -0.05, height = .95, all = true }, -- widebar : 0x00AF - - -- [0x00307] = { yoffset = -0.03, height = .95, all = true }, -- widedot : 0x02D9 - -- [0x00308] = { yoffset = -0.03, height = .95, all = true }, -- wideddot : 0x00A8 - -- [0x020DB] = { yoffset = -0.015, height = .95, all = true }, -- widedddot : 0x20DB (self) + -- here we want to apply to all + -- [0x00300] = { yoffset = -0.02, height = .95, all = true }, -- widegrave : 0x0060 + -- [0x00301] = { yoffset = -0.02, height = .95, all = true }, -- wideacute : 0x00B4 + -- [0x00302] = { yoffset = -0.03, height = .95, all = true }, -- widehat : 0x02C6 + -- [0x00303] = { yoffset = -0.02, height = .95, all = true }, -- widetilde : 0x02DC + -- [0x00306] = { yoffset = -0.03, height = .95, all = true }, -- widebre : 0x02D8 + -- [0x0030A] = { yoffset = 0.00, height = .95, all = true }, -- widering : 0x02DA + -- [0x0030C] = { yoffset = -0.03, height = .95, all = true }, -- widecheck : 0x02C7 + -- [0x00304] = { yoffset = -0.05, height = .95, all = true }, -- widebar : 0x00AF + -- [0x00307] = { yoffset = -0.03, height = .95, all = true }, -- widedot : 0x02D9 + -- [0x00308] = { yoffset = -0.03, height = .95, all = true }, -- wideddot : 0x00A8 + -- [0x020DB] = { yoffset = -0.015, height = .95, all = true }, -- widedddot : 0x20DB (self) }, }, -- We now copy these to the not wide slots so that we can set these to stretch as well, @@ -173,50 +181,20 @@ return { { tweak = "kerns", list = { - [0x2F] = { - topleft = -0.2, - -- bottomleft = 0, - -- topright = 0, - bottomright = -0.2, - }, - - ["0x7D.parts.top"] = { - topright = -0.15, - }, -- right brace top - ["0x7D.parts.bottom"] = { - bottomright = -0.15, - }, -- right brace bottom - ["0x7D.variants.*"] = { - topright = -0.15, - bottomright = -0.15, - }, -- right brace variants - ["0x29.parts.top"] = { - topright = -0.25, - }, -- right parenthesis top - ["0x29.parts.bottom"] = { - bottomright = -0.25, - }, -- right parenthesis bottom - ["0x29.variants.*"] = { - topright = -0.2, - bottomright = -0.2, - }, -- right parenthesis variants - ["0x221A.parts.top"] = { - topright = 0.2, - }, -- right radical top - ["0x221A.parts.bottom"] = { - bottomright = 0.2, - }, -- right radical bottom - ["0x221A.variants.*"] = { - topright = 0.2, - bottomright = 0.2, - }, -- right radical variants - - -- angle - [0x27E9] = { topright = -0.2, bottomright = -0.2 }, - ["0x27E9.variants.*"] = { topright = -0.3, bottomright = -0.3 }, - [0x27EB] = { topright = -0.2, bottomright = -0.2 }, - ["0x27EB.variants.*"] = { topright = -0.3, bottomright = -0.3 }, - + [0x002F] = { topleft = -0.2, bottomright = -0.2 }, + ["0x7D.parts.top"] = { topright = -0.15 }, -- right brace top + ["0x7D.parts.bottom"] = { bottomright = -0.15 }, -- right brace bottom + ["0x7D.variants.*"] = { topright = -0.15, bottomright = -0.15 }, -- right brace variants + ["0x29.parts.top"] = { topright = -0.25 }, -- right parenthesis top + ["0x29.parts.bottom"] = { bottomright = -0.25 }, -- right parenthesis bottom + ["0x29.variants.*"] = { topright = -0.2, bottomright = -0.2 }, -- right parenthesis variants + ["0x221A.parts.top"] = { topright = 0.2 }, -- right radical top + ["0x221A.parts.bottom"] = { bottomright = 0.2 }, -- right radical bottom + ["0x221A.variants.*"] = { topright = 0.2, bottomright = 0.2 }, -- right radical variants + [0x27E9] = { topright = -0.2, bottomright = -0.2 }, -- angle + ["0x27E9.variants.*"] = { topright = -0.3, bottomright = -0.3 }, + [0x27EB] = { topright = -0.2, bottomright = -0.2 }, + ["0x27EB.variants.*"] = { topright = -0.3, bottomright = -0.3 }, ["0x222B.variants.*"] = integral_variants, ["0x222B.parts.top"] = integral_top, ["0x222B.parts.bottom"] = integral_bottom, ["0x222C.variants.*"] = integral_variants, ["0x222C.parts.top"] = integral_top, ["0x222C.parts.bottom"] = integral_bottom, ["0x222D.variants.*"] = integral_variants, ["0x222D.parts.top"] = integral_top, ["0x222D.parts.bottom"] = integral_bottom, @@ -254,7 +232,7 @@ return { }, { tweak = "addfourier", - -- scale = 1.5, + -- scale = 1.5, variant = 1, }, { @@ -269,9 +247,9 @@ return { [0x2192] = false, [0x219E] = false, [0x21A0] = false, --- [0x21A6] = false, --- [0x21CB] = false, --- [0x21CC] = false, + -- [0x21A6] = false, + -- [0x21CB] = false, + -- [0x21CC] = false, } }, }, diff --git a/tex/context/fonts/mkiv/minion-math.lfg b/tex/context/fonts/mkiv/minion-math.lfg index 162b9f628..5216e1289 100644 --- a/tex/context/fonts/mkiv/minion-math.lfg +++ b/tex/context/fonts/mkiv/minion-math.lfg @@ -14,6 +14,9 @@ local dimensions, kerns if CONTEXTLMTXMODE == 0 then end +local common = fonts.goodies.load("common-math.lfg") +local presets = common.mathematics.tweaks.presets + return { name = "minion-math", version = "1.00", @@ -37,49 +40,51 @@ return { parameters = { NoLimitSupFactor = 0, NoLimitSubFactor = 900, - -- AccentTopShiftUp = -15, - -- FlattenedAccentTopShiftUp = -15, - -- -- AccentExtendMargin = 50, - -- AccentBaseDepth = 50, - -- RadicalDegreeBottomRaisePercent = 60, - -- RadicalRuleThickness = 66, -- 72 in font - -- DelimiterPercent = 90, - -- DelimiterShortfall = 400, - -- DisplayOperatorMinHeight = 1900, -- 1250 in font - -- -- AccentSuperscriptDrop = 100, - -- -- AccentSuperscriptPercent = 20, - PrimeRaisePercent = 50, -- 50 default - PrimeRaiseComposedPercent = 25, -- 25 default - -- PrimeShiftUp = 0, - -- PrimeBaselineDropMax = 0, - RadicalKernAfterExtensible = 100, -- 0 default - RadicalKernBeforeExtensible = 100, -- 0 default + -- AccentTopShiftUp = -15, + -- FlattenedAccentTopShiftUp = -15, + -- AccentExtendMargin = 50, + -- AccentBaseDepth = 50, + -- RadicalDegreeBottomRaisePercent = 60, + -- RadicalRuleThickness = 66, -- 72 in font + -- DelimiterPercent = 90, + -- DelimiterShortfall = 400, + -- DisplayOperatorMinHeight = 1900, -- 1250 in font + -- AccentSuperscriptDrop = 100, + -- AccentSuperscriptPercent = 20, + PrimeRaisePercent = 50, -- 50 default + PrimeRaiseComposedPercent = 25, -- 25 default + -- PrimeShiftUp = 0, + -- PrimeBaselineDropMax = 0, + RadicalKernAfterExtensible = 100, -- 0 default + RadicalKernBeforeExtensible = 100, -- 0 default }, tweaks = { aftercopying = { -- { -- tweak = "version", - -- expected = "unknown", + -- expected = "unknown", -- todo -- }, { - tweak = "dimensions", - -- smaller = true, - list = dimensions, + tweak = "addmirrors", + }, + presets.matheulercalligraphic { rscale = 0.95 }, + presets.mathrsfscript { rscale = 0.95 }, + presets.mathxitsarabic { rscale = 0.88 }, + { + tweak = "simplifykerns", + }, + presets.moveitalics { + correct = true + }, + { -- Check! + tweak = "replacealphabets", + list = { + { + source = "uppercasecalligraphic", + target = "uppercasescript", + }, + }, }, - -- { - -- tweak = "variants", - -- kind = "script", - -- feature = "s_s_0",-- this changes to chancery style for lucida - -- -- feature = false, -- use the saved ones (see typescript) - -- selector = 0xFE00, - -- }, - -- -- 0xFEO1 should be roundhand style, if present - -- { - -- tweak = "variants", - -- kind = "script", - -- selector = 0xFE01, - -- }, - { tweak = "extendaccents", }, @@ -94,18 +99,18 @@ return { factor = 0.95, scale = 0.9, }, - -- { - -- tweak = "checkspacing", - -- }, - -- { - -- tweak = "addscripts", - -- }, - -- { - -- tweak = "accentdimensions", - -- }, - -- { - -- tweak = "addrules", - -- }, + -- { + -- tweak = "checkspacing", + -- }, + -- { + -- tweak = "addscripts", + -- }, + -- { + -- tweak = "accentdimensions", + -- }, + -- { + -- tweak = "addrules", + -- }, { tweak = "addfourier", variant = 1, diff --git a/tex/context/fonts/mkiv/pagella-math.lfg b/tex/context/fonts/mkiv/pagella-math.lfg index 021bd2b7f..59eafeaaf 100644 --- a/tex/context/fonts/mkiv/pagella-math.lfg +++ b/tex/context/fonts/mkiv/pagella-math.lfg @@ -29,11 +29,13 @@ end -- When set this will bypass the italic correction hackery! +local common = fonts.goodies.load("common-math.lfg") +local presets = common.mathematics.tweaks.presets + local integral_variants = { bottomright = -0.20 } ----- integral_top = { topright = 0.05 } local integral_bottom = { bottomright = -0.20 } - return { name = "pagella-math", version = "1.00", @@ -45,20 +47,22 @@ return { NoLimitSupFactor = 0, NoLimitSubFactor = 900, AccentTopShiftUp = 10, - FlattenedAccentTopShiftUp = 10, -- now also set, the wide ones (so we can move in one go) - -- AccentExtendMargin = 50, + FlattenedAccentTopShiftUp = 10, + -- AccentExtendMargin = 50, -- AccentBaseHeight = 0, AccentBaseDepth = 80, -- SpaceAfterScript = 0, -- SpaceAfterScript = 30, RadicalDegreeBottomRaisePercent = 60, RadicalKernAfterDegree = -500, - RadicalRuleThickness = 54, -- 60 in font + RadicalRuleThickness = 54, -- 60 in font DelimiterPercent = 90, DelimiterShortfall = 400, DisplayOperatorMinHeight = 1800, -- 1500 in font - PrimeRaisePercent = 75, -- 50 default - PrimeRaiseComposedPercent = 10, -- 25 default + PrimeRaisePercent = 75, -- 50 default + PrimeRaiseComposedPercent = 10, -- 25 default + -- RadicalKernAfterExtensible = 0, -- 0 default + -- RadicalKernBeforeExtensible = 0, -- 0 default }, tweaks = { aftercopying = { @@ -66,47 +70,58 @@ return { tweak = "version", expected = "Version 1.632", }, - -- { - -- comment = "example" - -- tweak = "action", - -- action = function(target,original,parameters) mathematics.tweaks.fixdimensions(target, original, parameters) - -- list = fixes, -- one of the parameters - -- }, - -- { - -- comment = "example" - -- tweak = "action", - -- action = mathematics.tweaks.fixdimensions, - -- list = fixes, -- one of the parameters - -- }, { - tweak = "dimensions", - list = { -- offset width italic - [0x020D7] = { yoffset = -0.05 }, -- vec - [0x1D44E] = { xoffset = 0, width = 1, italic = 0, anchor = 0.9 }, -- a - [0x1D44F] = { xoffset = 0, width = 1, italic = 0, anchor = 1.3 }, -- b - [0x1D450] = { xoffset = 0, width = 1, italic = 0, anchor = 0.9 }, -- c - [0x1D451] = { xoffset = 0, width = 1, italic = 0, anchor = 0.7 }, -- d - [0x1D452] = { xoffset = 0, width = 1, italic = 0, anchor = 0.9 }, -- e - [0x1D453] = { xoffset = 0.50, width = 1.70, italic = 0.6, anchor = 1.2 }, -- f - [0x1D454] = { xoffset = 0.10, width = 1.15, italic = 0.2 }, -- g - [0x0210E] = { xoffset = 0, width = 1, italic = 0, anchor = 1.3 }, -- h - [0x1D458] = { xoffset = 0, width = 1, italic = 0, anchor = 1.3 }, -- k - [0x1D459] = { xoffset = 0, width = 1, italic = 0, anchor = 0.9 }, -- l - [0x1D45E] = { xoffset = 0, width = 1, italic = 0, anchor = 0.9 }, -- q - [0x1D463] = { xoffset = 0, width = 1, italic = 0, anchor = 1.25 }, -- v - [0x1D464] = { xoffset = 0, width = 1, italic = 0, anchor = 1.2 }, -- w - [0x1D6FE] = { xoffset = 0, width = 1, italic = 0, anchor = 1.2 }, -- \gamma - [0x1D706] = { xoffset = 0, width = 1, italic = 0, anchor = 1.05 }, -- \lambda - [0x1D70A] = { xoffset = 0, width = 1, italic = 0, anchor = 1.2 }, -- \omicron - [0x1D70D] = { xoffset = 0, width = 1, italic = 0, anchor = 1.2 }, -- \varsigma - [0x1D70E] = { xoffset = 0, width = 1, italic = 0, anchor = 1.1 }, -- \sigma - [0x1D70F] = { xoffset = -.10, width = 1, italic = 0, anchor = 0.95 }, -- \tau - [0x1D712] = { xoffset = 0.1, width = 1.2, italic = 0.1 }, -- \chi - [0x1D713] = { xoffset = -0.05, width = 0.95, italic = 0.1 }, -- \psi - [0x1D71D] = { xoffset = 0, width = 1, italic = 0, anchor = 0.7 }, -- \varpi + tweak = "fixprimes", + factor = 0.9, + -- smaller = true, + scale = 0.9, + -- fake = 0.65, + }, + { + tweak = "addmirrors", + }, + presets.matheulercalligraphic { rscale = 0.97 }, + presets.mathrsfscript { rscale = 0.97 }, + presets.mathxitsarabic { rscale = 0.95 }, + { + -- When it makes sense we get rid of italics. + tweak = "moveitalics", + correct = true, + list = { + "lowercasenormal", + "lowercaseitalic", + "lowercasebold", + "lowercasebolditalic", + "lowercasegreeknormal", + "lowercasegreekitalic", + "lowercasegreekbold", + "lowercasegreekbolditalic", + "uppercasenormal", + "uppercaseitalic", + "uppercasebold", + "uppercasebolditalic", + "uppercasegreeknormal", + "uppercasegreekitalic", + "uppercasegreekbold", + "uppercasegreekbolditalic", + mathematics.tweaks.subsets.dotless, + } + }, + { + tweak = "setovershoots", + list = { + { + target = "uppercasescript", + -- quad = true, -- to be decided + topovershoot = 0.05, + }, + { + target = "uppercaseboldscript", + -- quad = true, -- to be decided + topovershoot = 0.05, + }, }, }, - -- Accents are a mess. We migrate the extensibles from the combiners to the base accent -- and then need to tweak the width (which is auto set because it was zero with a large -- accent anchor offset). First we copy and fix. @@ -126,7 +141,7 @@ return { [0x00302] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widehat [0x00303] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widetilde [0x00306] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widebreve - [0x0030A] = { width = 0.9, xoffset = -.0 }, -- widering + [0x0030A] = { width = 0.9, xoffset = -.0 }, -- widering -- weird this one [0x0030C] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widecheck }, }, @@ -135,20 +150,18 @@ return { { tweak = "dimensions", list = { - -- here we want to apply to all - -- [0x00300] = { yoffset = -0.02, height = .95, all = true }, -- widegrave : 0x0060 - -- [0x00301] = { yoffset = -0.02, height = .95, all = true }, -- wideacute : 0x00B4 - -- [0x00302] = { yoffset = -0.03, height = .95, all = true }, -- widehat : 0x02C6 - -- [0x00303] = { yoffset = -0.02, height = .95, all = true }, -- widetilde : 0x02DC - -- [0x00306] = { yoffset = -0.03, height = .95, all = true }, -- widebre : 0x02D8 - -- [0x0030A] = { yoffset = 0.00, height = .95, all = true }, -- widering : 0x02DA - -- [0x0030C] = { yoffset = -0.03, height = .95, all = true }, -- widecheck : 0x02C7 - - -- [0x00304] = { yoffset = -0.05, height = .95, all = true }, -- widebar : 0x00AF - - -- [0x00307] = { yoffset = -0.03, height = .95, all = true }, -- widedot : 0x02D9 - -- [0x00308] = { yoffset = -0.03, height = .95, all = true }, -- wideddot : 0x00A8 - [0x020DB] = { yoffset = -0.01, height = .95, all = true }, -- widedddot : 0x20DB (self) + -- here we want to apply to all + -- [0x00300] = { yoffset = -0.02, height = .95, all = true }, -- widegrave : 0x0060 + -- [0x00301] = { yoffset = -0.02, height = .95, all = true }, -- wideacute : 0x00B4 + -- [0x00302] = { yoffset = -0.03, height = .95, all = true }, -- widehat : 0x02C6 + -- [0x00303] = { yoffset = -0.02, height = .95, all = true }, -- widetilde : 0x02DC + -- [0x00306] = { yoffset = -0.03, height = .95, all = true }, -- widebre : 0x02D8 + -- [0x0030A] = { yoffset = 0.00, height = .95, all = true }, -- widering : 0x02DA + -- [0x0030C] = { yoffset = -0.03, height = .95, all = true }, -- widecheck : 0x02C7 + -- [0x00304] = { yoffset = -0.05, height = .95, all = true }, -- widebar : 0x00AF + -- [0x00307] = { yoffset = -0.03, height = .95, all = true }, -- widedot : 0x02D9 + -- [0x00308] = { yoffset = -0.03, height = .95, all = true }, -- wideddot : 0x00A8 + [0x020DB] = { yoffset = -0.01, height = .95, all = true }, -- widedddot : 0x20DB (self) }, }, -- We now copy these to the not wide slots so that we can set these to stretch as well, @@ -165,50 +178,24 @@ return { { tweak = "kerns", list = { - -- ["*:0x2F"] = { - [0x2F] = { - topleft = -0.2, - -- bottomleft = 0, - -- topright = 0, - bottomright = -0.2, - }, - ["0x7D.parts.top"] = { - topright = -0.15, - }, -- right brace top - ["0x7D.parts.bottom"] = { - bottomright = -0.15, - }, -- right brace bottom - ["0x7D.variants.*"] = { - topright = -0.15, - bottomright = -0.15, - }, -- right brace variants - ["0x29.parts.top"] = { - topright = -0.25, - }, -- right parenthesis top - ["0x29.parts.bottom"] = { - bottomright = -0.25, - }, -- right parenthesis bottom - ["0x29.variants.*"] = { - topright = -0.2, - bottomright = -0.2, - }, -- right parenthesis variants - ["0x221A.parts.top"] = { - topright = 0.2, - }, -- right radical top - ["0x221A.parts.bottom"] = { - bottomright = 0.2, - }, -- right radical bottom - ["0x221A.variants.*"] = { - topright = 0.2, - bottomright = 0.2, - }, -- right radical variants - + -- ["*:0x2F"] = { ... } + [0x002F] = { topleft = -0.2, bottomright = -0.2 }, + -- + ["0x7D.parts.top"] = { topright = -0.15, }, -- right brace top + ["0x7D.parts.bottom"] = { bottomright = -0.15 }, -- right brace bottom + ["0x7D.variants.*"] = { topright = -0.15, bottomright = -0.15 }, -- right brace variants + ["0x29.parts.top"] = { topright = -0.25, }, -- right parenthesis top + ["0x29.parts.bottom"] = { bottomright = -0.25 }, -- right parenthesis bottom + ["0x29.variants.*"] = { topright = -0.2, bottomright = -0.2 }, -- right parenthesis variants + ["0x221A.parts.top"] = { topright = 0.2, }, -- right radical top + ["0x221A.parts.bottom"] = { bottomright = 0.2 }, -- right radical bottom + ["0x221A.variants.*"] = { topright = 0.2, bottomright = 0.2 }, -- right radical variants -- angle - [0x27E9] = { topright = -0.2, bottomright = -0.2 }, - ["0x27E9.variants.*"] = { topright = -0.3, bottomright = -0.3 }, - [0x27EB] = { topright = -0.2, bottomright = -0.2 }, - ["0x27EB.variants.*"] = { topright = -0.3, bottomright = -0.3 }, - + [0x27E9] = { topright = -0.2, bottomright = -0.2 }, + ["0x27E9.variants.*"] = { topright = -0.3, bottomright = -0.3 }, + [0x27EB] = { topright = -0.2, bottomright = -0.2 }, + ["0x27EB.variants.*"] = { topright = -0.3, bottomright = -0.3 }, + -- ["0x222B.variants.*"] = integral_variants, ["0x222B.parts.top"] = integral_top, ["0x222B.parts.bottom"] = integral_bottom, ["0x222C.variants.*"] = integral_variants, ["0x222C.parts.top"] = integral_top, ["0x222C.parts.bottom"] = integral_bottom, ["0x222D.variants.*"] = integral_variants, ["0x222D.parts.top"] = integral_top, ["0x222D.parts.bottom"] = integral_bottom, @@ -218,17 +205,8 @@ return { ["0x2231.variants.*"] = integral_variants, ["0x2231.parts.top"] = integral_top, ["0x2231.parts.bottom"] = integral_bottom, ["0x2232.variants.*"] = integral_variants, ["0x2232.parts.top"] = integral_top, ["0x2232.parts.bottom"] = integral_bottom, ["0x2233.variants.*"] = integral_variants, ["0x2233.parts.top"] = integral_top, ["0x2233.parts.bottom"] = integral_bottom, - - }, }, - { - tweak = "fixprimes", - factor = 0.9, - -- smaller = true, - scale = 0.9, - -- fake = 0.65, - }, { tweak = "checkspacing", }, @@ -258,21 +236,19 @@ return { tweak = "addequals", }, { - tweak = "addfourier", + tweak = "addfourier", variant = 1, }, - -{ - tweak = "kernpairs", - list = { - -- beware: we kept the italic correction in spite of punctuation class - [0x1D453] = { -- f - [0x3A] = -.1, - [0x3B] = -.1, - }, - }, -}, - + { + tweak = "kernpairs", + list = { + -- beware: we kept the italic correction in spite of punctuation class + [0x1D453] = { -- f + [0x3A] = -.1, + [0x3B] = -.1, + }, + }, + }, }, }, bigslots = { @@ -288,3 +264,38 @@ return { kerns = kerns, }, } + + + + + +-- Old values + + -- { + -- tweak = "dimensions", + -- list = { -- offset width italic + -- [0x020D7] = { yoffset = -0.05 }, -- vec + -- [0x1D44E] = { xoffset = 0, width = 1, italic = 0, anchor = 0.9 }, -- a + -- [0x1D44F] = { xoffset = 0, width = 1, italic = 0, anchor = 1.3 }, -- b + -- [0x1D450] = { xoffset = 0, width = 1, italic = 0, anchor = 0.9 }, -- c + -- [0x1D451] = { xoffset = 0, width = 1, italic = 0, anchor = 0.7 }, -- d + -- [0x1D452] = { xoffset = 0, width = 1, italic = 0, anchor = 0.9 }, -- e + -- [0x1D453] = { xoffset = 0.50, width = 1.70, italic = 0.6, anchor = 1.2 }, -- f + -- [0x1D454] = { xoffset = 0.10, width = 1.15, italic = 0.2 }, -- g + -- [0x0210E] = { xoffset = 0, width = 1, italic = 0, anchor = 1.3 }, -- h + -- [0x1D458] = { xoffset = 0, width = 1, italic = 0, anchor = 1.3 }, -- k + -- [0x1D459] = { xoffset = 0, width = 1, italic = 0, anchor = 0.9 }, -- l + -- [0x1D45E] = { xoffset = 0, width = 1, italic = 0, anchor = 0.9 }, -- q + -- [0x1D463] = { xoffset = 0, width = 1, italic = 0, anchor = 1.25 }, -- v + -- [0x1D464] = { xoffset = 0, width = 1, italic = 0, anchor = 1.2 }, -- w + -- [0x1D6FE] = { xoffset = 0, width = 1, italic = 0, anchor = 1.2 }, -- \gamma + -- [0x1D706] = { xoffset = 0, width = 1, italic = 0, anchor = 1.05 }, -- \lambda + -- [0x1D70A] = { xoffset = 0, width = 1, italic = 0, anchor = 1.2 }, -- \omicron + -- [0x1D70D] = { xoffset = 0, width = 1, italic = 0, anchor = 1.2 }, -- \varsigma + -- [0x1D70E] = { xoffset = 0, width = 1, italic = 0, anchor = 1.1 }, -- \sigma + -- [0x1D70F] = { xoffset = -.10, width = 1, italic = 0, anchor = 0.95 }, -- \tau + -- [0x1D712] = { xoffset = 0.1, width = 1.2, italic = 0.1 }, -- \chi + -- [0x1D713] = { xoffset = -0.05, width = 0.95, italic = 0.1 }, -- \psi + -- [0x1D71D] = { xoffset = 0, width = 1, italic = 0, anchor = 0.7 }, -- \varpi + -- }, + -- }, diff --git a/tex/context/fonts/mkiv/schola-math.lfg b/tex/context/fonts/mkiv/schola-math.lfg index cb992cd0b..54d24ffa3 100644 --- a/tex/context/fonts/mkiv/schola-math.lfg +++ b/tex/context/fonts/mkiv/schola-math.lfg @@ -10,11 +10,11 @@ local dimensions, kerns if CONTEXTLMTXMODE == 0 then end --- When set this will bypass the italic correction hackery! local integral_variants = { bottomright = -0.20 } --- local integral_top = { topright = 0.05 } local integral_bottom = { bottomright = -0.20 } +local common = fonts.goodies.load("common-math.lfg") +local presets = common.mathematics.tweaks.presets return { name = "schola-math", @@ -28,17 +28,17 @@ return { NoLimitSubFactor = 900, AccentTopShiftUp = -15, FlattenedAccentTopShiftUp = -15, - -- AccentExtendMargin = 50, + -- AccentExtendMargin = 50, -- AccentBaseHeight = 0, AccentBaseDepth = 30, RadicalDegreeBottomRaisePercent = 60, RadicalKernAfterDegree = -500, - RadicalRuleThickness = 64, -- 70 in font + RadicalRuleThickness = 64, -- 70 in font DelimiterPercent = 90, DelimiterShortfall = 400, DisplayOperatorMinHeight = 1800, -- 1333 in font - -- PrimeRaisePercent = 50, -- 50 default - PrimeRaiseComposedPercent = 10, -- 25 default + -- PrimeRaisePercent = 50, -- 50 default + PrimeRaiseComposedPercent = 10, -- 25 default }, tweaks = { aftercopying = { @@ -47,58 +47,36 @@ return { expected = "Version 1.533", }, { - tweak = "dimensions", - list = { - -- nothing yet - } + tweak = "fixprimes", + scale = 0.85, + -- smaller = true, + factor = 1, }, + { + tweak = "addmirrors", + }, + presets.matheulercalligraphic { rscale = 1 }, + presets.mathrsfscript { rscale = 1 }, + presets.mathxitsarabic { rscale = 0.93 }, + presets.moveitalics { correct = true }, { tweak = "kerns", list = { - [0x2F] = { - topleft = -0.2, - -- bottomleft = 0, - -- topright = 0, - bottomright = -0.2, - }, - ["0x7D.parts.top"] = { - topright = -0.15, - }, -- right brace top - ["0x7D.parts.bottom"] = { - bottomright = -0.15, - }, -- right brace bottom - ["0x7D.variants.*"] = { - topright = -0.15, - bottomright = -0.15, - }, -- right brace variants - ["0x29.parts.top"] = { - topright = -0.25, - }, -- right parenthesis top - ["0x29.parts.bottom"] = { - bottomright = -0.25, - }, -- right parenthesis bottom - ["0x29.variants.*"] = { - topright = -0.2, - bottomright = -0.2, - }, -- right parenthesis variants - ["0x221A.parts.top"] = { - topright = 0.2, - }, -- right radical top - ["0x221A.parts.bottom"] = { - bottomright = 0.2, - }, -- right radical bottom - ["0x221A.variants.*"] = { - topright = 0.2, - bottomright = 0.2, - }, -- right radical variants - - -- angle - [0x27E9] = { topright = -0.1, bottomright = -0.1 }, - ["0x27E9.variants.*"] = { topright = -0.2, bottomright = -0.2 }, - [0x27EB] = { topright = -0.1, bottomright = -0.1 }, - ["0x27EB.variants.*"] = { topright = -0.2, bottomright = -0.2 }, - - + [0x002F] = { topleft = -0.2, bottomright = -0.2 }, + ["0x7D.parts.top"] = { topright = -0.15, }, -- right brace top + ["0x7D.parts.bottom"] = { bottomright = -0.15 }, -- right brace bottom + ["0x7D.variants.*"] = { topright = -0.15, bottomright = -0.15 }, -- right brace variants + ["0x29.parts.top"] = { topright = -0.25, }, -- right parenthesis top + ["0x29.parts.bottom"] = { bottomright = -0.25 }, -- right parenthesis bottom + ["0x29.variants.*"] = { topright = -0.2, bottomright = -0.2 }, -- right parenthesis variants + ["0x221A.parts.top"] = { topright = 0.2, }, -- right radical top + ["0x221A.parts.bottom"] = { bottomright = 0.2 }, -- right radical bottom + ["0x221A.variants.*"] = { topright = 0.2, bottomright = 0.2 }, -- right radical variants + [0x27E9] = { topright = -0.1, bottomright = -0.1 }, -- angle + ["0x27E9.variants.*"] = { topright = -0.2, bottomright = -0.2 }, + [0x27EB] = { topright = -0.1, bottomright = -0.1 }, + ["0x27EB.variants.*"] = { topright = -0.2, bottomright = -0.2 }, + -- ["0x222B.variants.*"] = integral_variants, ["0x222B.parts.top"] = integral_top, ["0x222B.parts.bottom"] = integral_bottom, ["0x222C.variants.*"] = integral_variants, ["0x222C.parts.top"] = integral_top, ["0x222C.parts.bottom"] = integral_bottom, ["0x222D.variants.*"] = integral_variants, ["0x222D.parts.top"] = integral_top, ["0x222D.parts.bottom"] = integral_bottom, @@ -126,9 +104,9 @@ return { { tweak = "dimensions", list = { - [0x00302] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widehat - [0x00303] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widetilde - [0x00306] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widebreve + [0x00302] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widehat + [0x00303] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widetilde + [0x00306] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widebreve [0x0030C] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widecheck }, }, @@ -137,20 +115,18 @@ return { { tweak = "dimensions", list = { - -- here we want to apply to all - -- [0x00300] = { yoffset = -0.02, height = .95, all = true }, -- widegrave : 0x0060 - -- [0x00301] = { yoffset = -0.02, height = .95, all = true }, -- wideacute : 0x00B4 - -- [0x00302] = { yoffset = -0.03, height = .95, all = true }, -- widehat : 0x02C6 - -- [0x00303] = { yoffset = -0.02, height = .95, all = true }, -- widetilde : 0x02DC - -- [0x00306] = { yoffset = -0.03, height = .95, all = true }, -- widebre : 0x02D8 - -- [0x0030A] = { yoffset = 0.00, height = .95, all = true }, -- widering : 0x02DA - -- [0x0030C] = { yoffset = -0.03, height = .95, all = true }, -- widecheck : 0x02C7 - - -- [0x00304] = { yoffset = -0.05, height = .95, all = true }, -- widebar : 0x00AF - - -- [0x00307] = { yoffset = -0.03, height = .95, all = true }, -- widedot : 0x02D9 - -- [0x00308] = { yoffset = -0.03, height = .95, all = true }, -- wideddot : 0x00A8 - -- [0x020DB] = { yoffset = -0.015, height = .95, all = true }, -- widedddot : 0x20DB (self) + -- here we want to apply to all + -- [0x00300] = { yoffset = -0.02, height = .95, all = true }, -- widegrave : 0x0060 + -- [0x00301] = { yoffset = -0.02, height = .95, all = true }, -- wideacute : 0x00B4 + -- [0x00302] = { yoffset = -0.03, height = .95, all = true }, -- widehat : 0x02C6 + -- [0x00303] = { yoffset = -0.02, height = .95, all = true }, -- widetilde : 0x02DC + -- [0x00306] = { yoffset = -0.03, height = .95, all = true }, -- widebre : 0x02D8 + -- [0x0030A] = { yoffset = 0.00, height = .95, all = true }, -- widering : 0x02DA + -- [0x0030C] = { yoffset = -0.03, height = .95, all = true }, -- widecheck : 0x02C7 + -- [0x00304] = { yoffset = -0.05, height = .95, all = true }, -- widebar : 0x00AF + -- [0x00307] = { yoffset = -0.03, height = .95, all = true }, -- widedot : 0x02D9 + -- [0x00308] = { yoffset = -0.03, height = .95, all = true }, -- wideddot : 0x00A8 + -- [0x020DB] = { yoffset = -0.015, height = .95, all = true }, -- widedddot : 0x20DB (self) }, }, -- We now copy these to the not wide slots so that we can set these to stretch as well, @@ -158,16 +134,6 @@ return { { tweak = "copyaccents", }, - -- So far for the accents. - - - - { - tweak = "fixprimes", - scale = 0.85, - -- smaller = true, - factor = 1, - }, { tweak = "checkspacing", }, @@ -191,8 +157,8 @@ return { tweak = "addequals", }, { - tweak = "addfourier", - -- scale = 1.25, + tweak = "addfourier", + -- scale = 1.25, variant = 1, }, }, diff --git a/tex/context/fonts/mkiv/stix-two-math.lfg b/tex/context/fonts/mkiv/stix-two-math.lfg index b5e6daf29..8b03a7730 100644 --- a/tex/context/fonts/mkiv/stix-two-math.lfg +++ b/tex/context/fonts/mkiv/stix-two-math.lfg @@ -3,6 +3,8 @@ local integral_variants = { bottomright = -0.4 } -- local integral_top = { topright = 0.05 } local integral_bottom = { bottomright = -0.35 } +local common = fonts.goodies.load("common-math.lfg") +local presets = common.mathematics.tweaks.presets return { name = "stix-two-math", @@ -31,18 +33,18 @@ return { NoLimitSubFactor = 1000, -- AccentBaseHeight = 0, AccentBaseDepth = 30, - FlattenedAccentTopShiftUp = 0, -- now also set, the wide ones (so we can move in one go) - -- AccentExtendMargin = 50, + FlattenedAccentTopShiftUp = 0, + -- AccentExtendMargin = 50, RadicalDegreeBottomRaisePercent = 65, -- RadicalKernBeforeDegree = 500, RadicalKernAfterDegree = -500, RadicalVerticalGap = 10, - -- RadicalRuleThickness = 68, -- 68 in font (but shifted down) + -- RadicalRuleThickness = 68, -- 68 in font (but shifted down) DelimiterPercent = 90, DelimiterShortfall = 400, DisplayOperatorMinHeight = 1800, -- 1800 in font - PrimeRaisePercent = 75, -- 50 default - PrimeRaiseComposedPercent = 10, -- 25 default + PrimeRaisePercent = 75, -- 50 default + PrimeRaiseComposedPercent = 10, -- 25 default }, tweaks = { aftercopying = { @@ -50,53 +52,40 @@ return { tweak = "version", expected = "Version 2.12 b168", }, + { + tweak = "fixprimes", + scale = 1, + -- smaller = true, + factor = 1, + }, + { + tweak = "addmirrors", + }, + presets.mathxitsarabic { rscale = 0.95 }, + { + tweak = "simplifykerns", + }, + presets.moveitalics { + correct = true + }, { tweak = "kerns", list = { - [0x2F] = { - topleft = -0.2, - -- bottomleft = 0, - -- topright = 0, - bottomright = -0.2, - }, - - ["0x7D.parts.top"] = { - topright = -0.15, - }, -- right brace top - ["0x7D.parts.bottom"] = { - bottomright = -0.15, - }, -- right brace bottom - -- ["0x7D.variants.*"] = { - -- topright = -0.15, - -- bottomright = -0.15, - -- }, -- right brace variants - ["0x29.parts.top"] = { - topright = -0.1, - }, -- right parenthesis top - ["0x29.parts.bottom"] = { - bottomright = -0.1, - }, -- right parenthesis bottom - ["0x29.variants.*"] = { - topright = -0.2, - bottomright = -0.2, - }, -- right parenthesis variants - ["0x221A.parts.top"] = { - topright = 0.2, - }, -- right radical top - ["0x221A.parts.bottom"] = { - bottomright = 0.2, - }, -- right radical bottom - ["0x221A.variants.*"] = { - topright = 0.2, - bottomright = 0.2, - }, -- right radical variants - - -- angle - [0x27E9] = { topright = -0.1, bottomright = -0.1 }, - ["0x27E9.variants.*"] = { topright = -0.2, bottomright = -0.2 }, - [0x27EB] = { topright = -0.1, bottomright = -0.1 }, - ["0x27EB.variants.*"] = { topright = -0.2, bottomright = -0.2 }, - + [0x002F] = { topleft = -0.2, bottomright = -0.2 }, + ["0x7D.parts.top"] = { topright = -0.15, }, -- right brace top + ["0x7D.parts.bottom"] = { bottomright = -0.15 }, -- right brace bottom + -- ["0x7D.variants.*"] = { topright = -0.15, bottomright = -0.15 }, -- right brace variants + ["0x29.parts.top"] = { topright = -0.1, }, -- right parenthesis top + ["0x29.parts.bottom"] = { bottomright = -0.1 }, -- right parenthesis bottom + ["0x29.variants.*"] = { topright = -0.2, bottomright = -0.2 }, -- right parenthesis variants + ["0x221A.parts.top"] = { topright = 0.2, }, -- right radical top + ["0x221A.parts.bottom"] = { bottomright = 0.2 }, -- right radical bottom + ["0x221A.variants.*"] = { topright = 0.2, bottomright = 0.2 }, -- right radical variants + [0x27E9] = { topright = -0.1, bottomright = -0.1 }, -- angle + ["0x27E9.variants.*"] = { topright = -0.2, bottomright = -0.2 }, + [0x27EB] = { topright = -0.1, bottomright = -0.1 }, + ["0x27EB.variants.*"] = { topright = -0.2, bottomright = -0.2 }, + -- ["0x222B.variants.*"] = integral_variants, ["0x222B.parts.top"] = integral_top, ["0x222B.parts.bottom"] = integral_bottom, ["0x222C.variants.*"] = integral_variants, ["0x222C.parts.top"] = integral_top, ["0x222C.parts.bottom"] = integral_bottom, ["0x222D.variants.*"] = integral_variants, ["0x222D.parts.top"] = integral_top, ["0x222D.parts.bottom"] = integral_bottom, @@ -106,23 +95,21 @@ return { ["0x2231.variants.*"] = integral_variants, ["0x2231.parts.top"] = integral_top, ["0x2231.parts.bottom"] = integral_bottom, ["0x2232.variants.*"] = integral_variants, ["0x2232.parts.top"] = integral_top, ["0x2232.parts.bottom"] = integral_bottom, ["0x2233.variants.*"] = integral_variants, ["0x2233.parts.top"] = integral_top, ["0x2233.parts.bottom"] = integral_bottom, - - }, }, - -- 0xFEOO should be chancery style, if present { - tweak = "variants", - kind = "script", - -- feature = false, -- use the saved ones (see typescript) - selector = 0xFE00, - }, - -- 0xFEO1 should be roundhand style, if present - { - tweak = "variants", - kind = "script", - feature = "ss01",-- this changes to roundhand style for stixtwo - selector = 0xFE01, + tweak = "replacealphabets", + list = { + { + source = "uppercasescript", + target = "uppercasecalligraphic", + }, + { + source = "uppercasescript", + target = "uppercasescript", + feature = "ss01", + }, + }, }, -- Accents are a mess. We migrate the extensibles from the combiners to the base accent -- and then need to tweak the width (which is auto set because it was zero with a large @@ -138,9 +125,9 @@ return { { tweak = "dimensions", list = { - [0x00302] = { width = 1.2, anchor = 1.10, xoffset = .05 }, -- widehat - [0x00303] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widetilde - [0x00306] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widebreve + [0x00302] = { width = 1.2, anchor = 1.10, xoffset = .05 }, -- widehat + [0x00303] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widetilde + [0x00306] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widebreve [0x0030C] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widecheck }, }, @@ -149,20 +136,18 @@ return { { tweak = "dimensions", list = { - -- here we want to apply to all - -- [0x00300] = { yoffset = -0.02, height = .95, all = true }, -- widegrave : 0x0060 - -- [0x00301] = { yoffset = -0.02, height = .95, all = true }, -- wideacute : 0x00B4 - -- [0x00302] = { yoffset = -0.03, height = .95, all = true }, -- widehat : 0x02C6 - -- [0x00303] = { yoffset = -0.02, height = .95, all = true }, -- widetilde : 0x02DC - -- [0x00306] = { yoffset = -0.03, height = .95, all = true }, -- widebre : 0x02D8 - -- [0x0030A] = { yoffset = 0.00, height = .95, all = true }, -- widering : 0x02DA - -- [0x0030C] = { yoffset = -0.03, height = .95, all = true }, -- widecheck : 0x02C7 - - -- [0x00304] = { yoffset = -0.05, height = .95, all = true }, -- widebar : 0x00AF - - -- [0x00307] = { yoffset = -0.03, height = .95, all = true }, -- widedot : 0x02D9 - -- [0x00308] = { yoffset = -0.03, height = .95, all = true }, -- wideddot : 0x00A8 - [0x020DB] = { yoffset = 0.025, height = .95, all = true }, -- widedddot : 0x20DB (self) + -- here we want to apply to all + -- [0x00300] = { yoffset = -0.02, height = .95, all = true }, -- widegrave : 0x0060 + -- [0x00301] = { yoffset = -0.02, height = .95, all = true }, -- wideacute : 0x00B4 + -- [0x00302] = { yoffset = -0.03, height = .95, all = true }, -- widehat : 0x02C6 + -- [0x00303] = { yoffset = -0.02, height = .95, all = true }, -- widetilde : 0x02DC + -- [0x00306] = { yoffset = -0.03, height = .95, all = true }, -- widebre : 0x02D8 + -- [0x0030A] = { yoffset = 0.00, height = .95, all = true }, -- widering : 0x02DA + -- [0x0030C] = { yoffset = -0.03, height = .95, all = true }, -- widecheck : 0x02C7 + -- [0x00304] = { yoffset = -0.05, height = .95, all = true }, -- widebar : 0x00AF + -- [0x00307] = { yoffset = -0.03, height = .95, all = true }, -- widedot : 0x02D9 + -- [0x00308] = { yoffset = -0.03, height = .95, all = true }, -- wideddot : 0x00A8 + [0x020DB] = { yoffset = 0.025, height = .95, all = true }, -- widedddot : 0x20DB (self) }, }, -- We now copy these to the not wide slots so that we can set these to stretch as well, @@ -171,13 +156,6 @@ return { tweak = "copyaccents", }, -- So far for the accents. - - { - tweak = "fixprimes", - scale = 1, - -- smaller = true, - factor = 1, - }, { tweak = "checkspacing", }, @@ -204,21 +182,21 @@ return { tweak = "addfourier", variant = 1, }, -{ - tweak = "addparts", - list = { - [0x21F4] = { - horizontal = true, - template = 0x2192, - sequence = { - { glyph = "first", factor = 2 }, - { glyph = 0x2022, }, - { glyph = "first", factor = 2 }, - { glyph = "last" }, - } - } - } -}, + { + tweak = "addparts", + list = { + [0x21F4] = { + horizontal = true, + template = 0x2192, + sequence = { + { glyph = "first", factor = 2 }, + { glyph = 0x2022, }, + { glyph = "first", factor = 2 }, + { glyph = "last" }, + } + } + } + }, }, }, bigslots = { @@ -226,5 +204,3 @@ return { }, }, } - - diff --git a/tex/context/fonts/mkiv/termes-math.lfg b/tex/context/fonts/mkiv/termes-math.lfg index c5bcb3e84..6a54535df 100644 --- a/tex/context/fonts/mkiv/termes-math.lfg +++ b/tex/context/fonts/mkiv/termes-math.lfg @@ -17,11 +17,11 @@ local dimensions, kerns if CONTEXTLMTXMODE == 0 then end --- When set this will bypass the italic correction hackery! local integral_variants = { bottomright = -0.20 } --- local integral_top = { topright = 0.05 } local integral_bottom = { bottomright = -0.30 } +local common = fonts.goodies.load("common-math.lfg") +local presets = common.mathematics.tweaks.presets return { name = "termes-math", @@ -35,16 +35,16 @@ return { NoLimitSubFactor = 900, AccentTopShiftUp = -15, FlattenedAccentTopShiftUp = -15, - -- AccentExtendMargin = 50, + -- AccentExtendMargin = 50, -- AccentBaseHeight = 0, AccentBaseDepth = 50, RadicalDegreeBottomRaisePercent = 60, - RadicalRuleThickness = 46, -- 52 in font + RadicalRuleThickness = 46, -- 52 in font DelimiterPercent = 90, DelimiterShortfall = 400, DisplayOperatorMinHeight = 1800, -- 1300 in font (only one) - PrimeRaisePercent = 60, -- 50 default - PrimeRaiseComposedPercent = 10, -- 25 default + PrimeRaisePercent = 60, -- 50 default + PrimeRaiseComposedPercent = 10, -- 25 default }, tweaks = { aftercopying = { @@ -53,81 +53,45 @@ return { expected = "Version 1.543", }, { - tweak = "dimensions", - list = { - [0x1D44F] = { xoffset = 0, width = 1, italic = 0, anchor = 1.3 }, -- b - [0x1D451] = { xoffset = 0, width = 1, italic = 0, anchor = 0.8 }, -- d - [0x1D452] = { xoffset = 0, width = 1, italic = 0, anchor = 0.9 }, -- e - [0x0210E] = { xoffset = 0, width = 1, italic = 0, anchor = 1.3 }, -- h - [0x1D458] = { xoffset = 0, width = 1, italic = 0, anchor = 1.3 }, -- k - [0x1D453] = { xoffset = 0.6, width = 1.4, italic = 1.2, anchor = 1.5 }, -- f - [0x1D457] = { xoffset = 0.5, width = 1.3, italic = 1.7 }, -- j - [0x1D45D] = { xoffset = 0.15, width = 1.15, italic = 0, anchor = 1.4 }, -- p - [0x1D45E] = { xoffset = 0, width = 1, italic = 0, anchor = 0.9 }, -- q - [0x1D464] = { xoffset = 0, width = 1, italic = 0, anchor = 1.1 }, -- w - [0x1D6FE] = { xoffset = 0, width = 1, italic = 0, anchor = 1.1 }, -- \gamma - [0x1D706] = { xoffset = 0, width = 1, italic = 0, anchor = 1.05 }, -- \lambda - [0x1D70A] = { xoffset = 0, width = 1, italic = 0, anchor = 1.2 }, -- \omicron - [0x1D70F] = { xoffset = 0, width = 1, italic = 0, anchor = 1.05 }, -- \tau - }, + tweak = "fixprimes", + scale = 0.85, + -- smaller = true, + factor = 0.95, + }, + { + tweak = "addmirrors", }, + presets.matheulercalligraphic { rscale = 0.95 }, + presets.mathrsfscript { rscale = 0.95 }, + presets.mathxitsarabic { rscale = 0.88 }, + presets.moveitalics { correct = true }, { tweak = "kerns", list = { - [0x2F] = { - topleft = -0.2, - -- bottomleft = 0, - -- topright = 0, - bottomright = -0.2, - }, - - - ["0x7D.parts.top"] = { - topright = -0.15, - }, -- right brace top - ["0x7D.parts.bottom"] = { - bottomright = -0.15, - }, -- right brace bottom - ["0x7D.variants.*"] = { - topright = -0.1, - bottomright = -0.1, - }, -- right brace variants - ["0x29.parts.top"] = { - topright = -0.1, - }, -- right parenthesis top - ["0x29.parts.bottom"] = { - bottomright = -0.1, - }, -- right parenthesis bottom - ["0x29.variants.*"] = { - topright = -0.15, - bottomright = -0.15, - }, -- right parenthesis variants - ["0x221A.parts.top"] = { - topright = 0.2, - }, -- right radical top - ["0x221A.parts.bottom"] = { - bottomright = 0.2, - }, -- right radical bottom - ["0x221A.variants.*"] = { - topright = 0.2, - bottomright = 0.2, - }, -- right radical variants - - -- angle - [0x27E9] = { topright = -0.1, bottomright = -0.1 }, - ["0x27E9.variants.*"] = { topright = -0.2, bottomright = -0.2 }, - [0x27EB] = { topright = -0.1, bottomright = -0.1 }, - ["0x27EB.variants.*"] = { topright = -0.2, bottomright = -0.2 }, - - ["0x222B.variants.*"] = integral_variants, ["0x222B.parts.top"] = integral_top, ["0x222B.parts.bottom"] = integral_bottom, - ["0x222C.variants.*"] = integral_variants, ["0x222C.parts.top"] = integral_top, ["0x222C.parts.bottom"] = integral_bottom, - ["0x222D.variants.*"] = integral_variants, ["0x222D.parts.top"] = integral_top, ["0x222D.parts.bottom"] = integral_bottom, - ["0x222E.variants.*"] = integral_variants, ["0x222E.parts.top"] = integral_top, ["0x222E.parts.bottom"] = integral_bottom, - ["0x222F.variants.*"] = integral_variants, ["0x222F.parts.top"] = integral_top, ["0x222F.parts.bottom"] = integral_bottom, - ["0x2230.variants.*"] = integral_variants, ["0x2230.parts.top"] = integral_top, ["0x2230.parts.bottom"] = integral_bottom, - ["0x2231.variants.*"] = integral_variants, ["0x2231.parts.top"] = integral_top, ["0x2231.parts.bottom"] = integral_bottom, - ["0x2232.variants.*"] = integral_variants, ["0x2232.parts.top"] = integral_top, ["0x2232.parts.bottom"] = integral_bottom, - ["0x2233.variants.*"] = integral_variants, ["0x2233.parts.top"] = integral_top, ["0x2233.parts.bottom"] = integral_bottom, + [0x002F] = { topleft = -0.2, bottomright = -0.2 }, + ["0x7D.parts.top"] = { topright = -0.15, }, -- right brace top + ["0x7D.parts.bottom"] = { bottomright = -0.15 }, -- right brace bottom + ["0x7D.variants.*"] = { topright = -0.1, bottomright = -0.1 }, -- right brace variants + ["0x29.parts.top"] = { topright = -0.1, }, -- right parenthesis top + ["0x29.parts.bottom"] = { bottomright = -0.1 }, -- right parenthesis bottom + ["0x29.variants.*"] = { topright = -0.15, bottomright = -0.15 }, -- right parenthesis variants + ["0x221A.parts.top"] = { topright = 0.2, }, -- right radical top + ["0x221A.parts.bottom"] = { bottomright = 0.2 }, -- right radical bottom + ["0x221A.variants.*"] = { topright = 0.2, bottomright = 0.2 }, -- right radical variants + [0x27E9] = { topright = -0.1, bottomright = -0.1 }, -- angle + ["0x27E9.variants.*"] = { topright = -0.2, bottomright = -0.2 }, + [0x27EB] = { topright = -0.1, bottomright = -0.1 }, + ["0x27EB.variants.*"] = { topright = -0.2, bottomright = -0.2 }, + -- + ["0x222B.variants.*"] = integral_variants, ["0x222B.parts.top"] = integral_top, ["0x222B.parts.bottom"] = integral_bottom, + ["0x222C.variants.*"] = integral_variants, ["0x222C.parts.top"] = integral_top, ["0x222C.parts.bottom"] = integral_bottom, + ["0x222D.variants.*"] = integral_variants, ["0x222D.parts.top"] = integral_top, ["0x222D.parts.bottom"] = integral_bottom, + ["0x222E.variants.*"] = integral_variants, ["0x222E.parts.top"] = integral_top, ["0x222E.parts.bottom"] = integral_bottom, + ["0x222F.variants.*"] = integral_variants, ["0x222F.parts.top"] = integral_top, ["0x222F.parts.bottom"] = integral_bottom, + ["0x2230.variants.*"] = integral_variants, ["0x2230.parts.top"] = integral_top, ["0x2230.parts.bottom"] = integral_bottom, + ["0x2231.variants.*"] = integral_variants, ["0x2231.parts.top"] = integral_top, ["0x2231.parts.bottom"] = integral_bottom, + ["0x2232.variants.*"] = integral_variants, ["0x2232.parts.top"] = integral_top, ["0x2232.parts.bottom"] = integral_bottom, + ["0x2233.variants.*"] = integral_variants, ["0x2233.parts.top"] = integral_top, ["0x2233.parts.bottom"] = integral_bottom, }, }, -- Accents are a mess. We migrate the extensibles from the combiners to the base accent @@ -155,20 +119,18 @@ return { { tweak = "dimensions", list = { - -- here we want to apply to all - -- [0x00300] = { yoffset = -0.02, height = .95, all = true }, -- widegrave : 0x0060 - -- [0x00301] = { yoffset = -0.02, height = .95, all = true }, -- wideacute : 0x00B4 - -- [0x00302] = { yoffset = -0.03, height = .95, all = true }, -- widehat : 0x02C6 - -- [0x00303] = { yoffset = -0.02, height = .95, all = true }, -- widetilde : 0x02DC - -- [0x00306] = { yoffset = -0.03, height = .95, all = true }, -- widebre : 0x02D8 - -- [0x0030A] = { yoffset = 0.00, height = .95, all = true }, -- widering : 0x02DA - -- [0x0030C] = { yoffset = -0.03, height = .95, all = true }, -- widecheck : 0x02C7 - - -- [0x00304] = { yoffset = -0.05, height = .95, all = true }, -- widebar : 0x00AF - - -- [0x00307] = { yoffset = -0.03, height = .95, all = true }, -- widedot : 0x02D9 - -- [0x00308] = { yoffset = -0.03, height = .95, all = true }, -- wideddot : 0x00A8 - -- [0x020DB] = { yoffset = -0.015, height = .95, all = true }, -- widedddot : 0x20DB (self) + -- here we want to apply to all + -- [0x00300] = { yoffset = -0.02, height = .95, all = true }, -- widegrave : 0x0060 + -- [0x00301] = { yoffset = -0.02, height = .95, all = true }, -- wideacute : 0x00B4 + -- [0x00302] = { yoffset = -0.03, height = .95, all = true }, -- widehat : 0x02C6 + -- [0x00303] = { yoffset = -0.02, height = .95, all = true }, -- widetilde : 0x02DC + -- [0x00306] = { yoffset = -0.03, height = .95, all = true }, -- widebre : 0x02D8 + -- [0x0030A] = { yoffset = 0.00, height = .95, all = true }, -- widering : 0x02DA + -- [0x0030C] = { yoffset = -0.03, height = .95, all = true }, -- widecheck : 0x02C7 + -- [0x00304] = { yoffset = -0.05, height = .95, all = true }, -- widebar : 0x00AF + -- [0x00307] = { yoffset = -0.03, height = .95, all = true }, -- widedot : 0x02D9 + -- [0x00308] = { yoffset = -0.03, height = .95, all = true }, -- wideddot : 0x00A8 + -- [0x020DB] = { yoffset = -0.015, height = .95, all = true }, -- widedddot : 0x20DB (self) }, }, -- We now copy these to the not wide slots so that we can set these to stretch as well, @@ -177,13 +139,6 @@ return { tweak = "copyaccents", }, -- So far for the accents. - - { - tweak = "fixprimes", - scale = 0.85, - -- smaller = true, - factor = 0.95, - }, { tweak = "checkspacing", }, @@ -225,3 +180,25 @@ return { kerns = kerns, }, } + + + -- Do a testrun with hats on these: + -- { + -- tweak = "dimensions", + -- list = { + -- [0x1D44F] = { width = 1, italic = 0, anchor = 1.3 }, -- b + -- [0x1D451] = { width = 1, italic = 0, anchor = 0.8 }, -- d + -- [0x1D452] = { width = 1, italic = 0, anchor = 0.9 }, -- e + -- [0x0210E] = { width = 1, italic = 0, anchor = 1.3 }, -- h + -- [0x1D458] = { width = 1, italic = 0, anchor = 1.3 }, -- k + -- [0x1D453] = { xoffset = 0.6, width = 1.4, italic = 1.2, anchor = 1.5 }, -- f + -- [0x1D457] = { xoffset = 0.5, width = 1.3, italic = 1.7 }, -- j + -- [0x1D45D] = { xoffset = 0.15, width = 1.15, italic = 0, anchor = 1.4 }, -- p + -- [0x1D45E] = { width = 1, italic = 0, anchor = 0.9 }, -- q + -- [0x1D464] = { width = 1, italic = 0, anchor = 1.1 }, -- w + -- [0x1D6FE] = { width = 1, italic = 0, anchor = 1.1 }, -- \gamma + -- [0x1D706] = { width = 1, italic = 0, anchor = 1.05 }, -- \lambda + -- [0x1D70A] = { width = 1, italic = 0, anchor = 1.2 }, -- \omicron + -- [0x1D70F] = { width = 1, italic = 0, anchor = 1.05 }, -- \tau + -- }, + -- }, diff --git a/tex/context/fonts/mkiv/type-imp-concrete.mkiv b/tex/context/fonts/mkiv/type-imp-concrete.mkiv index 72b0141a5..5e4e6bc76 100644 --- a/tex/context/fonts/mkiv/type-imp-concrete.mkiv +++ b/tex/context/fonts/mkiv/type-imp-concrete.mkiv @@ -1,50 +1,62 @@ +%D \module +%D [ file=type-imp-erewhon, +%D version=2022.30.09, % a bit older +%D title=\CONTEXT\ Typescript Macros, +%D subtitle=\TEX Gyre Fonts, +%D author=Mikael Sundqvist, +%D date=\currentdate, +%D copyright={\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. + %\loadtypescriptfile[texgyre] %\resetfontfallback [concrete-euler-fix] %\definefontfallback[concrete-euler-fix][texgyrepagella-math] [0x022EE,0x022F0,0x022F1,0x02661,0x02220][force=yes] - \starttypescriptcollection[concrete] %\definefontfeature[default-slanted-concrete][default][slant=.2] %\definefontfeature[none-slanted-concrete] [none] [slant=.2] \starttypescript [\s!serif] [concrete-serif] - \definefontsynonym [\s!Serif] [\s!file:cmunorm] [\s!features=\s!default] - \definefontsynonym [\s!SerifItalic] [\s!file:cmunoti] [\s!features=\s!default] - \definefontsynonym [\s!SerifSlanted] [\s!file:cmunorm] [\s!features=default-slanted-concrete] - \definefontsynonym [\s!SerifBold] [\s!file:cmunobx] [\s!features=\s!default] - \definefontsynonym [\s!SerifBoldItalic] [\s!file:cmunobi] [\s!features=\s!default] - \definefontsynonym [\s!SerifBoldSlanted][\s!file:cmunobx] [\s!features=default-slanted-concrete] + \definefontsynonym [\s!Serif] [\s!file:cmunorm] [\s!features=\s!default] + \definefontsynonym [\s!SerifItalic] [\s!file:cmunoti] [\s!features=\s!default] + \definefontsynonym [\s!SerifSlanted] [\s!file:cmunorm] [\s!features=default-slanted-concrete] + \definefontsynonym [\s!SerifBold] [\s!file:cmunobx] [\s!features=\s!default] + \definefontsynonym [\s!SerifBoldItalic] [\s!file:cmunobi] [\s!features=\s!default] + \definefontsynonym [\s!SerifBoldSlanted] [\s!file:cmunobx] [\s!features=default-slanted-concrete] \stoptypescript \starttypescript [\s!sans] [concrete-sans] - \definefontsynonym [\s!Sans] [\s!file:cmunss] [\s!features=\s!default] - \definefontsynonym [\s!SansItalic] [\s!file:cmunsi] [\s!features=\s!default] - \definefontsynonym [\s!SansSlanted] [\s!file:cmunss] [\s!features=default-slanted-concrete] - \definefontsynonym [\s!SansBold] [\s!file:cmunsx] [\s!features=\s!default] - \definefontsynonym [\s!SansBoldItalic] [\s!file:cmunso] [\s!features=\s!default] - \definefontsynonym [\s!SansBoldSlanted] [\s!file:cmunsx] [\s!features=default-slanted-concrete] + \definefontsynonym [\s!Sans] [\s!file:cmunss] [\s!features=\s!default] + \definefontsynonym [\s!SansItalic] [\s!file:cmunsi] [\s!features=\s!default] + \definefontsynonym [\s!SansSlanted] [\s!file:cmunss] [\s!features=default-slanted-concrete] + \definefontsynonym [\s!SansBold] [\s!file:cmunsx] [\s!features=\s!default] + \definefontsynonym [\s!SansBoldItalic] [\s!file:cmunso] [\s!features=\s!default] + \definefontsynonym [\s!SansBoldSlanted] [\s!file:cmunsx] [\s!features=default-slanted-concrete] \stoptypescript \starttypescript [\s!mono] [concrete-mono] - \definefontsynonym [\s!Mono] [\s!file:cmuntt] [\s!features=\s!none] - \definefontsynonym [\s!MonoItalic] [\s!file:cmunit] [\s!features=\s!none] - \definefontsynonym [\s!MonoSlanted] [\s!file:cmunst] [\s!features=\s!none] - \definefontsynonym [\s!MonoBold] [\s!file:cmuntb] [\s!features=\s!none] - \definefontsynonym [\s!MonoBoldItalic] [\s!file:cmuntx] [\s!features=\s!none] - \definefontsynonym [\s!MonoBoldSlanted] [\s!file:cmuntb] [\s!features=none-slanted-concrete] + \definefontsynonym [\s!Mono] [\s!file:cmuntt] [\s!features=\s!none] + \definefontsynonym [\s!MonoItalic] [\s!file:cmunit] [\s!features=\s!none] + \definefontsynonym [\s!MonoSlanted] [\s!file:cmunst] [\s!features=\s!none] + \definefontsynonym [\s!MonoBold] [\s!file:cmuntb] [\s!features=\s!none] + \definefontsynonym [\s!MonoBoldItalic] [\s!file:cmuntx] [\s!features=\s!none] + \definefontsynonym [\s!MonoBoldSlanted] [\s!file:cmuntb] [\s!features=none-slanted-concrete] \stoptypescript \starttypescript [\s!math] [concrete-math] [\s!name] \loadfontgoodies[concrete-math] - \definefontsynonym[\s!MathRoman] [\s!file:Concrete-Math.otf] [\s!features=\s!math\mathsizesuffix,\s!goodies=concrete-math] + \definefontsynonym[\s!MathRoman] [\s!file:Concrete-Math.otf] [\s!features={\s!math\mathsizesuffix,mathextra,concrete:mathextra},\s!goodies=concrete-math] \stoptypescript \starttypescript [concrete] \definetypeface [concrete] [\s!rm] [\s!serif] [concrete-serif] [\s!default] - \definetypeface [concrete] [\s!ss] [\s!sans] [concrete-sans] [\s!default] - \definetypeface [concrete] [\s!tt] [\s!mono] [concrete-mono] [\s!default] - \definetypeface [concrete] [\s!mm] [\s!math] [concrete-math] [\s!default] + \definetypeface [concrete] [\s!ss] [\s!sans] [concrete-sans] [\s!default] + \definetypeface [concrete] [\s!tt] [\s!mono] [concrete-mono] [\s!default] + \definetypeface [concrete] [\s!mm] [\s!math] [concrete-math] [\s!default] \quittypescriptscanning \stoptypescript diff --git a/tex/context/fonts/mkiv/type-imp-erewhon.mkiv b/tex/context/fonts/mkiv/type-imp-erewhon.mkiv index b8efcd7f9..8f38fb8b0 100644 --- a/tex/context/fonts/mkiv/type-imp-erewhon.mkiv +++ b/tex/context/fonts/mkiv/type-imp-erewhon.mkiv @@ -1,44 +1,56 @@ +%D \module +%D [ file=type-imp-erewhon, +%D version=2022.30.09, % a bit older +%D title=\CONTEXT\ Typescript Macros, +%D subtitle=\TEX Gyre Fonts, +%D author=Mikael Sundqvist, +%D date=\currentdate, +%D copyright={\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. + %\loadtypescriptfile[texgyre] -%\resetfontfallback [erewhon-euler-fix] +%\resetfontfallback [erewhon-euler-fix] %\definefontfallback[erewhon-euler-fix][texgyrepagella-math] [0x022EE,0x022F0,0x022F1,0x02661,0x02220][force=yes] - \starttypescriptcollection[erewhon] %\definefontfeature[default-slanted-erewhon][default][slant=.2] %\definefontfeature[none-slanted-erewhon] [none] [slant=.2] \starttypescript [\s!serif] [erewhon-serif] - \definefontsynonym [\s!Serif] [\s!file:Erewhon-Regular] [\s!features=\s!default] - \definefontsynonym [\s!SerifItalic] [\s!file:Erewhon-Italic] [\s!features=\s!default] - \definefontsynonym [\s!SerifSlanted] [\s!file:Erewhon-RegularSlanted] [\s!features=\s!default] - \definefontsynonym [\s!SerifBold] [\s!file:Erewhon-Bold] [\s!features=\s!default] - \definefontsynonym [\s!SerifBoldItalic] [\s!file:Erewhon-BoldItalic] [\s!features=\s!default] + \definefontsynonym [\s!Serif] [\s!file:Erewhon-Regular] [\s!features=\s!default] + \definefontsynonym [\s!SerifItalic] [\s!file:Erewhon-Italic] [\s!features=\s!default] + \definefontsynonym [\s!SerifSlanted] [\s!file:Erewhon-RegularSlanted][\s!features=\s!default] + \definefontsynonym [\s!SerifBold] [\s!file:Erewhon-Bold] [\s!features=\s!default] + \definefontsynonym [\s!SerifBoldItalic] [\s!file:Erewhon-BoldItalic] [\s!features=\s!default] \definefontsynonym [\s!SerifBoldSlanted][\s!file:Erewhon-BoldSlanted] [\s!features=\s!default] \stoptypescript \starttypescript [\s!sans] [cabin-sans] - \definefontsynonym [\s!Sans] [\s!file:Cabin-Regular] [\s!features=\s!default] - \definefontsynonym [\s!SansItalic] [\s!file:Cabin-Italic] [\s!features=\s!default] - \definefontsynonym [\s!SansBold] [\s!file:Cabin-SemiBold] [\s!features=\s!default] - \definefontsynonym [\s!SansBoldItalic] [\s!file:Cabin-SemiBoldItalic] [\s!features=\s!default] + \definefontsynonym [\s!Sans] [\s!file:Cabin-Regular] [\s!features=\s!default] + \definefontsynonym [\s!SansItalic] [\s!file:Cabin-Italic] [\s!features=\s!default] + \definefontsynonym [\s!SansBold] [\s!file:Cabin-SemiBold] [\s!features=\s!default] + \definefontsynonym [\s!SansBoldItalic][\s!file:Cabin-SemiBoldItalic][\s!features=\s!default] \stoptypescript \starttypescript [\s!mono] [inconsolata-mono] - \definefontsynonym [\s!Mono] [\s!file:Inconsolatazi4-Regular] [\s!features=\s!none] - \definefontsynonym [\s!MonoBold] [\s!file:Inconsolatazi4-Bold] [\s!features=\s!none] + \definefontsynonym [\s!Mono] [\s!file:Inconsolatazi4-Regular][\s!features=\s!none] + \definefontsynonym [\s!MonoBold][\s!file:Inconsolatazi4-Bold] [\s!features=\s!none] \stoptypescript \starttypescript [\s!math] [erewhon-math] [\s!name] \loadfontgoodies[erewhon-math] - \definefontsynonym[\s!MathRoman] [\s!file:Erewhon-Math.otf] [\s!features=\s!math\mathsizesuffix,\s!goodies=erewhon-math] + \definefontsynonym [\s!MathRoman] [\s!file:Erewhon-Math.otf] [\s!features={\s!math\mathsizesuffix,erewhon:mathextra,mathextra},\s!goodies=erewhon-math] \stoptypescript \starttypescript [erewhon] - \definetypeface [erewhon] [\s!rm] [\s!serif] [erewhon-serif] [\s!default] - \definetypeface [erewhon] [\s!ss] [\s!sans] [cabin-sans] [\s!default] + \definetypeface [erewhon] [\s!rm] [\s!serif] [erewhon-serif] [\s!default] + \definetypeface [erewhon] [\s!ss] [\s!sans] [cabin-sans] [\s!default] \definetypeface [erewhon] [\s!tt] [\s!mono] [inconsolata-mono] [\s!default] [\s!rscale=1.1] - \definetypeface [erewhon] [\s!mm] [\s!math] [erewhon-math] [\s!default] + \definetypeface [erewhon] [\s!mm] [\s!math] [erewhon-math] [\s!default] \quittypescriptscanning \stoptypescript diff --git a/tex/context/fonts/mkiv/type-imp-euler.mkiv b/tex/context/fonts/mkiv/type-imp-euler.mkiv index 00df63458..1aea88aae 100644 --- a/tex/context/fonts/mkiv/type-imp-euler.mkiv +++ b/tex/context/fonts/mkiv/type-imp-euler.mkiv @@ -66,15 +66,11 @@ \stoptypescript \starttypescript [\s!math] [euleroverpagella] [\s!name] - \definefontsynonym [MathRoman] [texgyrepagella-math] [\s!features={\s!math\mathsizesuffix,mathextra},\s!fallbacks=euleroverpagella% - ,\s!goodies=pagella-with-euler-math% - ] + \definefontsynonym [MathRoman] [texgyrepagella-math] [\s!features={\s!math\mathsizesuffix,mathextra},\s!fallbacks=euleroverpagella,\s!goodies=pagella-with-euler-math] \stoptypescript \starttypescript [\s!math] [pagellaovereuler] [\s!name] - \definefontsynonym [MathRoman] [\s!file:euler.otf] [\s!features={\s!math\mathsizesuffix,mathextra},\s!fallbacks=pagellaovereuler% - ,\s!goodies=euler-with-pagella-math% - ] + \definefontsynonym [MathRoman] [\s!file:euler.otf] [\s!features={\s!math\mathsizesuffix,mathextra},\s!fallbacks=pagellaovereuler,\s!goodies=euler-with-pagella-math] \stoptypescript \starttypescript [pagella-with-euler] diff --git a/tex/context/fonts/mkiv/type-imp-latinmodern.mkiv b/tex/context/fonts/mkiv/type-imp-latinmodern.mkiv index cf5052c82..e8e8e353b 100644 --- a/tex/context/fonts/mkiv/type-imp-latinmodern.mkiv +++ b/tex/context/fonts/mkiv/type-imp-latinmodern.mkiv @@ -181,8 +181,8 @@ \starttypescript [\s!math] [modern,latin-modern] \loadfontgoodies[lm] - \definefontsynonym [LMMathRoman-Regular] [\v!file:latinmodern-math-regular.otf] [\s!features={\s!math\mathsizesuffix,lm-math,mathextra},\s!goodies=lm] - \definefontsynonym [LMMathRoman-Bold] [\v!file:latinmodern-math-regular.otf] [\s!features={\s!math\mathsizesuffix,lm-math-bold,lm-math,mathextra},\s!goodies=lm] + \definefontsynonym [LMMathRoman-Regular] [\v!file:latinmodern-math-regular.otf] [\s!features={\s!math\mathsizesuffix,lm:mathextra,lm-math,mathextra},\s!goodies=lm] + \definefontsynonym [LMMathRoman-Bold] [\v!file:latinmodern-math-regular.otf] [\s!features={\s!math\mathsizesuffix,lm:mathextra,lm-math-bold,lm-math,mathextra},\s!goodies=lm] \stoptypescript \starttypescript [modern-designsize-virtual] diff --git a/tex/context/fonts/mkiv/type-imp-newcomputermodern.mkiv b/tex/context/fonts/mkiv/type-imp-newcomputermodern.mkiv index 1c9788a98..73f7c4dbf 100644 --- a/tex/context/fonts/mkiv/type-imp-newcomputermodern.mkiv +++ b/tex/context/fonts/mkiv/type-imp-newcomputermodern.mkiv @@ -50,7 +50,7 @@ \starttypescript [\s!math][newcomputermodern] [\s!name] % \loadfontgoodies[newcomputermodern-math] ,\s!goodies=newcomputermodern-math \definefontsynonym[\s!MathRoman] [\s!file:newcmmath-regular][\s!features={\s!math\mathsizesuffix,mathextra},\s!goodies=lm] - \definefontsynonym[\s!MathRomanBold][\s!file:newcmmath-regular][\s!features={\s!math\mathsizesuffix,newcomputermodern-math-bold,mathextra}\s!goodies=lm] + \definefontsynonym[\s!MathRomanBold][\s!file:newcmmath-regular][\s!features={\s!math\mathsizesuffix,newcomputermodern-math-bold,mathextra},\s!goodies=lm] \stoptypescript \starttypescript [\s!serif] [newcomputermodern-book] [\s!name] diff --git a/tex/context/fonts/mkiv/type-imp-stix.mkiv b/tex/context/fonts/mkiv/type-imp-stix.mkiv index b76b1d09b..ed2b63909 100644 --- a/tex/context/fonts/mkiv/type-imp-stix.mkiv +++ b/tex/context/fonts/mkiv/type-imp-stix.mkiv @@ -35,32 +35,11 @@ \starttypescriptcollection[stix] - % version one - - \starttypescript [\s!math] [stix] [\s!name] - \definefontsynonym[MathRoman][\s!file:stixmath-regular.otf] [\s!features={\s!math\mathsizesuffix,mathextra}] - \stoptypescript - - \starttypescript [\s!serif] [stix] [\s!name] - \setups[\s!font:\s!fallback:\s!serif] - \definefontsynonym[\s!Serif] [\s!file:stix-regular.otf] [\s!features=\s!default] - \definefontsynonym[\s!SerifBold] [\s!file:stix-bold.otf] [\s!features=\s!default] - \definefontsynonym[\s!SerifItalic] [\s!file:stix-italic.otf] [\s!features=\s!default] - \definefontsynonym[\s!SerifBoldItalic][\s!file:stix-bolditalic.otf][\s!features=\s!default] - \stoptypescript - - \starttypescript[stix] - \definetypeface [stix] [\s!rm] [\s!serif] [stix] [\s!default] - \definetypeface [stix] [\s!mm] [\s!math] [stix] [\s!default] - \stoptypescript - - % version two - - \starttypescript [\s!math] [stixtwo] [\s!name] - \definefontsynonym[MathRoman][\s!file:stixtwomath-regular.otf] [\s!features={\s!math\mathsizesuffix,stixtwomath,mathextra},\s!goodies=stix-two-math] + \starttypescript [\s!math] [stix,stixtwo,xits] [\s!name] + \definefontsynonym[\s!MathRoman][\s!file:stixtwomath-regular.otf][\s!features={\s!math\mathsizesuffix,stixtwomath,mathextra},\s!goodies=stix-two-math] \stoptypescript - \starttypescript [\s!serif] [stixtwo] [\s!name] + \starttypescript [\s!serif] [stix,stixtwo,xits] [\s!name] \setups[\s!font:\s!fallback:\s!serif] \definefontsynonym[\s!Serif] [\s!file:stixtwotext-regular.otf] [\s!features=\s!default] \definefontsynonym[\s!SerifBold] [\s!file:stixtwotext-bold.otf] [\s!features=\s!default] @@ -68,11 +47,11 @@ \definefontsynonym[\s!SerifBoldItalic][\s!file:stixtwotext-bolditalic.otf][\s!features=\s!default] \stoptypescript - \starttypescript[stixtwo] + \starttypescript[stix,stixtwo,xits] \definetypeface [\typescriptone] [\s!rm] [\s!serif] [stixtwo] [\s!default] \definetypeface [\typescriptone] [\s!ss] [\s!serif] [stixtwo] [\s!default] \definetypeface [\typescriptone] [\s!tt] [\s!mono] [dejavu] [\s!default] [\s!rscale=0.895] - \definetypeface [\typescriptone] [\s!mm] [\s!math] [stixtwo] [\s!default] + \definetypeface [\typescriptone] [\s!mm] [\s!math] [stixtwo] [\s!default] [\s!direction=\s!both] \stoptypescript \stoptypescriptcollection diff --git a/tex/context/fonts/mkiv/type-imp-texgyre.mkiv b/tex/context/fonts/mkiv/type-imp-texgyre.mkiv index 24b982bb5..c6b0ab28b 100644 --- a/tex/context/fonts/mkiv/type-imp-texgyre.mkiv +++ b/tex/context/fonts/mkiv/type-imp-texgyre.mkiv @@ -229,7 +229,14 @@ \stoptypescriptcollection -% tricky: we cannot mix now as the file is loaded only once +% We no longer support tx and px in LMTX. These fonts were used in the transition from +% traditional (type one) fonts to the new gyre fonts. The LMTX distribution no longer +% ships these fonts anyway. + +\ifcase\contextlmtxmode \else + \disablemode[pxmath] + \disablemode[txmath] +\fi \startmode[txmath] @@ -252,8 +259,8 @@ \starttypescript [\s!math][times,termes][\s!all] % \loadfontgoodies[texgyre] % \definefontsynonym[\s!MathRoman][file:texgyre-termes-math-regular.otf][\s!features={\s!math\mathsizesuffix,mathextra},\s!goodies=texgyre] - \definefontsynonym[\s!MathRoman] [file:texgyretermes-math.otf][\s!features={\s!math\mathsizesuffix,mathextra},\s!goodies=termes-math] - \definefontsynonym[\s!MathRomanBold][file:texgyretermes-math.otf][\s!features={\s!math\mathsizesuffix,termes-math-bold,mathextra},\s!goodies=termes-math] + \definefontsynonym[\s!MathRoman] [file:texgyretermes-math.otf][\s!features={\s!math\mathsizesuffix,termes:mathextra,mathextra},\s!goodies=termes-math] + \definefontsynonym[\s!MathRomanBold][file:texgyretermes-math.otf][\s!features={\s!math\mathsizesuffix,termes:mathextra,termes-math-bold,mathextra},\s!goodies=termes-math] \stoptypescript \stoptypescriptcollection @@ -281,8 +288,8 @@ \starttypescript [\s!math][palatino,pagella][\s!all] % \loadfontgoodies[texgyre] % \definefontsynonym[\s!MathRoman][file:texgyre-pagella-math-regular.otf][\s!features={\s!math\mathsizesuffix,mathextra},\s!goodies=texgyre] - \definefontsynonym[\s!MathRoman] [file:texgyrepagella-math.otf][\s!features={\s!math\mathsizesuffix,mathextra},\s!goodies=pagella-math] - \definefontsynonym[\s!MathRomanBold][file:texgyrepagella-math.otf][\s!features={\s!math\mathsizesuffix,pagella-math-bold,mathextra},\s!goodies=pagella-math] + \definefontsynonym[\s!MathRoman] [file:texgyrepagella-math.otf][\s!features={\s!math\mathsizesuffix,pagella:mathextra,mathextra},\s!goodies=pagella-math] + \definefontsynonym[\s!MathRomanBold][file:texgyrepagella-math.otf][\s!features={\s!math\mathsizesuffix,pagella:mathextra,pagella-math-bold,mathextra},\s!goodies=pagella-math] \stoptypescript \stoptypescriptcollection @@ -294,8 +301,8 @@ \starttypescript [\s!math][bookman,bonum][\s!all] % \loadfontgoodies[texgyre] % \definefontsynonym[\s!MathRoman][file:texgyre-bonum-math-regular.otf][\s!features={\s!math\mathsizesuffix,mathextra},\s!goodies=texgyre] - \definefontsynonym[\s!MathRoman] [file:texgyrebonum-math.otf][\s!features={\s!math\mathsizesuffix,mathextra},\s!goodies=bonum-math] - \definefontsynonym[\s!MathRomanBold][file:texgyrebonum-math.otf][\s!features={\s!math\mathsizesuffix,bonum-math-bold,mathextra},\s!goodies=bonum-math] + \definefontsynonym[\s!MathRoman] [file:texgyrebonum-math.otf][\s!features={\s!math\mathsizesuffix,bonum:mathextra,mathextra},\s!goodies=bonum-math] + \definefontsynonym[\s!MathRomanBold][file:texgyrebonum-math.otf][\s!features={\s!math\mathsizesuffix,bonum:mathextra,bonum-math-bold,mathextra},\s!goodies=bonum-math] \stoptypescript \stoptypescriptcollection @@ -305,8 +312,8 @@ \starttypescript [\s!math][schoolbook,schola][\s!all] % \loadfontgoodies[texgyre] % \definefontsynonym[\s!MathRoman][file:texgyre-schola-math-regular.otf][\s!features={\s!math\mathsizesuffix,mathextra},\s!goodies=texgyre] - \definefontsynonym[\s!MathRoman] [file:texgyreschola-math.otf][\s!features={\s!math\mathsizesuffix,mathextra},\s!goodies=schola-math] - \definefontsynonym[\s!MathRomanBold][file:texgyreschola-math.otf][\s!features={\s!math\mathsizesuffix,schola-math-bold,mathextra},\s!goodies=schola-math] + \definefontsynonym[\s!MathRoman] [file:texgyreschola-math.otf][\s!features={\s!math\mathsizesuffix,schola:mathextra,mathextra},\s!goodies=schola-math] + \definefontsynonym[\s!MathRomanBold][file:texgyreschola-math.otf][\s!features={\s!math\mathsizesuffix,schola:mathextra,schola-math-bold,mathextra},\s!goodies=schola-math] \stoptypescript \stoptypescriptcollection diff --git a/tex/context/fonts/mkiv/type-imp-xits.mkiv b/tex/context/fonts/mkiv/type-imp-xits.mkiv index f2d3e83c3..ce8d4209d 100644 --- a/tex/context/fonts/mkiv/type-imp-xits.mkiv +++ b/tex/context/fonts/mkiv/type-imp-xits.mkiv @@ -25,10 +25,10 @@ \starttypescript [\s!math] [xits,xitsbidi] [\s!name] \loadfontgoodies[xits-math] - \definefontsynonym[\s!MathRoman ][\s!file:xitsmath-regular.otf] [\s!features={\s!math\mathsizesuffix,mathextra,xitsmath},\s!goodies=xits-math] + \definefontsynonym[\s!MathRoman ][\s!file:xitsmath-regular.otf] [\s!features={\s!math\mathsizesuffix ,mathextra,xitsmath},\s!goodies=xits-math] \definefontsynonym[\s!MathRoman L2R][\s!file:xitsmath-regular.otf] [\s!features={\s!math\mathsizesuffix-l2r,mathextra,xitsmath},\s!goodies=xits-math] \definefontsynonym[\s!MathRoman R2L][\s!file:xitsmath-regular.otf] [\s!features={\s!math\mathsizesuffix-r2l,mathextra,xitsmath},\s!goodies=xits-math] - \definefontsynonym[\s!MathRomanBold ][\s!file:xitsmath-bold.otf] [\s!features={\s!math\mathsizesuffix,mathextra,xitsmath},\s!goodies=xits-math] + \definefontsynonym[\s!MathRomanBold ][\s!file:xitsmath-bold.otf] [\s!features={\s!math\mathsizesuffix ,mathextra,xitsmath},\s!goodies=xits-math] \definefontsynonym[\s!MathRomanBold L2R][\s!file:xitsmath-bold.otf] [\s!features={\s!math\mathsizesuffix-l2r,mathextra,xitsmath},\s!goodies=xits-math] \definefontsynonym[\s!MathRomanBold R2L][\s!file:xitsmath-bold.otf] [\s!features={\s!math\mathsizesuffix-r2l,mathextra,xitsmath},\s!goodies=xits-math] \stoptypescript diff --git a/tex/context/fonts/mkiv/xits-math.lfg b/tex/context/fonts/mkiv/xits-math.lfg index cf3050369..374f03a0e 100644 --- a/tex/context/fonts/mkiv/xits-math.lfg +++ b/tex/context/fonts/mkiv/xits-math.lfg @@ -1,3 +1,7 @@ +-- When testing XITS in LMTX one has to do this: +-- +-- \definefilesynonym [type-imp-xits.mkiv] [type-imp-xits.mkiv] + return { name = "xits-math", version = "1.00", @@ -15,6 +19,25 @@ return { }, }, mathematics = { + parameters = { + NoLimitSupFactor = 0, + NoLimitSubFactor = 1000, + -- AccentBaseHeight = 0, + AccentBaseDepth = 30, + FlattenedAccentTopShiftUp = 0, -- now also set, the wide ones (so we can move in one go) + -- AccentExtendMargin = 50, + RadicalDegreeBottomRaisePercent = 65, + -- RadicalKernBeforeDegree = 500, + RadicalKernAfterDegree = -500, + RadicalVerticalGap = 10, + -- RadicalRuleThickness = 68, -- 68 in font (but shifted down) + DelimiterPercent = 90, + DelimiterShortfall = 400, + DisplayOperatorMinHeight = 1800, -- 1800 in font + PrimeRaisePercent = 75, -- 50 default + PrimeRaiseComposedPercent = 10, -- 25 default + + }, tweaks = { aftercopying = { { @@ -69,6 +92,10 @@ return { { tweak = "addrules", }, + { + tweak = "setoptions", + set = { "ignorekerndimensions" } + }, }, }, alternates = { diff --git a/tex/context/modules/mkiv/s-fonts-charts.mkiv b/tex/context/modules/mkiv/s-fonts-charts.mkiv index b7fcc9f9e..6fe58c899 100644 --- a/tex/context/modules/mkiv/s-fonts-charts.mkiv +++ b/tex/context/modules/mkiv/s-fonts-charts.mkiv @@ -172,10 +172,10 @@ \starttext -% \showfontchart[filename=texgyredejavu-math.otf,page=yes,option=all] + \showfontchart[filename=texgyredejavu-math.otf,page=yes,option=all] - \showfontchart[filename=danlan.otf] % ,page=yes,option=all] - \showfontchart[filename=danlan-bold.otf] % ,page=yes,option=all] +% \showfontchart[filename=danlan.otf] % ,page=yes,option=all] +% \showfontchart[filename=danlan-bold.otf] % ,page=yes,option=all] % \showfontchart[filename=aegean,page=yes] % \showfontchart[filename=veramono.ttf,page=yes] diff --git a/tex/context/modules/mkiv/s-fonts-coverage.mkiv b/tex/context/modules/mkiv/s-fonts-coverage.mkiv index 2d1870842..a4ae9d211 100644 --- a/tex/context/modules/mkiv/s-fonts-coverage.mkiv +++ b/tex/context/modules/mkiv/s-fonts-coverage.mkiv @@ -31,16 +31,18 @@ \continueifinputfile{s-fonts-coverage.mkiv} +% \usemodule[fonts-coverage] + \usemodule[art-01] \starttext - \showfontcomparison - [list={texgyrepagella-regular.otf,texgyretermes-regular.otf,texgyrebonum-regular.otf}, - pattern=ogonek] - % \showfontcomparison -% [list={texgyrepagella-regular.otf,texgyretermes-regular.otf,nimbusroman-regular.afm}] +% [list={texgyrepagella-regular.otf,texgyretermes-regular.otf,texgyrebonum-regular.otf}, +% pattern=ogonek] + + \showfontcomparison + [list={texgyrepagella-regular.otf,texgyretermes-regular.otf,nimbusroman-regular.afm}] \page diff --git a/tex/context/modules/mkiv/s-fonts-shapes.lua b/tex/context/modules/mkiv/s-fonts-shapes.lua index 868c22da1..d55b1198e 100644 --- a/tex/context/modules/mkiv/s-fonts-shapes.lua +++ b/tex/context/modules/mkiv/s-fonts-shapes.lua @@ -83,16 +83,21 @@ local function showglyphshape(specification) local characters = tfmdata.characters local descriptions = tfmdata.descriptions local parameters = tfmdata.parameters + local tfmfactor = parameters.scaledpoints/10 +-- inspect(tfmdata.parameters) +-- inspect(tfmdata.properties) local anchors = fonts.helpers.collectanchors(tfmdata) - local function showonecharacter(unicode) + local function showonecharacter(unicode,krn,tight) local c = characters [unicode] local d = descriptions[unicode] if c and d then local factor = (parameters.size/parameters.units)*((7200/7227)/65536) local llx, lly, urx, ury = unpack(d.boundingbox) + local height = ury + local depth = lly llx, lly, urx, ury = llx*factor, lly*factor, urx*factor, ury*factor - local width = (d.width or 0)*factor + local width = (d.width or 0)*factor context.start() context.dontleavehmode() context.obeyMPboxdepth() @@ -110,76 +115,52 @@ local function showglyphshape(specification) context('draw boundingbox p withcolor .2white withpen pencircle scaled .065bp ;') context("defaultscale := 0.05 ; ") -- inefficient but non critical - local slant = { - function(v,dx,dy,txt,xsign,ysign,loc,labloc) - local n = #v - if n > 0 then - local l = { } - for i=1,n do - local c = v[i] - local h = c.height or 0 - local k = c.kern or 0 - l[i] = formatters["((%s,%s) shifted (%s,%s))"](xsign*k*factor,ysign*h*factor,dx,dy) - end - context("draw ((%s,%s) shifted (%s,%s))--%s dashed (evenly scaled 1/16) withcolor .5white;", xsign*v[1].kern*factor,lly,dx,dy,l[1]) - context("draw laddered (%..t) withcolor .5white ;",l) -- why not "--" - context("draw ((%s,%s) shifted (%s,%s))--%s dashed (evenly scaled 1/16) withcolor .5white;", xsign*v[#v].kern*factor,ury,dx,dy,l[#l]) - for i=1,n do - context("draw %s withcolor blue withpen pencircle scaled 2lw ;",l[i]) + function slant(v,dx,dy,txt,xsign,ysign,loc,labloc,shift) + local n = #v + if n > 0 then + local l = { } + local t = { } + for i=1,n do + local c = v[i] + local h = c.height or height or 0 + local d = depth or 0 + local k = c.kern or 0 + if i == 1 then + l[1] = formatters["((%s,%s) shifted (%s,%s))"](xsign*k*factor,d*factor,dx,dy) + t[1] = formatters['draw textext.%s("\\tttf(%s,%s)") scaled .025 shifted %s shifted (%i/4,%i/3);'](labloc,k,d,l[1],shift,shift); end + l[i+1] = formatters["((%s,%s) shifted (%s,%s))"](xsign*k*factor,ysign*h*factor,dx,dy) + t[i+1] = formatters['draw textext.%s("\\tttf(%s,%s)") scaled .025 shifted %s shifted (%i/4,%i/3);'](labloc,k,h,l[i+1],shift,shift); end - end, - function(v,dx,dy,txt,xsign,ysign,loc,labloc) - local n = #v - if n > 0 then - local l = { } - for i=1,n do - local c = v[i] - local h = c.height or 0 - local k = c.kern or 0 - l[i] = formatters["((%s,%s) shifted (%s,%s))"](xsign*k*factor,ysign*h*factor,dx,dy) - end - if loc == "top" then - context('label.%s("\\type{%s}",%s shifted (0,-1bp)) ;',loc,txt,l[n]) - else - context('label.%s("\\type{%s}",%s shifted (0,2bp)) ;',loc,txt,l[1]) - end - for i=1,n do - local c = v[i] - local h = c.height or 0 - local k = c.kern or 0 - context('label.top("(%s,%s)",%s shifted (0,-2bp));',k,h,l[i]) - end + context("draw laddered (%--t) withcolor .5white ;",l) + for i=1,#l do + context("draw %s withcolor blue withpen pencircle scaled 2lw ;",l[i]) + context(t[i]) end - end, - } + end + end -- local math = d.math if math then local kerns = math.kerns if kerns then - for i=1,#slant do - local s = slant[i] - for k, v in next, kerns do - if k == "topright" then - -- s(v,width+italic,0,k,1,1,"top","ulft") - s(v,width,0,k,1,1,"top","ulft") - elseif k == "bottomright" then - s(v,width,0,k,1,1,"bot","lrt") - elseif k == "topleft" then - s(v,0,0,k,-1,1,"top","ulft") - elseif k == "bottomleft" then - s(v,0,0,k,-1,1,"bot","lrt") - end + for k, v in next, kerns do + if k == "topright" and (krn == "all" or krn == k) then + slant(v,width,0,k,1,1,"top","lrt",1) + elseif k == "bottomright" and (krn == "all" or krn == k) then + slant(v,width,0,k,1,1,"bot","ulft",-1) + elseif k == "topleft" and (krn == "all" or krn == k) then + slant(v,0,0,k,-1,1,"top","lrt",1) + elseif k == "bottomleft" and (krn == "all" or krn == k) then + slant(v,0,0,k,-1,1,"bot","ulft",-1) end end end - local accent = math.accent + local accent = math.topanchor or math.accent if accent and accent ~= 0 then local a = accent * factor - context('draw (%s,%s+1bp)--(%s,%s-1bp) withcolor blue;',a,ury,a,ury) - context('label.bot("\\type{%s}",(%s,%s+1bp));',"accent",a,ury) - context('label.top("%s",(%s,%s-1bp));',math.accent,a,ury) + context('draw (%s,%s+1/4)--(%s,%s-1/4) withcolor blue;',a,ury,a,ury) + context('draw textext.top("\\tttf%s") scaled .025 shifted (%s,%s+2/4);',accent,a,ury) end end -- @@ -215,7 +196,29 @@ local function showglyphshape(specification) context('label.rt("%s",(%s-2bp,%s-1bp));',italic,width+i,ury) end context('draw origin withcolor red withpen pencircle scaled 2lw;') - context("setbounds currentpicture to boundingbox currentpicture enlarged 1bp ;") + local kern = c.topright + if kern and kern ~= 0 then + local k = kern * factor / tfmfactor + context('draw (%s,%s) withcolor "orange" withpen pencircle scaled .2 ;',width+k,ury) + end + local kern = c.bottomright + if kern and kern ~= 0 then + local k = kern * factor / tfmfactor + context('draw (%s,%s) withcolor "orange" withpen pencircle scaled .2 ;',width+k,lly) + end + local kern = c.topleft + if kern and kern ~= 0 then + local k = kern * factor / tfmfactor + context('draw (%s,%s) withcolor "orange" withpen pencircle scaled .2 ;',-k,ury) + end + local kern = c.bottomleft + if kern and kern ~= 0 then + local k = kern * factor / tfmfactor + context('draw (%s,%s) withcolor "orange" withpen pencircle scaled .2 ;',-k,lly) + end + if not tight then + context("setbounds currentpicture to boundingbox currentpicture enlarged 1bp ;") + end context("currentpicture := currentpicture scaled 8 ;") context.stopMPcode() context.stop() @@ -226,16 +229,28 @@ local function showglyphshape(specification) fonts.helpers.nametoslot(specification.character) if unicode then - showonecharacter(unicode) + showonecharacter(unicode,"all",true) else context.modulefontsstartshowglyphshapes() for unicode, description in fonts.iterators.descriptions(tfmdata) do if unicode >= 0x110000 then break end + local kerns = specification.kerns + if kerns then + local k = description and description.math and description.math.kerns + if k then + if not (kerns == "all" or k[kerns]) then + goto DONE + end + else + goto DONE + end + end context.modulefontsstartshowglyphshape(unicode,description.name or "",description.index or 0) - showonecharacter(unicode) + showonecharacter(unicode,kerns,false) context.modulefontsstopshowglyphshape() + ::DONE:: end context.modulefontsstopshowglyphshapes() end diff --git a/tex/context/modules/mkiv/s-fonts-shapes.mkiv b/tex/context/modules/mkiv/s-fonts-shapes.mkiv index 7dd39c07d..97fcbfa6c 100644 --- a/tex/context/modules/mkiv/s-fonts-shapes.mkiv +++ b/tex/context/modules/mkiv/s-fonts-shapes.mkiv @@ -30,7 +30,7 @@ \startsetups module:showallglyphshapes:start \unexpanded\def\modulefontsstartshowglyphshape##1##2##3{ - \startTEXpage[\c!offset=\exheight] % ,\c!frame=\v!on] + \startTEXpage[\c!offset=\exheight]% ,\c!frame=\v!on] \edef\lastshownglyphshapefieldunicode{##1}% \edef\lastshownglyphshapefieldname {##2}% \edef\lastshownglyphshapefieldindex {##3}% @@ -106,8 +106,11 @@ % \startTEXpage \ShowGlyphShape{simplenaskhi}{100bp}{0xF0299} \stopTEXpage % \startTEXpage \ShowGlyphShape{simplenaskhi}{100bp}{NameMe.1190} \stopTEXpage - \startTEXpage[offset=0pt]\ShowGlyphShape{file:stixtwomath-regular.otf}{20bp}{0x1D44A}\stopTEXpage - \startTEXpage[offset=0pt]\ShowGlyphShape{file:stixtwomath-regular.otf}{20bp}{0x1D44C}\stopTEXpage +% \startTEXpage[offset=0pt]\ShowGlyphShape{file:stixtwomath-regular.otf}{20bp}{0x1D44A}\stopTEXpage +% \startTEXpage[offset=0pt]\ShowGlyphShape{file:stixtwomath-regular.otf}{20bp}{0x1D44C}\stopTEXpage + +% \definefontfeature[tg][goodies=pagella-math] +% \startTEXpage[offset=0pt]\ShowGlyphShape{file:texgyrepagella-math.otf*tg}{20bp}{0x002F}\stopTEXpage % \startTEXpage[offset=0pt]\ShowGlyphShape{name:cambria-math}{20bp}{0x00066}\stopTEXpage % \startTEXpage[offset=0pt]\ShowGlyphShape{name:cambria-math}{20bp}{0x1D453}\stopTEXpage @@ -126,7 +129,12 @@ % \startTEXpage[offset=0pt]\ShowGlyphShape{file:husayninotebold.ttf}{50bp}{0x006DD}\stopTEXpage % \startTEXpage[offset=0pt]\ShowGlyphShape{file:arabtype.ttf}{50bp}{0x0FCA1}\stopTEXpage -% \showallglyphshapes[name=name:cambria-math,size=100bp] +\showallglyphshapes[name=name:cambria-math,size=100bp,kerns=bottomright] +% \startTEXpage[offset=0pt]\ShowGlyphShape{name:cambria-math}{100bp}{0x1D6FD}\stopTEXpage + +% \showallglyphshapes[name=file:lucidabrightmathot,size=100bp,kerns=all] +% \showallglyphshapes[name=file:garamondmath,size=100bp,kerns=bottomright] + % \showallglyphshapes[name=name:arabtype,size=100bp] % \showallglyphshapes[name=file:husayninotebold.ttf,size=100bp] % \showallglyphshapes[name=name:dejavuserif,size=100bp] diff --git a/tex/context/modules/mkiv/s-math-characters.lua b/tex/context/modules/mkiv/s-math-characters.lua index b634a203f..a967f7934 100644 --- a/tex/context/modules/mkiv/s-math-characters.lua +++ b/tex/context/modules/mkiv/s-math-characters.lua @@ -185,7 +185,7 @@ function moduledata.math.characters.showlist(specification) round(char.height or 0), round(char.depth or 0), round(char.italic or 0), - round(char.topaccent or 0) + round(char.topanchor or char.topaccent or 0) ) end if virtual and commands then diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index c539d886c..c87c4ee52 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 : 2022-09-16 14:39 +-- merge date : 2022-10-14 10:13 do -- begin closure to overcome local limits and interference @@ -13418,10 +13418,10 @@ do result.familyotherblues={ unpack(stack,1,top) } top=0 end+P("\10")/function() - result.strhw=stack[top] + result.stdhw=stack[top] top=0 end+P("\11")/function() - result.strvw=stack[top] + result.stdvw=stack[top] top=0 end+P("\13")/function() result.uniqueid=stack[top] @@ -13493,7 +13493,7 @@ do result.bluescale=stack[top] top=0 end+P("\10")/function() - result.bluesnap=stack[top] + result.blueshift=stack[top] top=0 end+P("\11")/function() result.bluefuzz=stack[top] @@ -13547,7 +13547,7 @@ do top=0 end ) - local remap={ + local remap_1={ ["\x00"]="00",["\x01"]="01",["\x02"]="02",["\x03"]="03",["\x04"]="04",["\x05"]="05",["\x06"]="06",["\x07"]="07",["\x08"]="08",["\x09"]="09",["\x0A"]="0.",["\x0B"]="0E",["\x0C"]="0E-",["\x0D"]="0",["\x0E"]="0-",["\x0F"]="0", ["\x10"]="10",["\x11"]="11",["\x12"]="12",["\x13"]="13",["\x14"]="14",["\x15"]="15",["\x16"]="16",["\x17"]="17",["\x18"]="18",["\x19"]="19",["\x1A"]="1.",["\x1B"]="1E",["\x1C"]="1E-",["\x1D"]="1",["\x1E"]="1-",["\x1F"]="1", ["\x20"]="20",["\x21"]="21",["\x22"]="22",["\x23"]="23",["\x24"]="24",["\x25"]="25",["\x26"]="26",["\x27"]="27",["\x28"]="28",["\x29"]="29",["\x2A"]="2.",["\x2B"]="2E",["\x2C"]="2E-",["\x2D"]="2",["\x2E"]="2-",["\x2F"]="2", @@ -13563,8 +13563,13 @@ do ["\xC0"]="E-0",["\xC1"]="E-1",["\xC2"]="E-2",["\xC3"]="E-3",["\xC4"]="E-4",["\xC5"]="E-5",["\xC6"]="E-6",["\xC7"]="E-7",["\xC8"]="E-8",["\xC9"]="E-9",["\xCA"]="E-.",["\xCB"]="E-E",["\xCC"]="E-E-",["\xCD"]="E-",["\xCE"]="E--",["\xCF"]="E-", ["\xD0"]="-0",["\xD1"]="-1",["\xD2"]="-2",["\xD3"]="-3",["\xD4"]="-4",["\xD5"]="-5",["\xD6"]="-6",["\xD7"]="-7",["\xD8"]="-8",["\xD9"]="-9",["\xDA"]="-.",["\xDB"]="-E",["\xDC"]="-E-",["\xDD"]="-",["\xDE"]="--",["\xDF"]="-", } - local p_last=S("\x0F\x1F\x2F\x3F\x4F\x5F\x6F\x7F\x8F\x9F\xAF\xBF")+R("\xF0\xFF") - local p_nibbles=P("\30")*Cs(((1-p_last)/remap)^0*(P(1)/remap))/function(n) + local remap_2={ + ["\x0F"]="0",["\x1F"]="1",["\x2F"]="2",["\x3F"]="3",["\x4F"]="4", + ["\x5F"]="5",["\x6F"]="6",["\x7F"]="7",["\x8F"]="8",["\x9F"]="9", + } + local p_last_1=S("\x0F\x1F\x2F\x3F\x4F\x5F\x6F\x7F\x8F\x9F\xAF\xBF") + local p_last_2=R("\xF0\xFF") + local p_nibbles=P("\30")*Cs(((1-(p_last_1+p_last_2))/remap_1)^0*(p_last_1/remap_2+p_last_2/""))/function(n) top=top+1 stack[top]=tonumber(n) or 0 end @@ -15378,6 +15383,8 @@ function readers.cff(f,fontdata,specification) cffinfo.bluefuzz=data.bluefuzz cffinfo.stdhw=data.stdhw cffinfo.stdvw=data.stdvw + cffinfo.stemsnaph=data.stemsnaph + cffinfo.stemsnapv=data.stemsnapv end end cleanup(data,dictionaries) @@ -18461,6 +18468,7 @@ do local noflookups=#lookups local lookupprefix=sub(what,2,2) local usedlookups=false + local allsteps={} for lookupid=1,noflookups do local lookup=lookups[lookupid] local lookuptype=lookup.type @@ -18495,6 +18503,7 @@ do steps[nofsteps]=step local rules=step.rules if rules then + allsteps[#allsteps+1]=step for i=1,#rules do local rule=rules[i] local before=rule.before @@ -18600,11 +18609,8 @@ do reported[name]=true end end - for i=lastsequence+1,nofsequences do - local sequence=sequences[i] - local steps=sequence.steps - for i=1,#steps do - local step=steps[i] + for i=1,#allsteps do + local step=allsteps[i] local rules=step.rules if rules then for i=1,#rules do @@ -18674,7 +18680,6 @@ do end end end - end for i,n in sortedhash(sublookupcheck) do local l=lookups[i] local t=l.type @@ -19097,7 +19102,7 @@ local function readmathglyphinfo(f,fontdata,offset) if not math then glyph.math={ accent=accent } else - math.accent=accent + math.accent=accent end end end @@ -21289,7 +21294,7 @@ local trace_defining=false registertracker("fonts.defining",function(v) trace_d local report_otf=logs.reporter("fonts","otf loading") local fonts=fonts local otf=fonts.handlers.otf -otf.version=3.120 +otf.version=3.121 otf.cache=containers.define("fonts","otl",otf.version,true) otf.svgcache=containers.define("fonts","svg",otf.version,true) otf.pngcache=containers.define("fonts","png",otf.version,true) @@ -27329,12 +27334,8 @@ local trace_testruns=false registertracker("otf.testruns",function(v) trace_tes local forcediscretionaries=false local forcepairadvance=false local repeatablemultiples=context or false -directives.register("otf.forcediscretionaries",function(v) - forcediscretionaries=v -end) -directives.register("otf.forcepairadvance",function(v) - forcepairadvance=v -end) +directives.register("otf.forcediscretionaries",function(v) forcediscretionaries=v end) +directives.register("otf.forcepairadvance",function(v) forcepairadvance=v end) local report_direct=logs.reporter("fonts","otf direct") local report_subchain=logs.reporter("fonts","otf subchain") local report_chain=logs.reporter("fonts","otf chain") @@ -27356,7 +27357,6 @@ local setboth=nuts.setboth local getid=nuts.getid local getstate=nuts.getstate local getsubtype=nuts.getsubtype -local setsubtype=nuts.setsubtype local getchar=nuts.getchar local setchar=nuts.setchar local getdisc=nuts.getdisc @@ -27376,10 +27376,10 @@ local flushcomponents=components.flush local ischar=nuts.ischar local usesfont=nuts.usesfont local insertnodeafter=nuts.insertafter -local copy_node=nuts.copy -local copy_node_list=nuts.copylist -local remove_node=nuts.remove -local find_node_tail=nuts.tail +local copynode=nuts.copy +local copynodelist=nuts.copylist +local removenode=nuts.remove +local findnodetail=nuts.tail local flushnodelist=nuts.flushlist local flushnode=nuts.flushnode local endofmath=nuts.endofmath @@ -27389,7 +27389,6 @@ local setmetatableindex=table.setmetatableindex local nextnode=nuts.traversers.node local nodecodes=nodes.nodecodes local glyphcodes=nodes.glyphcodes -local disccodes=nodes.disccodes local glyph_code=nodecodes.glyph local glue_code=nodecodes.glue local disc_code=nodecodes.disc @@ -27398,8 +27397,7 @@ local dir_code=nodecodes.dir local par_code=nodecodes.par local lefttoright_code=nodes.dirvalues.lefttoright local righttoleft_code=nodes.dirvalues.righttoleft -local discretionarydisc_code=disccodes.discretionary -local ligatureglyph_code=glyphcodes.ligature +local discretionarydisc_code=nodes.disccodes.discretionary local a_noligature=attributes.private("noligature") local injections=nodes.injections local setmark=injections.setmark @@ -27490,7 +27488,7 @@ local function cref(dataset,sequence,index) return "no valid dataset" end local merged=sequence.merged and "merged " or "" - if index then + if index and index>1 then return formatters["feature %a, type %a, %schain lookup %a, index %a"]( dataset[4],sequence.type,merged,sequence.name,index) else @@ -27547,7 +27545,7 @@ end local function appenddisc(disc,list) local pre,post,replace,pretail,posttail,replacetail=getdisc(disc,true) local posthead=list - local replacehead=copy_node_list(list) + local replacehead=copynodelist(list) if post then setlink(posttail,posthead) else @@ -27574,7 +27572,6 @@ local function markstoligature(head,start,stop,char) end resetinjection(base) setchar(base,char) - setsubtype(base,ligatureglyph_code) setcomponents(base,start) setlink(prev,base,next) flushcomponents(start) @@ -27612,7 +27609,6 @@ local function toligature(head,start,stop,char,dataset,sequence,skiphash,discfou end resetinjection(base) setchar(base,char) - setsubtype(base,ligatureglyph_code) setcomponents(base,comp) setlink(prev,base,next) if not discfound then @@ -27632,7 +27628,7 @@ local function toligature(head,start,stop,char,dataset,sequence,skiphash,discfou if trace_marks then logwarning("%s: keep ligature mark %s, gets index %s",pref(dataset,sequence),gref(char),getligaindex(start)) end - local n=copy_node(start) + local n=copynode(start) copyinjection(n,start) head,current=insertnodeafter(head,current,n) elseif trace_marks then @@ -27696,57 +27692,57 @@ end local function multiple_glyphs(head,start,multiple,skiphash,what,stop) local nofmultiples=#multiple if nofmultiples>0 then + local first=start resetinjection(start) setchar(start,multiple[1]) if nofmultiples>1 then - local sn=getnext(start) - for k=2,nofmultiples do - local n=copy_node(start) + for i=2,nofmultiples do + local n=copynode(start) resetinjection(n) - setchar(n,multiple[k]) + setchar(n,multiple[i]) insertnodeafter(head,start,n) start=n end - if what~=true and repeatablemultiples then - local kind=type(what) - local m,f,l - if kind=="string" then - local what,n=string.match(what,"^repeat(.-)[:=](%d+)$") - if what=="middle" then - m=tonumber(n) - elseif what=="first" then - f=tonumber(n) - elseif what=="last" then - l=tonumber(n) - end - elseif kind=="table" then - m=what.middle - f=what.first - l=what.last - end - if f or m or l then - if m and m>1 and nofmultiples==3 then - local middle=getnext(first) - for i=2,m do - local n=copynode(middle) - resetinjection(n) - insertnodeafter(head,first,n) - end - end - if f and f>1 then - for i=2,f do - local n=copynode(first) - resetinjection(n) - insertnodeafter(head,first,n) - end - end - if l and l>1 then - for i=2,l do - local n=copynode(start) - resetinjection(n) - insertnodeafter(head,start,n) - start=n - end + end + if what~=true and repeatablemultiples then + local kind=type(what) + local m,f,l + if kind=="string" then + local what,n=string.match(what,"^repeat(.-)[:=](%d+)$") + if what=="middle" then + m=tonumber(n) + elseif what=="first" then + f=tonumber(n) + elseif what=="last" then + l=tonumber(n) + end + elseif kind=="table" then + m=what.middle + f=what.first + l=what.last + end + if f or m or l then + if m and m>1 and nofmultiples==3 then + local middle=getnext(first) + for i=2,m do + local n=copynode(middle) + resetinjection(n) + insertnodeafter(head,first,n) + end + end + if f and f>1 then + for i=2,f do + local n=copynode(first) + resetinjection(n) + insertnodeafter(head,first,n) + end + end + if l and l>1 then + for i=2,l do + local n=copynode(start) + resetinjection(n) + insertnodeafter(head,start,n) + start=n end end end @@ -27918,9 +27914,9 @@ function handlers.gsub_ligature(head,start,dataset,sequence,ligature,rlmode,skip local prev=getprev(start) if stop then setnext(stop) - local copy=copy_node_list(start) + local copy=copynodelist(start) local tail=stop - local liat=find_node_tail(copy) + local liat=findnodetail(copy) if pre then setlink(liat,pre) end @@ -27931,7 +27927,7 @@ function handlers.gsub_ligature(head,start,dataset,sequence,ligature,rlmode,skip replace=start else setnext(start) - local copy=copy_node(start) + local copy=copynode(start) if pre then setlink(copy,pre) end @@ -28308,7 +28304,7 @@ function chainprocs.gsub_remove(head,start,stop,dataset,sequence,currentlookup,r if trace_chains then logprocess("%s: removing character %s",cref(dataset,sequence,chainindex),gref(getchar(start))) end - head,start=remove_node(head,start,true) + head,start=removenode(head,start,true) return head,getprev(start),true end function chainprocs.gsub_single(head,start,stop,dataset,sequence,currentlookup,rlmode,skiphash,chainindex) @@ -28821,7 +28817,7 @@ do if not userkern then local thekern=nuts.new("kern",1) local setkern=nuts.setkern userkern=function(k) - local n=copy_node(thekern) + local n=copynode(thekern) setkern(n,k) return n end @@ -28858,26 +28854,33 @@ local function setdiscchecked(d,pre,post,replace) setdisc(d,pre,post,replace) end local noflags={ false,false,false,false } -local function chainrun(head,start,last,dataset,sequence,rlmode,skiphash,ck) +local function chainrun(head,start,last,dataset,sequence,rlmode,skiphash,ck,where) local size=ck[5]-ck[4]+1 local chainlookups=ck[6] local done=false if chainlookups then if size==1 then local chainlookup=chainlookups[1] - for j=1,#chainlookup do - local chainstep=chainlookup[j] - local chainkind=chainstep.type - local chainproc=chainprocs[chainkind] - if chainproc then - local ok - head,start,ok=chainproc(head,start,last,dataset,sequence,chainstep,rlmode,skiphash,1) - if ok then - done=true + if chainlookup then + for j=1,#chainlookup do + local chainstep=chainlookup[j] + if chainstep then + local chainkind=chainstep.type + local chainproc=chainprocs[chainkind] + if chainproc then + local ok + head,start,ok=chainproc(head,start,last,dataset,sequence,chainstep,rlmode,skiphash,1) + if ok then + done=true + end + else + logprocess("%s: %s is not yet supported (1)",cref(dataset,sequence),chainkind) + end + else + logprocess("%s: has an issue (1)",cref(dataset,sequence)) end - else - logprocess("%s: %s is not yet supported (1)",cref(dataset,sequence),chainkind) end + else end else local i=1 @@ -28902,20 +28905,24 @@ local function chainrun(head,start,last,dataset,sequence,rlmode,skiphash,ck) if chainlookup then for j=1,#chainlookup do local chainstep=chainlookup[j] - local chainkind=chainstep.type - local chainproc=chainprocs[chainkind] - if chainproc then - local ok,n - head,start,ok,n=chainproc(head,start,last,dataset,sequence,chainstep,rlmode,skiphash,i) - if ok then - done=true - if n and n>1 and i+n>nofchainlookups then - i=size - break + if chainstep then + local chainkind=chainstep.type + local chainproc=chainprocs[chainkind] + if chainproc then + local ok,n + head,start,ok,n=chainproc(head,start,last,dataset,sequence,chainstep,rlmode,skiphash,i) + if ok then + done=true + if n and n>1 and i+n>nofchainlookups then + i=size + break + end end + else + logprocess("%s: %s is not yet supported (2)",cref(dataset,sequence),chainkind) end else - logprocess("%s: %s is not yet supported (2)",cref(dataset,sequence),chainkind) + logprocess("%s: has an issue (2)",cref(dataset,sequence)) end end else @@ -28939,7 +28946,7 @@ local function chainrun(head,start,last,dataset,sequence,rlmode,skiphash,ck) else done=true if trace_contexts then - logprocess("%s: skipping match",cref(dataset,sequence)) + logprocess("%s: skipping match @ %i",cref(dataset,sequence),where) end end end @@ -28966,6 +28973,8 @@ local function chaindisk(head,start,dataset,sequence,rlmode,skiphash,ck) local last=start local prev=getprev(start) local hasglue=false + local useddisc=nil + local usedstart=start local i=f while i<=l do local id=getid(current) @@ -29028,7 +29037,7 @@ local function chaindisk(head,start,dataset,sequence,rlmode,skiphash,ck) tail=prev setprev(current,sweepnode) else - tail=find_node_tail(head) + tail=findnodetail(head) end setnext(sweepnode,current) setprev(head) @@ -29139,13 +29148,13 @@ local function chaindisk(head,start,dataset,sequence,rlmode,skiphash,ck) head=lookaheaddisc end local pre,post,replace=getdisc(lookaheaddisc) - local new=copy_node_list(cf) + local new=copynodelist(cf) local cnew=new if pre then - setlink(find_node_tail(cf),pre) + setlink(findnodetail(cf),pre) end if replace then - local tail=find_node_tail(new) + local tail=findnodetail(new) setlink(tail,replace) end for i=1,insertedmarks do @@ -29159,14 +29168,14 @@ local function chaindisk(head,start,dataset,sequence,rlmode,skiphash,ck) end if not notmatchpre[lookaheaddisc] then local ok=false - cf,start,ok=chainrun(cf,start,cl,dataset,sequence,rlmode,skiphash,ck) + cf,start,ok=chainrun(cf,start,cl,dataset,sequence,rlmode,skiphash,ck,1) if ok then done=true end end if not notmatchreplace[lookaheaddisc] then local ok=false - new,cnew,ok=chainrun(new,cnew,clast,dataset,sequence,rlmode,skiphash,ck) + new,cnew,ok=chainrun(new,cnew,clast,dataset,sequence,rlmode,skiphash,ck,2) if ok then done=true end @@ -29177,6 +29186,7 @@ local function chaindisk(head,start,dataset,sequence,rlmode,skiphash,ck) setdisc(lookaheaddisc,cf,post,new) end start=getprev(lookaheaddisc) + useddisc=lookaheaddisc sweephead[cf]=getnext(clast) or false sweephead[new]=getnext(cl) or false elseif backtrackdisc then @@ -29198,8 +29208,8 @@ local function chaindisk(head,start,dataset,sequence,rlmode,skiphash,ck) setprev(cf) setnext(cl) local pre,post,replace,pretail,posttail,replacetail=getdisc(backtrackdisc,true) - local new=copy_node_list(cf) - local cnew=find_node_tail(new) + local new=copynodelist(cf) + local cnew=findnodetail(new) for i=1,insertedmarks do cnew=getprev(cnew) end @@ -29209,14 +29219,14 @@ local function chaindisk(head,start,dataset,sequence,rlmode,skiphash,ck) end if not notmatchpost[backtrackdisc] then local ok=false - cf,start,ok=chainrun(cf,start,last,dataset,sequence,rlmode,skiphash,ck) + cf,start,ok=chainrun(cf,start,last,dataset,sequence,rlmode,skiphash,ck,3) if ok then done=true end end if not notmatchreplace[backtrackdisc] then local ok=false - new,cnew,ok=chainrun(new,cnew,clast,dataset,sequence,rlmode,skiphash,ck) + new,cnew,ok=chainrun(new,cnew,clast,dataset,sequence,rlmode,skiphash,ck,4) if ok then done=true end @@ -29237,30 +29247,55 @@ local function chaindisk(head,start,dataset,sequence,rlmode,skiphash,ck) setdisc(backtrackdisc,pre,post,replace) end start=getprev(backtrackdisc) + useddisc=backtrackdisc sweephead[post]=getnext(clast) or false sweephead[replace]=getnext(last) or false else local ok=false - head,start,ok=chainrun(head,start,last,dataset,sequence,rlmode,skiphash,ck) + head,start,ok=chainrun(head,start,last,dataset,sequence,rlmode,skiphash,ck,5) if ok then done=true end end - return head,start,done -end -local function chaintrac(head,start,dataset,sequence,rlmode,skiphash,ck,match,discseen,sweepnode) - local rule=ck[1] - local lookuptype=ck[8] or ck[2] - local nofseq=#ck[3] - local first=ck[4] - local last=ck[5] - local char=getchar(start) - logwarning("%s: rule %s %s at char %s for (%s,%s,%s) chars, lookuptype %a, %sdisc seen, %ssweeping", - cref(dataset,sequence),rule,match and "matches" or "nomatch", - gref(char),first-1,last-first+1,nofseq-last,lookuptype, - discseen and "" or "no ",sweepnode and "" or "not ") + if useddisc and start~=usedstart then + start=getnext(start) + end + return head,start,done,useddisc +end +local chaintrac do + local level=0 + local last={} + chaintrac=function(head,start,dataset,sequence,rlmode,skiphash,ck,match,discseen,sweepnode) + if dataset then + level=level+1 + last[level]=start + local rule=ck[1] + local lookuptype=ck[8] or ck[2] + local nofseq=#ck[3] + local first=ck[4] + local last=ck[5] + local char=getchar(start) + logwarning("+ %i : %s: rule %s %s at char %s for (%s,%s,%s) chars, lookuptype %a, %sdisc seen, %ssweeping", + level,cref(dataset,sequence),rule,match and "matches" or "nomatch", + gref(char),first-1,last-first+1,nofseq-last,lookuptype, + discseen and "" or "no ",sweepnode and "" or "not ") + else + local what=start and "done" or "continue" + local where=head==last[level] and "same" or "different" + local char=getchar(head) + if char then + logwarning("- %i : %s at char %s, %s node",level,what,gref(char),where) + else + logwarning("- %i : %s, %s node",level,what,where) + end + level=level-1 + end + end end local function handle_contextchain(head,start,dataset,sequence,contexts,rlmode,skiphash) + if not contexts then + return head,start,false + end local sweepnode=sweepnode local sweeptype=sweeptype local postreplace @@ -29288,7 +29323,7 @@ local function handle_contextchain(head,start,dataset,sequence,contexts,rlmode,s local ck=contexts[k] local seq=ck[3] local f=ck[4] -local last=start + local last=start if not startchar or not seq[f][startchar] then goto next end @@ -29399,7 +29434,6 @@ local last=start end end if f>1 then - if startprev then local prev=startprev if prereplace and prev==checkdisc then prev=getprev(sweepnode) @@ -29514,9 +29548,6 @@ local last=start else goto next end - else - goto next - end end if s>l then local current=last and getnext(last) @@ -29640,12 +29671,15 @@ local last=start if discseen or sweepnode then head,start,done=chaindisk(head,start,dataset,sequence,rlmode,skipped and skiphash,ck) else - head,start,done=chainrun(head,start,last,dataset,sequence,rlmode,skipped and skiphash,ck) + head,start,done=chainrun(head,start,last,dataset,sequence,rlmode,skipped and skiphash,ck,6) + end + if trace_contexts then + chaintrac(start,done) end if done then break end - ::next:: + ::next:: end if discseen then notmatchpre={} @@ -29662,15 +29696,26 @@ handlers.gpos_context=handle_contextchain local function chained_contextchain(head,start,stop,dataset,sequence,currentlookup,rlmode,skiphash) local steps=currentlookup.steps local nofsteps=currentlookup.nofsteps - if nofsteps>1 then - reportmoresteps(dataset,sequence) - end - local l=steps[1].coverage[getchar(start)] - if l then - return handle_contextchain(head,start,dataset,sequence,l,rlmode,skiphash) + local char=getchar(start) + if nofsteps==1 then + local s=steps[1] + local l=s.coverage[char] + if l then + return handle_contextchain(head,start,dataset,sequence,l,rlmode,skiphash) + end else - return head,start,false + for i=1,nofsteps do + local s=steps[i] + local l=s.coverage[char] + if l then + local h,s,d=handle_contextchain(head,start,dataset,sequence,l,rlmode,skiphash) + if d then + return h,s,d + end + end + end end + return head,start,false end chainprocs.gsub_context=chained_contextchain chainprocs.gsub_contextchain=chained_contextchain @@ -29853,7 +29898,7 @@ local function kernrun(disc,k_run,font,attr,...) if done and trace_testruns then report_disc("done",disc) end - return nextstart,done + return nextstart end local function comprun(disc,c_run,...) if trace_compruns then @@ -29896,8 +29941,12 @@ local function comprun(disc,c_run,...) end setdisc(disc,pre,post,replace) end - return getnext(disc),renewed + return getnext(disc) end +local test_flatten_start=2 +directives.register("otf.testrun.forceflatten",function(v) + test_flatten_start=v and 1 or 2 +end) local function testrun(disc,t_run,c_run,...) if trace_testruns then report_disc("test",disc) @@ -29925,7 +29974,7 @@ local function testrun(disc,t_run,c_run,...) local d=d_replace>d_post and d_replace or d_post local head=getnext(disc) local tail=head - for i=2,d do + for i=test_flatten_start,d do local nx=getnext(tail) local id=getid(nx) if id==disc_code then @@ -29939,7 +29988,7 @@ local function testrun(disc,t_run,c_run,...) next=getnext(tail) setnext(tail) setprev(head) - local new=copy_node_list(head) + local new=copynodelist(head) if posttail then setlink(posttail,head) else @@ -30002,7 +30051,7 @@ local function testrun(disc,t_run,c_run,...) report_disc("done",disc) end end - return getnext(disc),renewed + return getnext(disc) end local nesting=0 local function c_run_single(head,font,attr,lookupcache,step,dataset,sequence,rlmode,skiphash,handler) @@ -30420,7 +30469,7 @@ do head=h end elseif typ=="gsub_reversecontextchain" then - local start=find_node_tail(head) + local start=findnodetail(head) local rlmode=0 local merged=steps.merged while start do @@ -30498,13 +30547,12 @@ do start=getnext(start) elseif id==disc_code then if not discs or discs[start]==true then - local ok if gpossing then - start,ok=kernrun(start,k_run_single,font,attr,lookupcache,step,dataset,sequence,rlmode,skiphash,handler) + start=kernrun(start,k_run_single,font,attr,lookupcache,step,dataset,sequence,rlmode,skiphash,handler) elseif forcetestrun then - start,ok=testrun(start,t_run_single,c_run_single,font,attr,lookupcache,step,dataset,sequence,rlmode,skiphash,handler) + start=testrun(start,t_run_single,c_run_single,font,attr,lookupcache,step,dataset,sequence,rlmode,skiphash,handler) else - start,ok=comprun(start,c_run_single,font,attr,lookupcache,step,dataset,sequence,rlmode,skiphash,handler) + start=comprun(start,c_run_single,font,attr,lookupcache,step,dataset,sequence,rlmode,skiphash,handler) end else start=getnext(start) @@ -30568,13 +30616,12 @@ do start=getnext(start) elseif id==disc_code then if not discs or discs[start]==true then - local ok if gpossing then - start,ok=kernrun(start,k_run_multiple,font,attr,steps,nofsteps,dataset,sequence,rlmode,skiphash,handler) + start=kernrun(start,k_run_multiple,font,attr,steps,nofsteps,dataset,sequence,rlmode,skiphash,handler) elseif forcetestrun then - start,ok=testrun(start,t_run_multiple,c_run_multiple,font,attr,steps,nofsteps,dataset,sequence,rlmode,skiphash,handler) + start=testrun(start,t_run_multiple,c_run_multiple,font,attr,steps,nofsteps,dataset,sequence,rlmode,skiphash,handler) else - start,ok=comprun(start,c_run_multiple,font,attr,steps,nofsteps,dataset,sequence,rlmode,skiphash,handler) + start=comprun(start,c_run_multiple,font,attr,steps,nofsteps,dataset,sequence,rlmode,skiphash,handler) end else start=getnext(start) @@ -31074,6 +31121,10 @@ local function addfeature(data,feature,specifications,prepareonly) end local descriptions=data.descriptions local resources=data.resources + if not descriptions or not resources then + report_otf("missing specification") + return + end local features=resources.features local sequences=resources.sequences if not features or not sequences then @@ -33297,7 +33348,7 @@ local function reorder_two(head,start,stop,font,attr,nbspaces) local subpos=nil local postpos=nil reorderreph.coverage={} - rephbase[font]={} + rephbase[font]={} for i=1,#seqsubset do local subset=seqsubset[i] local kind=subset[1] @@ -33418,7 +33469,7 @@ local function reorder_two(head,start,stop,font,attr,nbspaces) end end end - local current,base,firstcons=start,nil,nil + local current,base,firstcons,subnotafterbase,postnotafterbase=start,nil,nil,nil,nil if getstate(start,s_rphf) then current=getnext(getnext(start)) end @@ -33474,7 +33525,7 @@ local function reorder_two(head,start,stop,font,attr,nbspaces) logprocess("reorder two, handle nbsp") end end - else + else local last=getnext(stop) while current~=last do local next=getnext(current) @@ -33537,8 +33588,8 @@ local function reorder_two(head,start,stop,font,attr,nbspaces) logprocess("reorder two, handle matra") end end - if dependent_vowel[char] then - if pre_mark[char] then + if not moved[current] and dependent_vowel[char] then + if pre_mark[char] then moved[current]=true local prev,next=getboth(current) setlink(prev,next) @@ -34012,11 +34063,11 @@ local function analyze_next_chars_two(c,font) if pre_mark[v] and not already_pre_mark then already_pre_mark=true elseif post_mark[v] and not already_post_mark then - if devanagarihash[font].conjuncts=="mixed" then - return c - else - already_post_mark=true - end + if devanagarihash[font].conjuncts=="mixed" then + return c + else + already_post_mark=true + end elseif below_mark[v] and not already_below_mark then already_below_mark=true elseif above_mark[v] and not already_above_mark then @@ -37079,7 +37130,7 @@ local afm=fonts.handlers.afm local pfb=fonts.handlers.pfb local hashes=fonts.hashes local identifiers=hashes.identifiers -local version=otf.version or 0.011 +local version=otf.version or 0.013 local shapescache=containers.define("fonts","shapes",version,true) local streamscache=containers.define("fonts","streams",version,true) local compact_streams=false @@ -37926,17 +37977,19 @@ if not modules then modules={} end modules ['font-imp-italics']={ copyright="PRAGMA ADE / ConTeXt Development Team", license="see context related readme files" } -local next=next +local next,tonumber=next,tonumber local fonts=fonts local handlers=fonts.handlers local registerotffeature=handlers.otf.features.register local registerafmfeature=handlers.afm.features.register local function initialize(tfmdata,key,value) + local factor=tonumber(value) or 1 for unicode,character in next,tfmdata.characters do local olditalic=character.italic if olditalic and olditalic~=0 then character.width=character.width+olditalic character.italic=0 + character.bottomright=-factor*olditalic end end end -- cgit v1.2.3