From adc43c3c243ed95215af6fe02d71e393c178da23 Mon Sep 17 00:00:00 2001 From: Context Git Mirror Bot Date: Thu, 19 Nov 2015 20:15:06 +0100 Subject: 2015-11-19 19:15:00 --- .../lexers/data/scite-context-data-context.lua | 2 +- .../context/lexers/data/scite-context-data-tex.lua | 6 +- .../context/scite-context-data-context.properties | 126 ++--- .../context/scite-context-data-tex.properties | 381 ++++++------- doc/context/documents/general/manuals/luatex.pdf | Bin 910917 -> 996235 bytes doc/context/scripts/mkiv/mtx-plain.html | 53 ++ doc/context/scripts/mkiv/mtx-plain.man | 42 ++ doc/context/scripts/mkiv/mtx-plain.xml | 20 + .../general/manuals/luatex/luatex-enhancements.tex | 47 +- .../general/manuals/luatex/luatex-fonts.tex | 5 + .../general/manuals/luatex/luatex-languages.tex | 17 + .../general/manuals/luatex/luatex-libraries.tex | 463 ++++++++++++---- .../sources/general/manuals/luatex/luatex-lua.tex | 11 +- .../sources/general/manuals/luatex/luatex-math.tex | 478 +++++++++++++++-- .../manuals/luatex/luatex-modifications.tex | 259 ++++++++- .../general/manuals/luatex/luatex-nodes.tex | 175 +++--- .../general/manuals/luatex/luatex-style.tex | 2 + .../sources/general/manuals/luatex/luatex.tex | 2 +- fonts/pfm/hoekwater/context/contnav.pfm | Bin 482 -> 0 bytes fonts/pfm/hoekwater/context/koeieletters.pfm | Bin 2798 -> 0 bytes fonts/pfm/jmn/hans/hans-sh.pfm | Bin 754 -> 0 bytes fonts/pfm/jmn/hans/hans.pfm | Bin 748 -> 0 bytes fonts/type1/hoekwater/context/contnav.pfm | Bin 0 -> 482 bytes fonts/type1/hoekwater/context/koeieletters.pfm | Bin 0 -> 2798 bytes fonts/type1/jmn/hans/hans-sh.pfm | Bin 0 -> 754 bytes fonts/type1/jmn/hans/hans.pfm | Bin 0 -> 748 bytes scripts/context/lua/mtx-plain.lua | 10 +- scripts/context/lua/mtxrun.lua | 20 +- scripts/context/stubs/mswin/mtxrun.lua | 20 +- scripts/context/stubs/unix/mtxrun | 20 +- scripts/context/stubs/win64/mtxrun.lua | 20 +- tex/context/base/anch-pos.lua | 10 +- tex/context/base/back-exp.lua | 3 - tex/context/base/back-ini.mkiv | 47 +- tex/context/base/back-pdf.lua | 71 ++- tex/context/base/back-pdf.mkiv | 145 +---- tex/context/base/buff-par.mkvi | 2 +- tex/context/base/catc-ini.mkiv | 8 +- tex/context/base/char-ini.lua | 33 +- tex/context/base/chem-ini.mkiv | 2 + tex/context/base/cldf-ini.lua | 9 + tex/context/base/cont-new.mkiv | 2 +- tex/context/base/context-version.pdf | Bin 4188 -> 4190 bytes tex/context/base/context.mkii | 1 + tex/context/base/context.mkiv | 2 +- tex/context/base/core-env.lua | 347 ++++++------ tex/context/base/core-sys.lua | 7 +- tex/context/base/font-cff.lua | 2 +- tex/context/base/font-chk.lua | 4 +- tex/context/base/font-col.lua | 6 +- tex/context/base/font-con.lua | 8 +- tex/context/base/font-ctx.lua | 6 +- tex/context/base/font-dsp.lua | 304 ++++++----- tex/context/base/font-fbk.lua | 24 +- tex/context/base/font-hsh.lua | 22 + tex/context/base/font-lib.mkvi | 8 - tex/context/base/font-nod.lua | 23 +- tex/context/base/font-osd.lua | 203 +++---- tex/context/base/font-otf.lua | 28 +- tex/context/base/font-otj.lua | 169 +++--- tex/context/base/font-otl.lua | 12 +- tex/context/base/font-otn.lua | 78 +-- tex/context/base/font-oto.lua | 11 +- tex/context/base/font-otr.lua | 31 +- tex/context/base/font-ots.lua | 593 ++++++++------------- tex/context/base/font-pre.mkiv | 11 +- tex/context/base/font-sol.lua | 40 +- tex/context/base/font-tfm.lua | 43 +- tex/context/base/hand-ini.mkiv | 17 +- tex/context/base/lang-def.mkiv | 7 +- tex/context/base/lang-hyp.lua | 22 +- tex/context/base/lang-ini.mkii | 4 +- tex/context/base/lang-rep.lua | 30 +- tex/context/base/lpdf-ano.lua | 2 + tex/context/base/lpdf-fld.lua | 6 + tex/context/base/lpdf-fmt.lua | 85 ++- tex/context/base/lpdf-ini.lua | 87 ++- tex/context/base/lpdf-mis.lua | 17 +- tex/context/base/lpdf-nod.lua | 112 ++-- tex/context/base/lpdf-pua.xml | 202 +++++++ tex/context/base/lpdf-res.lua | 39 ++ tex/context/base/lpdf-tag.lua | 26 +- tex/context/base/lpdf-xmp.lua | 8 +- tex/context/base/luat-cod.lua | 2 +- tex/context/base/m-newotf.mkiv | 2 - tex/context/base/m-nodechart.lua | 8 +- tex/context/base/math-dim.lua | 6 + tex/context/base/math-dir.lua | 6 +- tex/context/base/math-frc.mkiv | 37 ++ tex/context/base/math-ini.mkiv | 40 +- tex/context/base/math-map.lua | 28 +- tex/context/base/math-noa.lua | 467 ++++++++-------- tex/context/base/math-tag.lua | 14 +- tex/context/base/meta-ini.mkiv | 7 +- tex/context/base/meta-pdh.mkiv | 4 +- tex/context/base/mlib-pps.mkiv | 6 +- tex/context/base/mult-de.mkii | 1 + tex/context/base/mult-def.lua | 14 +- tex/context/base/mult-dim.mkvi | 2 + tex/context/base/mult-en.mkii | 1 + tex/context/base/mult-fr.mkii | 1 + tex/context/base/mult-ini.lua | 10 - tex/context/base/mult-it.mkii | 1 + tex/context/base/mult-low.lua | 2 +- tex/context/base/mult-nl.mkii | 1 + tex/context/base/mult-pe.mkii | 1 + tex/context/base/mult-prm.lua | 75 ++- tex/context/base/mult-ro.mkii | 1 + tex/context/base/node-acc.lua | 10 +- tex/context/base/node-aux.lua | 29 +- tex/context/base/node-bck.lua | 19 +- tex/context/base/node-fin.lua | 11 + tex/context/base/node-fnt.lua | 21 +- tex/context/base/node-ini.lua | 52 +- tex/context/base/node-ltp.lua | 178 ++----- tex/context/base/node-mig.lua | 23 +- tex/context/base/node-nut.lua | 144 ++--- tex/context/base/node-ppt.lua | 3 - tex/context/base/node-ref.lua | 97 ++-- tex/context/base/node-res.lua | 24 +- tex/context/base/node-rul.lua | 21 +- tex/context/base/node-shp.lua | 24 +- tex/context/base/node-tra.lua | 33 +- tex/context/base/node-typ.lua | 12 +- tex/context/base/pack-bck.mkvi | 18 +- tex/context/base/pack-obj.lua | 197 ++++++- tex/context/base/pack-obj.mkiv | 434 ++++----------- tex/context/base/page-brk.mkiv | 4 + tex/context/base/page-imp.mkiv | 8 +- tex/context/base/page-lin.mkvi | 2 +- tex/context/base/page-mix.lua | 23 +- tex/context/base/page-mix.mkiv | 2 +- tex/context/base/page-set.mkiv | 4 +- tex/context/base/page-txt.mkvi | 6 +- tex/context/base/publ-imp-apa.mkvi | 41 +- tex/context/base/publ-imp-aps.mkvi | 26 +- tex/context/base/publ-imp-author.mkvi | 2 +- tex/context/base/publ-imp-cite.mkvi | 6 +- tex/context/base/publ-imp-default.mkvi | 2 +- tex/context/base/publ-imp-definitions.mkvi | 10 +- tex/context/base/publ-imp-list.mkvi | 4 +- tex/context/base/scrn-but.lua | 2 +- tex/context/base/scrn-but.mkvi | 2 +- tex/context/base/scrn-fld.mkvi | 3 - tex/context/base/scrn-hlp.mkvi | 2 +- tex/context/base/scrn-ref.mkvi | 12 +- tex/context/base/scrn-wid.mkvi | 2 +- tex/context/base/scrp-cjk.lua | 9 +- tex/context/base/spac-ali.mkiv | 5 +- tex/context/base/spac-hor.mkiv | 9 +- tex/context/base/spac-prf.lua | 33 +- tex/context/base/spac-ver.lua | 19 +- tex/context/base/spac-ver.mkiv | 8 + tex/context/base/status-files.pdf | Bin 24435 -> 24446 bytes tex/context/base/status-lua.pdf | Bin 256381 -> 257653 bytes tex/context/base/status-mkiv.lua | 5 + tex/context/base/strc-mar.lua | 2 - tex/context/base/strc-mar.mkiv | 2 +- tex/context/base/strc-mat.mkiv | 50 ++ tex/context/base/supp-box.lua | 28 +- tex/context/base/supp-fil.mkii | 20 +- tex/context/base/supp-tpi.mkii | 2 +- tex/context/base/syst-aux.mkiv | 4 +- tex/context/base/syst-ini.mkii | 145 ++++- tex/context/base/syst-ini.mkiv | 271 +++++----- tex/context/base/syst-lua.lua | 12 - tex/context/base/syst-lua.mkiv | 38 -- tex/context/base/tabl-xtb.lua | 10 +- tex/context/base/task-ini.lua | 8 +- tex/context/base/toks-ini.lua | 396 +++++++------- tex/context/base/toks-scn.lua | 2 + tex/context/base/toks-tra.lua | 404 +++++++------- tex/context/base/trac-deb.lua | 53 +- tex/context/base/trac-log.lua | 14 +- tex/context/base/trac-tex.lua | 112 ++-- tex/context/base/trac-vis.lua | 146 ++--- tex/context/base/typo-bld.lua | 112 +++- tex/context/base/typo-bld.mkiv | 4 + tex/context/base/typo-brk.lua | 43 +- tex/context/base/typo-cap.lua | 21 +- tex/context/base/typo-chr.lua | 5 +- tex/context/base/typo-cln.lua | 6 +- tex/context/base/typo-del.mkiv | 2 + tex/context/base/typo-dha.lua | 43 +- tex/context/base/typo-dig.lua | 15 +- tex/context/base/typo-drp.lua | 121 +---- tex/context/base/typo-dua.lua | 20 +- tex/context/base/typo-dub.lua | 20 +- tex/context/base/typo-krn.lua | 26 +- tex/context/base/typo-lin.lua | 15 +- tex/context/base/typo-mar.lua | 2 +- tex/context/base/typo-mar.mkiv | 3 +- tex/context/base/typo-tal.lua | 7 +- tex/context/interface/cont-cs.xml | 20 +- tex/context/interface/keys-cs.xml | 5 +- tex/context/interface/keys-de.xml | 1 + tex/context/interface/keys-en.xml | 1 + tex/context/interface/keys-fr.xml | 1 + tex/context/interface/keys-it.xml | 1 + tex/context/interface/keys-nl.xml | 1 + tex/context/interface/keys-pe.xml | 1 + tex/context/interface/keys-ro.xml | 1 + tex/context/test/pdf-ua.mkiv | 44 ++ .../context/luatex/luatex-fonts-demo-vf-1.lua | 8 +- tex/generic/context/luatex/luatex-fonts-merged.lua | 130 ++--- tex/generic/context/luatex/luatex-fonts-otn.lua | 76 --- tex/generic/context/luatex/luatex-pdf.tex | 179 +++++++ tex/generic/context/luatex/luatex-plain.tex | 4 + 208 files changed, 5801 insertions(+), 4352 deletions(-) create mode 100644 doc/context/scripts/mkiv/mtx-plain.html create mode 100644 doc/context/scripts/mkiv/mtx-plain.man create mode 100644 doc/context/scripts/mkiv/mtx-plain.xml delete mode 100644 fonts/pfm/hoekwater/context/contnav.pfm delete mode 100644 fonts/pfm/hoekwater/context/koeieletters.pfm delete mode 100644 fonts/pfm/jmn/hans/hans-sh.pfm delete mode 100644 fonts/pfm/jmn/hans/hans.pfm create mode 100644 fonts/type1/hoekwater/context/contnav.pfm create mode 100644 fonts/type1/hoekwater/context/koeieletters.pfm create mode 100644 fonts/type1/jmn/hans/hans-sh.pfm create mode 100644 fonts/type1/jmn/hans/hans.pfm create mode 100644 tex/context/base/lpdf-pua.xml create mode 100644 tex/context/base/lpdf-res.lua create mode 100644 tex/context/test/pdf-ua.mkiv create mode 100644 tex/generic/context/luatex/luatex-pdf.tex 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 ac6ab3a68..6551f8f84 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", "plussixteen", "plushundred", "plusthousand", "plustenthousand", "plustwentythousand", "medcard", "maxcard", "maxcardminusone", "zeropoint", "onepoint", "halfapoint", "onebasepoint", "maxdimen", "scaledpoint", "thousandpoint", "points", "halfpoint", "zeroskip", "zeromuskip", "onemuskip", "pluscxxvii", "pluscxxviii", "pluscclv", "pluscclvi", "normalpagebox", "endoflinetoken", "outputnewlinechar", "emptytoks", "empty", "undefined", "voidbox", "emptybox", "emptyvbox", "emptyhbox", "bigskipamount", "medskipamount", "smallskipamount", "fmtname", "fmtversion", "texengine", "texenginename", "texengineversion", "luatexengine", "pdftexengine", "xetexengine", "unknownengine", "activecatcode", "bgroup", "egroup", "endline", "conditionaltrue", "conditionalfalse", "attributeunsetvalue", "uprotationangle", "rightrotationangle", "downrotationangle", "leftrotationangle", "inicatcodes", "ctxcatcodes", "texcatcodes", "notcatcodes", "txtcatcodes", "vrbcatcodes", "prtcatcodes", "nilcatcodes", "luacatcodes", "tpacatcodes", "tpbcatcodes", "xmlcatcodes", "ctdcatcodes", "escapecatcode", "begingroupcatcode", "endgroupcatcode", "mathshiftcatcode", "alignmentcatcode", "endoflinecatcode", "parametercatcode", "superscriptcatcode", "subscriptcatcode", "ignorecatcode", "spacecatcode", "lettercatcode", "othercatcode", "activecatcode", "commentcatcode", "invalidcatcode", "tabasciicode", "newlineasciicode", "formfeedasciicode", "endoflineasciicode", "endoffileasciicode", "spaceasciicode", "hashasciicode", "dollarasciicode", "commentasciicode", "ampersandasciicode", "colonasciicode", "backslashasciicode", "circumflexasciicode", "underscoreasciicode", "leftbraceasciicode", "barasciicode", "rightbraceasciicode", "tildeasciicode", "delasciicode", "lessthanasciicode", "morethanasciicode", "doublecommentsignal", "atsignasciicode", "exclamationmarkasciicode", "questionmarkasciicode", "doublequoteasciicode", "singlequoteasciicode", "forwardslashasciicode", "primeasciicode", "hyphenasciicode", "activemathcharcode", "activetabtoken", "activeformfeedtoken", "activeendoflinetoken", "batchmodecode", "nonstopmodecode", "scrollmodecode", "errorstopmodecode", "bottomlevelgroupcode", "simplegroupcode", "hboxgroupcode", "adjustedhboxgroupcode", "vboxgroupcode", "vtopgroupcode", "aligngroupcode", "noaligngroupcode", "outputgroupcode", "mathgroupcode", "discretionarygroupcode", "insertgroupcode", "vcentergroupcode", "mathchoicegroupcode", "semisimplegroupcode", "mathshiftgroupcode", "mathleftgroupcode", "vadjustgroupcode", "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", "fontslantperpoint", "fontinterwordspace", "fontinterwordstretch", "fontinterwordshrink", "fontexheight", "fontemwidth", "fontextraspace", "slantperpoint", "interwordspace", "interwordstretch", "interwordshrink", "exheight", "emwidth", "extraspace", "mathsupdisplay", "mathsupnormal", "mathsupcramped", "mathsubnormal", "mathsubcombined", "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", "setupdocument", "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", "mathordcode", "mathopcode", "mathbincode", "mathrelcode", "mathopencode", "mathclosecode", "mathpunctcode", "mathalphacode", "mathinnercode", "mathnothingcode", "mathlimopcode", "mathnolopcode", "mathboxcode", "mathchoicecode", "mathaccentcode", "mathradicalcode", "constantnumber", "constantnumberargument", "constantdimen", "constantdimenargument", "constantemptyargument", "continueifinputfile", "luastringsep", "!!bs", "!!es", "lefttorightmark", "righttoleftmark", "breakablethinspace", "nobreakspace", "nonbreakablespace", "narrownobreakspace", "zerowidthnobreakspace", "ideographicspace", "ideographichalffillspace", "twoperemspace", "threeperemspace", "fourperemspace", "fiveperemspace", "sixperemspace", "figurespace", "punctuationspace", "hairspace", "zerowidthspace", "zerowidthnonjoiner", "zerowidthjoiner", "zwnj", "zwj", "optionalspace", "asciispacechar" }, + ["constants"]={ "zerocount", "minusone", "minustwo", "plusone", "plustwo", "plusthree", "plusfour", "plusfive", "plussix", "plusseven", "pluseight", "plusnine", "plusten", "plussixteen", "plushundred", "plustwohundred", "plusthousand", "plustenthousand", "plustwentythousand", "medcard", "maxcard", "maxcardminusone", "zeropoint", "onepoint", "halfapoint", "onebasepoint", "maxdimen", "scaledpoint", "thousandpoint", "points", "halfpoint", "zeroskip", "zeromuskip", "onemuskip", "pluscxxvii", "pluscxxviii", "pluscclv", "pluscclvi", "normalpagebox", "endoflinetoken", "outputnewlinechar", "emptytoks", "empty", "undefined", "voidbox", "emptybox", "emptyvbox", "emptyhbox", "bigskipamount", "medskipamount", "smallskipamount", "fmtname", "fmtversion", "texengine", "texenginename", "texengineversion", "luatexengine", "pdftexengine", "xetexengine", "unknownengine", "activecatcode", "bgroup", "egroup", "endline", "conditionaltrue", "conditionalfalse", "attributeunsetvalue", "uprotationangle", "rightrotationangle", "downrotationangle", "leftrotationangle", "inicatcodes", "ctxcatcodes", "texcatcodes", "notcatcodes", "txtcatcodes", "vrbcatcodes", "prtcatcodes", "nilcatcodes", "luacatcodes", "tpacatcodes", "tpbcatcodes", "xmlcatcodes", "ctdcatcodes", "escapecatcode", "begingroupcatcode", "endgroupcatcode", "mathshiftcatcode", "alignmentcatcode", "endoflinecatcode", "parametercatcode", "superscriptcatcode", "subscriptcatcode", "ignorecatcode", "spacecatcode", "lettercatcode", "othercatcode", "activecatcode", "commentcatcode", "invalidcatcode", "tabasciicode", "newlineasciicode", "formfeedasciicode", "endoflineasciicode", "endoffileasciicode", "spaceasciicode", "hashasciicode", "dollarasciicode", "commentasciicode", "ampersandasciicode", "colonasciicode", "backslashasciicode", "circumflexasciicode", "underscoreasciicode", "leftbraceasciicode", "barasciicode", "rightbraceasciicode", "tildeasciicode", "delasciicode", "lessthanasciicode", "morethanasciicode", "doublecommentsignal", "atsignasciicode", "exclamationmarkasciicode", "questionmarkasciicode", "doublequoteasciicode", "singlequoteasciicode", "forwardslashasciicode", "primeasciicode", "hyphenasciicode", "activemathcharcode", "activetabtoken", "activeformfeedtoken", "activeendoflinetoken", "batchmodecode", "nonstopmodecode", "scrollmodecode", "errorstopmodecode", "bottomlevelgroupcode", "simplegroupcode", "hboxgroupcode", "adjustedhboxgroupcode", "vboxgroupcode", "vtopgroupcode", "aligngroupcode", "noaligngroupcode", "outputgroupcode", "mathgroupcode", "discretionarygroupcode", "insertgroupcode", "vcentergroupcode", "mathchoicegroupcode", "semisimplegroupcode", "mathshiftgroupcode", "mathleftgroupcode", "vadjustgroupcode", "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", "fontslantperpoint", "fontinterwordspace", "fontinterwordstretch", "fontinterwordshrink", "fontexheight", "fontemwidth", "fontextraspace", "slantperpoint", "interwordspace", "interwordstretch", "interwordshrink", "exheight", "emwidth", "extraspace", "mathsupdisplay", "mathsupnormal", "mathsupcramped", "mathsubnormal", "mathsubcombined", "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", "setupdocument", "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", "mathordcode", "mathopcode", "mathbincode", "mathrelcode", "mathopencode", "mathclosecode", "mathpunctcode", "mathalphacode", "mathinnercode", "mathnothingcode", "mathlimopcode", "mathnolopcode", "mathboxcode", "mathchoicecode", "mathaccentcode", "mathradicalcode", "constantnumber", "constantnumberargument", "constantdimen", "constantdimenargument", "constantemptyargument", "continueifinputfile", "luastringsep", "!!bs", "!!es", "lefttorightmark", "righttoleftmark", "breakablethinspace", "nobreakspace", "nonbreakablespace", "narrownobreakspace", "zerowidthnobreakspace", "ideographicspace", "ideographichalffillspace", "twoperemspace", "threeperemspace", "fourperemspace", "fiveperemspace", "sixperemspace", "figurespace", "punctuationspace", "hairspace", "zerowidthspace", "zerowidthnonjoiner", "zerowidthjoiner", "zwnj", "zwj", "optionalspace", "asciispacechar" }, ["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", "doifelsecommandhandler", "doifcommandhandlerelse", "doifnotcommandhandler", "doifcommandhandler", "newmode", "setmode", "resetmode", "newsystemmode", "setsystemmode", "resetsystemmode", "pushsystemmode", "popsystemmode", "booleanmodevalue", "newcount", "newdimen", "newskip", "newmuskip", "newbox", "newtoks", "newread", "newwrite", "newmarks", "newinsert", "newattribute", "newif", "newlanguage", "newfamily", "newfam", "newhelp", "then", "begcsname", "strippedcsname", "checkedstrippedcsname", "firstargumentfalse", "firstargumenttrue", "secondargumentfalse", "secondargumenttrue", "thirdargumentfalse", "thirdargumenttrue", "fourthargumentfalse", "fourthargumenttrue", "fifthargumentfalse", "fifthsargumenttrue", "sixthargumentfalse", "sixtsargumenttrue", "doglobal", "dodoglobal", "redoglobal", "resetglobal", "donothing", "dontcomplain", "forgetall", "donetrue", "donefalse", "inlineordisplaymath", "indisplaymath", "forcedisplaymath", "startforceddisplaymath", "stopforceddisplaymath", "reqno", "mathortext", "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", "ruledhfilneg", "ruledhfillneg", "normalhfillneg", "ruledvss", "ruledvfil", "ruledvfill", "ruledvfilneg", "ruledvfillneg", "normalvfillneg", "ruledhbox", "ruledvbox", "ruledvtop", "ruledvcenter", "ruledmbox", "ruledhskip", "ruledvskip", "ruledkern", "ruledmskip", "ruledmkern", "ruledhglue", "ruledvglue", "normalhglue", "normalvglue", "ruledpenalty", "filledhboxb", "filledhboxr", "filledhboxg", "filledhboxc", "filledhboxm", "filledhboxy", "filledhboxk", "scratchcounter", "globalscratchcounter", "scratchdimen", "globalscratchdimen", "scratchskip", "globalscratchskip", "scratchmuskip", "globalscratchmuskip", "scratchtoks", "globalscratchtoks", "scratchbox", "globalscratchbox", "normalbaselineskip", "normallineskip", "normallineskiplimit", "availablehsize", "localhsize", "setlocalhsize", "distributedhsize", "hsizefraction", "nextbox", "dowithnextbox", "dowithnextboxcs", "dowithnextboxcontent", "dowithnextboxcontentcs", "flushnextbox", "scratchwidth", "scratchheight", "scratchdepth", "scratchoffset", "scratchdistance", "scratchhsize", "scratchvsize", "scratchxoffset", "scratchyoffset", "scratchhoffset", "scratchvoffset", "scratchxposition", "scratchyposition", "scratchtopoffset", "scratchbottomoffset", "scratchleftoffset", "scratchrightoffset", "scratchcounterone", "scratchcountertwo", "scratchcounterthree", "scratchdimenone", "scratchdimentwo", "scratchdimenthree", "scratchskipone", "scratchskiptwo", "scratchskipthree", "scratchmuskipone", "scratchmuskiptwo", "scratchmuskipthree", "scratchtoksone", "scratchtokstwo", "scratchtoksthree", "scratchboxone", "scratchboxtwo", "scratchboxthree", "scratchnx", "scratchny", "scratchmx", "scratchmy", "scratchunicode", "scratchleftskip", "scratchrightskip", "scratchtopskip", "scratchbottomskip", "doif", "doifnot", "doifelse", "doifinset", "doifnotinset", "doifelseinset", "doifinsetelse", "doifelsenextchar", "doifnextcharelse", "doifelsenextoptional", "doifnextoptionalelse", "doifelsenextoptionalcs", "doifnextoptionalcselse", "doifelsefastoptionalcheck", "doiffastoptionalcheckelse", "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", "tracingall", "tracingnone", "loggingall", "removetoks", "appendtoks", "prependtoks", "appendtotoks", "prependtotoks", "to", "endgraf", "endpar", "everyendpar", "reseteverypar", "finishpar", "empty", "null", "space", "quad", "enspace", "nbsp", "obeyspaces", "obeylines", "obeyedspace", "obeyedline", "obeyedtab", "obeyedpage", "normalspace", "executeifdefined", "singleexpandafter", "doubleexpandafter", "tripleexpandafter", "dontleavehmode", "removelastspace", "removeunwantedspaces", "keepunwantedspaces", "removepunctuation", "wait", "writestatus", "define", "defineexpandable", "redefine", "setmeasure", "setemeasure", "setgmeasure", "setxmeasure", "definemeasure", "freezemeasure", "measure", "measured", "installcorenamespace", "getvalue", "getuvalue", "setvalue", "setevalue", "setgvalue", "setxvalue", "letvalue", "letgvalue", "resetvalue", "undefinevalue", "ignorevalue", "setuvalue", "setuevalue", "setugvalue", "setuxvalue", "globallet", "glet", "udef", "ugdef", "uedef", "uxdef", "checked", "unique", "getparameters", "geteparameters", "getgparameters", "getxparameters", "forgetparameters", "copyparameters", "getdummyparameters", "dummyparameter", "directdummyparameter", "setdummyparameter", "letdummyparameter", "usedummystyleandcolor", "usedummystyleparameter", "usedummycolorparameter", "processcommalist", "processcommacommand", "quitcommalist", "quitprevcommalist", "processaction", "processallactions", "processfirstactioninset", "processallactionsinset", "unexpanded", "expanded", "startexpanded", "stopexpanded", "protected", "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", "dowith", "newconstant", "setnewconstant", "setconstant", "setconstantvalue", "newconditional", "settrue", "setfalse", "settruevalue", "setfalsevalue", "newmacro", "setnewmacro", "newfraction", "newsignal", "dosingleempty", "dodoubleempty", "dotripleempty", "doquadrupleempty", "doquintupleempty", "dosixtupleempty", "doseventupleempty", "dosingleargument", "dodoubleargument", "dotripleargument", "doquadrupleargument", "doquintupleargument", "dosixtupleargument", "doseventupleargument", "dosinglegroupempty", "dodoublegroupempty", "dotriplegroupempty", "doquadruplegroupempty", "doquintuplegroupempty", "permitspacesbetweengroups", "dontpermitspacesbetweengroups", "nopdfcompression", "maximumpdfcompression", "normalpdfcompression", "modulonumber", "dividenumber", "getfirstcharacter", "doifelsefirstchar", "doiffirstcharelse", "startnointerference", "stopnointerference", "twodigits", "threedigits", "leftorright", "offinterlineskip", "oninterlineskip", "nointerlineskip", "strut", "halfstrut", "quarterstrut", "depthstrut", "setstrut", "strutbox", "strutht", "strutdp", "strutwd", "struthtdp", "begstrut", "endstrut", "lineheight", "ordordspacing", "ordopspacing", "ordbinspacing", "ordrelspacing", "ordopenspacing", "ordclosespacing", "ordpunctspacing", "ordinnerspacing", "opordspacing", "opopspacing", "opbinspacing", "oprelspacing", "opopenspacing", "opclosespacing", "oppunctspacing", "opinnerspacing", "binordspacing", "binopspacing", "binbinspacing", "binrelspacing", "binopenspacing", "binclosespacing", "binpunctspacing", "bininnerspacing", "relordspacing", "relopspacing", "relbinspacing", "relrelspacing", "relopenspacing", "relclosespacing", "relpunctspacing", "relinnerspacing", "openordspacing", "openopspacing", "openbinspacing", "openrelspacing", "openopenspacing", "openclosespacing", "openpunctspacing", "openinnerspacing", "closeordspacing", "closeopspacing", "closebinspacing", "closerelspacing", "closeopenspacing", "closeclosespacing", "closepunctspacing", "closeinnerspacing", "punctordspacing", "punctopspacing", "punctbinspacing", "punctrelspacing", "punctopenspacing", "punctclosespacing", "punctpunctspacing", "punctinnerspacing", "innerordspacing", "inneropspacing", "innerbinspacing", "innerrelspacing", "inneropenspacing", "innerclosespacing", "innerpunctspacing", "innerinnerspacing", "normalreqno", "startimath", "stopimath", "normalstartimath", "normalstopimath", "startdmath", "stopdmath", "normalstartdmath", "normalstopdmath", "uncramped", "cramped", "triggermathstyle", "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", "startluaparameterset", "stopluaparameterset", "luaparameterset", "definenamedlua", "obeylualines", "obeyluatokens", "startluacode", "stopluacode", "startlua", "stoplua", "startctxfunction", "stopctxfunction", "ctxfunction", "startctxfunctiondefinition", "stopctxfunctiondefinition", "installctxfunction", "cldprocessfile", "cldloadfile", "cldcontext", "cldcommand", "carryoverpar", "assumelongusagecs", "Umathbotaccent", "righttolefthbox", "lefttorighthbox", "righttoleftvbox", "lefttorightvbox", "righttoleftvtop", "lefttorightvtop", "rtlhbox", "ltrhbox", "rtlvbox", "ltrvbox", "rtlvtop", "ltrvtop", "autodirhbox", "autodirvbox", "autodirvtop", "leftorrighthbox", "leftorrightvbox", "leftorrightvtop", "lefttoright", "righttoleft", "synchronizelayoutdirection", "synchronizedisplaydirection", "synchronizeinlinedirection", "lesshyphens", "morehyphens", "nohyphens", "dohyphens", "Ucheckedstartdisplaymath", "Ucheckedstopdisplaymath", "nobreak", "allowbreak", "goodbreak" }, } \ 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 235c4027e..1a1876843 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,9 +1,9 @@ return { ["aleph"]={ "AlephVersion", "Alephminorversion", "Alephrevision", "Alephversion", "Omegaminorversion", "Omegarevision", "Omegaversion", "boxdir", "pagebottomoffset", "pagerightoffset" }, ["etex"]={ "botmarks", "clubpenalties", "currentgrouplevel", "currentgrouptype", "currentifbranch", "currentiflevel", "currentiftype", "detokenize", "dimexpr", "displaywidowpenalties", "eTeXVersion", "eTeXminorversion", "eTeXrevision", "eTeXversion", "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", "readline", "savinghyphcodes", "savingvdiscards", "scantokens", "showgroups", "showifs", "showtokens", "splitbotmarks", "splitdiscards", "splitfirstmarks", "topmarks", "tracingassigns", "tracinggroups", "tracingifs", "tracingnesting", "tracingscantokens", "unexpanded", "unless", "widowpenalties" }, - ["luatex"]={ "Uchar", "Udelcode", "Udelcodenum", "Udelimiter", "Udelimiterover", "Udelimiterunder", "Umathaccent", "Umathaxis", "Umathbinbinspacing", "Umathbinclosespacing", "Umathbininnerspacing", "Umathbinopenspacing", "Umathbinopspacing", "Umathbinordspacing", "Umathbinpunctspacing", "Umathbinrelspacing", "Umathchar", "Umathchardef", "Umathcharnum", "Umathclosebinspacing", "Umathcloseclosespacing", "Umathcloseinnerspacing", "Umathcloseopenspacing", "Umathcloseopspacing", "Umathcloseordspacing", "Umathclosepunctspacing", "Umathcloserelspacing", "Umathcode", "Umathcodenum", "Umathconnectoroverlapmin", "Umathfractiondelsize", "Umathfractiondenomdown", "Umathfractiondenomvgap", "Umathfractionnumup", "Umathfractionnumvgap", "Umathfractionrule", "Umathinnerbinspacing", "Umathinnerclosespacing", "Umathinnerinnerspacing", "Umathinneropenspacing", "Umathinneropspacing", "Umathinnerordspacing", "Umathinnerpunctspacing", "Umathinnerrelspacing", "Umathlimitabovebgap", "Umathlimitabovekern", "Umathlimitabovevgap", "Umathlimitbelowbgap", "Umathlimitbelowkern", "Umathlimitbelowvgap", "Umathopbinspacing", "Umathopclosespacing", "Umathopenbinspacing", "Umathopenclosespacing", "Umathopeninnerspacing", "Umathopenopenspacing", "Umathopenopspacing", "Umathopenordspacing", "Umathopenpunctspacing", "Umathopenrelspacing", "Umathoperatorsize", "Umathopinnerspacing", "Umathopopenspacing", "Umathopopspacing", "Umathopordspacing", "Umathoppunctspacing", "Umathoprelspacing", "Umathordbinspacing", "Umathordclosespacing", "Umathordinnerspacing", "Umathordopenspacing", "Umathordopspacing", "Umathordordspacing", "Umathordpunctspacing", "Umathordrelspacing", "Umathoverbarkern", "Umathoverbarrule", "Umathoverbarvgap", "Umathoverdelimiterbgap", "Umathoverdelimitervgap", "Umathpunctbinspacing", "Umathpunctclosespacing", "Umathpunctinnerspacing", "Umathpunctopenspacing", "Umathpunctopspacing", "Umathpunctordspacing", "Umathpunctpunctspacing", "Umathpunctrelspacing", "Umathquad", "Umathradicaldegreeafter", "Umathradicaldegreebefore", "Umathradicaldegreeraise", "Umathradicalkern", "Umathradicalrule", "Umathradicalvgap", "Umathrelbinspacing", "Umathrelclosespacing", "Umathrelinnerspacing", "Umathrelopenspacing", "Umathrelopspacing", "Umathrelordspacing", "Umathrelpunctspacing", "Umathrelrelspacing", "Umathspaceafterscript", "Umathstackdenomdown", "Umathstacknumup", "Umathstackvgap", "Umathsubshiftdown", "Umathsubshiftdrop", "Umathsubsupshiftdown", "Umathsubsupvgap", "Umathsubtopmax", "Umathsupbottommin", "Umathsupshiftdrop", "Umathsupshiftup", "Umathsupsubbottommax", "Umathunderbarkern", "Umathunderbarrule", "Umathunderbarvgap", "Umathunderdelimiterbgap", "Umathunderdelimitervgap", "Uoverdelimiter", "Uradical", "Uroot", "Ustack", "Ustartdisplaymath", "Ustartmath", "Ustopdisplaymath", "Ustopmath", "Usubscript", "Usuperscript", "Uunderdelimiter", "adjustspacing", "alignmark", "aligntab", "attribute", "attributedef", "bodydir", "boxdir", "catcodetable", "clearmarks", "crampeddisplaystyle", "crampedscriptscriptstyle", "crampedscriptstyle", "crampedtextstyle", "efcode", "fontid", "formatname", "gleaders", "hyphenationmin", "ifabsdim", "ifabsnum", "ifprimitive", "ignoreligaturesinfont", "initcatcodetable", "lastsavedboxresourceindex", "lastsavedimageresourceindex", "lastsavedimageresourcepages", "lastxpos", "lastypos", "latelua", "leftghost", "leftmarginkern", "letterspacefont", "localbrokenpenalty", "localinterlinepenalty", "localleftbox", "localrightbox", "lpcode", "luaescapestring", "luastartup", "luatexbanner", "luatexrevision", "luatexversion", "luafunction", "mathdir", "matheqnogapstep", "mathstyle", "nokerns", "noligs", "normaldeviate", "outputbox", "pagedir", "pageheight", "pagebottomoffset", "pageleftoffset", "pagerightoffset", "pagetopoffset", "pagewidth", "pardir", "postexhyphenchar", "posthyphenchar", "preexhyphenchar", "prehyphenchar", "primitive", "protrudechars", "randomseed", "rightghost", "rightmarginkern", "rpcode", "saveboxresource", "savecatcodetable", "saveimageresource", "savepos", "scantextokens", "setrandomseed", "suppressfontnotfounderror", "suppressifcsnameerror", "suppresslongerror", "suppressoutererror", "suppressmathparerror", "synctex", "tagcode", "textdir", "uniformdeviate", "useboxresource", "useimageresource" }, + ["luatex"]={ "Uchar", "Udelcode", "Udelcodenum", "Udelimiter", "Udelimiterover", "Udelimiterunder", "Uhextensible", "Uleft", "Umathaccent", "Umathaxis", "Umathbinbinspacing", "Umathbinclosespacing", "Umathbininnerspacing", "Umathbinopenspacing", "Umathbinopspacing", "Umathbinordspacing", "Umathbinpunctspacing", "Umathbinrelspacing", "Umathchar", "Umathcharclass", "Umathchardef", "Umathcharfam", "Umathcharnum", "Umathcharnumdef", "Umathcharslot", "Umathclosebinspacing", "Umathcloseclosespacing", "Umathcloseinnerspacing", "Umathcloseopenspacing", "Umathcloseopspacing", "Umathcloseordspacing", "Umathclosepunctspacing", "Umathcloserelspacing", "Umathcode", "Umathcodenum", "Umathcodenumdef", "Umathconnectoroverlapmin", "Umathfractiondelsize", "Umathfractiondenomdown", "Umathfractiondenomvgap", "Umathfractionnumup", "Umathfractionnumvgap", "Umathfractionrule", "Umathinnerbinspacing", "Umathinnerclosespacing", "Umathinnerinnerspacing", "Umathinneropenspacing", "Umathinneropspacing", "Umathinnerordspacing", "Umathinnerpunctspacing", "Umathinnerrelspacing", "Umathlimitabovebgap", "Umathlimitabovekern", "Umathlimitabovevgap", "Umathlimitbelowbgap", "Umathlimitbelowkern", "Umathlimitbelowvgap", "Umathopbinspacing", "Umathopclosespacing", "Umathopenbinspacing", "Umathopenclosespacing", "Umathopeninnerspacing", "Umathopenopenspacing", "Umathopenopspacing", "Umathopenordspacing", "Umathopenpunctspacing", "Umathopenrelspacing", "Umathoperatorsize", "Umathopinnerspacing", "Umathopopenspacing", "Umathopopspacing", "Umathopordspacing", "Umathoppunctspacing", "Umathoprelspacing", "Umathordbinspacing", "Umathordclosespacing", "Umathordinnerspacing", "Umathordopenspacing", "Umathordopspacing", "Umathordordspacing", "Umathordpunctspacing", "Umathordrelspacing", "Umathoverbarkern", "Umathoverbarrule", "Umathoverbarvgap", "Umathoverdelimiterbgap", "Umathoverdelimitervgap", "Umathpunctbinspacing", "Umathpunctclosespacing", "Umathpunctinnerspacing", "Umathpunctopenspacing", "Umathpunctopspacing", "Umathpunctordspacing", "Umathpunctpunctspacing", "Umathpunctrelspacing", "Umathquad", "Umathradicaldegreeafter", "Umathradicaldegreebefore", "Umathradicaldegreeraise", "Umathradicalkern", "Umathradicalrule", "Umathradicalvgap", "Umathrelbinspacing", "Umathrelclosespacing", "Umathrelinnerspacing", "Umathrelopenspacing", "Umathrelopspacing", "Umathrelordspacing", "Umathrelpunctspacing", "Umathrelrelspacing", "Umathskewedfractionhgap", "Umathskewedfractionvgap", "Umathspaceafterscript", "Umathstackdenomdown", "Umathstacknumup", "Umathstackvgap", "Umathsubshiftdown", "Umathsubshiftdrop", "Umathsubsupshiftdown", "Umathsubsupvgap", "Umathsubtopmax", "Umathsupbottommin", "Umathsupshiftdrop", "Umathsupshiftup", "Umathsupsubbottommax", "Umathunderbarkern", "Umathunderbarrule", "Umathunderbarvgap", "Umathunderdelimiterbgap", "Umathunderdelimitervgap", "Umiddle", "Uoverdelimiter", "Uradical", "Uright", "Uroot", "Uskewed", "Uskewedwithdelims", "Ustack", "Ustartdisplaymath", "Ustartmath", "Ustopdisplaymath", "Ustopmath", "Usubscript", "Usuperscript", "Uunderdelimiter", "Uvextensible", "adjustspacing", "alignmark", "aligntab", "attribute", "attributedef", "bodydir", "boxdir", "catcodetable", "clearmarks", "copyfont", "crampeddisplaystyle", "crampedscriptscriptstyle", "crampedscriptstyle", "crampedtextstyle", "draftmode", "dviextension", "dvifeedback", "dvivariable", "efcode", "fontid", "formatname", "gleaders", "hyphenationmin", "ifabsdim", "ifabsnum", "ifprimitive", "ignoreligaturesinfont", "initcatcodetable", "insertht", "lastsavedboxresourceindex", "lastsavedimageresourceindex", "lastsavedimageresourcepages", "lastxpos", "lastypos", "latelua", "leftghost", "leftmarginkern", "letterspacefont", "localbrokenpenalty", "localinterlinepenalty", "localleftbox", "localrightbox", "lpcode", "luaescapestring", "luastartup", "luatexbanner", "luatexrevision", "luatexversion", "luafunction", "mathdir", "mathdisplayskipmode", "matheqnogapstep", "mathoption", "mathscriptsmode", "mathstyle", "mathsurroundskip", "nokerns", "nohrule", "noligs", "novrule", "normaldeviate", "outputbox", "outputmode", "pagedir", "pageheight", "pagebottomoffset", "pageleftoffset", "pagerightoffset", "pagetopoffset", "pagewidth", "pardir", "pdfextension", "pdffeedback", "pdfvariable", "postexhyphenchar", "posthyphenchar", "preexhyphenchar", "prehyphenchar", "primitive", "protrudechars", "pxdimen", "randomseed", "rightghost", "rightmarginkern", "rpcode", "saveboxresource", "savecatcodetable", "saveimageresource", "savepos", "scantextokens", "setfontid", "setrandomseed", "suppressfontnotfounderror", "suppressifcsnameerror", "suppresslongerror", "suppressoutererror", "suppressmathparerror", "synctex", "tagcode", "textdir", "tracingfonts", "uniformdeviate", "useboxresource", "useimageresource" }, ["omega"]={ "OmegaVersion", "bodydir", "chardp", "charht", "charit", "charwd", "leftghost", "localbrokenpenalty", "localinterlinepenalty", "localleftbox", "localrightbox", "mathdir", "odelcode", "odelimiter", "omathaccent", "omathchar", "omathchardef", "omathcode", "oradical", "pagedir", "pageheight", "pagewidth", "pardir", "rightghost", "textdir" }, - ["pdftex"]={ "efcode", "expanded", "ifincsname", "ifpdfabsdim", "ifpdfabsnum", "ifpdfprimitive", "leftmarginkern", "letterspacefont", "lpcode", "pdfadjustspacing", "pdfannot", "pdfcatalog", "pdfcolorstack", "pdfcolorstackinit", "pdfcompresslevel", "pdfcopyfont", "pdfcreationdate", "pdfdecimaldigits", "pdfdest", "pdfdestmargin", "pdfdraftmode", "pdfendlink", "pdfendthread", "pdffontattr", "pdffontexpand", "pdffontname", "pdffontobjnum", "pdffontsize", "pdfgamma", "pdfgentounicode", "pdfglyphtounicode", "pdfhorigin", "pdfignoreddimen", "pdfimageapplygamma", "pdfimagegamma", "pdfimagehicolor", "pdfimageresolution", "pdfincludechars", "pdfinclusioncopyfonts", "pdfinclusionerrorlevel", "pdfinfo", "pdfinsertht", "pdflastannot", "pdflastlink", "pdflastobj", "pdflastxform", "pdflastximage", "pdflastximagepages", "pdflastxpos", "pdflastypos", "pdflinkmargin", "pdfliteral", "pdfmapfile", "pdfmapline", "pdfminorversion", "pdfnames", "pdfnoligatures", "pdfnormaldeviate", "pdfobj", "pdfobjcompresslevel", "pdfoptionpdfminorversion", "pdfoutline", "pdfoutput", "pdfpageattr", "pdfpagebox", "pdfpageheight", "pdfpageref", "pdfpageresources", "pdfpagesattr", "pdfpagewidth", "pdfpkmode", "pdfpkresolution", "pdfprimitive", "pdfprotrudechars", "pdfpxdimen", "pdfrandomseed", "pdfrefobj", "pdfrefxform", "pdfrefximage", "pdfreplacefont", "pdfrestore", "pdfretval", "pdfsave", "pdfsavepos", "pdfsetmatrix", "pdfsetrandomseed", "pdfstartlink", "pdfstartthread", "pdftexbanner", "pdftexrevision", "pdftexversion", "pdfthread", "pdfthreadmargin", "pdftracingfonts", "pdftrailer", "pdfuniformdeviate", "pdfuniqueresname", "pdfvorigin", "pdfxform", "pdfxformattr", "pdfxformname", "pdfxformresources", "pdfximage", "quitvmode", "rightmarginkern", "rpcode", "tagcode" }, - ["tex"]={ "-", "/", "AlephVersion", "Alephminorversion", "Alephrevision", "Alephversion", "OmegaVersion", "Omegaminorversion", "Omegarevision", "Omegaversion", "Udelcode", "Udelcodenum", "Udelimiter", "Udelimiterover", "Udelimiterunder", "Umathaccent", "Umathaxis", "Umathbinbinspacing", "Umathbinclosespacing", "Umathbininnerspacing", "Umathbinopenspacing", "Umathbinopspacing", "Umathbinordspacing", "Umathbinpunctspacing", "Umathbinrelspacing", "Umathchar", "Umathchardef", "Umathcharnum", "Umathclosebinspacing", "Umathcloseclosespacing", "Umathcloseinnerspacing", "Umathcloseopenspacing", "Umathcloseopspacing", "Umathcloseordspacing", "Umathclosepunctspacing", "Umathcloserelspacing", "Umathcode", "Umathcodenum", "Umathconnectoroverlapmin", "Umathfractiondelsize", "Umathfractiondenomdown", "Umathfractiondenomvgap", "Umathfractionnumup", "Umathfractionnumvgap", "Umathfractionrule", "Umathinnerbinspacing", "Umathinnerclosespacing", "Umathinnerinnerspacing", "Umathinneropenspacing", "Umathinneropspacing", "Umathinnerordspacing", "Umathinnerpunctspacing", "Umathinnerrelspacing", "Umathlimitabovebgap", "Umathlimitabovekern", "Umathlimitabovevgap", "Umathlimitbelowbgap", "Umathlimitbelowkern", "Umathlimitbelowvgap", "Umathopbinspacing", "Umathopclosespacing", "Umathopenbinspacing", "Umathopenclosespacing", "Umathopeninnerspacing", "Umathopenopenspacing", "Umathopenopspacing", "Umathopenordspacing", "Umathopenpunctspacing", "Umathopenrelspacing", "Umathoperatorsize", "Umathopinnerspacing", "Umathopopenspacing", "Umathopopspacing", "Umathopordspacing", "Umathoppunctspacing", "Umathoprelspacing", "Umathordbinspacing", "Umathordclosespacing", "Umathordinnerspacing", "Umathordopenspacing", "Umathordopspacing", "Umathordordspacing", "Umathordpunctspacing", "Umathordrelspacing", "Umathoverbarkern", "Umathoverbarrule", "Umathoverbarvgap", "Umathoverdelimiterbgap", "Umathoverdelimitervgap", "Umathpunctbinspacing", "Umathpunctclosespacing", "Umathpunctinnerspacing", "Umathpunctopenspacing", "Umathpunctopspacing", "Umathpunctordspacing", "Umathpunctpunctspacing", "Umathpunctrelspacing", "Umathquad", "Umathradicaldegreeafter", "Umathradicaldegreebefore", "Umathradicaldegreeraise", "Umathradicalkern", "Umathradicalrule", "Umathradicalvgap", "Umathrelbinspacing", "Umathrelclosespacing", "Umathrelinnerspacing", "Umathrelopenspacing", "Umathrelopspacing", "Umathrelordspacing", "Umathrelpunctspacing", "Umathrelrelspacing", "Umathspaceafterscript", "Umathstackdenomdown", "Umathstacknumup", "Umathstackvgap", "Umathsubshiftdown", "Umathsubshiftdrop", "Umathsubsupshiftdown", "Umathsubsupvgap", "Umathsubtopmax", "Umathsupbottommin", "Umathsupshiftdrop", "Umathsupshiftup", "Umathsupsubbottommax", "Umathunderbarkern", "Umathunderbarrule", "Umathunderbarvgap", "Umathunderdelimiterbgap", "Umathunderdelimitervgap", "Uoverdelimiter", "Uradical", "Uroot", "Ustack", "Ustartdisplaymath", "Ustartmath", "Ustopdisplaymath", "Ustopmath", "Usubscript", "Usuperscript", "Uunderdelimiter", "above", "abovedisplayshortskip", "abovedisplayskip", "abovewithdelims", "accent", "adjdemerits", "advance", "afterassignment", "aftergroup", "alignmark", "aligntab", "atop", "atopwithdelims", "attribute", "attributedef", "badness", "baselineskip", "batchmode", "begingroup", "belowdisplayshortskip", "belowdisplayskip", "binoppenalty", "bodydir", "botmark", "botmarks", "box", "boxdir", "boxmaxdepth", "brokenpenalty", "catcode", "catcodetable", "char", "chardef", "cleaders", "clearmarks", "closein", "closeout", "clubpenalties", "clubpenalty", "copy", "count", "countdef", "cr", "crampeddisplaystyle", "crampedscriptscriptstyle", "crampedscriptstyle", "crampedtextstyle", "crcr", "csname", "currentgrouplevel", "currentgrouptype", "currentifbranch", "currentiflevel", "currentiftype", "day", "deadcycles", "def", "defaulthyphenchar", "defaultskewchar", "delcode", "delimiter", "delimiterfactor", "delimitershortfall", "detokenize", "dimen", "dimendef", "dimexpr", "directlua", "discretionary", "displayindent", "displaylimits", "displaystyle", "displaywidowpenalties", "displaywidowpenalty", "displaywidth", "divide", "doublehyphendemerits", "dp", "dump", "eTeXVersion", "eTeXminorversion", "eTeXrevision", "eTeXversion", "edef", "efcode", "else", "emergencystretch", "end", "endcsname", "endgroup", "endinput", "endlinechar", "eqno", "errhelp", "errmessage", "errorcontextlines", "errorstopmode", "escapechar", "everycr", "everydisplay", "everyeof", "everyhbox", "everyjob", "everymath", "everypar", "everyvbox", "exhyphenchar", "exhyphenpenalty", "expandafter", "expanded", "expandglyphsinfont", "fam", "fi", "finalhyphendemerits", "firstmark", "firstmarks", "floatingpenalty", "font", "fontchardp", "fontcharht", "fontcharic", "fontcharwd", "fontdimen", "fontid", "fontname", "formatname", "futurelet", "gdef", "gleaders", "global", "globaldefs", "glueexpr", "glueshrink", "glueshrinkorder", "gluestretch", "gluestretchorder", "gluetomu", "halign", "hangafter", "hangindent", "hbadness", "hbox", "hfil", "hfill", "hfilneg", "hfuzz", "hoffset", "holdinginserts", "hrule", "hsize", "hskip", "hss", "ht", "hyphenation", "hyphenchar", "hyphenpenalty", "if", "ifabsdim", "ifabsnum", "ifcase", "ifcat", "ifcsname", "ifdefined", "ifdim", "ifeof", "iffalse", "iffontchar", "ifhbox", "ifhmode", "ifincsname", "ifinner", "ifmmode", "ifnum", "ifodd", "ifpdfabsdim", "ifpdfabsnum", "ifpdfprimitive", "ifprimitive", "iftrue", "ifvbox", "ifvmode", "ifvoid", "ifx", "ignoreligaturesinfont", "ignorespaces", "immediate", "indent", "initcatcodetable", "input", "inputlineno", "insert", "insertpenalties", "interactionmode", "interlinepenalties", "interlinepenalty", "jobname", "kern", "language", "lastbox", "lastkern", "lastlinefit", "lastnodetype", "lastpenalty", "lastsavedboxresourceindex", "lastsavedimageresourceindex", "lastsavedimageresourcepages", "lastskip", "lastxpos", "lastypos", "latelua", "lccode", "leaders", "left", "leftghost", "lefthyphenmin", "leftmarginkern", "leftskip", "leqno", "let", "letterspacefont", "limits", "linepenalty", "lineskip", "lineskiplimit", "localbrokenpenalty", "localinterlinepenalty", "localleftbox", "localrightbox", "long", "looseness", "lower", "lowercase", "lpcode", "luaescapestring", "luastartup", "luatexbanner", "luatexrevision", "luatexversion", "mag", "mark", "marks", "mathaccent", "mathbin", "mathchar", "mathchardef", "mathchoice", "mathclose", "mathcode", "mathdir", "mathinner", "mathop", "mathopen", "mathord", "mathpunct", "mathrel", "mathstyle", "mathsurround", "maxdeadcycles", "maxdepth", "meaning", "medmuskip", "message", "middle", "mkern", "month", "moveleft", "moveright", "mskip", "muexpr", "multiply", "muskip", "muskipdef", "mutoglue", "newlinechar", "noalign", "noboundary", "noexpand", "noindent", "nokerns", "noligs", "nolimits", "nolocaldirs", "nolocalwhatsits", "nonscript", "nonstopmode", "normaldeviate", "nulldelimiterspace", "nullfont", "number", "numexpr", "odelcode", "odelimiter", "omathaccent", "omathchar", "omathchardef", "omathcode", "omit", "openin", "openout", "or", "oradical", "outer", "output", "outputbox", "outputpenalty", "over", "overfullrule", "overline", "overwithdelims", "pagebottomoffset", "pagedepth", "pagedir", "pagediscards", "pagefilllstretch", "pagefillstretch", "pagefilstretch", "pagegoal", "pageheight", "pageleftoffset", "pagerightoffset", "pageshrink", "pagestretch", "pagetopoffset", "pagetotal", "pagewidth", "par", "pardir", "parfillskip", "parindent", "parshape", "parshapedimen", "parshapeindent", "parshapelength", "parskip", "patterns", "pausing", "pdfadjustspacing", "pdfannot", "pdfcatalog", "pdfcolorstack", "pdfcolorstackinit", "pdfcompresslevel", "pdfcopyfont", "pdfcreationdate", "pdfdecimaldigits", "pdfdest", "pdfdestmargin", "pdfdraftmode", "pdfendlink", "pdfendthread", "pdffontattr", "pdffontexpand", "pdffontname", "pdffontobjnum", "pdffontsize", "pdfgamma", "pdfgentounicode", "pdfglyphtounicode", "pdfhorigin", "pdfignoreddimen", "pdfimageapplygamma", "pdfimagegamma", "pdfimagehicolor", "pdfimageresolution", "pdfincludechars", "pdfinclusioncopyfonts", "pdfinclusionerrorlevel", "pdfinfo", "pdfinsertht", "pdflastannot", "pdflastlink", "pdflastobj", "pdflastxform", "pdflastximage", "pdflastximagepages", "pdflastxpos", "pdflastypos", "pdflinkmargin", "pdfliteral", "pdfmapfile", "pdfmapline", "pdfminorversion", "pdfnames", "pdfnoligatures", "pdfnormaldeviate", "pdfobj", "pdfobjcompresslevel", "pdfoptionpdfminorversion", "pdfoutline", "pdfoutput", "pdfpageattr", "pdfpagebox", "pdfpageheight", "pdfpageref", "pdfpageresources", "pdfpagesattr", "pdfpagewidth", "pdfpkmode", "pdfpkresolution", "pdfprimitive", "pdfprotrudechars", "pdfpxdimen", "pdfrandomseed", "pdfrefobj", "pdfrefxform", "pdfrefximage", "pdfreplacefont", "pdfrestore", "pdfretval", "pdfsave", "pdfsavepos", "pdfsetmatrix", "pdfsetrandomseed", "pdfstartlink", "pdfstartthread", "pdftexbanner", "pdftexrevision", "pdftexversion", "pdfthread", "pdfthreadmargin", "pdftracingfonts", "pdftrailer", "pdfuniformdeviate", "pdfuniqueresname", "pdfvorigin", "pdfxform", "pdfxformattr", "pdfxformname", "pdfxformresources", "pdfximage", "penalty", "postdisplaypenalty", "postexhyphenchar", "posthyphenchar", "predisplaydirection", "predisplaypenalty", "predisplaysize", "preexhyphenchar", "prehyphenchar", "pretolerance", "prevdepth", "prevgraf", "primitive", "protected", "quitvmode", "radical", "raise", "randomseed", "read", "readline", "relax", "relpenalty", "right", "rightghost", "righthyphenmin", "rightmarginkern", "rightskip", "romannumeral", "rpcode", "saveboxresource", "saveimageresource", "savepos", "savecatcodetable", "savinghyphcodes", "savingvdiscards", "scantextokens", "scantokens", "scriptfont", "scriptscriptfont", "scriptscriptstyle", "scriptspace", "scriptstyle", "scrollmode", "setbox", "setlanguage", "setrandomseed", "sfcode", "shipout", "show", "showbox", "showboxbreadth", "showboxdepth", "showgroups", "showifs", "showlists", "showthe", "showtokens", "skewchar", "skip", "skipdef", "spacefactor", "spaceskip", "span", "special", "splitbotmark", "splitbotmarks", "splitdiscards", "splitfirstmark", "splitfirstmarks", "splitmaxdepth", "splittopskip", "string", "suppressfontnotfounderror", "suppressifcsnameerror", "suppresslongerror", "suppressoutererror", "synctex", "tabskip", "tagcode", "textdir", "textfont", "textstyle", "the", "thickmuskip", "thinmuskip", "time", "toks", "toksdef", "tolerance", "topmark", "topmarks", "topskip", "tracingassigns", "tracingcommands", "tracinggroups", "tracingifs", "tracinglostchars", "tracingmacros", "tracingnesting", "tracingonline", "tracingoutput", "tracingpages", "tracingparagraphs", "tracingrestores", "tracingscantokens", "tracingstats", "uccode", "uchyph", "underline", "unexpanded", "unhbox", "unhcopy", "uniformdeviate", "unkern", "unless", "unpenalty", "unskip", "unvbox", "unvcopy", "uppercase", "useboxresource", "useimageresource", "vadjust", "valign", "vbadness", "vbox", "vcenter", "vfil", "vfill", "vfilneg", "vfuzz", "voffset", "vrule", "vsize", "vskip", "vsplit", "vss", "vtop", "wd", "widowpenalties", "widowpenalty", "write", "xdef", "xleaders", "xspaceskip", "year" }, + ["pdftex"]={ "efcode", "expanded", "ifincsname", "ifpdfabsdim", "ifpdfabsnum", "ifpdfprimitive", "leftmarginkern", "letterspacefont", "lpcode", "pdfadjustspacing", "pdfannot", "pdfcatalog", "pdfcolorstack", "pdfcolorstackinit", "pdfcompresslevel", "pdfcopyfont", "pdfcreationdate", "pdfdecimaldigits", "pdfdest", "pdfdestmargin", "pdfdraftmode", "pdfeachlineheight", "pdfeachlinedepth", "pdfendlink", "pdfendthread", "pdffirstlineheight", "pdffontattr", "pdffontexpand", "pdffontname", "pdffontobjnum", "pdffontsize", "pdfgamma", "pdfgentounicode", "pdfglyphtounicode", "pdfhorigin", "pdfignoreddimen", "pdfimageapplygamma", "pdfimagegamma", "pdfimagehicolor", "pdfimageresolution", "pdfincludechars", "pdfinclusioncopyfonts", "pdfinclusionerrorlevel", "pdfinfo", "pdfinsertht", "pdflastannot", "pdflastlinedepth", "pdflastlink", "pdflastobj", "pdflastxform", "pdflastximage", "pdflastximagepages", "pdflastxpos", "pdflastypos", "pdflinkmargin", "pdfliteral", "pdfmapfile", "pdfmapline", "pdfminorversion", "pdfnames", "pdfnoligatures", "pdfnormaldeviate", "pdfobj", "pdfobjcompresslevel", "pdfoutline", "pdfoutput", "pdfpageattr", "pdfpagebox", "pdfpageheight", "pdfpageref", "pdfpageresources", "pdfpagesattr", "pdfpagewidth", "pdfpkmode", "pdfpkresolution", "pdfprimitive", "pdfprotrudechars", "pdfpxdimen", "pdfrandomseed", "pdfrefobj", "pdfrefxform", "pdfrefximage", "pdfreplacefont", "pdfrestore", "pdfretval", "pdfsave", "pdfsavepos", "pdfsetmatrix", "pdfsetrandomseed", "pdfstartlink", "pdfstartthread", "pdftexbanner", "pdftexrevision", "pdftexversion", "pdfthread", "pdfthreadmargin", "pdftracingfonts", "pdftrailer", "pdfuniformdeviate", "pdfuniqueresname", "pdfvorigin", "pdfxform", "pdfxformattr", "pdfxformname", "pdfxformresources", "pdfximage", "quitvmode", "rightmarginkern", "rpcode", "tagcode" }, + ["tex"]={ "-", "/", "AlephVersion", "Alephminorversion", "Alephrevision", "Alephversion", "OmegaVersion", "Omegaminorversion", "Omegarevision", "Omegaversion", "Udelcode", "Udelcodenum", "Udelimiter", "Udelimiterover", "Udelimiterunder", "Uhextensible", "Uleft", "Umathaccent", "Umathaxis", "Umathbinbinspacing", "Umathbinclosespacing", "Umathbininnerspacing", "Umathbinopenspacing", "Umathbinopspacing", "Umathbinordspacing", "Umathbinpunctspacing", "Umathbinrelspacing", "Umathchar", "Umathcharclass", "Umathchardef", "Umathcharfam", "Umathcharnum", "Umathcharnumdef", "Umathcharslot", "Umathclosebinspacing", "Umathcloseclosespacing", "Umathcloseinnerspacing", "Umathcloseopenspacing", "Umathcloseopspacing", "Umathcloseordspacing", "Umathclosepunctspacing", "Umathcloserelspacing", "Umathcode", "Umathcodenum", "Umathcodenumdef", "Umathconnectoroverlapmin", "Umathfractiondelsize", "Umathfractiondenomdown", "Umathfractiondenomvgap", "Umathfractionnumup", "Umathfractionnumvgap", "Umathfractionrule", "Umathinnerbinspacing", "Umathinnerclosespacing", "Umathinnerinnerspacing", "Umathinneropenspacing", "Umathinneropspacing", "Umathinnerordspacing", "Umathinnerpunctspacing", "Umathinnerrelspacing", "Umathlimitabovebgap", "Umathlimitabovekern", "Umathlimitabovevgap", "Umathlimitbelowbgap", "Umathlimitbelowkern", "Umathlimitbelowvgap", "Umathopbinspacing", "Umathopclosespacing", "Umathopenbinspacing", "Umathopenclosespacing", "Umathopeninnerspacing", "Umathopenopenspacing", "Umathopenopspacing", "Umathopenordspacing", "Umathopenpunctspacing", "Umathopenrelspacing", "Umathoperatorsize", "Umathopinnerspacing", "Umathopopenspacing", "Umathopopspacing", "Umathopordspacing", "Umathoppunctspacing", "Umathoprelspacing", "Umathordbinspacing", "Umathordclosespacing", "Umathordinnerspacing", "Umathordopenspacing", "Umathordopspacing", "Umathordordspacing", "Umathordpunctspacing", "Umathordrelspacing", "Umathoverbarkern", "Umathoverbarrule", "Umathoverbarvgap", "Umathoverdelimiterbgap", "Umathoverdelimitervgap", "Umathpunctbinspacing", "Umathpunctclosespacing", "Umathpunctinnerspacing", "Umathpunctopenspacing", "Umathpunctopspacing", "Umathpunctordspacing", "Umathpunctpunctspacing", "Umathpunctrelspacing", "Umathquad", "Umathradicaldegreeafter", "Umathradicaldegreebefore", "Umathradicaldegreeraise", "Umathradicalkern", "Umathradicalrule", "Umathradicalvgap", "Umathrelbinspacing", "Umathrelclosespacing", "Umathrelinnerspacing", "Umathrelopenspacing", "Umathrelopspacing", "Umathrelordspacing", "Umathrelpunctspacing", "Umathrelrelspacing", "Umathskewedfractionhgap", "Umathskewedfractionvgap", "Umathspaceafterscript", "Umathstackdenomdown", "Umathstacknumup", "Umathstackvgap", "Umathsubshiftdown", "Umathsubshiftdrop", "Umathsubsupshiftdown", "Umathsubsupvgap", "Umathsubtopmax", "Umathsupbottommin", "Umathsupshiftdrop", "Umathsupshiftup", "Umathsupsubbottommax", "Umathunderbarkern", "Umathunderbarrule", "Umathunderbarvgap", "Umathunderdelimiterbgap", "Umathunderdelimitervgap", "Umiddle", "Uoverdelimiter", "Uradical", "Uright", "Uroot", "Uskewed", "Uskewedwithdelims", "Ustack", "Ustartdisplaymath", "Ustartmath", "Ustopdisplaymath", "Ustopmath", "Usubscript", "Usuperscript", "Uunderdelimiter", "Uvextensible", "above", "abovedisplayshortskip", "abovedisplayskip", "abovewithdelims", "accent", "adjdemerits", "advance", "afterassignment", "aftergroup", "alignmark", "aligntab", "atop", "atopwithdelims", "attribute", "attributedef", "badness", "baselineskip", "batchmode", "begingroup", "belowdisplayshortskip", "belowdisplayskip", "binoppenalty", "bodydir", "botmark", "botmarks", "boundary", "box", "boxdir", "boxmaxdepth", "brokenpenalty", "catcode", "catcodetable", "char", "chardef", "cleaders", "clearmarks", "closein", "closeout", "clubpenalties", "clubpenalty", "copy", "copyfont", "count", "countdef", "cr", "crampeddisplaystyle", "crampedscriptscriptstyle", "crampedscriptstyle", "crampedtextstyle", "crcr", "csname", "currentgrouplevel", "currentgrouptype", "currentifbranch", "currentiflevel", "currentiftype", "day", "deadcycles", "def", "defaulthyphenchar", "defaultskewchar", "delcode", "delimiter", "delimiterfactor", "delimitershortfall", "detokenize", "dimen", "dimendef", "dimexpr", "directlua", "discretionary", "displayindent", "displaylimits", "displaystyle", "displaywidowpenalties", "displaywidowpenalty", "displaywidth", "divide", "doublehyphendemerits", "dp", "dump", "dviextension", "dvifeedback", "dvivariable", "eTeXVersion", "eTeXminorversion", "eTeXrevision", "eTeXversion", "edef", "efcode", "else", "emergencystretch", "end", "endcsname", "endgroup", "endinput", "endlinechar", "eqno", "errhelp", "errmessage", "errorcontextlines", "errorstopmode", "escapechar", "everycr", "everydisplay", "everyeof", "everyhbox", "everyjob", "everymath", "everypar", "everyvbox", "exhyphenchar", "exhyphenpenalty", "expandafter", "expanded", "expandglyphsinfont", "fam", "fi", "finalhyphendemerits", "firstmark", "firstmarks", "floatingpenalty", "font", "fontchardp", "fontcharht", "fontcharic", "fontcharwd", "fontdimen", "fontid", "fontname", "formatname", "futurelet", "gdef", "gleaders", "global", "globaldefs", "glueexpr", "glueshrink", "glueshrinkorder", "gluestretch", "gluestretchorder", "gluetomu", "halign", "hangafter", "hangindent", "hbadness", "hbox", "hfil", "hfill", "hfilneg", "hfuzz", "hoffset", "holdinginserts", "hrule", "hsize", "hskip", "hss", "ht", "hyphenation", "hyphenchar", "hyphenpenalty", "if", "ifabsdim", "ifabsnum", "ifcase", "ifcat", "ifcsname", "ifdefined", "ifdim", "ifeof", "iffalse", "iffontchar", "ifhbox", "ifhmode", "ifincsname", "ifinner", "ifmmode", "ifnum", "ifodd", "ifpdfabsdim", "ifpdfabsnum", "ifpdfprimitive", "ifprimitive", "iftrue", "ifvbox", "ifvmode", "ifvoid", "ifx", "ignoreligaturesinfont", "ignorespaces", "immediate", "indent", "initcatcodetable", "input", "inputlineno", "insert", "insertpenalties", "interactionmode", "interlinepenalties", "interlinepenalty", "jobname", "kern", "language", "lastbox", "lastkern", "lastlinefit", "lastnodetype", "lastpenalty", "lastsavedboxresourceindex", "lastsavedimageresourceindex", "lastsavedimageresourcepages", "lastskip", "lastxpos", "lastypos", "latelua", "lccode", "leaders", "left", "leftghost", "lefthyphenmin", "leftmarginkern", "leftskip", "leqno", "let", "letterspacefont", "limits", "linepenalty", "lineskip", "lineskiplimit", "localbrokenpenalty", "localinterlinepenalty", "localleftbox", "localrightbox", "long", "looseness", "lower", "lowercase", "lpcode", "luaescapestring", "luastartup", "luatexbanner", "luatexrevision", "luatexversion", "mag", "mark", "marks", "mathaccent", "mathbin", "mathchar", "mathchardef", "mathchoice", "mathclose", "mathcode", "mathdir", "mathdisplayskipmode", "matheqnogapstep", "mathinner", "mathop", "mathopen", "mathoption", "mathord", "mathpunct", "mathrel", "mathscriptsmode", "mathstyle", "mathsurroundskip", "mathsurround", "maxdeadcycles", "maxdepth", "meaning", "medmuskip", "message", "middle", "mkern", "month", "moveleft", "moveright", "mskip", "muexpr", "multiply", "muskip", "muskipdef", "mutoglue", "newlinechar", "noalign", "noboundary", "noexpand", "noindent", "nokerns", "nohrule", "noligs", "novrule", "nolimits", "nolocaldirs", "nolocalwhatsits", "nonscript", "nonstopmode", "normaldeviate", "nulldelimiterspace", "nullfont", "number", "numexpr", "odelcode", "odelimiter", "omathaccent", "omathchar", "omathchardef", "omathcode", "omit", "openin", "openout", "or", "oradical", "outer", "output", "outputbox", "outputpenalty", "over", "overfullrule", "overline", "overwithdelims", "pagebottomoffset", "pagedepth", "pagedir", "pagediscards", "pagefilllstretch", "pagefillstretch", "pagefilstretch", "pagegoal", "pageheight", "pageleftoffset", "pagerightoffset", "pageshrink", "pagestretch", "pagetopoffset", "pagetotal", "pagewidth", "par", "pardir", "parfillskip", "parindent", "parshape", "parshapedimen", "parshapeindent", "parshapelength", "parskip", "patterns", "pausing", "pdfadjustspacing", "pdfannot", "pdfcatalog", "pdfcolorstack", "pdfcolorstackinit", "pdfcompresslevel", "pdfcopyfont", "pdfcreationdate", "pdfdecimaldigits", "pdfdest", "pdfdestmargin", "pdfdraftmode", "pdfeachlineheight", "pdfeachlinedepth", "pdfendlink", "pdfendthread", "pdfextension", "pdfvariable", "pdffirstlineheight", "pdffontattr", "pdffontexpand", "pdffontname", "pdffontobjnum", "pdffontsize", "pdfgamma", "pdfgentounicode", "pdfglyphtounicode", "pdfhorigin", "pdfignoreddimen", "pdfimageaddfilename", "pdfimageapplygamma", "pdfimagegamma", "pdfimagehicolor", "pdfimageresolution", "pdfincludechars", "pdfinclusioncopyfonts", "pdfinclusionerrorlevel", "pdfinfo", "pdfinsertht", "pdflastannot", "pdflastlinedepth", "pdflastlink", "pdflastobj", "pdflastxform", "pdflastximage", "pdflastximagepages", "pdflastxpos", "pdflastypos", "pdflinkmargin", "pdfliteral", "pdfmapfile", "pdfmapline", "pdfminorversion", "pdfnames", "pdfnoligatures", "pdfnormaldeviate", "pdfobj", "pdfobjcompresslevel", "pdfoutline", "pdfoutput", "pdfpageattr", "pdfpagebox", "pdfpageheight", "pdfpageref", "pdfpageresources", "pdfpagesattr", "pdfpagewidth", "pdfpkmode", "pdfpkresolution", "pdfprimitive", "pdfprotrudechars", "pdfpxdimen", "pdfrandomseed", "pdfrefobj", "pdfrefxform", "pdfrefximage", "pdfreplacefont", "pdfrestore", "pdfretval", "pdfsave", "pdfsavepos", "pdfsetmatrix", "pdfsetrandomseed", "pdfstartlink", "pdfstartthread", "pdftexbanner", "pdftexrevision", "pdftexversion", "pdfthread", "pdfthreadmargin", "pdftracingfonts", "pdftrailer", "pdfuniformdeviate", "pdfuniqueresname", "pdfvorigin", "pdfxform", "pdfxformattr", "pdfxformname", "pdfxformresources", "pdfximage", "penalty", "postdisplaypenalty", "postexhyphenchar", "posthyphenchar", "predisplaydirection", "predisplaypenalty", "predisplaysize", "preexhyphenchar", "prehyphenchar", "pretolerance", "prevdepth", "prevgraf", "primitive", "protected", "pxdimen", "quitvmode", "radical", "raise", "randomseed", "read", "readline", "relax", "relpenalty", "right", "rightghost", "righthyphenmin", "rightmarginkern", "rightskip", "romannumeral", "rpcode", "saveboxresource", "saveimageresource", "savepos", "savecatcodetable", "savinghyphcodes", "savingvdiscards", "scantextokens", "scantokens", "scriptfont", "scriptscriptfont", "scriptscriptstyle", "scriptspace", "scriptstyle", "scrollmode", "setbox", "setfontid", "setlanguage", "setrandomseed", "sfcode", "shipout", "show", "showbox", "showboxbreadth", "showboxdepth", "showgroups", "showifs", "showlists", "showthe", "showtokens", "skewchar", "skip", "skipdef", "spacefactor", "spaceskip", "span", "special", "splitbotmark", "splitbotmarks", "splitdiscards", "splitfirstmark", "splitfirstmarks", "splitmaxdepth", "splittopskip", "string", "suppressfontnotfounderror", "suppressifcsnameerror", "suppresslongerror", "suppressoutererror", "synctex", "tabskip", "tagcode", "textdir", "textfont", "textstyle", "the", "thickmuskip", "thinmuskip", "time", "toks", "toksdef", "tolerance", "topmark", "topmarks", "topskip", "tracingassigns", "tracingcommands", "tracingfonts", "tracinggroups", "tracingifs", "tracinglostchars", "tracingmacros", "tracingnesting", "tracingonline", "tracingoutput", "tracingpages", "tracingparagraphs", "tracingrestores", "tracingscantokens", "tracingstats", "uccode", "uchyph", "underline", "unexpanded", "unhbox", "unhcopy", "uniformdeviate", "unkern", "unless", "unpenalty", "unskip", "unvbox", "unvcopy", "uppercase", "useboxresource", "useimageresource", "vadjust", "valign", "vbadness", "vbox", "vcenter", "vfil", "vfill", "vfilneg", "vfuzz", "voffset", "vrule", "vsize", "vskip", "vsplit", "vss", "vtop", "wd", "widowpenalties", "widowpenalty", "write", "xdef", "xleaders", "xspaceskip", "year" }, ["xetex"]={ "XeTeXversion" }, } \ No newline at end of file diff --git a/context/data/scite/context/scite-context-data-context.properties b/context/data/scite/context/scite-context-data-context.properties index 7ab883417..bbc7bf3fb 100644 --- a/context/data/scite/context/scite-context-data-context.properties +++ b/context/data/scite/context/scite-context-data-context.properties @@ -2,69 +2,69 @@ keywordclass.context.constants=\ zerocount minusone minustwo plusone \ plustwo plusthree plusfour plusfive plussix \ plusseven pluseight plusnine plusten plussixteen \ -plushundred plusthousand plustenthousand plustwentythousand medcard \ -maxcard maxcardminusone zeropoint onepoint halfapoint \ -onebasepoint maxdimen scaledpoint thousandpoint points \ -halfpoint zeroskip zeromuskip onemuskip pluscxxvii \ -pluscxxviii pluscclv pluscclvi normalpagebox endoflinetoken \ -outputnewlinechar emptytoks empty undefined voidbox \ -emptybox emptyvbox emptyhbox bigskipamount medskipamount \ -smallskipamount fmtname fmtversion texengine texenginename \ -texengineversion luatexengine pdftexengine xetexengine unknownengine \ -activecatcode bgroup egroup endline conditionaltrue \ -conditionalfalse attributeunsetvalue uprotationangle rightrotationangle downrotationangle \ -leftrotationangle inicatcodes ctxcatcodes texcatcodes notcatcodes \ -txtcatcodes vrbcatcodes prtcatcodes nilcatcodes luacatcodes \ -tpacatcodes tpbcatcodes xmlcatcodes ctdcatcodes escapecatcode \ -begingroupcatcode endgroupcatcode mathshiftcatcode alignmentcatcode endoflinecatcode \ -parametercatcode superscriptcatcode subscriptcatcode ignorecatcode spacecatcode \ -lettercatcode othercatcode activecatcode commentcatcode invalidcatcode \ -tabasciicode newlineasciicode formfeedasciicode endoflineasciicode endoffileasciicode \ -spaceasciicode hashasciicode dollarasciicode commentasciicode ampersandasciicode \ -colonasciicode backslashasciicode circumflexasciicode underscoreasciicode leftbraceasciicode \ -barasciicode rightbraceasciicode tildeasciicode delasciicode lessthanasciicode \ -morethanasciicode doublecommentsignal atsignasciicode exclamationmarkasciicode questionmarkasciicode \ -doublequoteasciicode singlequoteasciicode forwardslashasciicode primeasciicode hyphenasciicode \ -activemathcharcode activetabtoken activeformfeedtoken activeendoflinetoken batchmodecode \ -nonstopmodecode scrollmodecode errorstopmodecode bottomlevelgroupcode simplegroupcode \ -hboxgroupcode adjustedhboxgroupcode vboxgroupcode vtopgroupcode aligngroupcode \ -noaligngroupcode outputgroupcode mathgroupcode discretionarygroupcode insertgroupcode \ -vcentergroupcode mathchoicegroupcode semisimplegroupcode mathshiftgroupcode mathleftgroupcode \ -vadjustgroupcode 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 fontslantperpoint fontinterwordspace fontinterwordstretch \ -fontinterwordshrink fontexheight fontemwidth fontextraspace slantperpoint \ -interwordspace interwordstretch interwordshrink exheight emwidth \ -extraspace mathsupdisplay mathsupnormal mathsupcramped mathsubnormal \ -mathsubcombined 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 setupdocument 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 mathordcode mathopcode \ -mathbincode mathrelcode mathopencode mathclosecode mathpunctcode \ -mathalphacode mathinnercode mathnothingcode mathlimopcode mathnolopcode \ -mathboxcode mathchoicecode mathaccentcode mathradicalcode constantnumber \ -constantnumberargument constantdimen constantdimenargument constantemptyargument continueifinputfile \ -luastringsep !!bs !!es lefttorightmark righttoleftmark \ -breakablethinspace nobreakspace nonbreakablespace narrownobreakspace zerowidthnobreakspace \ -ideographicspace ideographichalffillspace twoperemspace threeperemspace fourperemspace \ -fiveperemspace sixperemspace figurespace punctuationspace hairspace \ -zerowidthspace zerowidthnonjoiner zerowidthjoiner zwnj zwj \ -optionalspace asciispacechar +plushundred plustwohundred plusthousand plustenthousand plustwentythousand \ +medcard maxcard maxcardminusone zeropoint onepoint \ +halfapoint onebasepoint maxdimen scaledpoint thousandpoint \ +points halfpoint zeroskip zeromuskip onemuskip \ +pluscxxvii pluscxxviii pluscclv pluscclvi normalpagebox \ +endoflinetoken outputnewlinechar emptytoks empty undefined \ +voidbox emptybox emptyvbox emptyhbox bigskipamount \ +medskipamount smallskipamount fmtname fmtversion texengine \ +texenginename texengineversion luatexengine pdftexengine xetexengine \ +unknownengine activecatcode bgroup egroup endline \ +conditionaltrue conditionalfalse attributeunsetvalue uprotationangle rightrotationangle \ +downrotationangle leftrotationangle inicatcodes ctxcatcodes texcatcodes \ +notcatcodes txtcatcodes vrbcatcodes prtcatcodes nilcatcodes \ +luacatcodes tpacatcodes tpbcatcodes xmlcatcodes ctdcatcodes \ +escapecatcode begingroupcatcode endgroupcatcode mathshiftcatcode alignmentcatcode \ +endoflinecatcode parametercatcode superscriptcatcode subscriptcatcode ignorecatcode \ +spacecatcode lettercatcode othercatcode activecatcode commentcatcode \ +invalidcatcode tabasciicode newlineasciicode formfeedasciicode endoflineasciicode \ +endoffileasciicode spaceasciicode hashasciicode dollarasciicode commentasciicode \ +ampersandasciicode colonasciicode backslashasciicode circumflexasciicode underscoreasciicode \ +leftbraceasciicode barasciicode rightbraceasciicode tildeasciicode delasciicode \ +lessthanasciicode morethanasciicode doublecommentsignal atsignasciicode exclamationmarkasciicode \ +questionmarkasciicode doublequoteasciicode singlequoteasciicode forwardslashasciicode primeasciicode \ +hyphenasciicode activemathcharcode activetabtoken activeformfeedtoken activeendoflinetoken \ +batchmodecode nonstopmodecode scrollmodecode errorstopmodecode bottomlevelgroupcode \ +simplegroupcode hboxgroupcode adjustedhboxgroupcode vboxgroupcode vtopgroupcode \ +aligngroupcode noaligngroupcode outputgroupcode mathgroupcode discretionarygroupcode \ +insertgroupcode vcentergroupcode mathchoicegroupcode semisimplegroupcode mathshiftgroupcode \ +mathleftgroupcode vadjustgroupcode 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 fontslantperpoint fontinterwordspace \ +fontinterwordstretch fontinterwordshrink fontexheight fontemwidth fontextraspace \ +slantperpoint interwordspace interwordstretch interwordshrink exheight \ +emwidth extraspace mathsupdisplay mathsupnormal mathsupcramped \ +mathsubnormal mathsubcombined 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 setupdocument 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 mathordcode \ +mathopcode mathbincode mathrelcode mathopencode mathclosecode \ +mathpunctcode mathalphacode mathinnercode mathnothingcode mathlimopcode \ +mathnolopcode mathboxcode mathchoicecode mathaccentcode mathradicalcode \ +constantnumber constantnumberargument constantdimen constantdimenargument constantemptyargument \ +continueifinputfile luastringsep !!bs !!es lefttorightmark \ +righttoleftmark breakablethinspace nobreakspace nonbreakablespace narrownobreakspace \ +zerowidthnobreakspace ideographicspace ideographichalffillspace twoperemspace threeperemspace \ +fourperemspace fiveperemspace sixperemspace figurespace punctuationspace \ +hairspace zerowidthspace zerowidthnonjoiner zerowidthjoiner zwnj \ +zwj optionalspace asciispacechar keywordclass.context.helpers=\ startsetups stopsetups startxmlsetups stopxmlsetups \ diff --git a/context/data/scite/context/scite-context-data-tex.properties b/context/data/scite/context/scite-context-data-tex.properties index ef01a072b..26e19b01a 100644 --- a/context/data/scite/context/scite-context-data-tex.properties +++ b/context/data/scite/context/scite-context-data-tex.properties @@ -20,49 +20,56 @@ unexpanded unless widowpenalties keywordclass.tex.luatex=\ Uchar Udelcode Udelcodenum Udelimiter \ -Udelimiterover Udelimiterunder Umathaccent Umathaxis Umathbinbinspacing \ -Umathbinclosespacing Umathbininnerspacing Umathbinopenspacing Umathbinopspacing Umathbinordspacing \ -Umathbinpunctspacing Umathbinrelspacing Umathchar Umathchardef Umathcharnum \ -Umathclosebinspacing Umathcloseclosespacing Umathcloseinnerspacing Umathcloseopenspacing Umathcloseopspacing \ -Umathcloseordspacing Umathclosepunctspacing Umathcloserelspacing Umathcode Umathcodenum \ -Umathconnectoroverlapmin Umathfractiondelsize Umathfractiondenomdown Umathfractiondenomvgap Umathfractionnumup \ -Umathfractionnumvgap Umathfractionrule Umathinnerbinspacing Umathinnerclosespacing Umathinnerinnerspacing \ -Umathinneropenspacing Umathinneropspacing Umathinnerordspacing Umathinnerpunctspacing Umathinnerrelspacing \ -Umathlimitabovebgap Umathlimitabovekern Umathlimitabovevgap Umathlimitbelowbgap Umathlimitbelowkern \ -Umathlimitbelowvgap Umathopbinspacing Umathopclosespacing Umathopenbinspacing Umathopenclosespacing \ -Umathopeninnerspacing Umathopenopenspacing Umathopenopspacing Umathopenordspacing Umathopenpunctspacing \ -Umathopenrelspacing Umathoperatorsize Umathopinnerspacing Umathopopenspacing Umathopopspacing \ -Umathopordspacing Umathoppunctspacing Umathoprelspacing Umathordbinspacing Umathordclosespacing \ -Umathordinnerspacing Umathordopenspacing Umathordopspacing Umathordordspacing Umathordpunctspacing \ -Umathordrelspacing Umathoverbarkern Umathoverbarrule Umathoverbarvgap Umathoverdelimiterbgap \ -Umathoverdelimitervgap Umathpunctbinspacing Umathpunctclosespacing Umathpunctinnerspacing Umathpunctopenspacing \ -Umathpunctopspacing Umathpunctordspacing Umathpunctpunctspacing Umathpunctrelspacing Umathquad \ -Umathradicaldegreeafter Umathradicaldegreebefore Umathradicaldegreeraise Umathradicalkern Umathradicalrule \ -Umathradicalvgap Umathrelbinspacing Umathrelclosespacing Umathrelinnerspacing Umathrelopenspacing \ -Umathrelopspacing Umathrelordspacing Umathrelpunctspacing Umathrelrelspacing Umathspaceafterscript \ -Umathstackdenomdown Umathstacknumup Umathstackvgap Umathsubshiftdown Umathsubshiftdrop \ -Umathsubsupshiftdown Umathsubsupvgap Umathsubtopmax Umathsupbottommin Umathsupshiftdrop \ -Umathsupshiftup Umathsupsubbottommax Umathunderbarkern Umathunderbarrule Umathunderbarvgap \ -Umathunderdelimiterbgap Umathunderdelimitervgap Uoverdelimiter Uradical Uroot \ -Ustack Ustartdisplaymath Ustartmath Ustopdisplaymath Ustopmath \ -Usubscript Usuperscript Uunderdelimiter adjustspacing alignmark \ -aligntab attribute attributedef bodydir boxdir \ -catcodetable clearmarks crampeddisplaystyle crampedscriptscriptstyle crampedscriptstyle \ -crampedtextstyle efcode fontid formatname gleaders \ -hyphenationmin ifabsdim ifabsnum ifprimitive ignoreligaturesinfont \ -initcatcodetable lastsavedboxresourceindex lastsavedimageresourceindex lastsavedimageresourcepages lastxpos \ +Udelimiterover Udelimiterunder Uhextensible Uleft Umathaccent \ +Umathaxis Umathbinbinspacing Umathbinclosespacing Umathbininnerspacing Umathbinopenspacing \ +Umathbinopspacing Umathbinordspacing Umathbinpunctspacing Umathbinrelspacing Umathchar \ +Umathcharclass Umathchardef Umathcharfam Umathcharnum Umathcharnumdef \ +Umathcharslot Umathclosebinspacing Umathcloseclosespacing Umathcloseinnerspacing Umathcloseopenspacing \ +Umathcloseopspacing Umathcloseordspacing Umathclosepunctspacing Umathcloserelspacing Umathcode \ +Umathcodenum Umathcodenumdef Umathconnectoroverlapmin Umathfractiondelsize Umathfractiondenomdown \ +Umathfractiondenomvgap Umathfractionnumup Umathfractionnumvgap Umathfractionrule Umathinnerbinspacing \ +Umathinnerclosespacing Umathinnerinnerspacing Umathinneropenspacing Umathinneropspacing Umathinnerordspacing \ +Umathinnerpunctspacing Umathinnerrelspacing Umathlimitabovebgap Umathlimitabovekern Umathlimitabovevgap \ +Umathlimitbelowbgap Umathlimitbelowkern Umathlimitbelowvgap Umathopbinspacing Umathopclosespacing \ +Umathopenbinspacing Umathopenclosespacing Umathopeninnerspacing Umathopenopenspacing Umathopenopspacing \ +Umathopenordspacing Umathopenpunctspacing Umathopenrelspacing Umathoperatorsize Umathopinnerspacing \ +Umathopopenspacing Umathopopspacing Umathopordspacing Umathoppunctspacing Umathoprelspacing \ +Umathordbinspacing Umathordclosespacing Umathordinnerspacing Umathordopenspacing Umathordopspacing \ +Umathordordspacing Umathordpunctspacing Umathordrelspacing Umathoverbarkern Umathoverbarrule \ +Umathoverbarvgap Umathoverdelimiterbgap Umathoverdelimitervgap Umathpunctbinspacing Umathpunctclosespacing \ +Umathpunctinnerspacing Umathpunctopenspacing Umathpunctopspacing Umathpunctordspacing Umathpunctpunctspacing \ +Umathpunctrelspacing Umathquad Umathradicaldegreeafter Umathradicaldegreebefore Umathradicaldegreeraise \ +Umathradicalkern Umathradicalrule Umathradicalvgap Umathrelbinspacing Umathrelclosespacing \ +Umathrelinnerspacing Umathrelopenspacing Umathrelopspacing Umathrelordspacing Umathrelpunctspacing \ +Umathrelrelspacing Umathskewedfractionhgap Umathskewedfractionvgap Umathspaceafterscript Umathstackdenomdown \ +Umathstacknumup Umathstackvgap Umathsubshiftdown Umathsubshiftdrop Umathsubsupshiftdown \ +Umathsubsupvgap Umathsubtopmax Umathsupbottommin Umathsupshiftdrop Umathsupshiftup \ +Umathsupsubbottommax Umathunderbarkern Umathunderbarrule Umathunderbarvgap Umathunderdelimiterbgap \ +Umathunderdelimitervgap Umiddle Uoverdelimiter Uradical Uright \ +Uroot Uskewed Uskewedwithdelims Ustack Ustartdisplaymath \ +Ustartmath Ustopdisplaymath Ustopmath Usubscript Usuperscript \ +Uunderdelimiter Uvextensible adjustspacing alignmark aligntab \ +attribute attributedef bodydir boxdir catcodetable \ +clearmarks copyfont crampeddisplaystyle crampedscriptscriptstyle crampedscriptstyle \ +crampedtextstyle draftmode dviextension dvifeedback dvivariable \ +efcode fontid formatname gleaders hyphenationmin \ +ifabsdim ifabsnum ifprimitive ignoreligaturesinfont initcatcodetable \ +insertht lastsavedboxresourceindex lastsavedimageresourceindex lastsavedimageresourcepages lastxpos \ lastypos latelua leftghost leftmarginkern letterspacefont \ localbrokenpenalty localinterlinepenalty localleftbox localrightbox lpcode \ luaescapestring luastartup luatexbanner luatexrevision luatexversion \ -luafunction mathdir matheqnogapstep mathstyle nokerns \ -noligs normaldeviate outputbox pagedir pageheight \ -pagebottomoffset pageleftoffset pagerightoffset pagetopoffset pagewidth \ -pardir postexhyphenchar posthyphenchar preexhyphenchar prehyphenchar \ -primitive protrudechars randomseed rightghost rightmarginkern \ -rpcode saveboxresource savecatcodetable saveimageresource savepos \ -scantextokens setrandomseed suppressfontnotfounderror suppressifcsnameerror suppresslongerror \ -suppressoutererror suppressmathparerror synctex tagcode textdir \ -uniformdeviate useboxresource useimageresource +luafunction mathdir mathdisplayskipmode matheqnogapstep mathoption \ +mathscriptsmode mathstyle mathsurroundskip nokerns nohrule \ +noligs novrule normaldeviate outputbox outputmode \ +pagedir pageheight pagebottomoffset pageleftoffset pagerightoffset \ +pagetopoffset pagewidth pardir pdfextension pdffeedback \ +pdfvariable postexhyphenchar posthyphenchar preexhyphenchar prehyphenchar \ +primitive protrudechars pxdimen randomseed rightghost \ +rightmarginkern rpcode saveboxresource savecatcodetable saveimageresource \ +savepos scantextokens setfontid setrandomseed suppressfontnotfounderror \ +suppressifcsnameerror suppresslongerror suppressoutererror suppressmathparerror synctex \ +tagcode textdir tracingfonts uniformdeviate useboxresource \ +useimageresource keywordclass.tex.omega=\ OmegaVersion bodydir chardp charht \ @@ -77,132 +84,15 @@ efcode expanded ifincsname ifpdfabsdim \ ifpdfabsnum ifpdfprimitive leftmarginkern letterspacefont lpcode \ pdfadjustspacing pdfannot pdfcatalog pdfcolorstack pdfcolorstackinit \ pdfcompresslevel pdfcopyfont pdfcreationdate pdfdecimaldigits pdfdest \ -pdfdestmargin pdfdraftmode pdfendlink pdfendthread pdffontattr \ -pdffontexpand pdffontname pdffontobjnum pdffontsize pdfgamma \ -pdfgentounicode pdfglyphtounicode pdfhorigin pdfignoreddimen pdfimageapplygamma \ -pdfimagegamma pdfimagehicolor pdfimageresolution pdfincludechars pdfinclusioncopyfonts \ -pdfinclusionerrorlevel pdfinfo pdfinsertht pdflastannot pdflastlink \ -pdflastobj pdflastxform pdflastximage pdflastximagepages pdflastxpos \ -pdflastypos pdflinkmargin pdfliteral pdfmapfile pdfmapline \ -pdfminorversion pdfnames pdfnoligatures pdfnormaldeviate pdfobj \ -pdfobjcompresslevel pdfoptionpdfminorversion pdfoutline pdfoutput pdfpageattr \ -pdfpagebox pdfpageheight pdfpageref pdfpageresources pdfpagesattr \ -pdfpagewidth pdfpkmode pdfpkresolution pdfprimitive pdfprotrudechars \ -pdfpxdimen pdfrandomseed pdfrefobj pdfrefxform pdfrefximage \ -pdfreplacefont pdfrestore pdfretval pdfsave pdfsavepos \ -pdfsetmatrix pdfsetrandomseed pdfstartlink pdfstartthread pdftexbanner \ -pdftexrevision pdftexversion pdfthread pdfthreadmargin pdftracingfonts \ -pdftrailer pdfuniformdeviate pdfuniqueresname pdfvorigin pdfxform \ -pdfxformattr pdfxformname pdfxformresources pdfximage quitvmode \ -rightmarginkern rpcode tagcode - -keywordclass.tex.tex=\ -- / AlephVersion Alephminorversion \ -Alephrevision Alephversion OmegaVersion Omegaminorversion Omegarevision \ -Omegaversion Udelcode Udelcodenum Udelimiter Udelimiterover \ -Udelimiterunder Umathaccent Umathaxis Umathbinbinspacing Umathbinclosespacing \ -Umathbininnerspacing Umathbinopenspacing Umathbinopspacing Umathbinordspacing Umathbinpunctspacing \ -Umathbinrelspacing Umathchar Umathchardef Umathcharnum Umathclosebinspacing \ -Umathcloseclosespacing Umathcloseinnerspacing Umathcloseopenspacing Umathcloseopspacing Umathcloseordspacing \ -Umathclosepunctspacing Umathcloserelspacing Umathcode Umathcodenum Umathconnectoroverlapmin \ -Umathfractiondelsize Umathfractiondenomdown Umathfractiondenomvgap Umathfractionnumup Umathfractionnumvgap \ -Umathfractionrule Umathinnerbinspacing Umathinnerclosespacing Umathinnerinnerspacing Umathinneropenspacing \ -Umathinneropspacing Umathinnerordspacing Umathinnerpunctspacing Umathinnerrelspacing Umathlimitabovebgap \ -Umathlimitabovekern Umathlimitabovevgap Umathlimitbelowbgap Umathlimitbelowkern Umathlimitbelowvgap \ -Umathopbinspacing Umathopclosespacing Umathopenbinspacing Umathopenclosespacing Umathopeninnerspacing \ -Umathopenopenspacing Umathopenopspacing Umathopenordspacing Umathopenpunctspacing Umathopenrelspacing \ -Umathoperatorsize Umathopinnerspacing Umathopopenspacing Umathopopspacing Umathopordspacing \ -Umathoppunctspacing Umathoprelspacing Umathordbinspacing Umathordclosespacing Umathordinnerspacing \ -Umathordopenspacing Umathordopspacing Umathordordspacing Umathordpunctspacing Umathordrelspacing \ -Umathoverbarkern Umathoverbarrule Umathoverbarvgap Umathoverdelimiterbgap Umathoverdelimitervgap \ -Umathpunctbinspacing Umathpunctclosespacing Umathpunctinnerspacing Umathpunctopenspacing Umathpunctopspacing \ -Umathpunctordspacing Umathpunctpunctspacing Umathpunctrelspacing Umathquad Umathradicaldegreeafter \ -Umathradicaldegreebefore Umathradicaldegreeraise Umathradicalkern Umathradicalrule Umathradicalvgap \ -Umathrelbinspacing Umathrelclosespacing Umathrelinnerspacing Umathrelopenspacing Umathrelopspacing \ -Umathrelordspacing Umathrelpunctspacing Umathrelrelspacing Umathspaceafterscript Umathstackdenomdown \ -Umathstacknumup Umathstackvgap Umathsubshiftdown Umathsubshiftdrop Umathsubsupshiftdown \ -Umathsubsupvgap Umathsubtopmax Umathsupbottommin Umathsupshiftdrop Umathsupshiftup \ -Umathsupsubbottommax Umathunderbarkern Umathunderbarrule Umathunderbarvgap Umathunderdelimiterbgap \ -Umathunderdelimitervgap Uoverdelimiter Uradical Uroot Ustack \ -Ustartdisplaymath Ustartmath Ustopdisplaymath Ustopmath Usubscript \ -Usuperscript Uunderdelimiter above abovedisplayshortskip abovedisplayskip \ -abovewithdelims accent adjdemerits advance afterassignment \ -aftergroup alignmark aligntab atop atopwithdelims \ -attribute attributedef badness baselineskip batchmode \ -begingroup belowdisplayshortskip belowdisplayskip binoppenalty bodydir \ -botmark botmarks box boxdir boxmaxdepth \ -brokenpenalty catcode catcodetable char chardef \ -cleaders clearmarks closein closeout clubpenalties \ -clubpenalty copy count countdef cr \ -crampeddisplaystyle crampedscriptscriptstyle crampedscriptstyle crampedtextstyle crcr \ -csname currentgrouplevel currentgrouptype currentifbranch currentiflevel \ -currentiftype day deadcycles def defaulthyphenchar \ -defaultskewchar delcode delimiter delimiterfactor delimitershortfall \ -detokenize dimen dimendef dimexpr directlua \ -discretionary displayindent displaylimits displaystyle displaywidowpenalties \ -displaywidowpenalty displaywidth divide doublehyphendemerits dp \ -dump eTeXVersion eTeXminorversion eTeXrevision eTeXversion \ -edef efcode else emergencystretch end \ -endcsname endgroup endinput endlinechar eqno \ -errhelp errmessage errorcontextlines errorstopmode escapechar \ -everycr everydisplay everyeof everyhbox everyjob \ -everymath everypar everyvbox exhyphenchar exhyphenpenalty \ -expandafter expanded expandglyphsinfont fam fi \ -finalhyphendemerits firstmark firstmarks floatingpenalty font \ -fontchardp fontcharht fontcharic fontcharwd fontdimen \ -fontid fontname formatname futurelet gdef \ -gleaders global globaldefs glueexpr glueshrink \ -glueshrinkorder gluestretch gluestretchorder gluetomu halign \ -hangafter hangindent hbadness hbox hfil \ -hfill hfilneg hfuzz hoffset holdinginserts \ -hrule hsize hskip hss ht \ -hyphenation hyphenchar hyphenpenalty if ifabsdim \ -ifabsnum ifcase ifcat ifcsname ifdefined \ -ifdim ifeof iffalse iffontchar ifhbox \ -ifhmode ifincsname ifinner ifmmode ifnum \ -ifodd ifpdfabsdim ifpdfabsnum ifpdfprimitive ifprimitive \ -iftrue ifvbox ifvmode ifvoid ifx \ -ignoreligaturesinfont ignorespaces immediate indent initcatcodetable \ -input inputlineno insert insertpenalties interactionmode \ -interlinepenalties interlinepenalty jobname kern language \ -lastbox lastkern lastlinefit lastnodetype lastpenalty \ -lastsavedboxresourceindex lastsavedimageresourceindex lastsavedimageresourcepages lastskip lastxpos \ -lastypos latelua lccode leaders left \ -leftghost lefthyphenmin leftmarginkern leftskip leqno \ -let letterspacefont limits linepenalty lineskip \ -lineskiplimit localbrokenpenalty localinterlinepenalty localleftbox localrightbox \ -long looseness lower lowercase lpcode \ -luaescapestring luastartup luatexbanner luatexrevision luatexversion \ -mag mark marks mathaccent mathbin \ -mathchar mathchardef mathchoice mathclose mathcode \ -mathdir mathinner mathop mathopen mathord \ -mathpunct mathrel mathstyle mathsurround maxdeadcycles \ -maxdepth meaning medmuskip message middle \ -mkern month moveleft moveright mskip \ -muexpr multiply muskip muskipdef mutoglue \ -newlinechar noalign noboundary noexpand noindent \ -nokerns noligs nolimits nolocaldirs nolocalwhatsits \ -nonscript nonstopmode normaldeviate nulldelimiterspace nullfont \ -number numexpr odelcode odelimiter omathaccent \ -omathchar omathchardef omathcode omit openin \ -openout or oradical outer output \ -outputbox outputpenalty over overfullrule overline \ -overwithdelims pagebottomoffset pagedepth pagedir pagediscards \ -pagefilllstretch pagefillstretch pagefilstretch pagegoal pageheight \ -pageleftoffset pagerightoffset pageshrink pagestretch pagetopoffset \ -pagetotal pagewidth par pardir parfillskip \ -parindent parshape parshapedimen parshapeindent parshapelength \ -parskip patterns pausing pdfadjustspacing pdfannot \ -pdfcatalog pdfcolorstack pdfcolorstackinit pdfcompresslevel pdfcopyfont \ -pdfcreationdate pdfdecimaldigits pdfdest pdfdestmargin pdfdraftmode \ -pdfendlink pdfendthread pdffontattr pdffontexpand pdffontname \ +pdfdestmargin pdfdraftmode pdfeachlineheight pdfeachlinedepth pdfendlink \ +pdfendthread pdffirstlineheight pdffontattr pdffontexpand pdffontname \ pdffontobjnum pdffontsize pdfgamma pdfgentounicode pdfglyphtounicode \ pdfhorigin pdfignoreddimen pdfimageapplygamma pdfimagegamma pdfimagehicolor \ pdfimageresolution pdfincludechars pdfinclusioncopyfonts pdfinclusionerrorlevel pdfinfo \ -pdfinsertht pdflastannot pdflastlink pdflastobj pdflastxform \ -pdflastximage pdflastximagepages pdflastxpos pdflastypos pdflinkmargin \ -pdfliteral pdfmapfile pdfmapline pdfminorversion pdfnames \ -pdfnoligatures pdfnormaldeviate pdfobj pdfobjcompresslevel pdfoptionpdfminorversion \ +pdfinsertht pdflastannot pdflastlinedepth pdflastlink pdflastobj \ +pdflastxform pdflastximage pdflastximagepages pdflastxpos pdflastypos \ +pdflinkmargin pdfliteral pdfmapfile pdfmapline pdfminorversion \ +pdfnames pdfnoligatures pdfnormaldeviate pdfobj pdfobjcompresslevel \ pdfoutline pdfoutput pdfpageattr pdfpagebox pdfpageheight \ pdfpageref pdfpageresources pdfpagesattr pdfpagewidth pdfpkmode \ pdfpkresolution pdfprimitive pdfprotrudechars pdfpxdimen pdfrandomseed \ @@ -211,26 +101,151 @@ pdfretval pdfsave pdfsavepos pdfsetmatrix pdfsetrandomseed \ pdfstartlink pdfstartthread pdftexbanner pdftexrevision pdftexversion \ pdfthread pdfthreadmargin pdftracingfonts pdftrailer pdfuniformdeviate \ pdfuniqueresname pdfvorigin pdfxform pdfxformattr pdfxformname \ -pdfxformresources pdfximage penalty postdisplaypenalty postexhyphenchar \ -posthyphenchar predisplaydirection predisplaypenalty predisplaysize preexhyphenchar \ -prehyphenchar pretolerance prevdepth prevgraf primitive \ -protected quitvmode radical raise randomseed \ -read readline relax relpenalty right \ -rightghost righthyphenmin rightmarginkern rightskip romannumeral \ -rpcode saveboxresource saveimageresource savepos savecatcodetable \ -savinghyphcodes savingvdiscards scantextokens scantokens scriptfont \ -scriptscriptfont scriptscriptstyle scriptspace scriptstyle scrollmode \ -setbox setlanguage setrandomseed sfcode shipout \ -show showbox showboxbreadth showboxdepth showgroups \ -showifs showlists showthe showtokens skewchar \ -skip skipdef spacefactor spaceskip span \ -special splitbotmark splitbotmarks splitdiscards splitfirstmark \ -splitfirstmarks splitmaxdepth splittopskip string suppressfontnotfounderror \ -suppressifcsnameerror suppresslongerror suppressoutererror synctex tabskip \ -tagcode textdir textfont textstyle the \ -thickmuskip thinmuskip time toks toksdef \ -tolerance topmark topmarks topskip tracingassigns \ -tracingcommands tracinggroups tracingifs tracinglostchars tracingmacros \ +pdfxformresources pdfximage quitvmode rightmarginkern rpcode \ +tagcode + +keywordclass.tex.tex=\ +- / AlephVersion Alephminorversion \ +Alephrevision Alephversion OmegaVersion Omegaminorversion Omegarevision \ +Omegaversion Udelcode Udelcodenum Udelimiter Udelimiterover \ +Udelimiterunder Uhextensible Uleft Umathaccent Umathaxis \ +Umathbinbinspacing Umathbinclosespacing Umathbininnerspacing Umathbinopenspacing Umathbinopspacing \ +Umathbinordspacing Umathbinpunctspacing Umathbinrelspacing Umathchar Umathcharclass \ +Umathchardef Umathcharfam Umathcharnum Umathcharnumdef Umathcharslot \ +Umathclosebinspacing Umathcloseclosespacing Umathcloseinnerspacing Umathcloseopenspacing Umathcloseopspacing \ +Umathcloseordspacing Umathclosepunctspacing Umathcloserelspacing Umathcode Umathcodenum \ +Umathcodenumdef Umathconnectoroverlapmin Umathfractiondelsize Umathfractiondenomdown Umathfractiondenomvgap \ +Umathfractionnumup Umathfractionnumvgap Umathfractionrule Umathinnerbinspacing Umathinnerclosespacing \ +Umathinnerinnerspacing Umathinneropenspacing Umathinneropspacing Umathinnerordspacing Umathinnerpunctspacing \ +Umathinnerrelspacing Umathlimitabovebgap Umathlimitabovekern Umathlimitabovevgap Umathlimitbelowbgap \ +Umathlimitbelowkern Umathlimitbelowvgap Umathopbinspacing Umathopclosespacing Umathopenbinspacing \ +Umathopenclosespacing Umathopeninnerspacing Umathopenopenspacing Umathopenopspacing Umathopenordspacing \ +Umathopenpunctspacing Umathopenrelspacing Umathoperatorsize Umathopinnerspacing Umathopopenspacing \ +Umathopopspacing Umathopordspacing Umathoppunctspacing Umathoprelspacing Umathordbinspacing \ +Umathordclosespacing Umathordinnerspacing Umathordopenspacing Umathordopspacing Umathordordspacing \ +Umathordpunctspacing Umathordrelspacing Umathoverbarkern Umathoverbarrule Umathoverbarvgap \ +Umathoverdelimiterbgap Umathoverdelimitervgap Umathpunctbinspacing Umathpunctclosespacing Umathpunctinnerspacing \ +Umathpunctopenspacing Umathpunctopspacing Umathpunctordspacing Umathpunctpunctspacing Umathpunctrelspacing \ +Umathquad Umathradicaldegreeafter Umathradicaldegreebefore Umathradicaldegreeraise Umathradicalkern \ +Umathradicalrule Umathradicalvgap Umathrelbinspacing Umathrelclosespacing Umathrelinnerspacing \ +Umathrelopenspacing Umathrelopspacing Umathrelordspacing Umathrelpunctspacing Umathrelrelspacing \ +Umathskewedfractionhgap Umathskewedfractionvgap Umathspaceafterscript Umathstackdenomdown Umathstacknumup \ +Umathstackvgap Umathsubshiftdown Umathsubshiftdrop Umathsubsupshiftdown Umathsubsupvgap \ +Umathsubtopmax Umathsupbottommin Umathsupshiftdrop Umathsupshiftup Umathsupsubbottommax \ +Umathunderbarkern Umathunderbarrule Umathunderbarvgap Umathunderdelimiterbgap Umathunderdelimitervgap \ +Umiddle Uoverdelimiter Uradical Uright Uroot \ +Uskewed Uskewedwithdelims Ustack Ustartdisplaymath Ustartmath \ +Ustopdisplaymath Ustopmath Usubscript Usuperscript Uunderdelimiter \ +Uvextensible above abovedisplayshortskip abovedisplayskip abovewithdelims \ +accent adjdemerits advance afterassignment aftergroup \ +alignmark aligntab atop atopwithdelims attribute \ +attributedef badness baselineskip batchmode begingroup \ +belowdisplayshortskip belowdisplayskip binoppenalty bodydir botmark \ +botmarks boundary box boxdir boxmaxdepth \ +brokenpenalty catcode catcodetable char chardef \ +cleaders clearmarks closein closeout clubpenalties \ +clubpenalty copy copyfont count countdef \ +cr crampeddisplaystyle crampedscriptscriptstyle crampedscriptstyle crampedtextstyle \ +crcr csname currentgrouplevel currentgrouptype currentifbranch \ +currentiflevel currentiftype day deadcycles def \ +defaulthyphenchar defaultskewchar delcode delimiter delimiterfactor \ +delimitershortfall detokenize dimen dimendef dimexpr \ +directlua discretionary displayindent displaylimits displaystyle \ +displaywidowpenalties displaywidowpenalty displaywidth divide doublehyphendemerits \ +dp dump dviextension dvifeedback dvivariable \ +eTeXVersion eTeXminorversion eTeXrevision eTeXversion edef \ +efcode else emergencystretch end endcsname \ +endgroup endinput endlinechar eqno errhelp \ +errmessage errorcontextlines errorstopmode escapechar everycr \ +everydisplay everyeof everyhbox everyjob everymath \ +everypar everyvbox exhyphenchar exhyphenpenalty expandafter \ +expanded expandglyphsinfont fam fi finalhyphendemerits \ +firstmark firstmarks floatingpenalty font fontchardp \ +fontcharht fontcharic fontcharwd fontdimen fontid \ +fontname formatname futurelet gdef gleaders \ +global globaldefs glueexpr glueshrink glueshrinkorder \ +gluestretch gluestretchorder gluetomu halign hangafter \ +hangindent hbadness hbox hfil hfill \ +hfilneg hfuzz hoffset holdinginserts hrule \ +hsize hskip hss ht hyphenation \ +hyphenchar hyphenpenalty if ifabsdim ifabsnum \ +ifcase ifcat ifcsname ifdefined ifdim \ +ifeof iffalse iffontchar ifhbox ifhmode \ +ifincsname ifinner ifmmode ifnum ifodd \ +ifpdfabsdim ifpdfabsnum ifpdfprimitive ifprimitive iftrue \ +ifvbox ifvmode ifvoid ifx ignoreligaturesinfont \ +ignorespaces immediate indent initcatcodetable input \ +inputlineno insert insertpenalties interactionmode interlinepenalties \ +interlinepenalty jobname kern language lastbox \ +lastkern lastlinefit lastnodetype lastpenalty lastsavedboxresourceindex \ +lastsavedimageresourceindex lastsavedimageresourcepages lastskip lastxpos lastypos \ +latelua lccode leaders left leftghost \ +lefthyphenmin leftmarginkern leftskip leqno let \ +letterspacefont limits linepenalty lineskip lineskiplimit \ +localbrokenpenalty localinterlinepenalty localleftbox localrightbox long \ +looseness lower lowercase lpcode luaescapestring \ +luastartup luatexbanner luatexrevision luatexversion mag \ +mark marks mathaccent mathbin mathchar \ +mathchardef mathchoice mathclose mathcode mathdir \ +mathdisplayskipmode matheqnogapstep mathinner mathop mathopen \ +mathoption mathord mathpunct mathrel mathscriptsmode \ +mathstyle mathsurroundskip mathsurround maxdeadcycles maxdepth \ +meaning medmuskip message middle mkern \ +month moveleft moveright mskip muexpr \ +multiply muskip muskipdef mutoglue newlinechar \ +noalign noboundary noexpand noindent nokerns \ +nohrule noligs novrule nolimits nolocaldirs \ +nolocalwhatsits nonscript nonstopmode normaldeviate nulldelimiterspace \ +nullfont number numexpr odelcode odelimiter \ +omathaccent omathchar omathchardef omathcode omit \ +openin openout or oradical outer \ +output outputbox outputpenalty over overfullrule \ +overline overwithdelims pagebottomoffset pagedepth pagedir \ +pagediscards pagefilllstretch pagefillstretch pagefilstretch pagegoal \ +pageheight pageleftoffset pagerightoffset pageshrink pagestretch \ +pagetopoffset pagetotal pagewidth par pardir \ +parfillskip parindent parshape parshapedimen parshapeindent \ +parshapelength parskip patterns pausing pdfadjustspacing \ +pdfannot pdfcatalog pdfcolorstack pdfcolorstackinit pdfcompresslevel \ +pdfcopyfont pdfcreationdate pdfdecimaldigits pdfdest pdfdestmargin \ +pdfdraftmode pdfeachlineheight pdfeachlinedepth pdfendlink pdfendthread \ +pdfextension pdfvariable pdffirstlineheight pdffontattr pdffontexpand \ +pdffontname pdffontobjnum pdffontsize pdfgamma pdfgentounicode \ +pdfglyphtounicode pdfhorigin pdfignoreddimen pdfimageaddfilename pdfimageapplygamma \ +pdfimagegamma pdfimagehicolor pdfimageresolution pdfincludechars pdfinclusioncopyfonts \ +pdfinclusionerrorlevel pdfinfo pdfinsertht pdflastannot pdflastlinedepth \ +pdflastlink pdflastobj pdflastxform pdflastximage pdflastximagepages \ +pdflastxpos pdflastypos pdflinkmargin pdfliteral pdfmapfile \ +pdfmapline pdfminorversion pdfnames pdfnoligatures pdfnormaldeviate \ +pdfobj pdfobjcompresslevel pdfoutline pdfoutput pdfpageattr \ +pdfpagebox pdfpageheight pdfpageref pdfpageresources pdfpagesattr \ +pdfpagewidth pdfpkmode pdfpkresolution pdfprimitive pdfprotrudechars \ +pdfpxdimen pdfrandomseed pdfrefobj pdfrefxform pdfrefximage \ +pdfreplacefont pdfrestore pdfretval pdfsave pdfsavepos \ +pdfsetmatrix pdfsetrandomseed pdfstartlink pdfstartthread pdftexbanner \ +pdftexrevision pdftexversion pdfthread pdfthreadmargin pdftracingfonts \ +pdftrailer pdfuniformdeviate pdfuniqueresname pdfvorigin pdfxform \ +pdfxformattr pdfxformname pdfxformresources pdfximage penalty \ +postdisplaypenalty postexhyphenchar posthyphenchar predisplaydirection predisplaypenalty \ +predisplaysize preexhyphenchar prehyphenchar pretolerance prevdepth \ +prevgraf primitive protected pxdimen quitvmode \ +radical raise randomseed read readline \ +relax relpenalty right rightghost righthyphenmin \ +rightmarginkern rightskip romannumeral rpcode saveboxresource \ +saveimageresource savepos savecatcodetable savinghyphcodes savingvdiscards \ +scantextokens scantokens scriptfont scriptscriptfont scriptscriptstyle \ +scriptspace scriptstyle scrollmode setbox setfontid \ +setlanguage setrandomseed sfcode shipout show \ +showbox showboxbreadth showboxdepth showgroups showifs \ +showlists showthe showtokens skewchar skip \ +skipdef spacefactor spaceskip span special \ +splitbotmark splitbotmarks splitdiscards splitfirstmark splitfirstmarks \ +splitmaxdepth splittopskip string suppressfontnotfounderror suppressifcsnameerror \ +suppresslongerror suppressoutererror synctex tabskip tagcode \ +textdir textfont textstyle the thickmuskip \ +thinmuskip time toks toksdef tolerance \ +topmark topmarks topskip tracingassigns tracingcommands \ +tracingfonts tracinggroups tracingifs tracinglostchars tracingmacros \ tracingnesting tracingonline tracingoutput tracingpages tracingparagraphs \ tracingrestores tracingscantokens tracingstats uccode uchyph \ underline unexpanded unhbox unhcopy uniformdeviate \ diff --git a/doc/context/documents/general/manuals/luatex.pdf b/doc/context/documents/general/manuals/luatex.pdf index 9388fbea3..426f3ed1d 100644 Binary files a/doc/context/documents/general/manuals/luatex.pdf and b/doc/context/documents/general/manuals/luatex.pdf differ diff --git a/doc/context/scripts/mkiv/mtx-plain.html b/doc/context/scripts/mkiv/mtx-plain.html new file mode 100644 index 000000000..d7600397a --- /dev/null +++ b/doc/context/scripts/mkiv/mtx-plain.html @@ -0,0 +1,53 @@ + + + + + + + + + + + Plain TeX Runner 1.00 + + + + + +
+
Plain TeX Runner 1.00
+
+
+
+
wiki: http://contextgarden.net | mail: ntg-context@ntg.nl | website: http://www.pragma-ade.nl
+
+
+
+ +
+
+

Command line options

+ + + + + + + + + +
flagvaluedescription
--makecreate format file
--fontscreate plain font database
--runprocess file
--formatstringformat name (default: luatex-plain)
--enginestringengine to use (default: luatex)
--jituse luajittex
+
+
+
+ + diff --git a/doc/context/scripts/mkiv/mtx-plain.man b/doc/context/scripts/mkiv/mtx-plain.man new file mode 100644 index 000000000..c2e0e0bd9 --- /dev/null +++ b/doc/context/scripts/mkiv/mtx-plain.man @@ -0,0 +1,42 @@ +.TH "mtx-plain" "1" "01-01-2015" "version 1.00" "Plain TeX Runner" +.SH NAME +.B mtx-plain +.SH SYNOPSIS +.B mtxrun --script plain [ +.I OPTIONS ... +.B ] [ +.I FILENAMES +.B ] +.SH DESCRIPTION +.B Plain TeX Runner +.SH OPTIONS +.TP +.B --make +create format file +.TP +.B --fonts +create plain font database +.TP +.B --run +process file +.TP +.B --format=string +format name (default: luatex-plain) +.TP +.B --engine=string +engine to use (default: luatex) +.TP +.B --jit +use luajittex +.SH AUTHOR +More information about ConTeXt and the tools that come with it can be found at: + + +.B "maillist:" +ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context + +.B "webpage:" +http://www.pragma-ade.nl / http://tex.aanhet.net + +.B "wiki:" +http://contextgarden.net diff --git a/doc/context/scripts/mkiv/mtx-plain.xml b/doc/context/scripts/mkiv/mtx-plain.xml new file mode 100644 index 000000000..a0d73279e --- /dev/null +++ b/doc/context/scripts/mkiv/mtx-plain.xml @@ -0,0 +1,20 @@ + + + + mtx-plain + Plain TeX Runner + 1.00 + + + + + create format file + create plain font database + process file + format name (default: luatex-plain) + engine to use (default: luatex) + use luajittex + + + + diff --git a/doc/context/sources/general/manuals/luatex/luatex-enhancements.tex b/doc/context/sources/general/manuals/luatex/luatex-enhancements.tex index bc68a0db9..6dfaecaba 100644 --- a/doc/context/sources/general/manuals/luatex/luatex-enhancements.tex +++ b/doc/context/sources/general/manuals/luatex/luatex-enhancements.tex @@ -618,7 +618,7 @@ This new integer parameter allows you to alter the number of the box that will b used to store the page sent to the output routine. Its default value is 255, and the acceptable range is from 0 to 65535. -\section{\type {\fontid}} +\section{\type {\fontid} and \type {\setfontid}} \startsyntax \fontid\font @@ -640,6 +640,9 @@ order of loading fonts. For instance, when in \CONTEXT\ virtual math \UNICODE\ fonts are used, we can easily get over a hundred ids in use. Not all ids have to be bound to a real font, after all it's just a number. +The primitive \type {\setfontid} can be used to enable a font with the given id +(which of course needs to be a valid one). + \section{\type {\gleaders}} This type of leaders is anchored to the origin of the box to be shipped out. So @@ -647,6 +650,14 @@ they are like normal \type {\leaders} in that they align nicely, except that the alignment is based on the {\it largest\/} enclosing box instead of the {\it smallest\/}. The \type {g} stresses this global nature. +\section{\type {\nohrule} and \type {\novrule}} + +Because internally box resources and image resources are now stored as a special +kind of rule, we also introduced an empty rule variant. Because introducing a new +keyword can cause incompatibilities, two new primitives were introduced: \type +{\nohrule} and \type {\novrule}. These can be used to reserve space. This is +often more efficient than creating an empty box with fake dimensions). + \section{\type {\Uchar}} The expandable command \type {\Uchar} reads a number between~0 and $1{,}114{,}111$ @@ -660,6 +671,21 @@ within the constraints of the \type {\lefthyphenmin} and \type {\righthyphenmin} values (as stored in the glyph node). This primitive accepts a number and stores the value with the language. +\section{\type {\boundary} and \type {\noboundary}} + +The \type {\noboundary} commands used to inject a whatsit node but now injects a normal +node with type \type {boundary} and subtype~0. In addition you can say: + +\starttyping +x\boundary 123\relax y +\stoptyping + +This has the same effect but the subtype is now~1 and the value~123 is stored. The +traditional ligature builder still sees this as a cancel boundary directive but at the +\LUA\ end you can implement different behaviour. The added benefit of passing this +value is a side effect of the generalization. + + \section{Debugging} If \type {\tracingonline} is larger than~2, the node list display will also print @@ -700,6 +726,19 @@ optional parameters are not implemented for \type {\saveboxresource}. \pdfrefxform width 20mm height 10mm depth 5mm \pdflastxform \stoptyping +\section{\type {\outputmode} and \type {\draftmode}} + +The \type {\outputmode} variable tells \LUATEX\ what it has to produce: + +\starttabulate[|l|l|] +\NC \type {0} \NC \DVI\ code \NC \NR +\NC \type {1} \NC \PDF\ code \NC \NR +\stoptabulate + +The value of the \type {\draftmode} counter signals the backend if it should +output less. The \PDF\ backend accepts a value of~$1$, while the \DVI\ backend +ignores the value. + \section{File syntax} \LUATEX\ will accept a braced argument as a file name: @@ -723,6 +762,12 @@ expansion takes place inside the argument. This allows for embedded spaces, without the need for double quotes. Macro expansion takes place inside the argument. +\section{Writing to file} + +You can now open upto 127 files with \type {\openout}. When no file is open +writes will go to the console and log. As a consequence a system command is +no longer possible but one can use \type {os.execute} to do the same. + \stopchapter \stopcomponent diff --git a/doc/context/sources/general/manuals/luatex/luatex-fonts.tex b/doc/context/sources/general/manuals/luatex/luatex-fonts.tex index 8ea4058a6..937e99c91 100644 --- a/doc/context/sources/general/manuals/luatex/luatex-fonts.tex +++ b/doc/context/sources/general/manuals/luatex/luatex-fonts.tex @@ -526,6 +526,11 @@ parameters to that command. The allowed commands and their arguments are: \NC comment \NC any \NC any \NC the arguments of this command are ignored\NC\NR \stoptabulate +When a font id is set to~0 then it will be replaced by the currently assigned +font id. This prevents the need for hackery with future id's (normally one could +use \type {font.nextid} but when more complex fonts are built in the meantime +other instances could have been loaded. + Here is a rather elaborate glyph commands example: \starttyping diff --git a/doc/context/sources/general/manuals/luatex/luatex-languages.tex b/doc/context/sources/general/manuals/luatex/luatex-languages.tex index 56978b0fd..83c251473 100644 --- a/doc/context/sources/general/manuals/luatex/luatex-languages.tex +++ b/doc/context/sources/general/manuals/luatex/luatex-languages.tex @@ -334,6 +334,23 @@ Differences between \LUATEX\ and \TEX82 that are a direct result of that: \stopitem \stopitemize +Because we store penalties in the disc node the \type {\discretionary} command has +been extended to accept an optional penalty specification, so you can do the +following: + +\startbuffer +\hsize1mm +1:foo{\hyphenpenalty 10000\discretionary{}{}{}}bar\par +2:foo\discretionary penalty 10000 {}{}{}bar\par +3:foo\discretionary{}{}{}bar\par +\stopbuffer + +\typebuffer + +This results in: + +\blank \start \getbuffer \stop \blank + Inserted characters and ligatures inherit their attributes from the nearest glyph node item (usually the preceding one, but the following one for the items inserted at the left-hand side of a word). diff --git a/doc/context/sources/general/manuals/luatex/luatex-libraries.tex b/doc/context/sources/general/manuals/luatex/luatex-libraries.tex index df03e348d..339f25eaf 100644 --- a/doc/context/sources/general/manuals/luatex/luatex-libraries.tex +++ b/doc/context/sources/general/manuals/luatex/luatex-libraries.tex @@ -18,7 +18,12 @@ the \LUATEX\ executable. Together, they allow \LUA\ scripts to query and change number of \TEX's internal variables, run various internal \TEX\ functions, and set up \LUATEX's hooks to execute \LUA\ code. -The following sections are in alphabetical order. +The following sections are in alphabetical order. For any callback (and +manipulation of nodes) the following is true: you have a lot of freedom which +also means that you can mess up the node lists and nodes themselves. So, a bit of +defensive programming doesn't hurt. A crash can happen when you spoil things or +when \LUATEX\ can recognize the issue, a panic exit will happen. Don't bother the +team with such issues. \section{The \type {callback} library} @@ -532,6 +537,22 @@ represent a hbox. Failure to do so will result in a fatal error. Setting this callback to \type {false} is possible, but dangerous, because it is possible you will end up in an unfixable \quote {deadcycles loop}. +\subsubsection{\type {append_to_vlist_filter}} + +This callback is called whenever \LUATEX\ adds a box to a vertical list: + +\startfunctioncall +function( box, locationcode, , + mirrored) + return list, prevdepth +end +\stopfunctioncall + +It is ok to return nothing in which case you also need to flush the box or deal +with it yourself. The prevdepth is also optional. Locations are \type {box}, +\type {alignment}, \type {equation}, \type {equation_number} and \type +{post_linebreak}. + \subsubsection{\type {post_linebreak_filter}} This callback is called just after \LUATEX\ has converted a list of nodes into a @@ -585,6 +606,61 @@ end This callback does not replace any internal code. +\subsubsection{\type {hpack_quality} and \type {vpack_quality}} + +These two callbacks can be used to intercept the overfull messages. They get a few +arguments: + +\startfunctioncall +function( incident, detail, head, first, + last) + return whatever +end +\stopfunctioncall + +The incident is one of \type {overfull}, \type {underfull}, \type {loose} or +\type {tight}. The detail is either the amount of overflow (in case of \type +{overerful}, or the badness. The head is the list that is constructed (when +protrusion or expansion is enabled, this is an intermediate list). For a hpack +you can return a node (for instance an overfull rule indicator). That node will +be appended to the list (just like \TEX's own rule would). + +\subsubsection{\type {hpack_quality}} + +This callback can be used to intercept the overfull messages that can result from +packing a horizontal list (as happens in the par builder). The function takes a +few arguments: + +\startfunctioncall +function( incident, detail, head, first, + last) + return whatever +end +\stopfunctioncall + +The incident is one of \type {overfull}, \type {underfull}, \type {loose} or +\type {tight}. The detail is either the amount of overflow in case of \type +{overfull}, or the badness otherwise. The head is the list that is constructed +(when protrusion or expansion is enabled, this is an intermediate list). +Optionally you can return a node, for instance an overfull rule indicator. That +node will be appended to the list (just like \TEX's own rule would). + +\subsubsection{\type {vpack_quality}} + +This callback can be used to intercept the overfull messages that can result from +packing a vertical list (as happens in the page builder). The function takes a +few arguments: + +\startfunctioncall +function( incident, detail, head, first, + last) +end +\stopfunctioncall + +The incident is one of \type {overfull}, \type {underfull}, \type {loose} or +\type {tight}. The detail is either the amount of overflow in case of \type +{overfull}, or the badness otherwise. The head is the list that is constructed. + \subsubsection{\type {pre_output_filter}} This callback is called when \TEX\ is ready to start boxing the box 255 for \type @@ -637,6 +713,9 @@ and because it can sometimes be handy when special processing has to take place. Setting this callback to \type {false} will prevent the internal ligature creation pass. +You must not ruin the node list. For instance, the head normally is a local par node, +and the tail a glue. Messing too much can push \LUATEX\ into panic mode. + \subsubsection{\type {kerning}} \startfunctioncall @@ -650,6 +729,9 @@ node list it receives. See \type {ligaturing} for calling conventions. Setting this callback to \type {false} will prevent the internal kern insertion pass. +You must not ruin the node list. For instance, the head normally is a local par node, +and the tail a glue. Messing too much can push \LUATEX\ into panic mode. + \subsubsection{\type {mlist_to_hlist}} This callback replaces \LUATEX's math list to node list conversion algorithm. @@ -1352,8 +1434,6 @@ conversion in memory and passing the result directly to the backend. This might save some runtime in one|-|pass workflows. This feature is currently not meant for production. -%*********************************************************************** - \section{The \type {font} library} The font library provides the interface into the internals of the font system, @@ -2231,7 +2311,6 @@ The subtables table has: \NC kernclass \NC table \NC (only if used)\NC \NR \stoptabulate - The kernclass with subtables table has: \starttabulate[|lT|l|p|] @@ -2242,6 +2321,10 @@ The kernclass with subtables table has: \NC offsets \NC array of numbers \NC \NC \NR \stoptabulate +Note: the kernclass (as far as we can see) always has one entry so it could be one level +deep instead. Also the seconds start at \type {[2]} which is close to the fontforge +internals so we keep that too. + \subsubsubsection{gsub table} This has identical layout to the \type {gpos} table, except for the @@ -2537,8 +2620,6 @@ reversecoverage: \NC replacements \NC string \NC \NC \NR \stoptabulate -%*********************************************************************** - \section{The \type {img} library} The \type {img} library can be used as an alternative to \type {\pdfximage} and @@ -2610,44 +2691,48 @@ user-supplied and automatic ones. % hahe: i need to add r/w ro column... \starttabulate[|l|l|p|] -\NC \bf field name\NC \bf type \NC description \NC \NR -\NC attr \NC string \NC the image attributes for \LUATEX \NC \NR -\NC bbox \NC table \NC table with 4 boundingbox dimensions - \type {llx}, \type {lly}, \type {urx}, - and \type {ury} overruling the \type {pagebox} - entry\NC \NR -\NC colordepth \NC number \NC the number of bits used by the color space\NC \NR -\NC colorspace \NC number \NC the color space object number \NC \NR -\NC depth \NC number \NC the image depth for \LUATEX\ - (in scaled points)\NC \NR -\NC filename \NC string \NC the image file name \NC \NR -\NC filepath \NC string \NC the full (expanded) file name of the image\NC \NR -\NC height \NC number \NC the image height for \LUATEX\ - (in scaled points)\NC \NR -\NC imagetype \NC string \NC one of \type {pdf}, \type {png}, \type {jpg}, \type {jp2}, - \type {jbig2}, or \type {nil} \NC \NR -\NC index \NC number \NC the \PDF\ image name suffix \NC \NR -\NC objnum \NC number \NC the \PDF\ image object number \NC \NR -\NC page \NC ?? \NC the identifier for the requested image page - (type is number or string, - default is the number 1)\NC \NR -\NC pagebox \NC string \NC the requested bounding box, one of - \type {none}, \type {media}, \type {crop}, - \type {bleed}, \type {trim}, \type {art} \NC \NR -\NC pages \NC number \NC the total number of available pages \NC \NR -\NC rotation \NC number \NC the image rotation from included \PDF\ file, - in multiples of 90~deg. \NC \NR -\NC stream \NC string \NC the raw stream data for an \type {/Xobject} - \type {/Form} object\NC \NR -\NC transform \NC number \NC the image transform, integer number 0..7\NC \NR -\NC width \NC number \NC the image width for \LUATEX\ - (in scaled points)\NC \NR -\NC xres \NC number \NC the horizontal natural image resolution - (in \DPI) \NC \NR -\NC xsize \NC number \NC the natural image width \NC \NR -\NC yres \NC number \NC the vertical natural image resolution - (in \DPI) \NC \NR -\NC ysize \NC number \NC the natural image height \NC \NR +\NC \bf field name \NC \bf type \NC description \NC \NR +\NC attr \NC string \NC the image attributes for \LUATEX \NC \NR +\NC bbox \NC table \NC table with 4 boundingbox dimensions + \type {llx}, \type {lly}, \type {urx}, + and \type {ury} overruling the \type {pagebox} + entry\NC \NR +\NC colordepth \NC number \NC the number of bits used by the color space\NC \NR +\NC colorspace \NC number \NC the color space object number \NC \NR +\NC depth \NC number \NC the image depth for \LUATEX\ + (in scaled points)\NC \NR +\NC filename \NC string \NC the image file name \NC \NR +\NC filepath \NC string \NC the full (expanded) file name of the image\NC \NR +\NC height \NC number \NC the image height for \LUATEX\ + (in scaled points)\NC \NR +\NC imagetype \NC string \NC one of \type {pdf}, \type {png}, \type {jpg}, \type {jp2}, + \type {jbig2}, or \type {nil} \NC \NR +\NC index \NC number \NC the \PDF\ image name suffix \NC \NR +\NC objnum \NC number \NC the \PDF\ image object number \NC \NR +\NC page \NC ?? \NC the identifier for the requested image page + (type is number or string, + default is the number 1)\NC \NR +\NC pagebox \NC string \NC the requested bounding box, one of + \type {none}, \type {media}, \type {crop}, + \type {bleed}, \type {trim}, \type {art} \NC \NR +\NC pages \NC number \NC the total number of available pages \NC \NR +\NC rotation \NC number \NC the image rotation from included \PDF\ file, + in multiples of 90~deg. \NC \NR +\NC stream \NC string \NC the raw stream data for an \type {/Xobject} + \type {/Form} object\NC \NR +\NC transform \NC number \NC the image transform, integer number 0..7\NC \NR +\NC width \NC number \NC the image width for \LUATEX\ + (in scaled points)\NC \NR +\NC xres \NC number \NC the horizontal natural image resolution + (in \DPI) \NC \NR +\NC xsize \NC number \NC the natural image width \NC \NR +\NC yres \NC number \NC the vertical natural image resolution + (in \DPI) \NC \NR +\NC ysize \NC number \NC the natural image height \NC \NR +\NC visiblefileame \NC string \NC when set, this name will find its way in the + \PDF\ file as \type {PTEX} specification; when + an empty string is assigned nothing is written + to file, otherwise the natural filename is taken \NC \NR \stoptabulate A running (undefined) dimension in \type {width}, \type {height}, or \type @@ -2821,8 +2906,6 @@ This function returns a list with the supported \PDF\ page box names, currently these are \type {media}, \type {crop}, \type {bleed}, \type {trim}, and \type {art} (all in lowercase letters). -%*********************************************************************** - \section{The \type {kpse} library} This library provides two separate, but nearly identical interfaces to the @@ -4279,6 +4362,28 @@ The preferred interface is now \type {pdf.setpageattributes}, \type properties and \type {pdf.getpageattributes}, \type {pdf.getpageattributes} and \type {pdf.getpageresources} for querying them. +\subsection{\type {pdf.xformattributes}, \type {pdf.xformresources}} + +These variables offer a read|-|write interface to related token lists. The value +types are strings. The variables have no interaction with the corresponding +\PDFTEX\ token registers \type {\pdfxformattr} and \type {\pdfxformresources}. They +are written out to the \PDF\ file directly after the \PDFTEX\ token registers. + +The preferred interface is now \type {pdf.setxformattributes} and \type +{pdf.setxformattributes} for setting these properties and \type +{pdf.getxformattributes} and \type {pdf.getxformresources} for querying them. + +\subsection{\type {pdf.setcompresslevel} and \type {pdf.setobjcompresslevel}} + +These two functions set the level of compression. The minimum valu sis~0, +the maximum is~9. + +\subsection{\type {pdf.lastobj}, \type {pdf.lastlink}, \type {pdf.lastannot}, +and \type {pdf.retval}} + +These status variables are similar to the ones traditionally used at the \TEX\ +end. + \subsection{\type {pdf.h}, \type {pdf.v}} These are the \type {h} and \type {v} values that define the current location on @@ -4449,6 +4554,15 @@ page without doing anything else. This function can only be used from within pdf.registerannot ( objnum) \stopfunctioncall +\subsection{\type {pdf.newcolorstack}} + +This function allocates a new color stack and returns it's id. The arguments +are the same as for the similar backend extension primitive. + +\startfunctioncall +pdf.newcolorstack("0 g","page",true) -- page|direct|origin +\stopfunctioncall + \section{The \type {pdfscanner} library} The \type {pdfscanner} library allows interpretation of PDF content streams and @@ -4661,6 +4775,7 @@ The current list is: \NC hash_size \NC size of hash \NC \NR \NC hash_extra \NC extra allowed hash \NC \NR \NC font_ptr \NC number of active fonts \NC \NR +\NC input_ptr \NC th elevel of input we're at \NC \NR \NC max_in_stack \NC max used input stack entries \NC \NR \NC max_nest_stack \NC max used nesting stack entries \NC \NR \NC max_param_stack \NC max used parameter stack entries \NC \NR @@ -4683,7 +4798,11 @@ The current list is: \NC filename \NC name of the current input file \NC \NR \NC inputid \NC numeric id of the current input \NC \NR \NC linenumber \NC location in the current input file \NC \NR -\NC lasterrorstring \NC last error string\NC \NR +\NC lasterrorstring \NC last tex error string \NC \NR +\NC lastluaerrorstring \NC last lua error string \NC \NR +\NC lastwarningtag \NC last warning string\NC \NR +\NC lastwarningstring \NC last warning tag, normally an indication of in what part\NC \NR +\NC lasterrorcontext \NC last error context string (with newlines) \NC \NR \NC luabytecodes \NC number of active \LUA\ bytecode registers \NC \NR \NC luabytecode_bytes \NC number of bytes in \LUA\ bytecode registers \NC \NR \NC luastate_bytes \NC number of bytes in use by \LUA\ interpreters \NC \NR @@ -4697,6 +4816,9 @@ The current list is: \NC ini_version \NC \type {true} if this is an \INITEX\ run \NC \NR \stoptabulate +The error and warning messages can be wiped with the \type {resetmessages} +function. + \section{The \type {tex} library} The \type {tex} table contains a large list of virtual internal \TEX\ @@ -4726,7 +4848,9 @@ writable as well as readable (stuff like \type {\tracingcommands} and For all the parameters in this section, it is possible to access them directly using their names as index in the \type {tex} table, or by using one of the -functions \type {tex.get()} and \type {tex.set()}. +functions \type {tex.get} and \type {tex.set}. If you created aliasses, +you can use accessors like \type {tex.getdimen} as these also understand +names of built|-|in variables. The exact parameters and return values differ depending on the actual parameter, and so does whether \type {tex.set} has any effect. For the parameters that {\it @@ -4735,10 +4859,22 @@ can\/} be set, it is possible to use \type {global} as the first argument to \startfunctioncall tex.set ( n, ...) -tex.set ('global', n, ...) +tex.set ("global", n, ...) ... = tex.get ( n) \stopfunctioncall +There are also dedicated setters, getters and checkers: + +\startfunctioncall +local d = tex.getdimen("foo") +if tex.isdimen("bar") then + tex.setdimen("bar",d) +end +\stopfunctioncall + +There are such helpers for \type {dimen}, \type {count}, \type {skip}, \type +{box} and \type {attribute} registers. + \subsubsection{Integer parameters} The integer parameters accept and return \LUA\ numbers. @@ -4892,6 +5028,9 @@ tex.splitmaxdepth tex.vfuzz tex.voffset tex.vsize +tex.prevdepth +tex.prevgraf +tex.spacefactor \stoptyping \stopthreecolumns @@ -4907,10 +5046,40 @@ tex.pagegoal tex.pageshrink tex.pagestretch tex.pagetotal -tex.prevdepth \stoptyping \stopthreecolumns +Beware: as with all \LUA\ tables you can add values to them. So, the following is valid: + +\starttyping +tex.foo = 123 +\stoptyping + +When you access a \TEX\ parameter a look up takes place. For read||only variables +that means that you will get something back, but when you set them you create a +new entry in the table thereby making the original invisible. + +There are a few special cases that we make an exception for: \type {prevdepth}, +\type {prevgraf} and \type {spacefactor}. These normally are accessed via the +\type {tex.nest} table: + +\starttyping +tex.nest[tex.nest.ptr].prevdepth = p +tex.nest[tex.nest.ptr].spacefactor = s +\stoptyping + +However, the following also works: + +\starttyping +tex.prevdepth = p +tex.spacefactor = s +\stoptyping + +Keep in mind that when you mess with node lists directly at the \LUA\ end you +might need to update the top of the nesting stack's \type {prevdepth} explicitly +as there is no way \LUATEX\ can guess your intentions. By using the accessor in +the \type {tex} tables, you get and set the values atthe top of the nest stack. + \subsubsection{Direction parameters} The direction parameters are read|-|only and return a \LUA\ string. @@ -5118,6 +5287,16 @@ tex.setskip ('global', s, s) s = tex.getskip ( s) \stopfunctioncall +We have similar setters for \type {count}, \type {dimen}, \type {muskip}, and +\type {toks}. Counters and dimen are represented by numbers, skips and muskips by +nodes, and toks by strings. For tokens registers we have an alternative where a +catcode table is specified: + +\startfunctioncall +tex.scantoks(0,3,"$e=mc^2$") +tex.scantoks("global",0,"$\int\limits^1_2$") +\stopfunctioncall + In the function-based interface, it is possible to define values globally by using the string \type {global} as the first function argument. @@ -5192,6 +5371,13 @@ And the table for \type {delcode} is an array with 4 numbers, like this: { small_fam, small_char, large_fam, large_char} \stoptyping +You can also avoid the table: + +\startfunctioncall +class, family, char = tex.getmathcodes ( n) +smallfam, smallchar, largefam, largechar = tex.getdelcodes ( n) +\stopfunctioncall + Normally, the third and fourth values in a delimiter code assignment will be zero according to \type {\Udelcode} usage, but the returned table can have values there (if the delimiter code was set using \type {\delcode}, for example). Unset \type @@ -5236,6 +5422,28 @@ invalid as well. To prevent this from happening, always use \type tex.box[0] = node.copy_list(tex.box[2]) \stoptyping +The following function will register a box for reuse (this is modelled after so +called xforms in \PDF). You can (re)use the box with \type {\useboxresource} or +by creating a rule node with subtype~2. + +\starttyping +local index = tex.saveboxresource(n,attributes,resources) +\stoptyping + +You can generate the reference (a rule type) with: + +\starttyping +local reused = tex.useboxresource(n,wd,ht,dp) +\stoptyping + +The dimensions are optional and the final ones are returned as extra values. The +following is just a bonus (no dimensions returned means that the resource is +unknown): + +\starttyping +local w, h, d = tex.getboxresourcedimensions(n) +\stoptyping + \subsection{Math parameters} It is possible to set and query the internal math parameters using: @@ -5298,6 +5506,10 @@ script crampedscript scriptscript crampedscriptscript \stoptyping +The value is either a number (representing a dimension or number) or a glue spec +node representing a muskip for \type {ordordspacing} and similar spacing +parameters. + \subsection{Special list heads} The virtual table \type {tex.lists} contains the set of internal registers that @@ -5536,6 +5748,26 @@ Associates \type {csname} with the internal font number \type {fontid}. The definition is global if (and only if) \type {global} is specified and true (the setting of \type {globaldefs} is not taken into account). +\subsubsection{\type {tex.getlinenumber} and \type {tex.setlinenumber}} + +You can mess with the current line number: + +\startfunctioncall +local n = tex.getlinenumber() +tex.setlinenumber(n+10) +\stopfunctioncall + +which can be shortcut to: + +\startfunctioncall +tex.setlinenumber(10,true) +\stopfunctioncall + +This might be handy when you have a callback that read numbers from a file and +combines them in one line (in which case an error message probably has to refer +to the original line). Interference with \TEX's internal handling of numbers is +of course possible. + \subsubsection{\type {tex.error}} \startfunctioncall @@ -5598,15 +5830,15 @@ will define \type {\LuaTeXformatname} with the same intrinsic meaning as the documented primitive \type {\formatname}, provided that the control sequences \type {\LuaTeXformatname} is currently undefined. -Second example: - -\starttyping - tex.enableprimitives('Omega',tex.extraprimitives ('omega')) -\stoptyping - -will define a whole series of csnames like \type {\Omegatextdir}, \type -{\Omegapardir}, etc., but it will stick with \type {\OmegaVersion} instead of -creating the doubly-prefixed \type {\OmegaOmegaVersion}. +% Second example: +% +% \starttyping +% tex.enableprimitives('Omega',tex.extraprimitives ('omega')) +% \stoptyping +% +% will define a whole series of csnames like \type {\Omegatextdir}, \type +% {\Omegapardir}, etc., but it will stick with \type {\OmegaVersion} instead of +% creating the doubly-prefixed \type {\OmegaOmegaVersion}. When \LUATEX\ is run with \type {--ini} only the \TEX82 primitives and \type {\directlua} are available, so no extra primitives {\bf at all}. @@ -5655,22 +5887,20 @@ end \NC tex \NC \ctxlua{document.showprimitives('tex') } \NC \NR \NC core \NC \ctxlua{document.showprimitives('core') } \NC \NR \NC etex \NC \ctxlua{document.showprimitives('etex') } \NC \NR -\NC pdftex \NC \ctxlua{document.showprimitives('pdftex') } \NC \NR \NC luatex \NC \ctxlua{document.showprimitives('luatex') } \NC \NR -\NC umath \NC \ctxlua{document.showprimitives('umath') } \NC \NR \stoptabulate Note that \type {'luatex'} does not contain \type {directlua}, as that isconsidered to be a core primitive, along with all the \TEX82 primitives, so it is part of the list that is returned from \type {'core'}. -\type {'umath'} is a subset of \type {'luatex'} that covers the Unicode math -primitives as it might be desired to handle the prefixing of that subset -differently. +% \type {'umath'} is a subset of \type {'luatex'} that covers the Unicode math +% primitives as it might be desired to handle the prefixing of that subset +% differently. Running \type {tex.extraprimitives()} will give you the complete list of primitives \type {-ini} startup. It is exactly equivalent to \type -{tex.extraprimitives('etex', 'pdftex' and 'luatex')}. +{tex.extraprimitives('etex' and 'luatex')}. \subsubsection{\type {tex.primitives}} @@ -5683,6 +5913,12 @@ about. The keys in the hash are primitives names, the values are tables representing tokens (see~\in{section }[luatokens]). The third value is always zero. +{\em In the beginning we had \type {omega} and \type {pdftex} subsets but in the +meantime relevant primitives ave been promoted (either or not adapted) to the +\type {luatex} set when found useful, or removed when considered to be of no use. +Originally we had two sets of math definition primitives but the \OMEGA\ ones +have been removed, so we no longer have a subset for math either.} + \subsection{Core functionality interfaces} \subsubsection{\type {tex.badness}} @@ -5899,7 +6135,10 @@ This function behaves like \type {texio.write}, but make sure that the given strings will appear at the beginning of a new line. You can pass a single empty string if you only want to move to the next line. -\section[luatokens]{The \type {token} library} +\section[luatokens]{The \type {oldtoken} library (obsolete)} + +{\em Nota Bene: This library will disappear soon. It is replaced by the \type +{token} library, that used to be called \type {newroken}.} The \type {token} table contains interface functions to \TEX's handling of tokens. These functions are most useful when combined with the \type @@ -5918,49 +6157,49 @@ consists of three numeric entries: {equivalence table} \NC \NR \stoptabulate -\subsection{\type {token.get_next}} +\subsection{\type {oldtoken.get_next}} \startfunctioncall -token t = token.get_next() +token t = oldtoken.get_next() \stopfunctioncall This fetches the next input token from the current input source, without expansion. -\subsection{\type {token.is_expandable}} +\subsection{\type {oldtoken.is_expandable}} \startfunctioncall - b = token.is_expandable( t) + b = oldtoken.is_expandable( t) \stopfunctioncall This tests if the token \type {t} could be expanded. -\subsection{\type {token.expand}} +\subsection{\type {oldtoken.expand}} \startfunctioncall -token.expand( t) +oldtoken.expand( t) \stopfunctioncall If a token is expandable, this will expand one level of it, so that the first token of the expansion will now be the next token to be read by \type -{token.get_next()}. +{oldtoken.get_next()}. -\subsection{\type {token.is_activechar}} +\subsection{\type {oldtoken.is_activechar}} \startfunctioncall - b = token.is_activechar( t) + b = oldtoken.is_activechar( t) \stopfunctioncall This is a special test that is sometimes handy. Discovering whether some control sequence is the result of an active character turned out to be very hard otherwise. -\subsection{\type {token.create}} +\subsection{\type {oldtoken.create}} \startfunctioncall -token t = token.create( csname) -token t = token.create( charcode) -token t = token.create( charcode, catcode) +token t = oldtoken.create( csname) +token t = oldtoken.create( charcode) +token t = oldtoken.create( charcode, catcode) \stopfunctioncall This is the token factory. If you feed it a string, then it is the name of a @@ -5972,17 +6211,17 @@ optional second number gives its category code. This means it is possible to overrule a character's category code, with a few exceptions: the category codes~0 (escape), 9~(ignored), 13~(active), 14~(comment), and 15 (invalid) cannot occur inside a token. The values~0, 9, 14 and~15 are therefore illegal as input to -\type {token.create()}, and active characters will be resolved immediately. +\type {oldtoken.create()}, and active characters will be resolved immediately. Note: unknown string sequences and never defined active characters will result in a token representing an \quote {undefined control sequence} with a near|-|random name. It is {\em not} possible to define brand new control sequences using -\type {token.create}! +\type {oldtoken.create}! -\subsection{\type {token.command_name}} +\subsection{\type {oldtoken.command_name}} \startfunctioncall - commandname = token.command_name( t) + commandname = oldtoken.command_name( t) \stopfunctioncall This returns the name associated with the \quote {command} value of the token in @@ -5990,19 +6229,19 @@ This returns the name associated with the \quote {command} value of the token in primitives. For instance, all \type {\ifxxx} tests are grouped under \type {if_test}, and the \quote {command modifier} defines which test is to be run. -\subsection{\type {token.command_id}} +\subsection{\type {oldtoken.command_id}} \startfunctioncall - i = token.command_id( commandname) + i = oldtoken.command_id( commandname) \stopfunctioncall This returns a number that is the inverse operation of the previous command, to be used as the first item in a token table. -\subsection{\type {token.csname_name}} +\subsection{\type {oldtoken.csname_name}} \startfunctioncall - csname = token.csname_name( t) + csname = oldtoken.csname_name( t) \stopfunctioncall This returns the name associated with the \quote {equivalence table} value of the @@ -6013,20 +6252,20 @@ Keep in mind that there are potentially two control sequences that return the same csname string: single character control sequences and active characters have the same \quote {name}. -\subsection{\type {token.csname_id}} +\subsection{\type {oldtoken.csname_id}} \startfunctioncall - i = token.csname_id( csname) + i = oldtoken.csname_id( csname) \stopfunctioncall This returns a number that is the inverse operation of the previous command, to be used as the third item in a token table. -\subsection{The \type {newtoken} libray} +\subsection{The \type {token} libray} The current \type {token} library will be replaced by a new one that is more flexible and powerful. The transition takes place in steps. In version 0.80 we -have \type {newtoken} and in version 0.85 the old lib will be replaced +have \type {token} and in version 0.85 the old lib will be replaced completely. So if you use this new mechanism in production code you need to be aware of incompatible updates between 0.80 and 0.90. Because the related in- and output code will also be cleaned up and rewritten you should be aware of @@ -6041,7 +6280,7 @@ parsers without too much overhead. It's up to macro package writers to see how they can benefit from this as the main principle behind \LUATEX\ is to provide a minimal set of tools and no solutions. -The current functions in the \type {newtoken} namespace are given in the next +The current functions in the \type {token} namespace are given in the next table: \starttabulate[|lT|lT|p|] @@ -6057,6 +6296,8 @@ table: \NC scan_code \NC bitset \NC returns a character if its category is in the given bitset (representing catcodes) \NC \NR \NC scan_string \NC \NC returns a string given between \type {{}}, as \type {\macro} or as sequence of characters with catcode 11 or 12 \NC \NR \NC scan_word \NC \NC returns a sequence of characters with catcode 11 or 12 as string \NC \NR +\NC scan_csname \NC \NC returns \type {foo} after scanning \type {\foo} \NC \NR +\NC set_macro \NC see below \NC assign a macro \NC \NR \NC create \NC \NC returns a userdata token object of the given control sequence name (or character); this interface can change \NC \NR \stoptabulate @@ -6086,9 +6327,9 @@ following definition: we get: \starttabulate[|l|Tl|l|] -\NC \type {\directlua{newtoken.scan_string()}{foo}} \NC \directlua{context("{\\red\\type {"..newtoken.scan_string().."}}")} {foo} \NC full expansion \NR -\NC \type {\directlua{newtoken.scan_string()}foo} \NC \directlua{context("{\\red\\type {"..newtoken.scan_string().."}}")} foo \NC letters and others \NR -\NC \type {\directlua{newtoken.scan_string()}\foo} \NC \directlua{context("{\\red\\type {"..newtoken.scan_string().."}}")}\foo \NC meaning \NR +\NC \type {\directlua{token.scan_string()}{foo}} \NC \directlua{context("{\\red\\type {"..token.scan_string().."}}")} {foo} \NC full expansion \NR +\NC \type {\directlua{token.scan_string()}foo} \NC \directlua{context("{\\red\\type {"..token.scan_string().."}}")} foo \NC letters and others \NR +\NC \type {\directlua{token.scan_string()}\foo} \NC \directlua{context("{\\red\\type {"..token.scan_string().."}}")}\foo \NC meaning \NR \stoptabulate The \type {\foo} case only gives the meaning, but one can pass an already @@ -6099,8 +6340,8 @@ do expand. The \type {scan_word} scanner can be used to implement for instance a number scanner: \starttyping -function newtokens.scan_number(base) - return tonumber(newtoken.scan_word(),base) +function token.scan_number(base) + return tonumber(token.scan_word(),base) end \stoptyping @@ -6110,7 +6351,7 @@ in the input. The creator function can be used as follows: \starttyping -local t = newtoken("relax") +local t = token("relax") \stoptyping This gives back a token object that has the properties of the \type {\relax} @@ -6159,7 +6400,7 @@ You can also do this: \starttyping \directlua { function mymacro() - local d = newtoken.scan_dimen() + local d = token.scan_dimen() ... end } @@ -6194,6 +6435,30 @@ more so we know then what will stay and go. A positive side effect of this transition is that we can simplify the input part because we no longer need to intercept using callbacks. +The \type {set_macro} function can get upto 4 arguments: + +\starttyping +setmacro("csname","content") +setmacro("csname","content","global") +setmacro("csname") +\stoptyping + +You can pass a catcodetable identifier as first argument: + +\starttyping +setmacro(catcodetable,"csname","content") +setmacro(catcodetable,"csname","content","global") +setmacro(catcodetable,"csname") +\stoptyping + +The results are like: + +\starttyping + \def\csname{content} +\gdef\csname{content} + \def\csname{} +\stoptyping + \stopchapter \stopcomponent diff --git a/doc/context/sources/general/manuals/luatex/luatex-lua.tex b/doc/context/sources/general/manuals/luatex/luatex-lua.tex index 3fe2ec9ad..86ddc17e8 100644 --- a/doc/context/sources/general/manuals/luatex/luatex-lua.tex +++ b/doc/context/sources/general/manuals/luatex/luatex-lua.tex @@ -156,6 +156,15 @@ Then it checks the various safety switches. You can use those to disable some Furthermore, it disables loading of compiled \LUA\ libraries and it makes \type {io.open()} fail on files that are opened for anything besides reading. +When \LUATEX\ starts it set the locale to a neutral value. If for some reason you use +\type {os.locale}, you need to make sire you nil it afterwards because otherise it +can interfere with code that for instance generates dates. You can nil the +locale with + +\starttyping +os.setlocale(nil.nil) +\stoptyping + \type {--nosocket} makes the socket library unavailable, so that \LUA\ cannot use networking. @@ -242,7 +251,7 @@ for this variable is \type {CLUAINPUTS}, and by default it has this value: \starttyping CLUAINPUTS=.:$SELFAUTOLOC/lib/{$progname,$engine,}/lua// -\stoptyping % $ +\stoptyping This path is imperfect (it requires a \TDS\ subtree below the binaries directory), but the architecture has to be in the path somewhere, and the diff --git a/doc/context/sources/general/manuals/luatex/luatex-math.tex b/doc/context/sources/general/manuals/luatex/luatex-math.tex index 88809d9d9..6c83b7786 100644 --- a/doc/context/sources/general/manuals/luatex/luatex-math.tex +++ b/doc/context/sources/general/manuals/luatex/luatex-math.tex @@ -91,7 +91,7 @@ Unaltered: New primitives that are compatible with \XETEX: \starttabulate[|l|l|l|l|] -\NC \bf primitive \NC \bf value range (in hex) \NC \NR +\NC \bf primitive \NC \bf value range (in hex) \NC \NR \NC \type {\Umathchardef} \NC 0+0+0--7+FF+10FFFF$^1$ \NC \NR \NC \type {\Umathcharnumdef}$^5$ \NC -80000000--7FFFFFFF$^3$ \NC \NR \NC \type {\Umathcode} \NC 0--10FFFF = 0+0+0--7+FF+10FFFF$^1$ \NC \NR @@ -105,15 +105,19 @@ New primitives that are compatible with \XETEX: \NC \type {\Udelcodenum} \NC 0--10FFFF = -80000000--7FFFFFFF$^3$ \NC \NR \stoptabulate -Note 1: \type {\Umathchardef="8"0"0} and \type -{\Umathchardef="8"0"0} are also accepted. +Specifications typically look like: -Note 2: The new primitives that deal with delimiter-style objects do not set up a +\starttyping +\Umathchardef\xx="1"0"456 +\Umathcode 123="1"0"789 +\stoptyping + +Note 1: The new primitives that deal with delimiter-style objects do not set up a \quote {large family}. Selecting a suitable size for display purposes is expected to be dealt with by the font via the \type {\Umathoperatorsize} parameter (more information can be found in a following section). -Note 3: For these three primitives, all information is packed into a single +Note 2: For these three primitives, all information is packed into a single signed integer. For the first two (\type {\Umathcharnum} and \type {\Umathcodenum}), the lowest 21 bits are the character code, the 3 bits above that represent the math class, and the family data is kept in the topmost bits (This means that the @@ -124,7 +128,7 @@ natural as using the two- and three-value commands, so unless you know exactly what you are doing and absolutely require the speedup resulting from the faster input scanning, it is better to use the verbose commands instead. -Note 4: The \type {\Umathaccent} command accepts optional keywords to control +Note 3: The \type {\Umathaccent} command accepts optional keywords to control various details regarding math accents. See \in {section} [mathacc] below for details. @@ -154,6 +158,74 @@ in following sections): These additional commands are not all that valuable on their own, but they come in handy as arguments to the math parameter settings that will be added shortly. +In Eijkhouts \quotation {\TEX\ by Topic} the rules for handling styles in scripts +are described as follows: + +\startitemize +\startitem + In any style superscripts and subscripts are taken from the next smaller style. + Exception: in display style they are taken in script style. +\stopitem +\startitem + Subscripts are always in the cramped variant of the style; superscripts are only + cramped if the original style was cramped. +\stopitem +\startitem + In an \type {..\over..} formula in any style the numerator and denominator are + taken from the next smaller style. +\stopitem +\startitem + The denominator is always in cramped style; the numerator is only in cramped + style if the original style was cramped. +\stopitem +\startitem + Formulas under a \type {\sqrt} or \type {\overline} are in cramped style. +\stopitem +\stopitemize + +In \LUATEX\ one can set the styles in more detail which means that you sometimes +have to set both normal and cramped styles to get the effect you want. If we +force styles in the scriptr using \type {\scriptstyle} and \type {\crampedscriptstyle} +we get this: + +\startbuffer[demo] +\starttabulate +\NC default \NC $b_{x=xx}^{x=xx}$ \NC \NR +\NC script \NC $b_{\scriptstyle x=xx}^{\scriptstyle x=xx}$ \NC \NR +\NC crampedscript \NC $b_{\crampedscriptstyle x=xx}^{\crampedscriptstyle x=xx}$ \NC \NR +\stoptabulate +\stopbuffer + +\getbuffer[demo] + +Now we set the following parameters + +\startbuffer[setup] +\Umathordrelspacing\scriptstyle=30mu +\Umathordordspacing\scriptstyle=30mu +\stopbuffer + +\typebuffer[setup] + +This gives: + +\start\getbuffer[setup,demo]\stop + +But, as this is not what is expected (visually) we should say: + +\startbuffer[setup] +\Umathordrelspacing\scriptstyle=30mu +\Umathordordspacing\scriptstyle=30mu +\Umathordrelspacing\crampedscriptstyle=30mu +\Umathordordspacing\crampedscriptstyle=30mu +\stopbuffer + +\typebuffer[setup] + +Now we get: + +\start\getbuffer[setup,demo]\stop + \section{Math parameter settings} In \LUATEX, the font dimension parameters that \TEX\ used in math typesetting are @@ -161,10 +233,10 @@ now accessible via primitive commands. In fact, refactoring of the math engine has resulted in many more parameters than were accessible before. \starttabulate -\NC \bf primitive name \NC \bf description \NC \NR +\NC \bf primitive name \NC \bf description \NC \NR \NC \type {\Umathquad} \NC the width of 18mu's \NC \NR \NC \type {\Umathaxis} \NC height of the vertical center axis of - the math formula above the baseline \NC \NR + the math formula above the baseline \NC \NR \NC \type {\Umathoperatorsize} \NC minimum size of large operators in display mode \NC \NR \NC \type {\Umathoverbarkern} \NC vertical clearance above the rule \NC \NR \NC \type {\Umathoverbarrule} \NC the width of the rule \NC \NR @@ -176,15 +248,15 @@ has resulted in many more parameters than were accessible before. \NC \type {\Umathradicalrule} \NC the width of the rule \NC \NR \NC \type {\Umathradicalvgap} \NC vertical clearance below the rule \NC \NR \NC \type {\Umathradicaldegreebefore}\NC the forward kern that takes place before placement of - the radical degree \NC \NR + the radical degree \NC \NR \NC \type {\Umathradicaldegreeafter} \NC the backward kern that takes place after placement of - the radical degree \NC \NR + the radical degree \NC \NR \NC \type {\Umathradicaldegreeraise} \NC this is the percentage of the total height and depth of - the radical sign that the degree is raised by. It is - expressed in \type {percents}, so 60\% is expressed as the - integer $60$. \NC \NR + the radical sign that the degree is raised by. It is + expressed in \type {percents}, so 60\% is expressed as the + integer $60$. \NC \NR \NC \type {\Umathstackvgap} \NC vertical clearance between the two - elements in a \type {\atop} stack \NC \NR + elements in a \type {\atop} stack \NC \NR \NC \type {\Umathstacknumup} \NC numerator shift upward in \type {\atop} stack \NC \NR \NC \type {\Umathstackdenomdown} \NC denominator shift downward in \type {\atop} stack \NC \NR \NC \type {\Umathfractionrule} \NC the width of the rule in a \type {\over} \NC \NR @@ -209,11 +281,11 @@ has resulted in many more parameters than were accessible before. \NC \type {\Umathsupshiftup} \NC superscript raise for characters \NC \NR \NC \type {\Umathsubsupshiftdown} \NC subscript drop in the presence of a superscript \NC \NR \NC \type {\Umathsubtopmax} \NC the top of standalone subscripts cannot be higher than this - above the baseline \NC \NR + above the baseline \NC \NR \NC \type {\Umathsupbottommin} \NC the bottom of standalone superscripts cannot be less than - this above the baseline \NC \NR + this above the baseline \NC \NR \NC \type {\Umathsupsubbottommax} \NC the bottom of the superscript of a combined super- and subscript - be at least as high as this above the baseline \NC \NR + be at least as high as this above the baseline \NC \NR \NC \type {\Umathsubsupvgap} \NC vertical clearance between super- and subscript \NC \NR \NC \type {\Umathspaceafterscript} \NC additional space added after a super- or subscript \NC \NR \NC \type {\Umathconnectoroverlapmin}\NC minimum overlap between parts in an extensible recipe \NC \NR @@ -228,6 +300,20 @@ Each of the parameters in this section can be set by a command like this: they obey grouping, and you can use \type {\the\Umathquad\displaystyle} if needed. +\section{Skips around display math} + +The injection of \type {\abovedisplayskip} and \type {\belowdisplayskip} is not symmetrical. An +above one is always inserted, also when zero, but the below is only inserted when larger than +zero. Especially the later mkes it sometimes hard to fully control spacing. Therefore \LUATEX\ +comes with a new directive: \type {\mathdisplayskipmode}. The following values apply: + +\starttabulate +\NC 0 \NC normal tex behaviour: always above, only below when larger than zero \NC \NR +\NC 1 \NC always \NC \NR +\NC 2 \NC only when not zero \NC \NR +\NC 3 \NC never, not even when not zero \NC \NR +\stoptabulate + \section{Font-based Math Parameters} While it is nice to have these math parameters available for tweaking, it would @@ -257,20 +343,22 @@ dimension parameter. For math fonts, this should be set to zero. \switchtobodyfont[8pt] \starttabulate[|l|l|l|p|] -\NC \bf variable \NC \bf style \NC \bf default value opentype \NC \bf default value tfm \NC \NR +\NC \bf variable \NC \bf style \NC \bf default value opentype \NC \bf default value tfm \NC \NR \NC \type {\Umathaxis} \NC -- \NC AxisHeight \NC axis_height \NC \NR \NC \type {\Umathoperatorsize} \NC D, D' \NC DisplayOperatorMinHeight \NC $^6$ \NC \NR \NC \type {\Umathfractiondelsize} \NC D, D' \NC FractionDelimiterDisplayStyleSize$^9$ \NC delim1 \NC \NR -\NC " \NC T, T', S, S', SS, SS' \NC FractionDelimiterSize$^9$ \NC delim2 \NC \NR +\NC \NC T, T', S, S', SS, SS' \NC FractionDelimiterSize$^9$ \NC delim2 \NC \NR \NC \type {\Umathfractiondenomdown} \NC D, D' \NC FractionDenominatorDisplayStyleShiftDown \NC denom1 \NC \NR -\NC " \NC T, T', S, S', SS, SS' \NC FractionDenominatorShiftDown \NC denom2 \NC \NR +\NC \NC T, T', S, S', SS, SS' \NC FractionDenominatorShiftDown \NC denom2 \NC \NR \NC \type {\Umathfractiondenomvgap} \NC D, D' \NC FractionDenominatorDisplayStyleGapMin \NC 3*default_rule_thickness \NC \NR -\NC " \NC T, T', S, S', SS, SS' \NC FractionDenominatorGapMin \NC default_rule_thickness \NC \NR +\NC \NC T, T', S, S', SS, SS' \NC FractionDenominatorGapMin \NC default_rule_thickness \NC \NR \NC \type {\Umathfractionnumup} \NC D, D' \NC FractionNumeratorDisplayStyleShiftUp \NC num1 \NC \NR -\NC " \NC T, T', S, S', SS, SS' \NC FractionNumeratorShiftUp \NC num2 \NC \NR +\NC \NC T, T', S, S', SS, SS' \NC FractionNumeratorShiftUp \NC num2 \NC \NR \NC \type {\Umathfractionnumvgap} \NC D, D' \NC FractionNumeratorDisplayStyleGapMin \NC 3*default_rule_thickness \NC \NR -\NC " \NC T, T', S, S', SS, SS' \NC FractionNumeratorGapMin \NC default_rule_thickness \NC \NR +\NC \NC T, T', S, S', SS, SS' \NC FractionNumeratorGapMin \NC default_rule_thickness \NC \NR \NC \type {\Umathfractionrule} \NC -- \NC FractionRuleThickness \NC default_rule_thickness \NC \NR +\NC \type {\Umathskewedfractionhgap} \NC -- \NC SkewedFractionHorizontalGap \NC math_quad/2 \NC \NR +\NC \type {\Umathskewedfractionvgap} \NC -- \NC SkewedFractionVerticalGap \NC math_x_height \NC \NR \NC \type {\Umathlimitabovebgap} \NC -- \NC UpperLimitBaselineRiseMin \NC big_op_spacing3 \NC \NR \NC \type {\Umathlimitabovekern} \NC -- \NC 0$^1$ \NC big_op_spacing5 \NC \NR \NC \type {\Umathlimitabovevgap} \NC -- \NC UpperLimitGapMin \NC big_op_spacing1 \NC \NR @@ -288,30 +376,30 @@ dimension parameter. For math fonts, this should be set to zero. \NC \type {\Umathradicalkern} \NC -- \NC RadicalExtraAscender \NC default_rule_thickness \NC \NR \NC \type {\Umathradicalrule} \NC -- \NC RadicalRuleThickness \NC $^2$ \NC \NR \NC \type {\Umathradicalvgap} \NC D, D' \NC RadicalDisplayStyleVerticalGap \NC (default_rule_thickness+\crlf - (abs(math_x_height)/4))$^3$ \NC \NR -\NC " \NC T, T', S, S', SS, SS' \NC RadicalVerticalGap \NC (default_rule_thickness+\crlf - (abs(default_rule_thickness)/4))$^3$ \NC \NR + (abs(math_x_height)/4))$^3$ \NC \NR +\NC \NC T, T', S, S', SS, SS' \NC RadicalVerticalGap \NC (default_rule_thickness+\crlf + (abs(default_rule_thickness)/4))$^3$ \NC \NR \NC \type {\Umathradicaldegreebefore} \NC -- \NC RadicalKernBeforeDegree \NC $^2$ \NC \NR \NC \type {\Umathradicaldegreeafter} \NC -- \NC RadicalKernAfterDegree \NC $^2$ \NC \NR \NC \type {\Umathradicaldegreeraise} \NC -- \NC RadicalDegreeBottomRaisePercent \NC $^{2,7}$ \NC \NR \NC \type {\Umathspaceafterscript} \NC -- \NC SpaceAfterScript \NC script_space$^4$ \NC \NR \NC \type {\Umathstackdenomdown} \NC D, D' \NC StackBottomDisplayStyleShiftDown \NC denom1 \NC \NR -\NC " \NC T, T', S, S', SS, SS' \NC StackBottomShiftDown \NC denom2 \NC \NR +\NC \NC T, T', S, S', SS, SS' \NC StackBottomShiftDown \NC denom2 \NC \NR \NC \type {\Umathstacknumup} \NC D, D' \NC StackTopDisplayStyleShiftUp \NC num1 \NC \NR -\NC " \NC T, T', S, S', SS, SS' \NC StackTopShiftUp \NC num3 \NC \NR +\NC \NC T, T', S, S', SS, SS' \NC StackTopShiftUp \NC num3 \NC \NR \NC \type {\Umathstackvgap} \NC D, D' \NC StackDisplayStyleGapMin \NC 7*default_rule_thickness \NC \NR -\NC " \NC T, T', S, S', SS, SS' \NC StackGapMin \NC 3*default_rule_thickness \NC \NR +\NC \NC T, T', S, S', SS, SS' \NC StackGapMin \NC 3*default_rule_thickness \NC \NR \NC \type {\Umathsubshiftdown} \NC -- \NC SubscriptShiftDown \NC sub1 \NC \NR \NC \type {\Umathsubshiftdrop} \NC -- \NC SubscriptBaselineDropMin \NC sub_drop \NC \NR \NC \type {\Umathsubsupshiftdown} \NC -- \NC SubscriptShiftDownWithSuperscript$^8$ \NC \NC \NR -\NC \NC \NC \quad\ or SubscriptShiftDown \NC sub2 \NC \NR +\NC \NC \NC \quad\ or SubscriptShiftDown \NC sub2 \NC \NR \NC \type {\Umathsubtopmax} \NC -- \NC SubscriptTopMax \NC (abs(math_x_height * 4) / 5) \NC \NR \NC \type {\Umathsubsupvgap} \NC -- \NC SubSuperscriptGapMin \NC 4*default_rule_thickness \NC \NR \NC \type {\Umathsupbottommin} \NC -- \NC SuperscriptBottomMin \NC (abs(math_x_height) / 4) \NC \NR \NC \type {\Umathsupshiftdrop} \NC -- \NC SuperscriptBaselineDropMax \NC sup_drop \NC \NR \NC \type {\Umathsupshiftup} \NC D \NC SuperscriptShiftUp \NC sup1 \NC \NR -\NC " \NC T, S, SS, \NC SuperscriptShiftUp \NC sup2 \NC \NR -\NC " \NC D', T', S', SS' \NC SuperscriptShiftUpCramped \NC sup3 \NC \NR +\NC \NC T, S, SS, \NC SuperscriptShiftUp \NC sup2 \NC \NR +\NC \NC D', T', S', SS' \NC SuperscriptShiftUpCramped \NC sup3 \NC \NR \NC \type {\Umathsupsubbottommax} \NC -- \NC SuperscriptBottomMaxWithSubscript \NC (abs(math_x_height * 4) / 5) \NC \NR \NC \type {\Umathunderbarkern} \NC -- \NC UnderbarExtraDescender \NC default_rule_thickness \NC \NR \NC \type {\Umathunderbarrule} \NC -- \NC UnderbarRuleThickness \NC default_rule_thickness \NC \NR @@ -498,13 +586,23 @@ font of the accentee (as explained in the \TEX book), but if value that turns ou to be zero and the font had a MathConstants table, then \type {AccentBaseHeight} is used instead. -If a math bottom accent has to be placed, the \type {bot_accent} value is checked -instead of \type {top_accent}. Because bottom accents do not exist in \TEX82, the -\type {\skewchar} kern is ignored. +% there is no bot_accent in opentype math +% +% If a math bottom accent has to be placed, the \type {bot_accent} value is checked +% instead of \type {top_accent}. Because bottom accents do not exist in \TEX82, the +% \type {\skewchar} kern is ignored. The vertical placement of a bottom accent is straight below the accentee, no correction takes place. +Possible locations are \type {top}, \type {bottom}, \type {both} and \type +{center}. When no location is given \type {top} is assumed. An additional +parameter \type {fraction} can be specified followed by a number; a value of for +instance 1200 means that the criterium is 1.2 times the width of the nuclues. The +fraction only aplies to the stepwise selected shapes and is mostly meant for the +\type {overlay} location. It also works for the other locations but then it +concerns the width. + \section{Math root extension} The new primitive \type {\Uroot} allows the construction of a radical noad @@ -607,12 +705,126 @@ The vertical placements are controlled by \type {\Umathunderdelimiterbgap}, \typ The superscript in \type {\Uoverdelimiter} is typeset in a suitable scripted style, the subscript in \type {\Uunderdelimiter} is cramped as well. -\section {Extensible delimiters} +These primitives accepts an option \type {width} specification. When used the +also optional keywords \type {left}, \type {middle} and \type {right} will +determine what happens when a requested size can't be met (which can happen when +we step to successive larger variants). + +An extra primitive \type {\Uhextensible} is available that can be used like this: + +\startbuffer +$\Uhextensible width 10cm 0 "2194$ +\stopbuffer + +\typebuffer This will render this: + +\blank \startnarrower \getbuffer \stopnarrower \blank + +Here you can also pass options, like: + +\startbuffer +$\Uhextensible width 1pt middle 0 "2194$ +\stopbuffer + +\typebuffer This gives: + +\blank \startnarrower \getbuffer \stopnarrower \blank \LUATEX\ internally uses a structure that supports \OPENTYPE\ \quote {MathVariants} as well as \TFM\ \quote {extensible recipes}. -\section{Other Math changes} +\section {Extracting values} + +You can extract the components of a math character. Say that we have defined: + +\starttyping +\Umathcode 1 2 3 4 +\stoptyping + +then + +\starttyping +[\Umathcharclass1] [\Umathcharfam1] [\Umathcharslot1] +\stoptyping + +will return: + +\starttyping +[2] [3] [4] +\stoptyping + +These commands are provides as convenience. before they came available you could +do the following: + +\starttyping +\def\Umathcharclass{\directlua{tex.print(tex.getmathcode(token.scan_int())[1])}} +\def\Umathcharfam {\directlua{tex.print(tex.getmathcode(token.scan_int())[2])}} +\def\Umathcharslot {\directlua{tex.print(tex.getmathcode(token.scan_int())[3])}} +\stoptyping + +\section{fractions} + +The \type {\abovewithdelims} command accepts a keyword \type {exact}. When issued +the extra space relative to the rule thickness is not added. One can of course +use the \type {\Umathfraction..gap} commands to influence the spacing. Also the +rule is still positioned around the math axis. + +\starttyping +$$ { {a} \abovewithdelims() exact 4pt {b} }$$ +\stoptyping + +The math parameter table contains some parameters that specify a horizontal and +vertical gap for skewed fractions. Of course some guessing is needed in order to +implement something that uses then. And so we now provide a primitive similar to the +other fraction related ones but with a few options so that one can influence the +rendering. Of course a user can mess around a bit with the parameters +\type {\Umathskewedfractionhgap} and \type {\Umathskewedfractionvgap}. + +The syntax used here is: + +\starttyping +{ {1} \Uskewed / {2} } +{ {1} \Uskewedwithdelims / () {2} } +\stoptyping + +where the options can be \type {noaxis} and \type {exact}. By default we add half +the axis to the shifts and by default we zero the width of the middle character. +For Latin Modern The result looks as follows: + +\def\ShowA#1#2#3{$x + { {#1} \Uskewed / #3 {#2} } + x$} +\def\ShowB#1#2#3{$x + { {#1} \Uskewedwithdelims / () #3 {#2} } + x$} + +\start + \switchtobodyfont[modern] + \starttabulate[||||||] + \NC \NC + \ShowA{a}{b}{} \NC + \ShowA{1}{2}{} \NC + \ShowB{a}{b}{} \NC + \ShowB{1}{2}{} \NC + \NR + \NC \type{exact} \NC + \ShowA{a}{b}{exact} \NC + \ShowA{1}{2}{exact} \NC + \ShowB{a}{b}{exact} \NC + \ShowB{1}{2}{exact} \NC + \NR + \NC \type{noaxis} \NC + \ShowA{a}{b}{noaxis} \NC + \ShowA{1}{2}{noaxis} \NC + \ShowB{a}{b}{noaxis} \NC + \ShowB{1}{2}{noaxis} \NC + \NR + \NC \type{exact noaxis} \NC + \ShowA{a}{b}{exact noaxis} \NC + \ShowA{1}{2}{exact noaxis} \NC + \ShowB{a}{b}{exact noaxis} \NC + \ShowB{1}{2}{exact noaxis} \NC + \NR + \stoptabulate +\stop + +\section {Other Math changes} \subsection {Verbose versions of single-character math commands} @@ -644,27 +856,181 @@ are the result of \type {\mathchardef} or \type {\Umathchardef} are also acceptable in the horizontal and vertical modes. In those cases, the \type {\textfont} from the requested math family is used. -\section{Math todo} +\section{Math surrounding skips} + +Inline math is surrounded by (optional) \type {\mathsurround} spacing but that is fixed +dimension. There is now an additional parameter \type {\mathsurroundskip}. When set to a +non|-|zero value (or zero with some stretch or shrink) this parameter will replace +\type {\mathsurround}. By using an additional parameter instead of changing the nature +of \type {\mathsurround}, we can remain compatible. + +% \section{Math todo} +% +% The following items are still todo. +% +% \startitemize +% \startitem +% Pre-scripts. +% \stopitem +% \startitem +% Multi-story stacks. +% \stopitem +% \startitem +% Flattened accents for high characters (maybe). +% \stopitem +% \startitem +% Better control over the spacing around displays and handling of equation numbers. +% \stopitem +% \startitem +% Support for multi|-|line displays using \MATHML\ style alignment points. +% \stopitem +% \stopitemize + +\subsection {Delimiters: \type{\Uleft}, \type {\Umiddle} and \type {\Uright}} + +Normally you will force delimiters to certain sizes by putting an empty box or +rule next to it. The resulting delimiter will either be a character from the +stepwise size range or an extensible. The latter can be quite differently +positioned that the characters as it depends on the fit aas well as the fact if +the used characters in the font have depth or height. Commands like (plain \TEX +s) \type {\big} need use this feature. In \LUATEX\ we provide a bit more control +by three variants that supporting optional parameters \type {height}, \type +{depth} and \type {axis}. The following example uses this: -The following items are still todo. +\startbuffer +\Uleft height 30pt depth 10pt \Udelimiter "0 "0 "000028 +\quad x\quad +\Umiddle height 40pt depth 15pt \Udelimiter "0 "0 "002016 +\quad x\quad +\Uright height 30pt depth 10pt \Udelimiter "0 "0 "000029 +\quad \quad \quad +\Uleft height 30pt depth 10pt axis \Udelimiter "0 "0 "000028 +\quad x\quad +\Umiddle height 40pt depth 15pt axis \Udelimiter "0 "0 "002016 +\quad x\quad +\Uright height 30pt depth 10pt axis \Udelimiter "0 "0 "000029 +\stopbuffer -\startitemize -\startitem - Pre-scripts. -\stopitem -\startitem - Multi-story stacks. -\stopitem -\startitem - Flattened accents for high characters (maybe). -\stopitem -\startitem - Better control over the spacing around displays and handling of equation numbers. -\stopitem -\startitem - Support for multi|-|line displays using \MATHML\ style alignment points. -\stopitem -\stopitemize +\typebuffer + +\startlinecorrection +\ruledhbox{\mathematics{\getbuffer}} +\stoplinecorrection + +The keyword \type {exact} can be used as directive that the real dimensions +should be applied when the criteria can't be met which can happen when we're +still stepping through the succesively larger variants. When no dimensions are +given the \type {noaxis} command can be used to prevent shifting over the axis. + +You can influence the final class with the keyword \type {class} which will +influence the spacing. + +\subsection{Fixed scripts} + +We have three parameters that are used for this fixed anchoring: + +\starttabulate[|l|l|] +\NC $d$ \NC \type {\Umathsubshiftdown} \NC \NR +\NC $u$ \NC \type {\Umathsupshiftup} \NC \NR +\NC $s$ \NC \type {\Umathsubsupshiftdown} \NC \NR +\stoptabulate + +When we set \type {\mathscriptsmode} to a value other than zero these are used +for calculating fixed positions. This is something that is needed for instance +for chemistry. You can manipulate the mentioned variables to achive different +effects. + +\def\SampleMath#1% + {$\mathscriptsmode#1\mathupright CH_2 + CH^+_2 + CH^2_2$} + +\starttabulate[|c|c|c|l|] +\NC \bf mode \NC \bf down \NC \bf up \NC \NC \NR +\NC 0 \NC dynamic \NC dynamic \NC \SampleMath{0} \NC \NR +\NC 1 \NC $d$ \NC $u$ \NC \SampleMath{1} \NC \NR +\NC 2 \NC $s$ \NC $u$ \NC \SampleMath{2} \NC \NR +\NC 3 \NC $s$ \NC $u + s - d$ \NC \SampleMath{3} \NC \NR +\NC 4 \NC $d + (s-d)/2$ \NC $u + (s-d)/2$ \NC \SampleMath{4} \NC \NR +\NC 5 \NC $d$ \NC $u + s - d$ \NC \SampleMath{5} \NC \NR +\stoptabulate + +The value of this parameter obeys grouping but applies to the whole current +formula. + +% if needed we can put the value in stylenodes but maybe more should go there + + +\subsection {Math options} + +The logic in the math engine is rather complex and there are often no universal +solutions (read: what works out well for one font, fails for another). Therefore +some variations in the implementation will be driven by options for which a new +primitive \type {\mathoption} has been introduced (so that we don't end up with +many new commands). The approach of options also permits us to see what effect a +specific solution has. + +\subsubsection {\type {\mathoption noitaliccompensation}} + +This option compensates placement for characters with a built|-|in italic +correction. + +\startbuffer +{\showboxes\int}\quad +{\showboxes\int_{|}^{|}}\quad +{\showboxes\int\limits_{|}^{|}} +\stopbuffer + +\typebuffer + +Gives (with computer modern that has such italics): + +\startlinecorrection[blank] + \switchtobodyfont[modern] + \startcombination[nx=2,ny=2,distance=5em] + {\mathoption noitaliccompensation 0\relax \mathematics{\getbuffer}} + {\nohyphens\type{0:inline}} + {\mathoption noitaliccompensation 0\relax \mathematics{\displaymath\getbuffer}} + {\nohyphens\type{0:display}} + {\mathoption noitaliccompensation 1\relax \mathematics{\getbuffer}} + {\nohyphens\type{1:inline}} + {\mathoption noitaliccompensation 1\relax \mathematics{\displaymath\getbuffer}} + {\nohyphens\type{1:display}} + \stopcombination +\stoplinecorrection + +\subsubsection {\type {\mathoption nocharitalic}} + +When two characters follow each other italic correction can interfere. The +following example shows what this option does: + +\startbuffer +\catcode"1D443=11 +\catcode"1D444=11 +\catcode"1D445=11 +P( PP PQR +\stopbuffer + +\typebuffer + +Gives (with computer modern that has such italics): + +\startlinecorrection[blank] + \switchtobodyfont[modern] + \startcombination[nx=2,ny=2,distance=5em] + {\mathoption nocharitalic 0\relax \mathematics{\getbuffer}} + {\nohyphens\type{0:inline}} + {\mathoption nocharitalic 0\relax \mathematics{\displaymath\getbuffer}} + {\nohyphens\type{0:display}} + {\mathoption nocharitalic 1\relax \mathematics{\getbuffer}} + {\nohyphens\type{1:inline}} + {\mathoption nocharitalic 1\relax \mathematics{\displaymath\getbuffer}} + {\nohyphens\type{1:display}} + \stopcombination +\stoplinecorrection + +\subsubsection {\type {\mathoption useoldfractionscaling}} + +This option has been introduced as solution for tracker item 604 for fuzzy cases +around either or not present fraction related settings for new fonts. \stopchapter diff --git a/doc/context/sources/general/manuals/luatex/luatex-modifications.tex b/doc/context/sources/general/manuals/luatex/luatex-modifications.tex index 28431fe29..5b35f3ec1 100644 --- a/doc/context/sources/general/manuals/luatex/luatex-modifications.tex +++ b/doc/context/sources/general/manuals/luatex/luatex-modifications.tex @@ -216,6 +216,12 @@ which in turn triggered renaming primitives. prefixed with \type {\pdf} originals. \stopitem +\startitem + When \type {\adjustspacing} has value~2, hz optimization will be applied to + glyphs and kerns. When the valus is~3, only glyphs will be treated. A value + smaller than~2 disables this feature. +\stopitem + \startitem The \type {\tagcode} primitive is promoted to core primitive. \stopitem @@ -229,6 +235,10 @@ which in turn triggered renaming primitives. The \type {\pdfnoligatures} primitive is now \type {\ignoreligaturesinfont}. \stopitem +\startitem + The \type {\pdfcopyfont} primitive is now \type {\copyfont}. +\stopitem + \startitem The \type {\pdffontexpand} primitive is now \type {\expandglyphsinfont}. \stopitem @@ -255,6 +265,21 @@ which in turn triggered renaming primitives. determine these properties or use the built|-|in \type {img} library. \stopitem +\startitem + The initializers \type {\pdfoutput} has been replaced by \type {\outputmode} and + \type {\pdfdraftmode} is now \type {\draftmode}. +\stopitem + +\startitem + The pixel multiplier dimension \type {\pdfpxdimen} lots its prefix and is now calles + \type {\pxdimen}. +\stopitem + +\startitem + An extra \type {\pdfimageaddfilename} option has been added that can be used to block + writing the filename to the \PDF\ file. +\stopitem + \stopitemize One change involves the so called xforms and ximages. In \PDFTEX\ these are @@ -332,7 +357,7 @@ we say next applies to both these programs. \stopitem \startitem - Several bugs hav ebeen fixed. The \type {\hoffset} bug when \type {\pagedir TRT} + Several bugs have been fixed. The \type {\hoffset} bug when \type {\pagedir TRT} is gone, removing the need for an explicit fix to \type {\hoffset}. Also bug causing \type {\fam} to fail for family numbers above 15 is fixed. A fair amount of other minor bugs are fixed as well, most of these related to \type @@ -360,13 +385,14 @@ we say next applies to both these programs. \stopitem \startitem - The page dimension related primitives \type {\pagewidth} and \type {\pageheight} have - been promoted to core primitives. + The page dimension related primitives \type {\pagewidth} and \type + {\pageheight} have been promoted to core primitives. \stopitem \startitem - The primitives \type {\charwd}, \type {\charht}, \type {\chardp} and \type {\charit} - have been removes as we have the \ETEX\ variants \type {\fontchar*}. + The primitives \type {\charwd}, \type {\charht}, \type {\chardp} and \type + {\charit} have been removes as we have the \ETEX\ variants \type + {\fontchar*}. \stopitem \startitem @@ -380,6 +406,15 @@ we say next applies to both these programs. core primitives. \stopitem +\startitem + The primitive \type {\pdftracingfonts} is now \type {\tracingfonts} as it + doesn't relate to the backend. +\stopitem + +\startitem + The experimental primitive \type {\pdfinsertht} is kept as \type {\insertht}. +\stopitem + \startitem The promotion of primitives to core primitives as well as the removed of all others mean that the initialization namespace \type {aleph} is gone. @@ -432,6 +467,220 @@ different: \stopsubsection +\startsubsection[title=The backend primitives \type {\pdf*}] + +In a previous section we mentioned that some \PDFTEX\ primitives were removed and +others promoted to core \LUATEX\ primitives. That is only part of the story. In +order to separate the backend specific primitives in de code these commands are +now replaced by only a few. In traditional \TEX\ we only had the \DVI\ backend +but now we have two: \DVI\ and \PDF. Additional functionality is implemented as +\quote {extensions} in \TEX speak. By seperating more strickly we are able to +keep the core (fontend) clean and stable. If for some reason an extra backend +option is needed, it can be implemented without touching the core. The three +\PDF\ backend related primitives are + +\starttyping +\pdfextension command [specification] +\pdfvariable name +\pdffeedback name +\stoptyping + +An extension triggers further parsing, depending on the command given. A variable is +a (kind of) register and can be read and written, while a feedback is reporting +something (as it comes from the backend it's normally a sequence of tokens). + +In order for \LUATEX\ to be more than just \TEX\ you need to enable primitives. That +has already be the case right from the start. If you want the traditional \PDFTEX\ +primitives (for as far their functionality is still around) you now can do this: + +\starttyping +\protected\def\pdfliteral {\pdfextension literal} +\protected\def\pdfcolorstack {\pdfextension colorstack} +\protected\def\pdfsetmatrix {\pdfextension setmatrix} +\protected\def\pdfsave {\pdfextension save\relax} +\protected\def\pdfrestore {\pdfextension restore\relax} +\protected\def\pdfobj {\pdfextension obj } +\protected\def\pdfrefobj {\pdfextension refobj } +\protected\def\pdfannot {\pdfextension annot } +\protected\def\pdfstartlink {\pdfextension startlink } +\protected\def\pdfendlink {\pdfextension endlink\relax} +\protected\def\pdfoutline {\pdfextension outline } +\protected\def\pdfdest {\pdfextension dest } +\protected\def\pdfthread {\pdfextension thread } +\protected\def\pdfstartthread {\pdfextension startthread } +\protected\def\pdfendthread {\pdfextension endthread\relax} +\protected\def\pdfinfo {\pdfextension info } +\protected\def\pdfcatalog {\pdfextension catalog } +\protected\def\pdfnames {\pdfextension names } +\protected\def\pdfincludechars {\pdfextension includechars } +\protected\def\pdffontattr {\pdfextension fontattr } +\protected\def\pdfmapfile {\pdfextension mapfile } +\protected\def\pdfmapline {\pdfextension mapline } +\protected\def\pdftrailer {\pdfextension trailer } +\protected\def\pdfglyphtounicode{\pdfextension glyphtounicode } +\stoptyping + +The introspective primitives can bve defines as: + +\starttyping +\def\pdftexversion {\numexpr\pdffeedback version} +\def\pdftexrevision {\pdffeedback revision} +\def\pdflastlink {\numexpr\pdffeedback lastlink} +\def\pdfretval {\numexpr\pdffeedback retval} +\def\pdflastobj {\numexpr\pdffeedback lastobj} +\def\pdflastannot {\numexpr\pdffeedback lastannot} +\def\pdfxformname {\numexpr\pdffeedback xformname} +\def\pdfcreationdate {\pdffeedback creationdate} +\def\pdffontname {\numexpr\pdffeedback fontname} +\def\pdffontobjnum {\numexpr\pdffeedback fontobjnum} +\def\pdffontsize {\dimexpr\pdffeedback fontsize} +\def\pdfpageref {\numexpr\pdffeedback pageref} +\def\pdfcolorstackinit {\pdffeedback colorstackinit} +\stoptyping + +The configuration related registers have become: + +\starttyping +\edef\pdfcompresslevel {\pdfvariable compresslevel} +\edef\pdfobjcompresslevel {\pdfvariable objcompresslevel} +\edef\pdfdecimaldigits {\pdfvariable decimaldigits} +\edef\pdfgamma {\pdfvariable gamma} +\edef\pdfimageresolution {\pdfvariable imageresolution} +\edef\pdfimageapplygamma {\pdfvariable imageapplygamma} +\edef\pdfimagegamma {\pdfvariable imagegamma} +\edef\pdfimagehicolor {\pdfvariable imagehicolor} +\edef\pdfimageaddfilename {\pdfvariable imageaddfilename} +\edef\pdfpkresolution {\pdfvariable pkresolution} +\edef\pdfinclusioncopyfonts {\pdfvariable inclusioncopyfonts} +\edef\pdfinclusionerrorlevel {\pdfvariable inclusionerrorlevel} +\edef\pdfreplacefont {\pdfvariable replacefont} +\edef\pdfgentounicode {\pdfvariable gentounicode} +\edef\pdfpagebox {\pdfvariable pagebox} +\edef\pdfminorversion {\pdfvariable minorversion} +\edef\pdfuniqueresname {\pdfvariable uniqueresname} + +\edef\pdfhorigin {\pdfvariable horigin} +\edef\pdfvorigin {\pdfvariable vorigin} +\edef\pdflinkmargin {\pdfvariable linkmargin} +\edef\pdfdestmargin {\pdfvariable destmargin} +\edef\pdfthreadmargin {\pdfvariable threadmargin} + +\edef\pdfpagesattr {\pdfvariable pagesattr} +\edef\pdfpageattr {\pdfvariable pageattr} +\edef\pdfpageresources {\pdfvariable pageresources} +\edef\pdfxformattr {\pdfvariable xformattr} +\edef\pdfxformresources {\pdfvariable xformresources} +\edef\pdfpkmode {\pdfvariable pkmode} +\stoptyping + +The variables are internal ones, so they are anonymous. When you ask for the +meaning of a few previously defined ones: + +\starttyping +\meaning\pdfhorigin +\meaning\pdfcompresslevel +\meaning\pdfpageattr +\stoptyping + +you will get: + +\starttyping +macro:->[internal backend dimension] +macro:->[internal backend integer] +macro:->[internal backend tokenlist] +\stoptyping + +The \type {\edef} can also be an \type {\def} but it's a bit more efficient +to expand the lookup related register beforehand. After that you can adapt +the defaults; these are: + +\starttyping +\pdfcompresslevel 9 +\pdfobjcompresslevel 1 +\pdfdecimaldigits 3 +\pdfgamma 1000 +\pdfimageresolution 71 +\pdfimageapplygamma 0 +\pdfimagegamma 2200 +\pdfimagehicolor 1 +\pdfimageaddfilename 1 +\pdfpkresolution 72 +\pdfinclusioncopyfonts 0 +\pdfinclusionerrorlevel 0 +\pdfreplacefont 0 +\pdfgentounicode 0 +\pdfpagebox 0 +\pdfminorversion 4 +\pdfuniqueresname 0 + +\pdfhorigin 1in +\pdfvorigin 1in +\pdflinkmargin 0pt +\pdfdestmargin 0pt +\pdfthreadmargin 0pt +\stoptyping + +If you also want some backward compatibility, you can add: + +\starttyping +\let\pdfpagewidth \pagewidth +\let\pdfpageheight \pageheight + +\let\pdfadjustspacing \adjustspacing +\let\pdfprotrudechars \protrudechars +\let\pdfnoligatures \ignoreligaturesinfont +\let\pdffontexpand \expandglyphsinfont +\let\pdfcopyfont \copyfont + +\let\pdfxform \saveboxresource +\let\pdflastxform \lastsavedboxresourceindex +\let\pdfrefxform \useboxresource + +\let\pdfximage \saveimageresource +\let\pdflastximage \lastsavedimageresourceindex +\let\pdflastximagepages\lastsavedimageresourcepages +\let\pdfrefximage \useimageresource + +\let\pdfsavepos \savepos +\let\pdflastxpos \lastxpos +\let\pdflastypos \lastypos + +\let\pdfoutput \outputmode +\let\pdfdraftmode \draftmode + +\let\pdfpxdimen \pxdimen + +\let\pdfinsertht \insertht + +\let\pdfnormaldeviate \normaldeviate +\let\pdfuniformdeviate \uniformdeviate +\let\pdfsetrandomseed \setrandomseed +\let\pdfrandomseed \randomseed + +\let\pdfprimitive \primitive +\let\ifpdfprimitive \ifprimitive + +\let\ifpdfabsnum \ifabsnum +\let\ifpdfabsdim \ifabsdim +\stoptyping + +And even: + +\starttyping +\newdimen\pdfeachlineheight +\newdimen\pdfeachlinedepth +\newdimen\pdflastlinedepth +\newdimen\pdffirstlineheight +\newdimen\pdfignoreddimen +\stoptyping + +The backend is derived from \PDFTEX\ so the same syntax applies. However, the +\type {outline} command accepts a \type {objnum} followed by a number. No +checking takes place so when this is used it had better be a valid (flushed) +object. + +\stopsubsection + \stopsection \startsection[title=Implementation notes] diff --git a/doc/context/sources/general/manuals/luatex/luatex-nodes.tex b/doc/context/sources/general/manuals/luatex/luatex-nodes.tex index 9626190fc..d59efbf19 100644 --- a/doc/context/sources/general/manuals/luatex/luatex-nodes.tex +++ b/doc/context/sources/general/manuals/luatex/luatex-nodes.tex @@ -25,8 +25,13 @@ The current return value of \type {node.types()} is: The \type {\lastnodetype} primitive is \ETEX\ compliant. The valid range is still $[-1,15]$ and glyph nodes (formerly known as char nodes) have number~0 while ligature nodes are mapped to~7. That way macro packages can use the same symbolic -names as in traditional \ETEX. Keep in mind that the internal node numbers are -different and that there are more node types than~15. +names as in traditional \ETEX. Keep in mind that these \ETEX\ node numbers are +different from the real internal ones and that there are more \ETEX\ node types +than~15. + +You can ask for a list of fields with the \type {node.fields} (which takes an id) +and for valid subtypes with \type {node.subtypes} (which takes a string because +eventually we might support more used enumerations) . \subsection{Auxiliary items} @@ -35,36 +40,6 @@ nodes, but can be pointed to from within that list. They are not quite the same as regular nodes, but it is easier for the library routines to treat them as if they were. -\subsubsection{glue_spec items} - -Skips are about the only type of data objects in traditional \TEX\ that are not a -simple value. The structure that represents the glue components of a skip is -called a \type {glue_spec}, and it has the following accessible fields: - -\starttabulate[|lT|l|p|] -\NC \ssbf key \NC \bf type \NC \bf explanation \NC \NR -\NC width \NC number \NC \NC \NR -\NC stretch \NC number \NC \NC \NR -\NC stretch_order \NC number \NC \NC \NR -\NC shrink \NC number \NC \NC \NR -\NC shrink_order \NC number \NC \NC \NR -\NC writable \NC boolean \NC If this is true, you can't assign to this - \type {glue_spec} because it is one of the - preallocated special cases. \NC \NR -\stoptabulate - -These objects are reference counted, so there is actually an extra read-only -field named \type {ref_count} as well. This item type will likely disappear in -the future, and the glue fields themselves will become part of the nodes -referencing glue items. - -The effective width of some glue subtypes depends on the stretch or shrink needed -to make the encapsulating box fit its dimensions. For instance, in a paragraph -lines normally have glue representing spaces and these stretch of shrink to make -the content fit in the available space. The \type {effective_glue} function that -takes a glue node and a parent (hlist or vlist) returns the effective width of -that glue item. - \subsubsection{attribute_list and attribute items} The newly introduced attribute registers are non|-|trivial, because the value @@ -102,27 +77,6 @@ As mentioned it's better to use the official helpers rather than edit these fields directly. For instance the \type {prev} field is used for other purposes and there is no double linked list. -\subsubsection{action item} - -Valid fields: \showfields{action}\crlf -Id: \showid{action} - -These are a special kind of item that only appears inside \PDF\ start link -objects. - -\starttabulate[|lT|l|p|] -\NC \ssbf field \NC \bf type \NC \bf explanation \NC \NR -\NC action_type \NC number \NC \NC \NR -\NC action_id \NC number or string \NC \NC \NR -\NC named_id \NC number \NC \NC \NR -\NC file \NC string \NC \NC \NR -\NC new_window \NC number \NC \NC \NR -\NC data \NC string \NC \NC \NR -\NC ref_count \NC number \NC - read-only -\NC \NR -\stoptabulate - \subsection{Main text nodes} These are the nodes that comprise actual typesetting commands. @@ -159,7 +113,9 @@ Id: \showid{hlist} \type {2} = explicit box command, \type {3} = paragraph indentation box, \type {4} = alignment column or row, - \type {5} = alignment cell \NC \NR + \type {5} = alignment cell + \type {6} = equation + \type {7} = equation number \NC \NR \NC attr \NC \syntax{} \NC The head of the associated attribute list \NC \NR \NC width \NC number \NC \NC \NR @@ -205,7 +161,7 @@ image. \starttabulate[|lT|l|p|] \NC \ssbf field \NC \bf type \NC \bf explanation \NC \NR -\NC subtype \NC number \NC 0, 1 or 2 \NC \NR +\NC subtype \NC number \NC 0 upto 3 \NC \NR \NC attr \NC \syntax{} \NC \NC \NR \NC width \NC number \NC the width of the rule; the special value $-1073741824$ is used for \quote @@ -222,7 +178,8 @@ image. \stoptabulate The subtypes 1 and~2 replace the xform and ximage whatsits and in nodelists they -behave like rules of subtype_0 when it comes to dimensions. +behave like rules of subtype_0 when it comes to dimensions. Subtype~3 only has +dimensions. \subsubsection{ins nodes} @@ -322,6 +279,36 @@ Id: \showid{math} \subsubsection{glue nodes} +Skips are about the only type of data objects in traditional \TEX\ that are not a +simple value. The structure that represents the glue components of a skip is +called a \type {glue_spec}, and it has the following accessible fields: + +\starttabulate[|lT|l|p|] +\NC \ssbf key \NC \bf type \NC \bf explanation \NC \NR +\NC width \NC number \NC \NC \NR +\NC stretch \NC number \NC \NC \NR +\NC stretch_order \NC number \NC \NC \NR +\NC shrink \NC number \NC \NC \NR +\NC shrink_order \NC number \NC \NC \NR +\NC writable \NC boolean \NC If this is true, you can't assign to this + \type {glue_spec} because it is one of the + preallocated special cases. \NC \NR +\stoptabulate + +% These objects are reference counted, so there is actually an extra read|-|only +% field named \type {ref_count} as well. This item type will likely disappear in +% the future, and the glue fields themselves will become part of the nodes +% referencing glue items. + +The effective width of some glue subtypes depends on the stretch or shrink needed +to make the encapsulating box fit its dimensions. For instance, in a paragraph +lines normally have glue representing spaces and these stretch of shrink to make +the content fit in the available space. The \type {effective_glue} function that +takes a glue node and a parent (hlist or vlist) returns the effective width of +that glue item. + +A spec node is normally references to from a glue node: + Valid fields: \showfields{glue}\crlf Id: \showid{glue} @@ -335,6 +322,11 @@ Id: \showid{glue} \NC leader \NC \syntax{} \NC pointer to a box or rule for leaders \NC \NR \stoptabulate +The indirect spec approach is an optimization in the original \TEX\ code. First +of all it saves quite some memory because all these spaces that become glue now +share the same specification, and zero testing is also faster because only the +pointer has to be checked. + The exact meanings of the subtypes are as follows: \starttabulate[|rT|l|] @@ -362,6 +354,28 @@ The exact meanings of the subtypes are as follows: \NC 103 \NC \type {\gleaders} \NC \NR \stoptabulate +For convenience we provide access to the spec fields directly so that you can +avoid the spec lookup. So, the following fields can also be queried or set. When +you set a field and no spec is set, a spec will automatically be created. + +\starttabulate[|lT|l|p|] +\NC \ssbf key \NC \bf type \NC \bf explanation \NC \NR +\NC width \NC number \NC \NC \NR +\NC stretch \NC number \NC \NC \NR +\NC stretch_order \NC number \NC \NC \NR +\NC shrink \NC number \NC \NC \NR +\NC shrink_order \NC number \NC \NC \NR +\stoptabulate + +When you assign the properties to a spec using the above keys the advantage is +that when needed a new spec is allocated. if you access the spec node directly +you can get an error message with respect to a non|-|writable spec node. + +By using the accessors in the glue node you are more future proof as we might +decide at some point to carry all information in the glue nodes themselves. Of +course we can then also decide to make the spec field kind of virtual to keep +compatibility (for a while). + \subsubsection{kern nodes} Valid fields: \showfields{kern}\crlf @@ -592,7 +606,8 @@ Id: \showid{accent} \subsubsubsection{style nodes} -Valid fields: \showfields{style}\crlf Id: \showid{style} +Valid fields: \showfields{style}\crlf +Id: \showid{style} \starttabulate[|lT|l|p|] \NC \ssbf field \NC \bf type \NC \bf explanation \NC \NR @@ -605,7 +620,8 @@ a trailing \type {'} to signify \quote {cramped} styles. \subsubsubsection{choice nodes} -Valid fields: \showfields{choice}\crlf Id: \showid{choice} +Valid fields: \showfields{choice}\crlf +Id: \showid{choice} \starttabulate[|lT|l|p|] \NC \ssbf field \NC \bf type \NC \bf explanation \NC \NR @@ -622,7 +638,8 @@ correct, otherwise an error may be result. \subsubsubsection{radical nodes} -Valid fields: \showfields{radical}\crlf Id: \showid{radical} +Valid fields: \showfields{radical}\crlf +Id: \showid{radical} \starttabulate[|lT|l|p|] \NC \ssbf field \NC \bf type \NC \bf explanation \NC \NR @@ -673,7 +690,8 @@ sure its internal link structure is correct, otherwise an error may be result. \subsubsubsection{fence nodes} -Valid fields: \showfields{fence}\crlf Id: \showid{fence} +Valid fields: \showfields{fence}\crlf +Id: \showid{fence} \starttabulate[|lT|l|p|] \NC \ssbf field \NC \bf type \NC \bf explanation \NC \NR @@ -749,6 +767,14 @@ Id: \showid{whatsit,special} \NC data \NC string \NC the \type {\special} information \NC \NR \stoptabulate +\subsubsection{boundary nodes} + +Valid fields: \showfields{boundary}\crlf +Id: \showid{boundary} + +This node relates to the \type {\noboundary} primitive but you can use it for +your own purpose too, in which case \type {\boundary} can come in handy. + \subsubsection{language nodes} \LUATEX\ does not have language whatsits any more. All language information is @@ -757,8 +783,8 @@ removed in the next release. \subsubsection{local_par nodes} -Valid fields: \showfields{whatsit,local_par}\crlf -Id: \showid{whatsit,local_par} +Valid fields: \showfields{local_par}\crlf +Id: \showid{local_par} \starttabulate[|lT|l|p|] \NC \ssbf field \NC \bf type \NC \bf explanation \NC \NR @@ -782,8 +808,8 @@ error may be result. \subsubsection[dirnodes]{dir nodes} -Valid fields: \showfields{whatsit,dir}\crlf -Id: \showid{whatsit,dir} +Valid fields: \showfields{dir}\crlf +Id: \showid{dir} \starttabulate[|lT|l|p|] \NC \ssbf field \NC \bf type \NC \bf explanation \NC \NR @@ -912,6 +938,25 @@ Id: \showid{whatsit,pdf_dest} \NC objnum \NC number \NC the \PDF\ object number \NC \NR \stoptabulate +\subsubsection{pdf_action nodes} + +Valid fields: \showfields{whatsit,pdf_action}\crlf +Id: \showid{whatsit,pdf_action} + +These are a special kind of item that only appears inside \PDF\ start link +objects. + +\starttabulate[|lT|l|p|] +\NC \ssbf field \NC \bf type \NC \bf explanation \NC \NR +\NC action_type \NC number \NC \NC \NR +\NC action_id \NC number or string \NC \NC \NR +\NC named_id \NC number \NC \NC \NR +\NC file \NC string \NC \NC \NR +\NC new_window \NC number \NC \NC \NR +\NC data \NC string \NC \NC \NR +\NC ref_count \NC number \NC read-only \NC \NR +\stoptabulate + \subsubsection{pdf_thread nodes} Valid fields: \showfields{whatsit,pdf_thread}\crlf @@ -1239,6 +1284,7 @@ summarized this: \NC \type {setprev} \NC \yes \NC \yes \NC \NR \NC \type {slide} \NC \yes \NC \yes \NC \NR \NC \type {subtype} \NC \yes \NC \nop \NC \NR +\NC \type {subtypes} \NC \yes \NC \nop \NC \NR \NC \type {tail} \NC \yes \NC \yes \NC \NR \NC \type {todirect} \NC \yes \NC \yes \NC \NR \NC \type {tonode} \NC \yes \NC \yes \NC \NR @@ -1252,6 +1298,7 @@ summarized this: \NC \type {usedlist} \NC \yes \NC \yes \NC \NR \NC \type {vpack} \NC \yes \NC \yes \NC \NR \NC \type {whatsits} \NC \yes \NC \nop \NC \NR +\NC \type {whatsitsubtypes} \NC \yes \NC \nop \NC \NR \NC \type {write} \NC \yes \NC \yes \NC \NR \stoptabulate diff --git a/doc/context/sources/general/manuals/luatex/luatex-style.tex b/doc/context/sources/general/manuals/luatex/luatex-style.tex index 4bb4557b0..90479adf1 100644 --- a/doc/context/sources/general/manuals/luatex/luatex-style.tex +++ b/doc/context/sources/general/manuals/luatex/luatex-style.tex @@ -74,6 +74,8 @@ \definecolor[maincolor] [b=.5] \definecolor[othercolor][r=.5,g=.5] +\setupbodyfont[modern] % we need this in examples so we predefine + % \doifmodeelse {atpragma} { % % % \setupbodyfont diff --git a/doc/context/sources/general/manuals/luatex/luatex.tex b/doc/context/sources/general/manuals/luatex/luatex.tex index 7648140f7..bcb543c54 100644 --- a/doc/context/sources/general/manuals/luatex/luatex.tex +++ b/doc/context/sources/general/manuals/luatex/luatex.tex @@ -7,7 +7,7 @@ \dontcomplain \startdocument - [beta=0.82.0] + [beta=0.85.0] \component luatex-titlepage diff --git a/fonts/pfm/hoekwater/context/contnav.pfm b/fonts/pfm/hoekwater/context/contnav.pfm deleted file mode 100644 index 2e6e2eebb..000000000 Binary files a/fonts/pfm/hoekwater/context/contnav.pfm and /dev/null differ diff --git a/fonts/pfm/hoekwater/context/koeieletters.pfm b/fonts/pfm/hoekwater/context/koeieletters.pfm deleted file mode 100644 index 8c890917a..000000000 Binary files a/fonts/pfm/hoekwater/context/koeieletters.pfm and /dev/null differ diff --git a/fonts/pfm/jmn/hans/hans-sh.pfm b/fonts/pfm/jmn/hans/hans-sh.pfm deleted file mode 100644 index 806167740..000000000 Binary files a/fonts/pfm/jmn/hans/hans-sh.pfm and /dev/null differ diff --git a/fonts/pfm/jmn/hans/hans.pfm b/fonts/pfm/jmn/hans/hans.pfm deleted file mode 100644 index 89f74d81e..000000000 Binary files a/fonts/pfm/jmn/hans/hans.pfm and /dev/null differ diff --git a/fonts/type1/hoekwater/context/contnav.pfm b/fonts/type1/hoekwater/context/contnav.pfm new file mode 100644 index 000000000..2e6e2eebb Binary files /dev/null and b/fonts/type1/hoekwater/context/contnav.pfm differ diff --git a/fonts/type1/hoekwater/context/koeieletters.pfm b/fonts/type1/hoekwater/context/koeieletters.pfm new file mode 100644 index 000000000..8c890917a Binary files /dev/null and b/fonts/type1/hoekwater/context/koeieletters.pfm differ diff --git a/fonts/type1/jmn/hans/hans-sh.pfm b/fonts/type1/jmn/hans/hans-sh.pfm new file mode 100644 index 000000000..806167740 Binary files /dev/null and b/fonts/type1/jmn/hans/hans-sh.pfm differ diff --git a/fonts/type1/jmn/hans/hans.pfm b/fonts/type1/jmn/hans/hans.pfm new file mode 100644 index 000000000..89f74d81e Binary files /dev/null and b/fonts/type1/jmn/hans/hans.pfm differ diff --git a/scripts/context/lua/mtx-plain.lua b/scripts/context/lua/mtx-plain.lua index de62b19ea..949b57952 100644 --- a/scripts/context/lua/mtx-plain.lua +++ b/scripts/context/lua/mtx-plain.lua @@ -55,7 +55,9 @@ end local function resultof(...) local command = string.format(...) report("running command %a",command) - return string.strip(os.resultof(command) or "") + local result = os.resultof(command) or "" + result = string.gsub(result,"[\n\r]+","") + return result end function scripts.plain.make(texengine,texformat) @@ -64,13 +66,13 @@ function scripts.plain.make(texengine,texformat) local fmtpathspec = resultof("kpsewhich --var-value=TEXFORMATS --engine=%s",texengine) if fmtpathspec ~= "" then report("using path specification %a",fmtpathspec) - fmtpathspec = resultof('kpsewhich -expand-braces="%s"',fmtpathspec) + fmtpathspec = resultof('kpsewhich --expand-braces="%s"',fmtpathspec) end if fmtpathspec ~= "" then report("using path expansion %a",fmtpathspec) else report("no valid path reported, trying alternative") - fmtpathspec = resultof("kpsewhich --show-path=fmt --engine=%s",texengine) +-- fmtpathspec = resultof("kpsewhich --show-path=fmt --engine=%s",texengine) if fmtpathspec ~= "" then report("using path expansion %a",fmtpathspec) else @@ -91,7 +93,7 @@ function scripts.plain.make(texengine,texformat) end end end - local fmtpath = --expand-path $safe-out-name=$TEXFORMATS +-- local fmtpath = resultof("kpsewhich --expand-path $safe-out-name=$TEXFORMATS") if not fmtpath or fmtpath == "" then fmtpath = "." else diff --git a/scripts/context/lua/mtxrun.lua b/scripts/context/lua/mtxrun.lua index 04b2294cb..15034149b 100644 --- a/scripts/context/lua/mtxrun.lua +++ b/scripts/context/lua/mtxrun.lua @@ -7959,7 +7959,7 @@ do -- create closure to overcome 200 locals limit package.loaded["trac-log"] = package.loaded["trac-log"] or true --- original size: 30417, stripped down to: 21120 +-- original size: 30685, stripped down to: 21298 if not modules then modules={} end modules ['trac-log']={ version=1.001, @@ -8019,6 +8019,8 @@ if tex and (tex.jobname or tex.formatname) then elseif target=="term" then texio_write_nl("term","") io_write(...) + elseif type(target)=="number" then + texio_write_nl(target,...) elseif target~="none" then texio_write_nl("log",target,...) texio_write_nl("term","") @@ -8036,6 +8038,8 @@ if tex and (tex.jobname or tex.formatname) then texio_write("log",...) elseif target=="term" then io_write(...) + elseif type(target)=="number" then + texio_write(target,...) elseif target~="none" then texio_write("log",target,...) io_write(target,...) @@ -8106,7 +8110,7 @@ if tex and (tex.jobname or tex.formatname) then write_nl(target,"\n") end report=function(a,b,c,...) - if c then + if c~=nil then write_nl(target,report_yes(translations[a],formatters[formats[b]](c,...))) elseif b then write_nl(target,report_yes(translations[a],formats[b])) @@ -8117,7 +8121,7 @@ if tex and (tex.jobname or tex.formatname) then end end direct=function(a,b,c,...) - if c then + if c~=nil then return direct_yes(translations[a],formatters[formats[b]](c,...)) elseif b then return direct_yes(translations[a],formats[b]) @@ -8128,7 +8132,7 @@ if tex and (tex.jobname or tex.formatname) then end end subreport=function(a,s,b,c,...) - if c then + if c~=nil then write_nl(target,subreport_yes(translations[a],translations[s],formatters[formats[b]](c,...))) elseif b then write_nl(target,subreport_yes(translations[a],translations[s],formats[b])) @@ -8139,7 +8143,7 @@ if tex and (tex.jobname or tex.formatname) then end end subdirect=function(a,s,b,c,...) - if c then + if c~=nil then return subdirect_yes(translations[a],translations[s],formatters[formats[b]](c,...)) elseif b then return subdirect_yes(translations[a],translations[s],formats[b]) @@ -8150,7 +8154,7 @@ if tex and (tex.jobname or tex.formatname) then end end status=function(a,b,c,...) - if c then + if c~=nil then write_nl(target,status_yes(translations[a],formatters[formats[b]](c,...))) elseif b then write_nl(target,status_yes(translations[a],formats[b])) @@ -18345,8 +18349,8 @@ end -- of closure -- used libraries : l-lua.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-fil.lua util-sac.lua util-sto.lua util-prs.lua util-fmt.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-mrg.lua util-tpl.lua util-env.lua luat-env.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua util-lib.lua luat-sta.lua luat-fmt.lua -- skipped libraries : - --- original bytes : 781632 --- stripped bytes : 283212 +-- original bytes : 781900 +-- stripped bytes : 283302 -- end library merge diff --git a/scripts/context/stubs/mswin/mtxrun.lua b/scripts/context/stubs/mswin/mtxrun.lua index 04b2294cb..15034149b 100644 --- a/scripts/context/stubs/mswin/mtxrun.lua +++ b/scripts/context/stubs/mswin/mtxrun.lua @@ -7959,7 +7959,7 @@ do -- create closure to overcome 200 locals limit package.loaded["trac-log"] = package.loaded["trac-log"] or true --- original size: 30417, stripped down to: 21120 +-- original size: 30685, stripped down to: 21298 if not modules then modules={} end modules ['trac-log']={ version=1.001, @@ -8019,6 +8019,8 @@ if tex and (tex.jobname or tex.formatname) then elseif target=="term" then texio_write_nl("term","") io_write(...) + elseif type(target)=="number" then + texio_write_nl(target,...) elseif target~="none" then texio_write_nl("log",target,...) texio_write_nl("term","") @@ -8036,6 +8038,8 @@ if tex and (tex.jobname or tex.formatname) then texio_write("log",...) elseif target=="term" then io_write(...) + elseif type(target)=="number" then + texio_write(target,...) elseif target~="none" then texio_write("log",target,...) io_write(target,...) @@ -8106,7 +8110,7 @@ if tex and (tex.jobname or tex.formatname) then write_nl(target,"\n") end report=function(a,b,c,...) - if c then + if c~=nil then write_nl(target,report_yes(translations[a],formatters[formats[b]](c,...))) elseif b then write_nl(target,report_yes(translations[a],formats[b])) @@ -8117,7 +8121,7 @@ if tex and (tex.jobname or tex.formatname) then end end direct=function(a,b,c,...) - if c then + if c~=nil then return direct_yes(translations[a],formatters[formats[b]](c,...)) elseif b then return direct_yes(translations[a],formats[b]) @@ -8128,7 +8132,7 @@ if tex and (tex.jobname or tex.formatname) then end end subreport=function(a,s,b,c,...) - if c then + if c~=nil then write_nl(target,subreport_yes(translations[a],translations[s],formatters[formats[b]](c,...))) elseif b then write_nl(target,subreport_yes(translations[a],translations[s],formats[b])) @@ -8139,7 +8143,7 @@ if tex and (tex.jobname or tex.formatname) then end end subdirect=function(a,s,b,c,...) - if c then + if c~=nil then return subdirect_yes(translations[a],translations[s],formatters[formats[b]](c,...)) elseif b then return subdirect_yes(translations[a],translations[s],formats[b]) @@ -8150,7 +8154,7 @@ if tex and (tex.jobname or tex.formatname) then end end status=function(a,b,c,...) - if c then + if c~=nil then write_nl(target,status_yes(translations[a],formatters[formats[b]](c,...))) elseif b then write_nl(target,status_yes(translations[a],formats[b])) @@ -18345,8 +18349,8 @@ end -- of closure -- used libraries : l-lua.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-fil.lua util-sac.lua util-sto.lua util-prs.lua util-fmt.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-mrg.lua util-tpl.lua util-env.lua luat-env.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua util-lib.lua luat-sta.lua luat-fmt.lua -- skipped libraries : - --- original bytes : 781632 --- stripped bytes : 283212 +-- original bytes : 781900 +-- stripped bytes : 283302 -- end library merge diff --git a/scripts/context/stubs/unix/mtxrun b/scripts/context/stubs/unix/mtxrun index 04b2294cb..15034149b 100644 --- a/scripts/context/stubs/unix/mtxrun +++ b/scripts/context/stubs/unix/mtxrun @@ -7959,7 +7959,7 @@ do -- create closure to overcome 200 locals limit package.loaded["trac-log"] = package.loaded["trac-log"] or true --- original size: 30417, stripped down to: 21120 +-- original size: 30685, stripped down to: 21298 if not modules then modules={} end modules ['trac-log']={ version=1.001, @@ -8019,6 +8019,8 @@ if tex and (tex.jobname or tex.formatname) then elseif target=="term" then texio_write_nl("term","") io_write(...) + elseif type(target)=="number" then + texio_write_nl(target,...) elseif target~="none" then texio_write_nl("log",target,...) texio_write_nl("term","") @@ -8036,6 +8038,8 @@ if tex and (tex.jobname or tex.formatname) then texio_write("log",...) elseif target=="term" then io_write(...) + elseif type(target)=="number" then + texio_write(target,...) elseif target~="none" then texio_write("log",target,...) io_write(target,...) @@ -8106,7 +8110,7 @@ if tex and (tex.jobname or tex.formatname) then write_nl(target,"\n") end report=function(a,b,c,...) - if c then + if c~=nil then write_nl(target,report_yes(translations[a],formatters[formats[b]](c,...))) elseif b then write_nl(target,report_yes(translations[a],formats[b])) @@ -8117,7 +8121,7 @@ if tex and (tex.jobname or tex.formatname) then end end direct=function(a,b,c,...) - if c then + if c~=nil then return direct_yes(translations[a],formatters[formats[b]](c,...)) elseif b then return direct_yes(translations[a],formats[b]) @@ -8128,7 +8132,7 @@ if tex and (tex.jobname or tex.formatname) then end end subreport=function(a,s,b,c,...) - if c then + if c~=nil then write_nl(target,subreport_yes(translations[a],translations[s],formatters[formats[b]](c,...))) elseif b then write_nl(target,subreport_yes(translations[a],translations[s],formats[b])) @@ -8139,7 +8143,7 @@ if tex and (tex.jobname or tex.formatname) then end end subdirect=function(a,s,b,c,...) - if c then + if c~=nil then return subdirect_yes(translations[a],translations[s],formatters[formats[b]](c,...)) elseif b then return subdirect_yes(translations[a],translations[s],formats[b]) @@ -8150,7 +8154,7 @@ if tex and (tex.jobname or tex.formatname) then end end status=function(a,b,c,...) - if c then + if c~=nil then write_nl(target,status_yes(translations[a],formatters[formats[b]](c,...))) elseif b then write_nl(target,status_yes(translations[a],formats[b])) @@ -18345,8 +18349,8 @@ end -- of closure -- used libraries : l-lua.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-fil.lua util-sac.lua util-sto.lua util-prs.lua util-fmt.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-mrg.lua util-tpl.lua util-env.lua luat-env.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua util-lib.lua luat-sta.lua luat-fmt.lua -- skipped libraries : - --- original bytes : 781632 --- stripped bytes : 283212 +-- original bytes : 781900 +-- stripped bytes : 283302 -- end library merge diff --git a/scripts/context/stubs/win64/mtxrun.lua b/scripts/context/stubs/win64/mtxrun.lua index 04b2294cb..15034149b 100644 --- a/scripts/context/stubs/win64/mtxrun.lua +++ b/scripts/context/stubs/win64/mtxrun.lua @@ -7959,7 +7959,7 @@ do -- create closure to overcome 200 locals limit package.loaded["trac-log"] = package.loaded["trac-log"] or true --- original size: 30417, stripped down to: 21120 +-- original size: 30685, stripped down to: 21298 if not modules then modules={} end modules ['trac-log']={ version=1.001, @@ -8019,6 +8019,8 @@ if tex and (tex.jobname or tex.formatname) then elseif target=="term" then texio_write_nl("term","") io_write(...) + elseif type(target)=="number" then + texio_write_nl(target,...) elseif target~="none" then texio_write_nl("log",target,...) texio_write_nl("term","") @@ -8036,6 +8038,8 @@ if tex and (tex.jobname or tex.formatname) then texio_write("log",...) elseif target=="term" then io_write(...) + elseif type(target)=="number" then + texio_write(target,...) elseif target~="none" then texio_write("log",target,...) io_write(target,...) @@ -8106,7 +8110,7 @@ if tex and (tex.jobname or tex.formatname) then write_nl(target,"\n") end report=function(a,b,c,...) - if c then + if c~=nil then write_nl(target,report_yes(translations[a],formatters[formats[b]](c,...))) elseif b then write_nl(target,report_yes(translations[a],formats[b])) @@ -8117,7 +8121,7 @@ if tex and (tex.jobname or tex.formatname) then end end direct=function(a,b,c,...) - if c then + if c~=nil then return direct_yes(translations[a],formatters[formats[b]](c,...)) elseif b then return direct_yes(translations[a],formats[b]) @@ -8128,7 +8132,7 @@ if tex and (tex.jobname or tex.formatname) then end end subreport=function(a,s,b,c,...) - if c then + if c~=nil then write_nl(target,subreport_yes(translations[a],translations[s],formatters[formats[b]](c,...))) elseif b then write_nl(target,subreport_yes(translations[a],translations[s],formats[b])) @@ -8139,7 +8143,7 @@ if tex and (tex.jobname or tex.formatname) then end end subdirect=function(a,s,b,c,...) - if c then + if c~=nil then return subdirect_yes(translations[a],translations[s],formatters[formats[b]](c,...)) elseif b then return subdirect_yes(translations[a],translations[s],formats[b]) @@ -8150,7 +8154,7 @@ if tex and (tex.jobname or tex.formatname) then end end status=function(a,b,c,...) - if c then + if c~=nil then write_nl(target,status_yes(translations[a],formatters[formats[b]](c,...))) elseif b then write_nl(target,status_yes(translations[a],formats[b])) @@ -18345,8 +18349,8 @@ end -- of closure -- used libraries : l-lua.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-fil.lua util-sac.lua util-sto.lua util-prs.lua util-fmt.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-mrg.lua util-tpl.lua util-env.lua luat-env.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua util-lib.lua luat-sta.lua luat-fmt.lua -- skipped libraries : - --- original bytes : 781632 --- stripped bytes : 283212 +-- original bytes : 781900 +-- stripped bytes : 283302 -- end library merge diff --git a/tex/context/base/anch-pos.lua b/tex/context/base/anch-pos.lua index 77e36e85e..95b5b86b2 100644 --- a/tex/context/base/anch-pos.lua +++ b/tex/context/base/anch-pos.lua @@ -55,6 +55,7 @@ local nuts = nodes.nuts local getfield = nuts.getfield local setfield = nuts.setfield +local setlink = nuts.setlink local getlist = nuts.getlist local getbox = nuts.getbox local getskip = nuts.getskip @@ -444,13 +445,10 @@ local function markregionbox(n,tag,correct) local head = getlist(box) if head then local tail = find_tail(head) - setfield(head,"prev",push) - setfield(push,"next",head) - setfield(pop,"prev",tail) - setfield(tail,"next",pop) + setlink(push,head) + setlink(tail,pop) else -- we can have a simple push/pop - setfield(push,"next",pop) - setfield(pop,"prev",push) + setlink(push,pop) end setfield(box,"list",push) end diff --git a/tex/context/base/back-exp.lua b/tex/context/base/back-exp.lua index 7a86cbd8c..840a6d3e3 100644 --- a/tex/context/base/back-exp.lua +++ b/tex/context/base/back-exp.lua @@ -81,7 +81,6 @@ local languagenames = languages.numbers local nodecodes = nodes.nodecodes local skipcodes = nodes.skipcodes -local whatsitcodes = nodes.whatsitcodes local listcodes = nodes.listcodes local hlist_code = nodecodes.hlist @@ -91,8 +90,6 @@ local glue_code = nodecodes.glue local kern_code = nodecodes.kern local disc_code = nodecodes.disc local insert_code = nodecodes.insert -local whatsit_code = nodecodes.whatsit -local refximage_code = whatsitcodes.pdfrefximage local userskip_code = skipcodes.userskip local rightskip_code = skipcodes.rightskip diff --git a/tex/context/base/back-ini.mkiv b/tex/context/base/back-ini.mkiv index 2b0f054ee..9859f026a 100644 --- a/tex/context/base/back-ini.mkiv +++ b/tex/context/base/back-ini.mkiv @@ -42,14 +42,8 @@ %D versions might support more backends again, but this has a low %D priority. %D -%D The big question is: what is to be considered a backend issue and -%D what not. For the moment we treat image inclusion, object reuse, -%D position tracking and color as frontend issues, if only because we -%D deal with them via \LUA\ code and as such we don't depend too much -%D on macro calls that need to inject code for the backend. -%D %D Not everything here makes sense and the content of this file will -%D definitely change. +%D definitely change (or even go away). \let \dostartrotation \gobbleoneargument \let \dostoprotation \donothing @@ -90,45 +84,6 @@ \let \dostartclipping \gobblethreearguments \let \dostopclipping \donothing -%D \macros -%D {dostartobject, -%D dostopobject, -%D doresetobjects, -%D doinsertobject} -%D -%D Reuse of object can reduce the output filesize -%D considerably. Reusable objects are implemented with: -%D -%D \starttyping -%D \dostartobject{class}{name}{width}{height}{depth} -%D some typeset material -%D \dostopobject -%D \stoptyping -%D -%D \starttyping -%D \doinsertobject{class}{name} -%D \stoptyping -%D -%D The savings can be huge in interactive texts. The next macro needs -%D to be called after a graphic is inserted (in order to clean up -%D global references). -%D -%D \starttyping -%D \doresetobjects -%D \stoptyping - -\let \dostartobject \gobblefourarguments -\let \dostopobject \donothing -\let \doinsertobject \gobbletwoarguments -\let \doresetobjects \donothing - -%D From now on, mapfile loading is also a special; we assume the -%D more or less standard dvips syntax. - -%let \doresetmapfilelist \donothing -%let \doloadmapfile \gobbletwoarguments % + - = | filename -%let \doloadmapline \gobbletwoarguments % + - = | fileline - %D \macros %D {jobsuffix} %D diff --git a/tex/context/base/back-pdf.lua b/tex/context/base/back-pdf.lua index 7f0b1acc7..5d007ed43 100644 --- a/tex/context/base/back-pdf.lua +++ b/tex/context/base/back-pdf.lua @@ -57,7 +57,7 @@ local pdfsetmatrix = nodes.pool.pdfsetmatrix local stack = { } local restore = true -- false -scanners.pdfstartrotation = function() -- a +scanners.pdfstartrotation = function() local a = scannumber() if a == 0 then insert(stack,false) @@ -69,53 +69,56 @@ scanners.pdfstartrotation = function() -- a end end -scanners.pdfstartscaling = function() -- sx sy - local sx, sy = 0, 0 +scanners.pdfstartscaling = function() -- at the tex end we use sx and sy instead of rx and ry + local rx, ry = 1, 1 while true do - if scankeyword("sx") then - sx = scannumber() - elseif scankeyword("sy") then - sy = scannumber() + if scankeyword("rx") then + rx = scannumber() + elseif scankeyword("ry") then + ry = scannumber() + -- elseif scankeyword("revert") then + -- local top = stack[#stack] + -- if top then + -- rx = top[1] + -- ry = top[4] + -- else + -- rx = 1 + -- ry = 1 + -- end else break end end - if sx == 1 and sy == 1 then + if rx == 1 and ry == 1 then insert(stack,false) else - if sx == 0 then - sx = 0.0001 + if rx == 0 then + rx = 0.0001 end - if sy == 0 then - sy = 0.0001 + if ry == 0 then + ry = 0.0001 end context(pdfsave()) - context(pdfsetmatrix(sx,0,0,sy)) - insert(stack,restore and { 1/sx, 0, 0, 1/sy } or true) + context(pdfsetmatrix(rx,0,0,ry)) + insert(stack,restore and { 1/rx, 0, 0, 1/ry } or true) end end -scanners.pdfstartmatrix = function() -- sx rx ry sy -- tx, ty - local sx, rx, ry, sy = 0, 0, 0, 0 +scanners.pdfstartmatrix = function() -- rx sx sy ry -- tx, ty + local rx, sx, sy, ry = 1, 0, 0, 1 while true do - if scankeyword("sx") then - sx = scannumber() - elseif scankeyword("sy") then - sy = scannumber() - elseif scankeyword("rx") then - rx = scannumber() - elseif scankeyword("ry") then - ry = scannumber() - else - break - end + if scankeyword("rx") then rx = scannumber() + elseif scankeyword("ry") then ry = scannumber() + elseif scankeyword("sx") then sx = scannumber() + elseif scankeyword("sy") then sy = scannumber() + else break end end - if sx == 1 and rx == 0 and ry == 0 and sy == 1 then + if rx == 1 and sx == 0 and sy == 0 and ry == 1 then insert(stack,false) else context(pdfsave()) - context(pdfsetmatrix(sx,rx,ry,sy)) - insert(stack,store and { -sx, -rx, -ry, -sy } or true) + context(pdfsetmatrix(rx,sx,sy,ry)) + insert(stack,store and { -rx, -sx, -sy, -ry } or true) end end @@ -126,7 +129,7 @@ local function pdfstopsomething() elseif top == true then context(pdfrestore()) elseif top then - context(pdfsetmatrix(unpack(top))) + context(pdfsetmatrix(unpack(top))) -- not really needed anymore context(pdfrestore()) else -- nesting error @@ -142,9 +145,3 @@ scanners.pdfstartmirroring = function() end scanners.pdfstopmirroring = scanners.pdfstartmirroring - -scanners.registerbackendsymbol = function() - backends.codeinjections.registersymbol(scanstring(),scaninteger()) -end - --- todo : clipping diff --git a/tex/context/base/back-pdf.mkiv b/tex/context/base/back-pdf.mkiv index 38de4bbfd..cc21355e9 100644 --- a/tex/context/base/back-pdf.mkiv +++ b/tex/context/base/back-pdf.mkiv @@ -19,6 +19,7 @@ \registerctxluafile{lpdf-col}{1.000} \registerctxluafile{lpdf-xmp}{1.001} \registerctxluafile{lpdf-ano}{1.001} +\registerctxluafile{lpdf-res}{1.001} \registerctxluafile{lpdf-mis}{1.001} \registerctxluafile{lpdf-ren}{1.001} \registerctxluafile{lpdf-grp}{1.001} @@ -41,20 +42,20 @@ %D %D Here we initialize some internal quantities. We also protect them. -\pdfoutput \plusone \let\pdfoutput \undefined \newcount\pdfoutput \pdfoutput \plusone +\outputmode \plusone \let\modeoutput \undefined \newcount\outputmode \outputmode \plusone %D These are already set: -\pdfhorigin 1 true in \let\pdfhorigin\undefined \newdimen\pdfhorigin \pdfhorigin 1 true in -\pdfvorigin \pdfhorigin \let\pdfvorigin\undefined \newdimen\pdfvorigin \pdfvorigin \pdfhorigin +\pdfhorigin 1 true in +\pdfvorigin \pdfhorigin %D These too and most of them will be protected as well: \pdfminorversion \plusseven -\pdfgentounicode \plusone \let\pdfgentounicode \undefined \newcount\pdfgentounicode -\pdfinclusioncopyfonts \plusone \let\pdfinclusioncopyfonts \undefined \newcount\pdfinclusioncopyfonts -\pdfinclusionerrorlevel \zerocount \let\pdfinclusionerrorlevel\undefined \newcount\pdfinclusionerrorlevel -\pdfdecimaldigits \plusten \let\pdfdecimaldigits \undefined \newcount\pdfdecimaldigits +\pdfgentounicode \plusone % \let\pdfgentounicode \undefined \newcount\pdfgentounicode +\pdfinclusioncopyfonts \plusone % \let\pdfinclusioncopyfonts \undefined \newcount\pdfinclusioncopyfonts +\pdfinclusionerrorlevel \zerocount % \let\pdfinclusionerrorlevel\undefined \newcount\pdfinclusionerrorlevel +\pdfdecimaldigits \plusten % \let\pdfdecimaldigits \undefined \newcount\pdfdecimaldigits \pdfimageresolution 300 \pdfpkresolution 600 @@ -97,7 +98,7 @@ %D For the moment we keep these. -\newtoks \pdfbackendeveryximage +%newtoks \pdfbackendeveryximage \newtoks \pdfbackendeveryxform %D These are the only official methods to add stuff to the resources. @@ -129,20 +130,9 @@ \pdfbackendsetinfo{ConTeXt.Support}{contextgarden.net}% \to \everylastbackendshipout -%D Transformations. Some day we will use primitives (once they're fixed). +%D Transformations -% todo: inject at the lua end cq. deal with #5 and #6 too - -% % % rotation % % % - -% \unexpanded\def\dostartrotation#1% grouped -% {\forcecolorhack -% \pdfsave -% \pdfsetmatrix{\clf_pdfrotation#1}} - -% \unexpanded\def\dostoprotation -% {\pdfrestore -% \forcecolorhack} +% rotation \unexpanded\def\dostartrotation#1% {\forcecolorhack @@ -151,36 +141,16 @@ \unexpanded\def\dostoprotation {\clf_pdfstoprotation} -% % % scaling % % % - -% \unexpanded\def\dostartscaling#1#2% the test is needed because acrobat is bugged! -% {\forcecolorhack % maybe use signal instead -% \pdfsave -% \pdfsetmatrix -% {\ifdim#1\points=\zeropoint.0001\else#1\fi\space 0 0 -% \ifdim#2\points=\zeropoint.0001\else#2\fi\space}}% 0 0 - -% \unexpanded\def\dostopscaling -% {\pdfrestore -% \forcecolorhack} +% scaling \unexpanded\def\dostartscaling#1#2% {\forcecolorhack - \clf_pdfstartscaling sx #1 sy #2\relax} + \clf_pdfstartscaling rx #1 ry #2\relax} \unexpanded\def\dostopscaling {\clf_pdfstopscaling} -% % % mirroring % % % - -% \unexpanded\def\dostartmirroring -% {\forcecolorhack -% \pdfsave -% \pdfsetmatrix{-1 0 0 1}} % 0 0 - -% \unexpanded\def\dostopmirroring -% {\pdfrestore -% \forcecolorhack} +% mirroring \unexpanded\def\dostartmirroring {\clf_pdfstartmirroring} @@ -188,35 +158,9 @@ \unexpanded\def\dostopmirroring {\clf_pdfstopmirroring} -% % % transform % % % - -% \unexpanded\def\dotransformnextbox#1#2#3#4#5#6% sx rx ry sy tx ty (will change) / basepoints ! -% {\dowithnextbox{\dodotransformnextbox{#5}{#6}{#1 #2 #3 #4}}} +% transform -% \unexpanded\def\dodotransformnextbox#1#2#3% -% {\hbox -% {\kern#1\onebasepoint -% \raise#2\onebasepoint\hbox -% {\pdfsave -% \pdfsetmatrix{#3}% 0 0 (no #5 #6 yet) -% \box\nextbox -% \pdfrestore -% }}} - -% \unexpanded\def\dotransformnextbox#1#2#3#4#5#6% sx rx ry sy tx ty (will change) / basepoints ! -% {% fixing ht/dp/wd should happen elsewhere -% \dowithnextbox{\dodotransformnextbox{#1}{#2}{#3}{#4}{#5}{#6}}} - -% \unexpanded\def\dodotransformnextbox#1#2#3#4#5#6% -% {\hbox -% {\kern #5\onebasepoint -% \raise#6\onebasepoint -% \hbox -% {\clf_pdfstartmatrix sx #1 rx #2 ry #3 sy #4\relax -% \box\nextbox -% \clf_pdfstopmatrix}}} - -\unexpanded\def\dotransformnextbox#1#2#3#4#5#6% sx rx ry sy tx ty (will change) / basepoints ! +\unexpanded\def\dotransformnextbox#1#2#3#4#5#6% {\dowithnextbox{\dodotransformnextbox{#1}{#2}{#3}{#4}{#5}{#6}}} \unexpanded\def\dodotransformnextbox#1#2#3#4#5#6% @@ -224,7 +168,7 @@ {\kern #5\onebasepoint \raise#6\onebasepoint \hbox - {\clf_pdfstartmatrix sx #1 rx #2 ry #3 sy #4\relax + {\clf_pdfstartmatrix rx #1 sx #2 sy #3 ry #4\relax \box\nextbox \clf_pdfstopmatrix}}} @@ -235,8 +179,8 @@ % \box\nextbox} % % \startluacode -% function commands.pdftransformbox(box,sx,rx,ry,sy,tx,ty) -% if sx == 1 and rx == 0 and ry == 0 and sy == 1 then +% function commands.pdftransformbox(box,rx,sx,sy,ry,tx,ty) +% if rx == 1 and sx == 0 and sy == 0 and ry == 1 then % if tx == 0 and ty == 0 then % local b = nodes.hpack(nodes.concat { % nodes.pool.kern(tx), @@ -251,9 +195,9 @@ % local b = nodes.hpack(nodes.concat { % nodes.pool.kern(tx), % nodes.pool.pdfsave(), -% nodes.pool.pdfsetmatrix(sx,rx,ry,sy), +% nodes.pool.pdfsetmatrix(rx,sx,sy,ry), % nodes.takebox(box), -% nodes.pool.pdfsetmatrix(-sx,-rx,-ry,-sy), +% nodes.pool.pdfsetmatrix(-rx,-sx,-sy,-ry), % nodes.pool.pdfrestore(), % }) % b.shift = -ty @@ -262,7 +206,7 @@ % end % \stopluacode -% % % clipping % % % +% clipping \unexpanded\def\dostartclipping#1#2#3% we can move this to lua and only set a box here {\PointsToBigPoints{#2}\width @@ -278,51 +222,12 @@ \unexpanded\def\dostopclipping {\pdfliteral{Q}} -%D The following will move to the backend \LUA\ code: - -%appendtoks \ctxlua{backends.codeinjections.finalizepage ()}\to \everybackendshipout % is immediate -%appendtoks \ctxlua{backends.codeinjections.finalizedocument()}\to \everylastbackendshipout % is immediate - %D Temporary hack, will be removed or improved or default. -%def\TransparencyHack{\ctxlua{backends.codeinjections.addtransparencygroup()}} -\def\TransparencyHack{\setupcolors[\c!pagecolormodel=\v!auto]} - -%D \macros -%D {dostartobject,dostopobject,doinsertobject} - -%D This will change: - -\newbox\objectbox - -\unexpanded\def\dostartobject#1#2#3#4#5% needs to be \unexpanded - {\bgroup - \setbox\objectbox\vbox\bgroup - \def\back_object_stop{\egroup\back_object_register{#1}{#2}}} - -\unexpanded\def\dostopobject % needs to be \unexpanded - {\back_object_stop - \egroup} - -\let\back_object_stop\relax - % attr {/Group << /S /Transparency /I false /K true >>} -\def\back_object_register#1#2% - {\the\pdfbackendeveryxform - \finalizeobjectbox\objectbox - \immediate\pdfxform resources {\pdfbackendcurrentresources}\objectbox - \dosetobjectreference{#1}{#2}\pdflastxform} - -\let\m_back_object_reference\empty - -\unexpanded\def\doinsertobject#1#2% - {\begingroup - \doifelseobjectreferencefound{#1}{#2} - {\dogetobjectreference{#1}{#2}\m_back_object_reference - \pdfrefxform\m_back_object_reference}% - \donothing - \endgroup} +%def\TransparencyHack{\ctxlua{backends.codeinjections.addtransparencygroup()}} +\def\TransparencyHack{\setupcolors[\c!pagecolormodel=\v!auto]} \let\lastpredefinedsymbol\empty % some day we can do more at the lua end @@ -334,7 +239,7 @@ \clf_registerbackendsymbol{#1}\m_back_object_reference\relax \endgroup} -% for the moment here +% Still here: %D \macros %D {back_ovalbox} diff --git a/tex/context/base/buff-par.mkvi b/tex/context/base/buff-par.mkvi index 5af04ba7c..b17edb173 100644 --- a/tex/context/base/buff-par.mkvi +++ b/tex/context/base/buff-par.mkvi @@ -93,7 +93,7 @@ \unexpanded\def\buff_parallel_save#instance% defined moet ook aan de lua kant kunnen {\clf_saveparallel {\currentparallel}% - {#instance}, + {#instance}% {\thedefinedbuffer{#instance}}% \relax} diff --git a/tex/context/base/catc-ini.mkiv b/tex/context/base/catc-ini.mkiv index bb1e47faa..175fdd380 100644 --- a/tex/context/base/catc-ini.mkiv +++ b/tex/context/base/catc-ini.mkiv @@ -279,9 +279,9 @@ \fi} \normalprotected\def\syst_catcodes_trace_nesting_error - {\immediate\write16{}% - \immediate\write16{Fatal error: catcode push/pop mismatch. Fix this! (restore level: \number\c_syst_catcodes_level)}\wait\end - \immediate\write16{}} + {\immediate\write\statuswrite{}% + \immediate\write\statuswrite{Fatal error: catcode push/pop mismatch. Fix this! (restore level: \number\c_syst_catcodes_level)}\wait\end + \immediate\write\statuswrite{}} \normalprotected\def\restorecatcodes % takes previous level {\ifnum\c_syst_catcodes_level>\plusone @@ -306,7 +306,7 @@ \def\syst_catcodes_trace_push{\syst_catcodes_trace{push \catcodetablename\space from \syst_catcodes_prev\space at \number\c_syst_catcodes_level}}% \def\syst_catcodes_trace_pop {\syst_catcodes_trace{pop \catcodetablename\space to \syst_catcodes_prev\space at \number\c_syst_catcodes_level}}} -\def\syst_catcodes_trace#1{\immediate\write16{[#1]}} +\def\syst_catcodes_trace#1{\immediate\write\statuswrite{[#1]}} \def\syst_catcodes_prev {\ifnum\numexpr\c_syst_catcodes_level-1\relax>\zerocount diff --git a/tex/context/base/char-ini.lua b/tex/context/base/char-ini.lua index 095133b55..0a79051e8 100644 --- a/tex/context/base/char-ini.lua +++ b/tex/context/base/char-ini.lua @@ -723,20 +723,27 @@ table we derive a few more.

if not characters.fallbacks then - characters.fallbacks = { } -- not than many - - local fallbacks = characters.fallbacks + characters.fallbacks = { + [0x0308] = 0x00A8, [0x00A8] = 0x0308, -- dieresiscmb dieresis + [0x0304] = 0x00AF, [0x00AF] = 0x0304, -- macroncmb macron + [0x0301] = 0x00B4, [0x00B4] = 0x0301, -- acutecomb acute + [0x0327] = 0x00B8, [0x00B8] = 0x0327, -- cedillacmb cedilla + [0x0302] = 0x02C6, [0x02C6] = 0x0302, -- circumflexcmb circumflex + [0x030C] = 0x02C7, [0x02C7] = 0x030C, -- caroncmb caron + [0x0306] = 0x02D8, [0x02D8] = 0x0306, -- brevecmb breve + [0x0307] = 0x02D9, [0x02D9] = 0x0307, -- dotaccentcmb dotaccent + [0x030A] = 0x02DA, [0x02DA] = 0x030A, -- ringcmb ring + [0x0328] = 0x02DB, [0x02DB] = 0x0328, -- ogonekcmb ogonek + [0x0303] = 0x02DC, [0x02DC] = 0x0303, -- tildecomb tilde + [0x030B] = 0x02DD, [0x02DD] = 0x030B, -- hungarumlautcmb hungarumlaut + [0x0305] = 0x203E, [0x203E] = 0x0305, -- overlinecmb overline + [0x0300] = 0x0060, [0x0060] = 0x0333, -- gravecomb grave + } - for k, d in next, data do - local specials = d.specials - if specials and specials[1] == "compat" and specials[2] == 0x0020 then - local s = specials[3] - if s then - fallbacks[k] = s - fallbacks[s] = k - end - end - end + -- not done (would mess up mapping): + -- + -- 0X0301/0X0384 0X0314/0X1FFE 0X0313/0X1FBD 0X0313/0X1FBF 0X0342/0X1FC0 + -- 0X3099/0X309B 0X309A/0X309C 0X0333/0X2017 0X0345/0X037A end diff --git a/tex/context/base/chem-ini.mkiv b/tex/context/base/chem-ini.mkiv index 9a44b4f1a..a5cd41f2b 100644 --- a/tex/context/base/chem-ini.mkiv +++ b/tex/context/base/chem-ini.mkiv @@ -16,6 +16,8 @@ \unprotect +% todo: use \mathscriptsmode if needed + %D \macros %D {molecule} %D diff --git a/tex/context/base/cldf-ini.lua b/tex/context/base/cldf-ini.lua index da284ba5e..f6a1ba849 100644 --- a/tex/context/base/cldf-ini.lua +++ b/tex/context/base/cldf-ini.lua @@ -6,6 +6,14 @@ if not modules then modules = { } end modules ['cldf-ini'] = { license = "see context related readme files" } +-- see cldf-tod.* ! + +-- maybe: +-- +-- 0.528 local foo = tex.ctxcatcodes +-- 0.651 local foo = getcount("ctxcatcodes") +-- 0.408 local foo = getcount(ctxcatcodes) -- local ctxcatcodes = tex.iscount("ctxcatcodes") + -- This started as an experiment: generating context code at the lua end. After all -- it is surprisingly simple to implement due to metatables. I was wondering if -- there was a more natural way to deal with commands at the lua end. Of course it's @@ -207,6 +215,7 @@ local registerfunction, unregisterfunction, reservefunction, knownfunctions, cal local slot = slots[i] local data = storedfunctions[slot] luafunctions[slot] = function(...) + -- print(data) -- could be trace return expose(slot,data,...) end end diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv index 63952c8b0..57610f6bc 100644 --- a/tex/context/base/cont-new.mkiv +++ b/tex/context/base/cont-new.mkiv @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2015.10.09 21:28} +\newcontextversion{2015.11.19 19:13} %D This file is loaded at runtime, thereby providing an excellent place for %D hacks, patches, extensions and new features. diff --git a/tex/context/base/context-version.pdf b/tex/context/base/context-version.pdf index 1d43fe81a..0674945c2 100644 Binary files a/tex/context/base/context-version.pdf and b/tex/context/base/context-version.pdf differ diff --git a/tex/context/base/context.mkii b/tex/context/base/context.mkii index 990c8bd11..84679a9a2 100644 --- a/tex/context/base/context.mkii +++ b/tex/context/base/context.mkii @@ -85,6 +85,7 @@ \loadmarkfile{xetx-cls} \fi + %D To enable selective loading, we say: \newif\ifCONTEXT \CONTEXTtrue % will disappear diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv index 0edbe084b..6beb784ac 100644 --- a/tex/context/base/context.mkiv +++ b/tex/context/base/context.mkiv @@ -39,7 +39,7 @@ %D up and the dependencies are more consistent. \edef\contextformat {\jobname} -\edef\contextversion{2015.10.09 21:28} +\edef\contextversion{2015.11.19 19:13} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/core-env.lua b/tex/context/base/core-env.lua index a3a87b7f7..866176171 100644 --- a/tex/context/base/core-env.lua +++ b/tex/context/base/core-env.lua @@ -13,6 +13,9 @@ if not modules then modules = { } end modules ['core-env'] = { local P, C, S, Cc, lpegmatch, patterns = lpeg.P, lpeg.C, lpeg.S, lpeg.Cc, lpeg.match, lpeg.patterns +local newtoken = newtoken or token +local context = context + local texgetcount = tex.getcount local texsetcount = tex.setcount @@ -20,8 +23,6 @@ local allocate = utilities.storage.allocate local setmetatableindex = table.setmetatableindex local setmetatablecall = table.setmetatablecall -local context = context - tex.modes = allocate { } tex.systemmodes = allocate { } tex.constants = allocate { } @@ -32,204 +33,216 @@ tex.isdefined = allocate { } local modes = { } local systemmodes = { } --- if newtoken then -- we keep the old code for historic reasons +-- we could use the built-in tex.is[count|dimen|skip|toks] here but caching +-- at the lua en dis not that bad (and we need more anyway) - -- undefined: mode == 0 or cmdname = "undefined_cs" +-- undefined: mode == 0 or cmdname = "undefined_cs" - local create = newtoken.create +local create = newtoken.create - local cache = table.setmetatableindex(function(t,k) - local v = create(k) - t[k] = v - return v - end) +local cache = table.setmetatableindex(function(t,k) + local v = create(k) + t[k] = v + return v +end) - -- we can have a modes cache too +-- we can have a modes cache too - local iftrue = cache["iftrue"].mode - local undefined = cache["*undefined*crap*"].mode -- is this ok? +local iftrue = cache["iftrue"].mode +local undefined = cache["*undefined*crap*"].mode -- is this ok? - setmetatableindex(tex.modes, function(t,k) - local m = modes[k] - if m then - return m() +setmetatableindex(tex.modes, function(t,k) + local m = modes[k] + if m then + return m() + else + local n = "mode>" .. k + if cache[n].mode == 0 then + return false else - local n = "mode>" .. k - if cache[n].mode == 0 then - return false - else - modes[k] = function() return texgetcount(n) == 1 end - return texgetcount(n) == 1 -- 2 is prevented - end + modes[k] = function() return texgetcount(n) == 1 end + return texgetcount(n) == 1 -- 2 is prevented end - end) + end +end) - setmetatableindex(tex.systemmodes, function(t,k) - local m = systemmodes[k] - if m then - return m() +setmetatableindex(tex.systemmodes, function(t,k) + local m = systemmodes[k] + if m then + return m() + else + local n = "mode>*" .. k + if cache[n].mode == 0 then + return false else - local n = "mode>*" .. k - if cache[n].mode == 0 then - return false - else - systemmodes[k] = function() return texgetcount(n) == 1 end - return texgetcount(n) == 1 -- 2 is prevented - end + systemmodes[k] = function() return texgetcount(n) == 1 end + return texgetcount(n) == 1 -- 2 is prevented end - end) - - setmetatableindex(tex.constants, function(t,k) - return cache[k].mode ~= 0 and texgetcount(k) or 0 - end) - - setmetatableindex(tex.conditionals, function(t,k) -- 0 == true - return cache[k].mode ~= 0 and texgetcount(k) == 0 - end) - - table.setmetatableindex(tex.ifs, function(t,k) - -- local mode = cache[k].mode - -- if mode == 0 then - -- return nil - -- else - -- return mode == iftrue - -- end - return cache[k].mode == iftrue - end) - - setmetatableindex(tex.isdefined, function(t,k) - return k and cache[k].mode ~= 0 - end) - - setmetatablecall(tex.isdefined, function(t,k) - return k and cache[k].mode ~= 0 - end) - - local dimencode = cache["scratchdimen" ].command - local countcode = cache["scratchcounter"].command - local tokencode = cache["scratchtoken" ].command - local skipcode = cache["scratchskip" ].command - - local types = { - [dimencode] = "dimen", - [countcode] = "count", - [tokencode] = "token", - [skipcode ] = "skip", - } - - function tex.isdimen(name) - return cache[name].command == dimencode end +end) + +setmetatableindex(tex.constants, function(t,k) + return cache[k].mode ~= 0 and texgetcount(k) or 0 +end) + +setmetatableindex(tex.conditionals, function(t,k) -- 0 == true + return cache[k].mode ~= 0 and texgetcount(k) == 0 +end) + +table.setmetatableindex(tex.ifs, function(t,k) + -- local mode = cache[k].mode + -- if mode == 0 then + -- return nil + -- else + -- return mode == iftrue + -- end + return cache[k].mode == iftrue +end) + +setmetatableindex(tex.isdefined, function(t,k) + return k and cache[k].mode ~= 0 +end) + +setmetatablecall(tex.isdefined, function(t,k) + return k and cache[k].mode ~= 0 +end) + +local dimencode = cache["scratchdimen"] .command +local countcode = cache["scratchcounter"] .command +local tokencode = cache["scratchtoken"] .command +local skipcode = cache["scratchskip"] .command +local muskipcode = cache["scratchmuskip"] .command +---- attributecode = cache["scratchattribute"].command + +local types = { + [dimencode] = "dimen", + [countcode] = "count", + [tokencode] = "token", + [skipcode] = "skip", + [muskipcode] = "muskip", + -- [attributecode] = "attribute", +} - function tex.iscount(name) - return cache[name].command == countcode - end +function tex.isdimen(name) + local hit = cache[name] + return hit.command == dimencode and hit.index or true +end - function tex.istoken(name) - return cache[name].command == tokencode - end +function tex.iscount(name) + local hit = cache[name] + return hit.command == countcode and hit.index or true +end - function tex.isskip(name) - return cache[name].command == skipcode - end +function tex.istoken(name) + local hit = cache[name] + return hit.command == tokencode and hit.index or true +end - function tex.type(name) - return types[cache[name].command] or "macro" - end +function tex.isskip(name) + local hit = cache[name] + return hit.command == skipcode and hit.index or true +end --- else --- --- local csname_id = token.csname_id --- local create = token.create +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" +end + +-- -- old token code -- --- local undefined = csname_id("*undefined*crap*") --- local iftrue = create("iftrue")[2] -- inefficient hack +-- local csname_id = token.csname_id +-- local create = token.create -- --- setmetatableindex(tex.modes, function(t,k) --- local m = modes[k] --- if m then --- return m() --- else --- local n = "mode>" .. k --- if csname_id(n) == undefined then --- return false --- else --- modes[k] = function() return texgetcount(n) == 1 end --- return texgetcount(n) == 1 -- 2 is prevented --- end --- end --- end) +-- local undefined = csname_id("*undefined*crap*") +-- local iftrue = create("iftrue")[2] -- inefficient hack -- --- setmetatableindex(tex.systemmodes, function(t,k) --- local m = systemmodes[k] --- if m then --- return m() --- else --- local n = "mode>*" .. k --- if csname_id(n) == undefined then --- return false --- else --- systemmodes[k] = function() return texgetcount(n) == 1 end --- return texgetcount(n) == 1 -- 2 is prevented --- end --- end --- end) +-- setmetatableindex(tex.modes, function(t,k) +-- local m = modes[k] +-- if m then +-- return m() +-- else +-- local n = "mode>" .. k +-- if csname_id(n) == undefined then +-- return false +-- else +-- modes[k] = function() return texgetcount(n) == 1 end +-- return texgetcount(n) == 1 -- 2 is prevented +-- end +-- end +-- end) -- --- setmetatableindex(tex.constants, function(t,k) --- return csname_id(k) ~= undefined and texgetcount(k) or 0 --- end) +-- setmetatableindex(tex.systemmodes, function(t,k) +-- local m = systemmodes[k] +-- if m then +-- return m() +-- else +-- local n = "mode>*" .. k +-- if csname_id(n) == undefined then +-- return false +-- else +-- systemmodes[k] = function() return texgetcount(n) == 1 end +-- return texgetcount(n) == 1 -- 2 is prevented +-- end +-- end +-- end) -- --- setmetatableindex(tex.conditionals, function(t,k) -- 0 == true --- return csname_id(k) ~= undefined and texgetcount(k) == 0 --- end) +-- setmetatableindex(tex.constants, function(t,k) +-- return csname_id(k) ~= undefined and texgetcount(k) or 0 +-- end) -- --- setmetatableindex(tex.ifs, function(t,k) --- -- k = "if" .. k -- better not --- return csname_id(k) ~= undefined and create(k)[2] == iftrue -- inefficient, this create, we need a helper --- end) +-- setmetatableindex(tex.conditionals, function(t,k) -- 0 == true +-- return csname_id(k) ~= undefined and texgetcount(k) == 0 +-- end) -- --- setmetatableindex(tex.isdefined, function(t,k) --- return k and csname_id(k) ~= undefined --- end) --- setmetatablecall(tex.isdefined, function(t,k) --- return k and csname_id(k) ~= undefined --- end) +-- setmetatableindex(tex.ifs, function(t,k) +-- -- k = "if" .. k -- better not +-- return csname_id(k) ~= undefined and create(k)[2] == iftrue -- inefficient, this create, we need a helper +-- end) -- --- local lookuptoken = token.lookup +-- setmetatableindex(tex.isdefined, function(t,k) +-- return k and csname_id(k) ~= undefined +-- end) +-- setmetatablecall(tex.isdefined, function(t,k) +-- return k and csname_id(k) ~= undefined +-- end) -- --- local dimencode = lookuptoken("scratchdimen" )[1] --- local countcode = lookuptoken("scratchcounter")[1] --- local tokencode = lookuptoken("scratchtoken" )[1] --- local skipcode = lookuptoken("scratchskip" )[1] +-- local lookuptoken = token.lookup -- --- local types = { --- [dimencode] = "dimen", --- [countcode] = "count", --- [tokencode] = "token", --- [skipcode ] = "skip", --- } +-- local dimencode = lookuptoken("scratchdimen" )[1] +-- local countcode = lookuptoken("scratchcounter")[1] +-- local tokencode = lookuptoken("scratchtoken" )[1] +-- local skipcode = lookuptoken("scratchskip" )[1] -- --- function tex.isdimen(name) --- return lookuptoken(name)[1] == dimencode --- end +-- local types = { +-- [dimencode] = "dimen", +-- [countcode] = "count", +-- [tokencode] = "token", +-- [skipcode ] = "skip", +-- } -- --- function tex.iscount(name) --- return lookuptoken(name)[1] == countcode --- end +-- function tex.isdimen(name) +-- return lookuptoken(name)[1] == dimencode +-- end -- --- function tex.istoken(name) --- return lookuptoken(name)[1] == tokencode --- end +-- function tex.iscount(name) +-- return lookuptoken(name)[1] == countcode +-- end -- --- function tex.isskip(name) --- return lookuptoken(name)[1] == skipcode --- end +-- function tex.istoken(name) +-- return lookuptoken(name)[1] == tokencode +-- end -- --- function tex.type(name) --- return types[lookuptoken(name)[1]] or "macro" --- end +-- function tex.isskip(name) +-- return lookuptoken(name)[1] == skipcode +-- end -- --- end +-- function tex.type(name) +-- return types[lookuptoken(name)[1]] or "macro" +-- end function context.setconditional(name,value) if value then diff --git a/tex/context/base/core-sys.lua b/tex/context/base/core-sys.lua index cf74d68f4..f688a1454 100644 --- a/tex/context/base/core-sys.lua +++ b/tex/context/base/core-sys.lua @@ -71,8 +71,11 @@ implement { name = "outputfilename", actions = function() context(environme statistics.register("result saved in file", function() -- suffix will be fetched from backend local outputfilename = environment.outputfilename or environment.jobname or tex.jobname or "" - if tex.pdfoutput > 0 then - return format("%s.%s, compresslevel %s, objectcompresslevel %s",outputfilename,"pdf",tex.pdfcompresslevel, tex.pdfobjcompresslevel) + if (tex.pdfoutput or tex.outputmode) > 0 then + return format("%s.%s, compresslevel %s, objectcompresslevel %s",outputfilename,"pdf", + tex.pdfcompresslevel or pdf.getcompresslevel(), + tex.pdfobjcompresslevel or pdf.getobjcompresslevel() + ) else return format("%s.%s",outputfilename,"dvi") -- hard to imagine end diff --git a/tex/context/base/font-cff.lua b/tex/context/base/font-cff.lua index 4d5fe7bdc..0314e4ac4 100644 --- a/tex/context/base/font-cff.lua +++ b/tex/context/base/font-cff.lua @@ -1303,7 +1303,7 @@ do -- process(tab) -- - local boundingbox = { xmin, ymin, xmax, ymax } + local boundingbox = { round(xmin), round(ymin), round(xmax), round(ymax) } -- if width == true or width == false then width = defaultwidth diff --git a/tex/context/base/font-chk.lua b/tex/context/base/font-chk.lua index 41205ce5e..5b1ad9920 100644 --- a/tex/context/base/font-chk.lua +++ b/tex/context/base/font-chk.lua @@ -56,7 +56,9 @@ local tonode = nuts.tonode local getfont = nuts.getfont local getchar = nuts.getchar + local setfield = nuts.setfield +local setchar = nuts.setchar local traverse_id = nuts.traverse_id local remove_node = nuts.remove @@ -287,7 +289,7 @@ function checkers.missing(head) insert_node_after(head,node,tonut(char)) head = remove_node(head,node,true) elseif kind == "char" then - setfield(node,"char",char) + setchar(node,char) else -- error end diff --git a/tex/context/base/font-col.lua b/tex/context/base/font-col.lua index dfad5c821..adcf374e2 100644 --- a/tex/context/base/font-col.lua +++ b/tex/context/base/font-col.lua @@ -19,9 +19,13 @@ local fastcopy = table.fastcopy local nuts = nodes.nuts local tonut = nuts.tonut + local getfont = nuts.getfont local getchar = nuts.getchar + local setfield = nuts.setfield +local setchar = nuts.setchar + local traverse_id = nuts.traverse_id local settings_to_hash = utilities.parsers.settings_to_hash @@ -269,7 +273,7 @@ function collections.process(head) -- this way we keep feature processing ) end setfield(n,"font",newfont) - setfield(n,"char",newchar) + setchar(n,newchar) done = true else if trace_collecting then diff --git a/tex/context/base/font-con.lua b/tex/context/base/font-con.lua index 383a403c4..55d7793cf 100644 --- a/tex/context/base/font-con.lua +++ b/tex/context/base/font-con.lua @@ -170,8 +170,8 @@ constructors.setfactor() function constructors.scaled(scaledpoints, designsize) -- handles designsize in sp as well if scaledpoints < 0 then + local factor = constructors.factor if designsize then - local factor = constructors.factor if designsize > factor then -- or just 1000 / when? mp? return (- scaledpoints/1000) * designsize -- sp's else @@ -700,6 +700,7 @@ function constructors.scale(tfmdata,specification) end -- if hasmath then + -- -- todo, just operate on descriptions.math local vn = character.next if vn then @@ -736,6 +737,11 @@ function constructors.scale(tfmdata,specification) chr.horiz_variants = t end end + -- todo also check mathitalics (or that one can go away) + end + local vi = character.vert_italic + if vi and vi ~= 0 then + chr.vert_italic = vi*hdelta end local va = character.accent if va then diff --git a/tex/context/base/font-ctx.lua b/tex/context/base/font-ctx.lua index a20174ef3..05a4fca3b 100644 --- a/tex/context/base/font-ctx.lua +++ b/tex/context/base/font-ctx.lua @@ -1961,9 +1961,11 @@ dimenfactors.pct = nil to scale virtual characters.

--ldx]]-- +-- in versions > 0.82 0 is supported as equivalent of self + function constructors.checkvirtualids(tfmdata) -- begin of experiment: we can use { "slot", 0, number } in virtual fonts - local fonts = tfmdata.fonts + local fonts = tfmdata.fonts local selfid = font.nextid() if fonts and #fonts > 0 then for i=1,#fonts do @@ -2212,7 +2214,7 @@ do local copy_node = nuts.copy local kern = nuts.pool.register(nuts.pool.kern()) - setattr(kern,attributes.private('fontkern'),1) -- we can have several, attributes are shared + setattr(kern,attributes.private('fontkern'),1) nodes.injections.installnewkern(function(k) local c = copy_node(kern) diff --git a/tex/context/base/font-dsp.lua b/tex/context/base/font-dsp.lua index 148889020..22f822979 100644 --- a/tex/context/base/font-dsp.lua +++ b/tex/context/base/font-dsp.lua @@ -372,32 +372,36 @@ local function unchainedcontext(f,fontdata,lookupid,lookupoffset,offset,glyphs,n if subtype == 1 then local coverage = readushort(f) local subclasssets = readarray(f) - coverage = readcoverage(f,tableoffset+coverage,true) local rules = { } - for i=1,#subclasssets do - local offset = subclasssets[i] - if offset > 0 then - local firstcoverage = coverage[i] - local rulesoffset = tableoffset + offset - local subclassrules = readarray(f,rulesoffset) - for rule=1,#subclassrules do - setposition(f,rulesoffset + subclassrules[rule]) - local nofcurrent = readushort(f) - local noflookups = readushort(f) - local current = { { firstcoverage } } - for i=2,nofcurrent do - current[i] = { readushort(f) } - end - local lookups = { } - for i=1,noflookups do - lookups[readushort(f)+1] = readushort(f) + 1 + if subclassets then + coverage = readcoverage(f,tableoffset+coverage,true) + for i=1,#subclasssets do + local offset = subclasssets[i] + if offset > 0 then + local firstcoverage = coverage[i] + local rulesoffset = tableoffset + offset + local subclassrules = readarray(f,rulesoffset) + for rule=1,#subclassrules do + setposition(f,rulesoffset + subclassrules[rule]) + local nofcurrent = readushort(f) + local noflookups = readushort(f) + local current = { { firstcoverage } } + for i=2,nofcurrent do + current[i] = { readushort(f) } + end + local lookups = { } + for i=1,noflookups do + lookups[readushort(f)+1] = readushort(f) + 1 + end + rules[#rules+1] = { + current = current, + lookups = lookups + } end - rules[#rules+1] = { - current = current, - lookups = lookups - } end end + else + report("empty subclassset in %a subtype %i","unchainedcontext",subtype) end return { format = "glyphs", @@ -409,43 +413,47 @@ local function unchainedcontext(f,fontdata,lookupid,lookupoffset,offset,glyphs,n local coverage = readushort(f) local currentclassdef = readushort(f) local subclasssets = readarray(f) - coverage = readcoverage(f,tableoffset + coverage) - currentclassdef = readclassdef(f,tableoffset + currentclassdef) - local currentclasses = classtocoverage(currentclassdef,fontdata.glyphs) local rules = { } - for class=1,#subclasssets do - local offset = subclasssets[class] - if offset > 0 then - local firstcoverage = currentclasses[class] - if firstcoverage then - firstcoverage = covered(firstcoverage,coverage) -- bonus + if subclasssets then + coverage = readcoverage(f,tableoffset + coverage) + currentclassdef = readclassdef(f,tableoffset + currentclassdef) + local currentclasses = classtocoverage(currentclassdef,fontdata.glyphs) + for class=1,#subclasssets do + local offset = subclasssets[class] + if offset > 0 then + local firstcoverage = currentclasses[class] if firstcoverage then - local rulesoffset = tableoffset + offset - local subclassrules = readarray(f,rulesoffset) - for rule=1,#subclassrules do - setposition(f,rulesoffset + subclassrules[rule]) - local nofcurrent = readushort(f) - local noflookups = readushort(f) - local current = { firstcoverage } - for i=2,nofcurrent do - current[i] = currentclasses[readushort(f) + 1] - end - local lookups = { } - for i=1,noflookups do - lookups[readushort(f)+1] = readushort(f) + 1 + firstcoverage = covered(firstcoverage,coverage) -- bonus + if firstcoverage then + local rulesoffset = tableoffset + offset + local subclassrules = readarray(f,rulesoffset) + for rule=1,#subclassrules do + setposition(f,rulesoffset + subclassrules[rule]) + local nofcurrent = readushort(f) + local noflookups = readushort(f) + local current = { firstcoverage } + for i=2,nofcurrent do + current[i] = currentclasses[readushort(f) + 1] + end + local lookups = { } + for i=1,noflookups do + lookups[readushort(f)+1] = readushort(f) + 1 + end + rules[#rules+1] = { + current = current, + lookups = lookups + } end - rules[#rules+1] = { - current = current, - lookups = lookups - } + else + report("no coverage") end else - report("no coverage") + report("no coverage class") end - else - report("no coverage class") end end + else + report("empty subclassset in %a subtype %i","unchainedcontext",subtype) end return { format = "class", @@ -469,7 +477,7 @@ local function unchainedcontext(f,fontdata,lookupid,lookupoffset,offset,glyphs,n } } else - report("unsupported subtype %a in %a %s",subtype,"chainedcontext",what) + report("unsupported subtype %a in %a %s",subtype,"unchainedcontext",what) end end @@ -484,50 +492,54 @@ local function chainedcontext(f,fontdata,lookupid,lookupoffset,offset,glyphs,nof if subtype == 1 then local coverage = readushort(f) local subclasssets = readarray(f) - coverage = readcoverage(f,tableoffset+coverage,true) local rules = { } - for i=1,#subclasssets do - local offset = subclasssets[i] - if offset > 0 then - local firstcoverage = coverage[i] - local rulesoffset = tableoffset + offset - local subclassrules = readarray(f,rulesoffset) - for rule=1,#subclassrules do - setposition(f,rulesoffset + subclassrules[rule]) - local nofbefore = readushort(f) - local before - if nofbefore > 0 then - before = { } - for i=1,nofbefore do - before[i] = { readushort(f) } + if subclasssets then + coverage = readcoverage(f,tableoffset+coverage,true) + for i=1,#subclasssets do + local offset = subclasssets[i] + if offset > 0 then + local firstcoverage = coverage[i] + local rulesoffset = tableoffset + offset + local subclassrules = readarray(f,rulesoffset) + for rule=1,#subclassrules do + setposition(f,rulesoffset + subclassrules[rule]) + local nofbefore = readushort(f) + local before + if nofbefore > 0 then + before = { } + for i=1,nofbefore do + before[i] = { readushort(f) } + end end - end - local nofcurrent = readushort(f) - local current = { { firstcoverage } } - for i=2,nofcurrent do - current[i] = { readushort(f) } - end - local nofafter = readushort(f) - local after - if nofafter > 0 then - after = { } - for i=1,nofafter do - after[i] = { readushort(f) } + local nofcurrent = readushort(f) + local current = { { firstcoverage } } + for i=2,nofcurrent do + current[i] = { readushort(f) } end + local nofafter = readushort(f) + local after + if nofafter > 0 then + after = { } + for i=1,nofafter do + after[i] = { readushort(f) } + end + end + local noflookups = readushort(f) + local lookups = { } + for i=1,noflookups do + lookups[readushort(f)+1] = readushort(f) + 1 + end + rules[#rules+1] = { + before = before, + current = current, + after = after, + lookups = lookups, + } end - local noflookups = readushort(f) - local lookups = { } - for i=1,noflookups do - lookups[readushort(f)+1] = readushort(f) + 1 - end - rules[#rules+1] = { - before = before, - current = current, - after = after, - lookups = lookups, - } end end + else + report("empty subclassset in %a subtype %i","chainedcontext",subtype) end return { format = "glyphs", @@ -539,68 +551,72 @@ local function chainedcontext(f,fontdata,lookupid,lookupoffset,offset,glyphs,nof local currentclassdef = readushort(f) local afterclassdef = readushort(f) local subclasssets = readarray(f) - local coverage = readcoverage(f,tableoffset + coverage) - local beforeclassdef = readclassdef(f,tableoffset + beforeclassdef) - local currentclassdef = readclassdef(f,tableoffset + currentclassdef) - local afterclassdef = readclassdef(f,tableoffset + afterclassdef) - local beforeclasses = classtocoverage(beforeclassdef,fontdata.glyphs) - local currentclasses = classtocoverage(currentclassdef,fontdata.glyphs) - local afterclasses = classtocoverage(afterclassdef,fontdata.glyphs) local rules = { } - for class=1,#subclasssets do - local offset = subclasssets[class] - if offset > 0 then - local firstcoverage = currentclasses[class] - if firstcoverage then - firstcoverage = covered(firstcoverage,coverage) -- bonus + if subclasssets then + local coverage = readcoverage(f,tableoffset + coverage) + local beforeclassdef = readclassdef(f,tableoffset + beforeclassdef) + local currentclassdef = readclassdef(f,tableoffset + currentclassdef) + local afterclassdef = readclassdef(f,tableoffset + afterclassdef) + local beforeclasses = classtocoverage(beforeclassdef,fontdata.glyphs) + local currentclasses = classtocoverage(currentclassdef,fontdata.glyphs) + local afterclasses = classtocoverage(afterclassdef,fontdata.glyphs) + for class=1,#subclasssets do + local offset = subclasssets[class] + if offset > 0 then + local firstcoverage = currentclasses[class] if firstcoverage then - local rulesoffset = tableoffset + offset - local subclassrules = readarray(f,rulesoffset) - for rule=1,#subclassrules do - -- watch out, in context we first get the counts and then the arrays while - -- here we get them mixed - setposition(f,rulesoffset + subclassrules[rule]) - local nofbefore = readushort(f) - local before - if nofbefore > 0 then - before = { } - for i=1,nofbefore do - before[i] = beforeclasses[readushort(f) + 1] + firstcoverage = covered(firstcoverage,coverage) -- bonus + if firstcoverage then + local rulesoffset = tableoffset + offset + local subclassrules = readarray(f,rulesoffset) + for rule=1,#subclassrules do + -- watch out, in context we first get the counts and then the arrays while + -- here we get them mixed + setposition(f,rulesoffset + subclassrules[rule]) + local nofbefore = readushort(f) + local before + if nofbefore > 0 then + before = { } + for i=1,nofbefore do + before[i] = beforeclasses[readushort(f) + 1] + end end - end - local nofcurrent = readushort(f) - local current = { firstcoverage } - for i=2,nofcurrent do - current[i] = currentclasses[readushort(f)+ 1] - end - local nofafter = readushort(f) - local after - if nofafter > 0 then - after = { } - for i=1,nofafter do - after[i] = afterclasses[readushort(f) + 1] + local nofcurrent = readushort(f) + local current = { firstcoverage } + for i=2,nofcurrent do + current[i] = currentclasses[readushort(f)+ 1] end + local nofafter = readushort(f) + local after + if nofafter > 0 then + after = { } + for i=1,nofafter do + after[i] = afterclasses[readushort(f) + 1] + end + end + -- no sequence index here (so why in context as it saves nothing) + local noflookups = readushort(f) + local lookups = { } + for i=1,noflookups do + lookups[readushort(f)+1] = readushort(f) + 1 + end + rules[#rules+1] = { + before = before, + current = current, + after = after, + lookups = lookups, + } end - -- no sequence index here (so why in context as it saves nothing) - local noflookups = readushort(f) - local lookups = { } - for i=1,noflookups do - lookups[readushort(f)+1] = readushort(f) + 1 - end - rules[#rules+1] = { - before = before, - current = current, - after = after, - lookups = lookups, - } + else + report("no coverage") end else - report("no coverage") + report("class is not covered") end - else - report("class is not covered") end end + else + report("empty subclassset in %a subtype %i","chainedcontext",subtype) end return { format = "class", @@ -967,7 +983,7 @@ function gposhandlers.pair(f,fontdata,lookupid,lookupoffset,offset,glyphs,nofgly local nofclasses1 = readushort(f) -- incl class 0 local nofclasses2 = readushort(f) -- incl class 0 local classlist = readpairclasssets(f,nofclasses1,nofclasses2,format1,format2) - coverage = readcoverage(f,tableoffset+coverage,true) + coverage = readcoverage(f,tableoffset+coverage) classdef1 = readclassdef(f,tableoffset+classdef1) classdef2 = readclassdef(f,tableoffset+classdef2) local usedcoverage = { } @@ -1052,7 +1068,7 @@ local function handlemark(f,fontdata,lookupid,lookupoffset,offset,glyphs,nofglyp local baseoffset = tableoffset + readushort(f) -- local markcoverage = readcoverage(f,markcoverage) - local basecoverage = readcoverage(f,basecoverage,true) + local basecoverage = readcoverage(f,basecoverage,true) -- TO BE CHECKED: true -- setposition(f,markoffset) local markclasses = { } diff --git a/tex/context/base/font-fbk.lua b/tex/context/base/font-fbk.lua index 22644f046..56f002558 100644 --- a/tex/context/base/font-fbk.lua +++ b/tex/context/base/font-fbk.lua @@ -89,21 +89,22 @@ local function composecharacters(tfmdata) end end local charsacc = characters[acc] - --~ local ca = charsacc.category - --~ if ca == "mn" then - --~ -- mark nonspacing - --~ elseif ca == "ms" then - --~ -- mark spacing combining - --~ elseif ca == "me" then - --~ -- mark enclosing - --~ else + -- local ca = charsacc.category + -- if ca == "mn" then + -- -- mark nonspacing + -- elseif ca == "ms" then + -- -- mark spacing combining + -- elseif ca == "me" then + -- -- mark enclosing + -- else if not charsacc then -- fallback accents acc = unicodefallbacks[acc] charsacc = acc and characters[acc] end local chr_t = cache[chr] if not chr_t then - chr_t = {"slot", 1, chr} + chr_t = { "slot", 1, chr } + -- will be: chr_t = { "slot", 0, chr } cache[chr] = chr_t end if charsacc then @@ -112,7 +113,8 @@ local function composecharacters(tfmdata) end local acc_t = cache[acc] if not acc_t then - acc_t = {"slot", 1, acc} + acc_t = { "slot", 1, acc } + -- will be: acc_t = { "slot", 0, acc } cache[acc] = acc_t end local cb = descriptions[chr].boundingbox @@ -224,7 +226,7 @@ local function composecharacters(tfmdata) end else if trace_combining_define then - report_combining("%C becomes simplfied %C",i,chr) + report_combining("%C becomes simplified %C",i,chr) end t.commands = { chr_t } -- else index mess end diff --git a/tex/context/base/font-hsh.lua b/tex/context/base/font-hsh.lua index 46d82d78f..efd042fe1 100644 --- a/tex/context/base/font-hsh.lua +++ b/tex/context/base/font-hsh.lua @@ -96,6 +96,26 @@ setmetatableindex(identifiers, function(t,k) return k == true and identifiers[currentfont()] or nulldata end) +do + + -- to be used + + local define = font.define + local setfont = font.setfont + local frozen = font.frozen + + function fonts.reserveid(fontdata) + return define(fontdata or nulldata) + end + + function fonts.enhanceid(id,fontdata) + if not frozen(id) then + setfont(id,fontdata) + end + end + +end + setmetatableindex(characters, function(t,k) if k == true then return characters[currentfont()] @@ -325,3 +345,5 @@ end) function font.getfont(id) return identifiers[id] end + +font.setfont = currentfont -- bah, no native 'setfont' as name diff --git a/tex/context/base/font-lib.mkvi b/tex/context/base/font-lib.mkvi index 46de6ee44..848fa872f 100644 --- a/tex/context/base/font-lib.mkvi +++ b/tex/context/base/font-lib.mkvi @@ -65,18 +65,10 @@ \registerctxluafile{font-otl}{1.001} % otf replacement \registerctxluafile{font-oto}{1.001} % otb replacement -\doifelsefile{font-otj-new.lua} { - \registerctxluafile{font-otj-new}{1.001} % inj replacement -} { \registerctxluafile{font-otj}{1.001} % inj replacement -} \registerctxluafile{font-oup}{1.001} % otp replacement \registerctxluafile{font-ota}{1.001} -\doifelsefile{font-ots-new.lua} { - \registerctxluafile{font-ots-new}{1.001} % otn replacement -} { \registerctxluafile{font-ots}{1.001} % otn replacement -} \registerctxluafile{font-otd}{1.001} \registerctxluafile{font-otc}{1.001} \registerctxluafile{font-oth}{1.001} diff --git a/tex/context/base/font-nod.lua b/tex/context/base/font-nod.lua index 240ea7057..cb89901cd 100644 --- a/tex/context/base/font-nod.lua +++ b/tex/context/base/font-nod.lua @@ -42,7 +42,6 @@ local step_tracers = tracers.steppers or { } tracers.steppers = step_tracers local nodecodes = nodes.nodecodes -local whatcodes = nodes.whatcodes local glyph_code = nodecodes.glyph local hlist_code = nodecodes.hlist @@ -51,16 +50,14 @@ local disc_code = nodecodes.disc local glue_code = nodecodes.glue local kern_code = nodecodes.kern local rule_code = nodecodes.rule -local dir_code = nodecodes.dir or whatcodes.dir -local localpar_code = nodecodes.localpar or whatcodes.localpar -local whatsit_code = nodecodes.whatsit +local dir_code = nodecodes.dir +local localpar_code = nodecodes.localpar local nuts = nodes.nuts local tonut = nuts.tonut local tonode = nuts.tonode local getfield = nuts.getfield -local setfield = nuts.setfield local getnext = nuts.getnext local getprev = nuts.getprev local getid = nuts.getid @@ -68,7 +65,11 @@ local getfont = nuts.getfont local getsubtype = nuts.getsubtype local getchar = nuts.getchar local getlist = nuts.getlist +local getdisc = nuts.getdisc + +local setfield = nuts.setfield local setbox = nuts.setbox +local setchar = nuts.setchar local copy_node_list = nuts.copy_list local hpack_node_list = nuts.hpack @@ -134,19 +135,17 @@ function char_tracers.collect(head,list,tag,n) l[#l+1] = { c, f } elseif id == disc_code then -- skip --- local replace = getfield(head,"replace") +-- local pre, post, replace = getdisc(head) -- if replace then -- for n in traverse_id(glyph_code,replace) do -- l[#l+1] = { c, f } -- end -- end --- local pre = getfield(head,"pre") -- if pre then -- for n in traverse_id(glyph_code,pre) do -- l[#l+1] = { c, f } -- end -- end --- local post = getfield(head,"post") -- if post then -- for n in traverse_id(glyph_code,post) do -- l[#l+1] = { c, f } @@ -327,7 +326,7 @@ end function tracers.fontchar(font,char) local n = new_glyph() setfield(n,"font",font) - setfield(n,"char",char) + setchar(n,"char",char) setfield(n,"subtype",256) context(tonode(n)) end @@ -395,12 +394,8 @@ function step_tracers.codes(i,command,space) showchar(c) elseif id == dir_code or id == localpar_code then context("[%s]",getfield(c,"dir")) - elseif id == whatsit_code and (getsubtype(c) == localpar_code or getsubtype(c) == dir_code) then - context("[%s]",getfield(c,"dir")) elseif id == disc_code then - local pre = getfield(c,"pre") - local post = getfield(c,"post") - local replace = getfield(c,"replace") + local pre, post, replace = getdisc(c) if pre or post or replace then context("[") context[space]() diff --git a/tex/context/base/font-osd.lua b/tex/context/base/font-osd.lua index cf2835554..23579ea48 100644 --- a/tex/context/base/font-osd.lua +++ b/tex/context/base/font-osd.lua @@ -120,8 +120,10 @@ local getid = nuts.getid local getchar = nuts.getchar local getfont = nuts.getfont local getsubtype = nuts.getsubtype -local getfield = nuts.getfield -local setfield = nuts.setfield +local setlink = nuts.setlink +local setnext = nuts.setnext +local setprev = nuts.setprev +local setchar = nuts.setchar local getprop = nuts.getprop local setprop = nuts.setprop @@ -840,8 +842,7 @@ local function deva_reorder(head,start,stop,font,attr,nbspaces) copyinjection(tempcurrent,next) local nextcurrent = copy_node(current) copyinjection(nextcurrent,current) -- KE: necessary? HH: probably not as positioning comes later and we rawget/set - setfield(tempcurrent,"next",nextcurrent) - setfield(nextcurrent,"prev",tempcurrent) + setlink(tempcurrent,nextcurrent) setprop(tempcurrent,a_state,s_blwf) tempcurrent = processcharacters(tempcurrent,font) setprop(tempcurrent,a_state,unsetvalue) @@ -849,15 +850,12 @@ local function deva_reorder(head,start,stop,font,attr,nbspaces) flush_list(tempcurrent) local n = copy_node(current) copyinjection(n,current) -- KE: necessary? HH: probably not as positioning comes later and we rawget/set - setfield(current,"char",dotted_circle) + setchar(current,dotted_circle) head = insert_node_after(head, current, n) else - setfield(current,"char",getchar(tempcurrent)) -- we assumes that the result of blwf consists of one node + setchar(current,getchar(tempcurrent)) -- we assumes that the result of blwf consists of one node local freenode = getnext(current) - setfield(current,"next",tmp) - if tmp then - setfield(tmp,"prev",current) - end + setlink(current,tmp) free_node(freenode) flush_list(tempcurrent) if changestop then @@ -910,14 +908,13 @@ local function deva_reorder(head,start,stop,font,attr,nbspaces) -- local np = getprev(n) local nn = getnext(n) local ln = getnext(lastcons) -- what if lastcons is nn ? - setfield(np,"next",nn) - setfield(nn,"prev",np) - setfield(lastcons,"next",n) + setlink(np,nn) + setnext(lastcons,n) if ln then - setfield(ln,"prev",n) + setprev(ln,n) end - setfield(n,"next",ln) - setfield(n,"prev",lastcons) + setnext(n,ln) + setprev(n,lastcons) if lastcons == stop then stop = n end @@ -940,16 +937,10 @@ local function deva_reorder(head,start,stop,font,attr,nbspaces) local sp = getprev(start) local nn = getnext(n) local mn = getnext(matra) - if sp then - setfield(sp,"next",nn) - end - setfield(nn,"prev",sp) - setfield(matra,"next",start) - setfield(start,"prev",matra) - setfield(n,"next",mn) - if mn then - setfield(mn,"prev",n) - end + setlink(sp,nn) + setprev(nn,sp) + setlink(matra,start) + setlink(n,mn) if head == start then head = nn end @@ -1023,20 +1014,19 @@ local function deva_reorder(head,start,stop,font,attr,nbspaces) -- move pre-base matras... if pre_mark[getchar(cn)] then if bp then - setfield(bp,"next",cn) + setnext(bp,cn) end local next = getnext(cn) local prev = getprev(cn) if next then - setfield(next,"prev",prev) + setprev(next,prev) end - setfield(prev,"next",next) + setnext(prev,next) if cn == stop then stop = prev end - setfield(cn,"prev",bp) - setfield(cn,"next",firstcons) - setfield(firstcons,"prev",cn) + setprev(cn,bp) + setlink(cn,firstcons) if firstcons == start then if head == start then head = cn @@ -1081,36 +1071,18 @@ local function deva_reorder(head,start,stop,font,attr,nbspaces) stop = c end local prev = getprev(current) - if prev then - setfield(prev,"next",n) - end - if n then - setfield(n,"prev",prev) - end + setlink(prev,n) local next = getnext(b) - setfield(c,"next",next) - if next then - setfield(next,"prev",c) - end - setfield(c,"next",next) - setfield(b,"next",current) - setfield(current,"prev",b) + setlink(c,next) + setnext(c,next) + setlink(b,current) 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) local cp, cnsn = getprev(current), getnext(cns) - if cp then - setfield(cp,"next",n) - end - if n then - setfield(n,"prev",cp) - end - setfield(cns,"next",current) - setfield(current,"prev",cns) - setfield(c,"next",cnsn) - if cnsn then - setfield(cnsn,"prev",c) - end + setlink(cp,n) + setlink(cns,current) + setlink(c,cnsn) if c == stop then stop = cp break @@ -1170,12 +1142,8 @@ function handlers.devanagari_reorder_matras(head,start) -- no leak local startnext = getnext(start) head = remove_node(head,start) local next = getnext(current) - if next then - setfield(next,"prev",start) - end - setfield(start,"next",next) - setfield(current,"next",start) - setfield(start,"prev",current) + setlink(start,next) + setlink(current,start) start = startnext break end @@ -1225,12 +1193,8 @@ function handlers.devanagari_reorder_reph(head,start) startnext = getnext(start) head = remove_node(head,start) local next = getnext(current) - if next then - setfield(next,"prev",start) - end - setfield(start,"next",next) - setfield(current,"next",start) - setfield(start,"prev",current) + setlink(start,next) + setlink(current,start) start = startnext startattr = getprop(start,a_syllabe) break @@ -1244,10 +1208,8 @@ function handlers.devanagari_reorder_reph(head,start) startnext = getnext(start) head = remove_node(head,start) local prev = getprev(current) - setfield(start,"prev",prev) - setfield(prev,"next",start) - setfield(start,"next",current) - setfield(current,"prev",start) + setlink(prev,start) + setlink(start,"next",current) start = startnext startattr = getprop(start,a_syllabe) break @@ -1276,10 +1238,8 @@ function handlers.devanagari_reorder_reph(head,start) startnext = getnext(start) head = remove_node(head,start) local prev = getprev(c) - setfield(start,"prev",prev) - setfield(prev,"next",start) - setfield(start,"next",c) - setfield(c,"prev",start) + setlink(prev,start) + setlink(start,c) -- end start = startnext startattr = getprop(start,a_syllabe) @@ -1297,12 +1257,8 @@ function handlers.devanagari_reorder_reph(head,start) startnext = getnext(start) head = remove_node(head,start) local next = getnext(current) - if next then - setfield(next,"prev",start) - end - setfield(start,"next",next) - setfield(current,"next",start) - setfield(start,"prev",current) + setlink(start,next) + setlink(current,"next",start) start = startnext end end @@ -1340,12 +1296,8 @@ function handlers.devanagari_reorder_pre_base_reordering_consonants(head,start) startnext = getnext(start) removenode(start,start) local next = getnext(current) - if next then - setfield(next,"prev",start) - end - setfield(start,"next",next) - setfield(current,"next",start) - setfield(start,"prev",current) + setlink(start,next) + setlink(current,start) start = startnext break end @@ -1359,10 +1311,8 @@ function handlers.devanagari_reorder_pre_base_reordering_consonants(head,start) startnext = getnext(start) removenode(start,start) local prev = getprev(current) - setfield(start,"prev",prev) - setfield(prev,"next",start) - setfield(start,"next",current) - setfield(current,"prev",start) + setlink(prev,"next",start) + setlink(start,"next",current) start = startnext break end @@ -1383,14 +1333,11 @@ function handlers.devanagari_remove_joiners(head,start) break end end - if stop then - setfield(getfield(stop,"prev"),"next",nil) - setfield(stop,"prev",getprev(start)) - end local prev = getprev(start) - if prev then - setfield(prev,"next",stop) + if stop then + setnext(getprev(stop)) end + setlink(prev,stop) if head == start then head = stop end @@ -1596,7 +1543,7 @@ local function dev2_reorder(head,start,stop,font,attr,nbspaces) -- maybe do a pa next = getnext(current) local tmp = getnext(next) local changestop = next == stop - setfield(next,"next",nil) + setnext(next,nil) setprop(current,a_state,s_pref) current = processcharacters(current,font) setprop(current,a_state,s_blwf) @@ -1605,13 +1552,13 @@ local function dev2_reorder(head,start,stop,font,attr,nbspaces) -- maybe do a pa current = processcharacters(current,font) setprop(current,a_state,unsetvalue) if halant[getchar(current)] then - setfield(getnext(current),"next",tmp) + setnext(getnext(current),tmp) local nc = copy_node(current) copyinjection(nc,current) - setfield(current,"char",dotted_circle) + setchar(current,dotted_circle) head = insert_node_after(head,current,nc) else - setfield(current,"next",tmp) -- assumes that result of pref, blwf, or pstf consists of one node + setnext(current,tmp) -- assumes that result of pref, blwf, or pstf consists of one node if changestop then stop = current end @@ -1677,8 +1624,8 @@ local function dev2_reorder(head,start,stop,font,attr,nbspaces) -- maybe do a pa local extra = copy_node(current) copyinjection(extra,current) char = tpm[1] - setfield(current,"char",char) - setfield(extra,"char",tpm[2]) + setchar(current,"char",char) + setchar(extra,"char",tpm[2]) head = insert_node_after(head,current,extra) end -- @@ -1687,12 +1634,7 @@ local function dev2_reorder(head,start,stop,font,attr,nbspaces) -- maybe do a pa moved[current] = true local prev = getprev(current) local next = getnext(current) - if prev then - setfield(prev,"next",next) - end - if next then - setfield(next,"prev",prev) - end + setlink(prev,next) if current == stop then stop = getprev(current) end @@ -1703,12 +1645,8 @@ local function dev2_reorder(head,start,stop,font,attr,nbspaces) -- maybe do a pa start = current end local prev = getprev(halfpos) - if prev then - setfield(prev,"next",current) - end - setfield(current,"prev",prev) - setfield(halfpos,"prev",current) - setfield(current,"next",halfpos) + setlink(prev,current) + setlink(current,halfpos) halfpos = current elseif above_mark[char] then -- After main consonant target = basepos @@ -1733,22 +1671,13 @@ local function dev2_reorder(head,start,stop,font,attr,nbspaces) -- maybe do a pa local prev = getprev(current) if prev ~= target then local next = getnext(current) - if prev then -- not needed, already tested with target - setfield(prev,"next",next) - end - if next then - setfield(next,"prev",prev) - end + setlink(next,prev) if current == stop then stop = prev end local next = getnext(target) - if next then - setfield(next,"prev",current) - end - setfield(current,"next",next) - setfield(target,"next",current) - setfield(current,"prev",target) + setlink(current,next) + setlink(target,current) end end end @@ -1776,18 +1705,14 @@ local function dev2_reorder(head,start,stop,font,attr,nbspaces) -- maybe do a pa stop = current end local prev = getprev(c) - if prev then - setfield(prev,"next",next) - end - setfield(next,"prev",prev) + setlink(next,prev) local nextnext = getnext(next) - setfield(current,"next",nextnext) + setnext(current,nextnext) local nextnextnext = getnext(nextnext) if nextnextnext then - setfield(nextnextnext,"prev",current) + setprev(nextnextnext,current) end - setfield(c,"prev",nextnext) - setfield(nextnext,"next",c) + setlink(nextnext,c) end if stop == current then break end current = getnext(current) @@ -2112,9 +2037,9 @@ local function inject_syntax_error(head,current,mark) local signal = copy_node(current) copyinjection(signal,current) if mark == pre_mark then -- THIS IS WRONG: pre_mark is a table - setfield(signal,"char",dotted_circle) + setchar(signal,dotted_circle) else - setfield(current,"char",dotted_circle) + setchar(current,dotted_circle) end return insert_node_after(head,current,signal) end diff --git a/tex/context/base/font-otf.lua b/tex/context/base/font-otf.lua index 0ca1e98ba..f709e7000 100644 --- a/tex/context/base/font-otf.lua +++ b/tex/context/base/font-otf.lua @@ -1999,9 +1999,10 @@ actions["merge kern classes"] = function(data,filename,raw) local kernclass = subtable.kernclass -- name is inconsistent with anchor_classes local lookup = subtable.lookup or subtable.name if kernclass then -- the next one is quite slow + -- as fas as i can see the kernclass is a table with one entry and offsets + -- have no [1] so we could remov eon elevel (kernclass) and start offsets + -- at 1 but we're too far down the road now to fix that if #kernclass > 0 then - -- it's a table with one entry .. a future luatex can just - -- omit that level kernclass = kernclass[1] lookup = type(kernclass.lookup) == "string" and kernclass.lookup or lookup report_otf("fixing kernclass table of lookup %a",lookup) @@ -2028,15 +2029,17 @@ actions["merge kern classes"] = function(data,filename,raw) if splt then local extrakerns = { } local baseoffset = (fk-1) * maxseconds - for sk=2,maxseconds do -- will become 1 based in future luatex - local sv = seconds[sk] -- for sk, sv in next, seconds do - local splt = split[sv] - if splt then -- redundant test - local offset = offsets[baseoffset + sk] - if offset then - for i=1,#splt do - extrakerns[splt[i]] = offset + for sk=2,maxseconds do + local sv = seconds[sk] + if sv then + local splt = split[sv] + if splt then -- redundant test + local offset = offsets[baseoffset + sk] + if offset then + for i=1,#splt do + extrakerns[splt[i]] = offset + end end end end @@ -2583,6 +2586,7 @@ local function copytotfm(data,cache_id) -- watch out: luatex uses horiz_variants for the parts -- local italic = m.italic + local vitalic = m.vitalic -- local variants = m.hvariants local parts = m.hparts @@ -2623,12 +2627,14 @@ local function copytotfm(data,cache_id) c.vert_variants = parts elseif parts then character.vert_variants = parts - italic = m.vitalic end -- if italic and italic ~= 0 then character.italic = italic -- overload end + if vitalic and vitalic ~= 0 then + character.vert_italic = vitalic + end -- local accent = m.accent if accent then diff --git a/tex/context/base/font-otj.lua b/tex/context/base/font-otj.lua index a8069b2dc..a942296c9 100644 --- a/tex/context/base/font-otj.lua +++ b/tex/context/base/font-otj.lua @@ -59,6 +59,9 @@ local getfont = nuts.getfont local getsubtype = nuts.getsubtype local getchar = nuts.getchar +local getdisc = nuts.getdisc +local setdisc = nuts.setdisc + local traverse_id = nuts.traverse_id local insert_node_before = nuts.insert_before local insert_node_after = nuts.insert_after @@ -414,9 +417,7 @@ local function trace(head,where) show(n,"replaceinjections",false,"=") show(n,"emptyinjections",false,"*") elseif id == disc_code then - local pre = getfield(n,"pre") - local post = getfield(n,"post") - local replace = getfield(n,"replace") + local pre, post, replace = getdisc(n) if pre then showsub(pre,"preinjections","pre") end @@ -490,8 +491,7 @@ local function inject_kerns_only(head,where) end end if prevdisc then - local postdone = false - local replacedone = false + local done = false if post then local i = rawget(p,"postinjections") if i then @@ -499,7 +499,7 @@ local function inject_kerns_only(head,where) if leftkern and leftkern ~= 0 then local posttail = find_tail(post) insert_node_after(post,posttail,newkern(leftkern)) - postdone = true + done = true end end end @@ -510,7 +510,7 @@ local function inject_kerns_only(head,where) if leftkern and leftkern ~= 0 then local replacetail = find_tail(replace) insert_node_after(replace,replacetail,newkern(leftkern)) - replacedone = true + done = true end end else @@ -524,11 +524,8 @@ local function inject_kerns_only(head,where) -- end -- end end - if postdone then - setfield(prevdisc,"post",post) - end - if replacedone then - setfield(prevdisc,"replace",replace) + if done then + setdisc(prevdisc,pre,post,replace) end end end @@ -536,12 +533,8 @@ local function inject_kerns_only(head,where) prevdisc = nil prevglyph = current elseif id == disc_code then - pre = getfield(current,"pre") - post = getfield(current,"post") - replace = getfield(current,"replace") - local predone = false - local postdone = false - local replacedone = false + pre, post, replace = getdisc(current) + local done = false if pre then -- left|pre glyphs|right for n in traverse_id(glyph_code,pre) do @@ -552,8 +545,8 @@ local function inject_kerns_only(head,where) if i then local leftkern = i.leftkern if leftkern and leftkern ~= 0 then - pre = insert_node_before(pre,n,newkern(leftkern)) - predone = true + pre = insert_node_before(pre,n,newkern(leftkern)) + done = true end end end @@ -570,8 +563,8 @@ local function inject_kerns_only(head,where) if i then local leftkern = i.leftkern if leftkern and leftkern ~= 0 then - post = insert_node_before(post,n,newkern(leftkern)) - postdone = true + post = insert_node_before(post,n,newkern(leftkern)) + done = true end end end @@ -588,22 +581,16 @@ local function inject_kerns_only(head,where) if i then local leftkern = i.leftkern if leftkern and leftkern ~= 0 then - replace = insert_node_before(replace,n,newkern(leftkern)) - replacedone = true + replace = insert_node_before(replace,n,newkern(leftkern)) + done = true end end end end end end - if predone then - setfield(current,"pre",pre) - end - if postdone then - setfield(current,"post",post) - end - if replacedone then - setfield(current,"replace",replace) + if done then + setdisc(current,pre,post,replace) end prevglyph = nil prevdisc = current @@ -659,13 +646,13 @@ local function inject_pairs_only(head,where) insert_node_after(head,current,newkern(rightkern)) end else - local i = rawget(p,"replaceinjections") + local i = rawget(p,"emptyinjections") if i then -- glyph|disc|glyph (special case) local rightkern = i.rightkern if rightkern and rightkern ~= 0 then if next and getid(next) == disc_code then - local replace = getfield(pr,"replace") + local replace = getfield(next,"replace") if replace then -- error, we expect an empty one else @@ -676,8 +663,7 @@ local function inject_pairs_only(head,where) end end if prevdisc and p then - local postdone = false - local replacedone = false + local done = false if post then local i = rawget(p,"postinjections") if i then @@ -685,7 +671,7 @@ local function inject_pairs_only(head,where) if leftkern and leftkern ~= 0 then local posttail = find_tail(post) insert_node_after(post,posttail,newkern(leftkern)) - postdone = true + done = true end end end @@ -696,15 +682,12 @@ local function inject_pairs_only(head,where) if leftkern and leftkern ~= 0 then local replacetail = find_tail(replace) insert_node_after(replace,replacetail,newkern(leftkern)) - replacedone = true + done = true end end end - if postdone then - setfield(prevdisc,"post",post) - end - if replacedone then - setfield(prevdisc,"replace",replace) + if done then + setdisc(prevdisc,pre,post,replace) end end end @@ -712,12 +695,8 @@ local function inject_pairs_only(head,where) prevdisc = nil prevglyph = current elseif id == disc_code then - pre = getfield(current,"pre") - post = getfield(current,"post") - replace = getfield(current,"replace") - local predone = false - local postdone = false - local replacedone = false + pre, post, replace = getdisc(current) + local done = false if pre then -- left|pre glyphs|right for n in traverse_id(glyph_code,pre) do @@ -732,13 +711,13 @@ local function inject_pairs_only(head,where) end local leftkern = i.leftkern if leftkern and leftkern ~= 0 then - pre = insert_node_before(pre,n,newkern(leftkern)) - predone = true + pre = insert_node_before(pre,n,newkern(leftkern)) + done = true end local rightkern = i.rightkern if rightkern and rightkern ~= 0 then insert_node_after(pre,n,newkern(rightkern)) - predone = true + done = true end end end @@ -760,12 +739,12 @@ local function inject_pairs_only(head,where) local leftkern = i.leftkern if leftkern and leftkern ~= 0 then post = insert_node_before(post,n,newkern(leftkern)) - postdone = true + done = true end local rightkern = i.rightkern if rightkern and rightkern ~= 0 then insert_node_after(post,n,newkern(rightkern)) - postdone = true + done = true end end end @@ -786,13 +765,13 @@ local function inject_pairs_only(head,where) end local leftkern = i.leftkern if leftkern and leftkern ~= 0 then - replace = insert_node_before(replace,n,newkern(leftkern)) - replacedone = true + replace = insert_node_before(replace,n,newkern(leftkern)) + done = true end local rightkern = i.rightkern if rightkern and rightkern ~= 0 then insert_node_after(replace,n,newkern(rightkern)) - replacedone = true + done = true end end end @@ -808,8 +787,8 @@ local function inject_pairs_only(head,where) -- glyph|pre glyphs local rightkern = i.rightkern if rightkern and rightkern ~= 0 then - pre = insert_node_before(pre,pre,newkern(rightkern)) - predone = true + pre = insert_node_before(pre,pre,newkern(rightkern)) + done = true end end end @@ -822,21 +801,15 @@ local function inject_pairs_only(head,where) -- glyph|replace glyphs local rightkern = i.rightkern if rightkern and rightkern ~= 0 then - replace = insert_node_before(replace,replace,newkern(rightkern)) - replacedone = true + replace = insert_node_before(replace,replace,newkern(rightkern)) + done = true end end end end end - if predone then - setfield(current,"pre",pre) - end - if postdone then - setfield(current,"post",post) - end - if replacedone then - setfield(current,"replace",replace) + if done then + setdisc(current,pre,post,replace) end prevglyph = nil prevdisc = current @@ -1029,13 +1002,13 @@ local function inject_everything(head,where) insert_node_after(head,current,newkern(rightkern)) end else - local i = rawget(p,"replaceinjections") + local i = rawget(p,"emptyinjections") if i then -- glyph|disc|glyph (special case) local rightkern = i.rightkern if rightkern and rightkern ~= 0 then if next and getid(next) == disc_code then - local replace = getfield(pr,"replace") + local replace = getfield(next,"replace") if replace then -- error, we expect an empty one else @@ -1047,8 +1020,7 @@ local function inject_everything(head,where) end if prevdisc then if p then - local postdone = false - local replacedone = false + local done = false if post then local i = rawget(p,"postinjections") if i then @@ -1056,7 +1028,7 @@ local function inject_everything(head,where) if leftkern and leftkern ~= 0 then local posttail = find_tail(post) insert_node_after(post,posttail,newkern(leftkern)) - postdone = true + done = true end end end @@ -1067,15 +1039,12 @@ local function inject_everything(head,where) if leftkern and leftkern ~= 0 then local replacetail = find_tail(replace) insert_node_after(replace,replacetail,newkern(leftkern)) - replacedone = true + done = true end end end - if postdone then - setfield(prevdisc,"post",post) - end - if replacedone then - setfield(prevdisc,"replace",replace) + if done then + setdisc(prevdisc,pre,post,replace) end end end @@ -1097,12 +1066,8 @@ local function inject_everything(head,where) prevdisc = nil prevglyph = current elseif id == disc_code then - pre = getfield(current,"pre") - post = getfield(current,"post") - replace = getfield(current,"replace") - local predone = false - local postdone = false - local replacedone = false + pre, post, replace = getdisc(current) + local done = false if pre then -- left|pre glyphs|right for n in traverse_id(glyph_code,pre) do @@ -1117,13 +1082,13 @@ local function inject_everything(head,where) end local leftkern = i.leftkern if leftkern and leftkern ~= 0 then - pre = insert_node_before(pre,n,newkern(leftkern)) - predone = true + pre = insert_node_before(pre,n,newkern(leftkern)) + done = true end local rightkern = i.rightkern if rightkern and rightkern ~= 0 then insert_node_after(pre,n,newkern(rightkern)) - predone = true + done = true end end if hasmarks then @@ -1151,12 +1116,12 @@ local function inject_everything(head,where) local leftkern = i.leftkern if leftkern and leftkern ~= 0 then post = insert_node_before(post,n,newkern(leftkern)) - postdone = true + done = true end local rightkern = i.rightkern if rightkern and rightkern ~= 0 then insert_node_after(post,n,newkern(rightkern)) - postdone = true + done = true end end if hasmarks then @@ -1183,13 +1148,13 @@ local function inject_everything(head,where) end local leftkern = i.leftkern if leftkern and leftkern ~= 0 then - insert_node_before(replace,n,newkern(leftkern)) - replacedone = true + replace = insert_node_before(replace,n,newkern(leftkern)) + done = true end local rightkern = i.rightkern if rightkern and rightkern ~= 0 then insert_node_after(replace,n,newkern(rightkern)) - replacedone = true + done = true end end if hasmarks then @@ -1211,8 +1176,8 @@ local function inject_everything(head,where) -- glyph|pre glyphs local rightkern = i.rightkern if rightkern and rightkern ~= 0 then - pre = insert_node_before(pre,pre,newkern(rightkern)) - predone = true + pre = insert_node_before(pre,pre,newkern(rightkern)) + done = true end end end @@ -1226,20 +1191,14 @@ local function inject_everything(head,where) local rightkern = i.rightkern if rightkern and rightkern ~= 0 then replace = insert_node_before(replace,replace,newkern(rightkern)) - replacedone = true + done = true end end end end end - if predone then - setfield(current,"pre",pre) - end - if postdone then - setfield(current,"post",post) - end - if replacedone then - setfield(current,"replace",replace) + if done then + setdisc(current,pre,post.replace) end prevglyph = nil prevdisc = current diff --git a/tex/context/base/font-otl.lua b/tex/context/base/font-otl.lua index c1df8d084..559cbb6a4 100644 --- a/tex/context/base/font-otl.lua +++ b/tex/context/base/font-otl.lua @@ -53,7 +53,7 @@ local report_otf = logs.reporter("fonts","otf loading") local fonts = fonts local otf = fonts.handlers.otf -otf.version = 3.004 -- beware: also sync font-mis.lua and in mtx-fonts +otf.version = 3.006 -- beware: also sync font-mis.lua and in mtx-fonts otf.cache = containers.define("fonts", "otl", otf.version, true) local otfreaders = otf.readers @@ -254,7 +254,7 @@ function otf.load(filename,sub,featurefile) -- second argument (format) is gone report_otf("loading %a, hash %a",filename,hash) -- starttiming(otfreaders) - data = otfreaders.loadfont(filename,sub or 1) + data = otfreaders.loadfont(filename,sub or 1) -- we can pass the number instead (if it comes from a name search) -- -- if featurefiles then -- for i=1,#featurefiles do @@ -377,6 +377,7 @@ local function copytotfm(data,cache_id) -- watch out: luatex uses horiz_variants for the parts -- local italic = m.italic + local vitalic = m.vitalic -- local variants = m.hvariants local parts = m.hparts @@ -407,16 +408,19 @@ local function copytotfm(data,cache_id) c.vert_variants = parts elseif parts then character.vert_variants = parts - italic = m.vitalic end -- if italic and italic ~= 0 then character.italic = italic end -- + if vitalic and vitalic ~= 0 then + character.vert_italic = vitalic + end + -- local accent = m.accent -- taccent? if accent then - character.top_accent = accent + character.accent = accent end -- local kerns = m.kerns diff --git a/tex/context/base/font-otn.lua b/tex/context/base/font-otn.lua index 9ccd19d75..6f5bf345b 100644 --- a/tex/context/base/font-otn.lua +++ b/tex/context/base/font-otn.lua @@ -250,10 +250,9 @@ local disccodes = nodes.disccodes local glyph_code = nodecodes.glyph local glue_code = nodecodes.glue local disc_code = nodecodes.disc -local whatsit_code = nodecodes.whatsit local math_code = nodecodes.math -local dir_code = nodecodes.dir or whatcodes.dir -local localpar_code = nodecodes.localpar or whatcodes.localpar +local dir_code = nodecodes.dir +local localpar_code = nodecodes.localpar local discretionary_code = disccodes.discretionary local ligature_code = glyphcodes.ligature @@ -3320,43 +3319,6 @@ local function featuresprocessor(head,font,attr) comprun(start,c_run) start = getnext(start) end - elseif id == whatsit_code then - local subtype = getsubtype(start) - if subtype == dir_code then - local dir = getfield(start,"dir") - if dir == "+TLT" then - topstack = topstack + 1 - dirstack[topstack] = dir - rlmode = 1 - elseif dir == "+TRT" then - topstack = topstack + 1 - dirstack[topstack] = dir - rlmode = -1 - elseif dir == "-TLT" or dir == "-TRT" then - topstack = topstack - 1 - rlmode = dirstack[topstack] == "+TRT" and -1 or 1 - else - rlmode = rlparmode - end - if trace_directions then - report_process("directions after txtdir %a: parmode %a, txtmode %a, # stack %a, new dir %a",dir,rlparmode,rlmode,topstack,newdir) - end - elseif subtype == localpar_code then - local dir = getfield(start,"dir") - if dir == "TRT" then - rlparmode = -1 - elseif dir == "TLT" then - rlparmode = 1 - else - rlparmode = 0 - end - -- one might wonder if the par dir should be looked at, so we might as well drop the next line - rlmode = rlparmode - if trace_directions then - report_process("directions after pardir %a: parmode %a, txtmode %a",dir,rlparmode,rlmode) - end - end - start = getnext(start) elseif id == math_code then start = getnext(end_of_math(start)) elseif id == dir_code then @@ -3627,42 +3589,6 @@ local function featuresprocessor(head,font,attr) comprun(start,c_run) start = getnext(start) end - elseif id == whatsit_code then - local subtype = getsubtype(start) - if subtype == dir_code then - local dir = getfield(start,"dir") - if dir == "+TLT" then - topstack = topstack + 1 - dirstack[topstack] = dir - rlmode = 1 - elseif dir == "+TRT" then - topstack = topstack + 1 - dirstack[topstack] = dir - rlmode = -1 - elseif dir == "-TLT" or dir == "-TRT" then - topstack = topstack - 1 - rlmode = dirstack[topstack] == "+TRT" and -1 or 1 - else - rlmode = rlparmode - end - if trace_directions then - report_process("directions after txtdir %a: parmode %a, txtmode %a, # stack %a, new dir %a",dir,rlparmode,rlmode,topstack,newdir) - end - elseif subtype == localpar_code then - local dir = getfield(start,"dir") - if dir == "TRT" then - rlparmode = -1 - elseif dir == "TLT" then - rlparmode = 1 - else - rlparmode = 0 - end - rlmode = rlparmode - if trace_directions then - report_process("directions after pardir %a: parmode %a, txtmode %a",dir,rlparmode,rlmode) - end - end - start = getnext(start) elseif id == math_code then start = getnext(end_of_math(start)) elseif id == dir_code then diff --git a/tex/context/base/font-oto.lua b/tex/context/base/font-oto.lua index aaaa67796..b7ee717c9 100644 --- a/tex/context/base/font-oto.lua +++ b/tex/context/base/font-oto.lua @@ -181,7 +181,7 @@ local function make_1(present,tree,name) end end -local function make_2(present,tfmdata,characters,tree,name,preceding,unicode,done,sequence) +local function make_2(present,tfmdata,characters,tree,name,preceding,unicode,done) for k, v in next, tree do if k == "ligature" then local character = characters[preceding] @@ -198,9 +198,9 @@ local function make_2(present,tfmdata,characters,tree,name,preceding,unicode,don character.ligatures = { [unicode] = { char = v } } end if done then - local d = done[lookupname] + local d = done[name] if not d then - done[lookupname] = { "dummy", v } + done[name] = { "dummy", v } else d[#d+1] = v end @@ -208,7 +208,7 @@ local function make_2(present,tfmdata,characters,tree,name,preceding,unicode,don else local code = present[name] or unicode local name = name .. "_" .. k - make_2(present,tfmdata,characters,v,name,code,k,done,sequence) + make_2(present,tfmdata,characters,v,name,code,k,done) end end end @@ -346,7 +346,6 @@ local function preparepositionings(tfmdata,feature,value,validlookups,lookuplist end end else - -- normally we don't end up here (yet untested) for unicode, data in next, steps[i].coverage do local character = characters[unicode] local kerns = character.kerns @@ -354,6 +353,8 @@ local function preparepositionings(tfmdata,feature,value,validlookups,lookuplist if not kern[2] and not (kerns and kerns[otherunicode]) then local kern = kern[1] if kern[1] ~= 0 or kern[2] ~= 0 or kern[4] ~= 0 then + -- a complex pair not suitable for basemode + else kern = kern[3] if kern ~= 0 then if kerns then diff --git a/tex/context/base/font-otr.lua b/tex/context/base/font-otr.lua index 9d46d654b..f9dce389e 100644 --- a/tex/context/base/font-otr.lua +++ b/tex/context/base/font-otr.lua @@ -1112,6 +1112,7 @@ end -- is no real gain. local formatreaders = { } +local duplicatestoo = true formatreaders[4] = function(f,fontdata,offset) setposition(f,offset+2) -- skip format @@ -1166,13 +1167,22 @@ formatreaders[4] = function(f,fontdata,offset) local gu = glyph.unicode if not gu then glyph.unicode = unicode - else - -- no duplicates ... weird side effects in lm + elseif gu ~= unicode then + if duplicatestoo then + local d = duplicates[gu] + if d then + d[unicode] = true + else + duplicates[gu] = { [unicode] = true } + end + else + -- no duplicates ... weird side effects in lm + report("duplicate case 1: %C %04i %s",unicode,index,glyphs[index].name) + end end if not mapping[index] then mapping[index] = unicode end - -- report("case 1: %C %04i %s",unicode,index,glyphs[index].name) end end end @@ -1188,13 +1198,22 @@ formatreaders[4] = function(f,fontdata,offset) local gu = glyph.unicode if not gu then glyph.unicode = unicode - else - -- no duplicates ... weird side effects in lm + elseif gu ~= unicode then + if duplicatestoo then + local d = duplicates[gu] + if d then + d[unicode] = true + else + duplicates[gu] = { [unicode] = true } + end + else + -- no duplicates ... weird side effects in lm + report("duplicate case 2: %C %04i %s",unicode,index,glyphs[index].name) + end end if not mapping[index] then mapping[index] = unicode end - -- report("case 2: %C %04i %s",unicode,index,glyphs[index].name) end end end diff --git a/tex/context/base/font-ots.lua b/tex/context/base/font-ots.lua index 64e2ea05f..3bb2d326a 100644 --- a/tex/context/base/font-ots.lua +++ b/tex/context/base/font-ots.lua @@ -155,14 +155,25 @@ local getfield = nuts.getfield local setfield = nuts.setfield local getnext = nuts.getnext local getprev = nuts.getprev +local getboth = nuts.getboth local getid = nuts.getid local getattr = nuts.getattr -local setattr = nuts.setattr local getprop = nuts.getprop -local setprop = nuts.setprop local getfont = nuts.getfont local getsubtype = nuts.getsubtype local getchar = nuts.getchar +local getdisc = nuts.getdisc + +local setattr = nuts.setattr +local setprop = nuts.setprop +local setdisc = nuts.setdisc +local setnext = nuts.setnext +local setprev = nuts.setprev +local setlink = nuts.setlink +local setboth = nuts.setboth +local setchar = nuts.setchar + +local ischar = nuts.is_char local insert_node_before = nuts.insert_before local insert_node_after = nuts.insert_after @@ -192,7 +203,6 @@ local disccodes = nodes.disccodes local glyph_code = nodecodes.glyph local glue_code = nodecodes.glue local disc_code = nodecodes.disc -local whatsit_code = nodecodes.whatsit local math_code = nodecodes.math local dir_code = nodecodes.dir or whatcodes.dir local localpar_code = nodecodes.localpar or whatcodes.localpar @@ -254,8 +264,6 @@ local notmatchpre = { } local notmatchpost = { } local notmatchreplace = { } --- head is always a whatsit so we can safely assume that head is not changed - -- handlers .whatever(head,start, dataset,sequence,kerns, step,i,injection) -- chainprocs.whatever(head,start,stop,dataset,sequence,currentlookup,chainindex) @@ -359,7 +367,7 @@ end -- if replace1 and replace2 then -- local pre2 = getfield(next,"pre") -- local post2 = getfield(next,"post") --- setfield(replace1,"prev",nil) +-- setprev(replace1,nil) -- if pre2 then -- local pre1 = getfield(start,"pre") -- if pre1 then @@ -367,8 +375,8 @@ end -- end -- local pre1 = copy_node_list(replace1) -- local tail1 = find_node_tail(pre1) --- setfield(tail1,"next",pre2) --- setfield(pre2,"prev",tail1) +-- setnext(tail1,pre2) +-- setprev(pre2,tail1) -- setfield(start,"pre",pre1) -- setfield(next,"pre",nil) -- else @@ -384,14 +392,14 @@ end -- setfield(start,"post",nil) -- end -- local tail1 = find_node_tail(replace1) --- setfield(tail1,"next",replace2) --- setfield(replace2,"prev",tail1) +-- setnext(tail1,replace2) +-- setprev(replace2,tail1) -- setfield(start,"replace",replace1) -- setfield(next,"replace",nil) -- -- -- local nextnext = getnext(next) --- setfield(nextnext,"prev",start) --- setfield(start,"next",nextnext) +-- setprev(nextnext,start) +-- setnext(start,nextnext) -- free_node(next) -- else -- -- maybe remove it @@ -407,19 +415,19 @@ end -- local rt = ps and find_node_tail(rs) -- local pt = rs and find_node_tail(ps) -- if pre then --- setfield(pre,"prev",pt) --- setfield(pt,"next",pre) +-- setprev(pre,pt) +-- setnext(pt,pre) -- end -- if replace then --- setfield(replace,"prev",rt) --- setfield(rt,"next",replace) +-- setprev(replace,rt) +-- setnext(rt,replace) -- end -- setfield(last,"pre",ps) -- setfield(last,"replace",rs) -- setfield(first,"replace",nil) -- free_node(first) --- setfield(last,"prev",prev) --- setfield(prev,"next",last) +-- setprev(last,prev) +-- setnext(prev,last) -- return prev -- if nil then last is head -- end @@ -430,31 +438,29 @@ end -- local rs = first -- local ps = copy_node(first) -- if pre then --- setfield(pre,"prev",ps) --- setfield(ps,"next",pre) +-- setprev(pre,ps) +-- setnext(ps,pre) -- end -- if replace then --- setfield(replace,"prev",rs) --- setfield(rs,"next",replace) +-- setprev(replace,rs) +-- setnext(rs,replace) -- end -- setfield(last,"pre",ps) -- setfield(last,"replace",rs) --- setfield(last,"prev",prev) --- setfield(prev,"next",last) +-- setprev(last,prev) +-- setnext(prev,last) -- return prev -- if nil then last is head -- end local function flattendisk(head,disc) - local replace = getfield(disc,"replace") + local _, _, replace, _, _, replacetail = getdisc(disc,true) setfield(disc,"replace",nil) free_node(disc) if head == disc then local next = getnext(disc) if replace then if next then - local tail = find_node_tail(replace) - setfield(tail,"next",next) - setfield(next,"prev",tail) + setlink(replacetail,next) end return replace, replace elseif next then @@ -463,46 +469,35 @@ local function flattendisk(head,disc) return -- maybe warning end else - local next = getnext(disc) - local prev = getprev(disc) + local prev, next = getboth(disc) if replace then - local tail = find_node_tail(replace) if next then - setfield(tail,"next",next) - setfield(next,"prev",tail) + setlink(replacetail,next) end - setfield(prev,"next",replace) - setfield(replace,"prev",prev) + setlink(prev,replace) return head, replace else - if next then - setfield(next,"prev",prev) - end - setfield(prev,"next",next) + setlink(prev,next) -- checks for next anyway return head, next end end end local function appenddisc(disc,list) - local post = getfield(disc,"post") - local replace = getfield(disc,"replace") - local phead = list - local rhead = copy_node_list(list) - local ptail = find_node_tail(post) - local rtail = find_node_tail(replace) + local pre, post, replace, pretail, posttail, replacetail = getdisc(disc,true) + local posthead = list + local replacehead = copy_node_list(list) if post then - setfield(ptail,"next",phead) - setfield(phead,"prev",ptail) + setlink(posttail,posthead) else - setfield(disc,"post",phead) + post = phead end if replace then - setfield(rtail,"next",rhead) - setfield(rhead,"prev",rtail) + setlink(replacetail,replacehead) else - setfield(disc,"replace",rhead) + replace = rhead end + setdisc(disc,pre,post,replace) end -- start is a mark and we need to keep that one @@ -513,24 +508,18 @@ local function markstoligature(head,start,stop,char) else local prev = getprev(start) local next = getnext(stop) - setfield(start,"prev",nil) - setfield(stop,"next",nil) + setprev(start,nil) + setnext(stop,nil) local base = copy_glyph(start) if head == start then head = base end resetinjection(base) - setfield(base,"char",char) + setchar(base,char) setfield(base,"subtype",ligature_code) setfield(base,"components",start) - if prev then - setfield(prev,"next",base) - end - if next then - setfield(next,"prev",base) - end - setfield(base,"next",next) - setfield(base,"prev",prev) + setlink(prev,base) + setlink(base,next) return head, base end end @@ -569,37 +558,36 @@ local function toligature(head,start,stop,char,dataset,sequence,markflag,discfou end if start == stop and getchar(start) == char then resetinjection(start) - setfield(start,"char",char) + setchar(start,char) return head, start end -- needs testing (side effects): local components = getfield(start,"components") if components then - -- we get a double free .. needs checking - -- flush_node_list(components) +-- we get a double free .. needs checking +-- flush_node_list(components) end -- local prev = getprev(start) local next = getnext(stop) local comp = start - setfield(start,"prev",nil) - setfield(stop,"next",nil) + setprev(start,nil) + setnext(stop,nil) local base = copy_glyph(start) if start == head then head = base end resetinjection(base) - setfield(base,"char",char) + setchar(base,char) setfield(base,"subtype",ligature_code) setfield(base,"components",comp) -- start can have components .. do we need to flush? if prev then - setfield(prev,"next",base) + setnext(prev,base) end if next then - setfield(next,"prev",base) + setprev(next,base) end - setfield(base,"prev",prev) - setfield(base,"next",next) + setboth(base,prev,next) if not discfound then local deletemarks = markflag ~= "mark" local components = start @@ -643,44 +631,32 @@ local function toligature(head,start,stop,char,dataset,sequence,markflag,discfou end else -- discfound ... forget about marks .. probably no scripts that hyphenate and have marks - local discprev = getfield(discfound,"prev") - local discnext = getfield(discfound,"next") + local discprev, discnext = getboth(discfound) if discprev and discnext then -- we assume normalization in context, and don't care about generic ... especially -- \- can give problems as there we can have a negative char but that won't match -- anyway - local pre = getfield(discfound,"pre") - local post = getfield(discfound,"post") - local replace = getfield(discfound,"replace") + local pre, post, replace, pretail, posttail, replacetail = getdisc(discfound,true) if not replace then -- todo: signal simple hyphen - local prev = getfield(base,"prev") + local prev = getprev(base) local copied = copy_node_list(comp) - setfield(discnext,"prev",nil) -- also blocks funny assignments - setfield(discprev,"next",nil) -- also blocks funny assignments + setprev(discnext,nil) -- also blocks funny assignments + setnext(discprev,nil) -- also blocks funny assignments if pre then - setfield(discprev,"next",pre) - setfield(pre,"prev",discprev) + setlink(discprev,pre) end pre = comp if post then - local tail = find_node_tail(post) - setfield(tail,"next",discnext) - setfield(discnext,"prev",tail) - setfield(post,"prev",nil) + setlink(posttail,discnext) + setprev(post,nil) else post = discnext end - setfield(prev,"next",discfound) - setfield(discfound,"prev",prev) - setfield(discfound,"next",next) - setfield(next,"prev",discfound) - setfield(base,"next",nil) - setfield(base,"prev",nil) + setlink(prev,discfound) + setlink(discfound,next) + setboth(base,nil,nil) setfield(base,"components",copied) - setfield(discfound,"pre",pre) - setfield(discfound,"post",post) - setfield(discfound,"replace",base) - setfield(discfound,"subtype",discretionary_code) + setdisc(discfound,pre,post,base,discretionary_code) base = prev -- restart end end @@ -692,7 +668,7 @@ local function multiple_glyphs(head,start,multiple,ignoremarks) local nofmultiples = #multiple if nofmultiples > 0 then resetinjection(start) - setfield(start,"char",multiple[1]) + setchar(start,multiple[1]) if nofmultiples > 1 then local sn = getnext(start) for k=2,nofmultiples do -- todo: use insert_node @@ -703,13 +679,12 @@ local function multiple_glyphs(head,start,multiple,ignoremarks) -- end local n = copy_node(start) -- ignore components resetinjection(n) - setfield(n,"char",multiple[k]) - setfield(n,"prev",start) - setfield(n,"next",sn) + setchar(n,multiple[k]) + setboth(n,start,sn) if sn then - setfield(sn,"prev",n) + setprev(sn,n) end - setfield(start,"next",n) + setnext(start,n) start = n end end @@ -766,7 +741,7 @@ function handlers.gsub_single(head,start,dataset,sequence,replacement) logprocess("%s: replacing %s by single %s",pref(dataset,sequence),gref(getchar(start)),gref(replacement)) end resetinjection(start) - setfield(start,"char",replacement) + setchar(start,replacement) return head, start, true end @@ -780,7 +755,7 @@ function handlers.gsub_alternate(head,start,dataset,sequence,alternative) logprocess("%s: replacing %s by alternative %a to %s, %s",pref(dataset,sequence),gref(getchar(start)),gref(choice),comment) end resetinjection(start) - setfield(start,"char",choice) + setchar(start,choice) else if trace_alternatives then logwarning("%s: no variant %a for %s, %s",pref(dataset,sequence),value,gref(getchar(start)),comment) @@ -803,7 +778,7 @@ function handlers.gsub_ligature(head,start,dataset,sequence,ligature) if marks[startchar] then while current do local id = getid(current) - if id == glyph_code and getfont(current) == currentfont and getsubtype(current)<256 then + if ischar(current,currentfont) then local lg = ligature[getchar(current)] if lg then stop = current @@ -837,8 +812,9 @@ function handlers.gsub_ligature(head,start,dataset,sequence,ligature) local lastdisc = nil while current do local id = getid(current) - if id == glyph_code and getsubtype(current)<256 then -- not needed - if getfont(current) == currentfont then -- also not needed only when mark + -- weird test here + if id == glyph_code then -- not needed + if ischar(current,currentfont) then local char = getchar(current) if skipmark and marks[char] then current = getnext(current) @@ -879,7 +855,7 @@ function handlers.gsub_ligature(head,start,dataset,sequence,ligature) else -- weird but happens (in some arabic font) resetinjection(start) - setfield(start,"char",lig) + setchar(start,lig) if trace_ligatures then logprocess("%s: replacing %s by (no real) ligature %s case 3",pref(dataset,sequence),gref(startchar),gref(lig)) end @@ -899,13 +875,13 @@ function handlers.gpos_single(head,start,dataset,sequence,kerns,rlmode,step,i,in if step.format == "pair" then local dx, dy, w, h = setpair(start,factor,rlmode,sequence.flags[4],kerns,injection) if trace_kerns then - logprocess("%s: shifting single %s by (%p,%p) and correction (%p,%p) as %s",pref(dataset,sequence),gref(startchar),dx,dy,w,h,injection or "injections") + logprocess("%s: shifting single %s by (%p,%p) and correction (%p,%p)",pref(dataset,sequence),gref(startchar),dx,dy,w,h) end else -- needs checking .. maybe no kerns format for single local k = setkern(start,factor,rlmode,kerns,injection) if trace_kerns then - logprocess("%s: shifting single %s by %p as %s",pref(dataset,sequence),gref(startchar),k,injection or "injections") + logprocess("%s: shifting single %s by %p",pref(dataset,sequence),gref(startchar),k) end end return head, start, false @@ -918,7 +894,7 @@ function handlers.gpos_pair(head,start,dataset,sequence,kerns,rlmode,step,i,inje else local prev = start local done = false - while snext and getid(snext) == glyph_code and getfont(snext) == currentfont and getsubtype(snext)<256 do + while snext and ischar(snext,currentfont) do local nextchar = getchar(snext) local krn = kerns[nextchar] if not krn and marks[nextchar] then @@ -980,12 +956,12 @@ function handlers.gpos_mark2base(head,start,dataset,sequence,markanchors,rlmode) local markchar = getchar(start) if marks[markchar] then local base = getprev(start) -- [glyph] [start=mark] - if base and getid(base) == glyph_code and getfont(base) == currentfont and getsubtype(base)<256 then + if base and ischar(base,currentfont) then local basechar = getchar(base) if marks[basechar] then while true do base = getprev(base) - if base and getid(base) == glyph_code and getfont(base) == currentfont and getsubtype(base)<256 then + if base and ischar(base,currentfont) then basechar = getchar(base) if not marks[basechar] then break @@ -1023,12 +999,12 @@ function handlers.gpos_mark2ligature(head,start,dataset,sequence,markanchors,rlm local markchar = getchar(start) if marks[markchar] then local base = getprev(start) -- [glyph] [optional marks] [start=mark] - if base and getid(base) == glyph_code and getfont(base) == currentfont and getsubtype(base)<256 then + if base and ischar(base,currentfont) then local basechar = getchar(base) if marks[basechar] then while true do base = getprev(base) - if base and getid(base) == glyph_code and getfont(base) == currentfont and getsubtype(base)<256 then + if base and ischar(base,currentfont) then basechar = getchar(base) if not marks[basechar] then break @@ -1088,7 +1064,7 @@ function handlers.gpos_mark2mark(head,start,dataset,sequence,markanchors,rlmode) end end end - if base and getid(base) == glyph_code and getfont(base) == currentfont and getsubtype(base)<256 then -- subtype test can go + if base and ischar(base,currentfont) then -- subtype test can go local basechar = getchar(base) local ba = markanchors[1][basechar] -- slot 1 has been made copy of the class hash if ba then @@ -1118,7 +1094,7 @@ function handlers.gpos_cursive(head,start,dataset,sequence,exitanchors,rlmode,st end else local nxt = getnext(start) - while not done and nxt and getid(nxt) == glyph_code and getfont(nxt) == currentfont and getsubtype(nxt)<256 do + while not done and nxt and ischar(nxt,currentfont) do local nextchar = getchar(nxt) if marks[nextchar] then -- should not happen (maybe warning) @@ -1191,7 +1167,7 @@ function chainprocs.reversesub(head,start,stop,dataset,sequence,replacements,rlm logprocess("%s: single reverse replacement of %s by %s",cref(dataset,sequence),gref(char),gref(replacement)) end resetinjection(start) - setfield(start,"char",replacement) + setchar(start,replacement) return head, start, true else return head, start, false @@ -1276,7 +1252,7 @@ function chainprocs.gsub_single(head,start,stop,dataset,sequence,currentlookup,c logprocess("%s: replacing single %s by %s",cref(dataset,sequence,chainindex),gref(currentchar),gref(replacement)) end resetinjection(current) - setfield(current,"char",replacement) + setchar(current,replacement) end return head, start, true elseif current == stop then @@ -1346,7 +1322,7 @@ function chainprocs.gsub_alternate(head,start,stop,dataset,sequence,currentlooku logprocess("%s: replacing %s by alternative %a to %s, %s",cref(dataset,sequence),gref(char),choice,gref(choice),comment) end resetinjection(start) - setfield(start,"char",choice) + setchar(start,choice) else if trace_alternatives then logwarning("%s: no variant %a for %s, %s",cref(dataset,sequence),value,gref(char),comment) @@ -1473,7 +1449,7 @@ function chainprocs.gpos_single(head,start,stop,dataset,sequence,currentlookup,r return head, start, false end -function chainprocs.gpos_pair(head,start,stop,dataset,sequence,currentlookup,rlmode,chainindex) +function chainprocs.gpos_pair(head,start,stop,dataset,sequence,currentlookup,rlmode,chainindex) -- todo: injections ? local steps = currentlookup.steps local nofsteps = currentlookup.nofsteps if nofsteps > 1 then @@ -1485,9 +1461,9 @@ function chainprocs.gpos_pair(head,start,stop,dataset,sequence,currentlookup,rlm local step = steps[1] local kerns = step.coverage[startchar] -- always 1 step if kerns then - local prev = start - local done = false - while snext and getid(snext) == glyph_code and getfont(snext) == currentfont and getsubtype(snext)<256 do + local prev = start + local done = false + while snext and ischar(snext,currentfont) do local nextchar = getchar(snext) local krn = kerns[nextchar] if not krn and marks[nextchar] then @@ -1551,12 +1527,12 @@ function chainprocs.gpos_mark2base(head,start,stop,dataset,sequence,currentlooku local markanchors = steps[1].coverage[markchar] -- always 1 step if markanchors then local base = getprev(start) -- [glyph] [start=mark] - if base and getid(base) == glyph_code and getfont(base) == currentfont and getsubtype(base)<256 then + if base and ischar(base,currentfont) then local basechar = getchar(base) if marks[basechar] then while true do base = getprev(base) - if base and getid(base) == glyph_code and getfont(base) == currentfont and getsubtype(base)<256 then + if base and ischar(base,currentfont) then basechar = getchar(base) if not marks[basechar] then break @@ -1604,12 +1580,12 @@ function chainprocs.gpos_mark2ligature(head,start,stop,dataset,sequence,currentl local markanchors = steps[1].coverage[markchar] -- always 1 step if markanchors then local base = getprev(start) -- [glyph] [optional marks] [start=mark] - if base and getid(base) == glyph_code and getfont(base) == currentfont and getsubtype(base)<256 then + if base and ischar(base,currentfont) then local basechar = getchar(base) if marks[basechar] then while true do base = getprev(base) - if base and getid(base) == glyph_code and getfont(base) == currentfont and getsubtype(base)<256 then + if base and ischar(base,currentfont) then basechar = getchar(base) if not marks[basechar] then break @@ -1672,7 +1648,7 @@ function chainprocs.gpos_mark2mark(head,start,stop,dataset,sequence,currentlooku end end end - if base and getid(base) == glyph_code and getfont(base) == currentfont and getsubtype(base)<256 then -- subtype test can go + if base and ischar(base,currentfont) then -- subtype test can go local basechar = getchar(base) local ba = markanchors[1][basechar] if ba then @@ -1716,7 +1692,7 @@ function chainprocs.gpos_cursive(head,start,stop,dataset,sequence,currentlookup, end else local nxt = getnext(start) - while not done and nxt and getid(nxt) == glyph_code and getfont(nxt) == currentfont and getsubtype(nxt)<256 do + while not done and nxt and ischar(nxt,currentfont) do local nextchar = getchar(nxt) if marks[nextchar] then -- should not happen (maybe warning) @@ -1865,13 +1841,13 @@ local function chaindisk(head,start,last,dataset,sequence,chainlookup,rlmode,k,c local tail = nil if prev then tail = prev - setfield(current,"prev",sweepnode) + setprev(current,sweepnode) else tail = find_node_tail(head) end - setfield(sweepnode,"next",current) - setfield(head,"prev",nil) - setfield(tail,"next",nil) + setnext(sweepnode,current) + setprev(head,nil) + setnext(tail,nil) appenddisc(sweepnode,head) end end @@ -1958,26 +1934,24 @@ local function chaindisk(head,start,last,dataset,sequence,chainlookup,rlmode,k,c local cprev = getprev(start) local insertedmarks = 0 - while cprev and getid(cf) == glyph_code and getfont(cf) == currentfont and marks[getchar(cf)] and getsubtype(cf) < 256 do + while cprev and ischar(cf,currentfont) and marks[getchar(cf)] do insertedmarks = insertedmarks + 1 cf = cprev startishead = cf == head cprev = getprev(cprev) end - setfield(lookaheaddisc,"prev",cprev) + setprev(lookaheaddisc,cprev) if cprev then - setfield(cprev,"next",lookaheaddisc) + setnext(cprev,lookaheaddisc) end - setfield(cf,"prev",nil) - setfield(cl,"next",nil) + setprev(cf,nil) + setnext(cl,nil) if startishead then head = lookaheaddisc end - - local replace = getfield(lookaheaddisc,"replace") - local pre = getfield(lookaheaddisc,"pre") - local new = copy_node_list(cf) + local pre, post, replace = getdisc(lookaheaddisc) + local new = copy_node_list(cf) local cnew = new for i=1,insertedmarks do cnew = getnext(cnew) @@ -1993,17 +1967,13 @@ local function chaindisk(head,start,last,dataset,sequence,chainlookup,rlmode,k,c new, cnew, ok = chainproc(new,cnew,clast,dataset,sequence,chainlookup,rlmode,k) end if pre then - setfield(cl,"next",pre) - setfield(pre,"prev",cl) + setlink(cl,pre) end if replace then local tail = find_node_tail(new) - setfield(tail,"next",replace) - setfield(replace,"prev",tail) + setlink(tail,replace) end - setfield(lookaheaddisc,"pre",cf) -- also updates tail - setfield(lookaheaddisc,"replace",new) -- also updates tail - + setdisc(lookaheaddisc,cf,post,new) start = getprev(lookaheaddisc) sweephead[cf] = getnext(clast) sweephead[new] = getnext(last) @@ -2015,21 +1985,20 @@ local function chaindisk(head,start,last,dataset,sequence,chainlookup,rlmode,k,c local cnext = getnext(start) local insertedmarks = 0 - while cnext and getid(cnext) == glyph_code and getfont(cnext) == currentfont and marks[getchar(cnext)] and getsubtype(cnext) < 256 do + while cnext and ischar(cnext,currentfont) and marks[getchar(cnext)] do insertedmarks = insertedmarks + 1 cl = cnext cnext = getnext(cnext) end if cnext then - setfield(cnext,"prev",backtrackdisc) - end - setfield(backtrackdisc,"next",cnext) - setfield(cf,"prev",nil) - setfield(cl,"next",nil) - local replace = getfield(backtrackdisc,"replace") - local post = getfield(backtrackdisc,"post") - local new = copy_node_list(cf) - local cnew = find_node_tail(new) + setprev(cnext,backtrackdisc) + end + setnext(backtrackdisc,cnext) + setprev(cf,nil) + setnext(cl,nil) + local pre, post, replace, pretail, posttail, replacetail = getdisc(backtrackdisc,true) + local new = copy_node_list(cf) + local cnew = find_node_tail(new) for i=1,insertedmarks do cnew = getprev(cnew) end @@ -2044,21 +2013,16 @@ local function chaindisk(head,start,last,dataset,sequence,chainlookup,rlmode,k,c new, cnew, ok = chainproc(new,cnew,clast,dataset,sequence,chainlookup,rlmode,k) end if post then - local tail = find_node_tail(post) - setfield(tail,"next",cf) - setfield(cf,"prev",tail) + setlink(posttail,cf) else post = cf end if replace then - local tail = find_node_tail(replace) - setfield(tail,"next",new) - setfield(new,"prev",tail) + setlink(replacetail,new) else replace = new end - setfield(backtrackdisc,"post",post) -- also updates tail - setfield(backtrackdisc,"replace",replace) -- also updates tail + setdisc(backtrackdisc,pre,post,replace) start = getprev(backtrackdisc) sweephead[post] = getnext(clast) sweephead[replace] = getnext(last) @@ -2155,7 +2119,7 @@ local function handle_contextchain(head,start,dataset,sequence,contexts,rlmode) -- f..l = mid string if s == 1 then -- never happens - match = getid(current) == glyph_code and getfont(current) == currentfont and getsubtype(current)<256 and seq[1][getchar(current)] + match = ischar(current,currentfont) and seq[1][getchar(current)] else -- maybe we need a better space check (maybe check for glue or category or combination) -- we cannot optimize for n=2 because there can be disc nodes @@ -2181,7 +2145,7 @@ local function handle_contextchain(head,start,dataset,sequence,contexts,rlmode) if last then local id = getid(last) if id == glyph_code then - if getfont(last) == currentfont and getsubtype(last)<256 then + if ischar(last,currentfont) then local char = getchar(last) local ccd = descriptions[char] if ccd then @@ -2230,8 +2194,7 @@ local function handle_contextchain(head,start,dataset,sequence,contexts,rlmode) notmatchpre[last] = nil notmatchpost[last] = true notmatchreplace[last] = nil - local pre = getfield(last,"pre") - local replace = getfield(last,"replace") + local pre, post, replace = getdisc(last) if pre then local n = n while pre do @@ -2296,7 +2259,7 @@ local function handle_contextchain(head,start,dataset,sequence,contexts,rlmode) if prev then local id = getid(prev) if id == glyph_code then - if getfont(prev) == currentfont and getsubtype(prev)<256 then -- normal char + if ischar(prev,currentfont) then local char = getchar(prev) local ccd = descriptions[char] if ccd then @@ -2342,13 +2305,10 @@ local function handle_contextchain(head,start,dataset,sequence,contexts,rlmode) notmatchpre[prev] = true notmatchpost[prev] = nil notmatchreplace[prev] = nil - local pre = getfield(prev,"pre") - local post = getfield(prev,"post") - local replace = getfield(prev,"replace") + local pre, post, replace, pretail, posttail, replacetail = getdisc(prev,true) if pre ~= start and post ~= start and replace ~= start then if post then local n = n - local posttail = find_node_tail(post) while posttail do if seq[n][getchar(posttail)] then n = n - 1 @@ -2373,7 +2333,6 @@ local function handle_contextchain(head,start,dataset,sequence,contexts,rlmode) end if replace then -- we seldom enter this branch (e.g. on brill efficient) - local replacetail = find_node_tail(replace) while replacetail do if seq[n][getchar(replacetail)] then n = n - 1 @@ -2438,7 +2397,7 @@ local function handle_contextchain(head,start,dataset,sequence,contexts,rlmode) if current then local id = getid(current) if id == glyph_code then - if getfont(current) == currentfont and getsubtype(current)<256 then -- normal char + if ischar(current,currentfont) then local char = getchar(current) local ccd = descriptions[char] if ccd then @@ -2483,8 +2442,7 @@ local function handle_contextchain(head,start,dataset,sequence,contexts,rlmode) notmatchpre[current] = nil notmatchpost[current] = true notmatchreplace[current] = nil - local pre = getfield(current,"pre") - local replace = getfield(current,"replace") + local pre, post, replace = getdisc(current) if pre then local n = n while pre do @@ -2779,26 +2737,23 @@ local function kernrun(disc,run) report_run("kern") -- will be more detailed end -- - local prev = getprev(disc) -- todo, keep these in the main loop - local next = getnext(disc) -- todo, keep these in the main loop + local prev, next = getboth(disc) -- - local pre = getfield(disc,"pre") - local post = getfield(disc,"post") - local replace = getfield(disc,"replace") + local pre, post, replace, pretail, posttail, replacetail = getdisc(disc,true) -- local prevmarks = prev -- -- can be optional, because why on earth do we get a disc after a mark (okay, maybe when a ccmp -- has happened but then it should be in the disc so basically this test indicates an error) -- - while prevmarks and getid(prevmarks) == glyph_code and marks[getchar(prevmarks)] and getfont(prevmarks) == currentfont and getsubtype(prevmarks) < 256 do + while prevmarks and ischar(prevmarks,currentfont) and marks[getchar(prevmarks)] do prevmarks = getprev(prevmarks) end -- - if prev and (pre or replace) and not (getid(prev) == glyph_code and getfont(prev) == currentfont and getsubtype(prev)<256) then + if prev and (pre or replace) and not ischar(prev,currentfont) then prev = false end - if next and (post or replace) and not (getid(next) == glyph_code and getfont(next) == currentfont and getsubtype(next)<256) then + if next and (post or replace) and not ischar(next,currentfont) then next = false end -- @@ -2806,23 +2761,20 @@ local function kernrun(disc,run) run(pre,"injections") if prev then local nest = getprev(pre) - setfield(pre,"prev",prev) - setfield(prev,"next",pre) - run(prevmarks,"preinjections",getnext(pre)) - setfield(pre,"prev",nest) - setfield(prev,"next",disc) + setlink(prev,pre) + run(prevmarks,"preinjections",pre) -- getnext(pre)) + setprev(pre,nest) + setnext(prev,disc) end end -- if post then run(post,"injections") if next then - local tail = find_node_tail(post) - setfield(tail,"next",next) - setfield(next,"prev",tail) - run(tail,"postinjections",next) - setfield(tail,"next",nil) - setfield(next,"prev",disc) + setlink(posttail,next) + run(posttail,"postinjections",next) + setnext(posttail,nil) + setprev(next,disc) end end -- @@ -2830,26 +2782,22 @@ local function kernrun(disc,run) run(replace,"injections") if prev then local nest = getprev(replace) - setfield(replace,"prev",prev) - setfield(prev,"next",replace) - run(prevmarks,"replaceinjections",getnext(replace)) - setfield(replace,"prev",nest) - setfield(prev,"next",disc) + setlink(prev,replace) + run(prevmarks,"replaceinjections",replace) -- getnext(replace)) + setprev(replace,nest) + setnext(prev,disc) end if next then - local tail = find_node_tail(replace) - setfield(tail,"next",next) - setfield(next,"prev",tail) - run(tail,"replaceinjections",next) - setfield(tail,"next",nil) - setfield(next,"prev",disc) + setlink(replacetail,next) + run(replacetail,"replaceinjections",next) + setnext(replacetail,nil) + setprev(next,disc) end elseif prev and next then - setfield(prev,"next",next) - setfield(next,"prev",prev) + setlink(prev,next) run(prevmarks,"emptyinjections",next) - setfield(prev,"next",disc) - setfield(next,"prev",disc) + setlink(prev,disc) + setlink(disc,next) end end @@ -2857,12 +2805,8 @@ end -- in a temp node local function checkdisc(str,d) -- only used when debugging - report_check("%s : [%s][%s][%s]", - str, - nodes.toutf(getfield(d,"pre")), - nodes.toutf(getfield(d,"post")), - nodes.toutf(getfield(d,"replace")) - ) + local pre, post, replace = getdisc(d) + report_check("%s : [%s][%s][%s]",str,nodes.toutf(pre),nodes.toutf(post),nodes.toutf(replace)) end local function comprun(disc,run) @@ -2870,64 +2814,65 @@ local function comprun(disc,run) report_run("comp: %s",languages.serializediscretionary(disc)) end -- - local pre = getfield(disc,"pre") + local pre, post, replace = getdisc(disc) + local renewed = false + -- if pre then sweepnode = disc - sweeptype = "pre" + sweeptype = "pre" -- in alternative code preinjections is used (also used then for proeprties, saves a variable) local new, done = run(pre) if done then - setfield(disc,"pre",new) + pre = new + renewed = true end end -- - local post = getfield(disc,"post") if post then sweepnode = disc sweeptype = "post" local new, done = run(post) if done then - setfield(disc,"post",new) + post = new + renewed = true end end -- - local replace = getfield(disc,"replace") if replace then sweepnode = disc sweeptype = "replace" local new, done = run(replace) if done then - setfield(disc,"replace",new) + replace = new + renewed = true end end sweepnode = nil sweeptype = nil + if renewed then + setdisc(disc,pre,post,replace) + end end local function testrun(disc,trun,crun) -- use helper local next = getnext(disc) if next then - local replace = getfield(disc,"replace") + local _, _, replace, _, _, tail = getdisc(disc,true) if replace then local prev = getprev(disc) if prev then -- only look ahead - local tail = find_node_tail(replace) -- local nest = getprev(replace) - setfield(tail,"next",next) - setfield(next,"prev",tail) + setlink(tail,next) if trun(replace,next) then setfield(disc,"replace",nil) -- beware, side effects of nest so first - setfield(prev,"next",replace) - setfield(replace,"prev",prev) - setfield(next,"prev",tail) - setfield(tail,"next",next) - setfield(disc,"prev",nil) - setfield(disc,"next",nil) + setlink(prev,replace) + setlink(tail,next) + setboth(disc,nil,nil) flush_node_list(disc) return replace -- restart else - setfield(tail,"next",nil) - setfield(next,"prev",disc) + setnext(tail,nil) + setprev(next,disc) end else -- weird case @@ -2943,17 +2888,16 @@ local function testrun(disc,trun,crun) -- use helper end local function discrun(disc,drun,krun) - local next = getnext(disc) - local prev = getprev(disc) + local prev, next = getboth(disc) if trace_discruns then report_run("disc") -- will be more detailed end if next and prev then - setfield(prev,"next",next) - -- setfield(next,"prev",prev) + setnext(prev,next) + -- setprev(next,prev) drun(prev) - setfield(prev,"next",disc) - -- setfield(next,"prev",disc) + setnext(prev,disc) + -- setprev(next,disc) end -- local pre = getfield(disc,"pre") @@ -2961,11 +2905,10 @@ local function discrun(disc,drun,krun) -- go on elseif prev then local nest = getprev(pre) - setfield(pre,"prev",prev) - setfield(prev,"next",pre) + setlink(prev,pre) krun(prev,"preinjections") - setfield(pre,"prev",nest) - setfield(prev,"next",disc) + setprev(pre,nest) + setnext(prev,disc) else krun(pre,"preinjections") end @@ -3066,43 +3009,38 @@ local function featuresprocessor(head,font,attr) local handler = handlers[typ] local steps = sequence.steps local nofsteps = sequence.nofsteps - if typ == "gsub_reversecontextchain" then -- chain < 0 -- this is a limited case, no special treatments like 'init' etc -- we need to get rid of this slide! probably no longer needed in latest luatex local start = find_node_tail(head) -- slow (we can store tail because there's always a skip at the end): todo while start do local id = getid(start) - if id == glyph_code then - if getfont(start) == font and getsubtype(start) < 256 then - local a = getattr(start,0) - if a then - a = a == attr - else - a = true - end - if a then - local char = getchar(start) - for i=1,nofsteps do - local step = steps[i] - local lookupcache = step.coverage - if lookupcache then - local lookupmatch = lookupcache[char] - if lookupmatch then - -- todo: disc? - head, start, success = handler(head,start,dataset,sequence,lookupmatch,rlmode,step,i) - if success then - break - end + if ischar(start,font) then + local a = getattr(start,0) + if a then + a = a == attr + else + a = true + end + if a then + local char = getchar(start) + for i=1,nofsteps do + local step = steps[i] + local lookupcache = step.coverage + if lookupcache then + local lookupmatch = lookupcache[char] + if lookupmatch then + -- todo: disc? + head, start, success = handler(head,start,dataset,sequence,lookupmatch,rlmode,step,i) + if success then + break end - else - report_missing_cache(dataset,sequence) end + else + report_missing_cache(dataset,sequence) end - if start then start = getprev(start) end - else - start = getprev(start) end + if start then start = getprev(start) end else start = getprev(start) end @@ -3114,7 +3052,7 @@ local function featuresprocessor(head,font,attr) local start = head -- local ? rlmode = 0 -- to be checked ? if nofsteps == 1 then -- happens often - local step = steps[1] + local step = steps[1] local lookupcache = step.coverage if not lookupcache then -- also check for empty cache report_missing_cache(dataset,sequence) @@ -3133,7 +3071,7 @@ local function featuresprocessor(head,font,attr) if id ~= glyph_code then -- very unlikely start = getnext(start) - elseif getfont(start) == font and getsubtype(start) < 256 then + elseif ischar(start,font) then local a = getattr(start,0) -- if a then -- a = (a == attr) and (not attribute or getprop(start,a_state) == attribute) @@ -3168,7 +3106,7 @@ if not a or (a == attr) then local function t_run(start,stop) while start ~= stop do local id = getid(start) - if id == glyph_code and getfont(start) == font and getsubtype(start) < 256 then + if ischar(start,font) then local a = getattr(start,0) -- if a then -- a = (a == attr) and (not attribute or getprop(start,a_state) == attribute) @@ -3217,14 +3155,14 @@ if not a or (a == attr) then -- sequence kan weg local h, d, ok = handler(head,start,dataset,sequence,lookupmatch,rlmode,step,1) if ok then - done = true + done = true success = true end end end end - local function k_run(sub,injection,last,bound) + local function k_run(sub,injection,last) local a = getattr(sub,0) -- if a then -- a = (a == attr) and (not attribute or getprop(sub,a_state) == attribute) @@ -3242,9 +3180,9 @@ if not a or (a == attr) then if id == glyph_code then local lookupmatch = lookupcache[getchar(n)] if lookupmatch then - local h, d, ok = handler(sub,n,dataset,sequence,lookupmatch,rlmode,step,1,injection,bound) + local h, d, ok = handler(sub,n,dataset,sequence,lookupmatch,rlmode,step,1,injection) if ok then - done = true + done = true success = true end end @@ -3258,7 +3196,7 @@ if not a or (a == attr) then while start do local id = getid(start) if id == glyph_code then - if getfont(start) == font and getsubtype(start) < 256 then -- why a 256 test ... + if ischar(start,font) then local a = getattr(start,0) if a then a = (a == attr) and (not attribute or getprop(start,a_state) == attribute) @@ -3297,43 +3235,6 @@ if not a or (a == attr) then comprun(start,c_run) start = getnext(start) end - elseif id == whatsit_code then - local subtype = getsubtype(start) - if subtype == dir_code then - local dir = getfield(start,"dir") - if dir == "+TLT" then - topstack = topstack + 1 - dirstack[topstack] = dir - rlmode = 1 - elseif dir == "+TRT" then - topstack = topstack + 1 - dirstack[topstack] = dir - rlmode = -1 - elseif dir == "-TLT" or dir == "-TRT" then - topstack = topstack - 1 - rlmode = dirstack[topstack] == "+TRT" and -1 or 1 - else - rlmode = rlparmode - end - if trace_directions then - report_process("directions after txtdir %a: parmode %a, txtmode %a, # stack %a, new dir %a",dir,mref(rlparmode),mref(rlmode),topstack,mref(newdir)) - end - elseif subtype == localpar_code then - local dir = getfield(start,"dir") - if dir == "TRT" then - rlparmode = -1 - elseif dir == "TLT" then - rlparmode = 1 - else - rlparmode = 0 - end - -- one might wonder if the par dir should be looked at, so we might as well drop the next line - rlmode = rlparmode - if trace_directions then - report_process("directions after pardir %a: parmode %a, txtmode %a",dir,mref(rlparmode),mref(rlmode)) - end - end - start = getnext(start) elseif id == math_code then start = getnext(end_of_math(start)) elseif id == dir_code then @@ -3392,7 +3293,7 @@ if not a or (a == attr) then if id ~= glyph_code then -- very unlikely start = getnext(start) - elseif getfont(start) == font and getsubtype(start) < 256 then + elseif ischar(start,font) then local a = getattr(start,0) -- if a then -- a = (a == attr) and (not attribute or getprop(start,a_state) == attribute) @@ -3468,7 +3369,7 @@ if not a or (a == attr) then end end - local function k_run(sub,injection,last,bound) + local function k_run(sub,injection,last) local a = getattr(sub,0) -- if a then -- a = (a == attr) and (not attribute or getprop(sub,a_state) == attribute) @@ -3490,7 +3391,7 @@ if not a or (a == attr) then if lookupcache then local lookupmatch = lookupcache[char] if lookupmatch then - local h, d, ok = handler(head,n,dataset,sequence,lookupmatch,step,rlmode,i,injection,bound) + local h, d, ok = handler(head,n,dataset,sequence,lookupmatch,step,rlmode,i,injection) if ok then done = true break @@ -3510,7 +3411,7 @@ if not a or (a == attr) then local function t_run(start,stop) while start ~= stop do local id = getid(start) - if id == glyph_code and getfont(start) == font and getsubtype(start) < 256 then + if ischar(start,font) then local a = getattr(start,0) -- if a then -- a = (a == attr) and (not attribute or getprop(start,a_state) == attribute) @@ -3521,7 +3422,7 @@ if not a or (a == attr) then if not a or (a == attr) then local char = getchar(start) for i=1,nofsteps do - local step = steps[i] + local step = steps[i] local lookupcache = step.coverage if lookupcache then local lookupmatch = lookupcache[char] @@ -3557,7 +3458,7 @@ if not a or (a == attr) then while start do local id = getid(start) if id == glyph_code then - if getfont(start) == font and getsubtype(start) < 256 then + if ischar(start,font) then local a = getattr(start,0) if a then a = (a == attr) and (not attribute or getprop(start,a_state) == attribute) @@ -3608,42 +3509,6 @@ if not a or (a == attr) then comprun(start,c_run) start = getnext(start) end - elseif id == whatsit_code then - local subtype = getsubtype(start) - if subtype == dir_code then - local dir = getfield(start,"dir") - if dir == "+TLT" then - topstack = topstack + 1 - dirstack[topstack] = dir - rlmode = 1 - elseif dir == "+TRT" then - topstack = topstack + 1 - dirstack[topstack] = dir - rlmode = -1 - elseif dir == "-TLT" or dir == "-TRT" then - topstack = topstack - 1 - rlmode = dirstack[topstack] == "+TRT" and -1 or 1 - else - rlmode = rlparmode - end - if trace_directions then - report_process("directions after txtdir %a: parmode %a, txtmode %a, # stack %a, new dir %a",dir,mref(rlparmode),mref(rlmode),topstack,mref(newdir)) - end - elseif subtype == localpar_code then - local dir = getfield(start,"dir") - if dir == "TRT" then - rlparmode = -1 - elseif dir == "TLT" then - rlparmode = 1 - else - rlparmode = 0 - end - rlmode = rlparmode - if trace_directions then - report_process("directions after pardir %a: parmode %a, txtmode %a",dir,mref(rlparmode),mref(rlmode)) - end - end - start = getnext(start) elseif id == math_code then start = getnext(end_of_math(start)) elseif id == dir_code then diff --git a/tex/context/base/font-pre.mkiv b/tex/context/base/font-pre.mkiv index c7625c932..492814915 100644 --- a/tex/context/base/font-pre.mkiv +++ b/tex/context/base/font-pre.mkiv @@ -251,11 +251,18 @@ [mathematics] [] +% \definefontfeature +% [mathematics-r2l] +% [mathematics] +% [language=ara, +% rtlm=yes, +% locl=yes] + \definefontfeature [mathematics-r2l] [mathematics] - [language=ara, - rtlm=yes, + [rtlm=yes, + %dtls=yes, locl=yes] \definefontfeature[virtualmath] [mathematics] % downward compatibility diff --git a/tex/context/base/font-sol.lua b/tex/context/base/font-sol.lua index 3e138f10f..ea9ac99bc 100644 --- a/tex/context/base/font-sol.lua +++ b/tex/context/base/font-sol.lua @@ -57,17 +57,20 @@ local tonut = nuts.tonut local tonode = nuts.tonode local getfield = nuts.getfield -local setfield = nuts.setfield local getnext = nuts.getnext local getprev = nuts.getprev local getid = nuts.getid local getattr = nuts.getattr -local setattr = nuts.setattr local getfont = nuts.getfont local getsubtype = nuts.getsubtype local getchar = nuts.getchar local getlist = nuts.getlist +local setfield = nuts.setfield +local setattr = nuts.setattr +local setlink = nuts.setlink +local setnext = nuts.setnext + local find_node_tail = nuts.tail local free_node = nuts.free local free_nodelist = nuts.flush_list @@ -95,8 +98,8 @@ local glyph_code = nodecodes.glyph local disc_code = nodecodes.disc local kern_code = nodecodes.kern local hlist_code = nodecodes.hlist -local dir_code = nodecodes.dir or whatsitcodes.dir -local localpar_code = nodecodes.localpar or whatsitcodes.localpar +local dir_code = nodecodes.dir +local localpar_code = nodecodes.localpar local whatsit_code = nodecodes.whatsit @@ -367,8 +370,7 @@ function splitters.split(head) end if rlmode == "TRT" or rlmode == "+TRT" then local dirnode = new_textdir("+TRT") - setfield(list,"prev",dirnode) - setfield(dirnode,"next",list) + setlink(dirnode,list) list = dirnode end local c = { @@ -420,14 +422,6 @@ function splitters.split(head) flush() end rlmode = getfield(current,"dir") - elseif id == whatsit_code then - if start then - flush() - end - local subtype = getsubtype(current) - if subtype == dir_code or subtype == localpar_code then - rlmode = getfield(current,"dir") - end else if start then flush() @@ -620,11 +614,9 @@ first = tonut(first) -- replace [u]h->t by [u]first->last local prev = getprev(h) local next = getnext(t) - setfield(prev,"next",first) - setfield(first,"prev",prev) + setlink(prev,first) if next then - setfield(last,"next",next) - setfield(next,"prev",last) + setlink(last,next) end -- check new pack local temp, b = repack_hlist(list,width,'exactly',listdir) @@ -633,22 +625,20 @@ first = tonut(first) report_optimizers("line %a, badness before %a, after %a, criterium %a, verdict %a",line,badness,b,criterium,"quit") end -- remove last insert - setfield(prev,"next",h) - setfield(h,"prev",prev) + setlink(prev,h) if next then - setfield(t,"next",next) - setfield(next,"prev",t) + setlink(t,next) else - setfield(t,"next",nil) + setnext(t) end - setfield(last,"next",nil) + setnext(last) free_nodelist(first) else if trace_optimize then report_optimizers("line %a, badness before: %a, after %a, criterium %a, verdict %a",line,badness,b,criterium,"continue") end -- free old h->t - setfield(t,"next",nil) + setnext(t) free_nodelist(h) -- somhow fails if not encapsulate then word[2] = first diff --git a/tex/context/base/font-tfm.lua b/tex/context/base/font-tfm.lua index 401dc8348..2dd576849 100644 --- a/tex/context/base/font-tfm.lua +++ b/tex/context/base/font-tfm.lua @@ -25,6 +25,8 @@ local encodings = fonts.encodings local tfm = constructors.newhandler("tfm") tfm.version = 1.000 +tfm.maxnestingdepth = 5 +tfm.maxnestingsize = 65536*1024 local tfmfeatures = constructors.newfeatures("tfm") local registertfmfeature = tfmfeatures.register @@ -45,6 +47,18 @@ supplied by .

-- ofm directive blocks local path search unless set; btw, in context we -- don't support ofm files anyway as this format is obsolete +-- we need to deal with nested virtual fonts, but because we load in the +-- frontend we also need to make sure we don't nest too deep (esp when sizes +-- get large) +-- +-- (VTITLE Example of a recursion) +-- (MAPFONT D 0 (FONTNAME recurse)(FONTAT D 2)) +-- (CHARACTER C A (CHARWD D 1)(CHARHT D 1)(MAP (SETRULE D 1 D 1))) +-- (CHARACTER C B (CHARWD D 2)(CHARHT D 2)(MAP (SETCHAR C A))) +-- (CHARACTER C C (CHARWD D 4)(CHARHT D 4)(MAP (SETCHAR C B))) +-- +-- we added the same checks as below to the luatex engine + function tfm.setfeatures(tfmdata,features) local okay = constructors.initializefeatures("tfm",tfmdata,features,trace_features,report_tfm) if okay then @@ -54,9 +68,12 @@ function tfm.setfeatures(tfmdata,features) end end +local depth = { } -- table.setmetatableindex("number") + local function read_from_tfm(specification) - local filename = specification.filename - local size = specification.size + local filename = specification.filename + local size = specification.size + depth[filename] = (depth[filename] or 0) + 1 if trace_defining then report_defining("loading tfm file %a at size %s",filename,size) end @@ -104,6 +121,25 @@ local function read_from_tfm(specification) end properties.virtualized = true tfmdata.fonts = vfdata.fonts + tfmdata.type = "virtual" -- else nested calls with cummulative scaling + local fontlist = vfdata.fonts + local name = file.nameonly(filename) + for i=1,#fontlist do + local n = fontlist[i].name + local s = fontlist[i].size + local d = depth[filename] + s = constructors.scaled(s,vfdata.designsize) + if d > tfm.maxnestingdepth then + report_defining("too deeply nested virtual font %a with size %a, max nesting depth %s",n,s,tfm.maxnestingdepth) + fontlist[i] = { id = 0 } + elseif (d > 1) and (s > tfm.maxnestingsize) then + report_defining("virtual font %a exceeds size %s",n,s) + fontlist[i] = { id = 0 } + else + local t, id = fonts.constructors.readanddefine(n,s) + fontlist[i] = { id = id } + end + end end end end @@ -122,7 +158,10 @@ local function read_from_tfm(specification) resources.unicodes = { } resources.lookuptags = { } -- + depth[filename] = depth[filename] - 1 return tfmdata + else + depth[filename] = depth[filename] - 1 end end diff --git a/tex/context/base/hand-ini.mkiv b/tex/context/base/hand-ini.mkiv index 7ee623193..d4bffdb14 100644 --- a/tex/context/base/hand-ini.mkiv +++ b/tex/context/base/hand-ini.mkiv @@ -51,10 +51,19 @@ \let\adjustspacing\relax \newcount\adjustspacing % a little bit protection \let\protrudechars\relax \newcount\protrudechars % a little bit protection -\def\font_expansion_enable {\normaladjustspacing\plustwo } % these will become normal primitives -\def\font_expansion_disable {\normaladjustspacing\zerocount} % these will become normal primitives -\def\font_protruding_enable {\normalprotrudechars\plustwo } % these will become normal primitives -\def\font_protruding_disable{\normalprotrudechars\zerocount} % these will become normal primitives +% at some point we can introduce extreme expansion, i.e. \normaladjustspacing\plustwo + +% 0 = disabled +% 1 = notused (thesis) +% 2 = glyph + kern +% 3 = glyph only + +\def\font_expansion_enable {\normaladjustspacing\plusthree} +\def\font_expansion_enable_k{\normaladjustspacing\plustwo} +\def\font_expansion_disable {\normaladjustspacing\zerocount} + +\def\font_protruding_enable {\normalprotrudechars\plustwo } +\def\font_protruding_disable{\normalprotrudechars\zerocount} \appendtoks \font_expansion_disable \to \everyforgetall % Here or not here? \appendtoks \font_protruding_disable \to \everyforgetall % Here or not here? diff --git a/tex/context/base/lang-def.mkiv b/tex/context/base/lang-def.mkiv index c2fb9640c..c3141ae72 100644 --- a/tex/context/base/lang-def.mkiv +++ b/tex/context/base/lang-def.mkiv @@ -171,7 +171,12 @@ [\c!default=\s!en, \s!patterns=\s!gb, \s!lefthyphenmin=3, - \s!righthyphenmin=3] + \s!righthyphenmin=3, + % the reverse of american (or maybe the american did it the reverse) + \c!leftquote=\upperleftdoublesixquote, + \c!rightquote=\upperrightdoubleninequote, + \c!leftquotation=\upperleftsinglesixquote, + \c!rightquotation=\upperrightsingleninequote] \installlanguage [en-us] diff --git a/tex/context/base/lang-hyp.lua b/tex/context/base/lang-hyp.lua index 6c7589956..49976515d 100644 --- a/tex/context/base/lang-hyp.lua +++ b/tex/context/base/lang-hyp.lua @@ -609,7 +609,6 @@ if context then local new_disc = nodepool.disc local new_glyph = nodepool.glyph - local setfield = nuts.setfield local getfield = nuts.getfield local getfont = nuts.getfont local getchar = nuts.getchar @@ -619,6 +618,11 @@ if context then local getprev = nuts.getprev local getsubtype = nuts.getsubtype local getlist = nuts.getlist + + local setfield = nuts.setfield + local setchar = nuts.setchar + local setdisc = nuts.setdisc + local insert_before = nuts.insert_before local insert_after = nuts.insert_after local copy_node = nuts.copy @@ -1123,7 +1127,7 @@ if context then return elseif replacement == true then local glyph = copy_node(stop) - setfield(glyph,"char",leftchar or rightchar) + setchar(glyph,leftchar or rightchar) return glyph end local head = nil @@ -1131,12 +1135,12 @@ if context then if leftchar then head = copy_node(stop) current = head - setfield(head,"char",leftchar) + setchar(head,leftchar) end local rsize = #replacement if rsize == 1 then local glyph = copy_node(stop) - setfield(glyph,"char",characters[replacement]) + setchar(glyph,characters[replacement]) if head then insert_after(current,current,glyph) else @@ -1147,7 +1151,7 @@ if context then local list = lpegmatch(p_split,replacement) -- this is an utf split (could be cached) for i=1,#list do local glyph = copy_node(stop) - setfield(glyph,"char",characters[list[i]]) + setchar(glyph,characters[list[i]]) if head then insert_after(current,current,glyph) else @@ -1159,7 +1163,7 @@ if context then if rightchar then local glyph = copy_node(stop) insert_after(current,current,glyph) - setfield(glyph,"char",rightchar) + setchar(glyph,rightchar) end return head end @@ -1220,7 +1224,7 @@ if context then end insert_before(first,current,disc) else - setfield(current,"char",characters[r]) + setchar(current,characters[r]) if i < rsize then current = getnext(current) end @@ -1253,11 +1257,11 @@ if context then end if rightchar then pre = copy_node(glyph) - setfield(pre,"char",rightchar) + setchar(pre,rightchar) end if leftchar then post = copy_node(glyph) - setfield(post,"char",leftchar) + setchar(post,leftchar) end setdisc(disc,pre,post,replace,discretionary_code,hyphenpenalty) if attributes then diff --git a/tex/context/base/lang-ini.mkii b/tex/context/base/lang-ini.mkii index 6ad6f02e3..4561f4dd1 100644 --- a/tex/context/base/lang-ini.mkii +++ b/tex/context/base/lang-ini.mkii @@ -670,9 +670,9 @@ \def\nopatterns{\normallanguage\minusone} -%D \XETEX\ is \UNICODE: +%D \XETEX\ (and also \LUATEX) are \UNICODE: -\ifnum\texengine=\xetexengine +\ifnum\texengine>\pdftexengine \def\synchronizepatternswithfont{} \def\doloadpatterns #1#2{\dodoloadpatterns{#1}{#2}\s!default\s!default} diff --git a/tex/context/base/lang-rep.lua b/tex/context/base/lang-rep.lua index 5ee862333..0090d7cc3 100644 --- a/tex/context/base/lang-rep.lua +++ b/tex/context/base/lang-rep.lua @@ -38,14 +38,19 @@ local nuts = nodes.nuts local tonut = nuts.tonut local tonode = nuts.tonode -local setfield = nuts.setfield local getnext = nuts.getnext local getprev = nuts.getprev local getattr = nuts.getattr -local setattr = nuts.setattr local getid = nuts.getid local getchar = nuts.getchar +local setfield = nuts.setfield +local setattr = nuts.setattr +local setlink = nuts.setlink +local setnext = nuts.setnext +local setprev = nuts.setprev +local setchar = nuts.setchar + local insert_node_before = nuts.insert_before local remove_node = nuts.remove local copy_node = nuts.copy @@ -163,7 +168,7 @@ local function tonodes(list,template) local head, current for i=1,#list do local new = copy_node(template) - setfield(new,"char",list[i]) + setchar(new,list[i]) if head then head, current = insert_after(head,current,new) else @@ -196,11 +201,8 @@ function replacements.handler(head) local prev = getprev(current) local next = getnext(last) local list = current - setfield(last,"next",nil) - setfield(prev,"next",next) - if next then - setfield(next,"prev",prev) - end + setnext(last) + setlink(prev,next) current = prev if not current then head = nil @@ -229,7 +231,7 @@ function replacements.handler(head) local list = codes[2] for i=1,#list do new = copy_node(last) - setfield(new,"char",list[i]) + setchar(new,list[i]) setattr(new,a_noligature,1) head, current = insert_after(head,current,new) end @@ -238,7 +240,7 @@ function replacements.handler(head) end else new = copy_node(last) - setfield(new,"char",codes) + setchar(new,codes) head, current = insert_after(head,current,new) end i = i + 1 @@ -246,18 +248,18 @@ function replacements.handler(head) flush_list(list) elseif oldlength == newlength then -- #old == #new for i=1,newlength do - setfield(current,"char",newcodes[i]) + setchar(current,newcodes[i]) current = getnext(current) end elseif oldlength < newlength then -- #old < #new for i=1,newlength-oldlength do local n = copy_node(current) - setfield(n,"char",newcodes[i]) + setchar(n,newcodes[i]) head, current = insert_node_before(head,current,n) current = getnext(current) end for i=newlength-oldlength+1,newlength do - setfield(current,"char",newcodes[i]) + setchar(current,newcodes[i]) current = getnext(current) end else -- #old > #new @@ -265,7 +267,7 @@ function replacements.handler(head) head, current = remove_node(head,current,true) end for i=1,newlength do - setfield(current,"char",newcodes[i]) + setchar(current,newcodes[i]) current = getnext(current) end end diff --git a/tex/context/base/lpdf-ano.lua b/tex/context/base/lpdf-ano.lua index d62fb9e5f..94cc41412 100644 --- a/tex/context/base/lpdf-ano.lua +++ b/tex/context/base/lpdf-ano.lua @@ -353,6 +353,8 @@ local v_tight = variables.tight -- and finger zooming this whole view is rather useless and as with any zooming -- one looses the overview and keeps zooming. +-- todo: scaling + local destinationactions = { -- [v_standard] = function(r,w,h,d) return f_xyz (r,pdfrectangle(w,h,d)) end, -- local left,top with zoom (0 in our case) [v_standard] = function(r,w,h,d) return f_xyz (r,gethpos()*factor,(getvpos()+h)*factor) end, -- local left,top with no zoom diff --git a/tex/context/base/lpdf-fld.lua b/tex/context/base/lpdf-fld.lua index f0aad3623..7e2cd4bdf 100644 --- a/tex/context/base/lpdf-fld.lua +++ b/tex/context/base/lpdf-fld.lua @@ -693,6 +693,12 @@ function codeinjections.setfieldcalculationset(tag) calculationset = tag end +interfaces.implement { + name = "setfieldcalculationset", + actions = codeinjections.setfieldcalculationset, + arguments = "string", +} + local function predefinesymbols(specification) local values = specification.values if values then diff --git a/tex/context/base/lpdf-fmt.lua b/tex/context/base/lpdf-fmt.lua index 862c011b8..ba9bc8f9c 100644 --- a/tex/context/base/lpdf-fmt.lua +++ b/tex/context/base/lpdf-fmt.lua @@ -36,8 +36,6 @@ local pdfstring = lpdf.string local pdfverbose = lpdf.verbose local pdfflushstreamfileobject = lpdf.flushstreamfileobject -local texset = tex.set - local addtoinfo = lpdf.addtoinfo local injectxmpinfo = lpdf.injectxmpinfo local insertxmpinfo = lpdf.insertxmpinfo @@ -339,6 +337,75 @@ local formats = utilities.storage.allocate { injectxmpinfo("xml://rdf:RDF","1B",false) end }, + ["pdf/a-2a"] = { -- untested; only PDF/A Attachments are allowed + pdf_version = 1.7, + format_name = "pdf/a-2a", + xmp_file = "lpdf-pda.xml", + gts_flag = "GTS_PDFA2", + gray_scale = true, + cmyk_colors = true, + rgb_colors = true, + spot_colors = true, + calibrated_rgb_colors = true, -- unknown + cielab_colors = true, -- unknown + include_intents = true, + forms = true, + tagging = true, + internal_icc_profiles = true, + transparency = true, -- NEW + jbig2_compression = true, + jpeg2000_compression = true, -- NEW + object_compression = true, + inject_metadata = function() + injectxmpinfo("xml://rdf:RDF","2A",false) + end + }, + ["pdf/a-3a"] = { -- untested; NEW: any type of attachment is allowed + pdf_version = 1.7, + format_name = "pdf/a-3a", + xmp_file = "lpdf-pda.xml", + gts_flag = "GTS_PDFA3", + gray_scale = true, + cmyk_colors = true, + rgb_colors = true, + spot_colors = true, + calibrated_rgb_colors = true, -- unknown + cielab_colors = true, -- unknown + include_intents = true, + forms = true, + tagging = true, + internal_icc_profiles = true, + transparency = true, + jbig2_compression = true, + jpeg2000_compression = true, + object_compression = true, + inject_metadata = function() + injectxmpinfo("xml://rdf:RDF","3A",false) + end + }, + ["pdf/ua-1"] = { -- based on PDF/A-3a, but no 'gts_flag' + pdf_version = 1.7, + format_name = "pdf/ua-1", + xmp_file = "lpdf-pua.xml", + gray_scale = true, + cmyk_colors = true, + rgb_colors = true, + spot_colors = true, + calibrated_rgb_colors = true, -- unknown + cielab_colors = true, -- unknown + include_intents = true, + forms = true, + tagging = true, + internal_icc_profiles = true, + transparency = true, + jbig2_compression = true, + jpeg2000_compression = true, + object_compression = true, + inject_metadata = function() + injectxmpinfo("xml://rdf:RDF","3A",false) + injectxmpinfo("xml://rdf:RDF","1",false) + end + }, } lpdf.formats = formats -- it does not hurt to have this one visible @@ -654,11 +721,11 @@ function codeinjections.setformat(s) local minorversion = math.mod(pdf_version,10) local objectcompression = spec.object_compression and pdf_version >= 15 local compresslevel = level or tex.pdfcompresslevel -- keep default - local objectcompresslevel = (objectcompression and (level or tex.pdfobjcompresslevel)) or 0 - texset("global","pdfcompresslevel",compresslevel) - texset("global","pdfobjcompresslevel",objectcompresslevel) - texset("global","pdfmajorversion",majorversion) - texset("global","pdfminorversion",minorversion) + local objectcompresslevel = (objectcompression and (level or pdf.getobjcompresslevel())) or 0 + pdf.setcompresslevel (compresslevel) + pdf.setobjcompresslevel(objectcompresslevel) + pdf.setmajorversion (majorversion) + pdf.setminorversion (minorversion) if objectcompression then report_backend("forcing pdf version %s.%s, compression level %s, object compression level %s", majorversion,minorversion,compresslevel,objectcompresslevel) @@ -718,8 +785,8 @@ function codeinjections.setformat(s) report_backend("error, format %a is not supported",format) end elseif level then - texset("global","pdfcompresslevel",level) - texset("global","pdfobjcompresslevel",level) + pdf.setcompresslevel(level) + pdf.setobjcompresslevel(level) else -- we ignore this as we hook it in \everysetupbackend end diff --git a/tex/context/base/lpdf-ini.lua b/tex/context/base/lpdf-ini.lua index 99e533094..a0707c23c 100644 --- a/tex/context/base/lpdf-ini.lua +++ b/tex/context/base/lpdf-ini.lua @@ -72,6 +72,29 @@ if pdf.setinfo then -- the getters are harmless end +do + + local texget = tex.get + local texset = tex.set + + if pdf.setminorversion then + function pdf.setmajorversion (n) texset("global","pdfmajorversion", n) end + function pdf.getmajorversion ( ) return texget("pdfmajorversion") end + else + -- + function pdf.setmajorversion (n) texset("global","pdfmajorversion",n) end + function pdf.setminorversion (n) texset("global","pdfminorversion",n) end + function pdf.setcompresslevel (n) texset("global","pdfcompresslevel",n) end + function pdf.setobjcompresslevel(n) texset("global","pdfobjcompresslevel",n) end + -- + function pdf.getmajorversion ( ) return texget("pdfmajorversion") end + function pdf.getminorversion ( ) return texget("pdfminorversion") end + function pdf.getcompresslevel ( ) return texget("pdfcompresslevel") end + function pdf.getobjcompresslevel( ) return texget("pdfobjcompresslevel") end + end + +end + if not pdf.setinfo then function pdf.setinfo (s) pdf.info = s end function pdf.setcatalog(s) pdf.catalog = s end @@ -80,10 +103,10 @@ if not pdf.setinfo then end if not pdf.getpos then - function pdf.getpos () return pdf.h, pdf.v end - function pdf.gethpos () return pdf.h end - function pdf.getvpos () return pdf.v end - function pdf.hasmatrix() return false end + function pdf.getpos () return pdf.h, pdf.v end + function pdf.gethpos () return pdf.h end + function pdf.getvpos () return pdf.v end + function pdf.hasmatrix() return false end function pdf.getmatrix() return 1, 0, 0, 1, 0, 0 end end @@ -161,44 +184,50 @@ codeinjections.getvpos = pdfgetvpos lpdf.getvpos = pdfgetvpos codeinjections.hasmatrix = pdfhasmatrix lpdf.hasmatrix = pdfhasmatrix codeinjections.getmatrix = pdfgetmatrix lpdf.getmatrix = pdfgetmatrix -function lpdf.transform(llx,lly,urx,ury) +-- local function transform(llx,lly,urx,ury,rx,sx,sy,ry) +-- local x1 = llx * rx + lly * sy +-- local y1 = llx * sx + lly * ry +-- local x2 = llx * rx + ury * sy +-- local y2 = llx * sx + ury * ry +-- local x3 = urx * rx + lly * sy +-- local y3 = urx * sx + lly * ry +-- local x4 = urx * rx + ury * sy +-- local y4 = urx * sx + ury * ry +-- llx = min(x1,x2,x3,x4); +-- lly = min(y1,y2,y3,y4); +-- urx = max(x1,x2,x3,x4); +-- ury = max(y1,y2,y3,y4); +-- return llx, lly, urx, ury +-- end + +function lpdf.transform(llx,lly,urx,ury) -- not yet used so unchecked if pdfhasmatrix() then local sx, rx, ry, sy = pdfgetmatrix() local w, h = urx - llx, ury - lly return llx, lly, llx + sy*w - ry*h, lly + sx*h - rx*w + -- return transform(llx,lly,urx,ury,sx,rx,ry,sy) else return llx, lly, urx, ury end end --- function lpdf.rectangle(width,height,depth) --- local h, v = pdfgetpos() --- local llx, lly, urx, ury --- if pdfhasmatrix() then --- local sx, rx, ry, sy = pdfgetmatrix() --- llx = 0 --- lly = -depth --- -- llx = ry * depth --- -- lly = -sx * depth --- urx = sy * width - ry * height --- ury = sx * height - rx * width --- else --- llx = 0 --- lly = -depth --- urx = width --- ury = height --- return (h+llx)*factor, (v+lly)*factor, (h+urx)*factor, (v+ury)*factor --- end --- end +-- funny values for tx and ty function lpdf.rectangle(width,height,depth) - local h, v = pdfgetpos() + local tx, ty = pdfgetpos() if pdfhasmatrix() then - local sx, rx, ry, sy = pdfgetmatrix() - -- return (h+ry*depth)*factor, (v-sx*depth)*factor, (h+sy*width-ry*height)*factor, (v+sx*height-rx*width)*factor - return h *factor, (v- depth)*factor, (h+sy*width-ry*height)*factor, (v+sx*height-rx*width)*factor + local rx, sx, sy, ry = pdfgetmatrix() + return + factor * tx, + factor * (ty - ry*depth + sx*width), + factor * (tx + rx*width - sy*height), + factor * (ty + ry*height - sx*width) else - return h *factor, (v- depth)*factor, (h+ width )*factor, (v+ height )*factor + return + factor * tx, + factor * (ty - depth), + factor * (tx + width), + factor * (ty + height) end end diff --git a/tex/context/base/lpdf-mis.lua b/tex/context/base/lpdf-mis.lua index 521266ad4..345b9624e 100644 --- a/tex/context/base/lpdf-mis.lua +++ b/tex/context/base/lpdf-mis.lua @@ -17,7 +17,7 @@ if not modules then modules = { } end modules ['lpdf-mis'] = { local next, tostring = next, tostring local format, gsub, formatters = string.format, string.gsub, string.formatters -local texset = tex.set +local texset, texget = tex.set, tex.get local backends, lpdf, nodes = backends, lpdf, nodes @@ -259,26 +259,21 @@ local pagespecs = { local pagespec, topoffset, leftoffset, height, width, doublesided = "default", 0, 0, 0, 0, false local cropoffset, bleedoffset, trimoffset, artoffset = 0, 0, 0, 0 -local pdfpaperheight = tex.normalpageheight -- we use normal because one never knows if an user -local pdfpaperwidth = tex.normalpagewidth -- defines a dimen is defined that overloads the internal - function codeinjections.setupcanvas(specification) local paperheight = specification.paperheight local paperwidth = specification.paperwidth local paperdouble = specification.doublesided if paperheight then texset('global','pageheight',paperheight) - pdfpaperheight = paperheight end if paperwidth then texset('global','pagewidth',paperwidth) - pdfpaperwidth = paperwidth end pagespec = specification.mode or pagespec topoffset = specification.topoffset or 0 leftoffset = specification.leftoffset or 0 - height = specification.height or pdfpaperheight - width = specification.width or pdfpaperwidth + height = specification.height or texget("pageheight") + width = specification.width or texget("pagewidth") -- cropoffset = specification.cropoffset or 0 trimoffset = cropoffset - (specification.trimoffset or 0) @@ -334,7 +329,7 @@ local function documentspecification() }) end addtoinfo ("Trapped", pdfconstant("False")) -- '/Trapped' in /Info, 'Trapped' in XMP - addtocatalog("Version", pdfconstant(format("1.%s",tex.pdfminorversion))) + addtocatalog("Version", pdfconstant(format("1.%s",pdf.getminorversion()))) end -- temp hack: the mediabox is not under our control and has a precision of 4 digits @@ -348,9 +343,9 @@ end local function pagespecification() local llx = leftoffset - local lly = pdfpaperheight + topoffset - height + local lly = texget("pageheight") + topoffset - height local urx = width - leftoffset - local ury = pdfpaperheight - topoffset + local ury = texget("pageheight") - topoffset -- boxes can be cached local function extrabox(WhatBox,offset,always) if offset ~= 0 or always then diff --git a/tex/context/base/lpdf-nod.lua b/tex/context/base/lpdf-nod.lua index 6295947d0..3dd5a6648 100644 --- a/tex/context/base/lpdf-nod.lua +++ b/tex/context/base/lpdf-nod.lua @@ -28,8 +28,8 @@ local pdfliteral = register(new_node("whatsit", whatsitcodes.pdfliteral)) local pdfsave = register(new_node("whatsit", whatsitcodes.pdfsave)) local pdfrestore = register(new_node("whatsit", whatsitcodes.pdfrestore)) local pdfsetmatrix = register(new_node("whatsit", whatsitcodes.pdfsetmatrix)) -local pdfdest = register(new_node("whatsit", whatsitcodes.pdfdest)) setfield(pdfdest,"named_id",1) -- xyz_zoom untouched -local pdfannot = register(new_node("whatsit", whatsitcodes.pdfannot)) +----- pdfdest = register(new_node("whatsit", whatsitcodes.pdfdest)) setfield(pdfdest,"named_id",1) -- xyz_zoom untouched +----- pdfannot = register(new_node("whatsit", whatsitcodes.pdfannot)) local variables = interfaces.variables @@ -108,23 +108,23 @@ nodeinjections.transform = nodepool.pdfsetmatrix function nodepool.pdfannotation(w,h,d,data,n) report("don't use node based annotations!") os.exit() --- local t = copy_node(pdfannot) --- if w and w ~= 0 then --- setfield(t,"width",w) --- end --- if h and h ~= 0 then --- setfield(t,"height",h) --- end --- if d and d ~= 0 then --- setfield(t,"depth",d) --- end --- if n then --- setfield(t,"objnum",n) --- end --- if data and data ~= "" then --- setfield(t,"data",data) --- end --- return t + -- local t = copy_node(pdfannot) + -- if w and w ~= 0 then + -- setfield(t,"width",w) + -- end + -- if h and h ~= 0 then + -- setfield(t,"height",h) + -- end + -- if d and d ~= 0 then + -- setfield(t,"depth",d) + -- end + -- if n then + -- setfield(t,"objnum",n) + -- end + -- if data and data ~= "" then + -- setfield(t,"data",data) + -- end + -- return t end -- (!) The next code in pdfdest.w is wrong: @@ -143,41 +143,41 @@ end function nodepool.pdfdestination(w,h,d,name,view,n) report("don't use node based destinations!") os.exit() --- local t = copy_node(pdfdest) --- local hasdimensions = false --- if w and w ~= 0 then --- setfield(t,"width",w) --- hasdimensions = true --- end --- if h and h ~= 0 then --- setfield(t,"height",h) --- hasdimensions = true --- end --- if d and d ~= 0 then --- setfield(t,"depth",d) --- hasdimensions = true --- end --- if n then --- setfield(t,"objnum",n) --- end --- view = views[view] or view or 1 -- fit is default --- setfield(t,"dest_id",name) --- setfield(t,"dest_type",view) --- if hasdimensions and view == 0 then -- xyz --- -- see (!) s -> m -> t -> r --- -- linked --- local s = copy_node(pdfsave) --- local m = copy_node(pdfsetmatrix) --- local r = copy_node(pdfrestore) --- setfield(m,"data","1 0 0 1") --- setfield(s,"next",m) --- setfield(m,"next",t) --- setfield(t,"next",r) --- setfield(m,"prev",s) --- setfield(t,"prev",m) --- setfield(r,"prev",t) --- return s -- a list --- else --- return t --- end + -- local t = copy_node(pdfdest) + -- local hasdimensions = false + -- if w and w ~= 0 then + -- setfield(t,"width",w) + -- hasdimensions = true + -- end + -- if h and h ~= 0 then + -- setfield(t,"height",h) + -- hasdimensions = true + -- end + -- if d and d ~= 0 then + -- setfield(t,"depth",d) + -- hasdimensions = true + -- end + -- if n then + -- setfield(t,"objnum",n) + -- end + -- view = views[view] or view or 1 -- fit is default + -- setfield(t,"dest_id",name) + -- setfield(t,"dest_type",view) + -- if hasdimensions and view == 0 then -- xyz + -- -- see (!) s -> m -> t -> r + -- -- linked + -- local s = copy_node(pdfsave) + -- local m = copy_node(pdfsetmatrix) + -- local r = copy_node(pdfrestore) + -- setfield(m,"data","1 0 0 1") + -- setfield(s,"next",m) + -- setfield(m,"next",t) + -- setfield(t,"next",r) + -- setfield(m,"prev",s) + -- setfield(t,"prev",m) + -- setfield(r,"prev",t) + -- return s -- a list + -- else + -- return t + -- end end diff --git a/tex/context/base/lpdf-pua.xml b/tex/context/base/lpdf-pua.xml new file mode 100644 index 000000000..c50e1f05b --- /dev/null +++ b/tex/context/base/lpdf-pua.xml @@ -0,0 +1,202 @@ + + + + + + + + application/pdf + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + False + + + + + + + + + + http://ns.adobe.com/pdf/1.3/ + pdf + Adobe PDF Schema + + + + internal + A name object indicating whether the document has been modified to include trapping information + Trapped + Text + + + + + + http://purl.org/dc/elements/1.1/ + pdf + Dubline Core Schema + + + + internal + Subject in Document Properties + description + Text + + + + + + http://ns.adobe.com/pdfx/1.3/ + pdfx + PDF/X ID Schema + + + + external + Name of the ConTeXt job + ConTeXt.Jobname + Text + + + external + Time stamp of ConTeXt version + ConTeXt.Time + Text + + + external + ConTeXt website + ConTeXt.Url + Text + + + external + ConTeXt version + ConTeXt.Version + Text + + + external + Banner of pdftex or one of its successors + PTEX.Fullbanner + Text + + + external + Document identifier + ID + Text + + + + + + http://ns.adobe.com/xap/1.0/mm/ + xmpMM + XMP Media Management Schema + + + + internal + UUID based identifier for specific incarnation of a document + InstanceID + URI + + + + + + http://www.aiim.org/pdfa/ns/id/ + pdfaid + PDF/A ID Schema + + + + internal + Part of PDF/A standard + part + Integer + + + internal + Amendment of PDF/A standard + amd + Text + + + internal + Conformance level of PDF/A standard + conformance + Text + + + + + + http://www.aiim.org/pdfua/ns/id/ + pdfuaid + PDF/UA identification schema + + + + internal + PDF/UA version identifier + part + Integer + + + internal + PDF/UA amendment identifier + amd + Text + + + internal + PDF/UA corrigenda identifier + corr + Text + + + + + + + + + diff --git a/tex/context/base/lpdf-res.lua b/tex/context/base/lpdf-res.lua new file mode 100644 index 000000000..172d74681 --- /dev/null +++ b/tex/context/base/lpdf-res.lua @@ -0,0 +1,39 @@ +if not modules then modules = { } end modules ['lpdf-res'] = { + version = 1.001, + comment = "companion to lpdf-ini.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +local codeinjections = backends.codeinjections +local implement = interfaces.implement + +local nuts = nodes.nuts +local tonut = nodes.tonut + +local setfield = nuts.setfield + +local new_hlist = nuts.pool.hlist + +local saveboxresource = tex.saveboxresource +local useboxresource = tex.useboxresource +local getboxresource = tex.getboxresourcedimensions + +function codeinjections.registerboxresource(n) + return saveboxresource(n,nil,lpdf.collectedresources) +end + +function codeinjections.restoreboxresource(index) + local hbox = new_hlist() + local list, wd, ht, dp = useboxresource(index) + setfield(hbox,"list", tonut(list)) + setfield(hbox,"width", wd) + setfield(hbox,"height", ht) + setfield(hbox,"depth", dp) + return hbox -- so we return a nut ! +end + +function codeinjections.boxresourcedimensions(index) + return getboxresource(index) +end diff --git a/tex/context/base/lpdf-tag.lua b/tex/context/base/lpdf-tag.lua index 828bfed25..3fa8883cb 100644 --- a/tex/context/base/lpdf-tag.lua +++ b/tex/context/base/lpdf-tag.lua @@ -63,7 +63,9 @@ local getattr = nuts.getattr local getprev = nuts.getprev local getnext = nuts.getnext local getlist = nuts.getlist + local setfield = nuts.setfield +local setlink = nuts.setlink local traverse_nodes = nuts.traverse local tosequence = nuts.tosequence @@ -423,11 +425,9 @@ function nodeinjections.addtags(head) if literal then local prev = getprev(start) if prev then - setfield(prev,"next",literal) - setfield(literal,"prev",prev) + setlink(prev,literal) end - setfield(start,"prev",literal) - setfield(literal,"next",start) + setlink(literal,start) if list and getlist(list) == start then setfield(list,"list",literal) end @@ -435,11 +435,9 @@ function nodeinjections.addtags(head) local literal = pdfliteral("EMC") local next = getnext(stop) if next then - setfield(next,"prev",literal) - setfield(literal,"next",next) + setlink(literal,next) end - setfield(stop,"next",literal) - setfield(literal,"prev",stop) + setlink(stop,literal) end top = taglist noftop = noftags @@ -570,11 +568,9 @@ end -- local literal = pdfliteral(result) -- local prev = getprev(start) -- if prev then --- setfield(prev,"next",literal) --- setfield(literal,"prev",prev) +-- setlink(prev,literal) -- end --- setfield(start,"prev",literal) --- setfield(literal,"next",start) +-- setlink(literal,start) -- if list and getlist(list) == start then -- setfield(list,"list",literal) -- end @@ -595,11 +591,9 @@ end -- -- use insert instead: -- local next = getnext(last) -- if next then --- setfield(next,"prev",literal) --- setfield(literal,"next",next) +-- setlink(literal,next) -- end --- setfield(last,"next",literal) --- setfield(literal,"prev",last) +-- setlink(last,literal) -- end -- -- finishpage() diff --git a/tex/context/base/lpdf-xmp.lua b/tex/context/base/lpdf-xmp.lua index b1a795c4b..4526b3738 100644 --- a/tex/context/base/lpdf-xmp.lua +++ b/tex/context/base/lpdf-xmp.lua @@ -151,6 +151,12 @@ end local t = { } for i=1,24 do t[i] = random() end +if not pdf.getcompresslevel then + pdf.getcompresslevel = function() + return tex.pdfcompresslevel or tex.getcount("pdfcompresslevel") + end +end + local function flushxmpinfo() commands.pushrandomseed() commands.setrandomseed(os.time()) @@ -196,7 +202,7 @@ local function flushxmpinfo() logs.poptarget() end blob = format(xpacket,packetid,blob) - if not verbose and tex.pdfcompresslevel > 0 then + if not verbose and pdf.getcompresslevel() > 0 then blob = gsub(blob,">%s+<","><") end local r = pdfflushstreamobject(blob,md,false) -- uncompressed diff --git a/tex/context/base/luat-cod.lua b/tex/context/base/luat-cod.lua index c436ee6d7..51610ee87 100644 --- a/tex/context/base/luat-cod.lua +++ b/tex/context/base/luat-cod.lua @@ -105,7 +105,7 @@ if not environment.luafilechunk then filename = sourcepath .. "/" .. filename end local data = loadfile(filename) - texio.write("<",data and "+ " or "- ",filename,">") + texio.write("term and log","<",data and "+ " or "- ",filename,">") if data then data() end diff --git a/tex/context/base/m-newotf.mkiv b/tex/context/base/m-newotf.mkiv index 84f458ac1..267d124fa 100644 --- a/tex/context/base/m-newotf.mkiv +++ b/tex/context/base/m-newotf.mkiv @@ -22,7 +22,6 @@ \startluacode local files = { "font-otj", -"font-otj-new", "font-otr", "font-cff", "font-ttf", @@ -30,7 +29,6 @@ "font-oup", "font-otl", "font-ots", -"font-ots-new", -- for testing (15% faster variant, but luatex update needed) "font-oto", "font-otd", "font-otc", diff --git a/tex/context/base/m-nodechart.lua b/tex/context/base/m-nodechart.lua index 1413cd8f1..4f2740ef4 100644 --- a/tex/context/base/m-nodechart.lua +++ b/tex/context/base/m-nodechart.lua @@ -57,13 +57,7 @@ end -- subtype width leader spec (stretch shrink ... function formatters.whatsit(n,comment) - local subtype = n.subtype - local whatsit = whatsitcodes[subtype] - if whatsit == "dir" or whatsit == "localpar" then - return format("\\doFLOWdirnode{%s}{%s}{%s}",comment,whatsit,n.dir) - else - return nodecodes[n.id] - end + return whatsitcodes[n.id] or "unknown whatsit" end function formatters.dir(n,comment) diff --git a/tex/context/base/math-dim.lua b/tex/context/base/math-dim.lua index f4fc7905e..b5241cb5a 100644 --- a/tex/context/base/math-dim.lua +++ b/tex/context/base/math-dim.lua @@ -39,6 +39,12 @@ local defaults = { fraction_num_vgap = { default = { "FractionNumeratorGapMin", "default_rule_thickness" }, cramped_display_style = { "FractionNumeratorDisplayStyleGapMin", "3*default_rule_thickness" }, display_style = { "FractionNumeratorDisplayStyleGapMin", "3*default_rule_thickness" }, }, + skewed_fraction_hgap = { default = { "SkewedFractionHorizontalGap", "math_quad/2" }, + cramped_display_style = { "SkewedFractionHorizontalGap", "math_quad/2" }, + display_style = { "SkewedFractionHorizontalGap", "math_quad/2" }, }, + skewed_fraction_vgap = { default = { "SkewedFractionVerticalGap", "x_height" }, + cramped_display_style = { "SkewedFractionVerticalGap", "x_height" }, + display_style = { "SkewedFractionVerticalGap", "x_height" }, }, fraction_rule = { default = { "FractionRuleThickness", "default_rule_thickness" }, }, limit_above_bgap = { default = { "UpperLimitBaselineRiseMin", "big_op_spacing3" }, }, limit_above_vgap = { default = { "UpperLimitGapMin", "big_op_spacing1" }, }, diff --git a/tex/context/base/math-dir.lua b/tex/context/base/math-dir.lua index 0f871beed..e15522191 100644 --- a/tex/context/base/math-dir.lua +++ b/tex/context/base/math-dir.lua @@ -31,9 +31,11 @@ local getnext = nuts.getnext local getchar = nuts.getchar local getid = nuts.getid local getlist = nuts.getlist -local setfield = nuts.setfield local getattr = nuts.getattr +local setfield = nuts.setfield +local setchar = nuts.setchar + local insert_node_before = nuts.insert_before local insert_node_after = nuts.insert_after @@ -94,7 +96,7 @@ local function processmath(head) if mirror then local class = charclasses[char] if class == "open" or class == "close" then - setfield(current,"char",mirror) + setchar(current,mirror) if trace_directions then report_directions("mirrored: %C to %C",char,mirror) end diff --git a/tex/context/base/math-frc.mkiv b/tex/context/base/math-frc.mkiv index bbee610eb..76c2f81fb 100644 --- a/tex/context/base/math-frc.mkiv +++ b/tex/context/base/math-frc.mkiv @@ -561,3 +561,40 @@ % \unexpanded\def\mthfrac#1#2#3{[mthfrac: #1 #2 #3]} % \unexpanded\def\mthsqrt#1#2#3{[mthsqrt: #1 #2 #3]} + +% used for prototypine \Uskewed +% +% \unexpanded\def\skewedfractiona#1#2{% +% \raise +% \Umathskewedfractionvgap\textstyle +% \hbox\bgroup +% $\scriptstyle#1\hskip\dimexpr\Umathskewedfractionhgap\scriptstyle/2\relax$% +% \egroup +% \hbox to \zeropoint\bgroup +% \hss$\textstyle/$\hss +% \egroup +% \lower +% \Umathskewedfractionvgap\textstyle +% \hbox\bgroup +% $\hskip\dimexpr\Umathskewedfractionhgap\scriptstyle/2\relax\scriptstyle#2$% +% \egroup +% } +% +% \unexpanded\def\skewedfractionb#1#2{% +% \raise +% \Umathskewedfractionvgap\textstyle +% \hbox\bgroup +% $\scriptstyle#1\hskip\dimexpr\Umathskewedfractionhgap\textstyle/2\relax$% +% \egroup +% \hbox to \zeropoint\bgroup +% \hss$\textstyle/$\hss +% \egroup +% \lower +% \Umathskewedfractionvgap\textstyle +% \hbox\bgroup +% $\hskip\dimexpr\Umathskewedfractionhgap\textstyle/2\relax\scriptstyle#2$% +% \egroup +% } +% +% $\skewedfractiona{1}{2}$ +% $\skewedfractionb{1}{2}$ diff --git a/tex/context/base/math-ini.mkiv b/tex/context/base/math-ini.mkiv index d0fb0405c..1e1d41534 100644 --- a/tex/context/base/math-ini.mkiv +++ b/tex/context/base/math-ini.mkiv @@ -72,6 +72,12 @@ \def\Umathbotaccent{\Umathaccent \s!bottom } \def\Umathaccents {\Umathaccent \s!both } +\ifdefined\Umathcharclass \else + \def\Umathcharclass{\cldcontext{tex.getmathcode(token.scan_int())[1]}} + \def\Umathcharfam {\cldcontext{tex.getmathcode(token.scan_int())[2]}} + \def\Umathcharslot {\cldcontext{tex.getmathcode(token.scan_int())[3]}} +\fi + %D The attributes that we will use: \definesystemattribute[mathalphabet] [public] @@ -675,6 +681,8 @@ % Once this is stable we can store the number at the tex end which is % faster. Functions getnumbers >= 1000. +% \setupmathematics[functionstyle=normal] % will give ligatures and kerning + \setupmathematics [\c!textstyle=, % rm ss etc i.e. known alternatives, otherwise math \c!textcolor=, @@ -784,6 +792,8 @@ % \let\mfunction \math_function_style_mfunction % \let\mfunctionlabeltext\math_function_style_mfunctionlabeltext}} +\def\currentmscaledstyle{rm} % will be plugged into the typeface text=ss option + \unexpanded\def\mscaledtext#1% {\mathchoice {\hbox{\csname\currentmscaledstyle\endcsname\tf #1}} @@ -794,21 +804,6 @@ \unexpanded\def\setmathfunctionstyle#1% {\setupmathematics[\c!functionstyle=#1]} % for old times sake -%D We can force the way functions are typeset by manipulating the text option: -%D -%D \starttyping -%D \definetypeface[iwona][ss][sans][iwona][default][encoding=texnansi] -%D \definetypeface[iwona][mm][math][iwona][default][encoding=texnansi,text=ss] -%D \stoptyping -%D -%D This hooks into the math handler with: - -% no longer supported this way, has to be done with \setupmathematics -% -% \appendtoks -% \setmathfunctionstyle\currentmathtextstyle -% \to \everybodyfont - %D Usage: %D %D \starttyping @@ -1165,7 +1160,6 @@ \attribute\mathbidiattribute\ifconditional\c_math_right_to_left\c_math_bidi\else\attributeunsetvalue\fi \to \everyswitchmathematics - %D Delayed: greek. %D %D \starttyping @@ -1482,13 +1476,13 @@ \def\triggermathstyle#1% #1 is number {\ifcase\numexpr#1\relax - \displaystyle \or - \crampeddisplaystyle \or - \textstyle \or - \crampedtextstyle \or - \scriptstyle \or - \crampedscriptstyle \or - \scriptscriptstyle \or + \displaystyle \or % 0 + \crampeddisplaystyle \or % 1 + \textstyle \or % 2 + \crampedtextstyle \or % 3 + \scriptstyle \or % 4 + \crampedscriptstyle \or % 5 + \scriptscriptstyle \or % 6 \crampedscriptscriptstyle \else % error \fi} diff --git a/tex/context/base/math-map.lua b/tex/context/base/math-map.lua index add6afa4c..94dde4110 100644 --- a/tex/context/base/math-map.lua +++ b/tex/context/base/math-map.lua @@ -200,6 +200,15 @@ local regular_it = { [0x00070]=0x1D45D, [0x00071]=0x1D45E, [0x00072]=0x1D45F, [0x00073]=0x1D460, [0x00074]=0x1D461, [0x00075]=0x1D462, [0x00076]=0x1D463, [0x00077]=0x1D464, [0x00078]=0x1D465, [0x00079]=0x1D466, [0x0007A]=0x1D467, + -- arabic + [0x00627] = 0x1EE00, [0x00628] = 0x1EE21, [0x0062A] = 0x1EE15, [0x0062B] = 0x1EE16, + [0x0062C] = 0x1EE22, [0x0062D] = 0x1EE07, [0x0062E] = 0x1EE17, [0x0062F] = 0x1EE03, + [0x00630] = 0x1EE18, [0x00631] = 0x1EE13, [0x00632] = 0x1EE06, [0x00633] = 0x1EE0E, + [0x00634] = 0x1EE14, [0x00635] = 0x1EE11, [0x00636] = 0x1EE19, [0x00637] = 0x1EE08, + [0x00638] = 0x1EE1A, [0x00639] = 0x1EE0F, [0x0063A] = 0x1EE1B, [0x00641] = 0x1EE10, + [0x00642] = 0x1EE12, [0x00643] = 0x1EE0A, [0x00644] = 0x1EE0B, [0x00645] = 0x1EE0C, + [0x00646] = 0x1EE0D, [0x00647] = 0x1EE24, [0x00648] = 0x1EE05, [0x0064A] = 0x1EE09, + [0x0066E] = 0x1EE1C, [0x0066F] = 0x1EE1F, [0x006A1] = 0x1EE1E, [0x006BA] = 0x1EE1D, }, ucgreek = { [0x0391]=0x1D6E2, [0x0392]=0x1D6E3, [0x0393]=0x1D6E4, [0x0394]=0x1D6E5, [0x0395]=0x1D6E6, @@ -389,7 +398,24 @@ local blackboard_tf = { [0x00055]=0x1D54C, [0x00056]=0x1D54D, [0x00057]=0x1D54E, [0x00058]=0x1D54F, [0x00059]=0x1D550, [0x0005A]=0x02124, }, - lcletters = tolower(0x1D552), + lcletters = { + -- tolower(0x1D552) : + [0x00061] = 0x1D552, [0x00062] = 0x1D553, [0x00063] = 0x1D554, [0x00064] = 0x1D555, + [0x00065] = 0x1D556, [0x00066] = 0x1D557, [0x00067] = 0x1D558, [0x00068] = 0x1D559, + [0x00069] = 0x1D55A, [0x0006A] = 0x1D55B, [0x0006B] = 0x1D55C, [0x0006C] = 0x1D55D, + [0x0006D] = 0x1D55E, [0x0006E] = 0x1D55F, [0x0006F] = 0x1D560, [0x00070] = 0x1D561, + [0x00071] = 0x1D562, [0x00072] = 0x1D563, [0x00073] = 0x1D564, [0x00074] = 0x1D565, + [0x00075] = 0x1D566, [0x00076] = 0x1D567, [0x00077] = 0x1D568, [0x00078] = 0x1D569, + [0x00079] = 0x1D56A, [0x0007A] = 0x1D56B, + -- arabic + [0x00628] = 0x1EEA1, [0x0062A] = 0x1EEB5, [0x0062B] = 0x1EEB6, [0x0062C] = 0x1EEA2, + [0x0062D] = 0x1EEA7, [0x0062E] = 0x1EEB7, [0x0062F] = 0x1EEA3, [0x00630] = 0x1EEB8, + [0x00631] = 0x1EEB3, [0x00632] = 0x1EEA6, [0x00633] = 0x1EEAE, [0x00634] = 0x1EEB4, + [0x00635] = 0x1EEB1, [0x00636] = 0x1EEB9, [0x00637] = 0x1EEA8, [0x00638] = 0x1EEBA, + [0x00639] = 0x1EEAF, [0x0063A] = 0x1EEBB, [0x00641] = 0x1EEB0, [0x00642] = 0x1EEB2, + [0x00644] = 0x1EEAB, [0x00645] = 0x1EEAC, [0x00646] = 0x1EEAD, [0x00648] = 0x1EEA5, + [0x0064A] = 0x1EEA9, + }, lcgreek = { -- gamma pi [0x03B3]=0x0213C, [0x03C0]=0x0213D, }, diff --git a/tex/context/base/math-noa.lua b/tex/context/base/math-noa.lua index 39c56c59f..85759ddf1 100644 --- a/tex/context/base/math-noa.lua +++ b/tex/context/base/math-noa.lua @@ -19,12 +19,6 @@ if not modules then modules = { } end modules ['math-noa'] = { -- 20D6 -> 2190 -- 20D7 -> 2192 --- future luatex will return font for a math char too --- --- local function getfont(n) --- return font_of_family(getfield(n,"fam")) --- end - -- todo: most is math_char so we can have simple dedicated loops -- nota bene: uunderdelimiter uoverdelimiter etc are radicals (we have 5 types) @@ -88,14 +82,20 @@ local tonut = nuts.tonut local tonode = nuts.tonode local nutstring = nuts.tostring -local getfield = nuts.getfield local setfield = nuts.setfield +local setlink = nuts.setlink +local setnext = nuts.setnext +local setprev = nuts.setprev +local setchar = nuts.setchar + +local getfield = nuts.getfield local getnext = nuts.getnext local getprev = nuts.getprev +local getboth = nuts.getboth local getid = nuts.getid ------ getfont = nuts.getfont local getsubtype = nuts.getsubtype local getchar = nuts.getchar +local getfont = nuts.getfont local getattr = nuts.getattr local setattr = nuts.setattr @@ -360,7 +360,8 @@ noads.process = processnoads noads.processnested = processnested noads.processouter = process --- + +-- experiment (when not present fall back to fam 0) -- needs documentation local unknowns = { } local checked = { } -- simple case @@ -402,8 +403,6 @@ local function errorchar(font,char) end end --- experiment (when not present fall back to fam 0) -- needs documentation - -- 0-2 regular -- 3-5 bold -- 6-8 pseudobold @@ -411,219 +410,229 @@ end -- this could best be integrated in the remapper, and if we run into problems, we -- might as well do this -local families = { } -local a_mathfamily = privateattribute("mathfamily") -local boldmap = mathematics.boldmap - -local familymap = { [0] = - "regular", - "regular", - "regular", - "bold", - "bold", - "bold", - "pseudobold", - "pseudobold", - "pseudobold", -} +do -families[math_char] = function(pointer) - if getfield(pointer,"fam") == 0 then - local a = getattr(pointer,a_mathfamily) - if a and a > 0 then - setattr(pointer,a_mathfamily,0) - if a > 5 then - local char = getchar(pointer) - local bold = boldmap[char] - local newa = a - 3 - if not bold then - if trace_families then - report_families("no bold replacement for %C, family %s with remap %s becomes %s with remap %s",char,a,familymap[a],newa,familymap[newa]) - end - setfield(pointer,"fam",newa) - elseif not fontcharacters[font_of_family(newa)][bold] then - if trace_families then - report_families("no bold character for %C, family %s with remap %s becomes %s with remap %s",char,a,familymap[a],newa,familymap[newa]) - end - if newa > 3 then - setfield(pointer,"fam",newa-3) - end - else - setattr(pointer,a_exportstatus,char) - setfield(pointer,"char",bold) - if trace_families then - report_families("replacing %C by bold %C, family %s with remap %s becomes %s with remap %s",char,bold,a,familymap[a],newa,familymap[newa]) - end - setfield(pointer,"fam",newa) - end - else - local char = getchar(pointer) - if not fontcharacters[font_of_family(a)][char] then - if trace_families then - report_families("no bold replacement for %C",char) + local families = { } + local a_mathfamily = privateattribute("mathfamily") + local boldmap = mathematics.boldmap + + local familymap = { [0] = + "regular", + "regular", + "regular", + "bold", + "bold", + "bold", + "pseudobold", + "pseudobold", + "pseudobold", + } + + families[math_char] = function(pointer) + if getfield(pointer,"fam") == 0 then + local a = getattr(pointer,a_mathfamily) + if a and a > 0 then + setattr(pointer,a_mathfamily,0) + if a > 5 then + local char = getchar(pointer) + local bold = boldmap[char] + local newa = a - 3 + if not bold then + if trace_families then + report_families("no bold replacement for %C, family %s with remap %s becomes %s with remap %s",char,a,familymap[a],newa,familymap[newa]) + end + setfield(pointer,"fam",newa) + elseif not fontcharacters[font_of_family(newa)][bold] then + if trace_families then + report_families("no bold character for %C, family %s with remap %s becomes %s with remap %s",char,a,familymap[a],newa,familymap[newa]) + end + if newa > 3 then + setfield(pointer,"fam",newa-3) + end + else + setattr(pointer,a_exportstatus,char) + setchar(pointer,bold) + if trace_families then + report_families("replacing %C by bold %C, family %s with remap %s becomes %s with remap %s",char,bold,a,familymap[a],newa,familymap[newa]) + end + setfield(pointer,"fam",newa) end else - if trace_families then - report_families("family of %C becomes %s with remap %s",char,a,familymap[a]) + local char = getchar(pointer) + if not fontcharacters[font_of_family(a)][char] then + if trace_families then + report_families("no bold replacement for %C",char) + end + else + if trace_families then + report_families("family of %C becomes %s with remap %s",char,a,familymap[a]) + end + setfield(pointer,"fam",a) end - setfield(pointer,"fam",a) end end end end -end -families[math_delim] = function(pointer) - if getfield(pointer,"small_fam") == 0 then - local a = getattr(pointer,a_mathfamily) - if a and a > 0 then - setattr(pointer,a_mathfamily,0) - if a > 5 then - -- no bold delimiters in unicode - a = a - 3 - end - local char = getfield(pointer,"small_char") - local okay = fontcharacters[font_of_family(a)][char] - if okay then - setfield(pointer,"small_fam",a) - elseif a > 2 then - setfield(pointer,"small_fam",a-3) - end - local char = getfield(pointer,"large_char") - local okay = fontcharacters[font_of_family(a)][char] - if okay then - setfield(pointer,"large_fam",a) - elseif a > 2 then - setfield(pointer,"large_fam",a-3) + families[math_delim] = function(pointer) + if getfield(pointer,"small_fam") == 0 then + local a = getattr(pointer,a_mathfamily) + if a and a > 0 then + setattr(pointer,a_mathfamily,0) + if a > 5 then + -- no bold delimiters in unicode + a = a - 3 + end + local char = getfield(pointer,"small_char") + local okay = fontcharacters[font_of_family(a)][char] + if okay then + setfield(pointer,"small_fam",a) + elseif a > 2 then + setfield(pointer,"small_fam",a-3) + end + local char = getfield(pointer,"large_char") + local okay = fontcharacters[font_of_family(a)][char] + if okay then + setfield(pointer,"large_fam",a) + elseif a > 2 then + setfield(pointer,"large_fam",a-3) + end + else + setfield(pointer,"small_fam",0) + setfield(pointer,"large_fam",0) end - else - setfield(pointer,"small_fam",0) - setfield(pointer,"large_fam",0) end end -end -families[math_textchar] = families[math_char] + families[math_textchar] = families[math_char] + + function handlers.families(head,style,penalties) + processnoads(head,families,"families") + return true + end -function handlers.families(head,style,penalties) - processnoads(head,families,"families") - return true end -- character remapping -local a_mathalphabet = privateattribute("mathalphabet") -local a_mathgreek = privateattribute("mathgreek") - -processors.relocate = { } +do -local function report_remap(tag,id,old,new,extra) - report_remapping("remapping %s in font %s from %C to %C%s",tag,id,old,new,extra) -end + local a_mathalphabet = privateattribute("mathalphabet") + local a_mathgreek = privateattribute("mathgreek") -local remapalphabets = mathematics.remapalphabets -local fallbackstyleattr = mathematics.fallbackstyleattr -local setnodecolor = nodes.tracers.colors.set + processors.relocate = { } -local function checked(pointer) - local char = getchar(pointer) - local fam = getfield(pointer,"fam") - local id = font_of_family(fam) - local tc = fontcharacters[id] - if not tc[char] then - local specials = characters.data[char].specials - if specials and (specials[1] == "char" or specials[1] == "font") then - newchar = specials[#specials] - if trace_remapping then - report_remap("fallback",id,char,newchar) - end - if trace_analyzing then - setnodecolor(pointer,"font:isol") - end - setattr(pointer,a_exportstatus,char) -- testcase: exponentiale - setfield(pointer,"char",newchar) - return true - end + local function report_remap(tag,id,old,new,extra) + report_remapping("remapping %s in font %s from %C to %C%s",tag,id,old,new,extra) end -end -processors.relocate[math_char] = function(pointer) - local g = getattr(pointer,a_mathgreek) or 0 - local a = getattr(pointer,a_mathalphabet) or 0 - local char = getchar(pointer) - local fam = getfield(pointer,"fam") - local font = font_of_family(fam) - local characters = fontcharacters[font] - if a > 0 or g > 0 then - if a > 0 then - setattr(pointer,a_mathgreek,0) - end - if g > 0 then - setattr(pointer,a_mathalphabet,0) - end - local newchar = remapalphabets(char,a,g) - if newchar then - if characters[newchar] then + local remapalphabets = mathematics.remapalphabets + local fallbackstyleattr = mathematics.fallbackstyleattr + local setnodecolor = nodes.tracers.colors.set + + local function checked(pointer) + local char = getchar(pointer) + -- local fam = getfield(pointer,"fam") + -- local font = font_of_family(fam) + local font = getfont(pointer) + local data = fontcharacters[font] + if not data[char] then + local specials = characters.data[char].specials + if specials and (specials[1] == "char" or specials[1] == "font") then + local newchar = specials[#specials] if trace_remapping then - report_remap("char",font,char,newchar) + report_remap("fallback",font,char,newchar) end if trace_analyzing then setnodecolor(pointer,"font:isol") end - setfield(pointer,"char",newchar) + setattr(pointer,a_exportstatus,char) -- testcase: exponentiale + setchar(pointer,newchar) return true - else - local fallback = fallbackstyleattr(a) - if fallback then - local newchar = remapalphabets(char,fallback,g) - if newchar then - if characters[newchar] then - if trace_remapping then - report_remap("char",font,char,newchar," (fallback remapping used)") - end - if trace_analyzing then - setnodecolor(pointer,"font:isol") + end + end + end + + processors.relocate[math_char] = function(pointer) + local g = getattr(pointer,a_mathgreek) or 0 + local a = getattr(pointer,a_mathalphabet) or 0 + local char = getchar(pointer) + -- local fam = getfield(pointer,"fam") + -- local font = font_of_family(fam) + local font = getfont(pointer) + local characters = fontcharacters[font] + if a > 0 or g > 0 then + if a > 0 then + setattr(pointer,a_mathgreek,0) + end + if g > 0 then + setattr(pointer,a_mathalphabet,0) + end + local newchar = remapalphabets(char,a,g) + if newchar then + if characters[newchar] then + if trace_remapping then + report_remap("char",font,char,newchar) + end + if trace_analyzing then + setnodecolor(pointer,"font:isol") + end + setchar(pointer,newchar) + return true + else + local fallback = fallbackstyleattr(a) + if fallback then + local newchar = remapalphabets(char,fallback,g) + if newchar then + if characters[newchar] then + if trace_remapping then + report_remap("char",font,char,newchar," (fallback remapping used)") + end + if trace_analyzing then + setnodecolor(pointer,"font:isol") + end + setchar(pointer,newchar) + return true + elseif trace_remapping then + report_remap("char",font,char,newchar," fails (no fallback character)") end - setfield(pointer,"char",newchar) - return true elseif trace_remapping then - report_remap("char",font,char,newchar," fails (no fallback character)") + report_remap("char",font,char,newchar," fails (no fallback remap character)") end elseif trace_remapping then - report_remap("char",font,char,newchar," fails (no fallback remap character)") + report_remap("char",font,char,newchar," fails (no fallback style)") end - elseif trace_remapping then - report_remap("char",font,char,newchar," fails (no fallback style)") end end end + if not characters[char] then + setchar(pointer,errorchar(font,char)) + end + if trace_analyzing then + setnodecolor(pointer,"font:medi") + end + if check_coverage then + return checked(pointer) + end end - if not characters[char] then - setfield(pointer,"char",errorchar(font,char)) - end - if trace_analyzing then - setnodecolor(pointer,"font:medi") - end - if check_coverage then - return checked(pointer) + + processors.relocate[math_textchar] = function(pointer) + if trace_analyzing then + setnodecolor(pointer,"font:init") + end end -end -processors.relocate[math_textchar] = function(pointer) - if trace_analyzing then - setnodecolor(pointer,"font:init") + processors.relocate[math_delim] = function(pointer) + if trace_analyzing then + setnodecolor(pointer,"font:fina") + end end -end -processors.relocate[math_delim] = function(pointer) - if trace_analyzing then - setnodecolor(pointer,"font:fina") + function handlers.relocate(head,style,penalties) + processnoads(head,processors.relocate,"relocate") + return true end -end -function handlers.relocate(head,style,penalties) - processnoads(head,processors.relocate,"relocate") - return true end -- rendering (beware, not exported) @@ -640,11 +649,12 @@ processors.render[math_char] = function(pointer) if renderset then local newchar = renderset[char] if newchar then - local fam = getfield(pointer,"fam") - local font = font_of_family(fam) + -- local fam = getfield(pointer,"fam") + -- local font = font_of_family(fam) + local font = getfont(pointer) local characters = fontcharacters[font] if characters and characters[newchar] then - setfield(pointer,"char",newchar) + setchar(pointer,newchar) setattr(pointer,a_exportstatus,char) end end @@ -725,10 +735,8 @@ local function makelist(noad,f_o,o_next,c_prev,f_c,middle) setfield(list,"head",f_o) setfield(noad,"subtype",noad_inner) setfield(noad,"nucleus",list) - setfield(f_o,"next",o_next) - setfield(o_next,"prev",f_o) - setfield(f_c,"prev",c_prev) - setfield(c_prev,"next",f_c) + setlink(f_o,o_next) + setlink(c_prev,f_c) if middle and next(middle) then local prev = f_o local current = o_next @@ -741,11 +749,8 @@ local function makelist(noad,f_o,o_next,c_prev,f_c,middle) free_node(current) middle[current] = nil -- replace_node --- print(">>>",prev,m) -- weird, can differ - setfield(prev,"next",fence) - setfield(fence,"prev",prev) - setfield(next,"prev",fence) - setfield(fence,"next",next) + setlink(prev,fence) + setlink(fence,next) prev = fence current = next else @@ -757,10 +762,8 @@ local function makelist(noad,f_o,o_next,c_prev,f_c,middle) end local function convert_both(open,close,middle) - local o_next = getnext(open) - -- local o_prev = getprev(open) - local c_next = getnext(close) - local c_prev = getprev(close) + local o_prev, o_next = getboth(open) + local c_prev, c_next = getboth(close) if o_next == close then return close else @@ -770,9 +773,9 @@ local function convert_both(open,close,middle) setfield(close,"nucleus",nil) free_node(close) if c_next then - setfield(c_next,"prev",open) + setprev(c_next,open) end - setfield(open,"next",c_next) + setnext(open,c_next) return open end end @@ -780,15 +783,13 @@ end local function convert_open(open,last,middle) local f_o = makefence(left_fence_code,open) local f_c = makefence(right_fence_code) - local o_next = getnext(open) - -- local o_prev = getprev(open) - local l_next = getnext(last) - -- local l_prev = getprev(last) + local o_prev, o_next = getboth(open) + local l_prev, l_next = getboth(last) makelist(open,f_o,o_next,last,f_c,middle) if l_next then - setfield(l_next,"prev",open) + setprev(l_next,open) end - setfield(open,"next",l_next) + setnext(open,l_next) return open end @@ -928,7 +929,7 @@ local function replace(pointer,what,n,parent) end stop_super = next next = getnext(next) - setfield(nextnucleus,"char",s) + setchar(nextnucleus,s) replaced[char] = (replaced[char] or 0) + 1 if trace_normalizing then report_normalizing("superscript %C becomes %C",char,s) @@ -944,7 +945,7 @@ local function replace(pointer,what,n,parent) end stop_sub = next next = getnext(next) - setfield(nextnucleus,"char",s) + setchar(nextnucleus,s) replaced[char] = (replaced[char] or 0) + 1 if trace_normalizing then report_normalizing("subscript %C becomes %C",char,s) @@ -966,9 +967,9 @@ local function replace(pointer,what,n,parent) setfield(pointer,"sup",list) end if mode == "super" then - setfield(pointer,"next",getnext(stop_super)) + setnext(pointer,getnext(stop_super)) end - setfield(stop_super,"next",nil) + setnext(stop_super) end if start_sub then if start_sub == stop_sub then @@ -979,9 +980,9 @@ local function replace(pointer,what,n,parent) setfield(pointer,"sub",list) end if mode == "sub" then - setfield(pointer,"next",getnext(stop_sub)) + setnext(pointer,getnext(stop_sub)) end - setfield(stop_sub,"next",nil) + setnext(stop_sub) end -- we could return stop end @@ -1110,19 +1111,21 @@ alternate[math_char] = function(pointer) local a = getattr(pointer,a_mathalternate) if a and a > 0 then setattr(pointer,a_mathalternate,0) - local tfmdata = fontdata[font_of_family(getfield(pointer,"fam"))] -- we can also have a famdata + -- local tfmdata = fontdata[font_of_family(getfield(pointer,"fam"))] + local tfmdata = fontdata[getfont(pointer)] local resources = tfmdata.resources -- was tfmdata.shared if resources then local mathalternatesattributes = resources.mathalternatesattributes if mathalternatesattributes then local what = mathalternatesattributes[a] - local alt = otf.getalternate(tfmdata,getchar(pointer),what.feature,what.value) - if alt then + local char = getchar(pointer) + local alt = otf.getalternate(tfmdata,char,what.feature,what.value) + if alt ~= char then if trace_alternates then report_alternates("alternate %a, value %a, replacing glyph %U by glyph %U", tostring(what.feature),tostring(what.value),getchar(pointer),alt) end - setfield(pointer,"char",alt) + setchar(pointer,alt) end end end @@ -1164,7 +1167,7 @@ local function insert_kern(current,kern) local sub = new_node(math_sub) -- todo: pool local noad = new_node(math_noad) -- todo: pool setfield(sub,"list",kern) - setfield(kern,"next",noad) + setnext(kern,noad) setfield(noad,"nucleus",current) return sub end @@ -1237,7 +1240,8 @@ italics[math_char] = function(pointer,what,n,parent) local method = getattr(pointer,a_mathitalics) if method and method > 0 and method < 100 then local char = getchar(pointer) - local font = font_of_family(getfield(pointer,"fam")) -- todo: table + -- local font = font_of_family(getfield(pointer,"fam")) -- todo: table + local font = getfont(pointer) local correction, visual = getcorrection(method,font,char) if correction and correction ~= 0 then local next_noad = getnext(parent) @@ -1358,14 +1362,14 @@ local function movesubscript(parent,current_nucleus,current_char) if prev and getid(prev) == math_noad then if not getfield(prev,"sup") and not getfield(prev,"sub") then -- {f} {'}_n => f_n^' - setfield(current_nucleus,"char",movesub[current_char or getchar(current_nucleus)]) + setchar(current_nucleus,movesub[current_char or getchar(current_nucleus)]) local nucleus = getfield(parent,"nucleus") local sub = getfield(parent,"sub") local sup = getfield(parent,"sup") setfield(prev,"sup",nucleus) setfield(prev,"sub",sub) local dummy = copy_node(nucleus) - setfield(dummy,"char",0) + setchar(dummy,0) setfield(parent,"nucleus",dummy) setfield(parent,"sub",nil) if trace_collapsing then @@ -1373,12 +1377,12 @@ local function movesubscript(parent,current_nucleus,current_char) end elseif not getfield(prev,"sup") then -- {f} {'}_n => f_n^' - setfield(current_nucleus,"char",movesub[current_char or getchar(current_nucleus)]) + setchar(current_nucleus,movesub[current_char or getchar(current_nucleus)]) local nucleus = getfield(parent,"nucleus") local sup = getfield(parent,"sup") setfield(prev,"sup",nucleus) local dummy = copy_node(nucleus) - setfield(dummy,"char",0) + setchar(dummy,0) setfield(parent,"nucleus",dummy) if trace_collapsing then report_collapsing("fixing subscript") @@ -1404,20 +1408,20 @@ local function collapsepair(pointer,what,n,parent,nested) -- todo: switch to tur if getid(next_nucleus) == math_char then local newchar = mathpair[next_char] if newchar then - local fam = getfield(current_nucleus,"fam") - local id = font_of_family(fam) + -- local fam = getfield(current_nucleus,"fam") + -- local id = font_of_family(fam) + local id = getfont(current_nucleus) local characters = fontcharacters[id] if characters and characters[newchar] then if trace_collapsing then report_collapsing("%U + %U => %U",current_char,next_char,newchar) end - setfield(current_nucleus,"char",newchar) + setchar(current_nucleus,newchar) local next_next_noad = getnext(next_noad) if next_next_noad then - setfield(parent,"next",next_next_noad) - setfield(next_next_noad,"prev",parent) + setlink(parent,next_next_noad) else - setfield(parent,"next",nil) + setnext(parent) end setfield(parent,"sup",getfield(next_noad,"sup")) setfield(parent,"sub",getfield(next_noad,"sub")) @@ -1484,7 +1488,8 @@ variants[math_char] = function(pointer,what,n,parent) -- also set export value local nucleus = getfield(next,"nucleus") if nucleus and getid(nucleus) == math_char and getchar(nucleus) == selector then local variant - local tfmdata = fontdata[font_of_family(getfield(pointer,"fam"))] -- we can also have a famdata + -- local tfmdata = fontdata[font_of_family(getfield(pointer,"fam"))] -- we can also have a famdata + local tfmdata = fontdata[getfont(pointer)] local mathvariants = tfmdata.resources.variants -- and variantdata if mathvariants then mathvariants = mathvariants[selector] @@ -1493,7 +1498,7 @@ variants[math_char] = function(pointer,what,n,parent) -- also set export value end end if variant then - setfield(pointer,"char",variant) + setchar(pointer,variant) setattr(pointer,a_exportstatus,char) -- we don't export the variant as it's visual markup if trace_variants then report_variants("variant (%U,%U) replaced by %U",char,selector,variant) @@ -1503,8 +1508,8 @@ variants[math_char] = function(pointer,what,n,parent) -- also set export value report_variants("no variant (%U,%U)",char,selector) end end - setfield(next,"prev",pointer) - setfield(parent,"next",getnext(next)) + setprev(next,pointer) + setnext(parent,getnext(next)) free_node(next) end end @@ -1695,7 +1700,7 @@ do local chr = okay.char local cls = okay.code if chr and chr ~= char then - setfield(pointer,"char",chr) + setchar(pointer,chr) end if cls and cls ~= getsubtype(parent) then setfield(parent,"subtype",cls) diff --git a/tex/context/base/math-tag.lua b/tex/context/base/math-tag.lua index 0d900b3a1..82bc2171c 100644 --- a/tex/context/base/math-tag.lua +++ b/tex/context/base/math-tag.lua @@ -7,6 +7,7 @@ if not modules then modules = { } end modules ['math-tag'] = { } -- todo: have a local list with local tags that then get appended +-- todo: use tex.getmathcodes (no table) -- use lpeg matchers @@ -22,8 +23,10 @@ local tonut = nuts.tonut local getnext = nuts.getnext local getid = nuts.getid local getchar = nuts.getchar +local getfont = nuts.getfont local getlist = nuts.getlist local getfield = nuts.getfield +local getdisc = nuts.getdisc local getsubtype = nuts.getsubtype local getattr = nuts.getattr local setattr = nuts.setattr @@ -88,7 +91,6 @@ local ordinary_code = mathcodes.ordinary local variable_code = mathcodes.variable local fromunicode16 = fonts.mappings.fromunicode16 -local font_of_family = node.family_font local fontcharacters = fonts.hashes.characters local report_tags = logs.reporter("structure","tags") @@ -150,7 +152,8 @@ local fencesstack = { } local function getunicode(n) -- instead of getchar local char = getchar(n) - local font = font_of_family(getfield(n,"fam")) -- font_of_family + -- local font = font_of_family(getfield(n,"fam")) -- font_of_family + local font = getfont(n) local data = fontcharacters[font][char] return data.unicode or char end @@ -316,9 +319,10 @@ process = function(start) -- we cannot use the processor as we have no finalizer elseif id == glyph_code then runner(getfield(n,"components"),depth+1) -- this should not be needed elseif id == disc_code then - runner(getfield(n,"pre"),depth+1) -- idem - runner(getfield(n,"post"),depth+1) -- idem - runner(getfield(n,"replace"),depth+1) -- idem + local pre, post, replace = getdisc(n) + runner(pre,depth+1) -- idem + runner(post,depth+1) -- idem + runner(replace,depth+1) -- idem end if mth == 1 then stop_tagged() diff --git a/tex/context/base/meta-ini.mkiv b/tex/context/base/meta-ini.mkiv index ee697d03a..dd8c9cdfa 100644 --- a/tex/context/base/meta-ini.mkiv +++ b/tex/context/base/meta-ini.mkiv @@ -696,6 +696,9 @@ {\MPllx#2\MPlly#3\MPurx#4\MPury#5% \hbox{\forcecolorhack\getobject{MP}{#1}}} % else no proper color intent +\unexpanded\def\meta_use_box + {\setobject{MP}} + \def\meta_handle_unique_graphic#1#2#3% when there are too many, we can store data at the lua end, although, {\begingroup % when there are that many they're probably not that unique anyway \edef\currentmpvariableclass{#1}% @@ -703,7 +706,7 @@ \ifcsname\??mpgraphic\overlaystamp:#1\endcsname\else \meta_enable_include % redundant \global\advance\c_meta_object_counter\plusone - \setobject{MP}{\number\c_meta_object_counter}\hbox{\meta_process_graphic{#3}}% was vbox, graphic must end up as hbox + \meta_use_box{\number\c_meta_object_counter}\hbox{\meta_process_graphic{#3}}% was vbox, graphic must end up as hbox \setxvalue{\??mpgraphic\overlaystamp:#1}{\meta_reuse_box{\number\c_meta_object_counter}{\the\MPllx}{\the\MPlly}{\the\MPurx}{\the\MPury}}% \fi \getvalue{\??mpgraphic\overlaystamp:#1}% @@ -790,7 +793,7 @@ \fi \meta_enable_include % redundant \global\advance\c_meta_object_counter\plusone - \setobject{MP}{\number\c_meta_object_counter}\hbox{\meta_process_graphic{#3}}% was vbox, graphic must end up as hbox + \meta_use_box{\number\c_meta_object_counter}\hbox{\meta_process_graphic{#3}}% was vbox, graphic must end up as hbox \setxvalue{\??mpgraphic#1}{\meta_reuse_box{\number\c_meta_object_counter}{\the\MPllx}{\the\MPlly}{\the\MPurx}{\the\MPury}}% \getvalue{\??mpgraphic#1}% \endgroup} diff --git a/tex/context/base/meta-pdh.mkiv b/tex/context/base/meta-pdh.mkiv index f3db5b388..c49613d36 100644 --- a/tex/context/base/meta-pdh.mkiv +++ b/tex/context/base/meta-pdh.mkiv @@ -171,8 +171,8 @@ \def\setMPPDFobject#1#2% resources boxnumber {\ifx\everyPDFxform\undefined\else\the\everyPDFxform\fi - \immediate\pdfxform resources{#1}#2% - \edef\getMPPDFobject{\noexpand\pdfrefxform\the\pdflastxform}} + \immediate\saveboxresource resources{#1}#2% + \edef\getMPPDFobject{\noexpand\useboxresource\the\lastsavedboxresourceindex}} \let\getMPPDFobject\relax diff --git a/tex/context/base/mlib-pps.mkiv b/tex/context/base/mlib-pps.mkiv index 07ac84b8d..269e000d5 100644 --- a/tex/context/base/mlib-pps.mkiv +++ b/tex/context/base/mlib-pps.mkiv @@ -134,12 +134,12 @@ \wd\scratchbox \dimexpr#5\onebasepoint-#3\onebasepoint+2\onebasepoint\relax \ht\scratchbox #6\onebasepoint \dp\scratchbox-#4\onebasepoint - \pdfxform + \saveboxresource attr {/Group << /S /Transparency /I \ifnum#1=1 true \else false \fi /K \ifnum#1=1 true \else false \fi >>} resources {\pdfbackendcurrentresources} \scratchbox - \setbox\scratchbox\hbox\bgroup\kern-\onebasepoint\pdfrefxform\pdflastxform\egroup - \setbox\scratchbox\hbox\bgroup\kern-\onebasepoint\pdfrefxform\pdflastxform\egroup + % \setbox\scratchbox\hbox\bgroup\kern-\onebasepoint\useboxresource\lastsavedboxresourceindex\egroup % why twice? + \setbox\scratchbox\hbox\bgroup\kern-\onebasepoint\useboxresource\lastsavedboxresourceindex\egroup \wd\scratchbox\zeropoint \ht\scratchbox\zeropoint \dp\scratchbox\zeropoint diff --git a/tex/context/base/mult-de.mkii b/tex/context/base/mult-de.mkii index bbfc317d5..4efd837ba 100644 --- a/tex/context/base/mult-de.mkii +++ b/tex/context/base/mult-de.mkii @@ -197,6 +197,7 @@ \setinterfacevariable{friday}{freitag} \setinterfacevariable{frontmatter}{einleitungen} \setinterfacevariable{frontpart}{einleitung} +\setinterfacevariable{fullhz}{fullhz} \setinterfacevariable{global}{global} \setinterfacevariable{graphic}{grafik} \setinterfacevariable{graphics}{grafiken} diff --git a/tex/context/base/mult-def.lua b/tex/context/base/mult-def.lua index 679a48710..fb41046be 100644 --- a/tex/context/base/mult-def.lua +++ b/tex/context/base/mult-def.lua @@ -13717,7 +13717,7 @@ return { ["ro"]="ininner", }, ["inleft"]={ - ["cs"]="vlevo", + ["cs"]="ivlevo", -- needs to be different from left ["de"]="imlinken", ["en"]="inleft", ["fr"]="dansgauche", @@ -13839,7 +13839,7 @@ return { ["ro"]="inouter", }, ["inright"]={ - ["cs"]="vpravo", + ["cs"]="ivpravo", -- needs to be different from right ["de"]="imrechten", ["en"]="inright", ["fr"]="dansdroit", @@ -14728,6 +14728,16 @@ return { ["pe"]="nohz", ["ro"]="nohz", }, + ["fullhz"]={ + ["cs"]="fullhz", + ["de"]="fullhz", + ["en"]="fullhz", + ["fr"]="fullhz", + ["it"]="fullhz", + ["nl"]="fullenhz", + ["pe"]="fullhz", + ["ro"]="fullhz", + }, ["nomarking"]={ ["cs"]="zadneznaceni", ["de"]="keinebeschriftung", diff --git a/tex/context/base/mult-dim.mkvi b/tex/context/base/mult-dim.mkvi index ffc04b523..cf4b1f4c8 100644 --- a/tex/context/base/mult-dim.mkvi +++ b/tex/context/base/mult-dim.mkvi @@ -13,6 +13,8 @@ \writestatus{loading}{ConTeXt Core Macros / General} +% we could write a proper parser now in lua + \unprotect %D \macros diff --git a/tex/context/base/mult-en.mkii b/tex/context/base/mult-en.mkii index fa1a353ce..9dccd9e29 100644 --- a/tex/context/base/mult-en.mkii +++ b/tex/context/base/mult-en.mkii @@ -197,6 +197,7 @@ \setinterfacevariable{friday}{friday} \setinterfacevariable{frontmatter}{frontmatter} \setinterfacevariable{frontpart}{frontpart} +\setinterfacevariable{fullhz}{fullhz} \setinterfacevariable{global}{global} \setinterfacevariable{graphic}{graphic} \setinterfacevariable{graphics}{graphics} diff --git a/tex/context/base/mult-fr.mkii b/tex/context/base/mult-fr.mkii index f04fdf98f..e166abd10 100644 --- a/tex/context/base/mult-fr.mkii +++ b/tex/context/base/mult-fr.mkii @@ -197,6 +197,7 @@ \setinterfacevariable{friday}{vendredi} \setinterfacevariable{frontmatter}{preambule} \setinterfacevariable{frontpart}{preface} +\setinterfacevariable{fullhz}{fullhz} \setinterfacevariable{global}{global} \setinterfacevariable{graphic}{graphique} \setinterfacevariable{graphics}{graphiques} diff --git a/tex/context/base/mult-ini.lua b/tex/context/base/mult-ini.lua index c7ba52b3b..c43f8e99f 100644 --- a/tex/context/base/mult-ini.lua +++ b/tex/context/base/mult-ini.lua @@ -274,16 +274,6 @@ function interfaces.cachesetup(t) end end --- if token.lookup then --- interfaces.is_command = token.lookup --- else - - function interfaces.is_command(str) - return (str and str ~= "" and token.csname_name(token.create(str)) ~= "") or false -- there will be a proper function for this - end - --- end - function interfaces.interfacedcommand(name) local command = complete.commands[name] return command and command[currentinterface] or name diff --git a/tex/context/base/mult-it.mkii b/tex/context/base/mult-it.mkii index 8dfc95609..830ca2c7c 100644 --- a/tex/context/base/mult-it.mkii +++ b/tex/context/base/mult-it.mkii @@ -197,6 +197,7 @@ \setinterfacevariable{friday}{venerdi} \setinterfacevariable{frontmatter}{preambolo} \setinterfacevariable{frontpart}{prefazione} +\setinterfacevariable{fullhz}{fullhz} \setinterfacevariable{global}{globale} \setinterfacevariable{graphic}{grafico} \setinterfacevariable{graphics}{grafici} diff --git a/tex/context/base/mult-low.lua b/tex/context/base/mult-low.lua index a94f4a825..1e77b7aa0 100644 --- a/tex/context/base/mult-low.lua +++ b/tex/context/base/mult-low.lua @@ -12,7 +12,7 @@ return { ["constants"] = { -- "zerocount", "minusone", "minustwo", "plusone", "plustwo", "plusthree", "plusfour", "plusfive", - "plussix", "plusseven", "pluseight", "plusnine", "plusten", "plussixteen", "plushundred", + "plussix", "plusseven", "pluseight", "plusnine", "plusten", "plussixteen", "plushundred", "plustwohundred", "plusthousand", "plustenthousand", "plustwentythousand", "medcard", "maxcard", "maxcardminusone", "zeropoint", "onepoint", "halfapoint", "onebasepoint", "maxdimen", "scaledpoint", "thousandpoint", "points", "halfpoint", diff --git a/tex/context/base/mult-nl.mkii b/tex/context/base/mult-nl.mkii index dd039e964..c988a5bff 100644 --- a/tex/context/base/mult-nl.mkii +++ b/tex/context/base/mult-nl.mkii @@ -197,6 +197,7 @@ \setinterfacevariable{friday}{vrijdag} \setinterfacevariable{frontmatter}{inleidingen} \setinterfacevariable{frontpart}{inleiding} +\setinterfacevariable{fullhz}{fullenhz} \setinterfacevariable{global}{globaal} \setinterfacevariable{graphic}{grafiek} \setinterfacevariable{graphics}{grafieken} diff --git a/tex/context/base/mult-pe.mkii b/tex/context/base/mult-pe.mkii index 59586deaa..c0ba4c04e 100644 --- a/tex/context/base/mult-pe.mkii +++ b/tex/context/base/mult-pe.mkii @@ -197,6 +197,7 @@ \setinterfacevariable{friday}{جمعه} \setinterfacevariable{frontmatter}{پیش‌مطلب} \setinterfacevariable{frontpart}{پیش‌قسمت} +\setinterfacevariable{fullhz}{fullhz} \setinterfacevariable{global}{سراسری} \setinterfacevariable{graphic}{گرافیک} \setinterfacevariable{graphics}{گرافیکها} diff --git a/tex/context/base/mult-prm.lua b/tex/context/base/mult-prm.lua index 821905590..feb22e3b2 100644 --- a/tex/context/base/mult-prm.lua +++ b/tex/context/base/mult-prm.lua @@ -84,6 +84,8 @@ return { "Udelimiter", "Udelimiterover", "Udelimiterunder", + "Uhextensible", + "Uleft", "Umathaccent", --"Umathaccents", "Umathaxis", @@ -97,8 +99,12 @@ return { "Umathbinrelspacing", --"Umathbotaccent", "Umathchar", + "Umathcharclass", "Umathchardef", + "Umathcharfam", "Umathcharnum", + "Umathcharnumdef", + "Umathcharslot", "Umathclosebinspacing", "Umathcloseclosespacing", "Umathcloseinnerspacing", @@ -109,6 +115,7 @@ return { "Umathcloserelspacing", "Umathcode", "Umathcodenum", + "Umathcodenumdef", "Umathconnectoroverlapmin", "Umathfractiondelsize", "Umathfractiondenomdown", @@ -183,6 +190,8 @@ return { "Umathrelordspacing", "Umathrelpunctspacing", "Umathrelrelspacing", + "Umathskewedfractionhgap", + "Umathskewedfractionvgap", "Umathspaceafterscript", "Umathstackdenomdown", "Umathstacknumup", @@ -201,9 +210,13 @@ return { "Umathunderbarvgap", "Umathunderdelimiterbgap", "Umathunderdelimitervgap", + "Umiddle", "Uoverdelimiter", "Uradical", + "Uright", "Uroot", + "Uskewed", + "Uskewedwithdelims", "Ustack", "Ustartdisplaymath", "Ustartmath", @@ -212,6 +225,7 @@ return { "Usubscript", "Usuperscript", "Uunderdelimiter", + "Uvextensible", "adjustspacing", "alignmark", "aligntab", @@ -221,10 +235,15 @@ return { "boxdir", "catcodetable", "clearmarks", + "copyfont", "crampeddisplaystyle", "crampedscriptscriptstyle", "crampedscriptstyle", "crampedtextstyle", + "draftmode", + "dviextension", + "dvifeedback", + "dvivariable", "efcode", "fontid", "formatname", @@ -235,6 +254,7 @@ return { "ifprimitive", "ignoreligaturesinfont", "initcatcodetable", + "insertht", "lastsavedboxresourceindex", "lastsavedimageresourceindex", "lastsavedimageresourcepages", @@ -256,12 +276,19 @@ return { "luatexversion", "luafunction", "mathdir", + "mathdisplayskipmode", "matheqnogapstep", + "mathoption", + "mathscriptsmode", "mathstyle", + "mathsurroundskip", "nokerns", + "nohrule", "noligs", + "novrule", "normaldeviate", "outputbox", + "outputmode", "pagedir", "pageheight", "pagebottomoffset", @@ -270,12 +297,16 @@ return { "pagetopoffset", "pagewidth", "pardir", + "pdfextension", + "pdffeedback", + "pdfvariable", "postexhyphenchar", "posthyphenchar", "preexhyphenchar", "prehyphenchar", "primitive", "protrudechars", + "pxdimen", "randomseed", "rightghost", "rightmarginkern", @@ -285,6 +316,7 @@ return { "saveimageresource", "savepos", "scantextokens", + "setfontid", "setrandomseed", "suppressfontnotfounderror", "suppressifcsnameerror", @@ -294,6 +326,7 @@ return { "synctex", "tagcode", "textdir", + "tracingfonts", "uniformdeviate", "useboxresource", "useimageresource", @@ -347,8 +380,11 @@ return { "pdfdest", "pdfdestmargin", "pdfdraftmode", + "pdfeachlineheight", + "pdfeachlinedepth", "pdfendlink", "pdfendthread", + "pdffirstlineheight", "pdffontattr", "pdffontexpand", "pdffontname", @@ -369,6 +405,7 @@ return { "pdfinfo", "pdfinsertht", "pdflastannot", + "pdflastlinedepth", "pdflastlink", "pdflastobj", "pdflastxform", @@ -386,7 +423,6 @@ return { "pdfnormaldeviate", "pdfobj", "pdfobjcompresslevel", - "pdfoptionpdfminorversion", "pdfoutline", "pdfoutput", "pdfpageattr", @@ -450,6 +486,8 @@ return { "Udelimiter", "Udelimiterover", "Udelimiterunder", + "Uhextensible", + "Uleft", "Umathaccent", --"Umathaccents", "Umathaxis", @@ -463,8 +501,12 @@ return { "Umathbinrelspacing", --"Umathbotaccent", "Umathchar", + "Umathcharclass", "Umathchardef", + "Umathcharfam", "Umathcharnum", + "Umathcharnumdef", + "Umathcharslot", "Umathclosebinspacing", "Umathcloseclosespacing", "Umathcloseinnerspacing", @@ -475,6 +517,7 @@ return { "Umathcloserelspacing", "Umathcode", "Umathcodenum", + "Umathcodenumdef", "Umathconnectoroverlapmin", "Umathfractiondelsize", "Umathfractiondenomdown", @@ -549,6 +592,8 @@ return { "Umathrelordspacing", "Umathrelpunctspacing", "Umathrelrelspacing", + "Umathskewedfractionhgap", + "Umathskewedfractionvgap", "Umathspaceafterscript", "Umathstackdenomdown", "Umathstacknumup", @@ -567,9 +612,13 @@ return { "Umathunderbarvgap", "Umathunderdelimiterbgap", "Umathunderdelimitervgap", + "Umiddle", "Uoverdelimiter", "Uradical", + "Uright", "Uroot", + "Uskewed", + "Uskewedwithdelims", "Ustack", "Ustartdisplaymath", "Ustartmath", @@ -578,6 +627,7 @@ return { "Usubscript", "Usuperscript", "Uunderdelimiter", + "Uvextensible", "above", "abovedisplayshortskip", "abovedisplayskip", @@ -603,6 +653,7 @@ return { "bodydir", "botmark", "botmarks", + "boundary", "box", "boxdir", "boxmaxdepth", @@ -622,6 +673,7 @@ return { "clubpenalties", "clubpenalty", "copy", + "copyfont", "count", "countdef", "cr", @@ -661,6 +713,9 @@ return { "doublehyphendemerits", "dp", "dump", + "dviextension", + "dvifeedback", + "dvivariable", "eTeXVersion", "eTeXminorversion", "eTeXrevision", @@ -831,13 +886,18 @@ return { "mathclose", "mathcode", "mathdir", + "mathdisplayskipmode", + "matheqnogapstep", "mathinner", "mathop", "mathopen", + "mathoption", "mathord", "mathpunct", "mathrel", + "mathscriptsmode", "mathstyle", + "mathsurroundskip", "mathsurround", "maxdeadcycles", "maxdepth", @@ -861,7 +921,9 @@ return { "noexpand", "noindent", "nokerns", + "nohrule", "noligs", + "novrule", "nolimits", "nolocaldirs", "nolocalwhatsits", @@ -930,8 +992,13 @@ return { "pdfdest", "pdfdestmargin", "pdfdraftmode", + "pdfeachlineheight", + "pdfeachlinedepth", "pdfendlink", "pdfendthread", + "pdfextension", + "pdfvariable", + "pdffirstlineheight", "pdffontattr", "pdffontexpand", "pdffontname", @@ -942,6 +1009,7 @@ return { "pdfglyphtounicode", "pdfhorigin", "pdfignoreddimen", + "pdfimageaddfilename", "pdfimageapplygamma", "pdfimagegamma", "pdfimagehicolor", @@ -952,6 +1020,7 @@ return { "pdfinfo", "pdfinsertht", "pdflastannot", + "pdflastlinedepth", "pdflastlink", "pdflastobj", "pdflastxform", @@ -969,7 +1038,6 @@ return { "pdfnormaldeviate", "pdfobj", "pdfobjcompresslevel", - "pdfoptionpdfminorversion", "pdfoutline", "pdfoutput", "pdfpageattr", @@ -1026,6 +1094,7 @@ return { "prevgraf", "primitive", "protected", + "pxdimen", "quitvmode", "radical", "raise", @@ -1056,6 +1125,7 @@ return { "scriptstyle", "scrollmode", "setbox", + "setfontid", "setlanguage", "setrandomseed", "sfcode", @@ -1107,6 +1177,7 @@ return { "topskip", "tracingassigns", "tracingcommands", + "tracingfonts", "tracinggroups", "tracingifs", "tracinglostchars", diff --git a/tex/context/base/mult-ro.mkii b/tex/context/base/mult-ro.mkii index 1d336d3f9..0d28a926b 100644 --- a/tex/context/base/mult-ro.mkii +++ b/tex/context/base/mult-ro.mkii @@ -197,6 +197,7 @@ \setinterfacevariable{friday}{vineri} \setinterfacevariable{frontmatter}{prologul} \setinterfacevariable{frontpart}{prolog} +\setinterfacevariable{fullhz}{fullhz} \setinterfacevariable{global}{global} \setinterfacevariable{graphic}{graficul} \setinterfacevariable{graphics}{graficele} diff --git a/tex/context/base/node-acc.lua b/tex/context/base/node-acc.lua index e684aeb7b..716b3ef4d 100644 --- a/tex/context/base/node-acc.lua +++ b/tex/context/base/node-acc.lua @@ -24,6 +24,8 @@ local getnext = nuts.getnext local setfield = nuts.setfield local setattr = nuts.setattr +local setlink = nuts.setlink +local setchar = nuts.setchar local traverse_nodes = nuts.traverse local traverse_id = nuts.traverse_id @@ -71,13 +73,11 @@ local function injectspaces(head) local s = getfield(n,"spec") s = s == 0 and new_gluespec(0) or copy_node(s) -- - setfield(g,"char",32) + setchar(g,32) setfield(n,"spec",s) -- insert_after(p,p,g) - setfield(p,"next",g) - setfield(g,"prev",p) - setfield(g,"next",n) - setfield(n,"prev",g) + setlink(p,g) + setlink(g,n) setfield(s,"width",getfield(s,"width") - getfield(g,"width")) if a then setattr(g,a_characters,a) diff --git a/tex/context/base/node-aux.lua b/tex/context/base/node-aux.lua index ec408c71a..bcc0afa25 100644 --- a/tex/context/base/node-aux.lua +++ b/tex/context/base/node-aux.lua @@ -35,9 +35,13 @@ local getlist = nuts.getlist local getfont = nuts.getfont local getchar = nuts.getchar local getattr = nuts.getattr -local setfield = nuts.setfield local getfield = nuts.getfield + +local setfield = nuts.setfield local setattr = nuts.setattr +local setlink = nuts.setlink +local setnext = nuts.setnext +local setprev = nuts.setprev local traverse_nodes = nuts.traverse local traverse_id = nuts.traverse_id @@ -172,22 +176,6 @@ nuts.unsetattributes = unset_attributes nodes.unsetattribut -- history: -- --- function nodes.is_skipable(a,id) -- skipable nodes at the margins during character protrusion --- return ( --- id ~= glyph_node --- or id == ins_node --- or id == mark_node --- or id == adjust_node --- or id == penalty_node --- or (id == glue_node and a.spec.writable) --- or (id == disc_node and getfield(a,"pre") == nil and getfield(a,"post") == nil and getfield(a,"replace") == nil) --- or (id == math_node and getfield(a,"surround") == 0) --- or (id == kern_node and (getfield(a,"kern") == 0 or getsubtype(subtype) == NORMAL)) --- or (id == hlist_node and getfield(a,"width") == 0 and getfield(a,"height") == 0 and getfield(a,"depth") == 0 and getlist(a) == nil) --- or (id == whatsit_node and getsubtype(a) ~= pdf_refximage_node and getsubtype(a) ~= pdf_refxform_node) --- ) --- end --- -- local function glyph_width(a) -- local ch = chardata[getfont(a)][getchar(a)] -- return (ch and ch.width) or 0 @@ -468,8 +456,8 @@ local function link(list,currentfont,currentattr,head,tail) -- an oldie, might b elseif not head then head, tail = h, t else - setfield(tail,"next",h) - setfield(h,"prev",t) + setnext(tail,h) + setprev(h,t) tail = t end end @@ -492,8 +480,7 @@ local function link(list,currentfont,currentattr,head,tail) -- an oldie, might b end os.exit() else - setfield(tail,"next",n) - setfield(n,"prev",tail) + setlink(tail,n) if getnext(n) then tail = find_tail(n) else diff --git a/tex/context/base/node-bck.lua b/tex/context/base/node-bck.lua index 99992de09..1be0669ba 100644 --- a/tex/context/base/node-bck.lua +++ b/tex/context/base/node-bck.lua @@ -28,19 +28,20 @@ local tonode = nuts.tonode local tonut = nuts.tonut local getfield = nuts.getfield -local setfield = nuts.setfield local getnext = nuts.getnext local getprev = nuts.getprev local getid = nuts.getid local getlist = nuts.getlist local getattr = nuts.getattr -local setattr = nuts.setattr local getsubtype = nuts.getsubtype +local setfield = nuts.setfield +local setattr = nuts.setattr +local setlink = nuts.setlink + local traverse = nuts.traverse local traverse_id = nuts.traverse_id - local new_rule = nodepool.rule local new_glue = nodepool.glue @@ -85,11 +86,9 @@ local function add_backgrounds(head) -- rather old code .. to be redone if transparency then setattr(rule,a_transparency,transparency) end - setfield(rule,"next",glue) - setfield(glue,"prev",rule) + setlink(rule,glue) if list then - setfield(glue,"next",list) - setfield(list,"prev",glue) + setlink(glue,list) end setfield(current,"list",rule) end @@ -146,11 +145,9 @@ local function add_alignbackgrounds(head) if transparency then setattr(rule,a_transparency,transparency) end - setfield(rule,"next",glue) - setfield(glue,"prev",rule) + setlink(rule,glue) if list then - setfield(glue,"next",list) - setfield(list,"prev",glue) + setlink(glue,list) end setfield(current,"list",rule) end diff --git a/tex/context/base/node-fin.lua b/tex/context/base/node-fin.lua index 84c5b9a2f..d83dceb9f 100644 --- a/tex/context/base/node-fin.lua +++ b/tex/context/base/node-fin.lua @@ -34,6 +34,7 @@ local insert_node_after = nuts.insert_after local nodecodes = nodes.nodecodes local whatcodes = nodes.whatcodes +local rulecodes = nodes.rulecodes local glyph_code = nodecodes.glyph local disc_code = nodecodes.disc @@ -43,6 +44,8 @@ local whatsit_code = nodecodes.whatsit local hlist_code = nodecodes.hlist local vlist_code = nodecodes.vlist +local normal_rule = rulecodes.normal + local pdfliteral_code = whatcodes.pdfliteral local states = attributes.states @@ -215,7 +218,9 @@ local function process(namespace,attribute,head,inheritance,default) -- one attr -- end nested -- end elseif id == rule_code then +-- if subtype(stack) == normal_rule then check = getfield(stack,"width") ~= 0 +-- end end -- much faster this way than using a check() and nested() function if check then @@ -330,7 +335,9 @@ local function selective(namespace,attribute,head,inheritance,default) -- two at -- end nested end elseif id == rule_code then +-- if subtype(stack) == normal_rule then check = getfield(stack,"width") ~= 0 +-- end end if check then @@ -449,7 +456,9 @@ local function stacked(namespace,attribute,head,default) -- no triggering, no in end end elseif id == rule_code then +-- if subtype(stack) == normal_rule then check = getfield(stack,"width") ~= 0 +-- end end if check then @@ -535,7 +544,9 @@ local function stacker(namespace,attribute,head,default) -- no triggering, no in done = done or ok end elseif id == rule_code then +-- if subtype(stack) == normal_rule then check = getfield(current,"width") ~= 0 +-- end end if check then diff --git a/tex/context/base/node-fnt.lua b/tex/context/base/node-fnt.lua index ff02c0930..667cf4d62 100644 --- a/tex/context/base/node-fnt.lua +++ b/tex/context/base/node-fnt.lua @@ -46,7 +46,9 @@ local getchar = nuts.getchar local getnext = nuts.getnext local getprev = nuts.getprev local getfield = nuts.getfield -local setfield = nuts.setfield +----- getdisc = nuts.getdisc +local setchar = nuts.setchar +local setlink = nuts.setlink local traverse_id = nuts.traverse_id local delete_node = nuts.delete @@ -239,7 +241,7 @@ function handlers.characters(head) if trace_variants then report_fonts("replacing %C by %C",char,variant) end - setfield(p,"char",variant) + setchar(p,variant) if not redundant then redundant = { n } else @@ -422,12 +424,10 @@ function handlers.characters(head) start = kerning(start) end if prev then - setfield(start,"prev",prev) - setfield(prev,"next",start) + setlink(prev,start) end if next then - setfield(stop,"next",next) - setfield(next,"prev",start) + setlink(stop,next) end if front then head = start @@ -592,7 +592,7 @@ end -- if p and getid(p) == glyph_code then -- local variant = hash[getchar(p)] -- if variant then --- setfield(p,"char",variant) +-- setchar(p,variant) -- delete_node(nuthead,n) -- end -- end @@ -648,9 +648,10 @@ handlers.unprotectglyphs = function(n) return d_unprotect_glyphs(tonut(n)) end -- function handlers.protectglyphs(h) -- local h = tonut(h) -- for n in traverse_id(disc_code,h) do --- local d = getfield(n,"pre") if d then d_protect_glyphs(d) end --- local d = getfield(n,"post") if d then d_protect_glyphs(d) end --- local d = getfield(n,"replace") if d then d_protect_glyphs(d) end +-- local pre, post, replace = getdisc(n) +-- if pre then d_protect_glyphs(pre) end +-- if post then d_protect_glyphs(post) end +-- if replace then d_protect_glyphs(replace) end -- end -- return d_protect_glyphs(h) -- end diff --git a/tex/context/base/node-ini.lua b/tex/context/base/node-ini.lua index 2c187b624..73f2a8add 100644 --- a/tex/context/base/node-ini.lua +++ b/tex/context/base/node-ini.lua @@ -13,6 +13,8 @@ modules.

-- this module is being reconstructed +-- todo: query names with new node.subtypes + local next, type, tostring = next, type, tostring local gsub = string.gsub local concat, remove = table.concat, table.remove @@ -80,6 +82,14 @@ local skipcodes = allocate { [ 16] = "thinmuskip", [ 17] = "medmuskip", [ 18] = "thickmuskip", + [ 19] = "mathskip", -- experiment + [100] = "leaders", + [101] = "cleaders", + [102] = "xleaders", + [103] = "gleaders", +} + +local leadercodes = allocate { [100] = "leaders", [101] = "cleaders", [102] = "xleaders", @@ -119,12 +129,14 @@ local radicalcodes = allocate { } local listcodes = allocate { - [ 0] = "unknown", - [ 1] = "line", - [ 2] = "box", - [ 3] = "indent", - [ 4] = "alignment", -- row or column - [ 5] = "cell", + [0] = "unknown", + [1] = "line", + [2] = "box", + [3] = "indent", + [4] = "alignment", -- row or column + [5] = "cell", + [6] = "equation", + [7] = "equationnumber", } local glyphcodes = allocate { @@ -183,6 +195,15 @@ local fencecodes = allocate { [3] = "right", } +local rulecodes = allocate { + [0] = "normal", + [1] = "box", + [2] = "image", + [3] = "empty", +} + +-- maybe we also need fractioncodes + local function simplified(t) local r = { } for k, v in next, t do @@ -209,6 +230,8 @@ margincodes = allocate(swapped(margincodes,margincodes)) disccodes = allocate(swapped(disccodes,disccodes)) accentcodes = allocate(swapped(accentcodes,accentcodes)) fencecodes = allocate(swapped(fencecodes,fencecodes)) +rulecodes = allocate(swapped(rulecodes,rulecodes)) +leadercodes = allocate(swapped(leadercodes,leadercodes)) nodes.skipcodes = skipcodes nodes.gluecodes = skipcodes -- more official nodes.noadcodes = noadcodes @@ -220,10 +243,13 @@ nodes.kerncodes = kerncodes nodes.penaltycodes = penaltycodes nodes.mathcodes = mathcodes nodes.fillcodes = fillcodes -nodes.margincodes = margincodes +nodes.margincodes = margincodes nodes.marginkerncodes = margincodes nodes.disccodes = disccodes nodes.discretionarycodes = disccodes nodes.accentcodes = accentcodes +nodes.radicalcodes = radicalcodes nodes.fencecodes = fencecodes +nodes.rulecodes = rulecodes +nodes.leadercodes = leadercodes listcodes.row = listcodes.alignment listcodes.column = listcodes.alignment @@ -272,11 +298,7 @@ end trackers.register("system.showcodes", nodes.showcodes) --- new: - -nodes.nativedir = nodecodes.dir and true or false - -nodecodes.dir = 98 -nodecodes[98] = "dir" -nodecodes.localpar = 99 -nodecodes[99] = "localpar" +if not nodecodes.dir then + report_codes("use a newer version of luatex") + os.exit() +end diff --git a/tex/context/base/node-ltp.lua b/tex/context/base/node-ltp.lua index 29846ae08..5416959e8 100644 --- a/tex/context/base/node-ltp.lua +++ b/tex/context/base/node-ltp.lua @@ -194,15 +194,23 @@ local tonut = nuts.tonut local tonode = nuts.tonode local getfield = nuts.getfield -local setfield = nuts.setfield local getid = nuts.getid local getsubtype = nuts.getsubtype local getnext = nuts.getnext local getprev = nuts.getprev +local getboth = nuts.getboth local getlist = nuts.getlist local getfont = nuts.getfont local getchar = nuts.getchar local getattr = nuts.getattr +local getdisc = nuts.getdisc + +local setfield = nuts.setfield +local setlink = nuts.setlink +local setboth = nuts.setboth +local setnext = nuts.setnext +local setprev = nuts.setprev +local setdisc = nuts.setdisc local slide_nodelist = nuts.slide -- get rid of this, probably ok > 78.2 local find_tail = nuts.tail @@ -223,7 +231,6 @@ local setnodecolor = nodes.tracers.colors.set local nodepool = nuts.pool local nodecodes = nodes.nodecodes -local whatcodes = nodes.whatcodes local kerncodes = nodes.kerncodes local glyphcodes = nodes.glyphcodes local gluecodes = nodes.gluecodes @@ -238,7 +245,6 @@ local ins_code = nodecodes.ins local mark_code = nodecodes.mark local adjust_code = nodecodes.adjust local penalty_code = nodecodes.penalty -local whatsit_code = nodecodes.whatsit local disc_code = nodecodes.disc local math_code = nodecodes.math local kern_code = nodecodes.kern @@ -247,13 +253,11 @@ local hlist_code = nodecodes.hlist local vlist_code = nodecodes.vlist local unset_code = nodecodes.unset local marginkern_code = nodecodes.marginkern -local dir_code = nodecodes.dir or whatcodes.dir +local dir_code = nodecodes.dir local leaders_code = gluecodes.leaders -local localpar_code = nodecodes.localpar or whatcodes.localpar -local pdfrefximage_code = whatcodes.pdfrefximage -local pdfrefxform_code = whatcodes.pdfrefxform +local localpar_code = nodecodes.localpar local kerning_code = kerncodes.kerning -- font kern local userkern_code = kerncodes.userkern @@ -356,7 +360,7 @@ local function inject_dirs_at_end_of_line(stack,current,start,stop) local h = nil while start and start ~= stop do local id = getid(start) - if id == dir_code or (id == whatsit_code and getsubtype(start) == dir_code) then + if id == dir_code then if not dir_pops[getfield(start,"dir")] then -- weird, what is this # n = n + 1 stack[n] = start @@ -408,11 +412,6 @@ local function register_statistics(par) nofadjustedlines = nofadjustedlines + statistics.nofadjustedlines end --- resolvers -- - -local get_whatsit_width = nodes.whatsitters.getters.width -local get_whatsit_dimensions = nodes.whatsitters.getters.dimensions - -- expansion etc -- local function calculate_fraction(x,n,d,max_answer) @@ -502,18 +501,18 @@ local function kern_stretch_shrink(p,d) return 0, 0 end -local expand_kerns = false ------ expand_kerns = "both" +local expand_kerns_mode = false +local expand_kerns = false directives.register("builders.paragraphs.adjusting.kerns",function(v) if not v then - expand_kerns = false + expand_kerns_mode = false elseif v == "stretch" or v == "shrink" then - expand_kerns = v + expand_kerns_mode = v elseif v == "both" then - expand_kerns = true + expand_kerns_mode = true else - expand_kerns = toboolean(v,true) or false + expand_kerns_mode = toboolean(v,true) or false end end) @@ -749,14 +748,13 @@ local function compute_break_width(par,break_type,p) -- split in two local break_size = break_width.size + disc_width.size local break_adjust_stretch = break_width.adjust_stretch + disc_width.adjust_stretch local break_adjust_shrink = break_width.adjust_shrink + disc_width.adjust_shrink - local replace = getfield(p,"replace") + local pre, post, replace = getdisc(p) if replace then local size, adjust_stretch, adjust_shrink = add_to_width(line_break_dir,checked_expansion,replace) break_size = break_size - size break_adjust_stretch = break_adjust_stretch - adjust_stretch break_adjust_shrink = break_adjust_shrink - adjust_shrink end - local post = getfield(p,"post") if post then local size, adjust_stretch, adjust_shrink = add_to_width(line_break_dir,checked_expansion,post) break_size = break_size + size @@ -816,8 +814,7 @@ local function append_to_vlist(par, b) local head_field = par.head_field if head_field then local n = slide_nodelist(head_field) -- todo: find_tail - setfield(n,"next",s) - setfield(s,"prev",n) + setlink(n,s) else par.head_field = s end @@ -826,8 +823,7 @@ local function append_to_vlist(par, b) local head_field = par.head_field if head_field then local n = slide_nodelist(head_field) -- todo: find_tail - setfield(n,"next",b) - setfield(b,"prev",n) + setlink(n,b) else par.head_field = b end @@ -842,8 +838,7 @@ local function append_list(par, b) local head_field = par.head_field if head_field then local n = slide_nodelist(head_field) -- todo: find_tail - setfield(n,"next",b) - setfield(b,"prev",n) + setlink(n,b) else par.head_field = b end @@ -874,7 +869,7 @@ local function initialize_line_break(head,display) local last_line_fit = tex.lastlinefit local newhead = new_temp() - setfield(newhead,"next",head) + setnext(newhead,head) local adjust_spacing_status = adjust_spacing > 1 and -1 or 0 @@ -1037,6 +1032,8 @@ local function initialize_line_break(head,display) par.tolerance = hztolerance end + expand_kerns = expand_kerns_mode or (adjust_spacing == 2) + end -- we need par for the error message @@ -1198,42 +1195,33 @@ local function post_line_break(par) local prevlast = getprev(lastnode) local nextlast = getnext(lastnode) local subtype = getsubtype(lastnode) - local pre = getfield(lastnode,"pre") - local post = getfield(lastnode,"post") - local replace = getfield(lastnode,"replace") + local pre, post, replace = getdisc(lastnode) if subtype == second_disc_code then if not (getid(prevlast) == disc_code and getsubtype(prevlast) == first_disc_code) then report_parbuilders('unsupported disc at location %a',3) end if pre then flush_nodelist(pre) - setfield(lastnode,"pre",nil) pre = nil -- signal end if replace then local n = find_tail(replace) - setfield(prevlast,"next",replace) - setfield(replace,"prev",prevlast) - setfield(n,"next",lastnode) - setfield(lastnode,"prev",n) - setfield(lastnode,"replace",nil) + setlink(prevlast,replace) + setlink(n,lastnode) replace = nil -- signal end - local pre = getfield(prevlast,"pre") - local post = getfield(prevlast,"post") - local replace = getfield(prevlast,"replace") + setdisc(pre,post,replace) + local pre, post, replace = getdisc(prevlast) if pre then flush_nodelist(pre) - setfield(prevlast,"pre",nil) end if replace then flush_nodelist(replace) - setfield(prevlast,"replace",nil) end if post then flush_nodelist(post) - setfield(prevlast,"post",nil) end + setdisc(prevlast) -- nil,nil,nil elseif subtype == first_disc_code then -- what is v ... next probably if not (getid(v) == disc_code and getsubtype(v) == second_disc_code) then @@ -1241,29 +1229,23 @@ local function post_line_break(par) end setfield(nextlast,"subtype",regular_disc_code) setfield(nextlast,"replace",post) - setfield(lastnode,"post",nil) + setfield(lastnode,"post") end if replace then - setfield(lastnode,"replace",nil) -- free flush_nodelist(replace) end if pre then local n = find_tail(pre) - setfield(prevlast,"next",pre) - setfield(pre,"prev",prevlast) - setfield(n,"next",lastnode) - setfield(lastnode,"prev",n) - setfield(lastnode,"pre",nil) + setlink(prevlast,pre) + setlink(n,lastnode) end if post then local n = find_tail(post) - setfield(lastnode,"next",post) - setfield(post,"prev",lastnode) - setfield(n,"next",nextlast) - setfield(nextlast,"prev",n) - setfield(lastnode,"post",nil) + setlink(lastnode,post) + setlink(n,nextlast) post_disc_break = true end + setdisc(lastnode) -- nil, nil, nil disc_break = true elseif id == kern_code then setfield(lastnode,"kern",0) @@ -1293,7 +1275,7 @@ local function post_line_break(par) end -- we finish the line local r = getnext(lineend) - setfield(lineend,"next",nil) + setnext(lineend) if not glue_break then if rightskip then insert_node_after(lineend,lineend,new_rightskip(right_skip)) -- lineend moves on as pseudo head @@ -1301,10 +1283,7 @@ local function post_line_break(par) end -- each time ? local q = getnext(head) - setfield(head,"next",r) - if r then - setfield(r,"prev",head) - end + setlink(head,r) -- insert leftbox (if needed after parindent) local leftbox = current_break.passive_left_box if leftbox then @@ -1429,7 +1408,7 @@ local function post_line_break(par) end local id = getid(next) local subtype = getsubtype(next) - if (id == localpar_code) or (id == whatsit_code and subtype == localpar_code) then + if id == localpar_code then -- nothing elseif id < math_code then -- messy criterium @@ -1445,12 +1424,9 @@ local function post_line_break(par) current = next end if current ~= head then - setfield(current,"next",nil) + setnext(current) flush_nodelist(getnext(head)) - setfield(head,"next",next) - if next then - setfield(next,"prev",head) - end + setlink(head,next) end end end @@ -2152,7 +2128,7 @@ function constructors.methods.basic(head,d) par.pass_number = 0 -- par.auto_breaking = true - setfield(temp_head,"next",head) + setnext(temp_head,head) local current = head local first_p = current @@ -2163,7 +2139,7 @@ function constructors.methods.basic(head,d) if current then local id = getid(current) - if (id == localpar_code) or (id == whatsit_code and getsubtype(current) == localpar_code) then + if id == localpar_code then par.init_internal_left_box = getfield(current,"box_left") par.init_internal_left_box_width = getfield(current,"box_left_width") par.internal_pen_inter = getfield(current,"pen_inter") @@ -2231,9 +2207,9 @@ function constructors.methods.basic(head,d) local prev_p = getprev(current) if prev_p and prev_p ~= temp_head then local id = getid(prev_p) - if id == glyph_code or -- dir_code is < math - (id < math_code and (id ~= whatsit_code or getsubtype(prev_p) ~= dir_code)) or -- was: precedes_break(prev_p) - (id == kern_code and getsubtype(prev_p) ~= userkern_code) then + if (id == glyph_code) or -- dir_code is < math + (id < math_code) or -- was: precedes_break(prev_p) + (id == kern_code and getsubtype(prev_p) ~= userkern_code) then p_active, n_active = try_break(0, unhyphenated_code, par, first_p, current, checked_expansion) end end @@ -2371,23 +2347,6 @@ function constructors.methods.basic(head,d) par.internal_left_box_width = getfield(current,"box_left_width") par.internal_right_box = getfield(current,"box_right") par.internal_right_box_width = getfield(current,"box_right_width") - elseif id == whatsit_code then - local subtype = getsubtype(current) - if subtype == localpar_code then - par.internal_pen_inter = getfield(current,"pen_inter") - par.internal_pen_broken = getfield(current,"pen_broken") - par.internal_left_box = getfield(current,"box_left") - par.internal_left_box_width = getfield(current,"box_left_width") - par.internal_right_box = getfield(current,"box_right") - par.internal_right_box_width = getfield(current,"box_right_width") - elseif subtype == dir_code then - par.line_break_dir = checked_line_dir(dirstack) or par.line_break_dir - else - local get_width = get_whatsit_width[subtype] - if get_width then - active_width.size = active_width.size + get_width(current,par.line_break_dir) - end - end elseif trace_unsupported then if id == mark_code or id == ins_code or id == adjust_code then -- skip @@ -2557,10 +2516,10 @@ function diagnostics.feasible_break(par, current, r, b, pi, d, artificial_demeri par.font_in_short_display = short_display("log",getnext(printed_node),par.font_in_short_display) else local save_link = getnext(current) - setfield(current,"next",nil) + setnext(current) write_nl("log","") par.font_in_short_display = short_display("log",getnext(printed_node),par.font_in_short_display) - setfield(current,"next",save_link) + setnext(current,save_link) end par.printed_node = current end @@ -2957,52 +2916,27 @@ local function hpack(head,width,method,direction,firstline,line) -- fast version depth = ds end elseif id == ins_code or id == mark_code then - local prev = getprev(current) - local next = getnext(current) + local prev, next = getboth(current) if adjust_tail then -- todo - if next then - setfield(next,"prev",prev) - end - if prev then - setfield(prev,"next",next) - end - setfield(current,"prev",adjust_tail) - setfield(current,"next",nil) - adjust_setfield(tail,"next",current) + setlink(prev,next) + setlink(adjust_tail,current) + setnext(current) adjust_tail = current else adjust_head = current adjust_tail = current - setfield(current,"prev",nil) - setfield(current,"next",nil) + setboth(current) end elseif id == adjust_code then local list = getlist(current) if adjust_tail then - adjust_setfield(tail,"next",list) + setnext(adjust_tail,list) else adjust_head = list end adjust_tail = slide_nodelist(list) -- find_tail(list) - elseif id == dir_code then + elseif id == dir_code then hpack_dir = checked_line_dir(stack,current) or hpack_dir - elseif id == whatsit_code then - local subtype = getsubtype(current) - if subtype == dir_code then - hpack_dir = checked_line_dir(stack,current) or hpack_dir - else - local get_dimensions = get_whatsit_dimensions[subtype] - if get_dimensions then - local wd, ht, dp = get_dimensions(current,hpack_dir) - natural = natural + wd - if ht > height then - height = ht - end - if dp > depth then - depth = dp - end - end - end elseif id == marginkern_code then local width = getfield(current,"width") if cal_expand_ratio then diff --git a/tex/context/base/node-mig.lua b/tex/context/base/node-mig.lua index 41f95be45..294af86ef 100644 --- a/tex/context/base/node-mig.lua +++ b/tex/context/base/node-mig.lua @@ -28,6 +28,9 @@ local getattr = nuts.getattr local setfield = nuts.setfield local setattr = nuts.setattr +local setlink = nuts.setlink +local setprev = nuts.setprev +local setnext = nuts.setnext local remove_node = nuts.remove @@ -57,12 +60,11 @@ local function locate(head,first,last,ni,nm) elseif migrate_inserts and id == insert_code then local insert head, current, insert = remove_node(head,current) - setfield(insert,"next",nil) + setnext(insert) if first then - setfield(insert,"prev",last) - setfield(last,"next",insert) + setlink(last,insert) else - setfield(insert,"prev",nil) + setprev(insert) first = insert end last = insert @@ -70,12 +72,11 @@ local function locate(head,first,last,ni,nm) elseif migrate_marks and id == mark_code then local mark head, current, mark = remove_node(head,current) - setfield(mark,"next",nil) + setnext(mark) if first then - setfield(mark,"prev",last) - setfield(last,"next",mark) + setlink(last,mark) else - setfield(mark,"prev",nil) + setprev(mark) first = mark end last = mark @@ -120,11 +121,9 @@ function nodes.handlers.migrate(head,where) -- inserts after head, use insert_after local n = getnext(current) if n then - setfield(last,"next",n) - setfield(n,"prev",last) + setlink(last,n) end - setfield(current,"next",first) - setfield(first,"prev",current) + setlink(current,first) done = true current = last end diff --git a/tex/context/base/node-nut.lua b/tex/context/base/node-nut.lua index 849715383..f5de89196 100644 --- a/tex/context/base/node-nut.lua +++ b/tex/context/base/node-nut.lua @@ -378,6 +378,8 @@ local d_insert_before = direct.insert_before local d_slide = direct.slide local d_copy_node = direct.copy local d_traverse = direct.traverse +local d_setlink = direct.setlink +local d_setboth = direct.setboth local function remove(head,current,free_too) local t = current @@ -388,41 +390,13 @@ local function remove(head,current,free_too) d_free_node(t) t = nil else - d_setfield(t,"next",nil) -- not that much needed (slows down unless we check the source on this) - d_setfield(t,"prev",nil) -- not that much needed (slows down unless we check the source on this) + d_setboth(t) -- (t,nil,nil) end return head, current, t end -- bad: we can have prev's being glue_spec --- local function remove(head,current,free_too) -- d_remove_node does a slide which can fail --- local prev = d_getprev(current) -- weird --- local next = d_getnext(current) --- if next then --- -- print("!!!!!!!! prev is gluespec", --- -- nodes.nodecodes[d_getid(current)], --- -- nodes.nodecodes[d_getid(next)], --- -- nodes.nodecodes[d_getid(prev)]) --- d_setfield(prev,"next",next) --- d_setfield(next,"prev",prev) --- else --- d_setfield(prev,"next",nil) --- end --- if free_too then --- d_free_node(current) --- current = nil --- else --- d_setfield(current,"next",nil) -- use this fact ! --- d_setfield(current,"prev",nil) -- use this fact ! --- end --- if head == current then --- return next, next, current --- else --- return head, next, current --- end --- end - nuts.remove = remove function nuts.delete(head,current) @@ -433,15 +407,12 @@ function nuts.replace(head,current,new) -- no head returned if false if not new then head, current, new = false, head, current end - local prev = d_getprev(current) - local next = d_getnext(current) + local prev, next = d_getboth(current) if next then - d_setfield(new,"next",next) - d_setfield(next,"prev",new) + d_setlink(new,next) end if prev then - d_setfield(new,"prev",prev) - d_setfield(prev,"next",new) + d_setlink(new,prev) end if head then if head == current then @@ -496,8 +467,7 @@ function nuts.linked(...) local next = select(i,...) if next then if head then - d_setfield(last,"next",next) - d_setfield(next,"prev",last) + d_setlink(last,next) else head = next end @@ -513,8 +483,7 @@ function nuts.concat(list) -- consider tail instead of slide local li = list[i] if li then if head then - d_setfield(tail,"next",li) - d_setfield(li,"prev",tail) + d_setlink(tail,li) else head = li end @@ -554,24 +523,6 @@ function nodes.vianodes(f) return function(n,...) return tonut (f(tonode(n),...) nuts.vianuts = nodes.vianuts nuts.vianodes = nodes.vianodes --- for k, v in next, nuts do --- if type(v) == "function" then --- if not string.find(k,"^[sg]et") and not string.find(k,"^to") then --- local f = v --- nuts[k] = function(...) print("d",k,...) return f(...) end --- end --- end --- end - --- for k, v in next, nodes do --- if type(v) == "function" then --- if not string.find(k,"^[sg]et") and not string.find(k,"^to") then --- local f = v --- nodes[k] = function(...) print("n",k,...) return f(...) end --- end --- end --- end - -- function nodes.insert_before(h,c,n) -- if c then -- if c == h then @@ -613,6 +564,7 @@ function nodes.insert_list_after(h,c,n) if c then local cn = n_getnext(c) if cn then + -- no setboth here yet n_setfield(t,"next",cn) n_setfield(cn,"prev",t) else @@ -628,17 +580,17 @@ end -- function nuts.insert_before(h,c,n) -- if c then -- if c == h then --- d_setfield(n,"next",h) --- d_setfield(n,"prev",nil) --- d_setfield(h,"prev",n) +-- d_setnext(n,h) +-- d_setprev(n) +-- d_setprev(h,n) -- else -- local cp = d_getprev(c) --- d_setfield(n,"next",c) --- d_setfield(n,"prev",cp) +-- d_setnext(n,c) +-- d_setprev(n,cp) -- if cp then --- d_setfield(cp,"next",n) +-- d_setnext(cp,n) -- end --- d_setfield(c,"prev",n) +-- d_setprev(c,n) -- return h, n -- end -- end @@ -649,13 +601,11 @@ end -- if c then -- local cn = d_getnext(c) -- if cn then --- d_setfield(n,"next",cn) --- d_setfield(cn,"prev",n) +-- d_setlink(n,cn) -- else --- d_setfield(n,"next",nil) +-- d_setnext(n,nil) -- end --- d_setfield(c,"next",n) --- d_setfield(n,"prev",c) +-- d_setlink(c,n) -- return h, n -- end -- return n, n @@ -666,13 +616,11 @@ function nuts.insert_list_after(h,c,n) if c then local cn = d_getnext(c) if cn then - d_setfield(t,"next",cn) - d_setfield(cn,"prev",t) + d_setlink(t,cn) else - d_setfield(t,"next",nil) + d_setnext(t) end - d_setfield(c,"next",n) - d_setfield(n,"prev",c) + d_setlink(c,n) return h, n end return n, t @@ -887,29 +835,29 @@ nodes.whatsitters = { setters = { width = setwidth, dimensions = setdimensions }, } --- this might move (in fact forms and images will become nodes) - -local function get_width(n,dir) - n = tonut(n) - return getfield(n,"width") -end - -local function get_dimensions(n,dir) - n = tonut(n) - return getfield(n,"width"), getfield(n,"height"), getfield(n,"depth") -end - -local whatcodes = nodes.whatcodes -local pdfrefximage_code = whatcodes.pdfrefximage -local pdfrefxform_code = whatcodes.pdfrefxform +-- obsolete -if pdfrefxform_code then - getwidth [pdfrefxform_code ] = get_width - getdimensions[pdfrefxform_code ] = get_dimensions -end - -if pdfrefximage_code then - getwidth [pdfrefximage_code] = get_width - getdimensions[pdfrefximage_code] = get_dimensions -end +-- local function get_width(n,dir) +-- n = tonut(n) +-- return getfield(n,"width") +-- end +-- +-- local function get_dimensions(n,dir) +-- n = tonut(n) +-- return getfield(n,"width"), getfield(n,"height"), getfield(n,"depth") +-- end +-- +-- local whatcodes = nodes.whatcodes +-- local pdfrefximage_code = whatcodes.pdfrefximage +-- local pdfrefxform_code = whatcodes.pdfrefxform +-- +-- if pdfrefxform_code then +-- getwidth [pdfrefxform_code ] = get_width +-- getdimensions[pdfrefxform_code ] = get_dimensions +-- end +-- +-- if pdfrefximage_code then +-- getwidth [pdfrefximage_code] = get_width +-- getdimensions[pdfrefximage_code] = get_dimensions +-- end diff --git a/tex/context/base/node-ppt.lua b/tex/context/base/node-ppt.lua index 70233603d..6577fffba 100644 --- a/tex/context/base/node-ppt.lua +++ b/tex/context/base/node-ppt.lua @@ -41,7 +41,6 @@ local whatsit_code = nodecodes.whatsit local hlist_code = nodecodes.hlist local vlist_code = nodecodes.vlist local userdefined_code = whatsitcodes.userdefined -local localpar_code = nodecodes.localpar or whatsitcodes.localpar local nodepool = nodes.pool local new_usernumber = nodepool.usernumber @@ -302,8 +301,6 @@ local anchored = { local subtype = getsubtype(n) if (subtype == userdefined_code and getfield(n,"user_id") == property_id) then -- continue - elseif subtype == localpar_code then - -- continue .. can't happen anyway as we cannot write else return n end diff --git a/tex/context/base/node-ref.lua b/tex/context/base/node-ref.lua index e77ea9a11..633cfd4a6 100644 --- a/tex/context/base/node-ref.lua +++ b/tex/context/base/node-ref.lua @@ -52,6 +52,9 @@ local tonut = nuts.tonut local getfield = nuts.getfield local setfield = nuts.setfield +local setlink = nuts.setlink +local setnext = nuts.setnext +local setprev = nuts.setprev local getnext = nuts.getnext local getprev = nuts.getprev local getid = nuts.getid @@ -68,7 +71,6 @@ local find_node_tail = nuts.tail local nodecodes = nodes.nodecodes local skipcodes = nodes.skipcodes -local whatcodes = nodes.whatcodes local listcodes = nodes.listcodes local hlist_code = nodecodes.hlist @@ -76,9 +78,8 @@ local vlist_code = nodecodes.vlist local glue_code = nodecodes.glue local glyph_code = nodecodes.glyph local rule_code = nodecodes.rule -local whatsit_code = nodecodes.whatsit -local dir_code = nodecodes.dir or whatcodes.dir -local localpar_code = nodecodes.localpar or whatcodes.localpar +local dir_code = nodecodes.dir +local localpar_code = nodecodes.localpar local leftskip_code = skipcodes.leftskip local rightskip_code = skipcodes.rightskip @@ -96,14 +97,14 @@ local tosequence = nodes.tosequence local implement = interfaces.implement -- Normally a (destination) area is a box or a simple stretch if nodes but when it is --- a paragraph we hav ea problem: we cannot calculate the height well. This happens +-- a paragraph we have a problem: we cannot calculate the height well. This happens -- with footnotes or content broken across a page. local function vlist_dimensions(start,stop) local temp if stop then temp = getnext(stop) - setfield(stop,"next",nil) + setnext(stop,nil) end local v = vpack_list(start) local w = getfield(v,"width") @@ -112,7 +113,7 @@ local function vlist_dimensions(start,stop) setfield(v,"list",nil) free_node(v) if temp then - setfield(stop,"next",temp) + setnext(stop,temp) end return w, h, d end @@ -133,7 +134,15 @@ local function dimensions(parent,start,stop) -- in principle we could move some if trace_areas then report_area("dimensions taken of %a",nodecodes[id]) end - return getfield(start,"width"), getfield(parent,"height"), getfield(parent,"depth") + -- hm, parent can be zero + local width = getfield(start,"width") + local height = getfield(parent,"height") + local depth = getfield(parent,"depth") + if height == 0 and depth == 0 then + height = getfield(start,"height") + depth = getfield(start,"depth") + end + return width, height, depth else if trace_areas then report_area("dimensions calculated of %a",nodecodes[id]) @@ -198,35 +207,34 @@ local function inject_range(head,first,last,reference,make,stack,parent,pardir,t local l = getlist(line) if trace_areas then report_area("%s: %04i %s %s %s => w=%p, h=%p, d=%p, c=%S","line", - reference,pardir or "---",txtdir or "---",tosequence(l,nil,true),width,height,depth,resolved) + reference,pardir or "---",txtdir or "---", + tosequence(l,nil,true),width,height,depth,resolved) end setfield(line,"list",result) - setfield(result,"next",l) - setfield(l,"prev",result) + setlink(result,l) return head, last else if head == first then if trace_areas then report_area("%s: %04i %s %s %s => w=%p, h=%p, d=%p, c=%S","head", - reference,pardir or "---",txtdir or "---",tosequence(first,last,true),width,height,depth,resolved) + reference,pardir or "---",txtdir or "---", + tosequence(first,last,true),width,height,depth,resolved) end - setfield(result,"next",first) - setfield(first,"prev",result) + setlink(result,first) return result, last else if trace_areas then report_area("%s: %04i %s %s %s => w=%p, h=%p, d=%p, c=%S","middle", - reference,pardir or "---",txtdir or "---",tosequence(first,last,true),width,height,depth,resolved) + reference,pardir or "---",txtdir or "---", + tosequence(first,last,true),width,height,depth,resolved) end local prev = getprev(first) if prev then - setfield(prev,"next",result) - setfield(result,"prev",prev) + setlink(prev,result) end - setfield(result,"next",first) - setfield(first,"prev",result) + setlink(result,first) -- if first == getnext(head) then - -- setfield(head,"next",result) -- hm, weird + -- setnext(head,result) -- hm, weird -- end return head, last end @@ -290,16 +298,14 @@ local function inject_list(id,current,reference,make,stack,pardir,txtdir) elseif moveright then -- brr no prevs done -- result after first local n = getnext(first) - setfield(result,"next",n) - setfield(first,"next",result) - setfield(result,"prev",first) + setnext(result,n) + setlink(first,first) if n then - setfield(n,"prev",result) + setprev(n,result) end else -- first after result - setfield(result,"next",first) - setfield(first,"prev",result) + setlink(result,first) setfield(current,"list",result) end end @@ -354,13 +360,6 @@ local function inject_areas(head,attribute,make,stack,done,skip,parent,pardir,tx txtdir = getfield(current,"dir") elseif id == localpar_code then pardir = getfield(current,"dir") - elseif id == whatsit_code then - local subtype = getsubtype(current) - if subtype == localpar_code then - pardir = getfield(current,"dir") - elseif subtype == dir_code then - txtdir = getfield(current,"dir") - end elseif id == glue_code and getsubtype(current) == leftskip_code then -- any glue at the left? -- else @@ -410,13 +409,6 @@ local function inject_area(head,attribute,make,stack,done,parent,pardir,txtdir) txtdir = getfield(current,"dir") elseif id == localpar_code then pardir = getfield(current,"dir") - elseif id == whatsit_code then - local subtype = getsubtype(current) - if subtype == localpar_code then - pardir = getfield(current,"dir") - elseif subtype == dir_code then - txtdir = getfield(current,"dir") - end else local r = getattr(current,attribute) if r and not done[r] then @@ -500,8 +492,8 @@ local function colorize(width,height,depth,n,reference,what,sr,offset) if width < 0 then local kern = new_kern(width) setfield(rule,"width",-width) - setfield(kern,"next",rule) - setfield(rule,"prev",kern) + setnext(kern,rule) + setprev(rule,kern) return kern else @@ -509,10 +501,8 @@ if sr and sr ~= "" then local text = addstring(what,sr,shift) if text then local kern = new_kern(-getfield(text,"width")) - setfield(kern,"next",text) - setfield(text,"prev",kern) - setfield(text,"next",rule) - setfield(rule,"prev",text) + setlink(kern,text) + setlink(text,rule) return kern end end @@ -526,10 +516,8 @@ local function justadd(what,sr,shift) local text = addstring(what,sr,shift) if text then local kern = new_kern(-getfield(text,"width")) - setfield(kern,"next",text) - setfield(text,"prev",kern) - setfield(text,"next",rule) - setfield(rule,"prev",text) + setlink(kern,text) + setlink(text,rule) return kern end end @@ -616,8 +604,7 @@ local function makereference(width,height,depth,reference) -- height and depth a end end if current then - setfield(current,"next",annot) - setfield(annot,"prev",current) + setlink(current,annot) else result = annot end @@ -727,8 +714,7 @@ local function makedestination(width,height,depth,reference) if not result then result, current = rule, rule else - setfield(current,"next",rule) - setfield(rule,"prev",current) + setlink(current,rule) current = rule end width, height = width - step, height - step @@ -747,8 +733,7 @@ local function makedestination(width,height,depth,reference) if annot then annot = tonut(annot) -- obsolete soon if result then - setfield(current,"next",annot) - setfield(annot,"prev",current) + setlink(current,annot) else result = annot end diff --git a/tex/context/base/node-res.lua b/tex/context/base/node-res.lua index 85fb63adf..10144399c 100644 --- a/tex/context/base/node-res.lua +++ b/tex/context/base/node-res.lua @@ -67,10 +67,12 @@ local tonode = nuts.tonode local getbox = nuts.getbox local getfield = nuts.getfield -local setfield = nuts.setfield local getid = nuts.getid local getlist = nuts.getlist +local setfield = nuts.setfield +local setchar = nuts.setchar + local copy_nut = nuts.copy local new_nut = nuts.new local free_nut = nuts.free @@ -140,13 +142,7 @@ local glue = register_nut(new_nut("glue")) -- glue.spec = nil local glue_spec = register_nut(new_nut("glue_spec")) local glyph = register_nut(new_nut("glyph",0)) -local textdir = nil - -if nodes.nativedir then - textdir = register_nut(new_nut("dir")) -else - textdir = register_nut(new_nut("whatsit",whatsitcodes.dir)) -end +local textdir = register_nut(new_nut("dir")) local latelua = register_nut(new_nut("whatsit",whatsitcodes.latelua)) local special = register_nut(new_nut("whatsit",whatsitcodes.special)) @@ -183,7 +179,7 @@ end function nutpool.glyph(fnt,chr) local n = copy_nut(glyph) if fnt then setfield(n,"font",fnt) end - if chr then setfield(n,"char",chr) end + if chr then setchar(n,chr) end return n end @@ -432,7 +428,7 @@ function nutpool.noad() return copy_nut(noad) end -function nutpool.hlist(list,width,height,depth) +function nutpool.hlist(list,width,height,depth,shift) local n = copy_nut(hlist) if list then setfield(n,"list",list) @@ -446,10 +442,13 @@ function nutpool.hlist(list,width,height,depth) if depth then setfield(n,"depth",depth) end + if shift then + setfield(n,"shift",shift) + end return n end -function nutpool.vlist(list,width,height,depth) +function nutpool.vlist(list,width,height,depth,shift) local n = copy_nut(vlist) if list then setfield(n,"list",list) @@ -463,6 +462,9 @@ function nutpool.vlist(list,width,height,depth) if depth then setfield(n,"depth",depth) end + if shift then + setfield(n,"shift",shift) + end return n end diff --git a/tex/context/base/node-rul.lua b/tex/context/base/node-rul.lua index f023d69c7..ec064f622 100644 --- a/tex/context/base/node-rul.lua +++ b/tex/context/base/node-rul.lua @@ -19,6 +19,9 @@ local tonut = nuts.tonut local getfield = nuts.getfield local setfield = nuts.setfield +local setnext = nuts.setnext +local setprev = nuts.setprev +local setlink = nuts.setlink local getnext = nuts.getnext local getprev = nuts.getprev local getid = nuts.getid @@ -106,7 +109,6 @@ local v_foreground = variables.foreground local nodecodes = nodes.nodecodes local skipcodes = nodes.skipcodes -local whatcodes = nodes.whatcodes local kerncodes = nodes.kerncodes local glyph_code = nodecodes.glyph @@ -117,8 +119,7 @@ local kern_code = nodecodes.kern local hlist_code = nodecodes.hlist local vlist_code = nodecodes.vlist local rule_code = nodecodes.rule -local dir_code = nodecodes.dir or whatcodes.dir -local whatsit_code = nodecodes.whatsit +local dir_code = nodecodes.dir local userskip_code = skipcodes.userskip local spaceskip_code = skipcodes.spaceskip @@ -187,8 +188,6 @@ local function processwords(attribute,data,flush,head,parent) -- we have hlistdi end f, l, a = nil, nil, nil end --- elseif f and (id == disc_code or (id == kern_code and getsubtype(n) == kerning_code)) then --- l = n elseif id == disc_code then if f then l = n @@ -206,7 +205,7 @@ local function processwords(attribute,data,flush,head,parent) -- we have hlistdi if list then setfield(n,"list",(processwords(attribute,data,flush,list,n))) -- watch () end - elseif checkdir and (id == dir_code or (id == whatsit_code and getsubtype(n) == dir_code)) then -- only changes in dir, we assume proper boundaries + elseif checkdir and id == dir_code then -- only changes in dir, we assume proper boundaries if f and a then l = n end @@ -391,20 +390,18 @@ local function flush_shifted(head,first,last,data,level,parent,strip) -- not tha end local prev = getprev(first) local next = getnext(last) - setfield(first,"prev",nil) - setfield(last,"next",nil) + setprev(first) + setnext(last) local width, height, depth = list_dimensions(getfield(parent,"glue_set"),getfield(parent,"glue_sign"),getfield(parent,"glue_order"),first,next) local list = hpack_nodes(first,width,"exactly") if first == head then head = list end if prev then - setfield(prev,"next",list) - setfield(list,"prev",prev) + setlink(prev,list) end if next then - setfield(next,"prev",list) - setfield(list,"next",next) + setlink(next,list) end local raise = data.dy * dimenfactor(data.unit,fontdata[getfont(first)]) setfield(list,"shift",raise) diff --git a/tex/context/base/node-shp.lua b/tex/context/base/node-shp.lua index af13973c0..df1a3e585 100644 --- a/tex/context/base/node-shp.lua +++ b/tex/context/base/node-shp.lua @@ -44,6 +44,9 @@ local find_tail = nuts.tail local getfield = nuts.getfield local setfield = nuts.setfield +local setsetlink = nuts.setlink +local setsetprev = nuts.setprev +local setsetnext = nuts.setnext local getid = nuts.getid local getnext = nuts.getnext local getprev = nuts.getprev @@ -51,13 +54,12 @@ local getlist = nuts.getlist local getsubtype = nuts.getsubtype local removables = { - [whatsitcodes.open] = true, - [whatsitcodes.close] = true, - [whatsitcodes.write] = true, - [whatsitcodes.savepos or - whatsitcodes.pdfsavepos] = true, -- for now - [whatsitcodes.latelua] = true, - [whatsitcodes.pdfdest] = true, + [whatsitcodes.open] = true, + [whatsitcodes.close] = true, + [whatsitcodes.write] = true, + [whatsitcodes.savepos] = true, + [whatsitcodes.latelua] = true, + [whatsitcodes.pdfdest] = true, } -- About 10% of the nodes make no sense for the backend. By (at least) @@ -87,14 +89,12 @@ local function cleanup_redundant(head) -- better name is: flatten_page remove_node(head,start,true) end if next then - setfield(tail,"next",next) - setfield(next,"prev",tail) + setlink(tail,next) end if prev then - setfield(prev,"next",replace) - setfield(replace,"prev",prev) + setlink(prev,replace) else - setfield(replace,"prev",nil) -- to be sure + setprev(replace) -- to be sure end start = next elseif wipedisc then diff --git a/tex/context/base/node-tra.lua b/tex/context/base/node-tra.lua index ae2dd7ddc..0692c1fe6 100644 --- a/tex/context/base/node-tra.lua +++ b/tex/context/base/node-tra.lua @@ -45,6 +45,7 @@ local getid = nuts.getid local getchar = nuts.getchar local getsubtype = nuts.getsubtype local getlist = nuts.getlist +local getdisc = nuts.getdisc local setattr = nuts.setattr @@ -71,8 +72,8 @@ local disc_code = nodecodes.disc local glue_code = nodecodes.glue local kern_code = nodecodes.kern local rule_code = nodecodes.rule -local dir_code = nodecodes.dir or whatcodes.dir -local localpar_code = nodecodes.localpar or whatcodes.localpar +local dir_code = nodecodes.dir +local localpar_code = nodecodes.localpar local whatsit_code = nodecodes.whatsit local gluespec_code = nodecodes.gluespec @@ -149,8 +150,6 @@ local function tosequence(start,stop,compact) end elseif id == dir_code or id == localpar_code then t[#t+1] = "[" .. getfield(start,"dir") .. "]" - elseif id == whatsit_code and (getsubtype(start) == localpar_code or getsubtype(start) == dir_code) then - t[#t+1] = "[" .. getfield(start,"dir") .. "]" elseif compact then t[#t+1] = "[]" else @@ -176,7 +175,7 @@ nodes.tosequence = tosequence nuts .tosequence = tosequence function nodes.report(t,done) - report_nodes("output %a, %changed %a, %s nodes",status.output_active,done,count_nodes(tonut(t))) + report_nodes("output %a, changed %a, %s nodes",status.output_active,done,count_nodes(tonut(t))) end function nodes.packlist(head) @@ -291,7 +290,7 @@ end nodes.showsimplelist = function(h,depth) showsimplelist(h,depth,0) end -local function listtoutf(h,joiner,textonly,last) +local function listtoutf(h,joiner,textonly,last,nodisc) local w = { } while h do local id = getid(h) @@ -302,14 +301,16 @@ local function listtoutf(h,joiner,textonly,last) w[#w+1] = joiner end elseif id == disc_code then - local pre = getfield(h,"pre") - local pos = getfield(h,"post") - local rep = getfield(h,"replace") - w[#w+1] = formatters["[%s|%s|%s]"] ( - pre and listtoutf(pre,joiner,textonly) or "", - pos and listtoutf(pos,joiner,textonly) or "", - rep and listtoutf(rep,joiner,textonly) or "" - ) + local pre, pos, rep = getdisc(h) + if not nodisc then + w[#w+1] = formatters["[%s|%s|%s]"] ( + pre and listtoutf(pre,joiner,textonly) or "", + pos and listtoutf(pos,joiner,textonly) or "", + rep and listtoutf(rep,joiner,textonly) or "" + ) + elseif rep then + w[#w+1] = listtoutf(rep,joiner,textonly) or "" + end elseif textonly then if id == glue_code then local spec = getfield(h,"spec") @@ -331,10 +332,10 @@ local function listtoutf(h,joiner,textonly,last) return concat(w) end -function nodes.listtoutf(h,joiner,textonly,last) +function nodes.listtoutf(h,joiner,textonly,last,nodisc) if h then local joiner = joiner == true and utfchar(0x200C) or joiner -- zwnj - return listtoutf(tonut(h),joiner,textonly,last and tonut(last)) + return listtoutf(tonut(h),joiner,textonly,last and tonut(last),nodisc) else return "" end diff --git a/tex/context/base/node-typ.lua b/tex/context/base/node-typ.lua index f1aacf25a..6c5577f08 100644 --- a/tex/context/base/node-typ.lua +++ b/tex/context/base/node-typ.lua @@ -16,6 +16,9 @@ local tonode = nuts.tonode local tonut = nuts.tonut local setfield = nuts.setfield +local setlink = nuts.setlink +local setchar = nuts.setchar + local getfont = nuts.getfont local hpack_node_list = nuts.hpack @@ -58,7 +61,7 @@ local function tonodes(str,fontid,spacing,templateglyph) -- quick and dirty end elseif templateglyph then next = copy_glyph(templateglyph) - setfield(next,"char",c) + setchar(next,c) spacedone = false else next = new_glyph(fontid or 1,c) @@ -69,8 +72,7 @@ local function tonodes(str,fontid,spacing,templateglyph) -- quick and dirty elseif not head then head = next else - setfield(prev,"next",next) - setfield(next,"prev",prev) + setlink(prev,next) end prev = next end @@ -116,7 +118,7 @@ typesetters.hpack = typesetters.tohpack -- obsolete typesetters.fast_hpack = typesetters.tofasthpack -- obsolete typesetters.vpack = typesetters.tovpack -- obsolete --- node.write(nodes.typestters.hpack("Hello World!")) --- node.write(nodes.typestters.hpack("Hello World!",1,100*1024*10)) +-- node.write(nodes.typesetters.hpack("Hello World!")) +-- node.write(nodes.typesetters.hpack("Hello World!",1,100*1024*10)) string.tonodes = function(...) return tonode(tonodes(...)) end -- quite convenient diff --git a/tex/context/base/pack-bck.mkvi b/tex/context/base/pack-bck.mkvi index bb4b72252..53cdf6de4 100644 --- a/tex/context/base/pack-bck.mkvi +++ b/tex/context/base/pack-bck.mkvi @@ -16,7 +16,7 @@ %D The code here is already pretty old and is used for simple %D backgrounds. As it is still used WS adapted the code to the %D new command handler methods so that it gets a second life. So -%D it made sense to mkvi ir as well. Some more code is moved here +%D it made sense to mkvi as well. Some more code is moved here %D too. %D \macros @@ -87,7 +87,9 @@ {\setupcurrentbackground[#settings,\c!state=\v!start,\c!offset=\v!overlay]% \let\pack_backgrounds_stop\pack_backgrounds_stop_indeed \setbox0\vbox\bgroup - \vbox to \lineheight{}\vskip\zeropoint + \strut + \vskip-2\lineheight + \strut \blank[\v!disable] \leftskip \backgroundparameter\c!leftoffset \rightskip\backgroundparameter\c!rightoffset} @@ -100,6 +102,9 @@ \unexpanded\def\pack_backgrounds_stop_indeed % we shoul duse the fast background variant of framed {\endgraf \removelastskip + \strut + \vskip-2\lineheight + \strut \egroup \dimen2\leftskip % new ** \forgetall @@ -114,7 +119,6 @@ \else \splitmaxdepth\boxmaxdepth \splittopskip\topskip - \setbox2\vsplit0 to \lineheight % get rid of fake line \doloop {\ifdim\pagetotal=\zeropoint % empty page \scratchdimen\textheight @@ -124,7 +128,13 @@ \scratchdimen\dimexpr\pagegoal-\ht2-\pagetotal\relax \backgroundsplitmode\plustwo % split to partial height \fi - \advance\scratchdimen\dimexpr-\backgroundparameter\c!topoffset-\backgroundparameter\c!bottomoffset\relax + \ifdim\scratchdimen<\zeropoint + \scratchdimen\pagegoal + \fi + \advance\scratchdimen\dimexpr + -\backgroundparameter\c!topoffset + -\backgroundparameter\c!bottomoffset + \relax \ifdim\scratchdimen>2\lineheight\relax % reasonable, will be configurable \ifdim\ht0>\scratchdimen % larger than page \setbox2\vsplit0 to \scratchdimen diff --git a/tex/context/base/pack-obj.lua b/tex/context/base/pack-obj.lua index d1cc5bafc..a689a13b8 100644 --- a/tex/context/base/pack-obj.lua +++ b/tex/context/base/pack-obj.lua @@ -11,21 +11,40 @@ if not modules then modules = { } end modules ['pack-obj'] = { reusable components.

--ldx]]-- -local context = context +local context = context +local codeinjections = backends.codeinjections -local implement = interfaces.implement +local ctx_doifelse = commands.doifelse -local allocate = utilities.storage.allocate +local nuts = nodes.nuts -local collected = allocate() -local tobesaved = allocate() +local setlink = nuts.setlink +local getlist = nuts.getlist +local setbox = nuts.setbox -local jobobjects = { +local new_latelua = nuts.pool.latelua + +local settexdimen = tokens.setters.dimen +local settexcount = tokens.setters.count + +local gettexbox = tokens.getters.box +local gettexdimen = tokens.getters.dimen +local gettexcount = tokens.getters.count + +local implement = interfaces.implement +local setmacro = interfaces.setmacro + +local allocate = utilities.storage.allocate + +local collected = allocate() +local tobesaved = allocate() + +local jobobjects = { collected = collected, tobesaved = tobesaved, } -job.objects = jobobjects +job.objects = jobobjects local function initializer() collected = jobobjects.collected @@ -63,31 +82,171 @@ jobobjects.get = getobject jobobjects.number = getobjectnumber jobobjects.page = getobjectpage +-- implement { +-- name = "saveobject", +-- actions = saveobject +-- } +-- +-- implement { +-- name = "setobject", +-- actions = setobject, +-- arguments = { "string", "integer", "integer" } +-- } +-- +-- implement { +-- name = "objectnumber", +-- actions = { getobjectnumber, context }, +-- arguments = { "string", "string" }, +-- } +-- +-- implement { +-- name = "objectpage", +-- actions = { getobjectpage, context }, +-- arguments = { "string", "string" }, +-- } +-- +-- implement { +-- name = "doifelseobjectreferencefound", +-- actions = { getobject, commands.doifelse }, +-- arguments = "string" +-- } + +-- if false then +-- -- we can flush the inline ref ourselves now if we want +-- local flush = new_latelua("pdf.flushxform("..index..")") +-- flush.next = list +-- next.prev = flush +-- end + +local data = table.setmetatableindex("table") + +objects = { + data = data, + n = 0, +} + +function objects.register(ns,id,b,referenced) + objects.n = objects.n + 1 + nodes.handlers.finalize(b) + data[ns][id] = { + codeinjections.registerboxresource(b), -- a box number + gettexdimen("objectoff"), + referenced + } +end + +function objects.restore(ns,id) + local d = data[ns][id] + if d then + local index = d[1] + local offset = d[2] + local status = d[3] + local hbox = codeinjections.restoreboxresource(index) -- a nut ! + if status then + local list = getlist(hbox) + local page = new_latelua(function() + saveobject(ns .. "::" .. id,index,gettexcount("realpageno")) + end) + setlink(list,page) + end + setbox("objectbox",hbox) + settexdimen("objectoff",offset) + else + setbox("objectbox",nil) + settexdimen("objectoff",0) + end +end + +function objects.dimensions(index) + local d = data[ns][id] + if d then + return codeinjections.boxresourcedimensions(d[1]) + else + return 0, 0, 0 + end +end + +function objects.reference(ns,id) + local d = data[ns][id] + if d then + return d[1] + else + return getobjectnumber(ns .."::" .. id,0) + end +end + +function objects.page(ns,id) + return getobjectpage(ns .."::" .. id,gettexcount("realpageno")) +end + +function objects.found(ns,id) + return data[ns][id] +end + implement { - name = "saveobject", - actions = saveobject + name = "registerreferencedobject", + arguments = { "string", "string", "integer", true }, + actions = objects.register, } implement { - name = "setobject", - actions = setobject, - arguments = { "string", "integer", "integer" } + name = "registerobject", + arguments = { "string", "string", "integer" }, + actions = objects.register, } implement { - name = "objectnumber", - actions = { getobjectnumber, context }, + name = "restoreobject", arguments = { "string", "string" }, + actions = objects.restore, } implement { - name = "objectpage", - actions = { getobjectpage, context }, + name = "doifelseobject", arguments = { "string", "string" }, + actions = function(ns,id) + ctx_doifelse(data[ns][id]) + end, } implement { - name = "doifelseobjectreferencefound", - actions = { jobobjects.get, commands.doifelse }, - arguments = "string" + name = "getobjectreference", + arguments = { "string", "string", "csname" }, + actions = function(ns,id,target) + setmacro(target,objects.reference(ns,id),"global") + end +} + +implement { + name = "getobjectreferencepage", + arguments = { "string", "string", "csname" }, + actions = function(ns,id,target) + setmacro(target,objects.page(ns,id),"global") + end +} + +implement { + name = "getobjectdimensions", + arguments = { "string", "string" }, + actions = function(ns,id) + local o = data[ns][id] + local w, h, d = 0, 0, 0 + if d then + w, h, d = codeinjections.boxresourcedimensions(o[1]) + end + settexdimen("objectwd",w or 0) + settexdimen("objectht",h or 0) + settexdimen("objectdp",d or 0) + settexdimen("objectoff",o[2]) + end +} + +-- for the moment here: + +implement { + name = "registerbackendsymbol", + arguments = { "string", "integer" }, + actions = function(...) + codeinjections.registersymbol(...) + end } diff --git a/tex/context/base/pack-obj.mkiv b/tex/context/base/pack-obj.mkiv index 605dd3b9e..4a253324e 100644 --- a/tex/context/base/pack-obj.mkiv +++ b/tex/context/base/pack-obj.mkiv @@ -15,309 +15,101 @@ \unprotect -\let\objectreference\gobblefourarguments % catch mkii tuo stuff - \registerctxluafile{pack-obj}{1.001} -% \startluacode -% local texbox, texdimen, texcount, texwrite = tex.box, tex.dimen, tex.count, tex.write -% local pdfxform, pdfrefxform = pdf.xform, pdf.refxform -% -% function pdf.xform (l) texbox["objectbox"] = nil return l end -% function pdf.refxform(l) return node.copy_list(l) end -% -% backends.codeinjections.register = pdf.xform -% backends.codeinjections.restore = pdf.refxform -% -% local codeinjections = backends.codeinjections -% -% objects = objects or { } -% -% local data = { } -% -% objects.data = data -% objects.n = 0 -% -% function objects.register(name) -% objects.n = objects.n + 1 -% local list = texbox.objectbox -% nodes.handlers.finalize(list) -% data[name] = { -% codeinjections.restore(list), -% texdimen.objectwd, -% texdimen.objectht, -% texdimen.objectdp, -% texdimen.objectoff, -% } -% end -% -% function objects.restore(name) -% local d = data[name] -% if d then -% texbox .objectbox = codeinjections.restore(d[1]) -% texdimen.objectwd = d[2] -% texdimen.objectht = d[3] -% texdimen.objectdp = d[4] -% texdimen.objectoff = d[5] -% else -% texbox .objectbox = nil -% texdimen.objectwd = 0 -% texdimen.objectht = 0 -% texdimen.objectdp = 0 -% texdimen.objectoff = 0 -% end -% end -% -% function objects.reference(name) -% local d = data[name] -% texwrite((d and d[1]) or 0) -% end -% -% function objects.enhance(name) -% local d = data[name] -% if d then -% d[6] = texcount.realpageno -% end -% end -% -% function objects.page(name) -% local d = data[name] -% texwrite((d and d[6]) or texcount.realpageno) -% end -% -% function objects.doifelse(name) -% commands.testcase(data[name]) -% end -% \stopluacode -% -% \unprotect -% -% \newbox \objectbox -% \newtoks \everyobject -% \newif \ifinobject -% -% \newdimen\objectoff \def\objectmargin{\the\objectoff} -% \newdimen\objectwd \def\objectwidth {\the\objectwd } -% \newdimen\objectht \def\objectheight{\the\objectht } -% \newdimen\objectdp \def\objectdepth {\the\objectdp } -% -% \def\objectoffset{1cm} -% -% \everyobject{\the\pdfbackendeveryxform} -% -% \unexpanded\def\setobject #1#2{\begingroup\objectoff\objectoffset\inobjecttrue\the\everyobject\dowithnextbox{\pack_objects_set{#1}{#2}}} -% \unexpanded\def\settightobject#1#2{\begingroup\objectoff\zeropoint \inobjecttrue\the\everyobject\dowithnextbox{\pack_objects_set{#1}{#2}}} -% -% \let\objectsetvbox\vbox %\def\objectsetvbox{\ruledvbox} -% \let\objectgetvbox\vbox %\def\objectgetvbox{\ruledvbox} -% \let\objectsethbox\hbox %\def\objectsethbox{\ruledhbox} -% \let\objectgethbox\hbox %\def\objectgethbox{\ruledhbox} -% -% \unexpanded\def\pack_objects_set#1#2% -% {\objectwd\wd\nextbox -% \objectht\ht\nextbox -% \objectdp\dp\nextbox -% \ifdim\objectoff=\zeropoint\relax -% \setbox\objectbox\box\nextbox -% \else -% \setbox\objectbox\objectsetvbox spread 2\objectoff{\vss\objectsethbox spread 2\objectoff{\hss\box\nextbox\hss}\vss}% -% \fi -% \ctxlua{objects.register("#1::#2")}% -% \endgroup} -% -% \unexpanded\def\getobject#1#2% -% {\begingroup -% \ctxlua{objects.restore("#1::#2")}% -% \ifdim\objectoff=\zeropoint\relax \else -% \setbox\objectbox\objectgetvbox to \dimexpr\objectht+\objectdp\relax -% {\vss\objectgethbox to \objectwd{\hss\box\objectbox\hss}\vss}% -% \wd\objectbox\objectwd -% \ht\objectbox\objectht -% \dp\objectbox\objectdp -% \fi -% \box\objectbox -% \endgroup} -% -% \unexpanded\def\getpageobject#1#2% -% {\begingroup -% \ctxlua{objects.restore("#1::#2")}% -% \ifdim\objectoff=\zeropoint\relax -% \setbox\objectbox\objectgethbox{\ctxlatelua{objects.enhance("#1::#2")}\box\objectbox} -% \else -% \setbox\objectbox\objectgetvbox to \dimexpr\objectht+\objectdp\relax -% {\vss\objectgethbox to \objectwd{\ctxlatelua{objects.enhance("#1::#2")}\hss\box\objectbox\hss}\vss}% -% \wd\objectbox\objectwd -% \ht\objectbox\objectht -% \dp\objectbox\objectdp -% \fi -% \box\objectbox -% \endgroup} -% -% \unexpanded\def\setobjectdirectly #1#2{\ctxlua{objects.register("#1::#2")}} -% \unexpanded\def\getobjectdirectly #1#2{\ctxlua{objects.restore ("#1::#2")}} -% \unexpanded\def\getobjectdimensions #1#2{\ctxlua{objects.restore ("#1::#2")}} -% \unexpanded\def\doifobjectfoundelse #1#2{\ctxlua{objects.doifelse("#1::#2")}} -% \unexpanded\def\doifobjectreferencefoundelse#1#2{\ctxlua{objects.doifelse("#1::#2")}} -% -% \let\objectreferenced\relax -% \let\driverreferenced\relax -% -% \unexpanded\def\pack_objects_register_reference{\writestatus{objects}{obsolete: register object reference}\gobblethreearguments} -% \unexpanded\def\pack_objects_overload_reference{\writestatus{objects}{obsolete: overload object reference}\gobblethreearguments} -% \unexpanded\def\dosetobjectreference {\writestatus{objects}{obsolete: set object reference}\gobblethreearguments} -% \unexpanded\def\dosetdriverreference {\writestatus{objects}{obsolete: set driver reference}\gobblethreearguments} -% -% \def\defaultobjectreference{0} -% \def\defaultobjectpage {\realfolio} -% -% \unexpanded\def\dogetobjectreference #1#2#3{\xdef#3{\ctxlua{objects.reference("#1::#2)}}} -% \unexpanded\def\dogetobjectreferencepage#1#2#3{\xdef#3{\ctxlua{objects.page("#1::#2))}}} -% -% \protect -% -% \starttext -% test \setobject{a}{b}\ruledhbox{xxx}\getobject{a}{b} test -% \vskip3cm -% test \settightobject{a}{b}\ruledhbox{xxx}\getobject{a}{b} test -% test \settightobject{a}{c}\ruledhbox{xxx}\getobject{a}{c} test -% \dorecurse{5000}{test \setobject{a}{b}\ruledhbox{xxx}\getobject{a}{b} test } -% \stoptext - %D \macros %D {setobject,getobject,ifinobject} %D -%D Boxes can be considered reuable objects. Unfortunaltely once -%D passed to the \DVI\ file, such objects cannot be reused. In -%D \PDF\ however, reusing is possible and sometimes even a -%D necessity. Therefore, \CONTEXT\ supports reusable objects. -%D -%D During the \TEX\ processing run, boxes can serve the purpose -%D of objects, and the \DVI\ driver module implements objects -%D using packed boxes. +%D Boxes can be considered reuable objects. Traditionally once passed +%D to the \DVI\ file, such objects cannot be reused. In \PDF\ however, +%D reusing is possible and sometimes even a necessity. Therefore, +%D \CONTEXT\ supports reusable objects and \LUATEX\ has native support +%D for so called box resources. %D -%D The \PDF\ and \PDFTEX\ driver modules implement objects -%D using \PDF\ forms. There is no (real) restriction on the -%D number of objects there. -%D -%D The first application of objects in \CONTEXT\ concerned -%D \METAPOST\ graphics and fill||in form fields. The first -%D application can save lots of bytes, while the latter use is -%D more a necessity than byte saving. +%D The first application of objects in \CONTEXT\ concerned \METAPOST\ +%D graphics and fill||in form fields. Reusing resources can save lots +%D of bytes and sometimes also runtime. %D %D \starttyping %D \setobject{class}{name}\somebox{} %D \getobject{class}{name} %D \stoptyping %D -%D Here \type{\somebox} can be whatever box specification suits -%D \TEX. We save the dimensions of an object, although some -%D drivers will do so themselves. This means that when for -%D instance using \PDFTEX\ we could save a hash entry plus some -%D 20+ memory locations per object by delegating this -%D housekeeping to the driver. The current approach permits -%D us to keep the box characteristic too. +%D Here \type {\somebox} can be whatever box specification suits \TEX. +%D Although the implementation in \MKIV\ is somewhat different the +%D principles have not changed. \installcorenamespace {objects} -\newif\ifinobject % public (might become a conditional) - -\def\objectplaceholder{NOT YET FLUSHED} - -\unexpanded\def\presetobject#1#2% \global added - {\ifcsname\??objects#1::#2\endcsname\else - \global\expandafter\let\csname\??objects#1::#2\endcsname\objectplaceholder - \fi} - -\unexpanded\def\pack_objects_set#1#2#3% - {\ifcsname\??objects#2::#3\endcsname - \expandafter\gobblefivearguments - \else % tzt, overload internal referenced objects to save entries - \expandafter\pack_objects_set_indeed - \fi - {#1}{#2}{#3}} - -\unexpanded\def\resetobject#1#2% - {\letbeundefined{\??objects#1::#2}} - -%D \macros -%D {finalizeobjectbox} -%D -%D This one provides a hook for last minute object box processing -%D we need this in \MKIV. - -\ifdefined\finalizeobjectbox \else - \let\finalizeobjectbox\gobbleoneargument -\fi - -%D Somehow there is a rounding error problem in either \PDFTEX\ -%D or in viewers, or maybe it is conforming the specs. The next -%D variable compensate for it by removing the rather tight -%D clip. +\newif \ifinobject +\newbox \objectbox \def\objectoffset{1cm} -\unexpanded\def\pack_objects_set_indeed#1#2#3% - {\bgroup - \globalpushmacro\crossreferenceobject - \objectreferenced - \inobjecttrue - \dowithnextbox - {\globalpopmacro\crossreferenceobject - \pack_objects_set_indeed_indeed{#1}{#2}{#3}% - \egroup}} +\newdimen\objectoff \def\objectmargin{\the\objectoff} +\newdimen\objectwd \def\objectwidth {\the\objectwd} +\newdimen\objectht \def\objectheight{\the\objectht} +\newdimen\objectdp \def\objectdepth {\the\objectdp} -% in luatex version < 66 we had a 1bp compensation (hardcoded in luatex) +% If I have time I will use the unreferenced variant for e.g. mp reuse. -\let\pack_objects_handle\relax +\unexpanded\def\setreferencedobject #1#2{\begingroup\objectoff\objectoffset\inobjecttrue\dowithnextbox{\pack_objects_set_yes{#1}{#2}}} +\unexpanded\def\settightreferencedobject #1#2{\begingroup\objectoff\zeropoint \inobjecttrue\dowithnextbox{\pack_objects_set_yes{#1}{#2}}} +\unexpanded\def\setunreferencedobject #1#2{\begingroup\objectoff\objectoffset\inobjecttrue\dowithnextbox{\pack_objects_set_nop{#1}{#2}}} +\unexpanded\def\settightunreferencedobject#1#2{\begingroup\objectoff\zeropoint \inobjecttrue\dowithnextbox{\pack_objects_set_nop{#1}{#2}}} -\unexpanded\def\pack_objects_set_indeed_indeed#1#2#3% - {\begingroup - \scratchdimen\objectoffset - \expandafter\xdef\csname\??objects#2::#3\endcsname - {\pack_objects_handle - {#2}% - {#3}% - {\ifhbox\nextbox\hbox\else\vbox\fi}% - {\number\wd\nextbox}% - {\number\ht\nextbox}% - {\number\dp\nextbox}% - {\number\scratchdimen}}% - \expanded % freeze the dimensions since \dostartobject may use \nextbox - {\dostartobject{#2}{#3}{\the\wd\nextbox}{\the\ht\nextbox}{\the\dp\nextbox}}% - \ifcase#1\relax\else \ifdim\objectoffset>\zeropoint - \setbox\nextbox\vbox \s!spread 2\scratchdimen - {\forgetall \offinterlineskip - \vss\hbox \s!spread 2\scratchdimen{\hss\box\nextbox\hss}\vss}% - \fi \fi - \box\nextbox - \dostopobject +\let\setobject \setreferencedobject +\let\settightobject\settightreferencedobject + +\unexpanded\def\pack_objects_set_yes#1#2% + {\ifdim\objectoff>\zeropoint\relax + \pack_objects_package + \else + \setbox\objectbox\box\nextbox + \fi + \clf_registerreferencedobject{#1}{#2}\objectbox \endgroup} -\unexpanded\def\getobject#1#2% - {\ifcsname\??objects#1::#2\endcsname - \begingroup - \let\pack_objects_handle\pack_objects_get - \csname\??objects#1::#2\expandafter\endcsname +\unexpanded\def\pack_objects_set_nop#1#2% + {\ifdim\objectoff>\zeropoint\relax + \pack_objects_package \else - {\infofont[object #1::#2]}% - \fi} + \setbox\objectbox\box\nextbox + \fi + \clf_registerobject{#1}{#2}\objectbox + \endgroup} -\unexpanded\def\pack_objects_get#1#2#3#4#5#6#7% don't change this, should work for dvi & pdf - {\forgetall - % todo: if no attr then faster - \setbox\scratchbox\vbox attr \viewerlayerattribute \attribute\viewerlayerattribute - {\doinsertobject{#1}{#2}}% - \setbox\scratchbox#3% - {\vbox to #5\scaledpoint - {\ifdim\ht\scratchbox>#5\scaledpoint - \vss\hbox to #4\scaledpoint{\hss\box\scratchbox\hss}\vss - \else\ifdim\wd\scratchbox>#4\scaledpoint - \vss\hbox to #4\scaledpoint{\hss\box\scratchbox\hss}\vss - \else - %\vss\box\scratchbox - \vss\hbox to #4\scaledpoint{\box\scratchbox\hss}% fix Chof - \fi\fi}}% - \box\scratchbox +\def\pack_objects_package + {\objectwd\dimexpr\wd\nextbox+2\objectoff\relax + \objectht\dimexpr\ht\nextbox+ \objectoff\relax + \objectdp\dimexpr\dp\nextbox+ \objectoff\relax + \setbox\objectbox\hbox + {\hskip\objectoff + \raise\objectoff + \box\nextbox}% + \wd\objectbox\objectwd + \ht\objectbox\objectht + \dp\objectbox\objectdp} + +\def\pack_objects_repackage + {\objectwd\dimexpr\wd\objectbox-2\objectoff\relax + \objectht\dimexpr\ht\objectbox- \objectoff\relax + \objectdp\dimexpr\dp\objectbox- \objectoff\relax + \setbox\objectbox\hbox + {\hskip-\objectoff + \lower\objectoff + \box\objectbox}% + \wd\objectbox\objectwd + \ht\objectbox\objectht + \dp\objectbox\objectdp} + +\unexpanded\def\getobject#1#2% + {\begingroup + \clf_restoreobject{#1}{#2}% + \ifdim\objectoff>\zeropoint + \pack_objects_repackage + \fi + \box\objectbox \endgroup} %D If needed one can ask for the dimensions of an object with: @@ -329,64 +121,8 @@ %D The results are reported in \type {\objectwidth}, \type %D {\objectheight} and \type {\objectdepth}. -\unexpanded\def\pack_objects_get_dimensions#1#2#3#4#5#6#7% - {\def\objectwidth {#4\s!sp}% - \def\objectheight{#5\s!sp}% - \def\objectdepth {#6\s!sp}% - \def\objectmargin{#7\s!sp}} - \unexpanded\def\getobjectdimensions#1#2% - {\let\pack_objects_handle\pack_objects_get_dimensions - \let\objectwidth \!!zeropoint - \let\objectheight\!!zeropoint - \let\objectdepth \!!zeropoint - \csname\??objects#1::#2\endcsname} - -%D Apart from this kind of objects, that have typeset content, -%D we can have low level driver specific objects. Both types -%D can have references to internal representations, hidden for -%D the user. We keep track of such references by means of a -%D dedicated cross reference mechanism. Normally, objects are -%D defined before they are used, but forward referencing -%D sometimes occurs. -%D -%D \starttyping -%D \dosetobjectreference {class} {identifier} {reference value} {page} -%D \dogetobjectreference {class} {identifier} \csname -%D \stoptyping -%D -%D These commands are to be called by the \type{\startobject}, -%D \type{\stopobject} and \type{\insertobject} specials. - -\unexpanded\def\objectreferenced{\global\chardef\crossreferenceobject\plusone} -\unexpanded\def\driverreferenced{\global\chardef\crossreferenceobject\zerocount} - -\objectreferenced - -% no undefined test ! ! ! ! (pdftex fails on undefined objects) - -\unexpanded\def\pack_objects_register_reference#1#2#3{\normalexpanded{\noexpand\ctxlatecommand{saveobject("#1::#2",#3,\noexpand\the\realpageno)}}} -\unexpanded\def\pack_objects_overload_reference#1#2#3{\clf_setobject{#1::#2}#3 \realpageno\relax} - -\unexpanded\def\dosetobjectreference - {\ifcase\crossreferenceobject - \objectreferenced - \expandafter\pack_objects_overload_reference - \else - \expandafter\pack_objects_register_reference - \fi} - -\unexpanded\def\dosetdriverreference - {\driverreferenced\dosetobjectreference} - -\def\defaultobjectreference#1#2{0} % driver dependent -\def\defaultobjectpage #1#2{\realfolio} - -\unexpanded\def\dogetobjectreference #1#2#3{\xdef#3{\clf_objectnumber{#1::#2}{\defaultobjectreference{#1}{#2}}}} -\unexpanded\def\dogetobjectreferencepage#1#2#3{\xdef#3{\clf_objectpage {#1::#2}{\defaultobjectpage {#1}{#2}}}} - -\unexpanded\def\setobject {\driverreferenced\pack_objects_set1} -\unexpanded\def\settightobject{\driverreferenced\pack_objects_set0} + {\clf_getobjectdimensions{#1}{#2}} %D \macros %D {doifobjectfoundelse,doifobjectreferencefoundelse} @@ -399,17 +135,25 @@ %D \doifobjectreferencefoundelse{class}{object}{do then}{do else} %D \stoptyping -\unexpanded\def\doifelseobjectfound#1#2% - {\ifcsname\??objects#1::#2\endcsname - \expandafter\firstoftwoarguments - \else - \expandafter\secondoftwoarguments - \fi} +\def\defaultobjectreference{0} +\def\defaultobjectpage {\realfolio} + +\unexpanded\def\dogetobjectreference {\clf_getobjectreference} +\unexpanded\def\dogetobjectreferencepage {\clf_getobjectreferencepage} + +\unexpanded\def\doifobjectfoundelse {\clf_doifelseobject} +\unexpanded\def\doifobjectreferencefoundelse{\clf_doifelseobject} +\unexpanded\def\doifelseobjectfound {\clf_doifelseobject} +\unexpanded\def\doifelseobjectreferencefound{\clf_doifelseobject} -\unexpanded\def\doifelseobjectreferencefound#1#2% - {\clf_doifelseobjectreferencefound{#1::#2}} +%D For the moment here: -\let\doifobjectfoundelse \doifelseobjectfound -\let\doifobjectreferencefoundelse\doifelseobjectreferencefound +\unexpanded\def\predefinesymbol[#1]% + {\begingroup + \xdef\lastpredefinedsymbol{#1}% + \settightobject{SYM}{#1}\hbox{\symbol[#1]}% to be checked ... maybe only fitting + \dogetobjectreference{SYM}{#1}\m_back_object_reference + \clf_registerbackendsymbol{#1}\m_back_object_reference\relax + \endgroup} \protect \endinput diff --git a/tex/context/base/page-brk.mkiv b/tex/context/base/page-brk.mkiv index f9c933052..b9805decd 100644 --- a/tex/context/base/page-brk.mkiv +++ b/tex/context/base/page-brk.mkiv @@ -387,6 +387,8 @@ % \fi % \fi} +\let\triggerpagebuilder\relax + \installcorenamespace {pagechecker} \installcorenamespace {pagecheckermethod} @@ -414,6 +416,8 @@ \def\page_check[#1][#2]% {\relax % needed before \if \endgraf + \triggerpagebuilder + \relax \ifconditional\c_page_breaks_enabled \begingroup \edef\currentpagechecker{#1}% diff --git a/tex/context/base/page-imp.mkiv b/tex/context/base/page-imp.mkiv index 198a98229..3d913a70a 100644 --- a/tex/context/base/page-imp.mkiv +++ b/tex/context/base/page-imp.mkiv @@ -1014,9 +1014,9 @@ \installpagearrangement 1*2-Conference {\dosetuparrangement{1}{2}{4}{3}{2}% X,Y,Total,hcutmarks,vcutmarks - \pusharrangedpageCONFERENCE2\poparrangedpagesAB\relax} + \pusharrangedpageCONFERENCETWO\poparrangedpagesAB\relax} -\def\pusharrangedpageCONFERENCE2#1% +\def\pusharrangedpageCONFERENCETWO#1% {\advancearrangedpageN \reportarrangedpage\arrangedpageN \ifcase\arrangedpageN @@ -1030,9 +1030,9 @@ \installpagearrangement 1*4-Conference {\dosetuparrangement{1}{2}{4}{3}{2}% X,Y,Total,hcutmarks,vcutmarks - \pusharrangedpageCONFERENCE4\poparrangedpagesAB\relax} + \pusharrangedpageCONFERENCEFOUR\poparrangedpagesAB\relax} -\def\pusharrangedpageCONFERENCE4#1% +\def\pusharrangedpageCONFERENCEFOUR#1% {\advancearrangedpageN \reportarrangedpage\arrangedpageN \ifcase\arrangedpageN diff --git a/tex/context/base/page-lin.mkvi b/tex/context/base/page-lin.mkvi index 28c0b0bc5..11e1f0b1b 100644 --- a/tex/context/base/page-lin.mkvi +++ b/tex/context/base/page-lin.mkvi @@ -188,7 +188,7 @@ \def\page_lines_start_zero[#1][#2]% {\edef\m_argument{\linenumberingparameter\c!continue}% - \ifx\m_argument\v!continue + \ifx\m_argument\v!yes \c_page_lines_mode\zerocount \else \c_page_lines_mode\plusone diff --git a/tex/context/base/page-mix.lua b/tex/context/base/page-mix.lua index 806632881..e52ba09db 100644 --- a/tex/context/base/page-mix.lua +++ b/tex/context/base/page-mix.lua @@ -53,13 +53,17 @@ local traversenodes = nuts.traverse local getfield = nuts.getfield local setfield = nuts.setfield +local setlink = nuts.setlink +local setnext = nuts.setnext +local setprev = nuts.setprev +local setbox = nuts.setbox + local getnext = nuts.getnext local getprev = nuts.getprev local getid = nuts.getid local getlist = nuts.getlist local getsubtype = nuts.getsubtype local getbox = nuts.getbox -local setbox = nuts.setbox local getskip = nuts.getskip local getattribute = nuts.getattribute @@ -186,7 +190,7 @@ local function discardtopglue(current,discarded) end end if current then - setfield(current,"prev",nil) -- prevent look back + setprev(current) -- prevent look back end return current, size end @@ -761,19 +765,18 @@ local function finalize(result) local r = results[i] local h = r.head if h then - setfield(h,"prev",nil) + setprev(h) if r.back then local k = new_glue(r.back) - setfield(h,"prev",k) - setfield(k,"next",h) + setlink(k,h) h = k r.head = h end local t = r.tail if t then - setfield(t,"next",nil) + setnext(t,nil) else - setfield(h,"next",nil) + setnext(h,nil) r.tail = h end for c, list in next, r.inserts do @@ -787,8 +790,8 @@ end setfield(h,"depth",getfield(l,"depth")) setfield(l,"head",nil) end - setfield(t[1],"prev",nil) -- needs checking - setfield(t[#t],"next",nil) -- needs checking + setprev(t[1]) -- needs checking + setnext(t[#t]) -- needs checking r.inserts[c] = t end end @@ -870,7 +873,7 @@ local function getsplit(result,n) return new_glue(result.originalwidth) end - setfield(h,"prev",nil) -- move up + setprev(h) -- move up local strutht = result.strutht local strutdp = result.strutdp local lineheight = strutht + strutdp diff --git a/tex/context/base/page-mix.mkiv b/tex/context/base/page-mix.mkiv index 7d9f4935c..5ff4ccc17 100644 --- a/tex/context/base/page-mix.mkiv +++ b/tex/context/base/page-mix.mkiv @@ -595,7 +595,7 @@ \def\page_mix_routine_package_step {% needs packaging anyway \setbox\scratchbox\page_mix_command_package_column -\page_lines_add_numbers_to_box\scratchbox\recurselevel\c_page_mix_n_of_columns\plusone % new + \page_lines_add_numbers_to_box\scratchbox\recurselevel\c_page_mix_n_of_columns\plusone % new \page_marks_synchronize_column\plusone\c_page_mix_n_of_columns\recurselevel\scratchbox % backgrounds \anch_mark_column_box\scratchbox diff --git a/tex/context/base/page-set.mkiv b/tex/context/base/page-set.mkiv index 51f990308..83bdf9a9f 100644 --- a/tex/context/base/page-set.mkiv +++ b/tex/context/base/page-set.mkiv @@ -1200,12 +1200,12 @@ {\OTRSETcheckprefered \enoughcolumncellsfalse \donefalse - \dostepwiserecurse{#1}{#2}{#31} + \dostepwiserecurse{#1}{#2}{#3#4} {\ifdone \exitloop \else #4=\recurselevel - \dostepwiserecurse{#5}{#6}{#71} + \dostepwiserecurse{#5}{#6}{#7#8} {\ifdone \exitloop \else diff --git a/tex/context/base/page-txt.mkvi b/tex/context/base/page-txt.mkvi index 7bcf0d014..8be4211bb 100644 --- a/tex/context/base/page-txt.mkvi +++ b/tex/context/base/page-txt.mkvi @@ -472,9 +472,9 @@ \resetlayoutelementparameter\c!righttext \fi\fi} -\letvalue{\??layouttextcontent\c!middle:\v!text}\c!middletext -\letvalue{\??layouttextcontent\c!left :\v!text}\c!lefttext -\letvalue{\??layouttextcontent\c!right :\v!text}\c!righttext +\letvalue{\??layouttextcontent\v!text:\c!middle}\c!middletext +\letvalue{\??layouttextcontent\v!text:\c!left }\c!lefttext +\letvalue{\??layouttextcontent\v!text:\c!right }\c!righttext %D The placement of a whole line is handled by the next two %D macros. These are hooked into the general purpose token diff --git a/tex/context/base/publ-imp-apa.mkvi b/tex/context/base/publ-imp-apa.mkvi index 85e0ebd5f..9468b0b0c 100644 --- a/tex/context/base/publ-imp-apa.mkvi +++ b/tex/context/base/publ-imp-apa.mkvi @@ -731,7 +731,7 @@ % #title can be title or booktitle -\starttexdefinition btx:apa:translated-title #title +\starttexdefinition unexpanded btx:apa:translated-title #title \ifx\currentbtxlanguage\empty % no need for an extra \else\ifx\mainbtxlanguage\currentbtxlanguage @@ -750,10 +750,11 @@ \fi\fi \stoptexdefinition -\starttexdefinition btx:apa:composed-title #title - \btxstartstyleandcolor [apa:\s!list:title:\currentbtxcategory] +\starttexdefinition unexpanded btx:apa:composed-title #title + \btxstartstyleandcolor[apa:\s!list:title:\currentbtxcategory] \begingroup \language[\currentbtxlanguage] + \tracingall \btxusecommand [apa:\s!list:title:\currentbtxcategory] { \btxflush{#title} \btxdoif {sub#title} { @@ -769,7 +770,7 @@ \btxstopstyleandcolor \stoptexdefinition -\starttexdefinition btx:apa:title +\starttexdefinition unexpanded btx:apa:title \setmode{btx:apa:title-placed} % we make the title active, opening "file" \btxdoifelse {file} { @@ -787,7 +788,7 @@ } \stoptexdefinition -\starttexdefinition btx:apa:title-if-not-placed +\starttexdefinition unexpanded btx:apa:title-if-not-placed \doifelsemode {btx:apa:title-placed} { \resetmode{btx:apa:title-placed} } { @@ -798,7 +799,7 @@ } \stoptexdefinition -\starttexdefinition btx:apa:suffixedyear +\starttexdefinition unexpanded btx:apa:suffixedyear \btxdoifelse {year} { \btxflush{year} \btxflushsuffix @@ -815,7 +816,7 @@ % #author may be author(set) or editor -\starttexdefinition btx:apa:author-or-editor #author +\starttexdefinition unexpanded btx:apa:author-or-editor #author \btxdoif {#author} { \btxflush{#author} \doifelse {\btxfoundname{#author}} {editor} { @@ -864,7 +865,7 @@ } \stoptexdefinition -\starttexdefinition btx:apa:authoryear +\starttexdefinition unexpanded btx:apa:authoryear % we make the authoryear active, pointing to the citation \texdefinition{btx:format:inject} {internal(\currentbtxinternal)} @@ -889,7 +890,7 @@ } \stoptexdefinition -\starttexdefinition btx:apa:editor-in +\starttexdefinition unexpanded btx:apa:editor-in \btxdoif {booktitle} { \btxlabeltext{apa:In} \doifnot {\btxfoundname{author}} {editor} { @@ -897,7 +898,7 @@ \texdefinition{btx:apa:author-or-editor} {editor} } \btxspace - \texdefinition{btx:apa:composed-title} {booktitle} + \texdefinition{btx:apa:composed-title}{booktitle} \btxperiod } \stoptexdefinition @@ -905,7 +906,7 @@ % TODO: The title is terminated with period. However, % we probably don't want this before the parenthesis. -\starttexdefinition btx:apa:leftparenthesis-or-comma +\starttexdefinition unexpanded btx:apa:leftparenthesis-or-comma \doifelsemode {btx:apa:editionset-is-empty} { \btxleftparenthesis \resetmode{btx:apa:editionset-is-empty} @@ -914,7 +915,7 @@ } \stoptexdefinition -\starttexdefinition btx:apa:editionset +\starttexdefinition unexpanded btx:apa:editionset \setmode{btx:apa:editionset-is-empty} \doif {\currentbtxcategory} {techreport} { \texdefinition{btx:apa:leftparenthesis-or-comma} @@ -963,7 +964,7 @@ } \stoptexdefinition -\starttexdefinition btx:apa:journal +\starttexdefinition unexpanded btx:apa:journal \btxstartstyleandcolor[apa:\s!list:journal] \btxusecommand [apa:\s!list:journal] { \btxflush{journal} @@ -971,7 +972,7 @@ \btxstopstyleandcolor \stoptexdefinition -\starttexdefinition btx:apa:volume +\starttexdefinition unexpanded btx:apa:volume \btxstartstyleandcolor[apa:\s!list:volume] \btxflush{volume} \btxstopstyleandcolor @@ -979,7 +980,7 @@ % this could be simplified! -\starttexdefinition btx:apa:journal-volume-number-pages +\starttexdefinition unexpanded btx:apa:journal-volume-number-pages \btxdoif {journal} { \btxspace \texdefinition{btx:apa:journal} @@ -1028,7 +1029,7 @@ } \stoptexdefinition -\starttexdefinition btx:apa:wherefrom-publisher +\starttexdefinition unexpanded btx:apa:wherefrom-publisher \btxdoifelse {address} { \btxflush{address} \btxdoif {country} { @@ -1062,7 +1063,7 @@ % use \btxentry here? -\starttexdefinition btx:apa:url +\starttexdefinition unexpanded btx:apa:url \btxspace \btxlabeltext{apa:Retrieved} \btxspace @@ -1082,7 +1083,7 @@ % use \btxentry here? -\starttexdefinition btx:apa:doi +\starttexdefinition unexpanded btx:apa:doi \btxspace \begingroup \setbreakpoints[doi] @@ -1098,7 +1099,7 @@ \endgroup \stoptexdefinition -\starttexdefinition btx:apa:note +\starttexdefinition unexpanded btx:apa:note \btxdoif {note} { \btxleftparenthesis \btxflush{note} @@ -1106,7 +1107,7 @@ } \stoptexdefinition -\starttexdefinition btx:apa:url-doi-note +\starttexdefinition unexpanded btx:apa:url-doi-note \doif {\btxfoundname{doi}} {url} { \texdefinition{btx:apa:url} } diff --git a/tex/context/base/publ-imp-aps.mkvi b/tex/context/base/publ-imp-aps.mkvi index 71b0dc185..674245714 100644 --- a/tex/context/base/publ-imp-aps.mkvi +++ b/tex/context/base/publ-imp-aps.mkvi @@ -631,7 +631,7 @@ %D returned. In lua syntax, it can be understood as %D author or editor or publisher or title or "" -\starttexdefinition btx:aps:composed-title #title +\starttexdefinition unexpanded btx:aps:composed-title #title \btxstartstyleandcolor [aps:\s!list:title:\currentbtxcategory] \begingroup \language[\currentbtxlanguage] @@ -646,7 +646,7 @@ \btxstopstyleandcolor \stoptexdefinition -\starttexdefinition btx:aps:title +\starttexdefinition unexpanded btx:aps:title \btxdoif {title} { % we make the title active, opening file \btxdoifelse {file} { @@ -662,13 +662,13 @@ } \stoptexdefinition -\starttexdefinition btx:aps:optional-title +\starttexdefinition unexpanded btx:aps:optional-title \doif{\btxparameter{\c!title}}\v!yes { \texdefinition {btx:aps:title} } \stoptexdefinition -\starttexdefinition btx:aps:year +\starttexdefinition unexpanded btx:aps:year \btxdoifelse {year} { \btxflush{year} } { @@ -678,7 +678,7 @@ % #author may be author(set) or editor -\starttexdefinition btx:aps:author-or-editor #author +\starttexdefinition unexpanded btx:aps:author-or-editor #author \btxdoif {#author} { \btxflush{#author} \doifelse {\btxfoundname{#author}} {editor} { @@ -699,12 +699,12 @@ } \stoptexdefinition -\starttexdefinition btx:aps:author +\starttexdefinition unexpanded btx:aps:author \btxflush{author} \btxcomma \stoptexdefinition -\starttexdefinition btx:aps:editor-in +\starttexdefinition unexpanded btx:aps:editor-in \btxdoif {booktitle} { \btxlabeltext{aps:In} \doifnot {\btxfoundname{author}} {editor} { @@ -712,12 +712,12 @@ \texdefinition{btx:aps:author-or-editor} {editor} } \btxspace - \texdefinition{btx:aps:composed-title} {booktitle} + \texdefinition{btx:aps:composed-title}{booktitle} \btxcomma } \stoptexdefinition -\starttexdefinition btx:aps:editionset +\starttexdefinition unexpanded btx:aps:editionset \doif {\currentbtxcategory} {techreport} { \btxdoifelse {type} { \btxusecommand [\currentbtx:type] { @@ -762,7 +762,7 @@ } \stoptexdefinition -\starttexdefinition btx:aps:journal-volume-year +\starttexdefinition unexpanded btx:aps:journal-volume-year \btxdoif {journal} { \btxstartstyleandcolor [aps:\s!list:journal] % expandedjournal abbreviatedjournal @@ -795,7 +795,7 @@ \btxrightparenthesis \stoptexdefinition -\starttexdefinition btx:aps:publisher-wherefrom-year +\starttexdefinition unexpanded btx:aps:publisher-wherefrom-year \removeunwantedspaces \removepunctuation \btxleftparenthesis @@ -819,7 +819,7 @@ \btxrightparenthesis \stoptexdefinition -\starttexdefinition btx:aps:note +\starttexdefinition unexpanded btx:aps:note \btxperiod \btxdoif {note} { \btxleftparenthesis @@ -828,7 +828,7 @@ } \stoptexdefinition -\starttexdefinition btx:aps:doi-url #text +\starttexdefinition unexpanded btx:aps:doi-url #text \ifconditional\btxinteractive \btxdoifelse {doi} { \goto {#text} [url(http://dx.doi.org/\btxflush{doi})] diff --git a/tex/context/base/publ-imp-author.mkvi b/tex/context/base/publ-imp-author.mkvi index 7529c7aa9..b52433186 100644 --- a/tex/context/base/publ-imp-author.mkvi +++ b/tex/context/base/publ-imp-author.mkvi @@ -23,7 +23,7 @@ % \currentbtxsurnames : \btxauthorfield{surnames} % \currentbtxjuniors : \btxauthorfield{juniors} -\starttexdefinition \s!btx:\s!cite:\s!author:\s!de +\starttexdefinition unexpanded \s!btx:\s!cite:\s!author:\s!de \ifx\currentbtxlanguage\s!de \setmode{\s!btx:\s!de} \fi diff --git a/tex/context/base/publ-imp-cite.mkvi b/tex/context/base/publ-imp-cite.mkvi index 54e23f67d..cb1c46fe4 100644 --- a/tex/context/base/publ-imp-cite.mkvi +++ b/tex/context/base/publ-imp-cite.mkvi @@ -13,7 +13,7 @@ \unprotect -\starttexdefinition btx:cite:inject #content +\starttexdefinition unexpanded btx:cite:inject #content \ifconditional\btxinteractive \ifx\currentbtxinternal\empty #content @@ -29,7 +29,7 @@ \fi \stoptexdefinition -\starttexdefinition btx:cite:checkconcat +\starttexdefinition unexpanded btx:cite:checkconcat \ifnum\currentbtxcount>\zerocount \let\currentbtxinternal\empty \let\currentbtxbacklink\empty @@ -66,7 +66,7 @@ {\tt <\currentbtxreference>} \stopsetups -\starttexdefinition btx:cite:concat +\starttexdefinition unexpanded btx:cite:concat \btxparameter{\c!separator:\number\currentbtxconcat} \stoptexdefinition diff --git a/tex/context/base/publ-imp-default.mkvi b/tex/context/base/publ-imp-default.mkvi index 6a15712ad..f5c99ac18 100644 --- a/tex/context/base/publ-imp-default.mkvi +++ b/tex/context/base/publ-imp-default.mkvi @@ -141,7 +141,7 @@ [\s!default:\s!list:title:article] [\s!default:\s!list:title] [\c!style=, % journal is set in italics - \c!command={\quotation\Word}] + \c!command=\quotation] % alan, you can't do \quotation\Word \definebtx [\s!default:\s!list:title:book] diff --git a/tex/context/base/publ-imp-definitions.mkvi b/tex/context/base/publ-imp-definitions.mkvi index 8dfa931b3..295586f60 100644 --- a/tex/context/base/publ-imp-definitions.mkvi +++ b/tex/context/base/publ-imp-definitions.mkvi @@ -27,7 +27,7 @@ \btxfield{short} \stopxmlsetups -\starttexdefinition btx:format:inject #link #content +\starttexdefinition unexpanded btx:format:inject #link #content \ifx\currentbtxinternal\empty #content \else\ifconditional\btxinteractive @@ -86,7 +86,7 @@ % macros: -\starttexdefinition btx:style:italic #content +\starttexdefinition unexpanded btx:style:italic #content \dontleavehmode \begingroup \it @@ -95,7 +95,7 @@ \endgroup \stoptexdefinition -\starttexdefinition btx:style:bold #content +\starttexdefinition unexpanded btx:style:bold #content \dontleavehmode \begingroup \bf @@ -103,14 +103,14 @@ \endgroup \stoptexdefinition -\starttexdefinition btx:style:quote #content +\starttexdefinition unexpanded btx:style:quote #content \dontleavehmode \startquote #content \stopquote \stoptexdefinition -\starttexdefinition btx:style #style #content +\starttexdefinition unexpanded btx:style #style #content \doifelsedefined {btx:style:#style} { \texdefinition{btx:style:#style} { #content diff --git a/tex/context/base/publ-imp-list.mkvi b/tex/context/base/publ-imp-list.mkvi index 23256de33..68ccaef01 100644 --- a/tex/context/base/publ-imp-list.mkvi +++ b/tex/context/base/publ-imp-list.mkvi @@ -13,7 +13,7 @@ \unprotect -\starttexdefinition btx:list:inject #content +\starttexdefinition unexpanded btx:list:inject #content \ifconditional\btxinteractive \ifx\currentbtxinternal\empty #content @@ -29,7 +29,7 @@ \fi \stoptexdefinition -\starttexdefinition btx:list:helpers:concat +\starttexdefinition unexpanded btx:list:helpers:concat \space \stoptexdefinition diff --git a/tex/context/base/scrn-but.lua b/tex/context/base/scrn-but.lua index 7d883c910..85cbf0b39 100644 --- a/tex/context/base/scrn-but.lua +++ b/tex/context/base/scrn-but.lua @@ -11,7 +11,7 @@ local f_two_colon = string.formatters["%s:%s"] local function registerbuttons(tag,register,language) local data = sorters.definitions[language] - local orders = daya and data.orders or sorters.definitions.default.orders + local orders = data and data.orders or sorters.definitions.default.orders local tag = tag == "" and { "" } or { tag } for i=1,#orders do local order = orders[i] diff --git a/tex/context/base/scrn-but.mkvi b/tex/context/base/scrn-but.mkvi index 3fdaf2c5d..1d5ffe6f3 100644 --- a/tex/context/base/scrn-but.mkvi +++ b/tex/context/base/scrn-but.mkvi @@ -724,7 +724,7 @@ {\scrn_menu_action_start \letinteractionmenuparameter\c!frame\v!off \letinteractionmenuparameter\c!background\empty - \letinteractionmenuparameter\v!yes + \letinteractionmenuparameter\c!empty\v!yes \inheritedinteractionmenuframed{\ignorespaces#text\removeunwantedspaces}% \scrn_menu_action_stop} diff --git a/tex/context/base/scrn-fld.mkvi b/tex/context/base/scrn-fld.mkvi index 4b4c9d0ee..9a69bbdc5 100644 --- a/tex/context/base/scrn-fld.mkvi +++ b/tex/context/base/scrn-fld.mkvi @@ -141,9 +141,6 @@ {\definesymbol[defaultyes][\mathematics{\times}]% \definesymbol[defaultno] [\mathematics{\cdot }]} -% \def\resetfieldsymbol[#tag]% for experimental usage only -% {\resetobject{SYM}{#tag}} - %D Now comes the real code: \installcorenamespace{fieldcategory} diff --git a/tex/context/base/scrn-hlp.mkvi b/tex/context/base/scrn-hlp.mkvi index eca79c90a..7466e5687 100644 --- a/tex/context/base/scrn-hlp.mkvi +++ b/tex/context/base/scrn-hlp.mkvi @@ -89,7 +89,7 @@ \dontleavehmode \hbox \bgroup \dontcomplain \setbox\b_scrn_help_box\hbox{\strut#text}% - \doregisterhelp{#target}% + \scrn_help_register{#target}% \egroup % can be usernode instead \goto {\helpsignal{\number\c_scrn_help_n}#target}% diff --git a/tex/context/base/scrn-ref.mkvi b/tex/context/base/scrn-ref.mkvi index 2b15b4677..9a3f0c264 100644 --- a/tex/context/base/scrn-ref.mkvi +++ b/tex/context/base/scrn-ref.mkvi @@ -18,10 +18,14 @@ \unprotect \appendtoks - \doifsomething{\interactionparameter\c!calculate}{\doregistercalculationset{\interactionparameter\c!calculate}}% - \doifelse{\interactionparameter\c!click }\v!yes \settrue \setfalse \highlighthyperlinks - \doifelse{\interactionparameter\c!display}\v!new \settrue \setfalse \gotonewwindow - \doifnot {\interactionparameter\c!page }\v!no \scrn_reference_enable_page_destinations + \doifsomething{\interactionparameter\c!calculate}% + {\clf_setfieldcalculationset{\interactionparameter\c!calculate}}% + \doifelse{\interactionparameter\c!click }\v!yes + \settrue\setfalse\highlighthyperlinks + \doifelse{\interactionparameter\c!display}\v!new + \settrue\setfalse\gotonewwindow + \doifnot {\interactionparameter\c!page}\v!no + \scrn_reference_enable_page_destinations \to \everysetupinteraction \def\scrn_reference_enable_page_destinations % no reset diff --git a/tex/context/base/scrn-wid.mkvi b/tex/context/base/scrn-wid.mkvi index 57a4be276..f4679684c 100644 --- a/tex/context/base/scrn-wid.mkvi +++ b/tex/context/base/scrn-wid.mkvi @@ -272,7 +272,7 @@ \else\ifsecondargument \registerattachment[#tag][title=#title,name=#title,file=#title]% \else - \registerattachment[#tag][title=#title,name=#tag,file=#tag]% + \registerattachment[#tag][title=#tag,name=#tag,file=#tag]% \fi\fi\fi} %D Comments: diff --git a/tex/context/base/scrp-cjk.lua b/tex/context/base/scrp-cjk.lua index 9050da6be..0639f5583 100644 --- a/tex/context/base/scrp-cjk.lua +++ b/tex/context/base/scrp-cjk.lua @@ -34,7 +34,8 @@ local getid = nuts.getid local getattr = nuts.getattr local getsubtype = nuts.getsubtype local getfield = nuts.getfield -local setfield = nuts.setfield + +local setchar = nuts.setchar local nodepool = nuts.pool local new_glue = nodepool.glue @@ -514,13 +515,13 @@ function scripts.decomposehangul(head) for current in traverse_id(glyph_code,head) do local lead_consonant, medial_vowel, tail_consonant = decomposed(getchar(current)) if lead_consonant then - setfield(current,"char",lead_consonant) + setchar(current,lead_consonant) local m = copy_node(current) - setfield(m,"char",medial_vowel) + setchar(m,medial_vowel) head, current = insert_node_after(head,current,m) if tail_consonant then local t = copy_node(current) - setfield(t,"char",tail_consonant) + setchar(t,tail_consonant) head, current = insert_node_after(head,current,t) end done = true diff --git a/tex/context/base/spac-ali.mkiv b/tex/context/base/spac-ali.mkiv index f90ab4fa9..763d2001a 100644 --- a/tex/context/base/spac-ali.mkiv +++ b/tex/context/base/spac-ali.mkiv @@ -679,6 +679,7 @@ \setvalue{\??aligncommand\v!hanging }{\t_spac_align_collected\expandafter{\the\t_spac_align_collected\font_protruding_enable }} \setvalue{\??aligncommand\v!nothanging }{\t_spac_align_collected\expandafter{\the\t_spac_align_collected\font_protruding_disable}} \setvalue{\??aligncommand\v!hz }{\t_spac_align_collected\expandafter{\the\t_spac_align_collected\font_expansion_enable }} +\setvalue{\??aligncommand\v!fullhz }{\t_spac_align_collected\expandafter{\the\t_spac_align_collected\font_expansion_enable_k}} \setvalue{\??aligncommand\v!nohz }{\t_spac_align_collected\expandafter{\the\t_spac_align_collected\font_expansion_disable }} %setvalue{\??aligncommand\v!spacing }{\t_spac_align_collected\expandafter{\the\t_spac_align_collected\enablespacehandling \enablekernhandling }} % not in mkiv %setvalue{\??aligncommand\v!nospacing }{\t_spac_align_collected\expandafter{\the\t_spac_align_collected\disablespacehandling\disablekernhandling}} % not in mkiv @@ -724,7 +725,7 @@ % Box commands. -\unexpanded\def\ibox#1#2#3% +\unexpanded\def\ibox {\vbox\bgroup \forgetall \let\\=\endgraf @@ -732,7 +733,7 @@ \doifelserightpage\spac_align_set_horizontal_right\spac_align_set_horizontal_left \let\next} -\unexpanded\def\obox#1#2#3% +\unexpanded\def\obox {\vbox\bgroup \forgetall \let\\=\endgraf diff --git a/tex/context/base/spac-hor.mkiv b/tex/context/base/spac-hor.mkiv index 54156c3b4..b677bacdf 100644 --- a/tex/context/base/spac-hor.mkiv +++ b/tex/context/base/spac-hor.mkiv @@ -154,7 +154,7 @@ \installindentingmethod \v!normal{\ifx\normalindentation\empty\else \let\v_spac_indentation_current\normalindentation - \simplesetupindenting + \spac_indentation_setup_size \fi} \installindentingmethod \v!reset {\settrue\c_spac_indentation_indent_first @@ -774,11 +774,16 @@ \installtolerancemethod \v!horizontal \v!stretch {\emergencystretch\bodyfontsize} \installtolerancemethod \v!horizontal \v!space {\spaceskip.5em\s!plus.25em\s!minus.25em\relax} -\installtolerancemethod \v!horizontal \v!verystrict {\tolerance 200 } +\installtolerancemethod \v!horizontal \v!verystrict {\tolerance\plustwohundred} \installtolerancemethod \v!horizontal \v!strict {\tolerance1500 } \installtolerancemethod \v!horizontal \v!tolerant {\tolerance3000 } \installtolerancemethod \v!horizontal \v!verytolerant {\tolerance4500 } +\appendetoks + \pretolerance\plushundred + \tolerance \plustwohundred +\to\everyforgetall + \def\spac_tolerances_step_vertical #1{\csname\??tolerancemethods\v!vertical :#1\endcsname} \def\spac_tolerances_step_horizontal#1{\csname\??tolerancemethods\v!horizontal:#1\endcsname} diff --git a/tex/context/base/spac-prf.lua b/tex/context/base/spac-prf.lua index 39603ec96..687671eff 100644 --- a/tex/context/base/spac-prf.lua +++ b/tex/context/base/spac-prf.lua @@ -27,7 +27,6 @@ local hlist_code = nodecodes.hlist local vlist_code = nodecodes.vlist local unset_code = nodecodes.unset local math_code = nodecodes.math -local whatsit_code = nodecodes.whatsit local rule_code = nodecodes.rule local marginkern_code = nodecodes.marginkern @@ -46,8 +45,7 @@ local taketexbox = tex.takebox local nuts = nodes.nuts local tonut = nodes.tonut local tonode = nuts.tonode -local setfield = nuts.setfield -local setattr = nuts.setattr + local getfield = nuts.getfield local getattr = nuts.getattr local getid = nuts.getid @@ -57,6 +55,10 @@ local getsubtype = nuts.getsubtype local getlist = nuts.getlist local gettexbox = nuts.getbox +local setfield = nuts.setfield +local setlink = nuts.setlink +local setattr = nuts.setattr + local theprop = nuts.theprop local floor = math.floor @@ -71,8 +73,6 @@ local find_node_tail = nuts.tail local properties = nodes.properties.data -local get_dimensions = nodes.whatsitters.getters.dimensions - local a_visual = attributes.private("visual") local a_snapmethod = attributes.private("snapmethod") local a_profilemethod = attributes.private("profilemethod") @@ -227,14 +227,6 @@ local function getprofile(line,step) ht = 0 dp = 0 progress() - elseif id == whatsit_code then - local subtype = getsubtype(current) - local getdimen = get_dimensions[subtype] - if getdimen then - -- unlikely to happen as we always wrap images etc in a box - wd, ht, dp = get_dimensions(current) - progress() - end elseif id == marginkern_code then wd = getfield(current,"width") ht = 0 @@ -367,8 +359,7 @@ local function addprofile(node,profile,step) settransparency(what,visual) end if tail then - setfield(tail,"next",what) - setfield(what,"prev",tail) + setlink(tail,what) else head = what end @@ -406,15 +397,13 @@ local function addprofile(node,profile,step) -- formatters["%0.4f"](getfield(rule,"depth") /65536) -- ) -- - -- setfield(text,"next",rule) - -- setfield(rule,"prev",text) + -- setlink(text,rule) -- -- rule = text -- -- end - setfield(rule,"next",list) - setfield(list,"prev",rule) + setlink(rule,list) setfield(line,"list",rule) end @@ -477,10 +466,8 @@ local function inject(top,bot,amount) -- todo: look at penalties setattr(glue,a_profilemethod,0) setattr(glue,a_visual,getattr(top,a_visual)) -- - setfield(bot,"prev",glue) - setfield(glue,"next",bot) - setfield(glue,"prev",top) - setfield(top,"next",glue) + setlink(glue,bot) + setlink(top,glue) end methods[v_none] = function() diff --git a/tex/context/base/spac-ver.lua b/tex/context/base/spac-ver.lua index 76f9e1df5..7db01325f 100644 --- a/tex/context/base/spac-ver.lua +++ b/tex/context/base/spac-ver.lua @@ -88,6 +88,7 @@ local ntostring = nuts.tostring local getfield = nuts.getfield local setfield = nuts.setfield local getnext = nuts.getnext +local setlink = nuts.setlink local getprev = nuts.getprev local getid = nuts.getid local getlist = nuts.getlist @@ -125,14 +126,13 @@ local new_gluespec = nodepool.gluespec local nodecodes = nodes.nodecodes local skipcodes = nodes.skipcodes -local whatsitcodes = nodes.whatsitcodes local penalty_code = nodecodes.penalty local kern_code = nodecodes.kern local glue_code = nodecodes.glue local hlist_code = nodecodes.hlist local vlist_code = nodecodes.vlist -local whatsit_code = nodecodes.whatsit +local localpar_code = nodecodes.localpar local vspacing = builders.vspacing or { } builders.vspacing = vspacing @@ -229,7 +229,7 @@ end local function validvbox(parentid,list) if parentid == hlist_code then local id = getid(list) - if id == whatsit_code then -- check for initial par subtype + if id == localpar_code then -- check for initial par subtype list = getnext(list) if not next then return nil @@ -264,7 +264,7 @@ local function already_done(parentid,list,a_snapmethod) -- todo: done when only -- problem: any snapped vbox ends up in a line if list and parentid == hlist_code then local id = getid(list) - if id == whatsit_code then -- check for initial par subtype + if id == localpar_code then -- check for initial par subtype list = getnext(list) if not next then return false @@ -281,7 +281,7 @@ local function already_done(parentid,list,a_snapmethod) -- todo: done when only elseif a == 0 then return true -- already snapped end - elseif id == glue_code or id == penalty_code then -- whatsit is weak spot + elseif id == glue_code or id == penalty_code then -- go on else return false -- whatever @@ -1042,9 +1042,6 @@ local function check_experimental_overlay(head,current) local p = nil local c = current local n = nil - - -- setfield(head,"prev",nil) -- till we have 0.79 ** - local function overlay(p,n,mvl) local p_ht = getfield(p,"height") local p_dp = getfield(p,"depth") @@ -1690,8 +1687,7 @@ function vspacing.pagehandler(newhead,where) if flush then if stackhead then if trace_collect_vspacing then report("appending %s nodes to stack (final): %s",newhead) end - setfield(stacktail,"next",newhead) - setfield(newhead,"prev",stacktail) + setlink(stacktail,newhead) newhead = stackhead stackhead, stacktail = nil, nil end @@ -1708,8 +1704,7 @@ function vspacing.pagehandler(newhead,where) else if stackhead then if trace_collect_vspacing then report("appending %s nodes to stack (intermediate): %s",newhead) end - setfield(stacktail,"next",newhead) - setfield(newhead,"prev",stacktail) + setlink(stacktail,newhead) else if trace_collect_vspacing then report("storing %s nodes in stack (initial): %s",newhead) end stackhead = newhead diff --git a/tex/context/base/spac-ver.mkiv b/tex/context/base/spac-ver.mkiv index eb5fb603e..7620b7b5a 100644 --- a/tex/context/base/spac-ver.mkiv +++ b/tex/context/base/spac-ver.mkiv @@ -837,6 +837,10 @@ \def\strut{\relax\ifmmode\copy\else\unhcopy\fi\strutbox} +% \unexpanded\def\strut +% {\relax +% \ifmmode\copy\else\dontleavehmode\unhcopy\fi\strutbox} + \let\normalstrut\strut % The double \hbox construction enables us to \backtrack @@ -1002,6 +1006,10 @@ \dontleavehmode \copy\strutbox} +% \unexpanded\def\strut % slightly faster +% {\relax +% \ifmmode\copy\else\dontleavehmode\unhcopy\fi\strutbox} + \let\normalstrut\strut \unexpanded\def\halfstrut diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf index d29a9995e..a56679347 100644 Binary files a/tex/context/base/status-files.pdf and b/tex/context/base/status-files.pdf differ diff --git a/tex/context/base/status-lua.pdf b/tex/context/base/status-lua.pdf index fcfe7bae1..f2b041597 100644 Binary files a/tex/context/base/status-lua.pdf and b/tex/context/base/status-lua.pdf differ diff --git a/tex/context/base/status-mkiv.lua b/tex/context/base/status-mkiv.lua index 45c282256..9b320c651 100644 --- a/tex/context/base/status-mkiv.lua +++ b/tex/context/base/status-mkiv.lua @@ -3572,6 +3572,11 @@ return { filename = "lpdf-ano", status = "todo", }, + { + category = "lua", + filename = "lpdf-res", + status = "todo", + }, { category = "lua", filename = "lpdf-col", diff --git a/tex/context/base/strc-mar.lua b/tex/context/base/strc-mar.lua index 3af9113bf..b7e6ef8c2 100644 --- a/tex/context/base/strc-mar.lua +++ b/tex/context/base/strc-mar.lua @@ -26,8 +26,6 @@ local tonut = nuts.tonut local getfield = nuts.getfield local setfield = nuts.setfield -local getnext = nuts.getnext -local getprev = nuts.getprev local getid = nuts.getid local getlist = nuts.getlist local getattr = nuts.getattr diff --git a/tex/context/base/strc-mar.mkiv b/tex/context/base/strc-mar.mkiv index 8bd8c094e..4e8df5f5d 100644 --- a/tex/context/base/strc-mar.mkiv +++ b/tex/context/base/strc-mar.mkiv @@ -120,7 +120,7 @@ % the fetchers are fully expandable: [name][method] -\def\fetchonemark[#1]#2[#3]{\ifconditional\inhibitgetmarking\else\clf_fetchonemark {#1}{\v!page}{#2}\fi} +\def\fetchonemark[#1]#2[#3]{\ifconditional\inhibitgetmarking\else\clf_fetchonemark {#1}{\v!page}{#3}\fi} \def\fetchtwomarks [#1]{\ifconditional\inhibitgetmarking\else\clf_fetchtwomarks{#1}{\v!page}\fi} \def\fetchallmarks [#1]{\ifconditional\inhibitgetmarking\else\clf_fetchallmarks{#1}{\v!page}\fi} diff --git a/tex/context/base/strc-mat.mkiv b/tex/context/base/strc-mat.mkiv index 7d1cbf767..4435692e1 100644 --- a/tex/context/base/strc-mat.mkiv +++ b/tex/context/base/strc-mat.mkiv @@ -56,6 +56,56 @@ \setupformulas[\c!distance=\emwidth] \fi +% \ifdefined\mathdisplayskipmode +% \mathdisplayskipmode\plustwo % only when not zero / needs adapted space handler +% \fi + +% \mathdisplayskipmode\plusthree +% +% \hbox\bgroup +% \setbox0\vbox\bgroup +% xxxxxxxxx\par +% \vskip-\baselineskip +% $$a^2_2$$\par +% xxxxxxxxx\par +% \egroup +% \box0 +% \vbox\bgroup +% xxxxxxxxx\par +% \vskip-\baselineskip +% $$a^2$$\par +% xxxxxxxxx\par +% \egroup +% \vbox\bgroup +% xxxxxxxxx +% \vskip-\baselineskip +% $$a_2$$ +% xxxxxxxxx +% \egroup +% \egroup +% +% \hbox\bgroup +% \setbox0\vbox\bgroup +% xxxxxxxxx\par +% \ctxlua{tex.prevdepth=-1000 *65536} +% $$a^2_2$$\par +% xxxxxxxxx\par +% \egroup +% \box0 +% \vbox\bgroup +% xxxxxxxxx\par +% \ctxlua{tex.prevdepth=-1000 *65536} +% $$a^2$$\par +% xxxxxxxxx\par +% \egroup +% \vbox\bgroup +% xxxxxxxxx +% \ctxlua{tex.prevdepth=-1000 *65536} +% $$a_2$$ +% xxxxxxxxx +% \egroup +% \egroup + \setupsubformulas % subformulas could be last in chain [\c!indentnext=\formulaparameter\c!indentnext] diff --git a/tex/context/base/supp-box.lua b/tex/context/base/supp-box.lua index edbbe4841..2123c0ffa 100644 --- a/tex/context/base/supp-box.lua +++ b/tex/context/base/supp-box.lua @@ -36,12 +36,16 @@ local tonode = nuts.tonode local getfield = nuts.getfield local getnext = nuts.getnext local getprev = nuts.getprev +local getdisc = nuts.getdisc local getid = nuts.getid local getlist = nuts.getlist local getattribute = nuts.getattribute local getbox = nuts.getbox local setfield = nuts.setfield +local setlink = nuts.setlink +local setboth = nuts.setboth +local setnext = nuts.setnext local setbox = nuts.setbox local free_node = nuts.free @@ -75,9 +79,7 @@ local function hyphenatedlist(head,usecolor) local next = getnext(current) local prev = getprev(current) if id == disc_code then - local pre = getfield(current,"pre") - local post = getfield(current,"post") - local replace = getfield(current,"replace") + local pre, post, replace = getdisc(current) if pre then setfield(current,"pre",nil) end @@ -99,8 +101,7 @@ local function hyphenatedlist(head,usecolor) setfield(current,"replace",nil) end -- setfield(current,"replace",new_rule(65536)) -- new_kern(65536*2)) - setfield(current,"next",nil) - setfield(current,"prev",nil) + setboth(current) local list = link_nodes ( pre and new_penalty(10000), pre, @@ -110,12 +111,10 @@ local function hyphenatedlist(head,usecolor) ) local tail = find_tail(list) if prev then - setfield(prev,"next",list) - setfield(list,"prev",prev) + setlink(prev,list) end if next then - setfield(tail,"next",next) - setfield(next,"prev",tail) + setlink(tail,next) end -- free_node(current) elseif id == vlist_code or id == hlist_code then @@ -315,12 +314,10 @@ implement { if head then if inbetween > 0 then local n = new_glue(0,0,inbetween) - setfield(tail,"next",n) - setfield(n,"prev",tail) + setlink(tail,n) tail = n end - setfield(tail,"next",list) - setfield(list,"prev",tail) + setlink(tail,list) else head = list end @@ -331,8 +328,7 @@ implement { local prev = getprev(tail) if next then local list = getlist(tail) - setfield(prev,"next",list) - setfield(list,"prev",prev) + setlink(prev,list) setfield(tail,"list",nil) tail = find_tail(list) else @@ -341,7 +337,7 @@ implement { free_node(temp) end -- done - setfield(tail,"next",nil) + setnext(tail) setfield(current,"list",nil) end current = next diff --git a/tex/context/base/supp-fil.mkii b/tex/context/base/supp-fil.mkii index b76dfb901..9a981797e 100644 --- a/tex/context/base/supp-fil.mkii +++ b/tex/context/base/supp-fil.mkii @@ -37,9 +37,17 @@ \def\f!parentpath {..} \fi -\def\openinputfile #1#2{\immediate\openin #1="#2"\relax} \def\closeinputfile #1{\immediate\closein #1} -\def\openoutputfile#1#2{\immediate\openout#1="#2"\relax} \def\closeoutputfile#1{\immediate\closeout#1} - +\ifnum\texengine=\luatexengine + \def\openinputfile #1#2{\openin #1{#2}\relax} + \def\openoutputfile#1#2{\immediate\openout#1{#2}\relax} +\else + \def\openinputfile #1#2{\openin #1 "#2"\relax} + \def\openoutputfile#1#2{\immediate\openout#1 "#2"\relax} +\fi + +\def\closeinputfile #1{\immediate\closein #1} +\def\closeoutputfile#1{\immediate\closeout#1} + %D \macros %D {pushendofline,popendofline} %D @@ -235,7 +243,11 @@ \unexpanded\def\input{\normalinput} -\def\inputgivenfile#1{\normalinput"#1"\relax} +\ifnum\texengine=\luatexengine + \def\inputgivenfile#1{\normalinput{#1}\relax} +\else + \def\inputgivenfile#1{\normalinput"#1"\relax} +\fi %D \macros %D {readfile,ReadFile,maxreadlevel} diff --git a/tex/context/base/supp-tpi.mkii b/tex/context/base/supp-tpi.mkii index dc230563b..2c3e282e3 100644 --- a/tex/context/base/supp-tpi.mkii +++ b/tex/context/base/supp-tpi.mkii @@ -20,7 +20,7 @@ %D implemented in \type{supp-mps}. \ifnum\texengine=\luatexengine - \endinput + \expandafter \endinput \fi \ifx\undefined\writestatus \input supp-mis.mkii \relax \fi diff --git a/tex/context/base/syst-aux.mkiv b/tex/context/base/syst-aux.mkiv index 8a9782cf1..dd8d5b3ae 100644 --- a/tex/context/base/syst-aux.mkiv +++ b/tex/context/base/syst-aux.mkiv @@ -3051,8 +3051,8 @@ %D of the identification string with the macro \type %D {\statuswidth}. -\setnewconstant\statuswidth 15 -\setnewconstant\statuswrite 16 +\setnewconstant\statuswidth 15 +\setnewconstant\statuswrite 128 % \pluscxxviii \ifdefined\writestring \else diff --git a/tex/context/base/syst-ini.mkii b/tex/context/base/syst-ini.mkii index 9988efc10..124a7282a 100644 --- a/tex/context/base/syst-ini.mkii +++ b/tex/context/base/syst-ini.mkii @@ -90,10 +90,9 @@ \expandafter\end \fi -% todo: pdfsave pdfrestore pdfcolor... don't initialize them - \ifnum\texengine=\luatexengine \directlua 0 { % this info is stored in the format + % kpse.set_program_name("context") lua.name[0] = "main ctx instance" local extraprimitives = tex.extraprimitives local enableprimitives = tex.enableprimitives @@ -119,6 +118,142 @@ } \fi +\ifdefined\pdfextension + + % promoted + + \let\pdfpagewidth \pagewidth + \let\pdfpageheight \pageheight + + \let\pdfadjustspacing \adjustspacing + \let\pdfprotrudechars \protrudechars + \let\pdfnoligatures \ignoreligaturesinfont + \let\pdffontexpand \expandglyphsinfont + \let\pdfcopyfont \copyfont + + \let\pdfxform \saveboxresource + \let\pdflastxform \lastsavedboxresourceindex + \let\pdfrefxform \useboxresource + + \let\pdfximage \saveimageresource + \let\pdflastximage \lastsavedimageresourceindex + \let\pdflastximagepages\lastsavedimageresourcepages + \let\pdfrefximage \useimageresource + + \let\pdfsavepos \savepos + \let\pdflastxpos \lastxpos + \let\pdflastypos \lastypos + + % \let\pdftexversion \luatexversion + % \let\pdftexrevision \luatexrevision + \let\pdftexbanner \luatexbanner + + \let\pdfoutput \outputmode + \let\pdfdraftmode \draftmode + + \let\pdfpxdimen \pxdimen + + \let\pdfinsertht \insertht + + % also promoted + + % \let\pdfnormaldeviate \normaldeviate + % \let\pdfuniformdeviate \uniformdeviate + % \let\pdfsetrandomseed \setrandomseed + % \let\pdfrandomseed \randomseed + % + % \let\pdfprimitive \primitive + % + % \let\expandafter\csname ifpdfabsnum\expandafter\endcsname\csname ifabsnum\endcsname + % \let\expandafter\csname ifpdfabsdim\expandafter\endcsname\csname ifabsdim\endcsname + % \let\expandafter\csname ifpdfprimitive\expandafter\endcsname\csname ifprimitive\endcsname + + % removed (also some others but already long ago) + + \newdimen\pdfeachlineheight + \newdimen\pdfeachlinedepth + \newdimen\pdflastlinedepth + \newdimen\pdffirstlineheight + \newdimen\pdfignoreddimen + + % grouped + + \protected\def\pdfliteral {\pdfextension literal} + \protected\def\pdfcolorstack {\pdfextension colorstack} + \protected\def\pdfsetmatrix {\pdfextension setmatrix} + \protected\def\pdfsave {\pdfextension save\relax} + \protected\def\pdfrestore {\pdfextension restore\relax} + \protected\def\pdfobj {\pdfextension obj } + \protected\def\pdfrefobj {\pdfextension refobj } + \protected\def\pdfannot {\pdfextension annot } + \protected\def\pdfstartlink {\pdfextension startlink } + \protected\def\pdfendlink {\pdfextension endlink\relax} + \protected\def\pdfoutline {\pdfextension outline } + \protected\def\pdfdest {\pdfextension dest } + \protected\def\pdfthread {\pdfextension thread } + \protected\def\pdfstartthread {\pdfextension startthread } + \protected\def\pdfendthread {\pdfextension endthread\relax} + \protected\def\pdfinfo {\pdfextension info } + \protected\def\pdfcatalog {\pdfextension catalog } + \protected\def\pdfnames {\pdfextension names } + \protected\def\pdfincludechars {\pdfextension includechars } + \protected\def\pdffontattr {\pdfextension fontattr } + \protected\def\pdfmapfile {\pdfextension mapfile } + \protected\def\pdfmapline {\pdfextension mapline } + \protected\def\pdftrailer {\pdfextension trailer } + \protected\def\pdfglyphtounicode {\pdfextension glyphtounicode } + + % grouped + + \def\pdftexversion {\numexpr\pdffeedback version} + \def\pdftexrevision {\pdffeedback revision} + \def\pdflastlink {\numexpr\pdffeedback lastlink} + \def\pdfretval {\numexpr\pdffeedback retval} + \def\pdflastobj {\numexpr\pdffeedback lastobj} + \def\pdflastannot {\numexpr\pdffeedback lastannot} + \def\pdfxformname {\numexpr\pdffeedback xformname} + \def\pdfcreationdate {\pdffeedback creationdate} + \def\pdffontname {\numexpr\pdffeedback fontname} + \def\pdffontobjnum {\numexpr\pdffeedback fontobjnum} + \def\pdffontsize {\dimexpr\pdffeedback fontsize} + \def\pdfpageref {\numexpr\pdffeedback pageref} + \def\pdfcolorstackinit {\pdffeedback colorstackinit} + + % used when defined + + \edef\pdfcompresslevel {\pdfvariable compresslevel} \pdfcompresslevel 9 + \edef\pdfobjcompresslevel {\pdfvariable objcompresslevel} \pdfobjcompresslevel 1 + \edef\pdfdecimaldigits {\pdfvariable decimaldigits} \pdfdecimaldigits 3 + \edef\pdfgamma {\pdfvariable gamma} \pdfgamma 1000 + \edef\pdfimageresolution {\pdfvariable imageresolution} \pdfimageresolution 71 + \edef\pdfimageapplygamma {\pdfvariable imageapplygamma} \pdfimageapplygamma 0 + \edef\pdfimagegamma {\pdfvariable imagegamma} \pdfimagegamma 2200 + \edef\pdfimagehicolor {\pdfvariable imagehicolor} \pdfimagehicolor 1 + \edef\pdfimageaddfilename {\pdfvariable imageaddfilename} \pdfimageaddfilename 1 + \edef\pdfpkresolution {\pdfvariable pkresolution} \pdfpkresolution 72 + \edef\pdfinclusioncopyfonts {\pdfvariable inclusioncopyfonts} \pdfinclusioncopyfonts 0 + \edef\pdfinclusionerrorlevel {\pdfvariable inclusionerrorlevel} \pdfinclusionerrorlevel 0 + \edef\pdfreplacefont {\pdfvariable replacefont} \pdfreplacefont 0 + \edef\pdfgentounicode {\pdfvariable gentounicode} \pdfgentounicode 0 + \edef\pdfpagebox {\pdfvariable pagebox} \pdfpagebox 0 + \edef\pdfminorversion {\pdfvariable minorversion} \pdfminorversion 4 + \edef\pdfuniqueresname {\pdfvariable uniqueresname} \pdfuniqueresname 0 + + \edef\pdfhorigin {\pdfvariable horigin} \pdfhorigin 1in + \edef\pdfvorigin {\pdfvariable vorigin} \pdfvorigin 1in + \edef\pdflinkmargin {\pdfvariable linkmargin} \pdflinkmargin 0pt + \edef\pdfdestmargin {\pdfvariable destmargin} \pdfdestmargin 0pt + \edef\pdfthreadmargin {\pdfvariable threadmargin} \pdfthreadmargin 0pt + + \edef\pdfpagesattr {\pdfvariable pagesattr} + \edef\pdfpageattr {\pdfvariable pageattr} + \edef\pdfpageresources {\pdfvariable pageresources} + \edef\pdfxformattr {\pdfvariable xformattr} + \edef\pdfxformresources {\pdfvariable xformresources} + \edef\pdfpkmode {\pdfvariable pkmode} + +\fi + %D \ETEX\ has a not so handy way of telling you the version number, %D i.e. the revision number has a period in it: @@ -278,6 +413,12 @@ \fi\fi #1#2#3#4#5} +%D Goodie: + +\ifnum\texengine=\luatexengine + \input luatex-pdf \relax +\fi + %D Since the number of chars exceed 256 now, we can use \type %D {\chardef} instead of the more limited \type {\mathchardef}. diff --git a/tex/context/base/syst-ini.mkiv b/tex/context/base/syst-ini.mkiv index b71713b00..b3193a393 100644 --- a/tex/context/base/syst-ini.mkiv +++ b/tex/context/base/syst-ini.mkiv @@ -63,6 +63,8 @@ \chardef\xetexengine = 2 \chardef\luatexengine = 3 +\chardef\statuswrite = 128 + \ifx\directlua\undefined \ifx\XeTeXversion\undefined \ifx\pdftexversion\undefined @@ -80,9 +82,9 @@ \ifnum\texengine=\luatexengine % for historic reasons we keep some mkii code around \else - \immediate\write16{>>>} - \immediate\write16{>>> only luatex is supported} - \immediate\write16{>>>} + \immediate\write\statuswrite{>>>} + \immediate\write\statuswrite{>>> only luatex is supported} + \immediate\write\statuswrite{>>>} \let\dump\relax \expandafter\end \fi @@ -91,48 +93,20 @@ \directlua 0 { % this info is stored in the format lua.name[0] = "main ctx instance" - local extraprimitives = tex.extraprimitives - local enableprimitives = tex.enableprimitives - local core = extraprimitives("core") - local btex = extraprimitives("tex") - local etex = extraprimitives("etex") - local pdftex = extraprimitives("pdftex") - local luatex = extraprimitives("luatex") - local omega = { % now luatex - "pagewidth", "pageheight", - "textdir", "pagedir", "mathdir", "pardir", "bodydir", - "leftghost", "rightghost", - "localleftbox", "localrightbox", - "localinterlinepenalty", "localbrokenpenalty", - } - local aleph = { % now luatex - "boxdir", - "pagebottomoffset", "pagerightoffset", - } - for _, subset in next, { etex, pdftex, luatex, omega, aleph } do - enableprimitives("",subset) - end - for _, subset in next, { core, btex, etex, pdftex, luatex, omega, aleph } do - enableprimitives("normal",subset) - end -} - -% for the moment: -\ifdefined\pagewidth \else \let\pagewidth \pdfpagewidth \let\normalpagewidth \pdfpagewidth \fi -\ifdefined\pageheight \else \let\pageheight \pdfpageheight \let\normalpageheight \pdfpageheight \fi + local coreprimitives = tex.extraprimitives("core") + local texprimitives = tex.extraprimitives("tex") + local etexprimitives = tex.extraprimitives("etex") + local luatexprimitives = tex.extraprimitives("luatex") -\ifdefined\adjustspacing \else \let\adjustspacing \pdfadjustspacing \let\normaladjustspacing \adjustspacing \fi -\ifdefined\protrudechars \else \let\protrudechars \pdfprotrudechars \let\normalprotrudechars \protrudechars \fi + tex.enableprimitives("",etexprimitives) + tex.enableprimitives("",luatexprimitives) -\ifdefined\pdfxform \else \let\pdfxform \saveboxresource \let\normalpdfxform \pdfxform \fi -\ifdefined\pdflastxform \else \let\pdflastxform \lastsavedboxresourceindex \let\normalpdflastxform \pdflastxform \fi -\ifdefined\pdfrefxform \else \let\pdfrefxform \useboxresource \let\normalpdfrefxform \pdfrefxform \fi - -\ifdefined\pdfximage \else \let\pdfximage \saveimageresource \let\normalpdfximage \pdfximage \fi -\ifdefined\pdflastximage \else \let\pdflastximage \lastsavedimageresourceindex \let\normalpdflastximage \pdflastximage \fi -\ifdefined\pdflastximagepages\else \let\pdflastximagepages \lastsavedimageresourcepages \let\normalpdflastximagepages\pdflastximagepages\fi -\ifdefined\pdfrefximage \else \let\pdfrefximage \useimageresource \let\normalpdfrefximage \pdfrefximage \fi + tex.enableprimitives("normal",coreprimitives) + tex.enableprimitives("normal",texprimitives) + tex.enableprimitives("normal",etexprimitives) + tex.enableprimitives("normal",luatexprimitives) +} %D \ETEX\ has a not so handy way of telling you the version number, i.e. the revision %D number has a period in it: @@ -191,8 +165,8 @@ \countdef \c_syst_min_allocated_register = 52 \c_syst_min_allocated_register = 256 % can change \countdef \c_syst_max_allocated_register = 53 \c_syst_max_allocated_register = 32767 -\countdef \c_syst_min_allocated_iochannel = 54 \c_syst_min_allocated_iochannel = -1 -\countdef \c_syst_max_allocated_iochannel = 55 \c_syst_max_allocated_iochannel = 16 +\countdef \c_syst_min_allocated_read = 54 \c_syst_min_allocated_read = -1 +\countdef \c_syst_max_allocated_read = 55 \c_syst_max_allocated_read = 16 \countdef \c_syst_min_allocated_language = 56 \c_syst_min_allocated_language = 0 \countdef \c_syst_max_allocated_language = 57 \c_syst_max_allocated_language = 255 \countdef \c_syst_max_allocated_insert = 58 \c_syst_max_allocated_insert = 254 @@ -200,6 +174,8 @@ \countdef \c_syst_min_allocated_family = 60 \c_syst_min_allocated_family = 128 \countdef \c_syst_max_allocated_family = 61 \c_syst_max_allocated_family = 255 \countdef \c_syst_min_allocated_attribute = 62 \c_syst_min_allocated_attribute = 1024 % 127-1023 : private +\countdef \c_syst_min_allocated_write = 63 \c_syst_min_allocated_write = 0 % luatex >= 0.82 +\countdef \c_syst_max_allocated_write = 64 \c_syst_max_allocated_write = 127 % luatex >= 0.82 \countdef \c_syst_last_allocated_count = 32 \c_syst_last_allocated_count = \c_syst_min_allocated_register \countdef \c_syst_last_allocated_dimen = 33 \c_syst_last_allocated_dimen = \c_syst_min_allocated_register @@ -207,8 +183,8 @@ \countdef \c_syst_last_allocated_muskip = 35 \c_syst_last_allocated_muskip = \c_syst_min_allocated_register \countdef \c_syst_last_allocated_box = 36 \c_syst_last_allocated_box = \c_syst_min_allocated_register \countdef \c_syst_last_allocated_toks = 37 \c_syst_last_allocated_toks = \c_syst_min_allocated_register -\countdef \c_syst_last_allocated_read = 38 \c_syst_last_allocated_read = \c_syst_min_allocated_iochannel -\countdef \c_syst_last_allocated_write = 39 \c_syst_last_allocated_write = \c_syst_min_allocated_iochannel +\countdef \c_syst_last_allocated_read = 38 \c_syst_last_allocated_read = \c_syst_min_allocated_read +\countdef \c_syst_last_allocated_write = 39 \c_syst_last_allocated_write = \c_syst_min_allocated_write \countdef \c_syst_last_allocated_marks = 40 \c_syst_last_allocated_marks = \c_syst_min_allocated_register \countdef \c_syst_last_allocated_language = 41 \c_syst_last_allocated_language = \c_syst_min_allocated_language % not used in context \countdef \c_syst_last_allocated_insertion = 42 \c_syst_last_allocated_insertion = \c_syst_min_allocated_insert @@ -246,8 +222,8 @@ \normalprotected\def\newmuskip {\syst_basics_allocate\c_syst_last_allocated_muskip \muskip \muskipdef \c_syst_max_allocated_register} \normalprotected\def\newbox {\syst_basics_allocate\c_syst_last_allocated_box \box \mathchardef\c_syst_max_allocated_register} \normalprotected\def\newtoks {\syst_basics_allocate\c_syst_last_allocated_toks \toks \toksdef \c_syst_max_allocated_register} -\normalprotected\def\newread {\syst_basics_allocate\c_syst_last_allocated_read \read \chardef \c_syst_max_allocated_iochannel} -\normalprotected\def\newwrite {\syst_basics_allocate\c_syst_last_allocated_write \write \chardef \c_syst_max_allocated_iochannel} +\normalprotected\def\newread {\syst_basics_allocate\c_syst_last_allocated_read \read \chardef \c_syst_max_allocated_read} +\normalprotected\def\newwrite {\syst_basics_allocate\c_syst_last_allocated_write \write \chardef \c_syst_max_allocated_write} \normalprotected\def\newmarks {\syst_basics_allocate\c_syst_last_allocated_marks \marks \mathchardef\c_syst_max_allocated_register} \normalprotected\def\newinsert {\syst_basics_allocate\c_syst_last_allocated_insertion\insert \chardef \c_syst_max_allocated_insert} @@ -280,7 +256,7 @@ %D as all engines now provide many registers we removed all traces. \ifdefined\writestatus \else - \normalprotected\def\writestatus#1#2{\immediate\write16{#1: #2}} + \normalprotected\def\writestatus#1#2{\immediate\write\statuswrite{#1: #2}} \fi \def\syst_basics_allocate_yes#1#2#3#4#5% last class method max name @@ -324,6 +300,121 @@ \normalprotected\def\newhelp#1#2{\newtoks#1#1\expandafter{\csname#2\endcsname}} +%D For the moment: + +% for the moment (till 0.82) + +\ifdefined\outputmode \else \let\outputmode \pdfoutput \fi + +\ifdefined\pagewidth \else \let\pagewidth \pdfpagewidth \let\normalpagewidth \pdfpagewidth \fi +\ifdefined\pageheight \else \let\pageheight \pdfpageheight \let\normalpageheight \pdfpageheight \fi + +\ifdefined\adjustspacing \else \let\adjustspacing \pdfadjustspacing \let\normaladjustspacing \adjustspacing \fi +\ifdefined\protrudechars \else \let\protrudechars \pdfprotrudechars \let\normalprotrudechars \protrudechars \fi + +\ifdefined\saveboxresource \else \let\saveboxresource \pdfxform \let\normalsaveboxresource \saveboxresource \fi +\ifdefined\lastsavedboxresourceindex \else \let\lastsavedboxresourceindex \pdflastxform \let\normallastsavedboxresourceindex \lastsavedboxresourceindex \fi +\ifdefined\useboxresource \else \let\useboxresource \pdfrefxform \let\normaluseboxresource \useboxresource \fi + +\ifdefined\saveimageresource \else \let\saveimageresource \pdfximage \let\normalsaveimageresource \saveimageresource \fi +\ifdefined\lastsavedimageresourceindex\else \let\lastsavedimageresourceindex\pdflastximage \let\normallastsavedimageresourceindex\lastsavedimageresourceindex \fi +\ifdefined\lastsavedimageresourcepages\else \let\lastsavedimageresourcepages\pdflastximagepages \let\normallastsavedimageresourcepages\lastsavedimageresourcepages \fi +\ifdefined\useimageresource \else \let\useimageresource \pdfrefximage \let\normaluseimageresource \useimageresource \fi + +% for the moment, this will move to the backend module + +\ifdefined\pdfextension + + \normalprotected\def\pdfliteral {\pdfextension literal } + \normalprotected\def\pdfcolorstack {\pdfextension colorstack } + \normalprotected\def\pdfsetmatrix {\pdfextension setmatrix } + \normalprotected\def\pdfsave {\pdfextension save\relax} + \normalprotected\def\pdfrestore {\pdfextension restore\relax} + \normalprotected\def\pdfobj {\pdfextension obj } + \normalprotected\def\pdfrefobj {\pdfextension refobj } + \normalprotected\def\pdfannot {\pdfextension annot } + \normalprotected\def\pdfstartlink {\pdfextension startlink } + \normalprotected\def\pdfendlink {\pdfextension endlink\relax} + \normalprotected\def\pdfoutline {\pdfextension outline } + \normalprotected\def\pdfdest {\pdfextension dest } + \normalprotected\def\pdfthread {\pdfextension thread } + \normalprotected\def\pdfstartthread {\pdfextension startthread } + \normalprotected\def\pdfendthread {\pdfextension endthread\relax} + \normalprotected\def\pdfinfo {\pdfextension info } + \normalprotected\def\pdfcatalog {\pdfextension catalog } + \normalprotected\def\pdfnames {\pdfextension names } + \normalprotected\def\pdfincludechars {\pdfextension includechars } + \normalprotected\def\pdffontattr {\pdfextension fontattr } + \normalprotected\def\pdfmapfile {\pdfextension mapfile } + \normalprotected\def\pdfmapline {\pdfextension mapline } + \normalprotected\def\pdftrailer {\pdfextension trailer } + \normalprotected\def\pdfglyphtounicode {\pdfextension glyphtounicode } + +\fi + +\ifdefined\pdfextension + + \def\pdftexversion {\numexpr\pdffeedback version} + \def\pdftexrevision {\pdffeedback revision} + \def\pdflastlink {\numexpr\pdffeedback lastlink} + \def\pdfretval {\numexpr\pdffeedback retval} + \def\pdflastobj {\numexpr\pdffeedback lastobj} + \def\pdflastannot {\numexpr\pdffeedback lastannot} + \def\pdfxformname {\numexpr\pdffeedback xformname} + \def\pdfcreationdate {\pdffeedback creationdate} + \def\pdffontname {\numexpr\pdffeedback fontname} + \def\pdffontobjnum {\numexpr\pdffeedback fontobjnum} + \def\pdffontsize {\dimexpr\pdffeedback fontsize} + \def\pdfpageref {\numexpr\pdffeedback pageref} + \def\pdfcolorstackinit {\pdffeedback colorstackinit} + +\fi + +\ifdefined\pdfxform \else + \let \pdfxform \saveboxresource + \let \pdflastxform \lastsavedboxresourceindex + \let \pdfrefxform \useboxresource + \let \pdfximage \saveimageresource + \let \pdflastximage \lastsavedimageresourceindex + \let \pdflastximagepages \lastsavedimageresourcepages + \let \pdfrefximage \useimageresource +\fi + +\ifdefined\pdfvariable + + \edef\pdfcompresslevel {\pdfvariable compresslevel} \pdfcompresslevel 9 + \edef\pdfobjcompresslevel {\pdfvariable objcompresslevel} \pdfobjcompresslevel 1 + \edef\pdfdecimaldigits {\pdfvariable decimaldigits} \pdfdecimaldigits 3 + \edef\pdfgamma {\pdfvariable gamma} \pdfgamma 1000 + \edef\pdfimageresolution {\pdfvariable imageresolution} \pdfimageresolution 71 + \edef\pdfimageapplygamma {\pdfvariable imageapplygamma} \pdfimageapplygamma 0 + \edef\pdfimagegamma {\pdfvariable imagegamma} \pdfimagegamma 2200 + \edef\pdfimagehicolor {\pdfvariable imagehicolor} \pdfimagehicolor 1 + \edef\pdfimageaddfilename {\pdfvariable imageaddfilename} \pdfimageaddfilename 1 + \edef\pdfpkresolution {\pdfvariable pkresolution} \pdfpkresolution 72 + \edef\pdfinclusioncopyfonts {\pdfvariable inclusioncopyfonts} \pdfinclusioncopyfonts 0 + \edef\pdfinclusionerrorlevel {\pdfvariable inclusionerrorlevel} \pdfinclusionerrorlevel 0 + \edef\pdfreplacefont {\pdfvariable replacefont} \pdfreplacefont 0 + \edef\pdfgentounicode {\pdfvariable gentounicode} \pdfgentounicode 0 + \edef\pdfpagebox {\pdfvariable pagebox} \pdfpagebox 0 + \edef\pdfminorversion {\pdfvariable minorversion} \pdfminorversion 4 + \edef\pdfuniqueresname {\pdfvariable uniqueresname} \pdfuniqueresname 0 + + \edef\pdfhorigin {\pdfvariable horigin} \pdfhorigin 1in + \edef\pdfvorigin {\pdfvariable vorigin} \pdfvorigin 1in + \edef\pdflinkmargin {\pdfvariable linkmargin} \pdflinkmargin 0pt + \edef\pdfdestmargin {\pdfvariable destmargin} \pdfdestmargin 0pt + \edef\pdfthreadmargin {\pdfvariable threadmargin} \pdfthreadmargin 0pt + + \edef\pdfpagesattr {\pdfvariable pagesattr} + \edef\pdfpageattr {\pdfvariable pageattr} + \edef\pdfpageresources {\pdfvariable pageresources} + \edef\pdfxformattr {\pdfvariable xformattr} + \edef\pdfxformresources {\pdfvariable xformresources} + \edef\pdfpkmode {\pdfvariable pkmode} + +\fi + %D \macros %D {scratchcounter, %D scratchdimen,scratchskip,scratchmuskip, @@ -425,6 +516,7 @@ \chardef \plusten = 10 \chardef \plussixteen = 16 \chardef \plushundred = 100 +\chardef \plustwohundred = 200 \chardef \pluscxxvii = 127 \chardef \pluscxxviii = 128 \chardef \pluscclv = 255 @@ -963,53 +1055,10 @@ \spanomit \advance\mscount\minusone \repeat} -%D The next section deals with selective definitions in later modules. One can of -%D course use the \type {\texengine} number that we defined earlier instead. - -\bgroup \obeylines - \gdef\pickupSOMETEX#1% - {\expandafter\gdef\csname begin#1\endcsname{\bgroup\obeylines\dopickupSOMETEX{#1}}} - \gdef\dopickupSOMETEX#1#2 - % {\egroup\immediate\write16{special code for #1 -> [line \the\inputlineno] \detokenize{#2}}} - {\egroup} -\egroup - -\let\endTEX \relax \def\beginTEX #1\endTEX {} -\let\endETEX \relax \def\beginETEX #1\endETEX {} -\let\endXETEX \relax \def\beginXETEX #1\endXETEX {} -\let\endLUATEX\relax \def\beginLUATEX#1\endLUATEX{} -\let\endOLDTEX\relax \def\beginOLDTEX#1\endOLDTEX{} -\let\endNEWTEX\relax \def\beginNEWTEX#1\endNEWTEX{} - -\pickupSOMETEX{ETEX} - -\ifnum\texengine=\xetexengine - \pickupSOMETEX{XETEX} -\fi -\ifnum\texengine=\luatexengine - \pickupSOMETEX{LUATEX} -\fi -\ifnum\texengine<\xetexengine - \pickupSOMETEX{OLDTEX} -\else - \pickupSOMETEX{NEWTEX} -\fi - -%D \macros -%D {bindprimitive} -%D -%D We can remap primitives (which is needed because of changes in for instance -%D \PDFTEX). - -\def\bindprimitive#1 #2 % new old - {\ifcsname#1\endcsname \else \ifcsname#2\endcsname - \expandafter\let\csname#1\expandafter\endcsname\csname#2\endcsname - \fi \fi} - %D We need to make sure that we start up in \DVI\ mode, so, after testing for running %D \PDFTEX, we default to \DVI. Why? -\pdfoutput \zerocount +\outputmode \zerocount \pdfminorversion \plusseven \pdfgentounicode \plusone \pdfinclusioncopyfonts \plusone @@ -1026,10 +1075,6 @@ \normalpdfcompression -% \let\normalsetrandomseed \setrandomseed -% \let\normaluniformdeviate\uniformdeviate -% \let\normalnormaldeviate \normaldeviate - %D Basic status stuff. \newif\ifproductionrun @@ -1044,28 +1089,6 @@ \def\modulonumber#1#2{\the\numexpr#2-((((#2+(#1/2))/#1)-1)*#1)\relax} \def\dividenumber#1#2{\the\numexpr(#2-(#1/2))/#1\relax} -% \ifnum\texengine=\xetexengine -% \edef\xetexversion {\numexpr\XeTeXversion*100+(\expandafter\gobbleoneargument\XeTeXrevision-5)/10\relax} -% \edef\xetexrevision {\the\numexpr(\expandafter\gobbleoneargument\XeTeXrevision-50)/100\relax} -% \fi -% -% \ifcase\texengine -% \def \texenginename {impossible} -% \edef\texengineversion{0} -% \or -% \def \texenginename {pdfTeX} -% \edef\texengineversion{\dividenumber{100}\pdftexversion.\modulonumber{100}\pdftexversion.\pdftexrevision} -% \or -% \def \texenginename {XeTeX} -% \edef\texengineversion{\dividenumber{100}\xetexversion .\modulonumber{100}\xetexversion .\xetexrevision} -% \or -% \def \texenginename {LuaTeX} -% \edef\texengineversion{\dividenumber{100}\luatexversion.\modulonumber{100}\luatexversion.\luatexrevision} -% \else -% \def \texenginename {impossible} -% \edef\texengineversion{0} -% \fi - \def \texenginename {LuaTeX} \edef\texengineversion{\dividenumber{100}\luatexversion.\modulonumber{100}\luatexversion.\luatexrevision} @@ -1084,10 +1107,10 @@ %D Handy. -\suppresslongerror \plusone -\suppressoutererror \plusone -\suppressmathparerror \plusone -\suppressifcsnameerror\plusone +\suppresslongerror \plusone % \let\suppresslongerror \relax +\suppressoutererror \plusone % \let\suppressoutererror \relax +\suppressmathparerror \plusone % \let\suppressmathparerror \relax +\suppressifcsnameerror\plusone % \let\suppressifcsnameerror\relax \ifdefined\matheqnogapstep % for now \matheqnogapstep \zerocount @@ -1124,7 +1147,7 @@ \normalprotected\def\installsystemnamespace#1% {\ifcsname ??#1\endcsname - \immediate\write16{fatal error: duplicate system namespace '#1'}% + \immediate\write\statuswrite{fatal error: duplicate system namespace '#1'}% \expandafter\normalend \else \global\advance\c_syst_helpers_n_of_namespaces\plusone diff --git a/tex/context/base/syst-lua.lua b/tex/context/base/syst-lua.lua index a6665f410..1657753ce 100644 --- a/tex/context/base/syst-lua.lua +++ b/tex/context/base/syst-lua.lua @@ -194,18 +194,6 @@ implement { actions = os.execute -- wrapped in sandbox } --- function commands.write(n,str) --- if n == 18 then --- os.execute(str) --- elseif n == 16 then --- -- immediate --- logs.report(str) --- else --- -- at the tex end we can still drop the write / also delayed vs immediate --- context.writeviatex(n,str) --- end --- end - implement { name = "doifelsesame", arguments = two_strings, diff --git a/tex/context/base/syst-lua.mkiv b/tex/context/base/syst-lua.mkiv index 5e82a9ea9..b5001ab62 100644 --- a/tex/context/base/syst-lua.mkiv +++ b/tex/context/base/syst-lua.mkiv @@ -53,49 +53,11 @@ \def\ui_ft#1#2{#1} \def\ui_st#1#2{#2} -%D Let's bring this under \LUA\ (and therefore \MKIV\ sandbox) control: - -% \setnewconstant\c_syst_write 18 -% -% \unexpanded\def\write#1#% so we can handle \immediate -% {\ifnum#1=\c_syst_write -% \expandafter\syst_execute -% \else -% \normalwrite#1% -% \fi} -% -% \unexpanded\def\syst_execute#1% -% {\ctxlua{os.execute(\!!bs#1\!!es)}} %D But as we only use write 16 we could as well do all in \LUA\ %D and ignore the rest. Okay, we still can do writes here but only %D when not blocked. -% Nicer would be if we could just disable write 18 and keep os.execute -% which in fact we can do by defining write18 as macro instead of -% primitive ... todo. - -% \unexpanded\def\write#1#% -% {\syst_write{#1}} -% -% \def\syst_write#1#2% -% {\ctxcommand{write(\number#1,\!!bs\normalunexpanded{#2}\!!es)}} -% -% \unexpanded\def\writeviatex#1#2% -% {\ifx\normalwrite\relax\else -% \normalwrite#1{#2}% -% \fi} - -% we have no way yet to pickup \immediate unless we redefine it -% we assume immediate execution - \let\syst_write_execute\clf_execute % always {...} -\unexpanded\def\write#1#% - {\ifnum#1=18 - \expandafter\syst_write_execute - \else - \normalwrite#1% - \fi} - \protect \endinput diff --git a/tex/context/base/tabl-xtb.lua b/tex/context/base/tabl-xtb.lua index 29ee06259..95031c3e3 100644 --- a/tex/context/base/tabl-xtb.lua +++ b/tex/context/base/tabl-xtb.lua @@ -68,6 +68,7 @@ local getfield = nuts.getfield local getbox = nuts.getbox local setfield = nuts.setfield +local setlink = nuts.setlink local copy_node_list = nuts.copy_list local hpack_node_list = nuts.hpack @@ -829,8 +830,7 @@ function xtables.construct() list = h -- if start then - setfield(stop,"next",list) - setfield(list,"prev",stop) + setlink(stop,list) else start = list end @@ -842,8 +842,7 @@ function xtables.construct() end local kern = new_kern(step) if stop then - setfield(stop,"next",kern) - setfield(kern,"prev",stop) + setlink(stop,kern) else -- can be first spanning next row (ny=...) start = kern end @@ -852,8 +851,7 @@ function xtables.construct() if start then if rightmargindistance > 0 then local kern = new_kern(rightmargindistance) - setfield(stop,"next",kern) - setfield(kern,"prev",stop) + setlink(stop,kern) -- stop = kern end return start, heights[r] + depths[r], hasspan diff --git a/tex/context/base/task-ini.lua b/tex/context/base/task-ini.lua index 986044c6e..ebfbbdc26 100644 --- a/tex/context/base/task-ini.lua +++ b/tex/context/base/task-ini.lua @@ -66,7 +66,7 @@ appendaction("processors", "lists", "languages.visualizediscretionaries" -- appendaction("processors", "lists", "typesetters.initials.handler") -- disabled appendaction("shipouts", "normalizers", "typesetters.margins.finalhandler") -- disabled -appendaction("shipouts", "normalizers", "nodes.handlers.cleanuppage") -- disabled +------------("shipouts", "normalizers", "nodes.handlers.cleanuppage") -- disabled appendaction("shipouts", "normalizers", "builders.paragraphs.expansion.trace") -- disabled appendaction("shipouts", "normalizers", "typesetters.alignments.handler") appendaction("shipouts", "normalizers", "nodes.references.handler") -- disabled @@ -243,10 +243,10 @@ disableaction("processors", "builders.kernel.kerning") directives.register("nodes.basepass", function(v) if v then - disableaction("processors", "builders.kernel.ligaturing") - disableaction("processors", "builders.kernel.kerning") - else enableaction("processors", "builders.kernel.ligaturing") enableaction("processors", "builders.kernel.kerning") + else + disableaction("processors", "builders.kernel.ligaturing") + disableaction("processors", "builders.kernel.kerning") end end) diff --git a/tex/context/base/toks-ini.lua b/tex/context/base/toks-ini.lua index 642f85d94..a6c465d50 100644 --- a/tex/context/base/toks-ini.lua +++ b/tex/context/base/toks-ini.lua @@ -8,232 +8,250 @@ if not modules then modules = { } end modules ['toks-ini'] = { tokens = tokens or { } local tokens = tokens +local newtoken = newtoken or token local tostring = tostring local utfchar = utf.char local char = string.char local printtable = table.print local concat = table.concat -if newtoken then - - if setinspector then - - local istoken = newtoken.is_token - local simple = { letter = "letter", other_char = "other" } - - local function astable(t) - if t and istoken(t) then - local cmdname = t.cmdname - local simple = simple[cmdname] - if simple then - return { - category = simple, - character = utfchar(t.mode) or nil, - } - else - return { - command = t.command, - id = t.id, - tok = t.tok, - csname = t.csname, - active = t.active, - expandable = t.expandable, - protected = t.protected, - mode = t.mode, - cmdname = cmdname, - } - end +if setinspector then + + local istoken = newtoken.is_token + local simple = { letter = "letter", other_char = "other" } + + local function astable(t) + if t and istoken(t) then + local cmdname = t.cmdname + local simple = simple[cmdname] + if simple then + return { + category = simple, + character = utfchar(t.mode) or nil, + } + else + return { + command = t.command, + id = t.id, + tok = t.tok, + csname = t.csname, + active = t.active, + expandable = t.expandable, + protected = t.protected, + mode = t.mode, + index = t.index, + cmdname = cmdname, + } end end + end - tokens.istoken = istoken - tokens.astable = astable + tokens.istoken = istoken + tokens.astable = astable - setinspector("token",function(v) if istoken(v) then printtable(astable(v),tostring(v)) return true end end) + setinspector("token",function(v) if istoken(v) then printtable(astable(v),tostring(v)) return true end end) +end + +local scan_toks = newtoken.scan_toks +local scan_string = newtoken.scan_string +local scan_int = newtoken.scan_int +local scan_code = newtoken.scan_code +local scan_dimen = newtoken.scan_dimen +local scan_glue = newtoken.scan_glue +local scan_keyword = newtoken.scan_keyword +local scan_token = newtoken.scan_token +local scan_word = newtoken.scan_word +local scan_number = newtoken.scan_number +local scan_csname = newtoken.scan_csname + +local get_next = newtoken.get_next + +local set_macro = newtoken.set_macro + +set_macro = function(k,v,g) + if g == "global" then + context.setgvalue(k,v or '') + else + context.setvalue(k,v or '') end +end + +local bits = { + escape = 2^ 0, + begingroup = 2^ 1, + endgroup = 2^ 2, + mathshift = 2^ 3, + alignment = 2^ 4, + endofline = 2^ 5, + parameter = 2^ 6, + superscript = 2^ 7, + subscript = 2^ 8, + ignore = 2^ 9, + space = 2^10, -- 1024 + letter = 2^11, + other = 2^12, + active = 2^13, + comment = 2^14, + invalid = 2^15, + -- + character = 2^11 + 2^12, + whitespace = 2^13 + 2^10, -- / needs more checking + -- + open = 2^10 + 2^1, -- space + begingroup + close = 2^10 + 2^2, -- space + endgroup +} - local scan_toks = newtoken.scan_toks - local scan_string = newtoken.scan_string - local scan_int = newtoken.scan_int - local scan_code = newtoken.scan_code - local scan_dimen = newtoken.scan_dimen - local scan_glue = newtoken.scan_glue - local scan_keyword = newtoken.scan_keyword - local scan_token = newtoken.scan_token - local scan_word = newtoken.scan_word - local scan_number = newtoken.scan_number +-- for k, v in next, bits do bits[v] = k end - local get_next = newtoken.get_next +tokens.bits = bits - local set_macro = newtoken.set_macro +local space_bits = bits.space - set_macro = function(k,v,g) - if g == "global" then - context.setgvalue(k,v or '') +-- words are space or \relax terminated and the trailing space is gobbled; a word +-- can contain any non-space letter/other + +local t = { } -- small optimization, a shared variable that is not reset + +if scan_word then + + scan_number = function(base) + local s = scan_word() + if not s then + return nil + elseif base then + return tonumber(s,base) else - context.setvalue(k,v or '') + return tonumber(s) end end - local bits = { - escape = 2^ 0, - begingroup = 2^ 1, - endgroup = 2^ 2, - mathshift = 2^ 3, - alignment = 2^ 4, - endofline = 2^ 5, - parameter = 2^ 6, - superscript = 2^ 7, - subscript = 2^ 8, - ignore = 2^ 9, - space = 2^10, -- 1024 - letter = 2^11, - other = 2^12, - active = 2^13, - comment = 2^14, - invalid = 2^15, - -- - character = 2^11 + 2^12, - whitespace = 2^13 + 2^10, -- / needs more checking - -- - open = 2^10 + 2^1, -- space + begingroup - close = 2^10 + 2^2, -- space + endgroup - } - - -- for k, v in next, bits do bits[v] = k end - - tokens.bits = bits - - local space_bits = bits.space - - -- words are space or \relax terminated and the trailing space is gobbled; a word - -- can contain any non-space letter/other - - local t = { } -- small optimization, a shared variable that is not reset - - if scan_word then - - scan_number = function(base) - local s = scan_word() - if not s then - return nil - elseif base then - return tonumber(s,base) - else - return tonumber(s) - end - end - - else - - scan_word = function() - local n = 0 - while true do - local c = scan_code() - if c then - n = n + 1 - t[n] = utfchar(c) - elseif scan_code(space_bits) then - if n > 0 then - break - end - elseif n > 0 then +else + + scan_word = function() + local n = 0 + while true do + local c = scan_code() + if c then + n = n + 1 + t[n] = utfchar(c) + elseif scan_code(space_bits) then + if n > 0 then break - else - return end + elseif n > 0 then + break + else + return end - return concat(t,"",1,n) end + return concat(t,"",1,n) + end - -- so we gobble the space (like scan_int) (number has to be space or non-char terminated - -- as we accept 0xabcd and such so there is no clear separator for a keyword - - scan_number = function(base) - local n = 0 - while true do - local c = scan_code() - if c then - n = n + 1 - t[n] = char(c) - elseif scan_code(space_bits) then - if n > 0 then - break - end - elseif n > 0 then + -- so we gobble the space (like scan_int) (number has to be space or non-char terminated + -- as we accept 0xabcd and such so there is no clear separator for a keyword + + scan_number = function(base) + local n = 0 + while true do + local c = scan_code() + if c then + n = n + 1 + t[n] = char(c) + elseif scan_code(space_bits) then + if n > 0 then break - else - return end - end - local s = concat(t,"",1,n) - if base then - return tonumber(s,base) + elseif n > 0 then + break else - return tonumber(s) + return end end - - end - - -- -- the next one cannot handle \iftrue true\else false\fi - -- - -- local function scan_boolean() - -- if scan_keyword("true") then - -- return true - -- elseif scan_keyword("false") then - -- return false - -- else - -- return nil - -- end - -- end - - local function scan_boolean() - local kw = scan_word() - if kw == "true" then - return true - elseif kw == "false" then - return false + local s = concat(t,"",1,n) + if base then + return tonumber(s,base) else - return nil + return tonumber(s) end end - tokens.scanners = { -- these expand - token = scan_token or get_next, - toks = scan_toks, - tokens = scan_toks, - dimen = scan_dimen, - dimension = scan_dimen, - glue = scan_glue, - skip = scan_glue, - integer = scan_int, - count = scan_int, - string = scan_string, - code = scan_code, - word = scan_word, - number = scan_number, - boolean = scan_boolean, - keyword = scan_keyword, - } - - tokens.getters = { -- these don't expand - token = get_next, - count = tex.getcount, - dimen = tex.getdimen, - box = tex.getbox, - } - - tokens.setters = { - macro = set_macro, - count = tex.setcount, - dimen = tex.setdimen, - box = tex.setbox, - } +end +-- -- the next one cannot handle \iftrue true\else false\fi +-- +-- local function scan_boolean() +-- if scan_keyword("true") then +-- return true +-- elseif scan_keyword("false") then +-- return false +-- else +-- return nil +-- end +-- end + +local function scan_boolean() + local kw = scan_word() + if kw == "true" then + return true + elseif kw == "false" then + return false + else + return nil + end end +if not scan_csname then + + scan_csname = function() + local t = get_next() + local n = t.csname + return n ~= "" and n or nil + end + +end + +tokens.scanners = { -- these expand + token = scan_token, + toks = scan_toks, + tokens = scan_toks, + dimen = scan_dimen, + dimension = scan_dimen, + glue = scan_glue, + skip = scan_glue, + integer = scan_int, + count = scan_int, + string = scan_string, + code = scan_code, + word = scan_word, + number = scan_number, + boolean = scan_boolean, + keyword = scan_keyword, + csname = scan_csname, +} + +tokens.getters = { -- these don't expand + token = get_next, + count = tex.getcount, + dimen = tex.getdimen, + skip = tex.getglue, + glue = tex.getglue, + skip = tex.getmuglue, + glue = tex.getmuglue, + box = tex.getbox, +} + +tokens.setters = { + macro = set_macro, + count = tex.setcount, + dimen = tex.setdimen, + skip = tex.setglue, + glue = tex.setglue, + skip = tex.setmuglue, + glue = tex.setmuglue, + box = tex.setbox, +} + -- static int run_scan_token(lua_State * L) -- { -- saved_tex_scanner texstate; diff --git a/tex/context/base/toks-scn.lua b/tex/context/base/toks-scn.lua index 84924c694..c51912024 100644 --- a/tex/context/base/toks-scn.lua +++ b/tex/context/base/toks-scn.lua @@ -28,6 +28,7 @@ local scanword = scanners.word local scancode = scanners.code local scanboolean = scanners.boolean local scandimen = scanners.dimen +local scancsname = scanners.csname local todimen = number.todimen local toboolean = toboolean @@ -125,6 +126,7 @@ local shortcuts = { scanopen = scanopen, scanclose = scanclose, scanlist = scanlist, + scancsname = scancsname, todimen = todimen, tonumber = tonumber, tostring = tostring, diff --git a/tex/context/base/toks-tra.lua b/tex/context/base/toks-tra.lua index bf2b91d38..4b0b82f0a 100644 --- a/tex/context/base/toks-tra.lua +++ b/tex/context/base/toks-tra.lua @@ -11,7 +11,7 @@ local format, gsub = string.format, string.gsub local tostring = tostring local tokens = tokens -local newtoken = newtoken +local newtoken = newtoken or token local tex = tex local context = context local commands = commands @@ -27,224 +27,220 @@ local registered = collectors.registered local report = logs.reporter("tokens","collectors") -if newtoken then - - -- todo: - -- - -- register : macros that will be expanded (only for demo-ing) - -- flush : print back to tex - -- test : fancy stuff - - local get_next = newtoken.get_next - local create = newtoken.create - - function collectors.install(tag,end_cs) - local data, d = { }, 0 - collectordata[tag] = data - end_cs = gsub(end_cs,"^\\","") - while true do - local t = get_next() - if t.csname == end_cs then - context[end_cs]() - return - else - d = d + 1 - data[d] = t - end - end - end - - local simple = { letter = "letter", other_char = "other" } - - function collectors.show(data) - -- We no longer have methods as we only used (in demos) method a - -- so there is no need to burden the core with this. We have a - -- different table anyway. - if type(data) == "string" then - data = collectordata[data] - end - if not data then +-- todo: +-- +-- register : macros that will be expanded (only for demo-ing) +-- flush : print back to tex +-- test : fancy stuff + +local get_next = newtoken.get_next +local create = newtoken.create + +function collectors.install(tag,end_cs) + local data, d = { }, 0 + collectordata[tag] = data + end_cs = gsub(end_cs,"^\\","") + while true do + local t = get_next() + if t.csname == end_cs then + context[end_cs]() return - end - local ctx_NC = context.NC - local ctx_NR = context.NR - local ctx_bold = context.bold - local ctx_verbatim = context.verbatim - context.starttabulate { "|Tl|Tc|Tl|" } - ctx_NC() ctx_bold("cmd") - ctx_NC() ctx_bold("meaning") - ctx_NC() ctx_bold("properties") - ctx_NC() ctx_NR() - context.HL() - for i=1,#data do - local token = data[i] - local cmdname = token.cmdname - local simple = simple[cmdname] - ctx_NC() - ctx_verbatim(simple or cmdname) - ctx_NC() - ctx_verbatim(simple and utfchar(token.mode) or token.csname) - ctx_NC() - if token.active then context("active ") end - if token.expandable then context("expandable ") end - if token.protected then context("protected ") end - ctx_NC() - ctx_NR() - end - context.stoptabulate() - end - - local function printlist(data) - if data and #data > 0 then - report("not supported (yet): printing back to tex") + else + d = d + 1 + data[d] = t end end +end - tokens.printlist = printlist -- will change to another namespace - - function collectors.flush(tag) - printlist(collectordata[tag]) - end +local simple = { letter = "letter", other_char = "other" } - function collectors.test(tag,handle) - report("not supported (yet): testing") +function collectors.show(data) + -- We no longer have methods as we only used (in demos) method a + -- so there is no need to burden the core with this. We have a + -- different table anyway. + if type(data) == "string" then + data = collectordata[data] end - - function collectors.register(name) - report("not supported (yet): registering") + if not data then + return end - -else - - -- 1 = command, 2 = modifier (char), 3 = controlsequence id - - local create = token.create - local csname_id = token.csname_id - local command_id = token.command_id - local command_name = token.command_name - local get_next = token.get_next - local expand = token.expand - local csname_name = token.csname_name - - local function printlist(data) - if data and #data > 0 then - callbacks.push('token_filter', function () - callbacks.pop('token_filter') -- tricky but the nil assignment helps - return data - end) - end - end - - tokens.printlist = printlist -- will change to another namespace - - function collectors.flush(tag) - printlist(collectordata[tag]) + local ctx_NC = context.NC + local ctx_NR = context.NR + local ctx_bold = context.bold + local ctx_verbatim = context.verbatim + context.starttabulate { "|Tl|Tc|Tl|" } + ctx_NC() ctx_bold("cmd") + ctx_NC() ctx_bold("meaning") + ctx_NC() ctx_bold("properties") + ctx_NC() ctx_NR() + context.HL() + for i=1,#data do + local token = data[i] + local cmdname = token.cmdname + local simple = simple[cmdname] + ctx_NC() + ctx_verbatim(simple or cmdname) + ctx_NC() + ctx_verbatim(simple and utfchar(token.mode) or token.csname) + ctx_NC() + if token.active then context("active ") end + if token.expandable then context("expandable ") end + if token.protected then context("protected ") end + ctx_NC() + ctx_NR() end + context.stoptabulate() +end - function collectors.register(name) - registered[csname_id(name)] = name +local function printlist(data) + if data and #data > 0 then + report("not supported (yet): printing back to tex") end +end - local call = command_id("call") - local letter = command_id("letter") - local other = command_id("other_char") - - function collectors.install(tag,end_cs) - local data, d = { }, 0 - collectordata[tag] = data - end_cs = gsub(end_cs,"^\\","") - local endcs = csname_id(end_cs) - while true do - local t = get_next() - local a, b = t[1], t[3] - if b == endcs then - context[end_cs]() - return - elseif a == call and registered[b] then - expand() - else - d = d + 1 - data[d] = t - end - end - end +tokens.printlist = printlist -- will change to another namespace - function collectors.show(data) - -- We no longer have methods as we only used (in demos) method a - -- so there is no need to burden the core with this. - if type(data) == "string" then - data = collectordata[data] - end - if not data then - return - end - local ctx_NC = context.NC - local ctx_NR = context.NR - local ctx_bold = context.bold - local ctx_verbatim = context.verbatim - context.starttabulate { "|T|Tr|cT|Tr|T|" } - ctx_NC() ctx_bold("cmd") - ctx_NC() ctx_bold("chr") - ctx_NC() - ctx_NC() ctx_bold("id") - ctx_NC() ctx_bold("name") - ctx_NC() ctx_NR() - context.HL() - for i=1,#data do - local token = data[i] - local cmd = token[1] - local chr = token[2] - local id = token[3] - local name = command_name(token) - ctx_NC() - ctx_verbatim(name) - ctx_NC() - if tonumber(chr) >= 0 then - ctx_verbatim(chr) - end - ctx_NC() - if cmd == letter or cmd == other then - ctx_verbatim(utfchar(chr)) - end - ctx_NC() - if id > 0 then - ctx_verbatim(id) - end - ctx_NC() - if id > 0 then - ctx_verbatim(csname_name(token) or "") - end - ctx_NC() ctx_NR() - end - context.stoptabulate() - end +function collectors.flush(tag) + printlist(collectordata[tag]) +end - function collectors.test(tag,handle) - local t, w, tn, wn = { }, { }, 0, 0 - handle = handle or collectors.defaultwords - local tagdata = collectordata[tag] - for k=1,#tagdata do - local v = tagdata[k] - if v[1] == letter then - wn = wn + 1 - w[wn] = v[2] - else - if wn > 0 then - handle(t,w) - wn = 0 - end - tn = tn + 1 - t[tn] = v - end - end - if wn > 0 then - handle(t,w) - end - collectordata[tag] = t - end +function collectors.test(tag,handle) + report("not supported (yet): testing") +end +function collectors.register(name) + report("not supported (yet): registering") end +-- -- old token code +-- +-- -- 1 = command, 2 = modifier (char), 3 = controlsequence id +-- +-- local create = token.create +-- local csname_id = token.csname_id +-- local command_id = token.command_id +-- local command_name = token.command_name +-- local get_next = token.get_next +-- local expand = token.expand +-- local csname_name = token.csname_name +-- +-- local function printlist(data) +-- if data and #data > 0 then +-- callbacks.push('token_filter', function () +-- callbacks.pop('token_filter') -- tricky but the nil assignment helps +-- return data +-- end) +-- end +-- end +-- +-- tokens.printlist = printlist -- will change to another namespace +-- +-- function collectors.flush(tag) +-- printlist(collectordata[tag]) +-- end +-- +-- function collectors.register(name) +-- registered[csname_id(name)] = name +-- end +-- +-- local call = command_id("call") +-- local letter = command_id("letter") +-- local other = command_id("other_char") +-- +-- function collectors.install(tag,end_cs) +-- local data, d = { }, 0 +-- collectordata[tag] = data +-- end_cs = gsub(end_cs,"^\\","") +-- local endcs = csname_id(end_cs) +-- while true do +-- local t = get_next() +-- local a, b = t[1], t[3] +-- if b == endcs then +-- context[end_cs]() +-- return +-- elseif a == call and registered[b] then +-- expand() +-- else +-- d = d + 1 +-- data[d] = t +-- end +-- end +-- end +-- +-- function collectors.show(data) +-- -- We no longer have methods as we only used (in demos) method a +-- -- so there is no need to burden the core with this. +-- if type(data) == "string" then +-- data = collectordata[data] +-- end +-- if not data then +-- return +-- end +-- local ctx_NC = context.NC +-- local ctx_NR = context.NR +-- local ctx_bold = context.bold +-- local ctx_verbatim = context.verbatim +-- context.starttabulate { "|T|Tr|cT|Tr|T|" } +-- ctx_NC() ctx_bold("cmd") +-- ctx_NC() ctx_bold("chr") +-- ctx_NC() +-- ctx_NC() ctx_bold("id") +-- ctx_NC() ctx_bold("name") +-- ctx_NC() ctx_NR() +-- context.HL() +-- for i=1,#data do +-- local token = data[i] +-- local cmd = token[1] +-- local chr = token[2] +-- local id = token[3] +-- local name = command_name(token) +-- ctx_NC() +-- ctx_verbatim(name) +-- ctx_NC() +-- if tonumber(chr) >= 0 then +-- ctx_verbatim(chr) +-- end +-- ctx_NC() +-- if cmd == letter or cmd == other then +-- ctx_verbatim(utfchar(chr)) +-- end +-- ctx_NC() +-- if id > 0 then +-- ctx_verbatim(id) +-- end +-- ctx_NC() +-- if id > 0 then +-- ctx_verbatim(csname_name(token) or "") +-- end +-- ctx_NC() ctx_NR() +-- end +-- context.stoptabulate() +-- end +-- +-- function collectors.test(tag,handle) +-- local t, w, tn, wn = { }, { }, 0, 0 +-- handle = handle or collectors.defaultwords +-- local tagdata = collectordata[tag] +-- for k=1,#tagdata do +-- local v = tagdata[k] +-- if v[1] == letter then +-- wn = wn + 1 +-- w[wn] = v[2] +-- else +-- if wn > 0 then +-- handle(t,w) +-- wn = 0 +-- end +-- tn = tn + 1 +-- t[tn] = v +-- end +-- end +-- if wn > 0 then +-- handle(t,w) +-- end +-- collectordata[tag] = t +-- end + -- Interfacing: commands.collecttokens = collectors.install @@ -265,8 +261,6 @@ collectors.dowithwords = collectors.test -- This is only used in old articles ... will move to a module: -local create = newtoken and newtoken.create or token.create - tokens.vbox = create("vbox") tokens.hbox = create("hbox") tokens.vtop = create("vtop") diff --git a/tex/context/base/trac-deb.lua b/tex/context/base/trac-deb.lua index 224c8de22..792ad9b56 100644 --- a/tex/context/base/trac-deb.lua +++ b/tex/context/base/trac-deb.lua @@ -9,7 +9,7 @@ if not modules then modules = { } end modules ['trac-deb'] = { local lpeg, status = lpeg, status local lpegmatch = lpeg.match -local format, concat, match, find = string.format, table.concat, string.match, string.find +local format, concat, match, find, gsub = string.format, table.concat, string.match, string.find, string.gsub local tonumber, tostring = tonumber, tostring -- maybe tracers -> tracers.tex (and tracers.lua for current debugger) @@ -168,27 +168,33 @@ end -- todo: \starttext bla \blank[foo] bla \stoptext +local nop = function() end +local resetmessages = status.resetmessages() or nop + local function processerror(offset) + -- print("[[ last tex error: " .. tostring(status.lasterrorstring or "") .. " ]]") + -- print("[[ last lua error: " .. tostring(status.lastluaerrorstring or "") .. " ]]") + -- print("[[ last warning : " .. tostring(status.lastwarningstring or "") .. " ]]") + -- print("[[ last location : " .. tostring(status.lastwarninglocation or "") .. " ]]") + -- print("[[ last context : " .. tostring(status.lasterrorcontext or "") .. " ]]") + local inputstack = resolvers.inputstack local filename = inputstack[#inputstack] or status.filename local linenumber = tonumber(status.linenumber) or 0 - -- - -- print("[[ last tex error: " .. tostring(status.lasterrorstring) .. " ]]") - -- print("[[ last lua error: " .. tostring(status.lastluaerrorstring) .. " ]]") - -- print("[[ start errorcontext ]]") - -- tex.show_context() - -- print("\n[[ stop errorcontext ]]") - -- + local lastcontext = status.lasterrorcontext local lasttexerror = status.lasterrorstring or "?" local lastluaerror = status.lastluaerrorstring or lasttexerror local luaerrorline = match(lastluaerror,[[lua%]?:.-(%d+)]]) or (lastluaerror and find(lastluaerror,"?:0:",1,true) and 0) + resetmessages() + lastluaerror = gsub(lastluaerror,"%[\\directlua%]","[ctxlua]") tracers.printerror { filename = filename, linenumber = linenumber, + offset = tonumber(offset) or 10, lasttexerror = lasttexerror, lastluaerror = lastluaerror, luaerrorline = luaerrorline, - offset = tonumber(offset) or 10, + lastcontext = lastcontext, } end @@ -199,6 +205,7 @@ function tracers.printerror(specification) local linenumber = specification.linenumber local lasttexerror = specification.lasttexerror local lastluaerror = specification.lastluaerror + local lastcontext = specification.lasterrorcontext local luaerrorline = specification.luaerrorline local offset = specification.offset local report = errorreporter(luaerrorline) @@ -213,7 +220,11 @@ function tracers.printerror(specification) -- report("error on line %s in file %s:\n\n%s",linenumber,filename,lasttexerror) else report("tex error on line %s in file %s: %s",linenumber,filename,lasttexerror) - if tex.show_context then + if lastcontext then + report_nl() + report_str(lastcontext) + report_nl() + elseif tex.show_context then report_nl() tex.show_context() end @@ -224,17 +235,37 @@ function tracers.printerror(specification) end end -local nop = function() end +local function processwarning(offset) + -- local inputstack = resolvers.inputstack + -- local filename = inputstack[#inputstack] or status.filename + -- local linenumber = tonumber(status.linenumber) or 0 + local lastwarning = status.lastwarningstring or "?" + local lastlocation = status.lastwarningtag or "?" + resetmessages() + tracers.printwarning { + -- filename = filename, + -- linenumber = linenumber, + -- offset = tonumber(offset) or 10, + lastwarning = lastwarning , + lastlocation = lastlocation, + } +end + +function tracers.printwarning(specification) + logs.report("luatex warning","%s: %s",specification.lastlocation,specification.lastwarning) +end directives.register("system.errorcontext", function(v) local register = callback.register if v then register('show_error_message', nop) + register('show_warning_message',function() processwarning(v) end) register('show_error_hook', function() processerror(v) end) register('show_lua_error_hook', nop) else register('show_error_message', nil) register('show_error_hook', nil) + register('show_warning_message',nil) register('show_lua_error_hook', nil) end end) diff --git a/tex/context/base/trac-log.lua b/tex/context/base/trac-log.lua index 1e91fc404..ba8ee8df0 100644 --- a/tex/context/base/trac-log.lua +++ b/tex/context/base/trac-log.lua @@ -132,6 +132,8 @@ if tex and (tex.jobname or tex.formatname) then elseif target == "term" then texio_write_nl("term","") io_write(...) + elseif type(target) == "number" then + texio_write_nl(target,...) -- a tex output channel elseif target ~= "none" then texio_write_nl("log",target,...) texio_write_nl("term","") @@ -150,6 +152,8 @@ if tex and (tex.jobname or tex.formatname) then texio_write("log",...) elseif target == "term" then io_write(...) + elseif type(target) == "number" then + texio_write(target,...) -- a tex output channel elseif target ~= "none" then texio_write("log",target,...) io_write(target,...) @@ -233,7 +237,7 @@ if tex and (tex.jobname or tex.formatname) then end report = function(a,b,c,...) - if c then + if c ~= nil then write_nl(target,report_yes(translations[a],formatters[formats[b]](c,...))) elseif b then write_nl(target,report_yes(translations[a],formats[b])) @@ -245,7 +249,7 @@ if tex and (tex.jobname or tex.formatname) then end direct = function(a,b,c,...) - if c then + if c ~= nil then return direct_yes(translations[a],formatters[formats[b]](c,...)) elseif b then return direct_yes(translations[a],formats[b]) @@ -257,7 +261,7 @@ if tex and (tex.jobname or tex.formatname) then end subreport = function(a,s,b,c,...) - if c then + if c ~= nil then write_nl(target,subreport_yes(translations[a],translations[s],formatters[formats[b]](c,...))) elseif b then write_nl(target,subreport_yes(translations[a],translations[s],formats[b])) @@ -269,7 +273,7 @@ if tex and (tex.jobname or tex.formatname) then end subdirect = function(a,s,b,c,...) - if c then + if c ~= nil then return subdirect_yes(translations[a],translations[s],formatters[formats[b]](c,...)) elseif b then return subdirect_yes(translations[a],translations[s],formats[b]) @@ -281,7 +285,7 @@ if tex and (tex.jobname or tex.formatname) then end status = function(a,b,c,...) - if c then + if c ~= nil then write_nl(target,status_yes(translations[a],formatters[formats[b]](c,...))) elseif b then write_nl(target,status_yes(translations[a],formats[b])) diff --git a/tex/context/base/trac-tex.lua b/tex/context/base/trac-tex.lua index 5fe4754cb..24dc3f1bd 100644 --- a/tex/context/base/trac-tex.lua +++ b/tex/context/base/trac-tex.lua @@ -13,79 +13,75 @@ local next = next local texhashtokens = tex.hashtokens local trackers = trackers - -local saved = { } +local newtoken = newtoken or token +local saved = { } function trackers.savehash() saved = texhashtokens() end -if newtoken then - - function trackers.dumphashtofile(filename,delta) - local list = { } - local hash = tex.hashtokens() - local create = newtoken.create - for name, token in next, hash do - if not delta or not saved[name] then - if token[2] ~= 0 then -- still old interface - local token = create(name) - -- inspect(token) - local category = token.cmdname - local dk = list[category] - if not dk then - dk = { - names = { }, - found = 0, - -- code = token[1], - } - list[category] = dk - end - if token.protected then - if token.expandable then - dk.names[name] = "ep" - else - dk.names[name] = "-p" - end - else - if token.expandable then - dk.names[name] = "ep" - else - dk.names[name] = "--" - end - end - dk.found = dk.found + 1 - end - end - end - table.save(filename or tex.jobname .. "-hash.log",list) - end - -else - - function trackers.dumphashtofile(filename,delta) - local list = { } - local hash = texhashtokens() - local getname = token.command_name - for name, token in next, hash do - if not delta or not saved[name] then - -- token: cmd, chr, csid -- combination cmd,chr determines name - local category = getname(token) +function trackers.dumphashtofile(filename,delta) + local list = { } + local hash = tex.hashtokens() + local create = newtoken.create + for name, token in next, hash do + if not delta or not saved[name] then + if token[2] ~= 0 then -- still old interface + local token = create(name) + -- inspect(token) + local category = token.cmdname local dk = list[category] if not dk then - -- a bit funny names but this sorts better (easier to study) - dk = { names = { }, found = 0, code = token[1] } + dk = { + names = { }, + found = 0, + -- code = token[1], + } list[category] = dk end - dk.names[name] = { token[2], token[3] } + if token.protected then + if token.expandable then + dk.names[name] = "ep" + else + dk.names[name] = "-p" + end + else + if token.expandable then + dk.names[name] = "ep" + else + dk.names[name] = "--" + end + end dk.found = dk.found + 1 end end - table.save(filename or tex.jobname .. "-hash.log",list) end - + table.save(filename or tex.jobname .. "-hash.log",list) end +-- -- old token code +-- +-- function trackers.dumphashtofile(filename,delta) +-- local list = { } +-- local hash = texhashtokens() +-- local getname = token.command_name +-- for name, token in next, hash do +-- if not delta or not saved[name] then +-- -- token: cmd, chr, csid -- combination cmd,chr determines name +-- local category = getname(token) +-- local dk = list[category] +-- if not dk then +-- -- a bit funny names but this sorts better (easier to study) +-- dk = { names = { }, found = 0, code = token[1] } +-- list[category] = dk +-- end +-- dk.names[name] = { token[2], token[3] } +-- dk.found = dk.found + 1 +-- end +-- end +-- table.save(filename or tex.jobname .. "-hash.log",list) +-- end + local delta = nil local function dump_hash(wanteddelta) diff --git a/tex/context/base/trac-vis.lua b/tex/context/base/trac-vis.lua index a904b513d..25ec59886 100644 --- a/tex/context/base/trac-vis.lua +++ b/tex/context/base/trac-vis.lua @@ -68,19 +68,24 @@ local nuts = nodes.nuts local tonut = nuts.tonut local tonode = nuts.tonode -local getfield = nuts.getfield -local getnext = nuts.getnext -local getprev = nuts.getprev -local getid = nuts.getid local setfield = nuts.setfield -local getattr = nuts.getattr +local setboth = nuts.setboth +local setlink = nuts.setlink +local setdisc = nuts.setdisc local setattr = nuts.setattr + +local getfield = nuts.getfield +local getid = nuts.getid local getfont = nuts.getfont +local getattr = nuts.getattr local getsubtype = nuts.getsubtype local getchar = nuts.getchar local getbox = nuts.getbox local getlist = nuts.getlist local getleader = nuts.getleader +local getnext = nuts.getnext +local getprev = nuts.getprev +local getdisc = nuts.getdisc local hpack_nodes = nuts.hpack local vpack_nodes = nuts.vpack @@ -116,6 +121,8 @@ local new_rule = nodepool.rule local new_kern = nodepool.kern local new_glue = nodepool.glue local new_penalty = nodepool.penalty +local new_hlist = nodepool.hlist +local new_vlist = nodepool.vlist local tracers = nodes.tracers local visualizers = nodes.visualizers @@ -392,35 +399,29 @@ end local w_cache = { } local tags = { - open = "FIC", - write = "FIW", - close = "FIC", - special = "SPE", - localpar = "PAR", - dir = "DIR", - savepos = "POS", - pdfliteral = "PDF", - pdfrefobj = "PDF", - pdfrefxform = "PDF", - pdfrefximage = "PDF", - pdfannot = "PDF", - pdfstartlink = "PDF", - pdfendlink = "PDF", - pdfdest = "PDF", - pdfthread = "PDF", - pdfstartthread = "PDF", - pdfendthread = "PDF", - pdfsavepos = "PDF", -- obsolete - pdfthreaddata = "PDF", - pdflinkdata = "PDF", - pdfcolorstack = "PDF", - pdfsetmatrix = "PDF", - pdfsave = "PDF", - pdfrestore = "PDF", - latelua = "LUA", - closelua = "LUA", - cancelboundary = "CBD", - userdefined = "USR", + open = "FIC", + write = "FIW", + close = "FIC", + special = "SPE", + latelua = "LUA", + savepos = "POS", + userdefined = "USR", + -- backend stuff + pdfliteral = "PDF", + pdfrefobj = "PDF", + pdfannot = "PDF", + pdfstartlink = "PDF", + pdfendlink = "PDF", + pdfdest = "PDF", + pdfthread = "PDF", + pdfstartthread = "PDF", + pdfendthread = "PDF", + pdfthreaddata = "PDF", + pdflinkdata = "PDF", + pdfcolorstack = "PDF", + pdfsetmatrix = "PDF", + pdfsave = "PDF", + pdfrestore = "PDF", } local function whatsit(head,current) @@ -487,8 +488,7 @@ local function ruledbox(head,current,vertical,layer,what,simple,previous) local next = getnext(current) local prev = previous -- local prev = getprev(current) -- prev can be wrong in math mode < 0.78.3 - setfield(current,"next",nil) - setfield(current,"prev",nil) + setboth(current) local linewidth = emwidth/fraction local baseline, baseskip if dp ~= 0 and ht ~= 0 then @@ -549,50 +549,24 @@ local function ruledbox(head,current,vertical,layer,what,simple,previous) if baseskip then info = linked_nodes(info,baseskip,baseline) -- could be in previous linked end - local shft - if shift == 0 then - shift = nil - else - local sh = shift > 0 and shift or 0 - local sd = shift < 0 and - shift or 0 - shft = fast_hpack(new_rule(2*emwidth/fraction,sh,sd)) - setfield(shft,"width",0) - if sh > 0 then - setfield(shft,"height",0) - end - if sd > 0 then - setfield(shft,"depth",0) - end - end setlisttransparency(info,c_text) info = fast_hpack(info) setfield(info,"width",0) setfield(info,"height",0) setfield(info,"depth",0) setattr(info,a_layer,layer) - local info = linked_nodes(shft,current,new_kern(-wd),info) - info = fast_hpack(info,wd) - if vertical then - info = vpack_nodes(info) - end - if shift then - setfield(current,"shift",0) - setfield(info,"width",wd) - setfield(info,"height",ht) - setfield(info,"depth",dp) - setfield(info,"shift",shift) - end + local info = linked_nodes(current,new_kern(-wd),info) + setfield(current,"shift",0) + info = (vertical and new_vlist or new_hlist)(info,wd,ht,dp,shift) if next then - setfield(info,"next",next) - setfield(next,"prev",info) + setlink(info,next) end if prev then if getid(prev) == gluespec_code then report_visualize("ignoring invalid prev") -- weird, how can this happen, an inline glue-spec, probably math else - setfield(info,"prev",prev) - setfield(prev,"next",info) + setlink(prev,info) end end if head == current then @@ -607,14 +581,13 @@ end local function ruledglyph(head,current,previous) local wd = getfield(current,"width") - -- local wd = chardata[getfield(current,"font")][getfield(current,"char")].width + -- local wd = chardata[getfont(current)][getchar(current)].width if wd ~= 0 then local ht = getfield(current,"height") local dp = getfield(current,"depth") local next = getnext(current) local prev = previous - setfield(current,"next",nil) - setfield(current,"prev",nil) + setboth(current) local linewidth = emwidth/(2*fraction) local baseline -- if dp ~= 0 and ht ~= 0 then @@ -632,14 +605,14 @@ local function ruledglyph(head,current,previous) new_kern(-wd+doublelinewidth), baseline ) -local char = chardata[getfield(current,"font")][getfield(current,"char")] -if char and char.tounicode and #char.tounicode > 4 then -- hack test - setlistcolor(info,c_ligature) - setlisttransparency(info,c_ligature_d) -else - setlistcolor(info,c_glyph) - setlisttransparency(info,c_glyph_d) -end + local char = chardata[getfont(current)][getchar(current)] + if char and char.tounicode and #char.tounicode > 4 then -- hack test + setlistcolor(info,c_ligature) + setlisttransparency(info,c_ligature_d) + else + setlistcolor(info,c_glyph) + setlisttransparency(info,c_glyph_d) + end info = fast_hpack(info) setfield(info,"width",0) setfield(info,"height",0) @@ -649,12 +622,10 @@ end info = fast_hpack(info) setfield(info,"width",wd) if next then - setfield(info,"next",next) - setfield(next,"prev",info) + setlink(info,next) end if prev then - setfield(info,"prev",prev) - setfield(prev,"next",info) + setlink(prev,info) end if head == current then return info, info @@ -875,18 +846,17 @@ local function visualize(head,vertical,forced,parent) head, current = ruledglyph(head,current,previous) end elseif id == disc_code then - local pre = getfield(current,"pre") + local pre, post, replace = getdisc(current) if pre then - setfield(current,"pre",visualize(pre,false,a,parent)) + pre = visualize(pre,false,a,parent) end - local post = getfield(current,"post") if post then - setfield(current,"post",visualize(post,false,a,parent)) + post = visualize(post,false,a,parent) end - local replace = getfield(current,"replace") if replace then - setfield(current,"replace",visualize(replace,false,a,parent)) + replace = visualize(replace,false,a,parent) end + setdisc(current,pre,post,replace) elseif id == kern_code then local subtype = getsubtype(current) -- tricky ... we don't copy the trace attribute in node-inj (yet) diff --git a/tex/context/base/typo-bld.lua b/tex/context/base/typo-bld.lua index 69d72e28c..ade171c5d 100644 --- a/tex/context/base/typo-bld.lua +++ b/tex/context/base/typo-bld.lua @@ -1,4 +1,4 @@ -if not modules then modules = { } end modules ['typo-bld'] = { -- was node-par +if modules then modules = { } end modules ['typo-bld'] = { -- was node-par version = 1.001, comment = "companion to typo-bld.mkiv", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", @@ -287,3 +287,113 @@ implement { name = "startparbuilder", actions = constructors.start, arguments implement { name = "stopparbuilder", actions = constructors.stop } implement { name = "enableparbuilder", actions = constructors.enable } implement { name = "disableparbuilder", actions = constructors.disable } + +-- Here are some tracers: + +local new_kern = nodes.pool.kern +local new_rule = nodes.pool.rule +local hpack = nodes.hpack +local setcolor = nodes.tracers.colors.set +local listtoutf = nodes.listtoutf + +local report_hpack = logs.reporter("hpack routine") +local report_vpack = logs.reporter("vpack routine") + +-- overflow|badness w h d dir + +local function vpack_quality(how,n,detail,first,last) + if last <= 0 then + report_vpack("%s vbox",how) + elseif first > 0 and first < last then + report_vpack("%s vbox at line %i - %i",how,first,last) + else + report_vpack("%s vbox at line %i",how,last) + end +end + +trackers.register("builders.vpack.quality",function(v) + callback.register("vpack_quality",v and report_vpack_quality or nil) +end) + +local report, show = false, false + +local function hpack_quality(how,detail,n,first,last) + if report then + local str = listtoutf(n.head,"",true,nil,true) + if last <= 0 then + report_hpack("%s hbox: %s",how,str) + elseif first > 0 and first < last then + report_hpack("%s hbox at line %i - %i: %s",how,first,last,str) + else + report_hpack("%s hbox at line %i: %s",how,last,str) + end + end + if show then + local width = 2*65536 + local height = n.height + local depth = n.depth + local dir = n.dir + if height < 4*65526 then + height = 4*65526 + end + if depth < 2*65526 then + depth = 2*65526 + end + local rule = new_rule(width,height,depth) + rule.dir = dir + if how == "overfull" then + setcolor(rule,"red") + local kern = new_kern(-detail) + kern.next = rule + rule.prev = kern + rule = kern + elseif how == "underfull" then + setcolor(rule,"blue") + elseif how == "loose" then + setcolor(rule,"magenta") + elseif how == "tight" then + setcolor(rule,"cyan") + end + rule = hpack(rule) + rule.width = 0 + rule.dir = dir + return rule + end +end + +trackers.register("builders.hpack.quality",function(v) + report = v + callback.register("hpack_quality",(report or show) and hpack_quality or nil) +end) + +trackers.register("builders.hpack.overflow",function(v) + show = v + callback.register("hpack_quality",(report or show) and hpack_quality or nil) +end) + +-- local ignoredepth = - 65536000 +-- +-- callback.register("append_to_vlist_filter", function(box,location,prevdepth,mirrored) +-- if prevdepth > ignoredepth then +-- local b = tex.baselineskip +-- local d = b.width - prevdepth +-- local g = nil +-- if mirrored then +-- d = d - box.depth +-- else +-- d = d - box.height +-- end +-- if d < tex.lineskiplimit then +-- g = nodes.pool.glue() +-- g.spec = tex.lineskip +-- else +-- g = nodes.pool.baselineskip(d) +-- end +-- g.next = box +-- box.prev = g +-- return g, mirrored and box.height or box.depth +-- else +-- return box, mirrored and box.height or box.depth +-- end +-- end) +-- diff --git a/tex/context/base/typo-bld.mkiv b/tex/context/base/typo-bld.mkiv index 69047c98b..621d81c52 100644 --- a/tex/context/base/typo-bld.mkiv +++ b/tex/context/base/typo-bld.mkiv @@ -17,6 +17,10 @@ %D the underlying interfaces. But at least it's cleaned as part of the status-mkiv %D cleanup. +% \enabletrackers[builders.hpack.overflow] +% \enabletrackers[builders.hpack.quality] +% \enabletrackers[builders.vpack.quality] + % \startparbuilder[default] % \input tufte \par % \startparbuilder[oneline] diff --git a/tex/context/base/typo-brk.lua b/tex/context/base/typo-brk.lua index a9d775856..146694494 100644 --- a/tex/context/base/typo-brk.lua +++ b/tex/context/base/typo-brk.lua @@ -27,14 +27,19 @@ local tonode = nuts.tonode local getnext = nuts.getnext local getprev = nuts.getprev +local getboth = nuts.getboth local getsubtype = nuts.getsubtype local getchar = nuts.getchar local getfont = nuts.getfont local getid = nuts.getid local getfield = nuts.getfield -local setfield = nuts.setfield local getattr = nuts.getattr + +local setfield = nuts.setfield local setattr = nuts.setattr +local setlink = nuts.setlink +local setchar = nuts.setchar +local setdisc = nuts.setdisc local copy_node = nuts.copy local copy_nodelist = nuts.copy_list @@ -98,14 +103,16 @@ local function insert_break(head,start,before,after) end methods[1] = function(head,start) - if getprev(start) and getnext(start) then + local p, n = getboth(start) + if p and n then insert_break(head,start,10000,0) end return head, start end methods[2] = function(head,start) -- ( => (- - if getprev(start) and getnext(start) then + local p, n = getboth(start) + if p and n then local tmp head, start, tmp = remove_node(head,start) head, start = insert_node_before(head,start,new_disc()) @@ -114,9 +121,8 @@ methods[2] = function(head,start) -- ( => (- setfield(start,"replace",tmp) local tmp = copy_node(tmp) local hyphen = copy_node(tmp) - setfield(hyphen,"char",languages.prehyphenchar(getfield(tmp,"lang"))) - setfield(tmp,"next",hyphen) - setfield(hyphen,"prev",tmp) + setchar(hyphen,languages.prehyphenchar(getfield(tmp,"lang"))) + setlink(tmp,hyphen) setfield(start,"post",tmp) insert_break(head,start,10000,10000) end @@ -124,7 +130,8 @@ methods[2] = function(head,start) -- ( => (- end methods[3] = function(head,start) -- ) => -) - if getprev(start) and getnext(start) then + local p, n = getboth(start) + if p and n then local tmp head, start, tmp = remove_node(head,start) head, start = insert_node_before(head,start,new_disc()) @@ -133,9 +140,8 @@ methods[3] = function(head,start) -- ) => -) setfield(start,"replace",tmp) local tmp = copy_node(tmp) local hyphen = copy_node(tmp) - setfield(hyphen,"char",languages.prehyphenchar(getfield(tmp,"lang"))) - setfield(tmp,"prev",hyphen) - setfield(hyphen,"next",tmp) + setchar(hyphen,languages.prehyphenchar(getfield(tmp,"lang"))) + setlink(hyphen,tmp) setfield(start,"pre",hyphen) insert_break(head,start,10000,10000) end @@ -143,22 +149,22 @@ methods[3] = function(head,start) -- ) => -) end methods[4] = function(head,start) -- - => - - - - if getprev(start) and getnext(start) then + local p, n = getboth(start) + if p and n then local tmp head, start, tmp = remove_node(head,start) head, start = insert_node_before(head,start,new_disc()) -- setfield(start,"attr",copy_nodelist(getfield(tmp,"attr"))) -- just a copy will do setfield(start,"attr",getfield(tmp,"attr")) - setfield(start,"pre",copy_node(tmp)) - setfield(start,"post",copy_node(tmp)) - setfield(start,"replace",tmp) + setdisc(start,copy_node(tmp),copy_node(tmp),tmp) insert_break(head,start,10000,10000) end return head, start end methods[5] = function(head,start,settings) -- x => p q r - if getprev(start) and getnext(start) then + local p, n = getboth(start) + if p and n then local tmp head, start, tmp = remove_node(head,start) head, start = insert_node_before(head,start,new_disc()) @@ -168,14 +174,15 @@ methods[5] = function(head,start,settings) -- x => p q r local right = settings.right local middle = settings.middle if left then - setfield(start,"pre",(tonodes(tostring(left),font,attr))) -- was right + left = tonodes(tostring(left),font,attr) end if right then - setfield(start,"post",(tonodes(tostring(right),font,attr))) -- was left + right = tonodes(tostring(right),font,attr) end if middle then - setfield(start,"replace",(tonodes(tostring(middle),font,attr))) + middle = tonodes(tostring(middle),font,attr) end + setdisc(start,left,right,middle) -- setfield(start,"attr",copy_nodelist(attr)) -- todo: critical only -- just a copy will do setfield(start,"attr",attr) -- todo: critical only -- just a copy will do free_node(tmp) diff --git a/tex/context/base/typo-cap.lua b/tex/context/base/typo-cap.lua index 7f0656130..0eae3b2d9 100644 --- a/tex/context/base/typo-cap.lua +++ b/tex/context/base/typo-cap.lua @@ -22,15 +22,18 @@ local tonode = nuts.tonode local tonut = nuts.tonut local getfield = nuts.getfield -local setfield = nuts.setfield local getnext = nuts.getnext local getprev = nuts.getprev local getid = nuts.getid local getattr = nuts.getattr -local setattr = nuts.setattr local getfont = nuts.getfont local getsubtype = nuts.getsubtype local getchar = nuts.getchar +local getdisc = nuts.getdisc + +local setfield = nuts.setfield +local setattr = nuts.setattr +local setchar = nuts.setchar local copy_node = nuts.copy local end_of_math = nuts.end_of_math @@ -136,16 +139,16 @@ local function replacer(start,codes) for i=#dc,1,-1 do local chr = dc[i] if i == 1 then - setfield(start,"char",chr) + setchar(start,chr) else local g = copy_node(start) - setfield(g,"char",chr) + setchar(g,chr) insert_after(start,start,g) end end return start, true elseif ifc[dc] then - setfield(start,"char",dc) + setchar(start,dc) return start, true end end @@ -304,7 +307,7 @@ local function random(start,attr,lastfont,n,count,where,first) while true do local n = randomnumber(0x41,0x5A) if tfm[n] then -- this also intercepts tables - setfield(used,"char",n) + setchar(used,n) return start, true end end @@ -312,7 +315,7 @@ local function random(start,attr,lastfont,n,count,where,first) while true do local n = randomnumber(0x61,0x7A) if tfm[n] then -- this also intercepts tables - setfield(used,"char",n) + setchar(used,n) return start, true end end @@ -385,7 +388,7 @@ function cases.handler(head) -- not real fast but also not used on much data end local action = actions[n] -- map back to low number if action then - local replace = getfield(start,"replace") + local pre, post, replace = getdisc(start) if replace then local cnt = count for g in traverse_id(glyph_code,replace) do @@ -395,7 +398,6 @@ function cases.handler(head) -- not real fast but also not used on much data if quit then break end end end - local pre = getfield(start,"pre") if pre then local cnt = count for g in traverse_id(glyph_code,pre) do @@ -405,7 +407,6 @@ function cases.handler(head) -- not real fast but also not used on much data if quit then break end end end - local post = getfield(start,"post") if post then local cnt = count for g in traverse_id(glyph_code,post) do diff --git a/tex/context/base/typo-chr.lua b/tex/context/base/typo-chr.lua index 00123ede3..041a73e1b 100644 --- a/tex/context/base/typo-chr.lua +++ b/tex/context/base/typo-chr.lua @@ -89,10 +89,9 @@ if not modules then modules = { } end modules ['typo-chr'] = { local insert, remove = table.insert, table.remove local nodecodes = nodes.nodecodes -local whatsitcodes = nodes.whatsitcodes local glyph_code = nodecodes.glyph local whatsit_code = nodecodes.whatsit -local localpar_code = nodecodes.localpar or whatsitcodes.localpar +local localpar_code = nodecodes.localpar local texnest = tex.nest local free_node = node.free @@ -172,7 +171,7 @@ local function pickup(head,tail,str) local prev = first.prev if prev and prev[a_marked] == attr then local id = prev.id - if (id == localpar_code) or (id == whatsit_code and prev.subtype == localpar_code) then + if id == localpar_code then break else first = prev diff --git a/tex/context/base/typo-cln.lua b/tex/context/base/typo-cln.lua index 7228e02c5..6a62bdf9e 100644 --- a/tex/context/base/typo-cln.lua +++ b/tex/context/base/typo-cln.lua @@ -31,11 +31,13 @@ local texsetattribute = tex.setattribute local nuts = nodes.nuts local tonut = nuts.tonut -local setfield = nuts.setfield local getchar = nuts.getchar local getattr = nuts.getattr local setattr = nuts.setattr +local setfield = nuts.setfield +local setchar = nuts.setchar + local traverse_id = nuts.traverse_id local unsetvalue = attributes.unsetvalue @@ -67,7 +69,7 @@ function cleaners.handler(head) if type(upper) == "table" then -- some day, not much change that \SS ends up here else - setfield(n,"char",upper) + setchar(n,upper) done = true if trace_autocase then report_autocase("") diff --git a/tex/context/base/typo-del.mkiv b/tex/context/base/typo-del.mkiv index 974bc402d..ebba94428 100644 --- a/tex/context/base/typo-del.mkiv +++ b/tex/context/base/typo-del.mkiv @@ -11,6 +11,8 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. +% todo: textstyle|color for inline \quotation etc + \writestatus{loading}{ConTeXt Typesetting Macros / Delimited Content} \unprotect diff --git a/tex/context/base/typo-dha.lua b/tex/context/base/typo-dha.lua index 84c0d7c3d..4be0d99ea 100644 --- a/tex/context/base/typo-dha.lua +++ b/tex/context/base/typo-dha.lua @@ -31,7 +31,6 @@ if not modules then modules = { } end modules ['typo-dha'] = { -- elseif d == "ws" then -- Whitespace -- elseif d == "on" then -- Other Neutrals --- beware: math adds whatsits afterwards so that will mess things up -- todo : use new dir functions -- todo : make faster -- todo : move dir info into nodes @@ -59,10 +58,12 @@ local getid = nuts.getid local getsubtype = nuts.getsubtype local getlist = nuts.getlist local getfield = nuts.getfield -local setfield = nuts.setfield local getattr = nuts.getattr local getprop = nuts.getprop + +local setfield = nuts.setfield local setprop = nuts.setprop +local setchar = nuts.setchar local insert_node_before = nuts.insert_before local insert_node_after = nuts.insert_after @@ -76,7 +77,6 @@ local whatcodes = nodes.whatcodes local mathcodes = nodes.mathcodes local glyph_code = nodecodes.glyph -local whatsit_code = nodecodes.whatsit local math_code = nodecodes.math local penalty_code = nodecodes.penalty local kern_code = nodecodes.kern @@ -207,10 +207,10 @@ local function process(start) local class = charclasses[character] if class == "open" then if nextisright(current) then - setfield(current,"char",mirror) + setchar(current,mirror) setprop(current,"direction","r") elseif autodir < 0 then - setfield(current,"char",mirror) + setchar(current,mirror) setprop(current,"direction","r") else mirror = false @@ -222,14 +222,14 @@ local function process(start) local fencedir = fences[#fences] fences[#fences] = nil if fencedir < 0 then - setfield(current,"char",mirror) + setchard(current,mirror) setprop(current,"direction","r") else setprop(current,"direction","l") mirror = false end elseif autodir < 0 then - setfield(current,"char",mirror) + setchar(current,mirror) setprop(current,"direction","r") else setprop(current,"direction","l") @@ -339,35 +339,6 @@ local function process(start) pardir = autodir textdir = pardir setprop(current,"direction",true) - elseif id == whatsit_code then - local subtype = getsubtype(current) - if subtype == localpar_code then - local dir = getfield(current,"dir") - if dir == 'TRT' then - autodir = -1 - elseif dir == 'TLT' then - autodir = 1 - end - pardir = autodir - textdir = pardir - elseif subtype == dir_code then - local dir = getfield(current,"dir") - if dir == "+TRT" then - autodir = -1 - elseif dir == "+TLT" then - autodir = 1 - elseif dir == "-TRT" or dir == "-TLT" then - if embedded and embedded~= 0 then - autodir = embedded - else - autodir = 0 - end - else - -- message - end - textdir = autodir - end - setprop(current,"direction",true) else setprop(current,"direction",true) end diff --git a/tex/context/base/typo-dig.lua b/tex/context/base/typo-dig.lua index c753a0352..09c2f64ee 100644 --- a/tex/context/base/typo-dig.lua +++ b/tex/context/base/typo-dig.lua @@ -29,8 +29,11 @@ local getfont = nuts.getfont local getchar = nuts.getchar local getid = nuts.getid local getfield = nuts.getfield -local setfield = nuts.setfield local getattr = nuts.getattr + +local setlink = nuts.setlink +local setnext = nuts.setnext +local setprev = nuts.setprev local setattr = nuts.setattr local hpack_node = nuts.hpack @@ -82,16 +85,14 @@ function nodes.aligned(head,start,stop,width,how) end local prv = getprev(start) local nxt = getnext(stop) - setfield(start,"prev",nil) - setfield(stop,"next",nil) + setprev(start) + setnext(stop) local packed = hpack_node(start,width,"exactly") -- no directional mess here, just lr if prv then - setfield(prv,"next",packed) - setfield(packed,"prev",prv) + setlink(prv,packed) end if nxt then - setfield(nxt,"prev",packed) - setfield(packed,"next",nxt) + setlink(packed,nxt) end if getprev(packed) then return head, packed diff --git a/tex/context/base/typo-drp.lua b/tex/context/base/typo-drp.lua index 36b873081..9d6d645d0 100644 --- a/tex/context/base/typo-drp.lua +++ b/tex/context/base/typo-drp.lua @@ -32,14 +32,18 @@ local getchar = nuts.getchar local getid = nuts.getid local getsubtype = nuts.getsubtype local getfield = nuts.getfield -local setfield = nuts.setfield local getattr = nuts.getattr + +local setfield = nuts.setfield local setattr = nuts.setattr +local setlink = nuts.setlink +local setprev = nuts.setprev +local setnext = nuts.setnext +local setchar = nuts.setchar local hpack_nodes = nuts.hpack local nodecodes = nodes.nodecodes -local whatsitcodes = nodes.whatsitcodes local nodepool = nuts.pool local new_kern = nodepool.kern @@ -66,8 +70,7 @@ local glyph_code = nodecodes.glyph local hlist_code = nodecodes.hlist local glue_code = nodecodes.glue local kern_code = nodecodes.kern -local whatsit_code = nodecodes.whatsit -local localpar_code = nodecodes.localpar or whatsitcodes.localpar +local localpar_code = nodecodes.localpar local actions = { } initials.actions = actions @@ -127,104 +130,10 @@ interfaces.implement { -- todo: prevent linebreak .. but normally a initial ends up at the top of -- a page so this has a low priority --- actions[v_default] = function(head,setting) --- local done = false --- local id = getid(head) --- if (id == localpar_code) or (id == whatsit_code and getsubtype(head) == localpar_code) then --- -- begin of par --- local first = getnext(head) --- -- parbox .. needs to be set at 0 --- if first and getid(first) == hlist_code then --- first = getnext(first) --- end --- -- we need to skip over kerns and glues (signals) --- while first and getid(first) ~= glyph_code do --- first = getnext(first) --- end --- if first and getid(first) == glyph_code then --- local char = getchar(first) --- local prev = getprev(first) --- local next = getnext(first) --- -- if getid(prev) == hlist_code then --- -- -- set the width to 0 --- -- end --- if next and getid(next) == kern_code then --- setfield(next,"kern",0) --- end --- if setting.font then --- setfield(first,"font",setting.font) --- end --- if setting.dynamic > 0 then --- setattr(first,0,setting.dynamic) --- end --- -- can be a helper --- local ma = setting.ma or 0 --- local ca = setting.ca --- local ta = setting.ta --- if ca and ca > 0 then --- setattr(first,a_colorspace,ma == 0 and 1 or ma) --- setattr(first,a_color,ca) --- end --- if ta and ta > 0 then --- setattr(first,a_transparency,ta) --- end --- -- --- local width = getfield(first,"width") --- local height = getfield(first,"height") --- local depth = getfield(first,"depth") --- local distance = setting.distance or 0 --- local voffset = setting.voffset or 0 --- local hoffset = setting.hoffset or 0 --- local parindent = tex.parindent --- local baseline = texget("baselineskip").width --- local lines = tonumber(setting.n) or 0 --- -- --- setfield(first,"xoffset",- width - hoffset - distance - parindent) --- setfield(first,"yoffset",- voffset) -- no longer - height here --- -- We pack so that successive handling cannot touch the dropped cap. Packaging --- -- in a hlist is also needed because we cannot locally adapt e.g. parindent (not --- -- yet stored in with localpar). --- setfield(first,"prev",nil) --- setfield(first,"next",nil) --- local h = hpack_nodes(first) --- setfield(h,"width",0) --- setfield(h,"height",0) --- setfield(h,"depth",0) --- setfield(prev,"next",h) --- setfield(next,"prev",h) --- setfield(h,"next",next) --- setfield(h,"prev",prev) --- first = h --- -- end of packaging --- if setting.location == v_margin then --- -- okay --- else --- if lines == 0 then -- safeguard, not too precise --- lines = ceil((height+voffset) / baseline) --- end --- -- We cannot set parshape yet ... when we can I'll add a slope --- -- option (positive and negative, in emwidth). --- local hangafter = - lines --- local hangindent = width + distance + parindent --- if trace_initials then --- report_initials("setting hangafter to %i and hangindent to %p",hangafter,hangindent) --- end --- tex.hangafter = hangafter --- tex.hangindent = hangindent --- if parindent ~= 0 then --- insert_after(first,first,new_kern(-parindent)) --- end --- end --- done = true --- end --- end --- return head, done --- end - actions[v_default] = function(head,setting) local done = false local id = getid(head) - if (id == localpar_code) or (id == whatsit_code and getsubtype(head) == localpar_code) then + if id == localpar_code then -- begin of par local first = getnext(head) local indent = false @@ -352,7 +261,7 @@ actions[v_default] = function(head,setting) -- g.subtype = 0 -- nodes.handlers.characters(g) -- nodes.handlers.protectglyphs(g) --- setfield(current,"char",g.char) +-- setchar(current,g.char) -- nodes.free(g) -- can be a helper @@ -377,8 +286,8 @@ actions[v_default] = function(head,setting) local prev = getprev(first) local next = getnext(last) -- - setfield(first,"prev",nil) - setfield(last,"next",nil) + setprev(first) + setnext(last) local dropper = hpack_nodes(first) local width = getfield(dropper,"width") local height = getfield(dropper,"height") @@ -387,12 +296,8 @@ actions[v_default] = function(head,setting) setfield(dropper,"height",0) setfield(dropper,"depth",0) -- - setfield(prev,"next",dropper) - if next then - setfield(next,"prev",dropper) - end - setfield(dropper,"next",next) - setfield(dropper,"prev",prev) + setlink(prev,dropper) + setlink(dropper,next) -- if next then local current = next diff --git a/tex/context/base/typo-dua.lua b/tex/context/base/typo-dua.lua index 0cf84847d..bbb071f55 100644 --- a/tex/context/base/typo-dua.lua +++ b/tex/context/base/typo-dua.lua @@ -77,9 +77,11 @@ local getid = nuts.getid local getsubtype = nuts.getsubtype local getlist = nuts.getlist local getfield = nuts.getfield -local setfield = nuts.setfield local getprop = nuts.getprop + +local setfield = nuts.setfield local setprop = nuts.setprop +local setchar = nuts.setchar local remove_node = nuts.remove local copy_node = nuts.copy @@ -90,7 +92,6 @@ local nodepool = nuts.pool local new_textdir = nodepool.textdir local nodecodes = nodes.nodecodes -local whatsitcodes = nodes.whatsitcodes local skipcodes = nodes.skipcodes local glyph_code = nodecodes.glyph @@ -98,9 +99,8 @@ local glue_code = nodecodes.glue local hlist_code = nodecodes.hlist local vlist_code = nodecodes.vlist local math_code = nodecodes.math -local dir_code = nodecodes.dir or whatsitcodes.dir -local localpar_code = nodecodes.localpar or whatcodes.localpar -local whatsit_code = nodecodes.whatsit +local dir_code = nodecodes.dir +local localpar_code = nodecodes.localpar local parfillskip_code = skipcodes.skipcodes ----- object_replacement = 0xFFFC -- object replacement character @@ -233,7 +233,7 @@ local function build_list(head) -- todo: store node pointer ... saves loop elseif id == glue_code then -- and how about kern list[size] = { char = 0x0020, direction = "ws", original = "ws", level = 0 } current = getnext(current) - elseif id == dir_code or (id == whatsit_code and getsubtype(current) == dir_code) then + elseif id == dir_code then local dir = getfield(current,"dir") if dir == "+TLT" then list[size] = { char = 0x202A, direction = "lre", original = "lre", level = 0 } @@ -261,7 +261,7 @@ local function build_list(head) -- todo: store node pointer ... saves loop current = getnext(current) while n do local id = getid(current) - if id ~= glyph_code and id ~= glue_code and id ~= dir_code and not (id == whatsit_code and getsubtype(current) == dir_code) then + if id ~= glyph_code and id ~= glue_code and id ~= dir_code then skip = skip + 1 last = id current = getnext(current) @@ -325,7 +325,7 @@ end local function get_baselevel(head,list,size) -- todo: skip if first is object (or pass head and test for localpar) local id = getid(head) - if (id == localpar_code) or (id == whatsit_code and getsubtype(head) == localpar_code) then + if id == localpar_code then if getfield(head,"dir") == "TRT" then return 1, "TRT", true else @@ -742,7 +742,7 @@ local function apply_to_list(list,size,head,pardir) if id == glyph_code then local mirror = entry.mirror if mirror then - setfield(current,"char",mirror) + setchar(current,mirror) end if trace_directions then local direction = entry.direction @@ -761,7 +761,7 @@ local function apply_to_list(list,size,head,pardir) done = true end elseif begindir then - if (id == localpar_code) or (id == whatsit_code and getsubtype(current) == localpar_code) then + if id == localpar_code then -- localpar should always be the 1st node local d = new_textdir(begindir) setprop(d,"directions",true) diff --git a/tex/context/base/typo-dub.lua b/tex/context/base/typo-dub.lua index 789168a23..2ee85ad7d 100644 --- a/tex/context/base/typo-dub.lua +++ b/tex/context/base/typo-dub.lua @@ -66,9 +66,11 @@ local getsubtype = nuts.getsubtype local getlist = nuts.getlist local getattr = nuts.getattr local getfield = nuts.getfield -local setfield = nuts.setfield local getprop = nuts.getprop + +local setfield = nuts.setfield local setprop = nuts.setprop +local setchar = nuts.setchar local remove_node = nuts.remove local copy_node = nuts.copy @@ -79,7 +81,6 @@ local nodepool = nuts.pool local new_textdir = nodepool.textdir local nodecodes = nodes.nodecodes -local whatsitcodes = nodes.whatsitcodes local skipcodes = nodes.skipcodes local glyph_code = nodecodes.glyph @@ -87,9 +88,8 @@ local glue_code = nodecodes.glue local hlist_code = nodecodes.hlist local vlist_code = nodecodes.vlist local math_code = nodecodes.math -local dir_code = nodecodes.dir or whatsitcodes.dir -local localpar_code = nodecodes.localpar or whatcodes.localpar -local whatsit_code = nodecodes.whatsit +local dir_code = nodecodes.dir +local localpar_code = nodecodes.localpar local parfillskip_code = skipcodes.skipcodes local maximum_stack = 0xFF -- unicode: 60, will be jumped to 125, we don't care too much @@ -288,7 +288,7 @@ local function build_list(head) -- todo: store node pointer ... saves loop elseif id == glue_code then -- and how about kern list[size] = { char = 0x0020, direction = "ws", original = "ws", level = 0 } current = getnext(current) - elseif id == dir_code or (id == whatsit_code and getsubtype(current) == dir_code) then + elseif id == dir_code then local dir = getfield(current,"dir") if dir == "+TLT" then list[size] = { char = 0x202A, direction = "lre", original = "lre", level = 0 } @@ -316,7 +316,7 @@ local function build_list(head) -- todo: store node pointer ... saves loop current = getnext(current) while n do local id = getid(current) - if id ~= glyph_code and id ~= glue_code and id ~= dir_code and not (id == whatsit_code and getsubtype(current) == dir_code) then + if id ~= glyph_code and id ~= glue_code and id ~= dir_code then skip = skip + 1 last = id current = getnext(current) @@ -403,7 +403,7 @@ end local function get_baselevel(head,list,size) -- todo: skip if first is object (or pass head and test for localpar) local id = getid(head) - if (id == localpar_code) or (id == whatsit_code and getsubtype(head) == localpar_code) then + if id == localpar_code then if getfield(head,"dir") == "TRT" then return 1, "TRT", true else @@ -858,7 +858,7 @@ local function apply_to_list(list,size,head,pardir) if id == glyph_code then local mirror = entry.mirror if mirror then - setfield(current,"char",mirror) + setchar(current,mirror) end if trace_directions then local direction = entry.direction @@ -887,7 +887,7 @@ local function apply_to_list(list,size,head,pardir) done = true end elseif begindir then - if (id == localpar_code) or (id == whatsit_code and getsubtype(current) == localpar_code) then + if id == localpar_code then -- localpar should always be the 1st node local d = new_textdir(begindir) setprop(d,"directions",true) diff --git a/tex/context/base/typo-krn.lua b/tex/context/base/typo-krn.lua index 46a977cfd..45443a86d 100644 --- a/tex/context/base/typo-krn.lua +++ b/tex/context/base/typo-krn.lua @@ -30,15 +30,19 @@ local insert_node_after = nuts.insert_after local end_of_math = nuts.end_of_math local getfield = nuts.getfield -local setfield = nuts.setfield local getnext = nuts.getnext local getprev = nuts.getprev +local getboth = nuts.getboth local getid = nuts.getid -local getattr = nuts.getattr -local setattr = nuts.setattr local getfont = nuts.getfont local getsubtype = nuts.getsubtype local getchar = nuts.getchar +local getdisc = nuts.getdisc + +local setfield = nuts.setfield +local getattr = nuts.getattr +local setattr = nuts.setattr +local setlink = nuts.setlink local texsetattribute = tex.setattribute local unsetvalue = attributes.unsetvalue @@ -241,8 +245,7 @@ local function inject_begin(boundary,prev,keeptogether,krn,ok) -- prev is a glyp local chartwo = getchar(boundary) local kerns = chardata[font][charone].kerns local kern = new_kern((kerns and kerns[chartwo] or 0) + quaddata[font]*krn) - setfield(boundary,"prev",kern) - setfield(kern,"next",boundary) + setlink(kern,boundary) return kern, true end end @@ -401,17 +404,14 @@ function kerns.handler(head) while c do local s = start local t = find_node_tail(c) - local p = getprev(s) - local n = getnext(s) + local p, n = getboth(s) if p then - setfield(p,"next",c) - setfield(c,"prev",p) + setlink(p,c) else head = c end if n then - setfield(n,"prev",t) - setfield(t,"next",n) + setlink(t,n) end start = c setfield(s,"components",nil) @@ -477,9 +477,7 @@ function kerns.handler(head) pglyph = prev and getid(prev) == glyph_code languages.expand(start,pglyph and prev) end - local pre = getfield(start,"pre") - local post = getfield(start,"post") - local replace = getfield(start,"replace") + local pre, post, replace = getdisc(start) -- we really need to reasign the fields as luatex keeps track of -- the tail in a temp preceding head .. kind of messy so we might -- want to come up with a better solution some day like a real diff --git a/tex/context/base/typo-lin.lua b/tex/context/base/typo-lin.lua index 3bc18bd52..f9761fe64 100644 --- a/tex/context/base/typo-lin.lua +++ b/tex/context/base/typo-lin.lua @@ -60,18 +60,16 @@ local nuts = nodes.nuts local nodecodes = nodes.nodecodes local gluecodes = nodes.gluecodes local listcodes = nodes.listcodes -local whatcodes = nodes.whatsitcodes local hlist_code = nodecodes.hlist local glue_code = nodecodes.glue local kern_code = nodecodes.kern -local whatsit_code = nodecodes.whatsit local line_code = listcodes.line +local localpar_code = nodecodes.localpar local userskip_code = gluecodes.userskip local leftskip_code = gluecodes.leftskip local rightskip_code = gluecodes.rightskip local parfillskip_code = gluecodes.parfillskip -local localpar_code = nodecodes.localpar or whatcodes.localpar local tonut = nodes.tonut local tonode = nodes.tonode @@ -89,6 +87,7 @@ local getlist = nuts.getlist local getid = nuts.getid local getnext = nuts.getnext local getprev = nuts.getprev +local getboth = nuts.getboth local getfield = nuts.getfield local setfield = nuts.setfield @@ -188,9 +187,10 @@ local function normalize(line,islocal) -- assumes prestine lines, nothing pre/ap current = getnext(head) id = getid(current) end - if (id == localpar_code) or (id == whatsit_code and getsubtype(head) == localpar_code) then - head = remove_node(head,head,true) - end +-- no: +-- if id == localpar_code then +-- head = remove_node(head,head,true) +-- end local tail = find_tail(head) local current = tail local id = getid(current) @@ -357,8 +357,7 @@ function paragraphs.moveinline(n,blob,dx,dy) local line = type(n) ~= "table" and getprop(n,"line") or n if line then if dx ~= 0 then - local prev = getprev(blob) - local next = getnext(blob) + local prev, next = getboth(blob) if prev and getid(prev) == kern_code then setfield(prev,"kern",getfield(prev,"kern") + dx) end diff --git a/tex/context/base/typo-mar.lua b/tex/context/base/typo-mar.lua index 605ddfc41..7ed4cbe66 100644 --- a/tex/context/base/typo-mar.lua +++ b/tex/context/base/typo-mar.lua @@ -422,7 +422,7 @@ local function realign(current,candidate) local rightdistance = distance -- if not anchor or anchor == "" then - anchor = v_text + anchor = v_text -- this has to become more clever: region:0|column:n|column end if margin == v_normal then -- diff --git a/tex/context/base/typo-mar.mkiv b/tex/context/base/typo-mar.mkiv index 4afa11b71..90ccd46e2 100644 --- a/tex/context/base/typo-mar.mkiv +++ b/tex/context/base/typo-mar.mkiv @@ -266,6 +266,7 @@ \dostoptagged \fi \ifdone + \edef\p_anchor{\margindataparameter\c!anchor}% \anch_positions_initialize % we use positions at the lua end \clf_savemargindata location {\margindataparameter\c!location}% @@ -288,7 +289,7 @@ \ifhmode inline true % \fi - anchor {\margindataparameter\c!anchor}% + anchor {\p_anchor\ifx\p_anchor\v!region:0\fi}% kind of a hack to force column anchoring (for now) % % we're not in forgetall % diff --git a/tex/context/base/typo-tal.lua b/tex/context/base/typo-tal.lua index 5663c3bd9..ad2ad7bd1 100644 --- a/tex/context/base/typo-tal.lua +++ b/tex/context/base/typo-tal.lua @@ -42,10 +42,11 @@ local getid = nuts.getid local getfont = nuts.getfont local getchar = nuts.getchar local getfield = nuts.getfield -local setfield = nuts.setfield - local getattr = nuts.getattr + +local setfield = nuts.setfield local setattr = nuts.setattr +local setchar = nuts.setchar local insert_node_before = nuts.insert_before local insert_node_after = nuts.insert_after @@ -228,7 +229,7 @@ function characteralign.handler(originalhead,where) setcolor(sign,"darkyellow") end else - setfield(sign,"char",new) + setchar(sign,new) if trace_split then setcolor(sign,"darkmagenta") end diff --git a/tex/context/interface/cont-cs.xml b/tex/context/interface/cont-cs.xml index c798ea4a9..7eb672874 100644 --- a/tex/context/interface/cont-cs.xml +++ b/tex/context/interface/cont-cs.xml @@ -3152,8 +3152,8 @@ - - + + @@ -4186,8 +4186,8 @@ - - + + @@ -5489,9 +5489,9 @@ - - + + @@ -6708,8 +6708,8 @@ - - + + @@ -7629,8 +7629,8 @@ - - + + diff --git a/tex/context/interface/keys-cs.xml b/tex/context/interface/keys-cs.xml index 41cd41494..ecf4ce1b0 100644 --- a/tex/context/interface/keys-cs.xml +++ b/tex/context/interface/keys-cs.xml @@ -200,6 +200,7 @@ + @@ -231,7 +232,7 @@ - + @@ -242,7 +243,7 @@ - + diff --git a/tex/context/interface/keys-de.xml b/tex/context/interface/keys-de.xml index 2b37b979d..287b3b070 100644 --- a/tex/context/interface/keys-de.xml +++ b/tex/context/interface/keys-de.xml @@ -200,6 +200,7 @@ + diff --git a/tex/context/interface/keys-en.xml b/tex/context/interface/keys-en.xml index 2432f7f7e..cbd6efe37 100644 --- a/tex/context/interface/keys-en.xml +++ b/tex/context/interface/keys-en.xml @@ -200,6 +200,7 @@ + diff --git a/tex/context/interface/keys-fr.xml b/tex/context/interface/keys-fr.xml index ab7f6dec9..6b6637f20 100644 --- a/tex/context/interface/keys-fr.xml +++ b/tex/context/interface/keys-fr.xml @@ -200,6 +200,7 @@ + diff --git a/tex/context/interface/keys-it.xml b/tex/context/interface/keys-it.xml index ce4430852..1de504ba9 100644 --- a/tex/context/interface/keys-it.xml +++ b/tex/context/interface/keys-it.xml @@ -200,6 +200,7 @@ + diff --git a/tex/context/interface/keys-nl.xml b/tex/context/interface/keys-nl.xml index 86781b59e..2cd4f3750 100644 --- a/tex/context/interface/keys-nl.xml +++ b/tex/context/interface/keys-nl.xml @@ -200,6 +200,7 @@ + diff --git a/tex/context/interface/keys-pe.xml b/tex/context/interface/keys-pe.xml index f7ec4de40..4e3622d50 100644 --- a/tex/context/interface/keys-pe.xml +++ b/tex/context/interface/keys-pe.xml @@ -200,6 +200,7 @@ + diff --git a/tex/context/interface/keys-ro.xml b/tex/context/interface/keys-ro.xml index 0441dd9af..c27bc3d51 100644 --- a/tex/context/interface/keys-ro.xml +++ b/tex/context/interface/keys-ro.xml @@ -200,6 +200,7 @@ + diff --git a/tex/context/test/pdf-ua.mkiv b/tex/context/test/pdf-ua.mkiv new file mode 100644 index 000000000..e048b9717 --- /dev/null +++ b/tex/context/test/pdf-ua.mkiv @@ -0,0 +1,44 @@ +\setupinteraction + [title=TITLE, + subtitle=SUBTITLE, + author=AUTHOR, + keyword={{KEYWORD1, KEYWORD2}, KEYWORD3}] + +\setupbackend + [format={pdf/ua-1}, +% profile=srgb.icc, % can't validate PDF/A-3, so this only blows up the PDF +% intent={ISO Coated v2 300\letterpercent\space (ECI)}, + level=0] + +\setuptagging[state=start] % should be set automatically, if 'tagging = true' + +\setuplanguage[en] + +% DisplayDocTitle key is not set to true +% +% [from PDFUA-Reference-09_(English-invoice).pdf] +% 129 0 obj +% <>/PageMode/UseOutlines/Outlines 43 0 R/Lang(en)/StructTreeRoot 2 0 R/MarkInfo<>/OutputIntents[ 128 0 R]/Metadata 127 0 R>> +% endobj +% this may interfer with other ViewerPreferences settings? +\startluacode + lpdf.addtocatalog("ViewerPreferences",lpdf.dictionary{DisplayDocTitle = true}) +\stopluacode + +\def\tag#1{\quote{\tt#1}} + +\starttext + Warning: This document may contain errors and traces of hazelnuts. + + \blank[big] + + \startMPcode + fill fullcircle scaled 3cm withcolor red; + \stopMPcode + + \blank[big] + + The \quote{Matterhorn Protocol} gives a condensed overview of the possible failure conditions + and the used structure types (p.4).\par + +\stoptext diff --git a/tex/generic/context/luatex/luatex-fonts-demo-vf-1.lua b/tex/generic/context/luatex/luatex-fonts-demo-vf-1.lua index 3878ae648..13acd16ca 100644 --- a/tex/generic/context/luatex/luatex-fonts-demo-vf-1.lua +++ b/tex/generic/context/luatex/luatex-fonts-demo-vf-1.lua @@ -17,6 +17,7 @@ return function(specification) { "special", "pdf:1 0 0 rg" }, { "special", "pdf:0 1 0 rg" }, { "special", "pdf:0 0 1 rg" }, + { "special", "pdf:0 0 1 rg" }, } local chars = { identifiers[id1].characters, @@ -26,7 +27,12 @@ return function(specification) for u, v in next, f1.characters do local n = math.floor(math.random(1,3)+0.5) local c = chars[n][u] or v - v.commands = { color[n], { 'slot', n, u }, color[0] } + v.commands = { + color[n], + { 'slot', n, u }, + color[0], + { 'nop' } + } v.kerns = nil v.width = c.width v.height = c.height diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index a2a598b2d..ae366179c 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 : luatex-fonts-merged.lua -- parent file : luatex-fonts.lua --- merge date : 10/09/15 21:28:28 +-- merge date : 11/19/15 19:13:15 do -- begin closure to overcome local limits and interference @@ -4211,8 +4211,8 @@ end constructors.setfactor() function constructors.scaled(scaledpoints,designsize) if scaledpoints<0 then + local factor=constructors.factor if designsize then - local factor=constructors.factor if designsize>factor then return (- scaledpoints/1000)*designsize else @@ -4650,6 +4650,10 @@ function constructors.scale(tfmdata,specification) end end end + local vi=character.vert_italic + if vi and vi~=0 then + chr.vert_italic=vi*hdelta + end local va=character.accent if va then chr.top_accent=vdelta*va @@ -5833,6 +5837,8 @@ local constructors=fonts.constructors local encodings=fonts.encodings local tfm=constructors.newhandler("tfm") tfm.version=1.000 +tfm.maxnestingdepth=5 +tfm.maxnestingsize=65536*1024 local tfmfeatures=constructors.newfeatures("tfm") local registertfmfeature=tfmfeatures.register constructors.resolvevirtualtoo=false @@ -5845,9 +5851,11 @@ function tfm.setfeatures(tfmdata,features) return {} end end +local depth={} local function read_from_tfm(specification) local filename=specification.filename local size=specification.size + depth[filename]=(depth[filename] or 0)+1 if trace_defining then report_defining("loading tfm file %a at size %s",filename,size) end @@ -5891,6 +5899,25 @@ local function read_from_tfm(specification) end properties.virtualized=true tfmdata.fonts=vfdata.fonts + tfmdata.type="virtual" + local fontlist=vfdata.fonts + local name=file.nameonly(filename) + for i=1,#fontlist do + local n=fontlist[i].name + local s=fontlist[i].size + local d=depth[filename] + s=constructors.scaled(s,vfdata.designsize) + if d>tfm.maxnestingdepth then + report_defining("too deeply nested virtual font %a with size %a, max nesting depth %s",n,s,tfm.maxnestingdepth) + fontlist[i]={ id=0 } + elseif (d>1) and (s>tfm.maxnestingsize) then + report_defining("virtual font %a exceeds size %s",n,s) + fontlist[i]={ id=0 } + else + local t,id=fonts.constructors.readanddefine(n,s) + fontlist[i]={ id=id } + end + end end end end @@ -5906,7 +5933,10 @@ local function read_from_tfm(specification) properties.haslogatures=true resources.unicodes={} resources.lookuptags={} + depth[filename]=depth[filename]-1 return tfmdata + else + depth[filename]=depth[filename]-1 end end local function check_tfm(specification,fullname) @@ -8652,7 +8682,7 @@ actions["merge kern classes"]=function(data,filename,raw) local subtable=subtables[s] local kernclass=subtable.kernclass local lookup=subtable.lookup or subtable.name - if kernclass then + if kernclass then if #kernclass>0 then kernclass=kernclass[1] lookup=type(kernclass.lookup)=="string" and kernclass.lookup or lookup @@ -8677,14 +8707,16 @@ actions["merge kern classes"]=function(data,filename,raw) if splt then local extrakerns={} local baseoffset=(fk-1)*maxseconds - for sk=2,maxseconds do + for sk=2,maxseconds do local sv=seconds[sk] - local splt=split[sv] - if splt then - local offset=offsets[baseoffset+sk] - if offset then - for i=1,#splt do - extrakerns[splt[i]]=offset + if sv then + local splt=split[sv] + if splt then + local offset=offsets[baseoffset+sk] + if offset then + for i=1,#splt do + extrakerns[splt[i]]=offset + end end end end @@ -9145,6 +9177,7 @@ local function copytotfm(data,cache_id) local m=d.math if m then local italic=m.italic + local vitalic=m.vitalic local variants=m.hvariants local parts=m.hparts if variants then @@ -9171,11 +9204,13 @@ local function copytotfm(data,cache_id) c.vert_variants=parts elseif parts then character.vert_variants=parts - italic=m.vitalic end if italic and italic~=0 then character.italic=italic end + if vitalic and vitalic~=0 then + character.vert_italic=vitalic + end local accent=m.accent if accent then character.accent=accent @@ -11610,7 +11645,6 @@ local disccodes=nodes.disccodes local glyph_code=nodecodes.glyph local glue_code=nodecodes.glue local disc_code=nodecodes.disc -local whatsit_code=nodecodes.whatsit local math_code=nodecodes.math local dir_code=whatcodes.dir local localpar_code=whatcodes.localpar @@ -14245,42 +14279,6 @@ local function featuresprocessor(head,font,attr) comprun(start,c_run) start=getnext(start) end - elseif id==whatsit_code then - local subtype=getsubtype(start) - if subtype==dir_code then - local dir=getfield(start,"dir") - if dir=="+TLT" then - topstack=topstack+1 - dirstack[topstack]=dir - rlmode=1 - elseif dir=="+TRT" then - topstack=topstack+1 - dirstack[topstack]=dir - rlmode=-1 - elseif dir=="-TLT" or dir=="-TRT" then - topstack=topstack-1 - rlmode=dirstack[topstack]=="+TRT" and -1 or 1 - else - rlmode=rlparmode - end - if trace_directions then - report_process("directions after txtdir %a: parmode %a, txtmode %a, # stack %a, new dir %a",dir,rlparmode,rlmode,topstack,newdir) - end - elseif subtype==localpar_code then - local dir=getfield(start,"dir") - if dir=="TRT" then - rlparmode=-1 - elseif dir=="TLT" then - rlparmode=1 - else - rlparmode=0 - end - rlmode=rlparmode - if trace_directions then - report_process("directions after pardir %a: parmode %a, txtmode %a",dir,rlparmode,rlmode) - end - end - start=getnext(start) elseif id==math_code then start=getnext(end_of_math(start)) else @@ -14501,42 +14499,6 @@ local function featuresprocessor(head,font,attr) comprun(start,c_run) start=getnext(start) end - elseif id==whatsit_code then - local subtype=getsubtype(start) - if subtype==dir_code then - local dir=getfield(start,"dir") - if dir=="+TLT" then - topstack=topstack+1 - dirstack[topstack]=dir - rlmode=1 - elseif dir=="+TRT" then - topstack=topstack+1 - dirstack[topstack]=dir - rlmode=-1 - elseif dir=="-TLT" or dir=="-TRT" then - topstack=topstack-1 - rlmode=dirstack[topstack]=="+TRT" and -1 or 1 - else - rlmode=rlparmode - end - if trace_directions then - report_process("directions after txtdir %a: parmode %a, txtmode %a, # stack %a, new dir %a",dir,rlparmode,rlmode,topstack,newdir) - end - elseif subtype==localpar_code then - local dir=getfield(start,"dir") - if dir=="TRT" then - rlparmode=-1 - elseif dir=="TLT" then - rlparmode=1 - else - rlparmode=0 - end - rlmode=rlparmode - if trace_directions then - report_process("directions after pardir %a: parmode %a, txtmode %a",dir,rlparmode,rlmode) - end - end - start=getnext(start) elseif id==math_code then start=getnext(end_of_math(start)) else diff --git a/tex/generic/context/luatex/luatex-fonts-otn.lua b/tex/generic/context/luatex/luatex-fonts-otn.lua index 1b99c56de..7fafadbc4 100644 --- a/tex/generic/context/luatex/luatex-fonts-otn.lua +++ b/tex/generic/context/luatex/luatex-fonts-otn.lua @@ -250,7 +250,6 @@ local disccodes = nodes.disccodes local glyph_code = nodecodes.glyph local glue_code = nodecodes.glue local disc_code = nodecodes.disc -local whatsit_code = nodecodes.whatsit local math_code = nodecodes.math local dir_code = whatcodes.dir @@ -316,8 +315,6 @@ local notmatchpre = { } local notmatchpost = { } local notmatchreplace = { } --- head is always a whatsit so we can safely assume that head is not changed - -- we use this for special testing and documentation local checkstep = (nodes and nodes.tracers and nodes.tracers.steppers.check) or function() end @@ -3320,43 +3317,6 @@ local function featuresprocessor(head,font,attr) comprun(start,c_run) start = getnext(start) end - elseif id == whatsit_code then -- will be function - local subtype = getsubtype(start) - if subtype == dir_code then - local dir = getfield(start,"dir") - if dir == "+TLT" then - topstack = topstack + 1 - dirstack[topstack] = dir - rlmode = 1 - elseif dir == "+TRT" then - topstack = topstack + 1 - dirstack[topstack] = dir - rlmode = -1 - elseif dir == "-TLT" or dir == "-TRT" then - topstack = topstack - 1 - rlmode = dirstack[topstack] == "+TRT" and -1 or 1 - else - rlmode = rlparmode - end - if trace_directions then - report_process("directions after txtdir %a: parmode %a, txtmode %a, # stack %a, new dir %a",dir,rlparmode,rlmode,topstack,newdir) - end - elseif subtype == localpar_code then - local dir = getfield(start,"dir") - if dir == "TRT" then - rlparmode = -1 - elseif dir == "TLT" then - rlparmode = 1 - else - rlparmode = 0 - end - -- one might wonder if the par dir should be looked at, so we might as well drop the next line - rlmode = rlparmode - if trace_directions then - report_process("directions after pardir %a: parmode %a, txtmode %a",dir,rlparmode,rlmode) - end - end - start = getnext(start) elseif id == math_code then start = getnext(end_of_math(start)) else @@ -3592,42 +3552,6 @@ local function featuresprocessor(head,font,attr) comprun(start,c_run) start = getnext(start) end - elseif id == whatsit_code then - local subtype = getsubtype(start) - if subtype == dir_code then - local dir = getfield(start,"dir") - if dir == "+TLT" then - topstack = topstack + 1 - dirstack[topstack] = dir - rlmode = 1 - elseif dir == "+TRT" then - topstack = topstack + 1 - dirstack[topstack] = dir - rlmode = -1 - elseif dir == "-TLT" or dir == "-TRT" then - topstack = topstack - 1 - rlmode = dirstack[topstack] == "+TRT" and -1 or 1 - else - rlmode = rlparmode - end - if trace_directions then - report_process("directions after txtdir %a: parmode %a, txtmode %a, # stack %a, new dir %a",dir,rlparmode,rlmode,topstack,newdir) - end - elseif subtype == localpar_code then - local dir = getfield(start,"dir") - if dir == "TRT" then - rlparmode = -1 - elseif dir == "TLT" then - rlparmode = 1 - else - rlparmode = 0 - end - rlmode = rlparmode - if trace_directions then - report_process("directions after pardir %a: parmode %a, txtmode %a",dir,rlparmode,rlmode) - end - end - start = getnext(start) elseif id == math_code then start = getnext(end_of_math(start)) else diff --git a/tex/generic/context/luatex/luatex-pdf.tex b/tex/generic/context/luatex/luatex-pdf.tex new file mode 100644 index 000000000..49ca9c2d6 --- /dev/null +++ b/tex/generic/context/luatex/luatex-pdf.tex @@ -0,0 +1,179 @@ +% This is a pdftex compatibility file. We could use \ifprimitive instead. + +\begingroup + +\catcode`\{ = 1 % left brace is begin-group character +\catcode`\} = 2 % right brace is end-group character + +\ifdefined\pdfextension + + % promoted + + \global\let\pdfpagewidth \pagewidth + \global\let\pdfpageheight \pageheight + + \global\let\pdfadjustspacing \adjustspacing + \global\let\pdfprotrudechars \protrudechars + \global\let\pdfnoligatures \ignoreligaturesinfont + \global\let\pdffontexpand \expandglyphsinfont + \global\let\pdfcopyfont \copyfont + + \global\let\pdfxform \saveboxresource + \global\let\pdflastxform \lastsavedboxresourceindex + \global\let\pdfrefxform \useboxresource + + \global\let\pdfximage \saveimageresource + \global\let\pdflastximage \lastsavedimageresourceindex + \global\let\pdflastximagepages\lastsavedimageresourcepages + \global\let\pdfrefximage \useimageresource + + \global\let\pdfsavepos \savepos + \global\let\pdflastxpos \lastxpos + \global\let\pdflastypos \lastypos + + \global\let\pdftexversion \luatexversion + \global\let\pdftexrevision \luatexrevision + \global\let\pdftexbanner \luatexbanner + + \global\let\pdfoutput \outputmode + \global\let\pdfdraftmode \draftmode + + \global\let\pdfpxdimen \pxdimen + + \global\let\pdfinsertht \insertht + + % also promoted + + % \global\let\pdfnormaldeviate \normaldeviate + % \global\let\pdfuniformdeviate \uniformdeviate + % \global\let\pdfsetrandomseed \setrandomseed + % \global\let\pdfrandomseed \randomseed + % + % \let\pdfprimitive \primitive + % + % \global\let\expandafter\csname ifpdfabsnum\expandafter\endcsname\csname ifabsnum\endcsname + % \global\let\expandafter\csname ifpdfabsdim\expandafter\endcsname\csname ifabsdim\endcsname + % \global\let\expandafter\csname ifpdfprimitive\expandafter\endcsname\csname ifprimitive\endcsname + + % removed (also some others but already long ago) + + \ifdefined\newdimen + \newdimen\pdfeachlineheight + \newdimen\pdfeachlinedepth + \newdimen\pdflastlinedepth + \newdimen\pdffirstlineheight + \newdimen\pdfignoreddimen + \fi + + % commands + + \protected\gdef\pdfliteral {\pdfextension literal} + \protected\gdef\pdfcolorstack {\pdfextension colorstack} + \protected\gdef\pdfsetmatrix {\pdfextension setmatrix} + \protected\gdef\pdfsave {\pdfextension save\relax} + \protected\gdef\pdfrestore {\pdfextension restore\relax} + \protected\gdef\pdfobj {\pdfextension obj } + \protected\gdef\pdfrefobj {\pdfextension refobj } + \protected\gdef\pdfannot {\pdfextension annot } + \protected\gdef\pdfstartlink {\pdfextension startlink } + \protected\gdef\pdfendlink {\pdfextension endlink\relax} + \protected\gdef\pdfoutline {\pdfextension outline } + \protected\gdef\pdfdest {\pdfextension dest } + \protected\gdef\pdfthread {\pdfextension thread } + \protected\gdef\pdfstartthread {\pdfextension startthread } + \protected\gdef\pdfendthread {\pdfextension endthread\relax} + \protected\gdef\pdfinfo {\pdfextension info } + \protected\gdef\pdfcatalog {\pdfextension catalog } + \protected\gdef\pdfnames {\pdfextension names } + \protected\gdef\pdfincludechars {\pdfextension includechars } + \protected\gdef\pdffontattr {\pdfextension fontattr } + \protected\gdef\pdfmapfile {\pdfextension mapfile } + \protected\gdef\pdfmapline {\pdfextension mapline } + \protected\gdef\pdftrailer {\pdfextension trailer } + \protected\gdef\pdfglyphtounicode {\pdfextension glyphtounicode } + + % converted + + \gdef\pdftexversion {\numexpr\pdffeedback version} + \gdef\pdftexrevision {\pdffeedback revision} + \gdef\pdflastlink {\numexpr\pdffeedback lastlink} + \gdef\pdfretval {\numexpr\pdffeedback retval} + \gdef\pdflastobj {\numexpr\pdffeedback lastobj} + \gdef\pdflastannot {\numexpr\pdffeedback lastannot} + \gdef\pdfxformname {\numexpr\pdffeedback xformname} + \gdef\pdfcreationdate {\pdffeedback creationdate} + \gdef\pdffontname {\numexpr\pdffeedback fontname} + \gdef\pdffontobjnum {\numexpr\pdffeedback fontobjnum} + \gdef\pdffontsize {\dimexpr\pdffeedback fontsize} + \gdef\pdfpageref {\numexpr\pdffeedback pageref} + \gdef\pdfcolorstackinit {\pdffeedback colorstackinit} + + % registers + + \xdef\pdfcompresslevel {\pdfvariable compresslevel} + \xdef\pdfobjcompresslevel {\pdfvariable objcompresslevel} + \xdef\pdfdecimaldigits {\pdfvariable decimaldigits} + \xdef\pdfgamma {\pdfvariable gamma} + \xdef\pdfimageresolution {\pdfvariable imageresolution} + \xdef\pdfimageapplygamma {\pdfvariable imageapplygamma} + \xdef\pdfimagegamma {\pdfvariable imagegamma} + \xdef\pdfimagehicolor {\pdfvariable imagehicolor} + \xdef\pdfimageaddfilename {\pdfvariable imageaddfilename} + \xdef\pdfpkresolution {\pdfvariable pkresolution} + \xdef\pdfinclusioncopyfonts {\pdfvariable inclusioncopyfonts} + \xdef\pdfinclusionerrorlevel {\pdfvariable inclusionerrorlevel} + \xdef\pdfreplacefont {\pdfvariable replacefont} + \xdef\pdfgentounicode {\pdfvariable gentounicode} + \xdef\pdfpagebox {\pdfvariable pagebox} + \xdef\pdfminorversion {\pdfvariable minorversion} + \xdef\pdfuniqueresname {\pdfvariable uniqueresname} + + \xdef\pdfhorigin {\pdfvariable horigin} + \xdef\pdfvorigin {\pdfvariable vorigin} + \xdef\pdflinkmargin {\pdfvariable linkmargin} + \xdef\pdfdestmargin {\pdfvariable destmargin} + \xdef\pdfthreadmargin {\pdfvariable threadmargin} + + \xdef\pdfpagesattr {\pdfvariable pagesattr} + \xdef\pdfpageattr {\pdfvariable pageattr} + \xdef\pdfpageresources {\pdfvariable pageresources} + \xdef\pdfxformattr {\pdfvariable xformattr} + \xdef\pdfxformresources {\pdfvariable xformresources} + \xdef\pdfpkmode {\pdfvariable pkmode} + + % initializations + + \global\pdfcompresslevel 9 + \global\pdfobjcompresslevel 1 + \global\pdfdecimaldigits 3 + \global\pdfgamma 1000 + \global\pdfimageresolution 71 + \global\pdfimageapplygamma 0 + \global\pdfimagegamma 2200 + \global\pdfimagehicolor 1 + \global\pdfimageaddfilename 1 + \global\pdfpkresolution 72 + \global\pdfinclusioncopyfonts 0 + \global\pdfinclusionerrorlevel 0 + \global\pdfreplacefont 0 + \global\pdfgentounicode 0 + \global\pdfpagebox 0 + \global\pdfminorversion 4 + \global\pdfuniqueresname 0 + + \global\pdfhorigin 1in + \global\pdfvorigin 1in + \global\pdflinkmargin 0pt + \global\pdfdestmargin 0pt + \global\pdfthreadmargin 0pt + + % maybe + + % \global\chardef\pdftexversion 140 + % \global\def \pdftexrevision {16} + +\fi + +\endgroup + +\endinput diff --git a/tex/generic/context/luatex/luatex-plain.tex b/tex/generic/context/luatex/luatex-plain.tex index 9902c49f3..99347ed2c 100644 --- a/tex/generic/context/luatex/luatex-plain.tex +++ b/tex/generic/context/luatex/luatex-plain.tex @@ -13,6 +13,10 @@ % We assume that pdf is used. +\ifdefined\pdfextension + \input luatex-pdf \relax +\fi + \pdfoutput 1 % We set the page dimensions because otherwise the backend does weird things -- cgit v1.2.3