diff options
author | Hans Hagen <pragma@wxs.nl> | 2018-04-03 22:35:21 +0200 |
---|---|---|
committer | Context Git Mirror Bot <phg42.2a@gmail.com> | 2018-04-03 22:35:21 +0200 |
commit | 1e5d7f41ddede5e6400a2a7762032823d3545df4 (patch) | |
tree | bf53397fbdd2b85c94db72321e7d0e466d02acd5 /tex | |
parent | 0175a693fcb853ecce7d49f6564895c2dbfd11f1 (diff) | |
download | context-1e5d7f41ddede5e6400a2a7762032823d3545df4.tar.gz |
2018-04-03 22:30:00
Diffstat (limited to 'tex')
115 files changed, 1956 insertions, 674 deletions
diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii index a237e05cc..d8599af1a 100644 --- a/tex/context/base/mkii/cont-new.mkii +++ b/tex/context/base/mkii/cont-new.mkii @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2018.03.25 17:32} +\newcontextversion{2018.04.03 22:22} %D This file is loaded at runtime, thereby providing an %D excellent place for hacks, patches, extensions and new diff --git a/tex/context/base/mkii/context.mkii b/tex/context/base/mkii/context.mkii index f5b545b69..31663439f 100644 --- a/tex/context/base/mkii/context.mkii +++ b/tex/context/base/mkii/context.mkii @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2018.03.25 17:32} +\edef\contextversion{2018.04.03 22:22} %D For those who want to use this: diff --git a/tex/context/base/mkiv/anch-pgr.lua b/tex/context/base/mkiv/anch-pgr.lua index 18a915692..ca5a5a8af 100644 --- a/tex/context/base/mkiv/anch-pgr.lua +++ b/tex/context/base/mkiv/anch-pgr.lua @@ -222,7 +222,7 @@ end interfaces.implement { name = "registerbackground", actions = registerbackground, - arguments = { "string" } + arguments = "string", } -- optimized already but we can assume a cycle i.e. prune the last point and then diff --git a/tex/context/base/mkiv/attr-ini.lua b/tex/context/base/mkiv/attr-ini.lua index 2a11558a5..67faa9fc0 100644 --- a/tex/context/base/mkiv/attr-ini.lua +++ b/tex/context/base/mkiv/attr-ini.lua @@ -170,7 +170,7 @@ end implement { name = "defineattribute", - arguments = { "string", "string" }, + arguments = "2 strings", actions = { attributes.define, context } } diff --git a/tex/context/base/mkiv/back-exp.lua b/tex/context/base/mkiv/back-exp.lua index 2d51d933d..b18679fa2 100644 --- a/tex/context/base/mkiv/back-exp.lua +++ b/tex/context/base/mkiv/back-exp.lua @@ -3876,7 +3876,7 @@ implement { implement { name = "settagfloat", actions = structurestags.setfloat, - arguments = { "string", "string" } + arguments = "2 strings", } implement { diff --git a/tex/context/base/mkiv/buff-ini.lua b/tex/context/base/mkiv/buff-ini.lua index 2bbec2e4a..1c7912773 100644 --- a/tex/context/base/mkiv/buff-ini.lua +++ b/tex/context/base/mkiv/buff-ini.lua @@ -492,7 +492,7 @@ end implement { name = "savebuffer", actions = savebuffer, - arguments = { "string", "string", "string" } + arguments = "3 strings", } -- we can consider adding a size to avoid unlikely clashes diff --git a/tex/context/base/mkiv/buff-par.lua b/tex/context/base/mkiv/buff-par.lua index 33ed4baf0..a2b300a2b 100644 --- a/tex/context/base/mkiv/buff-par.lua +++ b/tex/context/base/mkiv/buff-par.lua @@ -203,7 +203,7 @@ end implement { name = "defineparallel", actions = parallel.define, - arguments = { "string", "string" } + arguments = "2 strings", } implement { @@ -236,11 +236,11 @@ implement { implement { name = "resetparallel", actions = parallel.reset, - arguments = { "string", "string" } + arguments = "2 strings", } implement { name = "doifelseparallel", actions = { parallel.hassomecontent, commands.doifelse } , - arguments = { "string", "string" } + arguments = "2 strings", } diff --git a/tex/context/base/mkiv/char-def.lua b/tex/context/base/mkiv/char-def.lua index ddcaa7673..fcbf01900 100644 --- a/tex/context/base/mkiv/char-def.lua +++ b/tex/context/base/mkiv/char-def.lua @@ -21482,6 +21482,7 @@ characters.data={ direction="l", indic="d", indicmark="l", + indicorder="bh", linebreak="cm", unicodeslot=0x94E, }, @@ -21948,6 +21949,7 @@ characters.data={ description="BENGALI SIGN CANDRABINDU", direction="nsm", indic="o", + indicorder="ap", linebreak="cm", unicodeslot=0x981, }, @@ -22318,6 +22320,7 @@ characters.data={ direction="l", indic="c", indicclass="ra", + indicorder="as", linebreak="al", unicodeslot=0x9B0, }, @@ -22393,6 +22396,7 @@ characters.data={ direction="l", indic="d", indicmark="r", + indicorder="ap", linebreak="cm", unicodeslot=0x9BE, }, @@ -22403,6 +22407,7 @@ characters.data={ direction="l", indic="d", indicmark="l", + indicorder="bh", linebreak="cm", unicodeslot=0x9BF, }, @@ -22413,6 +22418,7 @@ characters.data={ direction="l", indic="d", indicmark="r", + indicorder="ap", linebreak="cm", unicodeslot=0x9C0, }, @@ -22423,6 +22429,7 @@ characters.data={ direction="nsm", indic="d", indicmark="b", + indicorder="as", linebreak="cm", unicodeslot=0x9C1, }, @@ -22433,6 +22440,7 @@ characters.data={ direction="nsm", indic="d", indicmark="b", + indicorder="as", linebreak="cm", unicodeslot=0x9C2, }, @@ -22443,6 +22451,7 @@ characters.data={ direction="nsm", indic="d", indicmark="b", + indicorder="as", linebreak="cm", unicodeslot=0x9C3, }, @@ -22453,6 +22462,7 @@ characters.data={ direction="nsm", indic="d", indicmark="b", + indicorder="as", linebreak="cm", unicodeslot=0x9C4, }, @@ -22463,6 +22473,7 @@ characters.data={ direction="l", indic="d", indicmark="r", + indicorder="bh", linebreak="cm", unicodeslot=0x9C7, }, @@ -22473,6 +22484,7 @@ characters.data={ direction="l", indic="d", indicmark="r", + indicorder="bh", linebreak="cm", unicodeslot=0x9C8, }, @@ -22523,6 +22535,7 @@ characters.data={ description="BENGALI AU LENGTH MARK", direction="l", indic="o", + indicorder="ap", linebreak="cm", unicodeslot=0x9D7, }, @@ -22580,6 +22593,7 @@ characters.data={ description="BENGALI VOWEL SIGN VOCALIC L", direction="nsm", indic="i", + indicorder="as", linebreak="cm", unicodeslot=0x9E2, }, @@ -22589,6 +22603,7 @@ characters.data={ description="BENGALI VOWEL SIGN VOCALIC LL", direction="nsm", indic="i", + indicorder="as", linebreak="cm", unicodeslot=0x9E3, }, @@ -22688,6 +22703,7 @@ characters.data={ description="BENGALI LETTER RA WITH MIDDLE DIAGONAL", direction="l", indic="o", + indicorder="as", linebreak="al", shcode=0x9B0, unicodeslot=0x9F0, @@ -22812,6 +22828,7 @@ characters.data={ description="GURMUKHI SIGN ADAK BINDI", direction="nsm", indic="o", + indicorder="ap", linebreak="cm", unicodeslot=0xA01, }, @@ -22821,6 +22838,7 @@ characters.data={ description="GURMUKHI SIGN BINDI", direction="nsm", indic="o", + indicorder="ap", linebreak="cm", unicodeslot=0xA02, }, @@ -23163,6 +23181,7 @@ characters.data={ direction="l", indic="c", indicclass="ra", + indicorder="bs", linebreak="al", unicodeslot=0xA30, }, @@ -23240,6 +23259,7 @@ characters.data={ direction="l", indic="d", indicmark="r", + indicorder="ap", linebreak="cm", unicodeslot=0xA3E, }, @@ -23250,6 +23270,7 @@ characters.data={ direction="l", indic="d", indicmark="l", + indicorder="bh", linebreak="cm", unicodeslot=0xA3F, }, @@ -23260,6 +23281,7 @@ characters.data={ direction="l", indic="d", indicmark="r", + indicorder="ap", linebreak="cm", unicodeslot=0xA40, }, @@ -23270,6 +23292,7 @@ characters.data={ direction="nsm", indic="d", indicmark="b", + indicorder="ap", linebreak="cm", unicodeslot=0xA41, }, @@ -23280,6 +23303,7 @@ characters.data={ direction="nsm", indic="d", indicmark="b", + indicorder="ap", linebreak="cm", unicodeslot=0xA42, }, @@ -23290,6 +23314,7 @@ characters.data={ direction="nsm", indic="d", indicmark="t", + indicorder="as", linebreak="cm", unicodeslot=0xA47, }, @@ -23300,6 +23325,7 @@ characters.data={ direction="nsm", indic="d", indicmark="t", + indicorder="as", linebreak="cm", unicodeslot=0xA48, }, @@ -23310,6 +23336,7 @@ characters.data={ direction="nsm", indic="d", indicmark="t", + indicorder="as", linebreak="cm", unicodeslot=0xA4B, }, @@ -23320,6 +23347,7 @@ characters.data={ direction="nsm", indic="d", indicmark="t", + indicorder="as", linebreak="cm", unicodeslot=0xA4C, }, @@ -23488,6 +23516,7 @@ characters.data={ description="GURMUKHI TIPPI", direction="nsm", indic="o", + indicorder="ap", linebreak="cm", unicodeslot=0xA70, }, @@ -23497,6 +23526,7 @@ characters.data={ description="GURMUKHI ADDAK", direction="nsm", indic="o", + indicorder="ap", linebreak="cm", unicodeslot=0xA71, }, @@ -23928,6 +23958,7 @@ characters.data={ direction="l", indic="c", indicclass="ra", + indicorder="bp", linebreak="al", unicodeslot=0xAB0, }, @@ -24021,6 +24052,7 @@ characters.data={ direction="l", indic="d", indicmark="r", + indicorder="ap", linebreak="cm", unicodeslot=0xABE, }, @@ -24031,6 +24063,7 @@ characters.data={ direction="l", indic="d", indicmark="l", + indicorder="bh", linebreak="cm", unicodeslot=0xABF, }, @@ -24041,6 +24074,7 @@ characters.data={ direction="l", indic="d", indicmark="r", + indicorder="ap", linebreak="cm", unicodeslot=0xAC0, }, @@ -24051,6 +24085,7 @@ characters.data={ direction="nsm", indic="d", indicmark="b", + indicorder="ap", linebreak="cm", unicodeslot=0xAC1, }, @@ -24061,6 +24096,7 @@ characters.data={ direction="nsm", indic="d", indicmark="b", + indicorder="ap", linebreak="cm", unicodeslot=0xAC2, }, @@ -24071,6 +24107,7 @@ characters.data={ direction="nsm", indic="d", indicmark="b", + indicorder="ap", linebreak="cm", unicodeslot=0xAC3, }, @@ -24081,6 +24118,7 @@ characters.data={ direction="nsm", indic="d", indicmark="b", + indicorder="ap", linebreak="cm", unicodeslot=0xAC4, }, @@ -24091,6 +24129,7 @@ characters.data={ direction="nsm", indic="d", indicmark="t", + indicorder="as", linebreak="cm", unicodeslot=0xAC5, }, @@ -24101,6 +24140,7 @@ characters.data={ direction="nsm", indic="d", indicmark="t", + indicorder="as", linebreak="cm", unicodeslot=0xAC7, }, @@ -24111,6 +24151,7 @@ characters.data={ direction="nsm", indic="d", indicmark="t", + indicorder="as", linebreak="cm", unicodeslot=0xAC8, }, @@ -24121,6 +24162,7 @@ characters.data={ direction="l", indic="d", indicmark="r", + indicorder="ap", linebreak="cm", unicodeslot=0xAC9, }, @@ -24131,6 +24173,7 @@ characters.data={ direction="l", indic="d", indicmark="r", + indicorder="ap", linebreak="cm", unicodeslot=0xACB, }, @@ -24141,6 +24184,7 @@ characters.data={ direction="l", indic="d", indicmark="r", + indicorder="ap", linebreak="cm", unicodeslot=0xACC, }, @@ -24187,6 +24231,7 @@ characters.data={ description="GUJARATI VOWEL SIGN VOCALIC L", direction="nsm", indic="i", + indicorder="ap", linebreak="cm", unicodeslot=0xAE2, }, @@ -24195,6 +24240,7 @@ characters.data={ description="GUJARATI VOWEL SIGN VOCALIC LL", direction="nsm", indic="i", + indicorder="ap", linebreak="cm", unicodeslot=0xAE3, }, @@ -24365,6 +24411,7 @@ characters.data={ description="ORIYA SIGN CANDRABINDU", direction="nsm", indic="o", + indicorder="bs", linebreak="cm", unicodeslot=0xB01, }, @@ -24694,6 +24741,7 @@ characters.data={ direction="l", indic="c", indicclass="ra", + indicorder="am", linebreak="al", unicodeslot=0xB30, }, @@ -24778,6 +24826,7 @@ characters.data={ direction="l", indic="d", indicmark="r", + indicorder="ap", linebreak="cm", unicodeslot=0xB3E, }, @@ -24787,6 +24836,7 @@ characters.data={ direction="nsm", indic="d", indicmark="t", + indicorder="am", linebreak="cm", unicodeslot=0xB3F, }, @@ -24796,6 +24846,7 @@ characters.data={ direction="l", indic="d", indicmark="r", + indicorder="ap", linebreak="cm", unicodeslot=0xB40, }, @@ -24805,6 +24856,7 @@ characters.data={ direction="nsm", indic="d", indicmark="b", + indicorder="as", linebreak="cm", unicodeslot=0xB41, }, @@ -24814,6 +24866,7 @@ characters.data={ direction="nsm", indic="d", indicmark="b", + indicorder="as", linebreak="cm", unicodeslot=0xB42, }, @@ -24823,6 +24876,7 @@ characters.data={ direction="nsm", indic="d", indicmark="b", + indicorder="as", linebreak="cm", unicodeslot=0xB43, }, @@ -24841,6 +24895,7 @@ characters.data={ direction="l", indic="d", indicmark="l", + indicorder="bh", linebreak="cm", unicodeslot=0xB47, }, @@ -24890,6 +24945,7 @@ characters.data={ description="ORIYA AI LENGTH MARK", direction="nsm", indic="o", + indicorder="am", linebreak="cm", unicodeslot=0xB56, }, @@ -24898,6 +24954,7 @@ characters.data={ description="ORIYA AU LENGTH MARK", direction="l", indic="o", + indicorder="ap", linebreak="cm", unicodeslot=0xB57, }, @@ -25329,6 +25386,7 @@ characters.data={ direction="l", indic="c", indicclass="ra", + indicorder="ap", linebreak="al", unicodeslot=0xBB0, }, @@ -25410,6 +25468,7 @@ characters.data={ direction="l", indic="d", indicmark="r", + indicorder="ap", linebreak="cm", unicodeslot=0xBBE, }, @@ -25419,6 +25478,7 @@ characters.data={ direction="l", indic="d", indicmark="r", + indicorder="ap", linebreak="cm", unicodeslot=0xBBF, }, @@ -25428,6 +25488,7 @@ characters.data={ direction="nsm", indic="d", indicmark="t", + indicorder="as", linebreak="cm", unicodeslot=0xBC0, }, @@ -25437,6 +25498,7 @@ characters.data={ direction="l", indic="d", indicmark="b", + indicorder="ap", linebreak="cm", unicodeslot=0xBC1, }, @@ -25446,6 +25508,7 @@ characters.data={ direction="l", indic="d", indicmark="b", + indicorder="ap", linebreak="cm", unicodeslot=0xBC2, }, @@ -25455,6 +25518,7 @@ characters.data={ direction="l", indic="d", indicmark="l", + indicorder="bm", linebreak="cm", unicodeslot=0xBC6, }, @@ -25464,6 +25528,7 @@ characters.data={ direction="l", indic="d", indicmark="l", + indicorder="bm", linebreak="cm", unicodeslot=0xBC7, }, @@ -25473,6 +25538,7 @@ characters.data={ direction="l", indic="d", indicmark="l", + indicorder="bm", linebreak="cm", unicodeslot=0xBC8, }, @@ -25513,7 +25579,7 @@ characters.data={ direction="nsm", indic="o", indicclass="halant", - indicmark="b", + indicmark="t", linebreak="cm", unicodeslot=0xBCD, }, @@ -25530,6 +25596,7 @@ characters.data={ description="TAMIL AU LENGTH MARK", direction="l", indic="o", + indicorder="ap", linebreak="cm", unicodeslot=0xBD7, }, @@ -26068,6 +26135,7 @@ characters.data={ direction="l", indic="c", indicclass="ra", + indicorder="ap", linebreak="al", unicodeslot=0xC30, }, @@ -26157,6 +26225,7 @@ characters.data={ direction="nsm", indic="d", indicmark="t", + indicorder="bs", linebreak="cm", unicodeslot=0xC3E, }, @@ -26166,6 +26235,7 @@ characters.data={ direction="nsm", indic="d", indicmark="t", + indicorder="bs", linebreak="cm", unicodeslot=0xC3F, }, @@ -26175,6 +26245,7 @@ characters.data={ direction="nsm", indic="d", indicmark="t", + indicorder="bs", linebreak="cm", unicodeslot=0xC40, }, @@ -26184,6 +26255,7 @@ characters.data={ direction="l", indic="d", indicmark="r", + indicorder="bs", linebreak="cm", unicodeslot=0xC41, }, @@ -26193,6 +26265,7 @@ characters.data={ direction="l", indic="d", indicmark="r", + indicorder="bs", linebreak="cm", unicodeslot=0xC42, }, @@ -26202,6 +26275,7 @@ characters.data={ direction="l", indic="d", indicmark="r", + indicorder="as", linebreak="cm", unicodeslot=0xC43, }, @@ -26211,6 +26285,7 @@ characters.data={ direction="l", indic="d", indicmark="r", + indicorder="as", linebreak="cm", unicodeslot=0xC44, }, @@ -26220,6 +26295,7 @@ characters.data={ direction="nsm", indic="d", indicmark="t", + indicorder="bs", linebreak="cm", unicodeslot=0xC46, }, @@ -26229,6 +26305,7 @@ characters.data={ direction="nsm", indic="d", indicmark="t", + indicorder="bs", linebreak="cm", unicodeslot=0xC47, }, @@ -26248,6 +26325,7 @@ characters.data={ direction="nsm", indic="d", indicmark="t", + indicorder="bs", linebreak="cm", unicodeslot=0xC4A, }, @@ -26257,6 +26335,7 @@ characters.data={ direction="nsm", indic="d", indicmark="t", + indicorder="bs", linebreak="cm", unicodeslot=0xC4B, }, @@ -26266,6 +26345,7 @@ characters.data={ direction="nsm", indic="d", indicmark="t", + indicorder="bs", linebreak="cm", unicodeslot=0xC4C, }, @@ -26286,6 +26366,7 @@ characters.data={ description="TELUGU LENGTH MARK", direction="nsm", indic="o", + indicorder="bs", linebreak="cm", unicodeslot=0xC55, }, @@ -26295,6 +26376,7 @@ characters.data={ description="TELUGU AI LENGTH MARK", direction="nsm", indic="o", + indicorder="bs", linebreak="cm", unicodeslot=0xC56, }, @@ -27609,6 +27691,7 @@ characters.data={ direction="l", indic="c", indicclass="ra", + indicorder="am", linebreak="al", unicodeslot=0xD30, }, @@ -27724,6 +27807,7 @@ characters.data={ direction="l", indic="d", indicmark="r", + indicorder="ap", linebreak="cm", unicodeslot=0xD3E, }, @@ -27733,6 +27817,7 @@ characters.data={ direction="l", indic="d", indicmark="r", + indicorder="ap", linebreak="cm", unicodeslot=0xD3F, }, @@ -27742,6 +27827,7 @@ characters.data={ direction="l", indic="d", indicmark="r", + indicorder="ap", linebreak="cm", unicodeslot=0xD40, }, @@ -27751,6 +27837,7 @@ characters.data={ direction="nsm", indic="d", indicmark="r", + indicorder="ap", linebreak="cm", unicodeslot=0xD41, }, @@ -27760,6 +27847,7 @@ characters.data={ direction="nsm", indic="d", indicmark="r", + indicorder="ap", linebreak="cm", unicodeslot=0xD42, }, @@ -27769,6 +27857,7 @@ characters.data={ direction="nsm", indic="d", indicmark="r", + indicorder="ap", linebreak="cm", unicodeslot=0xD43, }, @@ -27787,6 +27876,7 @@ characters.data={ direction="l", indic="d", indicmark="l", + indicorder="bm", linebreak="cm", unicodeslot=0xD46, }, @@ -27796,6 +27886,7 @@ characters.data={ direction="l", indic="d", indicmark="l", + indicorder="bm", linebreak="cm", unicodeslot=0xD47, }, @@ -27805,6 +27896,7 @@ characters.data={ direction="l", indic="d", indicmark="l", + indicorder="bm", linebreak="cm", unicodeslot=0xD48, }, @@ -27896,6 +27988,7 @@ characters.data={ direction="l", indic="d", indicmark="r", + indicorder="ap", linebreak="cm", unicodeslot=0xD57, }, @@ -73357,6 +73450,7 @@ characters.data={ }, [0x25CC]={ adobename="dottedcircle", + contextname="dottedcircle", category="so", description="DOTTED CIRCLE", direction="on", diff --git a/tex/context/base/mkiv/char-tex.lua b/tex/context/base/mkiv/char-tex.lua index f123f0092..065152881 100644 --- a/tex/context/base/mkiv/char-tex.lua +++ b/tex/context/base/mkiv/char-tex.lua @@ -847,7 +847,7 @@ end interfaces.implement { name = "overloaduppercase", - arguments = { "string", "string" }, + arguments = "2 strings", actions = function(c,u) overload(c,u,"uccode","uccodes") end @@ -855,7 +855,7 @@ interfaces.implement { interfaces.implement { name = "overloadlowercase", - arguments = { "string", "string" }, + arguments = "2 strings", actions = function(c,u) overload(c,u,"lccode","lccodes") end diff --git a/tex/context/base/mkiv/char-utf.lua b/tex/context/base/mkiv/char-utf.lua index 8f46ae98f..4dc7eba7a 100644 --- a/tex/context/base/mkiv/char-utf.lua +++ b/tex/context/base/mkiv/char-utf.lua @@ -269,7 +269,7 @@ if interfaces then -- eventually this goes to char-ctx.lua interfaces.implement { name = "addgrapheme", actions = utffilters.addgrapheme, - arguments = { "string", "string", "string" } + arguments = "3 strings", } end diff --git a/tex/context/base/mkiv/chem-str.lua b/tex/context/base/mkiv/chem-str.lua index 1ad16564c..7581a61d1 100644 --- a/tex/context/base/mkiv/chem-str.lua +++ b/tex/context/base/mkiv/chem-str.lua @@ -808,7 +808,7 @@ implement { implement { name = "definechemical", actions = chemistry.define, - arguments = { "string", "string", "string" } + arguments = "3 strings", } implement { @@ -843,7 +843,7 @@ implement { implement { name = "chemicalcomponent", actions = chemistry.component, - arguments = { "string", "string", "string", "string" } + arguments = "4 strings", } -- todo: top / bottom diff --git a/tex/context/base/mkiv/cldf-ini.lua b/tex/context/base/mkiv/cldf-ini.lua index 6f39578b4..8cd6408d3 100644 --- a/tex/context/base/mkiv/cldf-ini.lua +++ b/tex/context/base/mkiv/cldf-ini.lua @@ -319,7 +319,43 @@ local interfacescanners = setmetatablenewindex(function(t,k,v) rawset(t,k,v) end) +function interfaces.registerscanner(name,action,protected,public,call) + if storedscanners[name] then + -- report_cld("warning: scanner %a is already set",k) + -- os.exit() + -- \scan_<k> is already in the format + -- report_cld("using interface scanner: %s",k) + else + storedscanners[name] = true +-- if protected then +-- -- report_cld("installing expandable interface scanner: %s",k) +-- if public then +-- context("\\installprotectedctxscanner{%s}{interfaces.scanners.%s}",name,name) +-- else +-- context("\\installprotectedctxscanner{clf_%s}{interfaces.scanners.%s}",name,name) +-- end +-- else +-- -- report_cld("installing protected interface scanner: %s",k) +-- if public then +-- context("\\installctxscanner{%s}{interfaces.scanners.%s}",name,name) +-- else +-- context("\\installctxscanner{clf_%s}{interfaces.scanners.%s}",name,name) +-- end +-- end + -- report_cld("installing interface scanner: %s",k) + context("\\install%sctxscanner%s{%s%s}{interfaces.scanners.%s}", + protected and "protected" or "", + call and "call" or "", + public and "" or "clf_", + name, + name + ) + end + rawset(interfacescanners,name,action) +end + interfaces.scanners = storage.mark(interfacescanners) +interfaces._ = interfaces.scanners context.functions = { register = registerfunction, diff --git a/tex/context/base/mkiv/cldf-scn.lua b/tex/context/base/mkiv/cldf-scn.lua index beeb8c8c9..ccf1f01c6 100644 --- a/tex/context/base/mkiv/cldf-scn.lua +++ b/tex/context/base/mkiv/cldf-scn.lua @@ -22,6 +22,7 @@ local f_command = formatters["local action = tokens._action\n%\nt\nreturn func local interfaces = interfaces local commands = commands local scanners = interfaces.scanners +local register = interfaces.registerscanner local compile = tokens.compile or function() end @@ -71,7 +72,8 @@ function interfaces.implement(specification) if scanners[name] and not specification.overload then report("warning: 'scanners.%s' is redefined",name) end - scanners[name] = scanner +-- scanners[name] = scanner + register(name,scanner,specification.protected,specification.public,specification.call) if private then return end diff --git a/tex/context/base/mkiv/colo-ini.lua b/tex/context/base/mkiv/colo-ini.lua index ca00ae72f..921612b0f 100644 --- a/tex/context/base/mkiv/colo-ini.lua +++ b/tex/context/base/mkiv/colo-ini.lua @@ -1058,12 +1058,12 @@ implement { implement { name = "synccolorclone", actions = synccolorclone, - arguments = { "string", "string" }, + arguments = "2 strings", } implement { name = "setcolormodel", - arguments = { "string", "string" }, + arguments = "2 strings", actions = function(model,weight) texsetattribute(a_colormodel,setcolormodel(model,weight)) end @@ -1072,7 +1072,7 @@ implement { implement { name = "setpagecolormodel", actions = colors.setpagecolormodel, - arguments = { "string" }, + arguments = "string", } implement { @@ -1110,13 +1110,13 @@ implement { actions = function(main) colors.main = main end, - arguments = { "integer" } + arguments = "integer" } implement { name = "definetransparency", actions = definetransparency, - arguments = { "string", "string" } + arguments = "2 strings" } implement { diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv index ca0f0d157..acb618a43 100644 --- a/tex/context/base/mkiv/cont-new.mkiv +++ b/tex/context/base/mkiv/cont-new.mkiv @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2018.03.25 17:32} +\newcontextversion{2018.04.03 22:22} %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/mkiv/context.mkiv b/tex/context/base/mkiv/context.mkiv index 1b9c2b4c3..7795c5a17 100644 --- a/tex/context/base/mkiv/context.mkiv +++ b/tex/context/base/mkiv/context.mkiv @@ -42,7 +42,7 @@ %D has to match \type {YYYY.MM.DD HH:MM} format. \edef\contextformat {\jobname} -\edef\contextversion{2018.03.25 17:32} +\edef\contextversion{2018.04.03 22:22} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/mkiv/core-con.lua b/tex/context/base/mkiv/core-con.lua index edba24f10..87b4c063e 100644 --- a/tex/context/base/mkiv/core-con.lua +++ b/tex/context/base/mkiv/core-con.lua @@ -644,7 +644,7 @@ end implement { name = "defineconversion", actions = converters.define, - arguments = { "string", "string" } + arguments = "2 strings", } implement { @@ -685,7 +685,7 @@ end implement { name = "doifelseconverter", actions = { valid, commands.doifelse }, - arguments = { "string", "string" } + arguments = "2 strings", } implement { @@ -1398,7 +1398,7 @@ end implement { name = "currentdate", - arguments = { "string", "string", "string" }, + arguments = "3 strings", actions = function(pattern,default,language) currentdate( pattern == "" and default or pattern, diff --git a/tex/context/base/mkiv/core-dat.lua b/tex/context/base/mkiv/core-dat.lua index c3b00a7c0..fa4d089d0 100644 --- a/tex/context/base/mkiv/core-dat.lua +++ b/tex/context/base/mkiv/core-dat.lua @@ -192,9 +192,9 @@ implement { } implement { - name = "datasetvariable", - actions = datasetvariable, - arguments = { "string", "string", "string" } + name = "datasetvariable", + actions = datasetvariable, + arguments = "3 strings", } --[[ldx-- @@ -305,11 +305,11 @@ implement { implement { name = "pagestaterealpage", actions = pagestaterealpage, - arguments = { "string", "string" } + arguments = "2 strings", } implement { name = "setpagestaterealpageno", actions = setpagestaterealpageno, - arguments = { "string", "string" } + arguments = "2 strings", } diff --git a/tex/context/base/mkiv/core-sys.lua b/tex/context/base/mkiv/core-sys.lua index 523b47298..26229235b 100644 --- a/tex/context/base/mkiv/core-sys.lua +++ b/tex/context/base/mkiv/core-sys.lua @@ -84,7 +84,7 @@ end) implement { name = "systemlog", - arguments = { "string", "string", "string" }, + arguments = "3 strings", actions = function(whereto,category,text) logs.system(whereto,"context",tex.jobname,category,text) end, diff --git a/tex/context/base/mkiv/core-two.lua b/tex/context/base/mkiv/core-two.lua index 5192677b2..1e59004be 100644 --- a/tex/context/base/mkiv/core-two.lua +++ b/tex/context/base/mkiv/core-two.lua @@ -150,7 +150,7 @@ local implement = interfaces.implement implement { name = "gettwopassdata", actions = { get , context }, arguments = "string" } implement { name = "getfirsttwopassdata",actions = { first, context }, arguments = "string" } implement { name = "getlasttwopassdata", actions = { last , context }, arguments = "string" } -implement { name = "findtwopassdata", actions = { find , context }, arguments = { "string", "string" } } +implement { name = "findtwopassdata", actions = { find , context }, arguments = "2 strings" } implement { name = "gettwopassdatalist", actions = { list , context }, arguments = "string" } implement { name = "counttwopassdata", actions = { count, context }, arguments = "string" } implement { name = "checktwopassdata", actions = { check, context }, arguments = "string" } @@ -164,17 +164,17 @@ implement { implement { name = "savetwopassdata", actions = jobpasses.save, - arguments = { "string", "string" } + arguments = "2 strings", } implement { name = "savetaggedtwopassdata", actions = jobpasses.savetagged, - arguments = { "string", "string", "string" } + arguments = "3 strings", } implement { name = "doifelseintwopassdata", actions = { inlist, commands.doifelse }, - arguments = { "string", "string" } + arguments = "2 strings", } diff --git a/tex/context/base/mkiv/core-uti.lua b/tex/context/base/mkiv/core-uti.lua index fda66ed73..b281b81a4 100644 --- a/tex/context/base/mkiv/core-uti.lua +++ b/tex/context/base/mkiv/core-uti.lua @@ -384,15 +384,37 @@ statistics.register("jobdata time",function() end end) -statistics.register("callbacks", function() - local total, indirect = status.callbacks or 0, status.indirect_callbacks or 0 - local pages = texgetcount('realpageno') - 1 - if pages > 1 then - return format("direct: %s, indirect: %s, total: %s (%i per page)", total-indirect, indirect, total, total/pages) - else - return format("direct: %s, indirect: %s, total: %s", total-indirect, indirect, total) +-- statistics.register("callbacks", function() +-- local total, indirect = status.callbacks or 0, status.indirect_callbacks or 0 +-- local pages = texgetcount('realpageno') - 1 +-- if pages > 1 then +-- return format("direct: %s, indirect: %s, total: %s (%i per page)", total-indirect, indirect, total, total/pages) +-- else +-- return format("direct: %s, indirect: %s, total: %s", total-indirect, indirect, total) +-- end +-- end) + +function statistics.callbacks() + local c_internal = status.callbacks or 0 + local c_file = status.indirect_callbacks or 0 + local c_direct = status.direct_callbacks or 0 + local c_late = status.late_callbacks or 0 + local c_function = status.function_callbacks or 0 + local c_total = c_internal + c_file + c_direct + c_late + c_function + local n_pages = texgetcount('realpageno') - 1 + local c_average = n_pages > 0 and math.round(c_total/n_pages) or 0 + local s_result = format ( + c_average > 0 and "internal: %s, file: %s, direct: %s, late: %s, function %s, total: %s (%s per page)" + or "internal: %s, file: %s, direct: %s, late: %s, function %s, total: %s", + c_internal, c_file, c_direct, c_late, c_function, c_total, c_average + ) + statistics.callbacks = function() + return s_result end -end) + return s_result +end + +statistics.register("callbacks", statistics.callbacks) statistics.register("randomizer", function() if rmethod and rvalue then @@ -436,7 +458,7 @@ end implement { name = "savevariable", actions = job.variables.save, - arguments = { "string", "string" } + arguments = "2 strings", } implement { diff --git a/tex/context/base/mkiv/file-job.lua b/tex/context/base/mkiv/file-job.lua index af15eff56..dbf6da9b4 100644 --- a/tex/context/base/mkiv/file-job.lua +++ b/tex/context/base/mkiv/file-job.lua @@ -160,7 +160,7 @@ implement { implement { name = "usezipfile", - arguments = { "string", "string" }, + arguments = "2 strings", actions = function(name,tree) if tree and tree ~= "" then resolvers.usezipfile(formatters["zip:///%s?tree=%s"](name,tree)) @@ -923,13 +923,13 @@ end implement { name = "setdocumentargument", actions = document.setargument, - arguments = { "string", "string" } + arguments = "2 strings" } implement { name = "setdocumentdefaultargument", actions = document.setdefaultargument, - arguments = { "string", "string" } + arguments = "2 strings" } implement { @@ -941,7 +941,7 @@ implement { implement { name = "getdocumentargument", actions = { document.getargument, context }, - arguments = { "string", "string" } + arguments = "2 strings" } implement { diff --git a/tex/context/base/mkiv/file-res.lua b/tex/context/base/mkiv/file-res.lua index cf76d2d8b..16afae4c7 100644 --- a/tex/context/base/mkiv/file-res.lua +++ b/tex/context/base/mkiv/file-res.lua @@ -161,7 +161,7 @@ local implement = interfaces.implement implement { name = "getreadfilename", actions = { getreadfilename, context }, - arguments = { "string", "string", "string" } + arguments = "3 strings", } implement { diff --git a/tex/context/base/mkiv/file-syn.lua b/tex/context/base/mkiv/file-syn.lua index 7b000f9ad..c1c25bab3 100644 --- a/tex/context/base/mkiv/file-syn.lua +++ b/tex/context/base/mkiv/file-syn.lua @@ -60,11 +60,11 @@ implement { implement { name = "definefilesynonym", actions = environment.definefilesynonym, - arguments = { "string", "string" } + arguments = "2 strings" } implement { name = "definefilefallback", actions = environment,definefilefallback, - arguments = { "string", "string" } + arguments = "2 strings" } diff --git a/tex/context/base/mkiv/font-cft.lua b/tex/context/base/mkiv/font-cft.lua index 30221cbaa..83227ca4a 100644 --- a/tex/context/base/mkiv/font-cft.lua +++ b/tex/context/base/mkiv/font-cft.lua @@ -266,6 +266,8 @@ do }, slantfactor = t_float, extendfactor = t_float, + mode = t_cardinal, + width = t_scale, factor = t_float, hfactor = t_float, vfactor = t_float, diff --git a/tex/context/base/mkiv/font-col.lua b/tex/context/base/mkiv/font-col.lua index 8d3152df4..7bbaf31cb 100644 --- a/tex/context/base/mkiv/font-col.lua +++ b/tex/context/base/mkiv/font-col.lua @@ -363,13 +363,13 @@ end implement { name = "fontcollectiondefine", actions = collections.define, - arguments = { "string", "string", "string", "string" } + arguments = "4 strings", } implement { name = "fontcollectionreset", actions = collections.reset, - arguments = { "string", "string" } + arguments = "2 strings", } implement { diff --git a/tex/context/base/mkiv/font-con.lua b/tex/context/base/mkiv/font-con.lua index 9cffa5927..add646da1 100644 --- a/tex/context/base/mkiv/font-con.lua +++ b/tex/context/base/mkiv/font-con.lua @@ -492,6 +492,15 @@ function constructors.scale(tfmdata,specification) else target.slant = 0 end + -- effects + local mode = parameters.mode or 0 + if mode ~= 0 then + target.mode = mode + end + local width = parameters.width or 0 + if width ~= 0 then + target.width = width + end -- targetparameters.factor = delta targetparameters.hfactor = hdelta @@ -499,6 +508,8 @@ function constructors.scale(tfmdata,specification) targetparameters.size = scaledpoints targetparameters.units = units targetparameters.scaledpoints = askedscaledpoints + targetparameters.mode = mode + targetparameters.width = width -- local isvirtual = properties.virtualized or tfmdata.type == "virtual" local hasquality = parameters.expansion or parameters.protrusion @@ -875,12 +886,15 @@ function constructors.scale(tfmdata,specification) -- constructors.aftercopyingcharacters(target,tfmdata) -- - constructors.trytosharefont(target,tfmdata) + constructors.trytosharefont(target,tfmdata) -- -- catch inconsistencies -- local vfonts = target.fonts - if isvirtual then +-- if isvirtual then +if isvirtual or target.type == "virtual" or properties.virtualized then + properties.virtualized = true +target.type = "virtual" if not vfonts or #vfonts == 0 then target.fonts = { { id = 0 } } end @@ -925,6 +939,14 @@ function constructors.finalize(tfmdata) parameters.size = tfmdata.size end -- + if not parameters.mode then + parameters.mode = 0 + end + -- + if not parameters.width then + parameters.width = 0 + end + -- if not parameters.extendfactor then parameters.extendfactor = tfmdata.extend or 0 end @@ -1023,6 +1045,8 @@ function constructors.finalize(tfmdata) tfmdata.step = nil tfmdata.extend = nil tfmdata.slant = nil + tfmdata.mode = nil + tfmdata.width = nil tfmdata.units = nil tfmdata.units_per_em = nil -- diff --git a/tex/context/base/mkiv/font-ctx.lua b/tex/context/base/mkiv/font-ctx.lua index bc562d0d0..87885f64f 100644 --- a/tex/context/base/mkiv/font-ctx.lua +++ b/tex/context/base/mkiv/font-ctx.lua @@ -2249,7 +2249,7 @@ end implement { name = "definetypeface", actions = fonts.definetypeface, - arguments = { "string", "string" } + arguments = "2 strings" } function fonts.current() -- todo: also handle name @@ -2442,13 +2442,13 @@ do implement { name = "definefontfeature", - arguments = { "string", "string", "string" }, + arguments = "3 strings", actions = presetcontext } implement { name = "adaptfontfeature", - arguments = { "string", "string" }, + arguments = "2 strings", actions = adaptcontext } @@ -2919,7 +2919,7 @@ do -- implement { -- name = "definefontcolorpalette", - -- arguments = { "string", "string" }, + -- arguments = "2 strings", -- actions = function(name,set) -- set = settings_to_array(set) -- for i=1,#set do @@ -2938,7 +2938,7 @@ do implement { name = "definefontcolorpalette", - arguments = { "string", "string" }, + arguments = "2 strings", actions = function(name,set) otf.registerpalette(name,settings_to_array(set)) end diff --git a/tex/context/base/mkiv/font-ext.lua b/tex/context/base/mkiv/font-ext.lua index 0def526d0..d873dccd4 100644 --- a/tex/context/base/mkiv/font-ext.lua +++ b/tex/context/base/mkiv/font-ext.lua @@ -30,9 +30,10 @@ of neutral.</p> local handlers = fonts.handlers local hashes = fonts.hashes local otf = handlers.otf +local afm = handlers.afm -local registerotffeature = handlers.otf.features.register -local registerafmfeature = handlers.afm.features.register +local registerotffeature = otf.features.register +local registerafmfeature = afm.features.register local fontdata = hashes.identifiers local fontproperties = hashes.properties @@ -181,7 +182,7 @@ fonts.goodies.register("expansions", function(...) return fonts.goodies.report( implement { name = "setupfontexpansion", - arguments = { "string", "string" }, + arguments = "2 strings", actions = function(class,settings) getparameters(classes,class,'preset',settings) end } @@ -492,7 +493,7 @@ fonts.goodies.register("protrusions", function(...) return fonts.goodies.report( implement { name = "setupfontprotrusion", - arguments = { "string", "string" }, + arguments = "2 strings", actions = function(class,settings) getparameters(classes,class,'preset',settings) end } @@ -672,8 +673,6 @@ local function manipulatedimensions(tfmdata,key,value) local height = newheight or oldheight or 0 local depth = newdepth or olddepth or 0 if oldwidth ~= width or oldheight ~= height or olddepth ~= depth then - -- Defining the tables in one step is more efficient - -- than adding fields later. local private = getprivate(tfmdata) local newslot = { "slot", 1, private } -- { "slot", 0, private } local new_c @@ -720,19 +719,19 @@ local function manipulatedimensions(tfmdata,key,value) for k, v in next, additions do characters[k] = v end - elseif height > 0 and depth > 0 then - for unicode, old_c in next, characters do - old_c.height = height - old_c.depth = depth - end - elseif height > 0 then - for unicode, old_c in next, characters do - old_c.height = height - end - elseif depth > 0 then - for unicode, old_c in next, characters do - old_c.depth = depth - end + -- elseif height > 0 and depth > 0 then + -- for unicode, old_c in next, characters do + -- old_c.height = height + -- old_c.depth = depth + -- end + -- elseif height > 0 then + -- for unicode, old_c in next, characters do + -- old_c.height = height + -- end + -- elseif depth > 0 then + -- for unicode, old_c in next, characters do + -- old_c.depth = depth + -- end end end end @@ -1708,3 +1707,150 @@ do } end + +-- maybe useful + +local function initializeoutline(tfmdata,value) + value = tonumber(value) + if not value then + value = 0 + else + value = tonumber(value) or 0 + end + if value then + value = value * 1000 + end + tfmdata.parameters.mode = 1 + tfmdata.parameters.width = value +end + +local outline_specification = { + name = "outline", + description = "outline glyphs", + initializers = { + base = initializeoutline, + node = initializeoutline, + } +} + +registerotffeature(outline_specification) +registerafmfeature(outline_specification) + +-- definitely ugly + +local report_effect = logs.reporter("fonts","effect") +local trace_effect = false + +trackers.register("fonts.effect", function(v) trace_effect = v end) + +local effects = { + inner = 0, + normal = 0, + outer = 1, + outline = 1, + both = 2, + hidden = 3, +} + +local function initializeeffect(tfmdata,value) + local spec + if type(value) == "number" then + spec = { width = value } + else + spec = settings_to_hash(value) + end + local effect = spec.effect or "both" + local width = tonumber(spec.width) or 0 + local mode = effects[effect] + if not mode then + report_effect("invalid effect %a",effect) + elseif width == 0 and mode == 0 then + report_effect("invalid width %a for effect %a",width,effect) + else + local parameters = tfmdata.parameters + local properties = tfmdata.properties + parameters.mode = mode + parameters.width = width * 1000 + local factor = tonumber(spec.factor) or 0 + local hfactor = tonumber(spec.vfactor) or factor + local vfactor = tonumber(spec.hfactor) or factor + local delta = tonumber(spec.delta) or 1 + local wdelta = tonumber(spec.wdelta) or delta + local hdelta = tonumber(spec.hdelta) or delta + local ddelta = tonumber(spec.ddelta) or hdelta + properties.effect = { + effect = effect, + width = width, + factor = factor, + hfactor = hfactor, + vfactor = vfactor, + wdelta = wdelta, + hdelta = hdelta, + ddelta = ddelta, + } + end +end + +local function manipulateeffect(tfmdata) + local effect = tfmdata.properties.effect + if effect then + local characters = tfmdata.characters + local parameters = tfmdata.parameters + local multiplier = effect.width * 100 + local wdelta = effect.wdelta * parameters.hfactor * multiplier + local hdelta = effect.hdelta * parameters.vfactor * multiplier + local ddelta = effect.ddelta * parameters.vfactor * multiplier + local hshift = wdelta / 2 + local factor = (1 + effect.factor) * parameters.factor + local hfactor = (1 + effect.hfactor) * parameters.hfactor + local vfactor = (1 + effect.vfactor) * parameters.vfactor + for unicode, old_c in next, characters do + local oldwidth = old_c.width + local oldheight = old_c.height + local olddepth = old_c.depth + if oldwidth and oldwidth > 0 then + old_c.width = oldwidth + wdelta + old_c.commands = { + { "right", hshift }, + { "char", unicode }, + } + end + if oldheight and oldheight > 0 then + old_c.height = oldheight + hdelta + end + if olddepth and olddepth > 0 then + old_c.depth = olddepth + ddelta + end + end + parameters.factor = factor + parameters.hfactor = hfactor + parameters.vfactor = vfactor + if trace_effect then + report_effect("applying effect") + report_effect(" effect : %s", effect.effect) + report_effect(" width : %s => %s", effect.width, multiplier) + report_effect(" factor : %s => %s", effect.factor, factor ) + report_effect(" hfactor : %s => %s", effect.hfactor,hfactor) + report_effect(" vfactor : %s => %s", effect.vfactor,vfactor) + report_effect(" wdelta : %s => %s", effect.wdelta, wdelta) + report_effect(" hdelta : %s => %s", effect.hdelta, hdelta) + report_effect(" ddelta : %s => %s", effect.ddelta, ddelta) + end + end +end + +local effect_specification = { + name = "effect", + description = "apply effects to glyphs", + initializers = { + base = initializeeffect, + node = initializeeffect, + }, + manipulators = { + base = manipulateeffect, + node = manipulateeffect, + }, +} + +registerotffeature(effect_specification) +registerafmfeature(effect_specification) diff --git a/tex/context/base/mkiv/font-ini.mkvi b/tex/context/base/mkiv/font-ini.mkvi index ee20d7b32..693182919 100644 --- a/tex/context/base/mkiv/font-ini.mkvi +++ b/tex/context/base/mkiv/font-ini.mkvi @@ -2510,14 +2510,32 @@ % \popmacro\fontclass % \ifx\fontclass\empty\else\setupbodyfont\relax\fi} +% \unexpanded\def\usebodyfont[#1]% +% {\pushmacro\fontclass +% \font_helpers_set_font\zerocount{#1}% +% \popmacro\fontclass +% \ifx\fontclass\empty \else +% \font_basics_setupbodyfont_nop +% \fi} + \unexpanded\def\usebodyfont[#1]% - {\pushmacro\fontclass - \font_helpers_set_font\zerocount{#1}% - \popmacro\fontclass - \ifx\fontclass\empty \else - \font_basics_setupbodyfont_nop + {\ifx\fontclass\empty + \setupbodyfont[#1]% + \else + \switchtobodyfont[#1]% + \fullrestoreglobalbodyfont \fi} +\unexpanded\def\showbodyfontstate + {\dontleavehmode + \start + \infofont + [fontclass: \fontclass,\space + fontbody: \fontbody ,\space + fontface: \fontface ,\space + fontsize: \fontsize ]% + \stop} + %D Handy for manuals: %D The \type {\tochar} commmand takes a specification: diff --git a/tex/context/base/mkiv/font-osd.lua b/tex/context/base/mkiv/font-osd.lua index 0bfa0028f..9f99fd57f 100644 --- a/tex/context/base/mkiv/font-osd.lua +++ b/tex/context/base/mkiv/font-osd.lua @@ -81,7 +81,7 @@ if not modules then modules = { } end modules ['font-osd'] = { -- script devanag local insert, imerge, copy = table.insert, table.imerge, table.copy local next, type = next, type -local report_devanagari = logs.reporter("otf","devanagari") +local report = logs.reporter("otf","devanagari") fonts = fonts or { } fonts.analyzers = fonts.analyzers or { } @@ -131,6 +131,9 @@ local a_state = attributes.private('state') local a_syllabe = attributes.private('syllabe') local dotted_circle = 0x25CC +local c_nbsp = 0x00A0 +local c_zwnj = 0x200C +local c_zwj = 0x200D local states = fonts.analyzers.states -- not features @@ -167,14 +170,27 @@ local function processcharacters(head,font) return tonut(xprocesscharacters(tonode(head))) -- can be more efficient in context, just direct call end --- local fontprocesses = fonts.hashes.processes +-- to be tested: -- --- function processcharacters(head,font) --- local processors = fontprocesses[font] --- for i=1,#processors do --- head = processors[i](head,font,0) +-- local processcharacters = nil +-- +-- if context then +-- local fontprocesses = fonts.hashes.processes +-- function processcharacters(head,font) +-- local processors = fontprocesses[font] +-- for i=1,#processors do +-- head = processors[i](head,font,0) +-- end +-- return head, true +-- end +-- else +-- function processcharacters(head,font) +-- local processors = fontdata[font].shared.processes +-- for i=1,#processors do +-- head = processors[i](head,font,0) +-- end +-- return head, true -- end --- return head, true -- end -- We can assume that script are not mixed in the source but if that is the case @@ -216,6 +232,8 @@ if not indicgroups and characters then as = { }, -- after_half bh = { }, -- before_subscript ah = { }, -- after_subscript + bm = { }, -- before_main + am = { }, -- after_main } for k, v in next, characters.data do @@ -264,6 +282,8 @@ if not indicgroups and characters then after_half = indicorders.ah, before_subscript = indicorders.bs, after_subscript = indicorders.as, + before_main = indicorders.bm, + after_main = indicorders.am, } indic = nil @@ -293,31 +313,33 @@ local nukta = indicgroups.nukta local halant = indicgroups.halant local ra = indicgroups.ra local anudatta = indicgroups.anudatta -local after_subscript = indicgroups.after_subscript - -local mark_four = { } -- As we access these frequently an extra hash is used. - -for k, v in next, pre_mark do mark_four[k] = pre_mark end -for k, v in next, above_mark do mark_four[k] = above_mark end -for k, v in next, below_mark do mark_four[k] = below_mark end -for k, v in next, post_mark do mark_four[k] = post_mark end - -local mark_above_below_post = { } -for k, v in next, above_mark do mark_above_below_post[k] = above_mark end -for k, v in next, below_mark do mark_above_below_post[k] = below_mark end -for k, v in next, post_mark do mark_above_below_post[k] = post_mark end - --- Again, this table can be extended for other scripts than devanagari. Actually, --- for ConTeXt this kind of data is kept elsewhere so eventually we might move --- tables to someplace else. +local before_postscript = indicgroups.before_postscript +local after_postscript = indicgroups.after_postscript +local before_half = indicgroups.before_half +local after_half = indicgroups.after_half +local before_subscript = indicgroups.before_subscript +local after_subscript = indicgroups.after_subscript +local before_main = indicgroups.before_main +local after_main = indicgroups.after_main + +local mark_four = table.merged ( + pre_mark, + above_mark, + below_mark, + post_mark +) + +local mark_above_below_post = table.merged ( + above_mark, + below_mark, + post_mark +) -- We use some pseudo features as we need to manipulate the nodelist based --- on information in the font as well as already applied features. - -local c_nbsp = 0x00A0 -local c_zwnj = 0x200C -local c_zwj = 0x200D +-- on information in the font as well as already applied features. We can +-- probably replace some of the code below by injecting 'real' features +-- using the extension mechanism. local zw_char = { -- both_joiners_true [c_zwnj] = true, @@ -328,11 +350,11 @@ local dflt_true = { dflt = true } -local dev2_defaults = { +local two_defaults = { dev2 = dflt_true, } -local deva_defaults = { +local one_defaults = { dev2 = dflt_true, deva = dflt_true, } @@ -340,7 +362,7 @@ local deva_defaults = { local false_flags = { false, false, false, false } local sequence_reorder_matras = { - features = { dv01 = dev2_defaults }, + features = { dv01 = two_defaults }, flags = false_flags, name = "dv01_reorder_matras", order = { "dv01" }, @@ -354,7 +376,7 @@ local sequence_reorder_matras = { } local sequence_reorder_reph = { - features = { dv02 = dev2_defaults }, + features = { dv02 = two_defaults }, flags = false_flags, name = "dv02_reorder_reph", order = { "dv02" }, @@ -368,7 +390,7 @@ local sequence_reorder_reph = { } local sequence_reorder_pre_base_reordering_consonants = { - features = { dv03 = dev2_defaults }, + features = { dv03 = two_defaults }, flags = false_flags, name = "dv03_reorder_pre_base_reordering_consonants", order = { "dv03" }, @@ -382,7 +404,7 @@ local sequence_reorder_pre_base_reordering_consonants = { } local sequence_remove_joiners = { - features = { dv04 = deva_defaults }, + features = { dv04 = one_defaults }, flags = false_flags, name = "dv04_remove_joiners", order = { "dv04" }, @@ -400,38 +422,85 @@ local sequence_remove_joiners = { -- as it might depends on the font. Not that it's a bottleneck. local basic_shaping_forms = { - nukt = true, + init = true, -- new + abvs = true, -- new akhn = true, - rphf = true, - pref = true, - rkrf = true, blwf = true, + calt = true, -- new + cjct = true, half = true, + haln = true, -- new + nukt = true, + pref = true, + pres = true, -- new pstf = true, + psts = true, -- new + rkrf = true, + rphf = true, vatu = true, - cjct = true, } local valid = { - akhn = true, -- malayalam - rphf = true, - pref = true, - half = true, + -- akhn = true, -- malayalam + -- rphf = true, + -- pref = true, + -- half = true, + -- blwf = true, + -- pstf = true, + -- pres = true, -- malayalam + -- blws = true, -- malayalam + -- psts = true, -- malayalam + abvs = true, + akhn = true, blwf = true, + calt = true, + cjct = true, + half = true, + haln = true, + nukt = true, + pref = true, + pres = true, pstf = true, - pres = true, -- malayalam - blws = true, -- malayalam - psts = true, -- malayalam + psts = true, + rkrf = true, + rphf = true, + vatu = true, + pres = true, + abvs = true, + blws = true, + psts = true, + haln = true, + calt = true, } +local scripts = { } + +local scripts_one = { "deva", "mlym", "beng", "gujr", "guru", "knda", "orya", "taml", "telu" } +local scripts_two = { "dev2", "mlm2", "bng2", "gjr2", "gur2", "knd2", "ory2", "tml2", "tel2" } + +local nofscripts = #scripts_one + +for i=1,nofscripts do + local one = scripts_one[i] + local two = scripts_two[i] + scripts[one] = true + scripts[two] = true + two_defaults[one] = dflt_true + one_defaults[one] = dflt_true + one_defaults[two] = dflt_true +end + +local function valid_one(s) for i=1,nofscripts do if s[scripts_one[i]] then return true end end end +local function valid_two(s) for i=1,nofscripts do if s[scripts_two[i]] then return true end end end + local function initializedevanagi(tfmdata) local script, language = otf.scriptandlanguage(tfmdata,attr) -- todo: take fast variant - if script == "deva" or script == "dev2" or script =="mlym" or script == "mlm2" then + if scripts[script] then local resources = tfmdata.resources local devanagari = resources.devanagari if not devanagari then -- - report_devanagari("adding devanagari features to font") + report("adding devanagari features to font") -- local gsubfeatures = resources.features.gsub local sequences = resources.sequences @@ -450,10 +519,10 @@ local function initializedevanagi(tfmdata) end local insertindex = lastmatch + 1 -- - gsubfeatures["dv01"] = dev2_defaults -- reorder matras - gsubfeatures["dv02"] = dev2_defaults -- reorder reph - gsubfeatures["dv03"] = dev2_defaults -- reorder pre base reordering consonants - gsubfeatures["dv04"] = deva_defaults -- remove joiners + gsubfeatures["dv01"] = two_defaults -- reorder matras + gsubfeatures["dv02"] = two_defaults -- reorder reph + gsubfeatures["dv03"] = two_defaults -- reorder pre base reordering consonants + gsubfeatures["dv04"] = one_defaults -- remove joiners -- local reorder_pre_base_reordering_consonants = copy(sequence_reorder_pre_base_reordering_consonants) local reorder_reph = copy(sequence_reorder_reph) @@ -509,8 +578,9 @@ local function initializedevanagi(tfmdata) end end end - for kind, spec in next, features do -- beware, this is - if spec.dev2 and valid[kind] then + for kind, spec in next, features do + -- if spec.dev2 and valid[kind] then + if valid[kind] and valid_two(spec)then for i=1,nofsteps do local step = steps[i] local coverage = step.coverage @@ -535,7 +605,9 @@ local function initializedevanagi(tfmdata) end end end - seqsubset[#seqsubset+1] = { kind, coverage, reph } +if reph then + seqsubset[#seqsubset+1] = { kind, coverage, reph } +end end end end @@ -581,8 +653,30 @@ local function initializedevanagi(tfmdata) sharedfeatures["pstf"] = true sharedfeatures["pref"] = true sharedfeatures["dv03"] = true -- dv03_reorder_pre_base_reordering_consonants - gsubfeatures ["dv03"] = dev2_defaults -- reorder pre base reordering consonants + gsubfeatures ["dv03"] = two_defaults -- reorder pre base reordering consonants insert(sequences,insertindex,sequence_reorder_pre_base_reordering_consonants) + -- elseif script == "beng" then + -- elseif script == "bng2" then + -- elseif script == "gujr" then + -- elseif script == "gjr2" then + -- elseif script == "guru" then + -- elseif script == "gur2" then + -- elseif script == "knda" then + -- elseif script == "knd2" then + elseif script == "taml" then + sharedfeatures["dv04"] = true -- dv04_remove_joiners +sharedfeatures["pstf"] = true + elseif script == "tml2" then +-- sharedfeatures["pstf"] = true +-- sharedfeatures["pref"] = true +-- sharedfeatures["dv01"] = true -- dv01_reorder_matras +-- sharedfeatures["dv02"] = true -- dv02_reorder_reph +-- sharedfeatures["dv03"] = true -- dv03_reorder_pre_base_reordering_consonants +-- sharedfeatures["dv04"] = true -- dv04_remove_joiners + -- elseif script == "telu" then + -- elseif script == "tel2" then + else + report("todo: enable the right features for script %a",script) end end end @@ -599,7 +693,7 @@ registerotffeature { -- hm, this is applied to one character: -local function deva_initialize(font,attr) -- we need a proper hook into the dataset initializer +local function initialize_one(font,attr) -- we need a proper hook into the dataset initializer local tfmdata = fontdata[font] local datasets = otf.dataset(tfmdata,font,attr) -- don't we know this one? @@ -638,9 +732,9 @@ local function deva_initialize(font,attr) -- we need a proper hook into the data end -local function deva_reorder(head,start,stop,font,attr,nbspaces) +local function reorder_one(head,start,stop,font,attr,nbspaces) - local reph, vattu, blwfcache = deva_initialize(font,attr) -- todo: a hash[font] + local reph, vattu, blwfcache = initialize_one(font,attr) -- todo: a hash[font] local current = start local n = getnext(start) @@ -677,40 +771,40 @@ local function deva_reorder(head,start,stop,font,attr,nbspaces) lastcons = current current = getnext(current) if current ~= stop then - if nukta[getchar(current)] then + local char = getchar(current) + if nukta[char] then current = getnext(current) + char = getchar(current) end - if getchar(current) == c_zwj then - if current ~= stop then - local next = getnext(current) - if next ~= stop and halant[getchar(next)] then - current = next - next = getnext(current) - local tmp = next and getnext(next) or nil -- needs checking - local changestop = next == stop - local tempcurrent = copy_node(next) - copyinjection(tempcurrent,next) - local nextcurrent = copy_node(current) - copyinjection(nextcurrent,current) -- KE: necessary? HH: probably not as positioning comes later and we rawget/set - setlink(tempcurrent,nextcurrent) - setprop(tempcurrent,a_state,s_blwf) - tempcurrent = processcharacters(tempcurrent,font) - setprop(tempcurrent,a_state,unsetvalue) - if getchar(next) == getchar(tempcurrent) then - flush_list(tempcurrent) - local n = copy_node(current) - copyinjection(n,current) -- KE: necessary? HH: probably not as positioning comes later and we rawget/set - setchar(current,dotted_circle) - head = insert_node_after(head, current, n) - else - setchar(current,getchar(tempcurrent)) -- we assumes that the result of blwf consists of one node - local freenode = getnext(current) - setlink(current,tmp) - flush_node(freenode) - flush_list(tempcurrent) - if changestop then - stop = current - end + if char == c_zwj and current ~= stop then + local next = getnext(current) + if next ~= stop and halant[getchar(next)] then + current = next + next = getnext(current) + local tmp = next and getnext(next) or nil -- needs checking + local changestop = next == stop + local tempcurrent = copy_node(next) + copyinjection(tempcurrent,next) + local nextcurrent = copy_node(current) + copyinjection(nextcurrent,current) -- KE: necessary? HH: probably not as positioning comes later and we rawget/set + setlink(tempcurrent,nextcurrent) + setprop(tempcurrent,a_state,s_blwf) + tempcurrent = processcharacters(tempcurrent,font) + setprop(tempcurrent,a_state,unsetvalue) + if getchar(next) == getchar(tempcurrent) then + flush_list(tempcurrent) + local n = copy_node(current) + copyinjection(n,current) -- KE: necessary? HH: probably not as positioning comes later and we rawget/set + setchar(current,dotted_circle) + head = insert_node_after(head, current, n) + else + setchar(current,getchar(tempcurrent)) -- we assumes that the result of blwf consists of one node + local freenode = getnext(current) + setlink(current,tmp) + flush_node(freenode) + flush_list(tempcurrent) + if changestop then + stop = current end end end @@ -1017,41 +1111,39 @@ function handlers.devanagari_reorder_matras(head,start) -- no leak return head, start, true end --- todo: way more caching of attributes and font - --- Reph’s original position is always at the beginning of the syllable, (i.e. it is not reordered at the character reordering stage). --- However, it will be reordered according to the basic-forms shaping results. --- Possible positions for reph, depending on the script, are; after main, before post-base consonant forms, --- and after post-base consonant forms. - --- 1 If reph should be positioned after post-base consonant forms, proceed to step 5. --- 2 If the reph repositioning class is not after post-base: target position is after the first explicit halant glyph between --- the first post-reph consonant and last main consonant. If ZWJ or ZWNJ are following this halant, position is moved after it. --- If such position is found, this is the target position. Otherwise, proceed to the next step. --- Note: in old-implementation fonts, where classifications were fixed in shaping engine, --- there was no case where reph position will be found on this step. --- 3 If reph should be repositioned after the main consonant: from the first consonant not ligated with main, --- or find the first consonant that is not a potential pre-base reordering Ra. --- 4 If reph should be positioned before post-base consonant, find first post-base classified consonant not ligated with main. --- If no consonant is found, the target position should be before the first matra, syllable modifier sign or vedic sign. --- 5 If no consonant is found in steps 3 or 4, move reph to a position immediately before the first post-base matra, --- syllable modifier sign or vedic sign that has a reordering class after the intended reph position. --- For example, if the reordering position for reph is post-main, it will skip above-base matras that also have a post-main position. --- 6 Otherwise, reorder reph to the end of the syllable. - --- hm, this only looks at the start of a nodelist ... is this supposed to be line based? +-- Reph’s original position is always at the beginning of the syllable, (i.e. it is +-- not reordered at the character reordering stage). However, it will be reordered +-- according to the basic-forms shaping results. Possible positions for reph, +-- depending on the script, are; after main, before post-base consonant forms, and +-- after post-base consonant forms. + +-- In Devanagari reph has reordering position 'before postscript' and dev2 only +-- follows step 2, 4, and 6. function handlers.devanagari_reorder_reph(head,start) - -- since in Devanagari reph has reordering position 'before postscript' dev2 only follows step 2, 4, and 6, - -- the other steps are still ToDo (required for scripts other than dev2) local current = getnext(start) local startnext = nil local startprev = nil local startfont = getfont(start) local startattr = getprop(start,a_syllabe) + -- + ::step_1:: + -- + -- If reph should be positioned after post-base consonant forms, proceed to step 5. + -- + ::step_2:: + -- + -- If the reph repositioning class is not after post-base: target position is after + -- the first explicit halant glyph between the first post-reph consonant and last + -- main consonant. If ZWJ or ZWNJ are following this halant, position is moved after + -- it. If such position is found, this is the target position. Otherwise, proceed to + -- the next step. Note: in old-implementation fonts, where classifications were + -- fixed in shaping engine, there was no case where reph position will be found on + -- this step. + -- while current do local char = ischar(current,startfont) - if char and getprop(current,a_syllabe) == startattr then -- step 2 + if char and getprop(current,a_syllabe) == startattr then if halant[char] and not getprop(current,a_state) then local next = getnext(current) if next then @@ -1075,11 +1167,25 @@ function handlers.devanagari_reorder_reph(head,start) break end end + ::step_3:: + -- + -- If reph should be repositioned after the main consonant: from the first consonant + -- not ligated with main, or find the first consonant that is not a potential + -- pre-base reordering Ra. + -- + -- Kai: todo + -- + ::step_4:: + -- + -- If reph should be positioned before post-base consonant, find first post-base + -- classified consonant not ligated with main. If no consonant is found, the target + -- position should be before the first matra, syllable modifier sign or vedic sign. + -- if not startnext then current = getnext(start) while current do local char = ischar(current,startfont) - if char and getprop(current,a_syllabe) == startattr then -- step 4 + if char and getprop(current,a_syllabe) == startattr then if getprop(current,a_state) == s_pstf then -- post-base startnext = getnext(start) head = remove_node(head,start) @@ -1096,15 +1202,21 @@ function handlers.devanagari_reorder_reph(head,start) end end end - -- todo: determine position for reph with reordering position other than 'before postscript' - -- (required for scripts other than dev2) - -- leaks + -- + ::step_5:: + -- + -- If no consonant is found in steps 3 or 4, move reph to a position immediately + -- before the first post-base matra, syllable modifier sign or vedic sign that has a + -- reordering class after the intended reph position. For example, if the reordering + -- position for reph is post-main, it will skip above-base matras that also have a + -- post-main position. + -- if not startnext then current = getnext(start) local c = nil while current do local char = ischar(current,startfont) - if char and getprop(current,a_syllabe) == startattr then -- step 5 + if char and getprop(current,a_syllabe) == startattr then if not c and mark_above_below_post[char] and after_subscript[char] then c = current end @@ -1125,13 +1237,17 @@ function handlers.devanagari_reorder_reph(head,start) startattr = getprop(start,a_syllabe) end end - -- leaks + -- + ::step_6:: + -- + -- Otherwise, reorder reph to the end of the syllable. + -- if not startnext then current = start local next = getnext(current) while next do local nextchar = ischar(next,startfont) - if nextchar and getprop(next,a_syllabe) == startattr then --step 6 + if nextchar and getprop(next,a_syllabe) == startattr then current = next next = getnext(current) else @@ -1151,13 +1267,13 @@ function handlers.devanagari_reorder_reph(head,start) return head, start, true end --- we can cache some checking (v) - -- If a pre-base reordering consonant is found, reorder it according to the following rules: -- --- 1 Only reorder a glyph produced by substitution during application of the feature. --- (Note that a font may shape a Ra consonant with the feature generally but block it in certain contexts.) --- 2 Try to find a target position the same way as for pre-base matra. If it is found, reorder pre-base consonant glyph. +-- 1 Only reorder a glyph produced by substitution during application of the feature. (Note +-- that a font may shape a Ra consonant with the feature generally but block it in certain +-- contexts.) +-- 2 Try to find a target position the same way as for pre-base matra. If it is found, reorder +-- pre-base consonant glyph. -- 3 If position is not found, reorder immediately before main consonant. -- Here we implement a few handlers: @@ -1251,7 +1367,7 @@ function handlers.devanagari_remove_joiners(head,start,kind,lookupname,replaceme return head, stop, true end -local function dev2_initialize(font,attr) +local function initialize_two(font,attr) local devanagari = fontdata[font].resources.devanagari @@ -1266,9 +1382,9 @@ end -- this one will be merged into the caller: it saves a call, but we will then make function -- of the actions -local function dev2_reorder(head,start,stop,font,attr,nbspaces) -- maybe do a pass over (determine stop in sweep) +local function reorder_two(head,start,stop,font,attr,nbspaces) -- maybe do a pass over (determine stop in sweep) - local seqsubset, reorderreph = dev2_initialize(font,attr) + local seqsubset, reorderreph = initialize_two(font,attr) local reph = false -- was nil ... probably went unnoticed because never assigned local halfpos = nil @@ -1279,7 +1395,7 @@ local function dev2_reorder(head,start,stop,font,attr,nbspaces) -- maybe do a pa for i=1,#seqsubset do - -- maybe quit if start == stop + -- this can be done more efficient, the last test and less getnext local subset = seqsubset[i] local kind = subset[1] @@ -1298,8 +1414,7 @@ local function dev2_reorder(head,start,stop,font,attr,nbspaces) -- maybe do a pa if found[n] then --above-base: rphf Consonant + Halant local afternext = next ~= stop and getnext(next) if afternext and zw_char[getchar(afternext)] then -- ZWJ and ZWNJ prevent creation of reph - current = next - current = getnext(current) + current = afternext -- getnext(next) elseif current == start then setprop(current,a_state,s_rphf) current = next @@ -1943,10 +2058,12 @@ local function analyze_next_chars_two(c,font) end end -local function inject_syntax_error(head,current,mark) +local show_syntax_errors = false + +local function inject_syntax_error(head,current,char) local signal = copy_node(current) copyinjection(signal,current) - if mark == pre_mark then -- THIS IS WRONG: pre_mark is a table + if pre_mark[char] then setchar(signal,dotted_circle) else setchar(current,dotted_circle) @@ -1957,7 +2074,7 @@ end -- It looks like these two analyzers were written independently but they share -- a lot. Common code has been synced. -function methods.deva(head,font,attr) +local function method_one(head,font,attr) head = tonut(head) local current = head local start = true @@ -2006,7 +2123,7 @@ function methods.deva(head,font,attr) local syllableend = analyze_next_chars_one(c,font,2) current = getnext(syllableend) if syllablestart ~= syllableend then - head, current, nbspaces = deva_reorder(head,syllablestart,syllableend,font,attr,nbspaces) + head, current, nbspaces = reorder_one(head,syllablestart,syllableend,font,attr,nbspaces) current = getnext(current) end else @@ -2112,7 +2229,7 @@ function methods.deva(head,font,attr) end end if syllablestart ~= syllableend then - head, current, nbspaces = deva_reorder(head,syllablestart,syllableend,font,attr,nbspaces) + head, current, nbspaces = reorder_one(head,syllablestart,syllableend,font,attr,nbspaces) current = getnext(current) end elseif independent_vowel[char] then @@ -2134,9 +2251,11 @@ function methods.deva(head,font,attr) end end else - local mark = mark_four[char] - if mark then - head, current = inject_syntax_error(head,current,mark) + if show_syntax_errors then + local mark = mark_four[char] + if mark then + head, current = inject_syntax_error(head,current,char) + end end current = getnext(current) end @@ -2151,15 +2270,13 @@ function methods.deva(head,font,attr) head = replace_all_nbsp(head) end - head = tonode(head) - - return head, done + return tonode(head), done end -- there is a good change that when we run into one with subtype < 256 that the rest is also done -- so maybe we can omit this check (it's pretty hard to get glyphs in the stream out of the blue) -function methods.dev2(head,font,attr) +local function method_two(head,font,attr) head = tonut(head) local current = head local start = true @@ -2230,14 +2347,14 @@ function methods.dev2(head,font,attr) end end if syllableend and syllablestart ~= syllableend then - head, current, nbspaces = dev2_reorder(head,syllablestart,syllableend,font,attr,nbspaces) + head, current, nbspaces = reorder_two(head,syllablestart,syllableend,font,attr,nbspaces) end - if not syllableend then + if not syllableend and show_syntax_errors then local char = ischar(current,font) if char and not getprop(current,a_state) then local mark = mark_four[char] if mark then - head, current = inject_syntax_error(head,current,mark) + head, current = inject_syntax_error(head,current,char) end end end @@ -2249,10 +2366,10 @@ function methods.dev2(head,font,attr) head = replace_all_nbsp(head) end - head = tonode(head) - - return head, done + return tonode(head), done end -methods.mlym = methods.deva -methods.mlm2 = methods.dev2 +for i=1,nofscripts do + methods[scripts_one[i]] = method_one + methods[scripts_two[i]] = method_two +end diff --git a/tex/context/base/mkiv/font-pre.mkiv b/tex/context/base/mkiv/font-pre.mkiv index d09d871f0..b49bc560e 100644 --- a/tex/context/base/mkiv/font-pre.mkiv +++ b/tex/context/base/mkiv/font-pre.mkiv @@ -191,59 +191,139 @@ [semitic-simple] [script=hebr] -% \definefont [DevaOne] [file:chandas.ttf*devanagari-one at 12pt] -% \definefont [DevaTwo] [file:kokila.ttf*devanagari-two at 18pt] +% indic \definefontfeature - [devanagari-one] + [indic-common] [mode=node, language=dflt, - script=deva, + % localized + locl=yes, + % positioning + kern=yes, + dist=yes, + % above/below base marks + abvm=yes, + blwm=yes, + % basic shaping nukt=yes, akhn=yes, rphf=yes, - blwf=yes, - half=yes, - vatu=yes, + % presentation pres=yes, abvs=yes, blws=yes, psts=yes, haln=yes, - abvm=yes, - blwm=yes, - dist=yes] + calt=yes] \definefontfeature - [devanagari-two] [devanagari-one] - [script=dev2, - locl=yes, - pref=yes, + [indic-common] + [script=deva, + % basic shaping rkrf=yes, + blwf=yes, + half=yes, + vatu=yes, + cjct=yes] + +\definefontfeature + [bengali-one] + [indic-common] + [script=beng, + % basic shaping + blwf=yes, + half=yes, pstf=yes, + vatu=yes, cjct=yes, - init=yes, - calt=yes, - kern=yes] + % presentation + init=yes] \definefontfeature - [malayalam-one] - [mode=node, - language=dflt, - script=mlym, - akhn=yes, + [gujarati-one] + [indic-common] + [script=gujr, + % basic shaping + rkrf=yes, blwf=yes, half=yes, - pres=yes, - blws=yes, - psts=yes, - haln=no] + vatu=yes, + cjct=yes] + +\definefontfeature + [gurmukhi-one] + [indic-common] + [script=guru, + % basic shaping + blwf=yes, + half=yes, + pstf=yes, + vatu=yes, + cjct=yes] + +\definefontfeature + [kannada-one] + [indic-common] + [script=knda, + % basic shaping + pref=yes, + blwf=yes, + half=yes, + pstf=yes, + cjct=yes] \definefontfeature - [malayalam-two] [malayalam-one] - [script=mlm2] + [indic-common] + [script=mlym, + % basic shaping + pref=yes, + blwf=yes, + half=yes, + pstf=yes, + cjct=yes] + +\definefontfeature + [oriya-one] + [indic-common] + [script=orya, + % basic shaping + blwf=yes, + pstf=yes, + cjct=yes] + +\definefontfeature + [tamil-one] + [indic-common] + [script=taml, + % basic shaping + pref=yes, + half=yes] + +\definefontfeature + [telugu-one] + [indic-common] + [script=telu, + % basic shaping + pref=yes, + blwf=yes, + half=yes, + pstf=yes, + cjct=yes] + +\definefontfeature [devanagari-two] [devanagari-one] [script=dev2] +\definefontfeature [bengali-two] [bengali-one] [script=bng2] +\definefontfeature [gujarati-two] [gujarati-one] [script=gjr2] +\definefontfeature [gurmukhi-two] [gurmukhi-one] [script=gur2] +\definefontfeature [kannada-two] [kannada-one] [script=knd2] +\definefontfeature [malayalam-two] [malayalam-one] [script=mlm2] +\definefontfeature [oriya-two] [oriya-one] [script=ory2] +\definefontfeature [tamil-two] [tamil-one] [script=tml2] +\definefontfeature [telugu-two] [telugu-one] [script=tel2] + +% cjk \definefontfeature [jamoforms] @@ -251,8 +331,6 @@ tjmo=yes, vjmo=yes] -% cjk - % \definefontfeature % [japanese] % [default] diff --git a/tex/context/base/mkiv/font-sel.lua b/tex/context/base/mkiv/font-sel.lua index 0cf51cad3..e7f56047b 100644 --- a/tex/context/base/mkiv/font-sel.lua +++ b/tex/context/base/mkiv/font-sel.lua @@ -943,5 +943,5 @@ implement { implement { name = "definefontfamilypreset", actions = selectfont.definefontfamilypreset, - arguments = { "string", "string" } + arguments = "2 strings", } diff --git a/tex/context/base/mkiv/grph-fil.lua b/tex/context/base/mkiv/grph-fil.lua index 3c069da37..540356c46 100644 --- a/tex/context/base/mkiv/grph-fil.lua +++ b/tex/context/base/mkiv/grph-fil.lua @@ -101,6 +101,6 @@ end interfaces.implement { name = "runcontextjob", - arguments = { "string", "string" }, + arguments = "2 strings", actions = { jobfiles.context, context } } diff --git a/tex/context/base/mkiv/grph-inc.lua b/tex/context/base/mkiv/grph-inc.lua index 47eb7bbbb..f2d7847eb 100644 --- a/tex/context/base/mkiv/grph-inc.lua +++ b/tex/context/base/mkiv/grph-inc.lua @@ -487,7 +487,7 @@ function figures.setpaths(locationset,pathlist) end end -implement { name = "setfigurepaths", actions = figures.setpaths, arguments = { "string", "string" } } +implement { name = "setfigurepaths", actions = figures.setpaths, arguments = "2 strings" } -- check conversions and handle it here @@ -2014,7 +2014,7 @@ local ctx_doexternalfigurerepeat = context.doexternalfigurerepeat implement { name = "figure_register_page", - arguments = { "string", "string", "string" }, + arguments = "3 strings", actions = function(a,b,c) registered[#registered+1] = { a, b, c } context(#registered) diff --git a/tex/context/base/mkiv/java-ini.lua b/tex/context/base/mkiv/java-ini.lua index 069eb5ab6..61ab15e7a 100644 --- a/tex/context/base/mkiv/java-ini.lua +++ b/tex/context/base/mkiv/java-ini.lua @@ -246,13 +246,13 @@ implement { implement { name = "setjavascriptpreamble", actions = javascripts.setpreamble, - arguments = { "string", "string" } + arguments = "2 strings", } implement { name = "addtojavascriptpreamble", actions = javascripts.addtopreamble, - arguments = { "string", "string" } + arguments = "2 strings", } implement { diff --git a/tex/context/base/mkiv/lang-hyp.lua b/tex/context/base/mkiv/lang-hyp.lua index f73a51b3a..e29446b65 100644 --- a/tex/context/base/mkiv/lang-hyp.lua +++ b/tex/context/base/mkiv/lang-hyp.lua @@ -980,7 +980,7 @@ featureset.hyphenonly = hyphenonly == v_yes implement { name = "registerhyphenationexception", actions = traditional.registerexception, - arguments = { "string", "string" } + arguments = "2 strings", } -- This is a relative large function with local variables and local functions. A previous @@ -1725,7 +1725,7 @@ featureset.hyphenonly = hyphenonly == v_yes implement { name = "showhyphenationtrace", actions = hyphenators.showhyphenationtrace, - arguments = { "string", "string" } + arguments = "2 strings", } function nodes.stripdiscretionaries(head) diff --git a/tex/context/base/mkiv/lang-ini.lua b/tex/context/base/mkiv/lang-ini.lua index 6d202ff5a..30e086e15 100644 --- a/tex/context/base/mkiv/lang-ini.lua +++ b/tex/context/base/mkiv/lang-ini.lua @@ -612,7 +612,7 @@ end) implement { name = "languagenumber", actions = { languages.getnumber, context }, - arguments = { "string", "string", "string", "string" } + arguments = "4 strings" } implement { @@ -623,25 +623,25 @@ implement { implement { name = "definelanguage", actions = languages.define, - arguments = { "string", "string" } + arguments = "2 strings" } implement { name = "setlanguagesynonym", actions = languages.setsynonym, - arguments = { "string", "string" } + arguments = "2 strings" } implement { name = "unloadlanguage", actions = languages.unload, - arguments = { "string" } + arguments = "string" } implement { name = "setlanguageexceptions", actions = languages.setexceptions, - arguments = { "string", "string" } + arguments = "2 strings" } implement { diff --git a/tex/context/base/mkiv/lang-rep.lua b/tex/context/base/mkiv/lang-rep.lua index 172454fc2..a5c4d97c8 100644 --- a/tex/context/base/mkiv/lang-rep.lua +++ b/tex/context/base/mkiv/lang-rep.lua @@ -366,11 +366,11 @@ implement { implement { name = "addreplacements", actions = replacements.add, - arguments = { "string", "string", "string" } + arguments = "3 strings", } implement { name = "addreplacementslist", actions = replacements.addlist, - arguments = { "string", "string" } + arguments = "2 strings", } diff --git a/tex/context/base/mkiv/lang-url.lua b/tex/context/base/mkiv/lang-url.lua index 651c6bd52..95d959206 100644 --- a/tex/context/base/mkiv/lang-url.lua +++ b/tex/context/base/mkiv/lang-url.lua @@ -214,7 +214,7 @@ end implement { name = "sethyphenatedurlcharacters", actions = urls.setcharacters, - arguments = { "string", "string" } + arguments = "2 strings", } implement { diff --git a/tex/context/base/mkiv/lang-wrd.lua b/tex/context/base/mkiv/lang-wrd.lua index b00375cc0..7363dbb31 100644 --- a/tex/context/base/mkiv/lang-wrd.lua +++ b/tex/context/base/mkiv/lang-wrd.lua @@ -420,6 +420,6 @@ implement { implement { name = "loadspellchecklist", - arguments = { "string", "string" }, + arguments = "2 strings", actions = words.load } diff --git a/tex/context/base/mkiv/luat-ini.mkiv b/tex/context/base/mkiv/luat-ini.mkiv index 25ad7e139..872d27e77 100644 --- a/tex/context/base/mkiv/luat-ini.mkiv +++ b/tex/context/base/mkiv/luat-ini.mkiv @@ -265,16 +265,52 @@ % \def\syst_helpers_checked_stripped_csname#1% % {\if\noexpand#1\letterbackslash\else#1\fi} -\normalprotected\def\installctxfunction#1#2% +\normalprotected\def\installctxfunction#1#2% expandable {\edef\m_syst_name{\csstring#1}% \global\expandafter\chardef\csname\??luafunction\m_syst_name\endcsname\ctxcommand{ctxfunction("#2",true)}\relax \expandafter\xdef\csname\m_syst_name\endcsname{\noexpand\luafunction\csname\??luafunction\m_syst_name\endcsname}} -\normalprotected\def\installctxscanner#1#2% +\normalprotected\def\installctxscanner#1#2% expandable {\edef\m_syst_name{\csstring#1}% \global\expandafter\chardef\csname\??luafunction\m_syst_name\endcsname\ctxcommand{ctxscanner("\m_syst_name","#2",true)}\relax \expandafter\xdef\csname\m_syst_name\endcsname{\noexpand\luafunction\csname\??luafunction\m_syst_name\endcsname}} +\normalprotected\def\installprotectedctxfunction#1#2% protected + {\edef\m_syst_name{\csstring#1}% + \global\expandafter\chardef\csname\??luafunction\m_syst_name\endcsname\ctxcommand{ctxfunction("#2",true)}\relax + \expandafter\xdef\csname\m_syst_name\endcsname{\noexpand\luafunction\csname\??luafunction\m_syst_name\endcsname}} + +\normalprotected\def\installprotectedctxscanner#1#2% protected + {\edef\m_syst_name{\csstring#1}% + \global\expandafter\chardef\csname\??luafunction\m_syst_name\endcsname\ctxcommand{ctxscanner("\m_syst_name","#2",true)}\relax + \expandafter\xdef\csname\m_syst_name\endcsname{\noexpand\luafunction\csname\??luafunction\m_syst_name\endcsname}} + +% not yet used + +\ifdefined\luafunctioncall \else + \protected\def\luafunctioncall{\luafunctioncall} +\fi + +\normalprotected\def\installctxfunctioncall#1#2% + {\edef\m_syst_name{\csstring#1}% + \global\expandafter\chardef\csname\??luafunction\m_syst_name\endcsname\ctxcommand{ctxfunction("#2",true)}\relax + \expandafter\xdef\csname\m_syst_name\endcsname{\luafunctioncall\csname\??luafunction\m_syst_name\endcsname}} + +\normalprotected\def\installctxscannercall#1#2% + {\edef\m_syst_name{\csstring#1}% + \global\expandafter\chardef\csname\??luafunction\m_syst_name\endcsname\ctxcommand{ctxscanner("\m_syst_name","#2",true)}\relax + \expandafter\xdef\csname\m_syst_name\endcsname{\luafunctioncall\csname\??luafunction\m_syst_name\endcsname}} + +\normalprotected\def\installprotectedctxfunctioncall#1#2% + {\edef\m_syst_name{\csstring#1}% + \global\expandafter\chardef\csname\??luafunction\m_syst_name\endcsname\ctxcommand{ctxfunction("#2",true)}\relax + \normalprotected\expandafter\xdef\csname\m_syst_name\endcsname{\luafunctioncall\csname\??luafunction\m_syst_name\endcsname}} + +\normalprotected\def\installprotectedctxscannercall#1#2% + {\edef\m_syst_name{\csstring#1}% + \global\expandafter\chardef\csname\??luafunction\m_syst_name\endcsname\ctxcommand{ctxscanner("\m_syst_name","#2",true)}\relax + \normalprotected\expandafter\xdef\csname\m_syst_name\endcsname{\luafunctioncall\csname\??luafunction\m_syst_name\endcsname}} + \normalprotected\def\resetctxscanner#1% {\edef\m_syst_name{\csstring#1}% \global\expandafter\chardef\csname\??luafunction\m_syst_name\endcsname\zerocount diff --git a/tex/context/base/mkiv/luat-usr.lua b/tex/context/base/mkiv/luat-usr.lua index e7406782b..ebcb0f0e8 100644 --- a/tex/context/base/mkiv/luat-usr.lua +++ b/tex/context/base/mkiv/luat-usr.lua @@ -101,7 +101,7 @@ interfaces.implement { interfaces.implement { name = "luathread", actions = runthread, - arguments = { "string", "string" } + arguments = "2 strings", } -- local scanners = interfaces.scanners @@ -177,7 +177,7 @@ lua.registername = registername implement { name = "registernamedlua", - arguments = { "string", "string", "string" }, + arguments = "3 strings", actions = function(name,message,csname) if csname and csname ~= "" then implement { diff --git a/tex/context/base/mkiv/lxml-css.lua b/tex/context/base/mkiv/lxml-css.lua index a4d15ba1f..1787c53df 100644 --- a/tex/context/base/mkiv/lxml-css.lua +++ b/tex/context/base/mkiv/lxml-css.lua @@ -985,11 +985,11 @@ end interfaces.implement { name = "xmlstylevalue", actions = css.stylevalue, - arguments = { "string", "string" }, + arguments = "2 strings", } interfaces.implement { name = "xmlmappedstylevalue", actions = css.mappedstylevalue, - arguments = { "string", "string", "string" }, + arguments = "3 strings", } diff --git a/tex/context/base/mkiv/lxml-ini.lua b/tex/context/base/mkiv/lxml-ini.lua index f7f882cee..b255477cb 100644 --- a/tex/context/base/mkiv/lxml-ini.lua +++ b/tex/context/base/mkiv/lxml-ini.lua @@ -23,16 +23,16 @@ local implement = interfaces.implement implement { name = "lxmlid", actions = lxml.getid, arguments = "string" } -implement { name = "xmldoif", actions = lxml.doif, arguments = { "string", "string" } } -implement { name = "xmldoifnot", actions = lxml.doifnot, arguments = { "string", "string" } } -implement { name = "xmldoifelse", actions = lxml.doifelse, arguments = { "string", "string" } } -implement { name = "xmldoiftext", actions = lxml.doiftext, arguments = { "string", "string" } } -implement { name = "xmldoifnottext", actions = lxml.doifnottext, arguments = { "string", "string" } } -implement { name = "xmldoifelsetext", actions = lxml.doifelsetext, arguments = { "string", "string" } } - -implement { name = "xmldoifempty", actions = lxml.doifempty, arguments = { "string", "string" } } -implement { name = "xmldoifnotempty", actions = lxml.doifnotempty, arguments = { "string", "string" } } -implement { name = "xmldoifelseempty", actions = lxml.doifelseempty, arguments = { "string", "string" } } +implement { name = "xmldoif", actions = lxml.doif, arguments = "2 strings" } +implement { name = "xmldoifnot", actions = lxml.doifnot, arguments = "2 strings" } +implement { name = "xmldoifelse", actions = lxml.doifelse, arguments = "2 strings" } +implement { name = "xmldoiftext", actions = lxml.doiftext, arguments = "2 strings" } +implement { name = "xmldoifnottext", actions = lxml.doifnottext, arguments = "2 strings" } +implement { name = "xmldoifelsetext", actions = lxml.doifelsetext, arguments = "2 strings" } + +implement { name = "xmldoifempty", actions = lxml.doifempty, arguments = "2 strings" } +implement { name = "xmldoifnotempty", actions = lxml.doifnotempty, arguments = "2 strings" } +implement { name = "xmldoifelseempty", actions = lxml.doifelseempty, arguments = "2 strings" } implement { name = "xmldoifselfempty", actions = lxml.doifempty, arguments = "string" } -- second arg is not passed (used) implement { name = "xmldoifnotselfempty", actions = lxml.doifnotempty, arguments = "string" } -- second arg is not passed (used) implement { name = "xmldoifelseselfempty", actions = lxml.doifelseempty, arguments = "string" } -- second arg is not passed (used) @@ -40,88 +40,88 @@ implement { name = "xmldoifelseselfempty", actions = lxml.doifelseempty, arg --------- { name = "xmlcontent", actions = lxml.content, arguments = "string" } --------- { name = "xmlflushstripped", actions = lxml.strip, arguments = { "string", true } } -implement { name = "xmlall", actions = lxml.all, arguments = { "string", "string" } } -implement { name = "xmlatt", actions = lxml.att, arguments = { "string", "string" } } -implement { name = "xmlattdef", actions = lxml.att, arguments = { "string", "string", "string" } } -implement { name = "xmlattribute", actions = lxml.attribute, arguments = { "string", "string", "string" } } -implement { name = "xmlattributedef", actions = lxml.attribute, arguments = { "string", "string", "string", "string" } } +implement { name = "xmlall", actions = lxml.all, arguments = "2 strings" } +implement { name = "xmlatt", actions = lxml.att, arguments = "2 strings" } +implement { name = "xmlattdef", actions = lxml.att, arguments = "3 strings" } +implement { name = "xmlattribute", actions = lxml.attribute, arguments = "3 strings" } +implement { name = "xmlattributedef", actions = lxml.attribute, arguments = "4 strings" } implement { name = "xmlbadinclusions", actions = lxml.badinclusions, arguments = "string" } implement { name = "xmlchainatt", actions = lxml.chainattribute, arguments = { "string", "'/'", "string" } } implement { name = "xmlchainattdef", actions = lxml.chainattribute, arguments = { "string", "'/'", "string", "string" } } implement { name = "xmlchecknamespace", actions = xml.checknamespace, arguments = { "lxmlid", "string", "string" } } -implement { name = "xmlcommand", actions = lxml.command, arguments = { "string", "string", "string" } } -implement { name = "xmlconcat", actions = lxml.concat, arguments = { "string", "string", "string" } } -- \detokenize{#3} +implement { name = "xmlcommand", actions = lxml.command, arguments = "3 strings" } +implement { name = "xmlconcat", actions = lxml.concat, arguments = "3 strings" } -- \detokenize{#3} implement { name = "xmlconcatrange", actions = lxml.concatrange, arguments = { "string", "string", "string", "string", "string" } } -- \detokenize{#5} -implement { name = "xmlcontext", actions = lxml.context, arguments = { "string", "string" } } -implement { name = "xmlcount", actions = lxml.count, arguments = { "string", "string" } } -implement { name = "xmldelete", actions = lxml.delete, arguments = { "string", "string" } } +implement { name = "xmlcontext", actions = lxml.context, arguments = "2 strings" } +implement { name = "xmlcount", actions = lxml.count, arguments = "2 strings" } +implement { name = "xmldelete", actions = lxml.delete, arguments = "2 strings" } implement { name = "xmldirect", actions = lxml.direct, arguments = "string" } implement { name = "xmldirectives", actions = lxml.directives.setup, arguments = "string" } implement { name = "xmldirectivesafter", actions = lxml.directives.after, arguments = "string" } implement { name = "xmldirectivesbefore", actions = lxml.directives.before, arguments = "string" } implement { name = "xmldisplayverbatim", actions = lxml.displayverbatim, arguments = "string" } -implement { name = "xmlelement", actions = lxml.element, arguments = { "string", "string" } } -- could be integer but now we can alias -implement { name = "xmlfilter", actions = lxml.filter, arguments = { "string", "string" } } -implement { name = "xmlfilterlist", actions = lxml.filterlist, arguments = { "string", "string" } } -implement { name = "xmlfirst", actions = lxml.first, arguments = { "string", "string" } } +implement { name = "xmlelement", actions = lxml.element, arguments = "2 strings" } -- could be integer but now we can alias +implement { name = "xmlfilter", actions = lxml.filter, arguments = "2 strings" } +implement { name = "xmlfilterlist", actions = lxml.filterlist, arguments = "2 strings" } +implement { name = "xmlfirst", actions = lxml.first, arguments = "2 strings" } implement { name = "xmlflush", actions = lxml.flush, arguments = "string" } implement { name = "xmlflushcontext", actions = lxml.context, arguments = "string" } implement { name = "xmlflushlinewise", actions = lxml.flushlinewise, arguments = "string" } implement { name = "xmlflushpure", actions = lxml.pure, arguments = "string" } implement { name = "xmlflushspacewise", actions = lxml.flushspacewise, arguments = "string" } implement { name = "xmlflushtext", actions = lxml.text, arguments = "string" } -implement { name = "xmlfunction", actions = lxml.applyfunction, arguments = { "string", "string" } } +implement { name = "xmlfunction", actions = lxml.applyfunction, arguments = "2 strings" } implement { name = "xmlinclude", actions = lxml.include, arguments = { "string", "string", "string", true } } -implement { name = "xmlincludeoptions", actions = lxml.include, arguments = { "string", "string", "string", "string" } } +implement { name = "xmlincludeoptions", actions = lxml.include, arguments = "4 strings" } implement { name = "xmlinclusion", actions = lxml.inclusion, arguments = "string" } implement { name = "xmlinclusionbase", actions = lxml.inclusion, arguments = { "string", false, true } } implement { name = "xmlinclusions", actions = lxml.inclusions, arguments = "string" } -implement { name = "xmlindex", actions = lxml.index, arguments = { "string", "string", "string" } } -- can be integer but now we can alias +implement { name = "xmlindex", actions = lxml.index, arguments = "3 strings" } -- can be integer but now we can alias implement { name = "xmlinlineverbatim", actions = lxml.inlineverbatim, arguments = "string" } -implement { name = "xmllast", actions = lxml.last, arguments = { "string", "string" } } +implement { name = "xmllast", actions = lxml.last, arguments = "2 strings" } implement { name = "xmllastatt", actions = lxml.lastatt } implement { name = "xmllastmatch", actions = lxml.lastmatch } implement { name = "xmllastpar", actions = lxml.lastpar } -implement { name = "xmlload", actions = lxml.load, arguments = { "string", "string", "string" } } -implement { name = "xmlloadbuffer", actions = lxml.loadbuffer, arguments = { "string", "string", "string" } } -implement { name = "xmlloaddata", actions = lxml.loaddata, arguments = { "string", "string", "string" } } +implement { name = "xmlload", actions = lxml.load, arguments = "3 strings" } +implement { name = "xmlloadbuffer", actions = lxml.loadbuffer, arguments = "3 strings" } +implement { name = "xmlloaddata", actions = lxml.loaddata, arguments = "3 strings" } implement { name = "xmlloaddirectives", actions = lxml.directives.load, arguments = "string" } implement { name = "xmlmain", actions = lxml.main, arguments = "string" } implement { name = "xmlmatch", actions = lxml.match, arguments = "string" } implement { name = "xmlname", actions = lxml.name, arguments = "string" } implement { name = "xmlnamespace", actions = lxml.namespace, arguments = "string" } -implement { name = "xmlnonspace", actions = lxml.nonspace, arguments = { "string", "string" } } -implement { name = "xmlpar", actions = lxml.par, arguments = { "string", "string" } } -implement { name = "xmlparam", actions = lxml.param, arguments = { "string", "string", "string" } } +implement { name = "xmlnonspace", actions = lxml.nonspace, arguments = "2 strings" } +implement { name = "xmlpar", actions = lxml.par, arguments = "2 strings" } +implement { name = "xmlparam", actions = lxml.param, arguments = "3 strings" } implement { name = "xmlpath", actions = lxml.path, arguments = { "string", "'/'" } } implement { name = "xmlpopmatch", actions = lxml.popmatch } implement { name = "xmlpos", actions = lxml.pos, arguments = "string" } -implement { name = "xmlpure", actions = lxml.pure, arguments = { "string", "string" } } +implement { name = "xmlpure", actions = lxml.pure, arguments = "2 strings" } implement { name = "xmlpushmatch", actions = lxml.pushmatch } -implement { name = "xmlraw", actions = lxml.raw, arguments = { "string", "string" } } -implement { name = "xmlrawtex", actions = lxml.rawtex, arguments = { "string", "string" } } -implement { name = "xmlrefatt", actions = lxml.refatt, arguments = { "string", "string" } } -implement { name = "xmlregisterns", actions = xml.registerns, arguments = { "string", "string" } } +implement { name = "xmlraw", actions = lxml.raw, arguments = "2 strings" } +implement { name = "xmlrawtex", actions = lxml.rawtex, arguments = "2 strings" } +implement { name = "xmlrefatt", actions = lxml.refatt, arguments = "2 strings" } +implement { name = "xmlregisterns", actions = xml.registerns, arguments = "2 strings" } implement { name = "xmlremapname", actions = xml.remapname, arguments = { "lxmlid", "string","string","string" } } implement { name = "xmlremapnamespace", actions = xml.renamespace, arguments = { "lxmlid", "string", "string" } } -implement { name = "xmlsave", actions = lxml.save, arguments = { "string", "string" } } -implement { name = "xmlsetatt", actions = lxml.setatt, arguments = { "string", "string", "string" } } -implement { name = "xmlsetattribute", actions = lxml.setattribute, arguments = { "string", "string", "string", "string" } } -implement { name = "xmlsetpar", actions = lxml.setpar, arguments = { "string", "string", "string" } } -implement { name = "xmlsetparam", actions = lxml.setparam, arguments = { "string", "string", "string", "string" } } -implement { name = "xmlsetsetup", actions = lxml.setsetup, arguments = { "string", "string", "string" } } -implement { name = "xmlsnippet", actions = lxml.snippet, arguments = { "string", "string" } } -implement { name = "xmlstrip", actions = lxml.strip, arguments = { "string", "string" } } +implement { name = "xmlsave", actions = lxml.save, arguments = "2 strings" } +implement { name = "xmlsetatt", actions = lxml.setatt, arguments = "3 strings" } +implement { name = "xmlsetattribute", actions = lxml.setattribute, arguments = "4 strings" } +implement { name = "xmlsetpar", actions = lxml.setpar, arguments = "3 strings" } +implement { name = "xmlsetparam", actions = lxml.setparam, arguments = "4 strings" } +implement { name = "xmlsetsetup", actions = lxml.setsetup, arguments = "3 strings" } +implement { name = "xmlsnippet", actions = lxml.snippet, arguments = "2 strings" } +implement { name = "xmlstrip", actions = lxml.strip, arguments = "2 strings" } implement { name = "xmlstripanywhere", actions = lxml.strip, arguments = { "string", "string", true, true } } implement { name = "xmlstripnolines", actions = lxml.strip, arguments = { "string", "string", true } } -implement { name = "xmlstripped", actions = lxml.stripped, arguments = { "string", "string" } } +implement { name = "xmlstripped", actions = lxml.stripped, arguments = "2 strings" } implement { name = "xmlstrippednolines", actions = lxml.stripped, arguments = { "string", "string", true } } implement { name = "xmltag", actions = lxml.tag, arguments = "string" } -implement { name = "xmltext", actions = lxml.text, arguments = { "string", "string" } } -implement { name = "xmltobuffer", actions = lxml.tobuffer, arguments = { "string", "string", "string" } } +implement { name = "xmltext", actions = lxml.text, arguments = "2 strings" } +implement { name = "xmltobuffer", actions = lxml.tobuffer, arguments = "3 strings" } implement { name = "xmltobuffertextonly", actions = lxml.tobuffer, arguments = { "string", "string", "string", false } } implement { name = "xmltobufferverbose", actions = lxml.tobuffer, arguments = { "string", "string", "string", true, true } } -implement { name = "xmltofile", actions = lxml.tofile, arguments = { "string", "string", "string" } } +implement { name = "xmltofile", actions = lxml.tofile, arguments = "3 strings" } implement { name = "xmltoparameters", actions = lxml.toparameters, arguments = "string" } implement { name = "xmlverbatim", actions = lxml.verbatim, arguments = "string" } @@ -132,15 +132,15 @@ implement { name = "xmlprependsetup", actions = lxml.installsetup, arg implement { name = "xmlappendsetup", actions = lxml.installsetup, arguments = { 2, "string", "string" } } -- 2:* implement { name = "xmlbeforesetup", actions = lxml.installsetup, arguments = { 3, "string", "string", "string" } } -- 2:* implement { name = "xmlaftersetup", actions = lxml.installsetup, arguments = { 4, "string", "string", "string" } } -- 2:* -implement { name = "xmlremovesetup", actions = lxml.removesetup, arguments = { "string", "string" } } -- 1:* -implement { name = "xmlflushsetups", actions = lxml.flushsetups, arguments = { "string", "string", "string" } } -- 2:* +implement { name = "xmlremovesetup", actions = lxml.removesetup, arguments = "2 strings" } -- 1:* +implement { name = "xmlflushsetups", actions = lxml.flushsetups, arguments = "3 strings" } -- 2:* implement { name = "xmlresetsetups", actions = lxml.resetsetups, arguments = "string" } -implement { name = "xmlgetindex", actions = lxml.getindex, arguments = { "string", "string" } } -implement { name = "xmlwithindex", actions = lxml.withindex, arguments = { "string", "string", "string" } } +implement { name = "xmlgetindex", actions = lxml.getindex, arguments = "2 strings" } +implement { name = "xmlwithindex", actions = lxml.withindex, arguments = "3 strings" } -implement { name = "xmlsetentity", actions = xml.registerentity, arguments = { "string", "string" } } -implement { name = "xmltexentity", actions = lxml.registerentity, arguments = { "string", "string" } } +implement { name = "xmlsetentity", actions = xml.registerentity, arguments = "2 strings" } +implement { name = "xmltexentity", actions = lxml.registerentity, arguments = "2 strings" } implement { name = "xmlsetcommandtotext", actions = lxml.setcommandtotext, arguments = "string" } implement { name = "xmlsetcommandtonone", actions = lxml.setcommandtonone, arguments = "string" } diff --git a/tex/context/base/mkiv/lxml-ini.mkiv b/tex/context/base/mkiv/lxml-ini.mkiv index 6f64e545b..7c97ffb2c 100644 --- a/tex/context/base/mkiv/lxml-ini.mkiv +++ b/tex/context/base/mkiv/lxml-ini.mkiv @@ -187,6 +187,10 @@ \let\xmldoifnottext \clf_xmldoifnottext \let\xmldoifelsetext \clf_xmldoifelsetext +\let\xmldoifatt \clf_xmldoifatt +\let\xmldoifnotatt \clf_xmldoifnotatt +\let\xmldoifelseatt \clf_xmldoifelseatt + \let\xmldoifempty \clf_xmldoifempty \let\xmldoifnotempty \clf_xmldoifnotempty \let\xmldoifelseempty \clf_xmldoifelseempty diff --git a/tex/context/base/mkiv/lxml-tab.lua b/tex/context/base/mkiv/lxml-tab.lua index 8d4be58ab..1ef83c47d 100644 --- a/tex/context/base/mkiv/lxml-tab.lua +++ b/tex/context/base/mkiv/lxml-tab.lua @@ -14,7 +14,7 @@ if not modules then modules = { } end modules ['lxml-tab'] = { -- maybe when letter -> utf, else name .. then we need an option to the serializer .. a bit -- of work so we delay this till we cleanup -local trace_entities = false trackers .register("xml.entities", function(v) trace_entities = v end) +local trace_entities = false trackers.register("xml.entities", function(v) trace_entities = v end) local report_xml = logs and logs.reporter("xml","core") or function(...) print(string.format(...)) end @@ -968,6 +968,25 @@ local function publicentity(k,v,n) end entities[k] = v end +local function entityfile(pattern,k,v,n) + if n then + local okay, data + if resolvers then + okay, data = resolvers.loadbinfile(n) + else + data = io.loaddata(n) + okay = data and data ~= "" + end + if okay then + if trace_entities then + report_xml("loading public entities %a as %a from %a",k,v,n) + end + lpegmatch(pattern,data) + return + end + end + report_xml("ignoring public entities %a as %a from %a",k,v,n) +end local function install(spacenewline,spacing,anything) @@ -1003,7 +1022,7 @@ local function install(spacenewline,spacing,anything) local attribute = (somespace * name * optionalspace * equal * optionalspace * attributevalue) / add_attribute --- local attributes = (attribute + somespace^-1 * (((1-endofattributes)^1)/attribute_specification_error))^0 + -- local attributes = (attribute + somespace^-1 * (((1-endofattributes)^1)/attribute_specification_error))^0 local attributes = (attribute + somespace^-1 * (((anything-endofattributes)^1)/attribute_specification_error))^0 local parsedtext = text_parsed -- / add_text @@ -1041,10 +1060,15 @@ local function install(spacenewline,spacing,anything) local weirdentitytype = P("%") * (somespace * doctypename * somespace * value) / weirdentity local normalentitytype = (doctypename * somespace * value) / normalentity - local publicentitytype = (doctypename * somespace * P("PUBLIC") * somespace * value)/publicentity + local publicentitytype = (doctypename * somespace * P("PUBLIC") * somespace * value) / publicentity + local systementitytype = (doctypename * somespace * P("SYSTEM") * somespace * value * somespace * P("NDATA") * somespace * doctypename)/systementity local entitydoctype = optionalspace * P("<!ENTITY") * somespace * (systementitytype + publicentitytype + normalentitytype + weirdentitytype) * optionalspace * close + local publicentityfile = (doctypename * somespace * P("PUBLIC") * somespace * value * (somespace * value)^0) / function(...) + entityfile(entitydoctype,...) + end + local function weirdresolve(s) lpegmatch(entitydoctype,parameters[s]) end @@ -1065,7 +1089,11 @@ local function install(spacenewline,spacing,anything) local publicdoctype = doctypename * somespace * P("PUBLIC") * somespace * value * somespace * value * somespace * doctypeset local systemdoctype = doctypename * somespace * P("SYSTEM") * somespace * value * somespace * doctypeset local simpledoctype = (anything-close)^1 -- * balanced^0 - local somedoctype = C((somespace * (publicdoctype + systemdoctype + definitiondoctype + simpledoctype) * optionalspace)^0) + local somedoctype = C((somespace * ( + +publicentityfile + + + publicdoctype + systemdoctype + definitiondoctype + simpledoctype) * optionalspace)^0) local instruction = (spacing * begininstruction * someinstruction * endinstruction) / function(...) add_special("@pi@",...) end local comment = (spacing * begincomment * somecomment * endcomment ) / function(...) add_special("@cm@",...) end @@ -1294,7 +1322,7 @@ a filename or a file handle.</p> function xml.load(filename,settings) local data = "" if type(filename) == "string" then - -- local data = io.loaddata(filename) - -todo: check type in io.loaddata + -- local data = io.loaddata(filename) -- todo: check type in io.loaddata local f = io.open(filename,'r') -- why not 'rb' if f then data = f:read("*all") -- io.readall(f) ... only makes sense for large files diff --git a/tex/context/base/mkiv/lxml-tex.lua b/tex/context/base/mkiv/lxml-tex.lua index 43b8e16b1..b8280ba9c 100644 --- a/tex/context/base/mkiv/lxml-tex.lua +++ b/tex/context/base/mkiv/lxml-tex.lua @@ -469,7 +469,7 @@ lxml.addindex = addindex implement { name = "xmladdindex", - arguments = { "string" }, + arguments = "string", actions = addindex, } @@ -821,7 +821,7 @@ local k_parser = class * spaces * key * spaces * rest --value implement { name = "xmlinstalldirective", - arguments = { "string", "string" }, + arguments = "2 strings", actions = function(name,csname) if csname then local keyvalueparser = k_parser / context[csname] @@ -1990,6 +1990,37 @@ do contextsprint(notcatcodes,att) end + local ctx_doif = commands.doif + local ctx_doifnot = commands.doifnot + local ctx_doifelse = commands.doifelse + + implement { + name = "xmldoifatt", + arguments = "3 strings", + actions = function(id,l,v) + local e = getid(id) + ctx_doif(e and e.at[k] == v or false) + end + } + + implement { + name = "xmldoifnotatt", + arguments = "3 strings", + actions = function(id,l,v) + local e = getid(id) + ctx_doifnot(e and e.at[k] == v or false) + end + } + + implement { + name = "xmldoifelseatt", + arguments = "3 strings", + actions = function(id,l,v) + local e = getid(id) + ctx_doifelse(e and e.at[k] == v or false) + end + } + end do diff --git a/tex/context/base/mkiv/lxml-xml.lua b/tex/context/base/mkiv/lxml-xml.lua index d1520800f..47a6e8c85 100644 --- a/tex/context/base/mkiv/lxml-xml.lua +++ b/tex/context/base/mkiv/lxml-xml.lua @@ -19,6 +19,10 @@ local xmlserialize = xml.serialize local xmlcollected = xml.collected local xmlnewhandlers = xml.newhandlers +local reparsedentity = xml.reparsedentitylpeg -- \Ux{...} +local unescapedentity = xml.unescapedentitylpeg +local parsedentity = reparsedentity + local function first(collected) -- wrong ? return collected and collected[1] end @@ -355,6 +359,25 @@ function xml.text(id,pattern) -- brrr either content or element (when cdata) end end +function xml.pure(id,pattern) + if pattern then + local collected = xmlfilter(id,pattern) + if collected and #collected > 0 then + parsedentity = unescapedentity + local s = collected and #collected > 0 and xmltotext(collected[1]) or "" + parsedentity = reparsedentity + return s + else + return "" + end + else + parsedentity = unescapedentity + local s = xmltotext(id) or "" + parsedentity = reparsedentity + return s + end +end + xml.content = text -- diff --git a/tex/context/base/mkiv/math-map.lua b/tex/context/base/mkiv/math-map.lua index 47e5cda0b..2233722a0 100644 --- a/tex/context/base/mkiv/math-map.lua +++ b/tex/context/base/mkiv/math-map.lua @@ -651,7 +651,7 @@ end implement { name = "setmathattribute", - arguments = { "string", "string" }, + arguments = "2 strings", actions = function(alphabet,style) local data = alphabets[alphabet] or regular data = data[style] or data.tf diff --git a/tex/context/base/mkiv/math-noa.lua b/tex/context/base/mkiv/math-noa.lua index 4c1997a64..529837cfa 100644 --- a/tex/context/base/mkiv/math-noa.lua +++ b/tex/context/base/mkiv/math-noa.lua @@ -100,6 +100,7 @@ local setchar = nuts.setchar local setfam = nuts.setfam local setsubtype = nuts.setsubtype local setattr = nuts.setattr +local setattrlist = nuts.setattrlist local getfield = nuts.getfield local getnext = nuts.getnext @@ -809,6 +810,8 @@ do setfield(d,"small_fam",fam) flush_node(sym) end + setattrlist(d,char) + setattrlist(f,char) setsubtype(f,what) setfield(f,"delim",d) setfield(f,"class",-1) -- tex itself does this, so not fenceclasses[what] diff --git a/tex/context/base/mkiv/meta-imp-txt.mkiv b/tex/context/base/mkiv/meta-imp-txt.mkiv index 56da9229d..e9660b3a7 100644 --- a/tex/context/base/mkiv/meta-imp-txt.mkiv +++ b/tex/context/base/mkiv/meta-imp-txt.mkiv @@ -287,7 +287,6 @@ \dontcomplain \setbox\scratchbox\hbox{\addff{mp:tp}#2}% \ctxlua{mp.follow_initialize(\number\scratchbox)}% - \stopluacode \startMPcode \includeMPgraphic{followtokens} ; mfun_follow_draw(\number#1) ; @@ -295,8 +294,8 @@ \ctxlua{mp.follow_reset()}% \egroup} -\unexpanded\def\followtokens {\dofollowtokens1} -\unexpanded\def\followtokenscentered{\dofollowtokens0} +\unexpanded\def\followtokens {\dofollowtokens\plusone} +\unexpanded\def\followtokenscentered{\dofollowtokens\zerocount} % stretched variant: % diff --git a/tex/context/base/mkiv/meta-tex.lua b/tex/context/base/mkiv/meta-tex.lua index d66eab069..fdf118424 100644 --- a/tex/context/base/mkiv/meta-tex.lua +++ b/tex/context/base/mkiv/meta-tex.lua @@ -117,13 +117,13 @@ do implement { name = "metapostformatted", actions = metapost.svformat, - arguments = { "string", "string" } + arguments = "2 strings", } implement { name = "metapostgraphformat", actions = metapost.nvformat, - arguments = { "string", "string" } + arguments = "2 strings", } if LUAVERSION < 5.2 then diff --git a/tex/context/base/mkiv/mlib-ctx.lua b/tex/context/base/mkiv/mlib-ctx.lua index 0ff28c1c4..c568b92a3 100644 --- a/tex/context/base/mkiv/mlib-ctx.lua +++ b/tex/context/base/mkiv/mlib-ctx.lua @@ -87,7 +87,7 @@ end implement { name = "setmpextensions", actions = metapost.setextensions, - arguments = { "string", "string" } + arguments = "2 strings", } implement { @@ -172,7 +172,7 @@ implement { implement { name = "mprunset", - arguments = { "string", "string" }, + arguments = "2 strings", actions = function(name,connector) local value = metapost.variables[name] if value ~= nil then diff --git a/tex/context/base/mkiv/mlib-lua.lua b/tex/context/base/mkiv/mlib-lua.lua index 5e6be614b..19e731b85 100644 --- a/tex/context/base/mkiv/mlib-lua.lua +++ b/tex/context/base/mkiv/mlib-lua.lua @@ -696,7 +696,7 @@ do interfaces.implement { name = "getMPstored", - arguments = { "string", "string" }, + arguments = "2 strings", actions = function(name,key) context(stores[name][key]) end diff --git a/tex/context/base/mkiv/mult-aux.lua b/tex/context/base/mkiv/mult-aux.lua index bcd5ae5be..96cc056ac 100644 --- a/tex/context/base/mkiv/mult-aux.lua +++ b/tex/context/base/mkiv/mult-aux.lua @@ -159,7 +159,7 @@ end interfaces.implement { name = "definenamespace", - arguments = { "string", "string" }, + arguments = "2 strings", actions = namespaces.define } diff --git a/tex/context/base/mkiv/mult-chk.lua b/tex/context/base/mkiv/mult-chk.lua index 44a9f739f..712d91f81 100644 --- a/tex/context/base/mkiv/mult-chk.lua +++ b/tex/context/base/mkiv/mult-chk.lua @@ -52,13 +52,13 @@ end implement { name = "setvalidinterfacekeys", actions = interfaces.setvalidkeys, - arguments = { "string", "string" } + arguments = "2 strings" } implement { name = "addvalidinterfacekeys", actions = interfaces.addvalidkeys, - arguments = { "string", "string" } + arguments = "2 strings" } -- weird code, looks incomplete ... probably an experiment @@ -89,5 +89,5 @@ end implement { name = "getcheckedinterfaceparameters", actions = interfaces.getcheckedparameters, - arguments = { "string", "string", "string" } + arguments = "3 strings" } diff --git a/tex/context/base/mkiv/mult-ini.lua b/tex/context/base/mkiv/mult-ini.lua index b899d25f2..3f320bf7f 100644 --- a/tex/context/base/mkiv/mult-ini.lua +++ b/tex/context/base/mkiv/mult-ini.lua @@ -346,7 +346,7 @@ end interfaces.implement { name = "setuserinterface", actions = interfaces.setuserinterface, - arguments = { "string", "string" } + arguments = "2 strings", } interfaces.cachedsetups = interfaces.cachedsetups or { } @@ -387,30 +387,30 @@ function interfaces.message(str) end implement { name = "registernamespace", actions = interfaces.registernamespace, arguments = { "integer", "string" } } -implement { name = "setinterfaceconstant", actions = interfaces.setconstant, arguments = { "string", "string" } } -implement { name = "setinterfacevariable", actions = interfaces.setvariable, arguments = { "string", "string" } } -implement { name = "setinterfaceelement", actions = interfaces.setelement, arguments = { "string", "string" } } -implement { name = "setinterfacemessage", actions = interfaces.setmessage, arguments = { "string", "string", "string" } } -implement { name = "setinterfacemessages", actions = interfaces.setmessages, arguments = { "string", "string" } } -implement { name = "showmessage", actions = interfaces.showmessage, arguments = { "string", "string", "string" } } +implement { name = "setinterfaceconstant", actions = interfaces.setconstant, arguments = "2 strings" } +implement { name = "setinterfacevariable", actions = interfaces.setvariable, arguments = "2 strings" } +implement { name = "setinterfaceelement", actions = interfaces.setelement, arguments = "2 strings" } +implement { name = "setinterfacemessage", actions = interfaces.setmessage, arguments = "3 strings" } +implement { name = "setinterfacemessages", actions = interfaces.setmessages, arguments = "2 strings" } +implement { name = "showmessage", actions = interfaces.showmessage, arguments = "3 strings" } implement { name = "doifelsemessage", actions = { interfaces.doifelsemessage, commands.doifelse }, - arguments = { "string", "string" }, + arguments = "2 strings", } implement { name = "getmessage", actions = { interfaces.getmessage, context }, - arguments = { "string", "string", "string" }, + arguments = "3 strings", } implement { name = "writestatus", overload = true, actions = interfaces.writestatus, - arguments = { "string", "string" }, + arguments = "2 strings", } implement { diff --git a/tex/context/base/mkiv/mult-low.lua b/tex/context/base/mkiv/mult-low.lua index cfe0c59e2..0acba3b87 100644 --- a/tex/context/base/mkiv/mult-low.lua +++ b/tex/context/base/mkiv/mult-low.lua @@ -402,7 +402,12 @@ return { "obeylualines", "obeyluatokens", "startluacode", "stopluacode", "startlua", "stoplua", "startctxfunction","stopctxfunction","ctxfunction", - "startctxfunctiondefinition","stopctxfunctiondefinition", "installctxfunction", + "startctxfunctiondefinition","stopctxfunctiondefinition", + "installctxfunction", "installctxfunctioncall", + "installprotectedctxfunction", "installprotectedctxfunctioncall", + "installctxscanner", "installctxscannercall", + "resetctxscanner", + "installprotectedctxscanner", "installprotectedctxscannercall", "cldprocessfile", "cldloadfile", "cldcontext", "cldcommand", -- "carryoverpar", diff --git a/tex/context/base/mkiv/mult-prm.lua b/tex/context/base/mkiv/mult-prm.lua index 601a615a0..1cd5f5810 100644 --- a/tex/context/base/mkiv/mult-prm.lua +++ b/tex/context/base/mkiv/mult-prm.lua @@ -282,6 +282,7 @@ return { "lpcode", "luaescapestring", "luafunction", + "luafunctioncall", "luatexbanner", "luatexrevision", "luatexversion", diff --git a/tex/context/base/mkiv/pack-obj.lua b/tex/context/base/mkiv/pack-obj.lua index f68c1ba0c..3f2b2edfe 100644 --- a/tex/context/base/mkiv/pack-obj.lua +++ b/tex/context/base/mkiv/pack-obj.lua @@ -96,13 +96,13 @@ jobobjects.page = getobjectpage -- implement { -- name = "objectnumber", -- actions = { getobjectnumber, context }, --- arguments = { "string", "string" }, +-- arguments = "2 strings", -- } -- -- implement { -- name = "objectpage", -- actions = { getobjectpage, context }, --- arguments = { "string", "string" }, +-- arguments = "2 strings", -- } -- -- implement { @@ -212,13 +212,13 @@ implement { implement { name = "restoreobject", - arguments = { "string", "string" }, + arguments = "2 strings", actions = objects.restore, } implement { name = "doifelseobject", - arguments = { "string", "string" }, + arguments = "2 strings", actions = function(ns,id) ctx_doifelse(data[ns][id]) -- ctx_doifelse(objects.reference(ns,id)) @@ -227,7 +227,7 @@ implement { implement { name = "doifelseobjectreference", - arguments = { "string", "string" }, + arguments = "2 strings", actions = function(ns,id) -- ctx_doifelse(data[ns][id]) ctx_doifelse(objects.reference(ns,id)) @@ -252,7 +252,7 @@ implement { implement { name = "getobjectdimensions", - arguments = { "string", "string" }, + arguments = "2 strings", actions = function(ns,id) local object = data[ns][id] local w, h, d, o = 0, 0, 0, 0 diff --git a/tex/context/base/mkiv/page-cst.lua b/tex/context/base/mkiv/page-cst.lua index 8b8214ab3..155d6e8b0 100644 --- a/tex/context/base/mkiv/page-cst.lua +++ b/tex/context/base/mkiv/page-cst.lua @@ -1271,13 +1271,13 @@ interfaces.implement { interfaces.implement { name = "preparecolumnsetflush", actions = columnsets.prepareflush, - arguments = { "string" }, + arguments = "string", } interfaces.implement { name = "finishcolumnsetflush", actions = columnsets.finishflush, - arguments = { "string" }, + arguments = "string", } interfaces.implement { @@ -1289,13 +1289,13 @@ interfaces.implement { interfaces.implement { name = "setvsizecolumnset", actions = columnsets.setvsize, - arguments = { "string" }, + arguments = "string", } interfaces.implement { name = "sethsizecolumnset", actions = columnsets.sethsize, - arguments = { "string" }, + arguments = "string", } interfaces.implement { @@ -1423,7 +1423,7 @@ interfaces.implement { interfaces.implement { name = "columnsetgoto", actions = columnsets["goto"], - arguments = { "string" , "string" }, + arguments = "2 strings", } interfaces.implement { diff --git a/tex/context/base/mkiv/page-inf.mkiv b/tex/context/base/mkiv/page-inf.mkiv index f60977e0c..2064f9f25 100644 --- a/tex/context/base/mkiv/page-inf.mkiv +++ b/tex/context/base/mkiv/page-inf.mkiv @@ -13,7 +13,7 @@ \writestatus{loading}{ConTeXt Page Macros / Tracing Info} -% this needs a real cleanup .. will be a more detailed list +% This needs a real cleanup .. will be a more detailed list. \unprotect @@ -23,6 +23,7 @@ \newtoks\everysetupversion \let\currentversioninfo\empty +\let\currentversiontext\empty \unexpanded\def\setupversion {\dosingleargument\page_info_setup} @@ -33,8 +34,13 @@ \def\page_info_setup[#1]% {\the\everyresetversion - \ifcsname\??layoutinfo#1\endcsname - \edef\currentversioninfo{#1}% + \doifelseassignment{#1}% + {\getdummyparameters[\c!alternative=,\c!text=,#1]% + \edef\currentversioninfo{\dummyparameter\c!alternative}% + \edef\currentversiontext{\dummyparameter\c!text}}% + {\edef\currentversioninfo{#1}% + \let \currentversiontext\empty}% + \ifcsname\??layoutinfo\currentversioninfo\endcsname \let\page_info_add_to_box\page_info_add_to_box_indeed \else \let\currentversioninfo\empty @@ -43,33 +49,46 @@ \the\everysetupversion} \unexpanded\def\page_info_place_info % at the bottom of the page - {\csname\??layoutinfo\currentversioninfo\endcsname} + {\begincsname\??layoutinfo\currentversioninfo\endcsname} \unexpanded\def\installversioninfo#1#2% {\setvalue{\??layoutinfo#1}{#2}} \unexpanded\def\includeversioninfo#1% - {\csname\??layoutinfo#1\endcsname} + {\begincsname\??layoutinfo#1\endcsname} + +\installversioninfo\v!final + {\let\currentversioninfo\empty + \let\page_info_add_to_box\gobbleoneargument} \installversioninfo\v!concept {\vskip6\points \hbox to \makeupwidth {\infofont - \v!concept:\space\currentdate + \rlap{\v!concept:\space\currentdate}% \hss - \page_adapts_status_info}} + \currentversiontext + \hss + \llap{\page_adapts_status_info}}} \installversioninfo\v!file {\vskip6\points \hbox to \makeupwidth {\infofont - \getmessage\m!system{27}:\space\currentdate\space + \getmessage\m!system{27}:\space\currentdate\quad \donefalse - \ifx\currentproject \empty \else \space\v!project :\space\currentproject \space \donetrue \fi - \ifx\currentproduct \empty \else \space\v!product :\space\currentproduct \space \donetrue \fi - \ifx\currentcomponent\empty \else \space\v!component:\space\currentcomponent\space \donetrue \fi - \ifdone \else \space\v!file :\space\jobname \space \fi + \doif\currentproject\currentproduct{\doif\currentproduct\currentcomponent\donetrue}% + \ifdone + \donefalse + \else + \ifx\currentproject \empty \else \space\v!project :\space\currentproject \space \donetrue \fi + \ifx\currentproduct \empty \else \space\v!product :\space\currentproduct \space \donetrue \fi + \ifx\currentcomponent\empty \else \space\v!component:\space\currentcomponent\space \donetrue \fi + \fi + \ifdone \else \space\v!file :\space\jobname \space \fi \hss + \currentversiontext + \quad \page_adapts_status_info}} \installversioninfo\v!temporary diff --git a/tex/context/base/mkiv/page-ini.lua b/tex/context/base/mkiv/page-ini.lua index 6325e1d39..5b73c9729 100644 --- a/tex/context/base/mkiv/page-ini.lua +++ b/tex/context/base/mkiv/page-ini.lua @@ -164,7 +164,7 @@ end) interfaces.implement { name = "markpage", - arguments = { "string", "string" }, + arguments = "2 strings", actions = pages.mark } diff --git a/tex/context/base/mkiv/page-ins.lua b/tex/context/base/mkiv/page-ins.lua index 4791bc69b..0323952d0 100644 --- a/tex/context/base/mkiv/page-ins.lua +++ b/tex/context/base/mkiv/page-ins.lua @@ -102,7 +102,7 @@ implement { implement { name = "setinsertionlocation", actions = inserts.setlocation, - arguments = { "string", "string" } + arguments = "2 strings", } implement { diff --git a/tex/context/base/mkiv/page-one.mkiv b/tex/context/base/mkiv/page-one.mkiv index 35233247b..348c301fc 100644 --- a/tex/context/base/mkiv/page-one.mkiv +++ b/tex/context/base/mkiv/page-one.mkiv @@ -481,28 +481,68 @@ #1{\box\floatbox}% \doifinset\v!tall\floatlocationmethod\page_sides_flush_floats_after_par} -\def\page_one_place_float_left {\page_one_place_float_side_indeed\page_sides_process_float_left\presetindentation} -\def\page_one_place_float_right {\page_one_place_float_side_indeed\page_sides_process_float_right} -\def\page_one_place_float_leftmargin {\page_one_place_float_side_indeed\page_sides_process_float_leftmargin} -\def\page_one_place_float_rightmargin{\page_one_place_float_side_indeed\page_sides_process_float_rightmargin} -\def\page_one_place_float_leftedge {\page_one_place_float_side_indeed\page_sides_process_float_leftedge} -\def\page_one_place_float_rightedge {\page_one_place_float_side_indeed\page_sides_process_float_rightedge} -\def\page_one_place_float_inmargin {\page_one_place_float_side_indeed\page_sides_process_float_cutspace} -\def\page_one_place_float_backspace {\page_one_place_float_side_indeed\page_sides_process_float_backspace} -\def\page_one_place_float_cutspace {\page_one_place_float_side_indeed\page_sides_process_float_cutspace} - -%def\page_one_place_float_margin {\page_one_place_float_side_indeed\page_sides_process_float_margin\nonoindentation} % wil be overloaded -\def\page_one_place_float_margin {\page_margin_blocks_process_float} +\def\page_one_place_float_left + {\page_one_place_float_side_indeed + \page_sides_process_float_left + \presetindentation} + +\def\page_one_place_float_right + {\page_one_place_float_side_indeed + \page_sides_process_float_right} + +\def\page_one_place_float_margin + {\page_margin_blocks_process_float + \nonoindentation} % new, due to popular request + +\def\page_one_place_float_leftmargin + {\page_one_place_float_side_indeed + \page_sides_process_float_leftmargin + \nonoindentation} % new, due to popular request + +\def\page_one_place_float_rightmargin + {\page_one_place_float_side_indeed + \page_sides_process_float_rightmargin + \nonoindentation} % new, due to popular request + +\def\page_one_place_float_leftedge + {\page_one_place_float_side_indeed + \page_sides_process_float_leftedge} + +\def\page_one_place_float_rightedge + {\page_one_place_float_side_indeed + \page_sides_process_float_rightedge} + +\def\page_one_place_float_inmargin + {\page_one_place_float_side_indeed + \page_sides_process_float_cutspace} + +\def\page_one_place_float_backspace + {\page_one_place_float_side_indeed + \page_sides_process_float_backspace} + +\def\page_one_place_float_cutspace + {\page_one_place_float_side_indeed + \page_sides_process_float_cutspace} \def\page_one_place_float_page {\page_floats_save_page_float \s!page \floatlocationmethod} \def\page_one_place_float_leftpage {\page_floats_save_page_float \s!leftpage \floatlocationmethod} \def\page_one_place_float_rightpage {\page_floats_save_page_float \s!rightpage\floatlocationmethod} \def\page_one_place_float_somewhere {\page_floats_save_somewhere_float\s!somewhere\floatlocationmethod} -\def\page_one_place_float_here {\page_one_place_float_otherwise_here} -\def\page_one_place_float_auto {\page_one_place_float_otherwise} -\def\page_one_place_float_top {\page_one_place_float_otherwise\nonoindentation} -\def\page_one_place_float_bottom {\page_one_place_float_otherwise} +\def\page_one_place_float_here + {\page_one_place_float_otherwise_here} + +\def\page_one_place_float_auto + {\page_one_place_float_otherwise + \nonoindentation} % new, due to popular request + +\def\page_one_place_float_top + {\page_one_place_float_otherwise + \nonoindentation} + +\def\page_one_place_float_bottom + {\page_one_place_float_otherwise + \nonoindentation} % new, due to popular request \def\page_one_place_float_otherwise {\doifelseinset\v!here\floatlocationmethod diff --git a/tex/context/base/mkiv/page-sid.mkiv b/tex/context/base/mkiv/page-sid.mkiv index 5742ce8c4..6f5d9f357 100644 --- a/tex/context/base/mkiv/page-sid.mkiv +++ b/tex/context/base/mkiv/page-sid.mkiv @@ -32,6 +32,7 @@ %D Earth, sophisticated Massive Attack video clips, impressive Davie504 movies %D and so on). +\newdimen \d_page_sides_margin \newdimen \d_page_sides_height % includes the topskip \newdimen \d_page_sides_width \newdimen \d_page_sides_hsize @@ -113,7 +114,7 @@ \or % high \or % low \or % fit - \global\d_strc_floats_margin\zeropoint + \global\d_page_sides_margin\zeropoint \fi} \def\page_sides_apply_horizontal_shift @@ -668,7 +669,7 @@ \else\ifnum\c_page_sides_float_type>\plusfive \global\d_page_sides_width\zeropoint \else - \global\d_page_sides_width\dimexpr\wd\floatbox+\d_strc_floats_margin\relax + \global\d_page_sides_width\dimexpr\wd\floatbox+\d_page_sides_margin\relax \fi\fi \ifdim\d_page_sides_width<\zeropoint \global\d_page_sides_width\zeropoint @@ -737,8 +738,9 @@ \def\page_sides_wrapup {% we need to do this aftergroup - \ignoreparskip \aftergroup\ignoreparskip - \ignorespaces \aftergroup\ignorespaces + \aftergroup\par + \aftergroup\ignoreparskip + \aftergroup\ignorespaces } \def\page_sides_check_floats_indeed diff --git a/tex/context/base/mkiv/phys-dim.lua b/tex/context/base/mkiv/phys-dim.lua index 71c9b0bd4..363b4a79c 100644 --- a/tex/context/base/mkiv/phys-dim.lua +++ b/tex/context/base/mkiv/phys-dim.lua @@ -966,4 +966,4 @@ implement { name = "digits_normal", actions = makedigits, arguments = "string implement { name = "digits_reverse", actions = makedigits, arguments = { "string", true } } implement { name = "unit_normal", actions = makeunit, arguments = "string"} implement { name = "unit_reverse", actions = makeunit, arguments = { "string", true } } -implement { name = "registerunit", actions = registerunit, arguments = { "string", "string" } } +implement { name = "registerunit", actions = registerunit, arguments = "2 strings" } diff --git a/tex/context/base/mkiv/publ-aut.lua b/tex/context/base/mkiv/publ-aut.lua index 91d38a8d9..be0c771a3 100644 --- a/tex/context/base/mkiv/publ-aut.lua +++ b/tex/context/base/mkiv/publ-aut.lua @@ -975,7 +975,7 @@ publications.sortmethods.authoryear = { implement { name = "btxremapauthor", - arguments = { "string", "string" }, + arguments = "2 strings", actions = function(k,v) local a = { splitauthor(k,true) } local s1 = sequentialhash(a) diff --git a/tex/context/base/mkiv/publ-ini.lua b/tex/context/base/mkiv/publ-ini.lua index 038a15d5a..8497b190f 100644 --- a/tex/context/base/mkiv/publ-ini.lua +++ b/tex/context/base/mkiv/publ-ini.lua @@ -648,7 +648,7 @@ local findallused do implement { name = "btxdoifelsematches", - arguments = { "string", "string", "string" }, + arguments = "3 strings", actions = function(dataset,tag,expression) local find = publications.finder(dataset,expression) local okay = false @@ -1009,30 +1009,28 @@ function publications.lastofrange(dataset,tag,name) end end -local three_strings = { "string", "string", "string" } - implement { name = "btxsingularorplural", actions = { publications.singularorplural, ctx_doifelse }, - arguments = three_strings + arguments = "3 strings" } implement { name = "btxoneorrange", actions = { publications.oneorrange, function(b) if b == nil then ctx_gobbletwoarguments() else ctx_doifelse(b) end end }, - arguments = three_strings + arguments = "3 strings" } implement { name = "btxfirstofrange", actions = { publications.firstofrange, context }, - arguments = three_strings + arguments = "3 strings" } implement { name = "btxlastofrange", actions = { publications.lastofrange, context }, - arguments = three_strings + arguments = "3 strings" } -- basic loading @@ -1237,13 +1235,13 @@ end implement { name = "btxaddentry", + arguments = "3 strings", actions = function(name,settings,content) local dataset = datasets[name] if dataset then publications.addtexentry(dataset,settings,content) end end, - arguments = { "string", "string", "string" } } function publications.checkeddataset(name,default) @@ -1260,12 +1258,13 @@ end implement { name = "btxsetdataset", + arguments = "2 strings", actions = { publications.checkeddataset, context }, - arguments = { "string", "string"} } implement { name = "btxsetentry", + arguments = "2 strings", actions = function(name,tag) local dataset = rawget(datasets,name) if dataset then @@ -1278,7 +1277,6 @@ implement { report("unknown dataset %a",name) end end, - arguments = { "string", "string" }, } -- rendering of fields @@ -1558,19 +1556,19 @@ do publications.okay = okay - implement { name = "btxfield", actions = btxfield, arguments = { "string", "string", "string" } } - implement { name = "btxdetail", actions = btxdetail, arguments = { "string", "string", "string" } } - implement { name = "btxflush", actions = btxflush, arguments = { "string", "string", "string" } } - implement { name = "btxdirect", actions = btxdirect, arguments = { "string", "string", "string" } } + implement { name = "btxfield", actions = btxfield, arguments = "3 strings" } + implement { name = "btxdetail", actions = btxdetail, arguments = "3 strings" } + implement { name = "btxflush", actions = btxflush, arguments = "3 strings" } + implement { name = "btxdirect", actions = btxdirect, arguments = "3 strings" } implement { name = "btxfieldname", actions = { get, context }, arguments = { "string", "string", "string", false, false } } implement { name = "btxfieldtype", actions = { get, context }, arguments = { "string", "string", "string", true, false } } implement { name = "btxfoundname", actions = { get, context }, arguments = { "string", "string", "string", false, true } } implement { name = "btxfoundtype", actions = { get, context }, arguments = { "string", "string", "string", true, true } } - implement { name = "btxdoifelse", actions = { okay, ctx_doifelse }, arguments = { "string", "string", "string" } } - implement { name = "btxdoif", actions = { okay, ctx_doif }, arguments = { "string", "string", "string" } } - implement { name = "btxdoifnot", actions = { okay, ctx_doifnot }, arguments = { "string", "string", "string" } } + implement { name = "btxdoifelse", actions = { okay, ctx_doifelse }, arguments = "3 strings" } + implement { name = "btxdoif", actions = { okay, ctx_doif }, arguments = "3 strings" } + implement { name = "btxdoifnot", actions = { okay, ctx_doifnot }, arguments = "3 strings" } end @@ -2041,8 +2039,8 @@ do implement { name = "btxflushpages", + arguments = "2 strings", actions = btxflushpages, - arguments = { "string", "string" } } local function identical(a,b) @@ -2277,20 +2275,20 @@ do implement { name = "btxuservariable", + arguments = "2 strings", actions = { getuserdata, context }, - arguments = { "string", "string" } } implement { name = "btxdoifelseuservariable", + arguments = "2 strings", actions = { getuserdata, ctx_doifelse }, - arguments = { "string", "string" } } -- implement { -- name = "btxresolvelistreference", + -- arguments = "2 strings", -- actions = lists.resolve, - -- arguments = { "string", "string" } -- } implement { @@ -2315,32 +2313,32 @@ do implement { name = "btxpreparelistentries", + arguments = "string", actions = lists.prepareentries, - arguments = { "string" }, } implement { name = "btxfetchlistentries", + arguments = "string", actions = lists.fetchentries, - arguments = { "string" }, } implement { name = "btxflushlistentry", + arguments = "2 strings", actions = lists.flushentry, - arguments = { "string", "integer" } } implement { name = "btxflushlisttag", + arguments = "2 strings", actions = lists.flushtag, - arguments = { "string", "integer" } } implement { name = "btxflushlistcombi", + arguments = "2 strings", actions = lists.flushcombi, - arguments = { "string", "string" } } implement { @@ -2351,8 +2349,8 @@ do implement { name = "btxdoifelsecombiinlist", + arguments = "2 strings", actions = { lists.combiinlist, ctx_doifelse }, - arguments = { "string", "string" } } end @@ -3374,8 +3372,8 @@ do implement { name = "btxlistvariant", + arguments = "5 strings", actions = btxlistvariant, - arguments = { "string", "string", "string", "string", "string" } -- not integer here } function listvariants.default(dataset,block,tag,variant) @@ -3440,7 +3438,7 @@ do implement { name = "checkinterfacechain", - arguments = { "string", "string" }, + arguments = "2 strings", actions = function(str,command) local chain = lpegmatch(splitter,str) if #chain > 0 then diff --git a/tex/context/base/mkiv/publ-jrn.lua b/tex/context/base/mkiv/publ-jrn.lua index 0cc41862f..fba994466 100644 --- a/tex/context/base/mkiv/publ-jrn.lua +++ b/tex/context/base/mkiv/publ-jrn.lua @@ -156,7 +156,7 @@ if implement then implement { name = "btxaddjournal", - arguments = { "string", "string" }, + arguments = "2 strings", actions = { journals.add, context } } diff --git a/tex/context/base/mkiv/publ-reg.lua b/tex/context/base/mkiv/publ-reg.lua index b40fbc80a..9ee574929 100644 --- a/tex/context/base/mkiv/publ-reg.lua +++ b/tex/context/base/mkiv/publ-reg.lua @@ -121,7 +121,7 @@ implement { implement { name = "btxtoregister", actions = btxtoregister, - arguments = { "string", "string" } + arguments = "2 strings", } -- context.setregisterentry ( @@ -221,5 +221,5 @@ publications.authortoregister = authortoregister implement { name = "btxauthortoregister", actions = authortoregister, - arguments = { "string", "string" } + arguments = "2 strings", } diff --git a/tex/context/base/mkiv/scrn-but.lua b/tex/context/base/mkiv/scrn-but.lua index c791f9718..da0d5e9f4 100644 --- a/tex/context/base/mkiv/scrn-but.lua +++ b/tex/context/base/mkiv/scrn-but.lua @@ -22,5 +22,5 @@ end interfaces.implement { name = "registerbuttons", actions = registerbuttons, - arguments = { "string", "string", "string" } + arguments = "3 strings", } diff --git a/tex/context/base/mkiv/scrn-fld.lua b/tex/context/base/mkiv/scrn-fld.lua index f68cc039d..046b7864f 100644 --- a/tex/context/base/mkiv/scrn-fld.lua +++ b/tex/context/base/mkiv/scrn-fld.lua @@ -66,7 +66,7 @@ implement { implement { name = "definefieldset", actions = defineset, - arguments = { "string", "string" } + arguments = "2 strings", } implement { diff --git a/tex/context/base/mkiv/scrn-wid.lua b/tex/context/base/mkiv/scrn-wid.lua index 636d547da..5b70bec75 100644 --- a/tex/context/base/mkiv/scrn-wid.lua +++ b/tex/context/base/mkiv/scrn-wid.lua @@ -288,7 +288,7 @@ end implement { name = "renderingvar", actions = { renderings.var, context }, - arguments = { "string", "string" } + arguments = "2 strings", } implement { diff --git a/tex/context/base/mkiv/scrp-ini.lua b/tex/context/base/mkiv/scrp-ini.lua index d5cad643f..9bd70e30a 100644 --- a/tex/context/base/mkiv/scrp-ini.lua +++ b/tex/context/base/mkiv/scrp-ini.lua @@ -973,7 +973,7 @@ implement { implement { name = "setscript", actions = scripts.set, - arguments = { "string", "string", "string" } + arguments = "3 strings", } implement { diff --git a/tex/context/base/mkiv/spac-ver.lua b/tex/context/base/mkiv/spac-ver.lua index 288630a5d..969a195e1 100644 --- a/tex/context/base/mkiv/spac-ver.lua +++ b/tex/context/base/mkiv/spac-ver.lua @@ -2180,7 +2180,7 @@ do name = "vspacingdefine", actions = vspacing.setmap, scope = "private", - arguments = { "string", "string" } + arguments = "2 strings", } implement { @@ -2208,7 +2208,7 @@ do name = "definesnapmethod", actions = vspacing.definesnapmethod, scope = "private", - arguments = { "string", "string" } + arguments = "2 strings", } -- local remove_node = nodes.remove diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf Binary files differindex 58b354529..452af8333 100644 --- a/tex/context/base/mkiv/status-files.pdf +++ b/tex/context/base/mkiv/status-files.pdf diff --git a/tex/context/base/mkiv/status-lua.pdf b/tex/context/base/mkiv/status-lua.pdf Binary files differindex e4af5aa4a..c4928ecb0 100644 --- a/tex/context/base/mkiv/status-lua.pdf +++ b/tex/context/base/mkiv/status-lua.pdf diff --git a/tex/context/base/mkiv/strc-bkm.lua b/tex/context/base/mkiv/strc-bkm.lua index e30a91820..ee9233a9a 100644 --- a/tex/context/base/mkiv/strc-bkm.lua +++ b/tex/context/base/mkiv/strc-bkm.lua @@ -523,5 +523,5 @@ implement { implement { name = "overloadbookmark", actions = bookmarks.overload, - arguments = { "string", "string" } + arguments = "2 strings", } diff --git a/tex/context/base/mkiv/strc-blk.lua b/tex/context/base/mkiv/strc-blk.lua index 492abc768..703d36379 100644 --- a/tex/context/base/mkiv/strc-blk.lua +++ b/tex/context/base/mkiv/strc-blk.lua @@ -157,6 +157,6 @@ end -- interface implement { name = "definestructureblock", actions = blocks.define, arguments = "string" } -implement { name = "savestructureblock", actions = blocks.save, arguments = { "string", "string" ,"string" } } -implement { name = "selectstructureblock", actions = blocks.select, arguments = { "string", "string" ,"string", "string" } } -implement { name = "setstructureblockstate", actions = blocks.setstate, arguments = { "string", "string" ,"string" } } +implement { name = "savestructureblock", actions = blocks.save, arguments = "3 strings" } +implement { name = "selectstructureblock", actions = blocks.select, arguments = "4 strings" } +implement { name = "setstructureblockstate", actions = blocks.setstate, arguments = "3 strings" } diff --git a/tex/context/base/mkiv/strc-doc.lua b/tex/context/base/mkiv/strc-doc.lua index 93d8db56b..2de26ac64 100644 --- a/tex/context/base/mkiv/strc-doc.lua +++ b/tex/context/base/mkiv/strc-doc.lua @@ -1029,11 +1029,11 @@ implement { name = "structurecatcodedget", actions = sections.structuredat implement { name = "structuregivencatcodedget", actions = sections.structuredata, arguments = { false, "string", false, "integer" } } implement { name = "structureautocatcodedget", actions = sections.structuredata, arguments = { false, "string", false, "string" } } -implement { name = "namedstructurevariable", actions = sections.structuredata, arguments = { "string", "string" } } -implement { name = "namedstructureuservariable", actions = sections.userdata, arguments = { "string", "string" } } +implement { name = "namedstructurevariable", actions = sections.structuredata, arguments = "2 strings" } +implement { name = "namedstructureuservariable", actions = sections.userdata, arguments = "2 strings" } -implement { name = "setstructurelevel", actions = sections.setlevel, arguments = { "string", "string" } } -implement { name = "getstructurelevel", actions = sections.getcurrentlevel, arguments = { "string" } } +implement { name = "setstructurelevel", actions = sections.setlevel, arguments = "2 strings" } +implement { name = "getstructurelevel", actions = sections.getcurrentlevel, arguments = "string" } implement { name = "setstructurenumber", actions = sections.setnumber, arguments = { "integer", "string" } } -- string as we support +- implement { name = "getstructurenumber", actions = sections.getnumber, arguments = { "integer" } } implement { name = "getsomestructurenumber", actions = sections.getnumber, arguments = { "integer", "string" } } diff --git a/tex/context/base/mkiv/strc-flt.mkvi b/tex/context/base/mkiv/strc-flt.mkvi index 69881037e..632c67686 100644 --- a/tex/context/base/mkiv/strc-flt.mkvi +++ b/tex/context/base/mkiv/strc-flt.mkvi @@ -148,7 +148,7 @@ \c!textmethod=\ifgridsnapping2\else0\fi, % 0=raw 1=safe (.99pg) 2=tight (-1pt) % THIS WILL CHANGE \c!sidemethod=\ifgridsnapping2\else1\fi, % 0=raw 1=safe (.99pg) 2=tight (-1pt) % THIS WILL CHANGE \c!indentnext=\v!no, - \c!margin=1\emwidth, + \c!margin=\emwidth, \c!method=1, \c!cache=\v!yes, % when no, then intermediate flush \c!leftmargin=\zeropoint, % displacement in 'normal floats' @@ -734,7 +734,6 @@ % nicer is a bunch of states and one loop that sets those states -\newdimen\d_strc_floats_margin \newdimen\d_strc_floats_top \newdimen\d_strc_floats_bottom @@ -776,13 +775,13 @@ \global\c_page_sides_tolerance \zerocount \global\c_page_sides_skipmode \zerocount \global\c_strc_floats_rotation \zerocount - \global\d_strc_floats_margin \rootfloatparameter\c!margin - \global\d_page_sides_leftshift \floatparameter \c!leftmargindistance - \global\d_page_sides_rightshift \floatparameter \c!rightmargindistance - \global\d_page_sides_topoffset \floatparameter \c!topoffset - \global\d_page_sides_bottomoffset\floatparameter \c!bottomoffset - \global\c_page_sides_method \floatparameter \c!sidemethod - \global\c_page_one_float_method \floatparameter \c!textmethod + \global\d_page_sides_margin \floatparameter\c!margin + \global\d_page_sides_leftshift \floatparameter\c!leftmargindistance + \global\d_page_sides_rightshift \floatparameter\c!rightmargindistance + \global\d_page_sides_topoffset \floatparameter\c!topoffset + \global\d_page_sides_bottomoffset\floatparameter\c!bottomoffset + \global\c_page_sides_method \floatparameter\c!sidemethod + \global\c_page_one_float_method \floatparameter\c!textmethod \global\c_page_floats_n_of_top \rootfloatparameter\c!ntop \global\c_page_floats_n_of_bottom\rootfloatparameter\c!nbottom \ifconditional\c_strc_floats_par_float diff --git a/tex/context/base/mkiv/strc-lev.lua b/tex/context/base/mkiv/strc-lev.lua index c06e209f6..74b64a09c 100644 --- a/tex/context/base/mkiv/strc-lev.lua +++ b/tex/context/base/mkiv/strc-lev.lua @@ -83,7 +83,7 @@ end implement { name = "definesectionlevels", actions = definesectionlevels, - arguments = { "string", "string" }, + arguments = "2 strings", } implement { diff --git a/tex/context/base/mkiv/strc-lst.lua b/tex/context/base/mkiv/strc-lst.lua index a235fac75..13bdf7786 100644 --- a/tex/context/base/mkiv/strc-lst.lua +++ b/tex/context/base/mkiv/strc-lst.lua @@ -1159,7 +1159,7 @@ implement { name = "listsize", actions = { lists.size, context } } implement { name = "listlocation", actions = { lists.location, context }, arguments = "integer" } implement { name = "listlabel", actions = { lists.label, context }, arguments = { "integer", "string" } } implement { name = "listrealpage", actions = { lists.realpage, context }, arguments = { "string", "integer" } } -implement { name = "listgroupindex", actions = { lists.groupindex, context }, arguments = { "string", "string" } } +implement { name = "listgroupindex", actions = { lists.groupindex, context }, arguments = "2 strings", } implement { name = "currentsectiontolist", diff --git a/tex/context/base/mkiv/strc-mar.lua b/tex/context/base/mkiv/strc-mar.lua index 80fcf126a..24a7fd491 100644 --- a/tex/context/base/mkiv/strc-mar.lua +++ b/tex/context/base/mkiv/strc-mar.lua @@ -714,17 +714,17 @@ end -- interface -implement { name = "markingtitle", actions = marks.title, arguments = { "string", "string" } } -implement { name = "markingnumber", actions = marks.number, arguments = { "string", "string" } } +implement { name = "markingtitle", actions = marks.title, arguments = "2 strings" } +implement { name = "markingnumber", actions = marks.number, arguments = "2 strings" } -implement { name = "definemarking", actions = marks.define, arguments = { "string", "string" } } -implement { name = "relatemarking", actions = marks.relate, arguments = { "string", "string" } } -implement { name = "setmarking", actions = marks.set, arguments = { "string", "string" } } -implement { name = "resetmarking", actions = marks.reset, arguments = { "string" } } +implement { name = "definemarking", actions = marks.define, arguments = "2 strings" } +implement { name = "relatemarking", actions = marks.relate, arguments = "2 strings" } +implement { name = "setmarking", actions = marks.set, arguments = "2 strings" } +implement { name = "resetmarking", actions = marks.reset, arguments = "string" } implement { name = "synchronizemarking", actions = marks.synchronize, arguments = { "string", "integer", "string" } } -implement { name = "getmarking", actions = marks.fetch, arguments = { "string", "string", "string" } } -implement { name = "fetchonemark", actions = marks.fetchonemark, arguments = { "string", "string", "string" } } -implement { name = "fetchtwomarks", actions = marks.fetchtwomarks, arguments = { "string", "string" } } -implement { name = "fetchallmarks", actions = marks.fetchallmarks, arguments = { "string", "string" } } +implement { name = "getmarking", actions = marks.fetch, arguments = "3 strings" } +implement { name = "fetchonemark", actions = marks.fetchonemark, arguments = "3 strings" } +implement { name = "fetchtwomarks", actions = marks.fetchtwomarks, arguments = "2 strings" } +implement { name = "fetchallmarks", actions = marks.fetchallmarks, arguments = "2 strings" } implement { name = "doifelsemarking", actions = { marks.exists, commands.doifelse }, arguments = "string" } diff --git a/tex/context/base/mkiv/strc-not.lua b/tex/context/base/mkiv/strc-not.lua index eff357eea..bb9d64beb 100644 --- a/tex/context/base/mkiv/strc-not.lua +++ b/tex/context/base/mkiv/strc-not.lua @@ -151,7 +151,7 @@ notes.getstate = getstate implement { name = "setnotestate", actions = setstate, - arguments = { "string", "string" } + arguments = "2 strings", } implement { @@ -199,8 +199,8 @@ function notes.restore(tag,forcedstate) end end -implement { name = "savenote", actions = notes.save, arguments = { "string", "string" } } -implement { name = "restorenote", actions = notes.restore, arguments = { "string", "string" } } +implement { name = "savenote", actions = notes.save, arguments = "2 strings" } +implement { name = "restorenote", actions = notes.restore, arguments = "2 strings" } local function hascontent(tag) local ok = notestates[tag] @@ -420,7 +420,7 @@ implement { implement { name = "flushnotes", actions = flushnotes, - arguments = { "string", "string", "string" } + arguments = "3 strings", } function notes.resetpostponed() diff --git a/tex/context/base/mkiv/strc-ref.lua b/tex/context/base/mkiv/strc-ref.lua index 73f1ca886..f20d93161 100644 --- a/tex/context/base/mkiv/strc-ref.lua +++ b/tex/context/base/mkiv/strc-ref.lua @@ -355,19 +355,19 @@ references.setcomponent = setcomponent implement { name = "setnextreferenceorder", actions = setnextorder, - arguments = { "string", "string" } + arguments = "2 strings", } implement { name = "setnextinternalreference", actions = setnextinternal, - arguments = { "string", "string" } + arguments = "2 strings", } implement { name = "currentreferenceorder", actions = { currentorder, context }, - arguments = { "string", "string" } + arguments = "2 strings", } function references.set(data) @@ -432,7 +432,7 @@ end implement { name = "enhancereference", actions = references.enhance, - arguments = { "string", "string" } + arguments = "2 strings", } -- -- -- related to strc-ini.lua -- -- -- @@ -633,7 +633,7 @@ implement { implement { name = "useurl", actions = urls.define, - arguments = { "string", "string", "string", "string" } + arguments = "4 strings", } implement { @@ -684,7 +684,7 @@ implement { implement { name = "usefile", actions = files.define, - arguments = { "string", "string", "string" } + arguments = "3 strings" } implement { @@ -774,7 +774,7 @@ end implement { name = "defineprogram", actions = programs.define, - arguments = { "string", "string", "string" } + arguments = "3 strings", } local function getprogram(name) @@ -863,13 +863,13 @@ end implement { name = "definereference", actions = references.define, - arguments = { "string", "string", "string" } + arguments = "3 strings", } implement { name = "resetreference", actions = references.reset, - arguments = { "string", "string" } + arguments = "2 strings", } setmetatableindex(defined,"table") diff --git a/tex/context/base/mkiv/strc-reg.lua b/tex/context/base/mkiv/strc-reg.lua index 51771e3b8..2c667fba3 100644 --- a/tex/context/base/mkiv/strc-reg.lua +++ b/tex/context/base/mkiv/strc-reg.lua @@ -428,13 +428,13 @@ registers.setmethod = defineregister -- and we might have a difference so implement { name = "defineregister", actions = defineregister, - arguments = { "string", "string" } + arguments = "2 strings", } implement { name = "setregistermethod", actions = defineregister, -- duplicate use - arguments = { "string", "string" } + arguments = "2 strings", } @@ -643,13 +643,13 @@ end implement { name = "enhanceregister", actions = registers.enhance, - arguments = { "string", "integer" } + arguments = { "string", "integer" }, } implement { name = "extendregister", actions = registers.extend, - arguments = { "string", "string" } + arguments = "2 strings", } implement { diff --git a/tex/context/base/mkiv/strc-syn.lua b/tex/context/base/mkiv/strc-syn.lua index ecc5e19ae..eec025593 100644 --- a/tex/context/base/mkiv/strc-syn.lua +++ b/tex/context/base/mkiv/strc-syn.lua @@ -259,23 +259,23 @@ end -- todo: local higher up -implement { name = "registerusedsynonym", actions = synonyms.registerused, arguments = { "string", "string" } } -implement { name = "registershownsynonym", actions = synonyms.registershown, arguments = { "string", "string" } } -implement { name = "synonymmeaning", actions = synonyms.meaning, arguments = { "string", "string" } } -implement { name = "synonymname", actions = synonyms.synonym, arguments = { "string", "string" } } +implement { name = "registerusedsynonym", actions = synonyms.registerused, arguments = "2 strings" } +implement { name = "registershownsynonym", actions = synonyms.registershown, arguments = "2 strings" } +implement { name = "synonymmeaning", actions = synonyms.meaning, arguments = "2 strings" } +implement { name = "synonymname", actions = synonyms.synonym, arguments = "2 strings" } implement { name = "resetusedsynonyms", actions = synonyms.resetused, arguments = "string" } implement { name = "resetshownsynonyms", actions = synonyms.resetshown, arguments = "string" } implement { name = "doifelsesynonymused", actions = { synonyms.isused, commands.doifelse }, - arguments = { "string", "string" } + arguments = "2 strings", } implement { name = "doifelsesynonymshown", actions = { synonyms.isshown, commands.doifelse }, - arguments = { "string", "string" } + arguments = "2 strings", } implement { diff --git a/tex/context/base/mkiv/strc-tag.lua b/tex/context/base/mkiv/strc-tag.lua index 1be44821e..649465a6a 100644 --- a/tex/context/base/mkiv/strc-tag.lua +++ b/tex/context/base/mkiv/strc-tag.lua @@ -464,7 +464,7 @@ local starttag = tags.start implement { name = "starttag", actions = starttag, - arguments = { "string" } + arguments = "string", } implement { @@ -476,26 +476,25 @@ implement { name = "starttag_u", scope = "private", actions = function(tag,userdata) starttag(tag,{ userdata = userdata }) end, - arguments = { "string", "string" } + arguments = "2 strings", } implement { name = "starttag_d", scope = "private", actions = function(tag,detail) starttag(tag,{ detail = detail }) end, - arguments = { "string", "string" } + arguments = "2 strings", } implement { name = "starttag_c", scope = "private", actions = function(tag,detail,parents) starttag(tag,{ detail = detail, parents = parents }) end, - arguments = { "string", "string", "string" } + arguments = "3 strings", } -implement { name = "settagaspect", actions = tags.setaspect, arguments = { "string", "string" } } - -implement { name = "settagproperty", actions = tags.setproperty, arguments = { "string", "string", "string" } } +implement { name = "settagaspect", actions = tags.setaspect, arguments = "2 strings" } +implement { name = "settagproperty", actions = tags.setproperty, arguments = "3 strings" } implement { name = "settagproperty_b", actions = tags.setproperty, arguments = { "string", "'backend'", "string" }, scope = "private" } implement { name = "settagproperty_n", actions = tags.setproperty, arguments = { "string", "'nature'", "string" }, scope = "private" } @@ -505,7 +504,7 @@ implement { name = "setelementuserproperties", scope = "private", actions = tags.setuserproperties, - arguments = { "string", "string" } + arguments = "2 strings", } implement { @@ -517,5 +516,5 @@ implement { implement { name = "settaggedmetadata", actions = tags.registermetadata, - arguments = "string" + arguments = "string", } diff --git a/tex/context/base/mkiv/supp-box.lua b/tex/context/base/mkiv/supp-box.lua index 664477cfc..40047167c 100644 --- a/tex/context/base/mkiv/supp-box.lua +++ b/tex/context/base/mkiv/supp-box.lua @@ -562,7 +562,7 @@ do implement { name = "directboxfromcache", - arguments = { "string", "string" }, + arguments = "2 strings", actions = { boxes.direct, context }, -- actions = function(category,name) local b = boxes.direct(category,name) if b then context(b) end end, } @@ -582,13 +582,13 @@ do implement { name = "doifelseboxincache", - arguments = { "string", "string" }, + arguments = "2 strings", actions = { boxes.found, doifelse }, } implement { name = "resetboxesincache", - arguments = { "string" }, + arguments = "string", actions = boxes.reset, } diff --git a/tex/context/base/mkiv/syst-aux.lua b/tex/context/base/mkiv/syst-aux.lua index 06f6176b1..f9d8505f1 100644 --- a/tex/context/base/mkiv/syst-aux.lua +++ b/tex/context/base/mkiv/syst-aux.lua @@ -61,7 +61,7 @@ local ctx_doifelse = commands.doifelse implement { name = "doifelsefirstchar", - arguments = { "string", "string" }, + arguments = "2 strings", actions = function(str,chr) ctx_doifelse(lpegmatch(pattern,str) == chr) end @@ -69,7 +69,7 @@ implement { implement { name = "getsubstring", - arguments = { "string", "string", "string" }, + arguments = "3 strings", actions = function(str,first,last) context(utfsub(str,tonumber(first),tonumber(last))) end @@ -581,42 +581,42 @@ end implement { name = "doifelsecommon", actions = doifelsecommon, - arguments = { "string", "string" }, + arguments = "2 strings", } implement { name = "doifcommon", actions = doifcommon, - arguments = { "string", "string" }, + arguments = "2 strings", } implement { name = "doifnotcommon", actions = doifnotcommon, - arguments = { "string", "string" }, + arguments = "2 strings", } implement { name = "doifelseinset", actions = doifelseinset, - arguments = { "string", "string" }, + arguments = "2 strings", } implement { name = "doifinset", actions = doifinset, - arguments = { "string", "string" }, + arguments = "2 strings", } implement { name = "doifnotinset", actions = doifnotinset, - arguments = { "string", "string" }, + arguments = "2 strings", } -- implement { -- name = "stringcompare", --- arguments = { "string", "string" }, +-- arguments = "2 strings", -- actions = function(a,b) -- context((a == b and 0) or (a > b and 1) or -1) -- end @@ -624,7 +624,7 @@ implement { -- -- implement { -- name = "doifelsestringafter", --- arguments = { "string", "string" }, +-- arguments = "2 strings", -- actions = function(a,b) -- ctx_doifelse((a == b and 0) or (a > b and 1) or -1) -- end @@ -632,7 +632,7 @@ implement { -- -- implement { -- name = "doifelsestringbefore", --- arguments = { "string", "string" }, +-- arguments = "2 strings", -- actions = function(a,b) -- ctx_doifelse((a == b and 0) or (a < b and -1) or 1) -- end @@ -640,7 +640,7 @@ implement { -- implement { -- not faster than addtocommalist -- name = "additemtolist", -- unique --- arguments = { "string", "string" }, +-- arguments = "2 strings", -- actions = function(l,s) -- if l == "" or s == l then -- -- s = s diff --git a/tex/context/base/mkiv/toks-ini.lua b/tex/context/base/mkiv/toks-ini.lua index 8f95f6692..15e5df267 100644 --- a/tex/context/base/mkiv/toks-ini.lua +++ b/tex/context/base/mkiv/toks-ini.lua @@ -58,6 +58,7 @@ end local scan_toks = token.scan_toks local scan_string = token.scan_string +local scan_argument = token.scan_argument local scan_int = token.scan_int local scan_code = token.scan_code local scan_dimen = token.scan_dimen @@ -241,6 +242,7 @@ tokens.scanners = { -- these expand integer = scan_int, count = scan_int, string = scan_string, + argument = scan_argument, code = scan_code, word = scan_word, number = scan_number, diff --git a/tex/context/base/mkiv/toks-scn.lua b/tex/context/base/mkiv/toks-scn.lua index f3781d022..fe32a1de4 100644 --- a/tex/context/base/mkiv/toks-scn.lua +++ b/tex/context/base/mkiv/toks-scn.lua @@ -21,6 +21,7 @@ local scanners = tokens.scanners local tokenbits = tokens.bits local scanstring = scanners.string +local scanargument = scanners.argument local scaninteger = scanners.integer local scannumber = scanners.number local scankeyword = scanners.keyword @@ -240,6 +241,19 @@ local f_check = formatters[ [[ end ]] ] +-- using these shortcuts saves temporary small tables (okay, it looks uglier) + +local presets = { + ["1 string" ] = { "string" }, + ["2 strings"] = { "string", "string" }, + ["3 strings"] = { "string", "string", "string" }, + ["4 strings"] = { "string", "string", "string", "string" }, + ["5 strings"] = { "string", "string", "string", "string", "string" }, + ["6 strings"] = { "string", "string", "string", "string", "string", "string" }, + ["7 strings"] = { "string", "string", "string", "string", "string", "string", "string" }, + ["8 strings"] = { "string", "string", "string", "string", "string", "string", "string", "string" }, +} + function tokens.compile(specification) local f = { } local n = 0 @@ -305,6 +319,10 @@ function tokens.compile(specification) return c end end + local p = t and presets[t] + if p then + t = p + end local tt = type(t) if tt == "string" then if a then diff --git a/tex/context/base/mkiv/trac-ctx.lua b/tex/context/base/mkiv/trac-ctx.lua index 29159d130..33637fd66 100644 --- a/tex/context/base/mkiv/trac-ctx.lua +++ b/tex/context/base/mkiv/trac-ctx.lua @@ -57,16 +57,16 @@ implement { implement { name = "installtextracker", + arguments = "3 strings", actions = function(tag,enable,disable) install(textrackers,trackers.register,tag,enable,disable) end, - arguments = { "string", "string", "string" } } implement { name = "installtexdirective", + arguments = "3 strings", actions = function(tag,enable,disable) install(texdirectives,directives.register,tag,enable,disable) end, - arguments = { "string", "string", "string" } } diff --git a/tex/context/base/mkiv/trac-inf.lua b/tex/context/base/mkiv/trac-inf.lua index 5810e2059..439e8b2dc 100644 --- a/tex/context/base/mkiv/trac-inf.lua +++ b/tex/context/base/mkiv/trac-inf.lua @@ -177,10 +177,7 @@ function statistics.show() register("control sequences", function() return format("%s of %s + %s", status.cs_count, status.hash_size,status.hash_extra) end) - register("callbacks", function() - local total, indirect = status.callbacks or 0, status.indirect_callbacks or 0 - return format("%s direct, %s indirect, %s total", total-indirect, indirect, total) - end) + register("callbacks", statistics.callbacks) if TEXENGINE == "luajittex" and JITSUPPORTED then local jitstatus = jit.status if jitstatus then diff --git a/tex/context/base/mkiv/type-set.mkiv b/tex/context/base/mkiv/type-set.mkiv index 1ef137d39..1763de687 100644 --- a/tex/context/base/mkiv/type-set.mkiv +++ b/tex/context/base/mkiv/type-set.mkiv @@ -57,6 +57,9 @@ \fi +\definefilesynonym [type-imp-latin-modern.mkiv] [type-imp-latinmodern.mkiv] +\definefilesynonym [type-imp-modern-latin.mkiv] [type-imp-modernlatin.mkiv] + \definefilesynonym [type-imp-lucida.mkiv] [type-imp-lucida-typeone.mkiv] \definefilesynonym [type-imp-lucidaot.mkiv] [type-imp-lucida-opentype.mkiv] \definefilesynonym [type-imp-lucidadk.mkiv] [type-imp-lucida-opentype.mkiv] diff --git a/tex/context/base/mkiv/typo-inj.lua b/tex/context/base/mkiv/typo-inj.lua index 786c3c287..44b6c0a14 100644 --- a/tex/context/base/mkiv/typo-inj.lua +++ b/tex/context/base/mkiv/typo-inj.lua @@ -91,8 +91,8 @@ end implement { name = "resetinjector", actions = injectors.reset, arguments = "string" } implement { name = "showinjector", actions = injectors.show, arguments = "string" } -implement { name = "setinjector", actions = injectors.set, arguments = { "string", "string", "string" } } +implement { name = "setinjector", actions = injectors.set, arguments = "3 strings" } implement { name = "markinjector", actions = injectors.mark, arguments = "string" } -implement { name = "checkinjector", actions = injectors.check, arguments = { "string", "string" } } +implement { name = "checkinjector", actions = injectors.check, arguments = "2 strings" } --------- { name = "checkpreviousinjector", actions = injectors.check, arguments = { "string", tokens.constant(v_previous) } } --------- { name = "checknextinjector", actions = injectors.check, arguments = { "string", tokens.constant(v_next) } } diff --git a/tex/context/base/mkiv/util-str.lua b/tex/context/base/mkiv/util-str.lua index f76895aaf..05ff9f304 100644 --- a/tex/context/base/mkiv/util-str.lua +++ b/tex/context/base/mkiv/util-str.lua @@ -1081,6 +1081,7 @@ local function make(t,str) f = function() return str end end end + -- if jit then jit.on(f,true) end t[str] = f return f end diff --git a/tex/context/base/mkiv/util-tab.lua b/tex/context/base/mkiv/util-tab.lua index ebe51eb1a..1b069e2ae 100644 --- a/tex/context/base/mkiv/util-tab.lua +++ b/tex/context/base/mkiv/util-tab.lua @@ -153,15 +153,16 @@ function table.tocsv(t,specification) fields = sortedkeys(t[1]) end local separator = specification.separator or "," + local noffields = #fields if specification.preamble == true then - for f=1,#fields do + for f=1,noffields do r[f] = lpegmatch(escape,tostring(fields[f])) end result[1] = concat(r,separator) end for i=1,#t do local ti = t[i] - for f=1,#fields do + for f=1,noffields do local field = ti[fields[f]] if type(field) == "string" then r[f] = lpegmatch(escape,field) @@ -215,30 +216,31 @@ end local nspaces = utilities.strings.newrepeater(" ") local function toxml(t,d,result,step) + local r = #result for k, v in sortedpairs(t) do local s = nspaces[d] -- inlining this is somewhat faster but gives more formatters local tk = type(k) local tv = type(v) if tv == "table" then if tk == "number" then - result[#result+1] = formatters["%s<entry n='%s'>"](s,k) + r = r + 1 result[r] = formatters["%s<entry n='%s'>"](s,k) toxml(v,d+step,result,step) - result[#result+1] = formatters["%s</entry>"](s,k) + r = r + 1 result[r] = formatters["%s</entry>"](s,k) else - result[#result+1] = formatters["%s<%s>"](s,k) + r = r + 1 result[r] = formatters["%s<%s>"](s,k) toxml(v,d+step,result,step) - result[#result+1] = formatters["%s</%s>"](s,k) + r = r + 1 result[r] = formatters["%s</%s>"](s,k) end elseif tv == "string" then if tk == "number" then - result[#result+1] = formatters["%s<entry n='%s'>%!xml!</entry>"](s,k,v,k) + r = r + 1 result[r] = formatters["%s<entry n='%s'>%!xml!</entry>"](s,k,v,k) else - result[#result+1] = formatters["%s<%s>%!xml!</%s>"](s,k,v,k) + r = r + 1 result[r] = formatters["%s<%s>%!xml!</%s>"](s,k,v,k) end elseif tk == "number" then - result[#result+1] = formatters["%s<entry n='%s'>%S</entry>"](s,k,v,k) + r = r + 1 result[r] = formatters["%s<entry n='%s'>%S</entry>"](s,k,v,k) else - result[#result+1] = formatters["%s<%s>%S</%s>"](s,k,v,k) + r = r + 1 result[r] = formatters["%s<%s>%S</%s>"](s,k,v,k) end end end diff --git a/tex/context/fonts/mkiv/type-imp-modernlatin.mkiv b/tex/context/fonts/mkiv/type-imp-modernlatin.mkiv new file mode 100644 index 000000000..a3f4762f1 --- /dev/null +++ b/tex/context/fonts/mkiv/type-imp-modernlatin.mkiv @@ -0,0 +1,69 @@ +%D \module +%D [ file=type-imp-modernlatin, +%D version=2018.03.25, +%D title=\CONTEXT\ Typescript Macros, +%D subtitle=Modern Latin Modern, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\starttypescriptcollection[modernlatin] + + \definefontfeature[lm-rm-regular][effect={width=0.15,delta=1.00}] + \definefontfeature[lm-rm-bold] [effect={width=0.30,delta=1.00}] + \definefontfeature[lm-ss-regular][effect={width=0.10,delta=1.00}] + \definefontfeature[lm-ss-bold] [effect={width=0.20,delta=1.00}] + \definefontfeature[lm-tt-regular][effect={width=0.20,delta=1.00}] + \definefontfeature[lm-tt-bold] [effect={width=0.30,delta=1.00}] + + \starttypescript [\s!serif] [modern-latin] + % \loadfontgoodies[lm] + \definefontsynonym [Serif] [\s!file:lmroman10-regular] [\s!features={\s!default,lm-rm-regular}] + \definefontsynonym [SerifItalic] [\s!file:lmroman10-italic] [\s!features={\s!default,lm-rm-regular}] + \definefontsynonym [SerifSlanted] [\s!file:lmromanslant10-regular] [\s!features={\s!default,lm-rm-regular}] + \definefontsynonym [SerifBold] [\s!file:lmroman10-regular] [\s!features={\s!default,lm-rm-bold}] + \definefontsynonym [SerifBoldItalic] [\s!file:lmroman10-italic] [\s!features={\s!default,lm-rm-bold}] + \definefontsynonym [SerifBoldSlanted][\s!file:lmromanslant10-regular] [\s!features={\s!default,lm-rm-bold}] + \stoptypescript + + \starttypescript [\s!sans] [modern-latin] + % \loadfontgoodies[lm] + \definefontsynonym [Sans] [\s!file:lmsans10-regular] [\s!features={\s!default,lm-ss-regular}] + \definefontsynonym [SansItalic] [\s!file:lmsans10-oblique] [\s!features={\s!default,lm-ss-regular}] + \definefontsynonym [SansSlanted] [\s!file:lmsans10-oblique] [\s!features={\s!default,lm-ss-regular}] + \definefontsynonym [SansBold] [\s!file:lmsans10-regular] [\s!features={\s!default,lm-ss-bold}] + \definefontsynonym [SansBoldItalic] [\s!file:lmsans10-oblique] [\s!features={\s!default,lm-ss-bold}] + \definefontsynonym [SansBoldSlanted][\s!file:lmsans10-oblique] [\s!features={\s!default,lm-ss-bold}] + \stoptypescript + + \starttypescript [\s!mono] [modern-latin] + % \loadfontgoodies[lm] + \definefontsynonym [Mono] [\s!file:lmmono10-regular] [\s!features={\s!default,lm-tt-regular}] + \definefontsynonym [MonoItalic] [\s!file:lmmono10-italic] [\s!features={\s!default,lm-tt-regular}] + \definefontsynonym [MonoSlanted] [\s!file:lmmonoslant10-regular] [\s!features={\s!default,lm-tt-regular}] + \definefontsynonym [MonoBold] [\s!file:lmmono10-regular] [\s!features={\s!default,lm-tt-bold}] + \definefontsynonym [MonoBoldItalic] [\s!file:lmmono10-italic] [\s!features={\s!default,lm-tt-bold}] + \definefontsynonym [MonoBoldSlanted][\s!file:lmmonoslant10-regular] [\s!features={\s!default,lm-tt-bold}] + \stoptypescript + + \starttypescript [\s!math] [modern-latin] + \loadfontgoodies[lm] + \definefontsynonym [LMMathRoman-Regular] [\v!file:latinmodern-math-regular.otf] [\s!features={\s!math\mathsizesuffix,lm-math,mathextra},\s!goodies=lm] + \definefontsynonym [LMMathRoman-Bold] [\v!file:latinmodern-math-regular.otf] [\s!features={\s!math\mathsizesuffix,lm-math,mathextra},\s!goodies=lm] + \stoptypescript + + \starttypescript [modern-latin] + \definetypeface [\typescriptone] [\s!rm] [\s!serif] [modern-latin] [\s!default] + \definetypeface [\typescriptone] [\s!ss] [\s!sans] [modern-latin] [\s!default] + \definetypeface [\typescriptone] [\s!tt] [\s!mono] [modern-latin] [\s!default] + \definetypeface [\typescriptone] [\s!mm] [\s!math] [modern-latin] [\s!default] + \quittypescriptscanning + \stoptypescript + +\stoptypescriptcollection + +\endinput diff --git a/tex/context/interface/mkiv/i-context.pdf b/tex/context/interface/mkiv/i-context.pdf Binary files differindex 1245654ec..4ef3011df 100644 --- a/tex/context/interface/mkiv/i-context.pdf +++ b/tex/context/interface/mkiv/i-context.pdf diff --git a/tex/context/interface/mkiv/i-readme.pdf b/tex/context/interface/mkiv/i-readme.pdf Binary files differindex f2aa59006..d8b9f44d9 100644 --- a/tex/context/interface/mkiv/i-readme.pdf +++ b/tex/context/interface/mkiv/i-readme.pdf diff --git a/tex/context/modules/common/s-abbreviations-logos.tex b/tex/context/modules/common/s-abbreviations-logos.tex index f1966f544..c14265cc0 100644 --- a/tex/context/modules/common/s-abbreviations-logos.tex +++ b/tex/context/modules/common/s-abbreviations-logos.tex @@ -86,6 +86,7 @@ \logo [DVISCR] {dviscr} \logo [DVIWINDO] {dviwindo} \logo [EBCDIC] {ebcdic} +\logo [EU] {eu} \logo [EC] {ec} \logo [EIFFEL] {Eiffel} \logo [EMACS] {emacs} diff --git a/tex/context/modules/mkiv/m-punk.mkiv b/tex/context/modules/mkiv/m-punk.mkiv index b72abd64d..08a066359 100644 --- a/tex/context/modules/mkiv/m-punk.mkiv +++ b/tex/context/modules/mkiv/m-punk.mkiv @@ -11,6 +11,12 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. +%D You can actually turn a punk font into music (wintergatan): +%D +%D \starttyping +%D https://www.youtube.com/watch?v=g5c2Htj8Vtw +%D \stoptyping + \startluacode local concat = table.concat local round = math.round diff --git a/tex/context/modules/mkiv/s-fonts-basics.mkiv b/tex/context/modules/mkiv/s-fonts-basics.mkiv index f90009789..e9d0a21a2 100644 --- a/tex/context/modules/mkiv/s-fonts-basics.mkiv +++ b/tex/context/modules/mkiv/s-fonts-basics.mkiv @@ -52,6 +52,17 @@ local arabicscripts = table.sorted { local allindic = true local allarabic = true +local dotted = utf.char(0x25CC) + +local left = table.setmetatableindex ( + { r = dotted, b = dotted, t = dotted, s = dotted }, + function(t,k) local v = "" if k then t[k] = v end return v end +) + +local right = table.setmetatableindex ( + { l = dotted }, + function(t,k) local v = "" if k then t[k] = v end return v end +) for i=1,#indicscripts do local script = indicscripts[i] @@ -90,8 +101,10 @@ for i=1,#indicscripts do local indicmark = d.indicmark local indicorder = d.indicorder if allindic or indic == "d" or indicmark or indicclass or indicorder then + local l = left [indicmark] + local r = right[indicmark] context.NC() context("%U",i) - context.NC() context("\\showstruts\\strut\\TestFont %c",i) + context.NC() context("\\showstruts\\strut\\TestFont %s%c%s",l,i,r) context.NC() context(category) context.NC() context(indic or "?") context.NC() context(indicmark or "") diff --git a/tex/context/modules/mkiv/s-fonts-overlay.mkiv b/tex/context/modules/mkiv/s-fonts-overlay.mkiv new file mode 100644 index 000000000..fccc977d4 --- /dev/null +++ b/tex/context/modules/mkiv/s-fonts-overlay.mkiv @@ -0,0 +1,107 @@ +%D \module +%D [ file=s-fonts-overlay, +%D version=2018.03.25, +%D title=\CONTEXT\ Style File, +%D subtitle=Show Glyph Similarity, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +% begin info +% +% title : overlay glyphs in fonts +% +% comment : show glyphs in two fonts +% status : experimental, used for font feature development +% +% end info + +%D This module is for Luigi/Idris as part of the Husayni development where the +%D gpos pair, single, mark and cursive features are just linear transformations. + +\startmodule[fonts-coverage] + +\unprotect + +\definecolor[ColorOne][r=1,t=.5,a=1] +\definecolor[ColorTwo][b=1,t=.5,a=1] + +\startluacode + moduledata.fonts = moduledata.fonts or { } + moduledata.fonts.overlay = moduledata.fonts.overlay or { } + + function moduledata.fonts.overlay(id) + for k, v in table.sortedhash(fonts.hashes.identifiers[id or true].characters) do + context.showoverlayedglyphs(k) + end + end +\stopluacode + +\starttexdefinition unexpanded showoverlayedglyphs#1 + \startTEXpage[offset=.25\scratchdimentwo,height=10\scratchdimentwo,width=4\scratchdimenone] + \ruledhbox to \hsize\bgroup + \hss + \FontOne\setstrut\strut\showglyphs + \startoverlay + {\ColorOne\ruledhbox{\FontOne\char#1}} + {\ColorTwo\ruledhbox{\FontTwo\char#1}} + \stopoverlay + \hss + \egroup + \vfill + \dontleavehmode + \hbox to \hsize\bgroup + \hss + \infofont0x\uchexnumbers{#1} + \hss + \egroup + \stopTEXpage +\stoptexdefinition + +\starttexdefinition unexpanded showoverlayedfonts[#1] + \start + \getdummyparameters[\c!list=,#1] + \doifsomething {\dummyparameter\c!list} { + \page + \getfromcommacommand[\dummyparameter\c!list][1]\let\NameOne\commalistelement + \getfromcommacommand[\dummyparameter\c!list][2]\let\NameTwo\commalistelement + \definefont[FontOne][\NameOne] + \definefont[FontTwo][\NameTwo] + \FontOne\expandafter\edef\expandafter\OneID\expandafter{\number\fontid\font}% + \FontTwo\expandafter\edef\expandafter\TwoID\expandafter{\number\fontid\font}% + \scratchdimenone\emwidth + \scratchdimentwo\exheight + \ctxlua{moduledata.fonts.overlay(\OneID)}% + \page + % \startTEXpage[offset=.25\scratchdimentwo,height=10\scratchdimentwo,width=4\scratchdimenone] + % \vfill + % \hbox to \hsize{\ColorOne\infofont\hss\OneN\hss} + % \vfill + % \hbox to \hsize{\ColorTwo\infofont\hss\TwoN\hss} + % \vfill + % \stopTEXpage + % \page + } + \stop +\stoptexdefinition + +\protect + +\stopmodule + +\continueifinputfile{s-fonts-overlay.mkiv} + +\starttext + +% \showoverlayedfonts +% [list={file:husayni-script-regular.ttf @ 48.0pt, +% file:husayni-note-bold.ttf @ 34.2pt}] % 34.18726pt + + \showoverlayedfonts + [list={Serif,SerifBold}] + +\stoptext diff --git a/tex/context/modules/mkiv/s-tugboat.mkiv b/tex/context/modules/mkiv/s-tugboat.mkiv index 2b3b07d11..d3d15c3e7 100644 --- a/tex/context/modules/mkiv/s-tugboat.mkiv +++ b/tex/context/modules/mkiv/s-tugboat.mkiv @@ -23,8 +23,7 @@ [tugboat] [type=article, columns=no, - grid=yes - ] + grid=yes] \setvariables [tugboat] @@ -45,7 +44,7 @@ email={tugboat@tug.org}] %D \section Font Setup %<<<1 -%D +%D %D \TUGBOAT\ uses slightly different interline space than the default. %D So we change the interline space. @@ -121,7 +120,7 @@ \setupdescriptions [indentnext=no] -%D \section Itemize +%D \section Itemize %D %D And these. We typeset itemizations ragged right. @@ -158,7 +157,7 @@ subject, subsubject, subsubsubject] [style=bold, align=right, - before={\blank[8pt]}, + before={\blank[8pt]}, after={\blank[4pt]}] %D \section Spacing <<<1 @@ -173,8 +172,8 @@ \setupitemize[1][before={\blank[tugblank]},after={\blank[tugblank]}, inbetween={\blank[tugblank]}] -\setuplines[before={\blank[tugblank]},after={\blank[tugblank]}, - inbetween={\blank[tugblank]}] +\setuplines[before={\blank[tugblank]},after={\blank[tugblank]}, + inbetween={\blank[tugblank]}] %D \section Typing %<<<1 %D @@ -232,7 +231,7 @@ \definereferenceformat[cite][left={[},right={]}] \defineitemgroup [bibliography] [levels=1] -\setupitemgroup [bibliography] +\setupitemgroup [bibliography] [symbol=n, left={[}, right={]}, diff --git a/tex/context/modules/mkiv/x-asciimath.lua b/tex/context/modules/mkiv/x-asciimath.lua index 7785d5587..b0d45659e 100644 --- a/tex/context/modules/mkiv/x-asciimath.lua +++ b/tex/context/modules/mkiv/x-asciimath.lua @@ -50,9 +50,12 @@ local formatters = string.formatters local entities = characters.entities or { } local xmltext = xml.text +local xmlpure = xml.pure local xmlinclusion = xml.inclusion local xmlcollected = xml.collected +local lxmlgetid = lxml.getid + -- todo: use private unicodes as temporary slots ... easier to compare local s_lparent = "\\left\\lparent" @@ -2089,6 +2092,14 @@ interfaces.implement { arguments = { "string", true }, } +interfaces.implement { + name = "xmlasciimath", + actions = function(id) + convert(xmlpure(lxmlgetid(id))) + end, + arguments = "string" +} + local ctx_typebuffer = context.typebuffer local ctx_mathematics = context.mathematics local ctx_color = context.color @@ -2192,7 +2203,7 @@ end function show.filter(id,element) collected, indexed, ignored = { }, { }, { } - asciimath.filter(lxml.getid(id),element or "am",collected,indexed) + asciimath.filter(lxmlgetid(id),element or "am",collected,indexed) end function show.max() diff --git a/tex/context/modules/mkiv/x-asciimath.mkiv b/tex/context/modules/mkiv/x-asciimath.mkiv index 1b0567dbd..32eaf2af2 100644 --- a/tex/context/modules/mkiv/x-asciimath.mkiv +++ b/tex/context/modules/mkiv/x-asciimath.mkiv @@ -182,6 +182,23 @@ {\the\everyasciimath \clf_justasciimath{\detokenize\expandafter{\normalexpanded{#1}}}}} +% \unexpanded\def\xmlasciimath +% {\clf_xmlasciimath} + +\unexpanded\def\xmlasciimath + {\doifnextoptionalelse\xmlasciimath_yes\xmlasciimath_nop} + +\def\xmlasciimath_yes[#1]#2% + {\mathematics + [#1]% + {\the\everyasciimath% + \clf_xmlasciimath{#2}}} + +\def\xmlasciimath_nop#1% + {\mathematics + {\the\everyasciimath + \clf_xmlasciimath{#1}}} + \unexpanded\def\ctxmoduleasciimath#1% {\ctxlua{moduledata.asciimath.#1}} diff --git a/tex/context/sample/common/poe.tex b/tex/context/sample/common/poe.tex new file mode 100644 index 000000000..fd84b60a8 --- /dev/null +++ b/tex/context/sample/common/poe.tex @@ -0,0 +1,33 @@ +% title : A dream within a dream +% author : Edgar Allan Poe +% +% music : Propaganda (on: A Secret Wish) + +\startlines +Take this kiss upon the brow! +And, in parting from you now, +Thus much let me avow — +You are not wrong, who deem +That my days have been a dream; +Yet if hope has flown away +In a night, or in a day, +In a vision, or in none, +Is it therefore the less gone? +All that we see or seem +Is but a dream within a dream. +\blank +I stand amid the roar +Of a surf-tormented shore, +And I hold within my hand +Grains of the golden sand — +How few! yet how they creep +Through my fingers to the deep, +While I weep — while I weep! +O God! can I not grasp +Them with a tighter clasp? +O God! can I not save +One from the pitiless wave? +Is all that we see or seem +But a dream within a dream? +\stoplines + diff --git a/tex/context/sample/common/samples.tex b/tex/context/sample/common/samples.tex index a2ffcf088..d732a240e 100644 --- a/tex/context/sample/common/samples.tex +++ b/tex/context/sample/common/samples.tex @@ -58,6 +58,7 @@ used in testing bibliographic references and citations. \NC greenfield.tex \NC Susan Greenfield \NC Mind Change, how digital technologies are leaving their mark on the brain, Rider, London, 2014. \NC \NR +\NC poe.tex \NC Edgar Allan Poe \NC A dream within a dream, www.poetryfoundation.org. \NC \NR \stoptabulate % Tufte: This quote will always produce hyphenated text, apart from the content, diff --git a/tex/generic/context/luatex/luatex-basics-chr.lua b/tex/generic/context/luatex/luatex-basics-chr.lua index 8919418ce..14a55d7b0 100644 --- a/tex/generic/context/luatex/luatex-basics-chr.lua +++ b/tex/generic/context/luatex/luatex-basics-chr.lua @@ -2278,6 +2278,7 @@ characters.indicgroups={ [2760]=true, [2879]=true, [3008]=true, + [3021]=true, [3134]=true, [3135]=true, [3136]=true, @@ -2311,8 +2312,54 @@ characters.indicgroups={ [43249]=true, }, ["after_half"]={}, + ["after_main"]={ + [2864]=true, + [2879]=true, + [2902]=true, + [3376]=true, + }, ["after_postscript"]={ + [2433]=true, + [2494]=true, + [2496]=true, + [2519]=true, + [2561]=true, + [2562]=true, + [2622]=true, + [2624]=true, + [2625]=true, + [2626]=true, + [2672]=true, + [2673]=true, + [2750]=true, + [2752]=true, + [2753]=true, + [2754]=true, + [2755]=true, + [2756]=true, + [2761]=true, + [2763]=true, + [2764]=true, + [2786]=true, + [2787]=true, + [2878]=true, + [2880]=true, + [2903]=true, + [2992]=true, + [3006]=true, + [3007]=true, + [3009]=true, + [3010]=true, + [3031]=true, + [3120]=true, [3248]=true, + [3390]=true, + [3391]=true, + [3392]=true, + [3393]=true, + [3394]=true, + [3395]=true, + [3415]=true, }, ["after_subscript"]={ [2366]=true, @@ -2331,6 +2378,27 @@ characters.indicgroups={ [2380]=true, [2402]=true, [2403]=true, + [2480]=true, + [2497]=true, + [2498]=true, + [2499]=true, + [2500]=true, + [2530]=true, + [2531]=true, + [2544]=true, + [2631]=true, + [2632]=true, + [2635]=true, + [2636]=true, + [2757]=true, + [2759]=true, + [2760]=true, + [2881]=true, + [2882]=true, + [2883]=true, + [3008]=true, + [3139]=true, + [3140]=true, [3267]=true, [3268]=true, [3285]=true, @@ -2341,11 +2409,41 @@ characters.indicgroups={ }, ["before_half"]={ [2367]=true, + [2382]=true, + [2495]=true, + [2503]=true, + [2504]=true, + [2623]=true, + [2751]=true, + [2887]=true, + }, + ["before_main"]={ + [3014]=true, + [3015]=true, + [3016]=true, + [3398]=true, + [3399]=true, + [3400]=true, }, ["before_postscript"]={ [2352]=true, + [2736]=true, }, ["before_subscript"]={ + [2608]=true, + [2817]=true, + [3134]=true, + [3135]=true, + [3136]=true, + [3137]=true, + [3138]=true, + [3142]=true, + [3143]=true, + [3146]=true, + [3147]=true, + [3148]=true, + [3157]=true, + [3158]=true, [3262]=true, [3263]=true, [3265]=true, @@ -2393,7 +2491,6 @@ characters.indicgroups={ [2915]=true, [3009]=true, [3010]=true, - [3021]=true, [3170]=true, [3171]=true, [3260]=true, diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 8cd82afce..203ae5bf6 100644 --- a/tex/generic/context/luatex/luatex-fonts-merged.lua +++ b/tex/generic/context/luatex/luatex-fonts-merged.lua @@ -1,6 +1,6 @@ -- merged file : c:/data/develop/context/sources/luatex-fonts-merged.lua -- parent file : c:/data/develop/context/sources/luatex-fonts.lua --- merge date : 03/25/18 17:32:09 +-- merge date : 04/03/18 22:22:05 do -- begin closure to overcome local limits and interference @@ -7883,6 +7883,7 @@ characters.indicgroups={ [2760]=true, [2879]=true, [3008]=true, + [3021]=true, [3134]=true, [3135]=true, [3136]=true, @@ -7916,8 +7917,54 @@ characters.indicgroups={ [43249]=true, }, ["after_half"]={}, + ["after_main"]={ + [2864]=true, + [2879]=true, + [2902]=true, + [3376]=true, + }, ["after_postscript"]={ + [2433]=true, + [2494]=true, + [2496]=true, + [2519]=true, + [2561]=true, + [2562]=true, + [2622]=true, + [2624]=true, + [2625]=true, + [2626]=true, + [2672]=true, + [2673]=true, + [2750]=true, + [2752]=true, + [2753]=true, + [2754]=true, + [2755]=true, + [2756]=true, + [2761]=true, + [2763]=true, + [2764]=true, + [2786]=true, + [2787]=true, + [2878]=true, + [2880]=true, + [2903]=true, + [2992]=true, + [3006]=true, + [3007]=true, + [3009]=true, + [3010]=true, + [3031]=true, + [3120]=true, [3248]=true, + [3390]=true, + [3391]=true, + [3392]=true, + [3393]=true, + [3394]=true, + [3395]=true, + [3415]=true, }, ["after_subscript"]={ [2366]=true, @@ -7936,6 +7983,27 @@ characters.indicgroups={ [2380]=true, [2402]=true, [2403]=true, + [2480]=true, + [2497]=true, + [2498]=true, + [2499]=true, + [2500]=true, + [2530]=true, + [2531]=true, + [2544]=true, + [2631]=true, + [2632]=true, + [2635]=true, + [2636]=true, + [2757]=true, + [2759]=true, + [2760]=true, + [2881]=true, + [2882]=true, + [2883]=true, + [3008]=true, + [3139]=true, + [3140]=true, [3267]=true, [3268]=true, [3285]=true, @@ -7946,11 +8014,41 @@ characters.indicgroups={ }, ["before_half"]={ [2367]=true, + [2382]=true, + [2495]=true, + [2503]=true, + [2504]=true, + [2623]=true, + [2751]=true, + [2887]=true, + }, + ["before_main"]={ + [3014]=true, + [3015]=true, + [3016]=true, + [3398]=true, + [3399]=true, + [3400]=true, }, ["before_postscript"]={ [2352]=true, + [2736]=true, }, ["before_subscript"]={ + [2608]=true, + [2817]=true, + [3134]=true, + [3135]=true, + [3136]=true, + [3137]=true, + [3138]=true, + [3142]=true, + [3143]=true, + [3146]=true, + [3147]=true, + [3148]=true, + [3157]=true, + [3158]=true, [3262]=true, [3263]=true, [3265]=true, @@ -7998,7 +8096,6 @@ characters.indicgroups={ [2915]=true, [3009]=true, [3010]=true, - [3021]=true, [3170]=true, [3171]=true, [3260]=true, @@ -9149,12 +9246,22 @@ function constructors.scale(tfmdata,specification) else target.slant=0 end + local mode=parameters.mode or 0 + if mode~=0 then + target.mode=mode + end + local width=parameters.width or 0 + if width~=0 then + target.width=width + end targetparameters.factor=delta targetparameters.hfactor=hdelta targetparameters.vfactor=vdelta targetparameters.size=scaledpoints targetparameters.units=units targetparameters.scaledpoints=askedscaledpoints + targetparameters.mode=mode + targetparameters.width=width local isvirtual=properties.virtualized or tfmdata.type=="virtual" local hasquality=parameters.expansion or parameters.protrusion local hasitalics=properties.hasitalics @@ -9490,7 +9597,9 @@ function constructors.scale(tfmdata,specification) constructors.aftercopyingcharacters(target,tfmdata) constructors.trytosharefont(target,tfmdata) local vfonts=target.fonts - if isvirtual then +if isvirtual or target.type=="virtual" or properties.virtualized then + properties.virtualized=true +target.type="virtual" if not vfonts or #vfonts==0 then target.fonts={ { id=0 } } end @@ -9527,6 +9636,12 @@ function constructors.finalize(tfmdata) if not parameters.size then parameters.size=tfmdata.size end + if not parameters.mode then + parameters.mode=0 + end + if not parameters.width then + parameters.width=0 + end if not parameters.extendfactor then parameters.extendfactor=tfmdata.extend or 0 end @@ -9609,6 +9724,8 @@ function constructors.finalize(tfmdata) tfmdata.step=nil tfmdata.extend=nil tfmdata.slant=nil + tfmdata.mode=nil + tfmdata.width=nil tfmdata.units=nil tfmdata.units_per_em=nil tfmdata.cache=nil @@ -27600,7 +27717,7 @@ if not modules then modules={} end modules ['font-osd']={ } local insert,imerge,copy=table.insert,table.imerge,table.copy local next,type=next,type -local report_devanagari=logs.reporter("otf","devanagari") +local report=logs.reporter("otf","devanagari") fonts=fonts or {} fonts.analyzers=fonts.analyzers or {} fonts.analyzers.methods=fonts.analyzers.methods or { node={ otf={} } } @@ -27637,6 +27754,9 @@ local fontdata=fonts.hashes.identifiers local a_state=attributes.private('state') local a_syllabe=attributes.private('syllabe') local dotted_circle=0x25CC +local c_nbsp=0x00A0 +local c_zwnj=0x200C +local c_zwj=0x200D local states=fonts.analyzers.states local s_rphf=states.rphf local s_half=states.half @@ -27695,6 +27815,8 @@ if not indicgroups and characters then as={}, bh={}, ah={}, + bm={}, + am={}, } for k,v in next,characters.data do local i=v.indic @@ -27740,6 +27862,8 @@ if not indicgroups and characters then after_half=indicorders.ah, before_subscript=indicorders.bs, after_subscript=indicorders.as, + before_main=indicorders.bm, + after_main=indicorders.am, } indic=nil indicmarks=nil @@ -27763,19 +27887,25 @@ local nukta=indicgroups.nukta local halant=indicgroups.halant local ra=indicgroups.ra local anudatta=indicgroups.anudatta +local before_postscript=indicgroups.before_postscript +local after_postscript=indicgroups.after_postscript +local before_half=indicgroups.before_half +local after_half=indicgroups.after_half +local before_subscript=indicgroups.before_subscript local after_subscript=indicgroups.after_subscript -local mark_four={} -for k,v in next,pre_mark do mark_four[k]=pre_mark end -for k,v in next,above_mark do mark_four[k]=above_mark end -for k,v in next,below_mark do mark_four[k]=below_mark end -for k,v in next,post_mark do mark_four[k]=post_mark end -local mark_above_below_post={} -for k,v in next,above_mark do mark_above_below_post[k]=above_mark end -for k,v in next,below_mark do mark_above_below_post[k]=below_mark end -for k,v in next,post_mark do mark_above_below_post[k]=post_mark end -local c_nbsp=0x00A0 -local c_zwnj=0x200C -local c_zwj=0x200D +local before_main=indicgroups.before_main +local after_main=indicgroups.after_main +local mark_four=table.merged ( + pre_mark, + above_mark, + below_mark, + post_mark +) +local mark_above_below_post=table.merged ( + above_mark, + below_mark, + post_mark +) local zw_char={ [c_zwnj]=true, [c_zwj ]=true, @@ -27783,16 +27913,16 @@ local zw_char={ local dflt_true={ dflt=true } -local dev2_defaults={ +local two_defaults={ dev2=dflt_true, } -local deva_defaults={ +local one_defaults={ dev2=dflt_true, deva=dflt_true, } local false_flags={ false,false,false,false } local sequence_reorder_matras={ - features={ dv01=dev2_defaults }, + features={ dv01=two_defaults }, flags=false_flags, name="dv01_reorder_matras", order={ "dv01" }, @@ -27805,7 +27935,7 @@ local sequence_reorder_matras={ } } local sequence_reorder_reph={ - features={ dv02=dev2_defaults }, + features={ dv02=two_defaults }, flags=false_flags, name="dv02_reorder_reph", order={ "dv02" }, @@ -27818,7 +27948,7 @@ local sequence_reorder_reph={ } } local sequence_reorder_pre_base_reordering_consonants={ - features={ dv03=dev2_defaults }, + features={ dv03=two_defaults }, flags=false_flags, name="dv03_reorder_pre_base_reordering_consonants", order={ "dv03" }, @@ -27831,7 +27961,7 @@ local sequence_reorder_pre_base_reordering_consonants={ } } local sequence_remove_joiners={ - features={ dv04=deva_defaults }, + features={ dv04=one_defaults }, flags=false_flags, name="dv04_remove_joiners", order={ "dv04" }, @@ -27844,35 +27974,68 @@ local sequence_remove_joiners={ } } local basic_shaping_forms={ - nukt=true, + init=true, + abvs=true, akhn=true, - rphf=true, - pref=true, - rkrf=true, blwf=true, + calt=true, + cjct=true, half=true, + haln=true, + nukt=true, + pref=true, + pres=true, pstf=true, + psts=true, + rkrf=true, + rphf=true, vatu=true, - cjct=true, } local valid={ + abvs=true, akhn=true, - rphf=true, - pref=true, - half=true, blwf=true, + calt=true, + cjct=true, + half=true, + haln=true, + nukt=true, + pref=true, + pres=true, pstf=true, + psts=true, + rkrf=true, + rphf=true, + vatu=true, pres=true, + abvs=true, blws=true, psts=true, + haln=true, + calt=true, } +local scripts={} +local scripts_one={ "deva","mlym","beng","gujr","guru","knda","orya","taml","telu" } +local scripts_two={ "dev2","mlm2","bng2","gjr2","gur2","knd2","ory2","tml2","tel2" } +local nofscripts=#scripts_one +for i=1,nofscripts do + local one=scripts_one[i] + local two=scripts_two[i] + scripts[one]=true + scripts[two]=true + two_defaults[one]=dflt_true + one_defaults[one]=dflt_true + one_defaults[two]=dflt_true +end +local function valid_one(s) for i=1,nofscripts do if s[scripts_one[i]] then return true end end end +local function valid_two(s) for i=1,nofscripts do if s[scripts_two[i]] then return true end end end local function initializedevanagi(tfmdata) local script,language=otf.scriptandlanguage(tfmdata,attr) - if script=="deva" or script=="dev2" or script=="mlym" or script=="mlm2" then + if scripts[script] then local resources=tfmdata.resources local devanagari=resources.devanagari if not devanagari then - report_devanagari("adding devanagari features to font") + report("adding devanagari features to font") local gsubfeatures=resources.features.gsub local sequences=resources.sequences local sharedfeatures=tfmdata.shared.features @@ -27888,10 +28051,10 @@ local function initializedevanagi(tfmdata) end end local insertindex=lastmatch+1 - gsubfeatures["dv01"]=dev2_defaults - gsubfeatures["dv02"]=dev2_defaults - gsubfeatures["dv03"]=dev2_defaults - gsubfeatures["dv04"]=deva_defaults + gsubfeatures["dv01"]=two_defaults + gsubfeatures["dv02"]=two_defaults + gsubfeatures["dv03"]=two_defaults + gsubfeatures["dv04"]=one_defaults local reorder_pre_base_reordering_consonants=copy(sequence_reorder_pre_base_reordering_consonants) local reorder_reph=copy(sequence_reorder_reph) local reorder_matras=copy(sequence_reorder_matras) @@ -27939,8 +28102,8 @@ local function initializedevanagi(tfmdata) end end end - for kind,spec in next,features do - if spec.dev2 and valid[kind] then + for kind,spec in next,features do + if valid[kind] and valid_two(spec)then for i=1,nofsteps do local step=steps[i] local coverage=step.coverage @@ -27964,7 +28127,9 @@ local function initializedevanagi(tfmdata) end end end - seqsubset[#seqsubset+1]={ kind,coverage,reph } +if reph then + seqsubset[#seqsubset+1]={ kind,coverage,reph } +end end end end @@ -28009,8 +28174,14 @@ local function initializedevanagi(tfmdata) sharedfeatures["pstf"]=true sharedfeatures["pref"]=true sharedfeatures["dv03"]=true - gsubfeatures ["dv03"]=dev2_defaults + gsubfeatures ["dv03"]=two_defaults insert(sequences,insertindex,sequence_reorder_pre_base_reordering_consonants) + elseif script=="taml" then + sharedfeatures["dv04"]=true +sharedfeatures["pstf"]=true + elseif script=="tml2" then + else + report("todo: enable the right features for script %a",script) end end end @@ -28023,7 +28194,7 @@ registerotffeature { node=initializedevanagi, }, } -local function deva_initialize(font,attr) +local function initialize_one(font,attr) local tfmdata=fontdata[font] local datasets=otf.dataset(tfmdata,font,attr) local devanagaridata=datasets.devanagari @@ -28051,8 +28222,8 @@ local function deva_initialize(font,attr) end return devanagaridata.reph,devanagaridata.vattu,devanagaridata.blwfcache end -local function deva_reorder(head,start,stop,font,attr,nbspaces) - local reph,vattu,blwfcache=deva_initialize(font,attr) +local function reorder_one(head,start,stop,font,attr,nbspaces) + local reph,vattu,blwfcache=initialize_one(font,attr) local current=start local n=getnext(start) local base=nil @@ -28083,40 +28254,40 @@ local function deva_reorder(head,start,stop,font,attr,nbspaces) lastcons=current current=getnext(current) if current~=stop then - if nukta[getchar(current)] then + local char=getchar(current) + if nukta[char] then current=getnext(current) + char=getchar(current) end - if getchar(current)==c_zwj then - if current~=stop then - local next=getnext(current) - if next~=stop and halant[getchar(next)] then - current=next - next=getnext(current) - local tmp=next and getnext(next) or nil - local changestop=next==stop - local tempcurrent=copy_node(next) - copyinjection(tempcurrent,next) - local nextcurrent=copy_node(current) - copyinjection(nextcurrent,current) - setlink(tempcurrent,nextcurrent) - setprop(tempcurrent,a_state,s_blwf) - tempcurrent=processcharacters(tempcurrent,font) - setprop(tempcurrent,a_state,unsetvalue) - if getchar(next)==getchar(tempcurrent) then - flush_list(tempcurrent) - local n=copy_node(current) - copyinjection(n,current) - setchar(current,dotted_circle) - head=insert_node_after(head,current,n) - else - setchar(current,getchar(tempcurrent)) - local freenode=getnext(current) - setlink(current,tmp) - flush_node(freenode) - flush_list(tempcurrent) - if changestop then - stop=current - end + if char==c_zwj and current~=stop then + local next=getnext(current) + if next~=stop and halant[getchar(next)] then + current=next + next=getnext(current) + local tmp=next and getnext(next) or nil + local changestop=next==stop + local tempcurrent=copy_node(next) + copyinjection(tempcurrent,next) + local nextcurrent=copy_node(current) + copyinjection(nextcurrent,current) + setlink(tempcurrent,nextcurrent) + setprop(tempcurrent,a_state,s_blwf) + tempcurrent=processcharacters(tempcurrent,font) + setprop(tempcurrent,a_state,unsetvalue) + if getchar(next)==getchar(tempcurrent) then + flush_list(tempcurrent) + local n=copy_node(current) + copyinjection(n,current) + setchar(current,dotted_circle) + head=insert_node_after(head,current,n) + else + setchar(current,getchar(tempcurrent)) + local freenode=getnext(current) + setlink(current,tmp) + flush_node(freenode) + flush_list(tempcurrent) + if changestop then + stop=current end end end @@ -28389,9 +28560,11 @@ function handlers.devanagari_reorder_reph(head,start) local startprev=nil local startfont=getfont(start) local startattr=getprop(start,a_syllabe) + ::step_1:: + ::step_2:: while current do local char=ischar(current,startfont) - if char and getprop(current,a_syllabe)==startattr then + if char and getprop(current,a_syllabe)==startattr then if halant[char] and not getprop(current,a_state) then local next=getnext(current) if next then @@ -28414,11 +28587,13 @@ function handlers.devanagari_reorder_reph(head,start) break end end + ::step_3:: + ::step_4:: if not startnext then current=getnext(start) while current do local char=ischar(current,startfont) - if char and getprop(current,a_syllabe)==startattr then + if char and getprop(current,a_syllabe)==startattr then if getprop(current,a_state)==s_pstf then startnext=getnext(start) head=remove_node(head,start) @@ -28434,12 +28609,13 @@ function handlers.devanagari_reorder_reph(head,start) end end end + ::step_5:: if not startnext then current=getnext(start) local c=nil while current do local char=ischar(current,startfont) - if char and getprop(current,a_syllabe)==startattr then + if char and getprop(current,a_syllabe)==startattr then if not c and mark_above_below_post[char] and after_subscript[char] then c=current end @@ -28457,12 +28633,13 @@ function handlers.devanagari_reorder_reph(head,start) startattr=getprop(start,a_syllabe) end end + ::step_6:: if not startnext then current=start local next=getnext(current) while next do local nextchar=ischar(next,startfont) - if nextchar and getprop(next,a_syllabe)==startattr then + if nextchar and getprop(next,a_syllabe)==startattr then current=next next=getnext(current) else @@ -28559,7 +28736,7 @@ function handlers.devanagari_remove_joiners(head,start,kind,lookupname,replaceme flush_list(start) return head,stop,true end -local function dev2_initialize(font,attr) +local function initialize_two(font,attr) local devanagari=fontdata[font].resources.devanagari if devanagari then return devanagari.seqsubset or {},devanagari.reorderreph or {} @@ -28567,8 +28744,8 @@ local function dev2_initialize(font,attr) return {},{} end end -local function dev2_reorder(head,start,stop,font,attr,nbspaces) - local seqsubset,reorderreph=dev2_initialize(font,attr) +local function reorder_two(head,start,stop,font,attr,nbspaces) + local seqsubset,reorderreph=initialize_two(font,attr) local reph=false local halfpos=nil local basepos=nil @@ -28593,8 +28770,7 @@ local function dev2_reorder(head,start,stop,font,attr,nbspaces) if found[n] then local afternext=next~=stop and getnext(next) if afternext and zw_char[getchar(afternext)] then - current=next - current=getnext(current) + current=afternext elseif current==start then setprop(current,a_state,s_rphf) current=next @@ -29197,17 +29373,18 @@ local function analyze_next_chars_two(c,font) return c end end -local function inject_syntax_error(head,current,mark) +local show_syntax_errors=false +local function inject_syntax_error(head,current,char) local signal=copy_node(current) copyinjection(signal,current) - if mark==pre_mark then + if pre_mark[char] then setchar(signal,dotted_circle) else setchar(current,dotted_circle) end return insert_node_after(head,current,signal) end -function methods.deva(head,font,attr) +local function method_one(head,font,attr) head=tonut(head) local current=head local start=true @@ -29252,7 +29429,7 @@ function methods.deva(head,font,attr) local syllableend=analyze_next_chars_one(c,font,2) current=getnext(syllableend) if syllablestart~=syllableend then - head,current,nbspaces=deva_reorder(head,syllablestart,syllableend,font,attr,nbspaces) + head,current,nbspaces=reorder_one(head,syllablestart,syllableend,font,attr,nbspaces) current=getnext(current) end else @@ -29349,7 +29526,7 @@ function methods.deva(head,font,attr) end end if syllablestart~=syllableend then - head,current,nbspaces=deva_reorder(head,syllablestart,syllableend,font,attr,nbspaces) + head,current,nbspaces=reorder_one(head,syllablestart,syllableend,font,attr,nbspaces) current=getnext(current) end elseif independent_vowel[char] then @@ -29370,9 +29547,11 @@ function methods.deva(head,font,attr) end end else - local mark=mark_four[char] - if mark then - head,current=inject_syntax_error(head,current,mark) + if show_syntax_errors then + local mark=mark_four[char] + if mark then + head,current=inject_syntax_error(head,current,char) + end end current=getnext(current) end @@ -29385,10 +29564,9 @@ function methods.deva(head,font,attr) if nbspaces>0 then head=replace_all_nbsp(head) end - head=tonode(head) - return head,done + return tonode(head),done end -function methods.dev2(head,font,attr) +local function method_two(head,font,attr) head=tonut(head) local current=head local start=true @@ -29451,14 +29629,14 @@ function methods.dev2(head,font,attr) end end if syllableend and syllablestart~=syllableend then - head,current,nbspaces=dev2_reorder(head,syllablestart,syllableend,font,attr,nbspaces) + head,current,nbspaces=reorder_two(head,syllablestart,syllableend,font,attr,nbspaces) end - if not syllableend then + if not syllableend and show_syntax_errors then local char=ischar(current,font) if char and not getprop(current,a_state) then local mark=mark_four[char] if mark then - head,current=inject_syntax_error(head,current,mark) + head,current=inject_syntax_error(head,current,char) end end end @@ -29468,11 +29646,12 @@ function methods.dev2(head,font,attr) if nbspaces>0 then head=replace_all_nbsp(head) end - head=tonode(head) - return head,done + return tonode(head),done +end +for i=1,nofscripts do + methods[scripts_one[i]]=method_one + methods[scripts_two[i]]=method_two end -methods.mlym=methods.deva -methods.mlm2=methods.dev2 end -- closure |