summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--context/data/scite/context/lexers/data/scite-context-data-metafun.lua2
-rw-r--r--context/data/scite/context/scite-context-data-metafun.properties3
-rw-r--r--doc/context/documents/general/manuals/math-mkiv.pdfbin2722067 -> 2769223 bytes
-rw-r--r--doc/context/scripts/mkiv/mtx-grep.html12
-rw-r--r--doc/context/scripts/mkiv/mtx-grep.man9
-rw-r--r--doc/context/scripts/mkiv/mtx-grep.xml16
-rw-r--r--metapost/context/base/mpiv/mp-luas.mpiv4
-rw-r--r--metapost/context/base/mpiv/mp-mlib.mpiv229
-rw-r--r--metapost/context/base/mpiv/mp-tool.mpiv74
-rw-r--r--scripts/context/lua/mtx-grep.lua64
-rw-r--r--tex/context/base/context-version.pdfbin4254 -> 4259 bytes
-rw-r--r--tex/context/base/mkiv/cont-new.mkiv2
-rw-r--r--tex/context/base/mkiv/context.mkiv2
-rw-r--r--tex/context/base/mkiv/font-ext.lua32
-rw-r--r--tex/context/base/mkiv/font-osd.lua157
-rw-r--r--tex/context/base/mkiv/meta-ini.mkiv6
-rw-r--r--tex/context/base/mkiv/mlib-ctx.lua14
-rw-r--r--tex/context/base/mkiv/mlib-pdf.lua9
-rw-r--r--tex/context/base/mkiv/mlib-pps.lua53
-rw-r--r--tex/context/base/mkiv/mlib-pps.mkiv13
-rw-r--r--tex/context/base/mkiv/mlib-run.lua56
-rw-r--r--tex/context/base/mkiv/mult-fun.lua2
-rw-r--r--tex/context/base/mkiv/status-files.pdfbin9243 -> 9126 bytes
-rw-r--r--tex/context/base/mkiv/status-lua.pdfbin368801 -> 368957 bytes
-rw-r--r--tex/context/fonts/mkiv/type-imp-libertinus.mkiv82
-rw-r--r--tex/context/interface/mkiv/i-context.pdfbin774584 -> 774457 bytes
-rw-r--r--tex/context/interface/mkiv/i-readme.pdfbin60792 -> 60792 bytes
-rw-r--r--tex/generic/context/luatex/luatex-fonts-merged.lua143
28 files changed, 579 insertions, 405 deletions
diff --git a/context/data/scite/context/lexers/data/scite-context-data-metafun.lua b/context/data/scite/context/lexers/data/scite-context-data-metafun.lua
index 581d6e905..e707e9d3e 100644
--- a/context/data/scite/context/lexers/data/scite-context-data-metafun.lua
+++ b/context/data/scite/context/lexers/data/scite-context-data-metafun.lua
@@ -1,4 +1,4 @@
return {
- ["commands"]={ "transparency", "sqr", "log", "ln", "exp", "inv", "pow", "pi", "radian", "tand", "cotd", "sin", "cos", "tan", "cot", "atan", "asin", "acos", "invsin", "invcos", "invtan", "acosh", "asinh", "sinh", "cosh", "zmod", "paired", "tripled", "unitcircle", "fulldiamond", "unitdiamond", "fullsquare", "unittriangle", "fulltriangle", "llcircle", "lrcircle", "urcircle", "ulcircle", "tcircle", "bcircle", "lcircle", "rcircle", "lltriangle", "lrtriangle", "urtriangle", "ultriangle", "uptriangle", "downtriangle", "lefttriangle", "righttriangle", "triangle", "smoothed", "cornered", "superellipsed", "randomized", "randomizedcontrols", "squeezed", "enlonged", "shortened", "punked", "curved", "unspiked", "simplified", "blownup", "stretched", "enlarged", "leftenlarged", "topenlarged", "rightenlarged", "bottomenlarged", "crossed", "laddered", "randomshifted", "interpolated", "paralleled", "cutends", "peepholed", "llenlarged", "lrenlarged", "urenlarged", "ulenlarged", "llmoved", "lrmoved", "urmoved", "ulmoved", "rightarrow", "leftarrow", "centerarrow", "boundingbox", "innerboundingbox", "outerboundingbox", "pushboundingbox", "popboundingbox", "bottomboundary", "leftboundary", "topboundary", "rightboundary", "xsized", "ysized", "xysized", "sized", "xyscaled", "intersection_point", "intersection_found", "penpoint", "bbwidth", "bbheight", "withshade", "withcircularshade", "withlinearshade", "defineshade", "shaded", "shadedinto", "withshadecolors", "withshadedomain", "withshademethod", "withshadefactor", "withshadevector", "withshadecenter", "withshadedirection", "withshaderadius", "withshadetransform", "withshadestep", "withshadefraction", "cmyk", "spotcolor", "multitonecolor", "namedcolor", "drawfill", "undrawfill", "inverted", "uncolored", "softened", "grayed", "greyed", "onlayer", "along", "graphictext", "loadfigure", "externalfigure", "figure", "register", "outlinetext", "checkedbounds", "checkbounds", "strut", "rule", "withmask", "bitmapimage", "colordecimals", "ddecimal", "dddecimal", "ddddecimal", "textext", "thetextext", "rawtextext", "textextoffset", "texbox", "thetexbox", "rawtexbox", "verbatim", "thelabel", "label", "autoalign", "transparent", "withtransparency", "property", "properties", "withproperties", "asgroup", "infont", "space", "crlf", "dquote", "percent", "SPACE", "CRLF", "DQUOTE", "PERCENT", "grayscale", "greyscale", "withgray", "withgrey", "colorpart", "readfile", "clearxy", "unitvector", "center", "epsed", "anchored", "originpath", "infinite", "break", "xstretched", "ystretched", "snapped", "pathconnectors", "function", "constructedfunction", "constructedpath", "constructedpairs", "straightfunction", "straightpath", "straightpairs", "curvedfunction", "curvedpath", "curvedpairs", "evenly", "oddly", "condition", "pushcurrentpicture", "popcurrentpicture", "arrowpath", "tensecircle", "roundedsquare", "colortype", "whitecolor", "blackcolor", "basiccolors", "complementary", "complemented", "resolvedcolor", "normalfill", "normaldraw", "visualizepaths", "detailpaths", "naturalizepaths", "drawboundary", "drawwholepath", "drawpathonly", "visualizeddraw", "visualizedfill", "detaileddraw", "draworigin", "drawboundingbox", "drawpath", "drawpoint", "drawpoints", "drawcontrolpoints", "drawcontrollines", "drawpointlabels", "drawlineoptions", "drawpointoptions", "drawcontroloptions", "drawlabeloptions", "draworiginoptions", "drawboundoptions", "drawpathoptions", "resetdrawoptions", "undashed", "decorated", "redecorated", "undecorated", "passvariable", "passarrayvariable", "tostring", "format", "formatted", "startpassingvariable", "stoppassingvariable", "eofill", "eoclip", "nofill", "fillup", "eofillup", "area", "addbackground", "shadedup", "shadeddown", "shadedleft", "shadedright" },
+ ["commands"]={ "transparency", "sqr", "log", "ln", "exp", "inv", "pow", "pi", "radian", "tand", "cotd", "sin", "cos", "tan", "cot", "atan", "asin", "acos", "invsin", "invcos", "invtan", "acosh", "asinh", "sinh", "cosh", "zmod", "paired", "tripled", "unitcircle", "fulldiamond", "unitdiamond", "fullsquare", "unittriangle", "fulltriangle", "llcircle", "lrcircle", "urcircle", "ulcircle", "tcircle", "bcircle", "lcircle", "rcircle", "lltriangle", "lrtriangle", "urtriangle", "ultriangle", "uptriangle", "downtriangle", "lefttriangle", "righttriangle", "triangle", "smoothed", "cornered", "superellipsed", "randomized", "randomizedcontrols", "squeezed", "enlonged", "shortened", "punked", "curved", "unspiked", "simplified", "blownup", "stretched", "enlarged", "leftenlarged", "topenlarged", "rightenlarged", "bottomenlarged", "crossed", "laddered", "randomshifted", "interpolated", "paralleled", "cutends", "peepholed", "llenlarged", "lrenlarged", "urenlarged", "ulenlarged", "llmoved", "lrmoved", "urmoved", "ulmoved", "rightarrow", "leftarrow", "centerarrow", "boundingbox", "innerboundingbox", "outerboundingbox", "pushboundingbox", "popboundingbox", "bottomboundary", "leftboundary", "topboundary", "rightboundary", "xsized", "ysized", "xysized", "sized", "xyscaled", "intersection_point", "intersection_found", "penpoint", "bbwidth", "bbheight", "withshade", "withcircularshade", "withlinearshade", "defineshade", "shaded", "shadedinto", "withshadecolors", "withshadedomain", "withshademethod", "withshadefactor", "withshadevector", "withshadecenter", "withshadedirection", "withshaderadius", "withshadetransform", "withshadestep", "withshadefraction", "cmyk", "spotcolor", "multitonecolor", "namedcolor", "drawfill", "undrawfill", "inverted", "uncolored", "softened", "grayed", "greyed", "onlayer", "along", "graphictext", "loadfigure", "externalfigure", "figure", "register", "outlinetext", "checkedbounds", "checkbounds", "strut", "rule", "withmask", "bitmapimage", "colordecimals", "ddecimal", "dddecimal", "ddddecimal", "textext", "thetextext", "rawtextext", "textextoffset", "texbox", "thetexbox", "rawtexbox", "verbatim", "thelabel", "label", "autoalign", "transparent", "withtransparency", "property", "properties", "withproperties", "asgroup", "infont", "space", "crlf", "dquote", "percent", "SPACE", "CRLF", "DQUOTE", "PERCENT", "grayscale", "greyscale", "withgray", "withgrey", "colorpart", "readfile", "clearxy", "unitvector", "center", "epsed", "anchored", "originpath", "infinite", "break", "xstretched", "ystretched", "snapped", "pathconnectors", "function", "constructedfunction", "constructedpath", "constructedpairs", "straightfunction", "straightpath", "straightpairs", "curvedfunction", "curvedpath", "curvedpairs", "evenly", "oddly", "condition", "pushcurrentpicture", "popcurrentpicture", "arrowpath", "tensecircle", "roundedsquare", "colortype", "whitecolor", "blackcolor", "basiccolors", "complementary", "complemented", "resolvedcolor", "normalfill", "normaldraw", "visualizepaths", "detailpaths", "naturalizepaths", "drawboundary", "drawwholepath", "drawpathonly", "visualizeddraw", "visualizedfill", "detaileddraw", "draworigin", "drawboundingbox", "drawpath", "drawpoint", "drawpoints", "drawcontrolpoints", "drawcontrollines", "drawpointlabels", "drawlineoptions", "drawpointoptions", "drawcontroloptions", "drawlabeloptions", "draworiginoptions", "drawboundoptions", "drawpathoptions", "resetdrawoptions", "undashed", "decorated", "redecorated", "undecorated", "passvariable", "passarrayvariable", "tostring", "format", "formatted", "startpassingvariable", "stoppassingvariable", "eofill", "eoclip", "nofill", "fillup", "eofillup", "area", "addbackground", "shadedup", "shadeddown", "shadedleft", "shadedright", "sortlist", "copylist", "shapedlist", "listtocurves", "listtolines", "listsize" },
["internals"]={ "nocolormodel", "greycolormodel", "graycolormodel", "rgbcolormodel", "cmykcolormodel", "shadefactor", "textextoffset", "normaltransparent", "multiplytransparent", "screentransparent", "overlaytransparent", "softlighttransparent", "hardlighttransparent", "colordodgetransparent", "colorburntransparent", "darkentransparent", "lightentransparent", "differencetransparent", "exclusiontransparent", "huetransparent", "saturationtransparent", "colortransparent", "luminositytransparent", "ahvariant", "ahdimple", "ahfactor", "metapostversion", "maxdimensions", "drawoptionsfactor" },
} \ No newline at end of file
diff --git a/context/data/scite/context/scite-context-data-metafun.properties b/context/data/scite/context/scite-context-data-metafun.properties
index 9797c5395..94387df64 100644
--- a/context/data/scite/context/scite-context-data-metafun.properties
+++ b/context/data/scite/context/scite-context-data-metafun.properties
@@ -53,7 +53,8 @@ undashed decorated redecorated undecorated passvariable \
passarrayvariable tostring format formatted startpassingvariable \
stoppassingvariable eofill eoclip nofill fillup \
eofillup area addbackground shadedup shadeddown \
-shadedleft shadedright
+shadedleft shadedright sortlist copylist shapedlist \
+listtocurves listtolines listsize
keywordclass.metafun.internals=\
nocolormodel greycolormodel graycolormodel rgbcolormodel \
diff --git a/doc/context/documents/general/manuals/math-mkiv.pdf b/doc/context/documents/general/manuals/math-mkiv.pdf
index 916766a0a..5b6a5441e 100644
--- a/doc/context/documents/general/manuals/math-mkiv.pdf
+++ b/doc/context/documents/general/manuals/math-mkiv.pdf
Binary files differ
diff --git a/doc/context/scripts/mkiv/mtx-grep.html b/doc/context/scripts/mkiv/mtx-grep.html
index 45a32f987..3ba8e8547 100644
--- a/doc/context/scripts/mkiv/mtx-grep.html
+++ b/doc/context/scripts/mkiv/mtx-grep.html
@@ -42,10 +42,20 @@
<tr><th>--pattern</th><td></td><td>search for pattern (optional)</td></tr>
<tr><th>--count</th><td></td><td>count matches only</td></tr>
<tr><th>--nocomment</th><td></td><td>skip lines that start with %% or #</td></tr>
+ <tr><th>--n</th><td></td><td>show at most n matches</td></tr>
+ <tr><th>--first</th><td></td><td>only show first match</td></tr>
+ <tr><th>--match</th><td></td><td>return the match (if it is one)</td></tr>
<tr><th>--xml</th><td></td><td>pattern is lpath expression</td></tr>
</table>
<br/>
- </div>
+<h1>Examples</h1>
+<tt>mtxrun --script grep --pattern=module *.mkiv</tt>
+<br/><tt>mtxrun --script grep --pattern="modules.-%['(.-)'%]" char-*.lua --first</tt>
+<br/><tt>mtxrun --script grep --pattern=module --count *.mkiv</tt>
+<br/><tt>mtxrun --script grep --pattern=module --first *.mkiv</tt>
+<br/><tt>mtxrun --script grep --pattern=module --nocomment *.mkiv</tt>
+<br/><tt>mtxrun --script grep --pattern=module --n=10 *.mkiv</tt>
+<br/><br/> </div>
</div>
</body>
</html>
diff --git a/doc/context/scripts/mkiv/mtx-grep.man b/doc/context/scripts/mkiv/mtx-grep.man
index 2a3d30316..02c4db2f9 100644
--- a/doc/context/scripts/mkiv/mtx-grep.man
+++ b/doc/context/scripts/mkiv/mtx-grep.man
@@ -20,6 +20,15 @@ count matches only
.B --nocomment
skip lines that start with %% or #
.TP
+.B --n
+show at most n matches
+.TP
+.B --first
+only show first match
+.TP
+.B --match
+return the match (if it is one)
+.TP
.B --xml
pattern is lpath expression
.SH AUTHOR
diff --git a/doc/context/scripts/mkiv/mtx-grep.xml b/doc/context/scripts/mkiv/mtx-grep.xml
index d8567e035..a78565b57 100644
--- a/doc/context/scripts/mkiv/mtx-grep.xml
+++ b/doc/context/scripts/mkiv/mtx-grep.xml
@@ -11,10 +11,26 @@
<flag name="pattern"><short>search for pattern (optional)</short></flag>
<flag name="count"><short>count matches only</short></flag>
<flag name="nocomment"><short>skip lines that start with %% or #</short></flag>
+ <flag name="n"><short>show at most n matches</short></flag>
+ <flag name="first"><short>only show first match</short></flag>
+ <flag name="match"><short>return the match (if it is one)</short></flag>
<flag name="xml"><short>pattern is lpath expression</short></flag>
</subcategory>
</category>
</flags>
+ <examples>
+ <category>
+ <title>Examples</title>
+ <subcategory>
+ <example><command>mtxrun --script grep --pattern=module *.mkiv</command></example>
+ <example><command>mtxrun --script grep --pattern="modules.-%['(.-)'%]" char-*.lua --first</command></example>
+ <example><command>mtxrun --script grep --pattern=module --count *.mkiv</command></example>
+ <example><command>mtxrun --script grep --pattern=module --first *.mkiv</command></example>
+ <example><command>mtxrun --script grep --pattern=module --nocomment *.mkiv</command></example>
+ <example><command>mtxrun --script grep --pattern=module --n=10 *.mkiv</command></example>
+ </subcategory>
+ </category>
+ </examples>
<comments>
<comment>patterns are lua patterns and need to be escaped accordingly</comment>
</comments>
diff --git a/metapost/context/base/mpiv/mp-luas.mpiv b/metapost/context/base/mpiv/mp-luas.mpiv
index c7c97228e..2c640960b 100644
--- a/metapost/context/base/mpiv/mp-luas.mpiv
+++ b/metapost/context/base/mpiv/mp-luas.mpiv
@@ -57,6 +57,8 @@ vardef mlib_luas_luacall(text t) =
& decimal s
elseif boolean s :
& if s : "true" else : "false" fi
+ else :
+ & ditto & tostring(s) & ditto
fi endfor
)
enddef ;
@@ -75,6 +77,8 @@ vardef mlib_luas_lualist(expr c)(text t) =
& decimal s
elseif boolean s :
& if s : "true" else : "false" fi
+ else :
+ & ditto & tostring(s) & ditto
fi endfor & ")"
)
enddef ;
diff --git a/metapost/context/base/mpiv/mp-mlib.mpiv b/metapost/context/base/mpiv/mp-mlib.mpiv
index add58a43b..6daf5672e 100644
--- a/metapost/context/base/mpiv/mp-mlib.mpiv
+++ b/metapost/context/base/mpiv/mp-mlib.mpiv
@@ -1268,11 +1268,7 @@ primarydef t asgroup s = % s = isolated|knockout
wrappedpicture:= nullpicture ;
addto wrappedpicture contour groupbounds
withprescript "gr_state=start"
- withprescript "gr_type=" & s
- withprescript "gr_llx=" & decimal xpart llcorner groupbounds
- withprescript "gr_lly=" & decimal ypart llcorner groupbounds
- withprescript "gr_urx=" & decimal xpart urcorner groupbounds
- withprescript "gr_ury=" & decimal ypart urcorner groupbounds ;
+ withprescript "gr_type=" & s ;
addto wrappedpicture also grouppicture ;
addto wrappedpicture contour groupbounds
withprescript "gr_state=stop" ;
@@ -1369,19 +1365,6 @@ vardef mfun_boolean_to_string(expr b) =
if b : "true" else : "false" fi
enddef ;
-% def passvariable(expr key, value) =
-% special
-% if numeric value : "1:" & key & "=" & mfun_numeric_to_string(value)
-% elseif pair value : "4:" & key & "=" & mfun_pair_to_string(value)
-% elseif rgbcolor value : "5:" & key & "=" & mfun_rgbcolor_to_string(value)
-% elseif cmykcolor value : "6:" & key & "=" & mfun_cmykcolor_to_string(value)
-% elseif boolean value : "3:" & key & "=" & mfun_boolean_to_string(value)
-% elseif path value : "7:" & key & "=" & mfun_path_to_string(value)
-% elseif transform value : "8:" & key & "=" & mfun_transform_to_string(value)
-% else : "2:" & key & "=" & value
-% fi ;
-% enddef ;
-
vardef tostring(expr value) =
if numeric value : mfun_numeric_to_string(value)
elseif pair value : mfun_pair_to_string(value)
@@ -1407,178 +1390,106 @@ vardef mfun_tagged_string(expr value) =
fi
enddef ;
-% amore flexible variant for passing data to context
+% A more flexible variant for passing data to context. We used to construct strings
+% but running lua is fast enough so we can gain on string construction in metapost
+% which is also not that efficient.
-vardef mfun_point_to_lua(expr p,i) =
- "{" &
- decimal xpart (point i of p) & "," &
- decimal ypart (point i of p) & "," &
- decimal xpart (precontrol i of p) & "," &
- decimal ypart (precontrol i of p) & "," &
- decimal xpart (postcontrol i of p) & "," &
- decimal ypart (postcontrol i of p)
- & "}"
+vardef mfun_key_to_lua(expr k) =
+ if numeric k : decimal k else : "'" & k & "'" fi
enddef ;
-vardef mfun_transform_to_lua(expr t) =
- "{" &
- decimal xxpart t & "," & % rx
- decimal xypart t & "," & % sx
- decimal yxpart t & "," & % sy
- decimal yypart t & "," & % ry
- decimal xpart t & "," & % tx
- decimal ypart t % ty
- & "}"
+vardef mfun_point_to_lua(expr k,p,i) =
+ runscript( "metapost.setvariable(" & mfun_key_to_lua(k) & ",{" &
+ decimal xpart (point i of p) & "," &
+ decimal ypart (point i of p) & "," &
+ decimal xpart (precontrol i of p) & "," &
+ decimal ypart (precontrol i of p) & "," &
+ decimal xpart (postcontrol i of p) & "," &
+ decimal ypart (postcontrol i of p)
+ & "})" ) ;
enddef ;
-vardef mfun_numeric_to_lua(expr n) =
- decimal n
-enddef ;
-
-vardef mfun_pair_to_lua(expr p) =
- "{" &
- decimal xpart p & "," &
- decimal ypart p
- & "}"
+vardef mfun_transform_to_lua(expr k,t) =
+ runscript( "metapost.setvariable(" & mfun_key_to_lua(k) & ",{" &
+ decimal xxpart t & "," & % rx
+ decimal xypart t & "," & % sx
+ decimal yxpart t & "," & % sy
+ decimal yypart t & "," & % ry
+ decimal xpart t & "," & % tx
+ decimal ypart t % ty
+ & "})" ) ;
enddef ;
-vardef mfun_rgbcolor_to_lua(expr c) =
- "{" &
- decimal redpart c & "," &
- decimal greenpart c & "," &
- decimal bluepart c
- & "}"
+vardef mfun_numeric_to_lua(expr k,n) =
+ runscript( "metapost.setvariable(" & mfun_key_to_lua(k) & "," & decimal n & ")" ) ;
enddef ;
-vardef mfun_cmykcolor_to_lua(expr c) =
- "{" &
- decimal cyanpart c & "," &
- decimal magentapart c & "," &
- decimal yellowpart c & "," &
- decimal blackpart c
- & "}"
+vardef mfun_pair_to_lua(expr k,p) =
+ runscript( "metapost.setvariable(" & mfun_key_to_lua(k) & ",{" &
+ decimal xpart p & "," &
+ decimal ypart p
+ & "})" ) ;
enddef ;
-vardef mfun_path_to_lua(expr p) =
- "{" &
- mfun_point_to_lua(p,0) for i=1 upto length(p) : & "," & mfun_point_to_lua(p,i) endfor
- & "}"
+vardef mfun_rgbcolor_to_lua(expr k,c) =
+ runscript( "metapost.setvariable(" & mfun_key_to_lua(k) & ",{" &
+ decimal redpart c & "," &
+ decimal greenpart c & "," &
+ decimal bluepart c
+ & "})" ) ;
enddef ;
-vardef mfun_boolean_to_lua(expr b) =
- if b : "true" else : "false" fi
+vardef mfun_cmykcolor_to_lua(expr k,c) =
+ runscript( "metapost.setvariable(" & mfun_key_to_lua(k) & ",{" &
+ decimal cyanpart c & "," &
+ decimal magentapart c & "," &
+ decimal yellowpart c & "," &
+ decimal blackpart c
+ & "})" ) ;
enddef ;
-vardef mfun_string_to_lua(expr s) =
- "[==[" & s & "]==]"
+vardef mfun_path_to_lua(expr k,p) =
+ runscript("metapost.pushvariable(" & mfun_key_to_lua(k) & ")") ;
+ for i=0 upto length(p) :
+ mfun_point_to_lua(i+1,p,i) ;
+ endfor ;
+ runscript("metapost.popvariable()") ;
enddef ;
-def mfun_to_lua(expr key)(expr value)(text t) =
- special "metapost.variables['" & key & "']=" & t(value) ;
+vardef mfun_boolean_to_lua(expr k,b) =
+ runscript( "metapost.setvariable(" & mfun_key_to_lua(k) & if b : ",true)" else : ",false)" fi ) ;
enddef ;
-def mfun_array_to_lua(expr key)(suffix value)(expr first, last, stp)(text t) =
- special
- "metapost.variables['" & key & "']={"
- for i=first step stp until last :
- & "[" & decimal i & "]=" & t(value[i]) & ","
- endfor
- & "}" ;
+vardef mfun_string_to_lua(expr k,s) =
+ runscript( "metapost.setvariable(" & mfun_key_to_lua(k) & ",[==[" & s & "]==])" ) ;
enddef ;
def passvariable(expr key, value) =
- if numeric value : mfun_to_lua(key,value,mfun_numeric_to_lua)
- elseif pair value : mfun_to_lua(key,value,mfun_pair_to_lua)
- elseif string value : mfun_to_lua(key,value,mfun_string_to_lua)
- elseif boolean value : mfun_to_lua(key,value,mfun_boolean_to_lua)
- elseif path value : mfun_to_lua(key,value,mfun_path_to_lua)
- elseif rgbcolor value : mfun_to_lua(key,value,mfun_rgbcolor_to_lua)
- elseif cmykcolor value : mfun_to_lua(key,value,mfun_cmykcolor_to_lua)
- elseif transform value : mfun_to_lua(key,value,mfun_transform_to_lua)
+ if numeric value : mfun_numeric_to_lua (key,value) ;
+ elseif pair value : mfun_pair_to_lua (key,value) ;
+ elseif string value : mfun_string_to_lua (key,value) ;
+ elseif boolean value : mfun_boolean_to_lua (key,value) ;
+ elseif path value : mfun_path_to_lua (key,value) ;
+ elseif rgbcolor value : mfun_rgbcolor_to_lua (key,value) ;
+ elseif cmykcolor value : mfun_cmykcolor_to_lua(key,value) ;
+ elseif transform value : mfun_transform_to_lua(key,value) ;
fi ;
enddef ;
def passarrayvariable(expr key)(suffix values)(expr first, last, stp) =
- if numeric values[first] : mfun_array_to_lua(key,values,first,last,stp,mfun_numeric_to_lua)
- elseif pair values[first] : mfun_array_to_lua(key,values,first,last,stp,mfun_pair_to_lua)
- elseif string values[first] : mfun_array_to_lua(key,values,first,last,stp,mfun_string_to_lua)
- elseif boolean values[first] : mfun_array_to_lua(key,values,first,last,stp,mfun_boolean_to_lua)
- elseif path values[first] : mfun_array_to_lua(key,values,first,last,stp,mfun_path_to_lua)
- elseif rgbcolor values[first] : mfun_array_to_lua(key,values,first,last,stp,mfun_rgbcolor_to_lua)
- elseif cmykcolor values[first] : mfun_array_to_lua(key,values,first,last,stp,mfun_cmykcolor_to_lua)
- elseif transform values[first] : mfun_array_to_lua(key,values,first,last,stp,mfun_transform_to_lua)
- fi ;
+ runscript("metapost.pushvariable(" & mfun_key_to_lua(key) & ")") ;
+ for i=first step stp until last :
+ passvariable(i, values[i]) ;
+ endfor
+ runscript("metapost.popvariable()") ;
enddef ;
def startpassingvariable(expr k) =
- begingroup ;
- save stoppassingvariable, startarray, stoparray, starthash, stophash, index, key, value, slot, entry ;
- let stoppassingvariable = mfun_stop_lua_variable ;
- let startarray = mfun_start_lua_array ;
- let stoparray = mfun_stop_lua_array ;
- let starthash = mfun_start_lua_hash ;
- let stophash = mfun_stop_lua_hash ;
- let index = mfun_lua_index ;
- let key = mfun_lua_key ;
- let value = mfun_lua_value ;
- let slot = mfun_lua_slot ;
- let entry = mfun_lua_entry ;
- save s ; string s ;
- s := "metapost.variables['" & k & "']="
-enddef ;
-
-def mfun_stop_lua_variable =
- ;
- special substring(0,length(s)-1) of s ;
- endgroup ;
-enddef ;
-
-% currently there is no difference between array and hash
-
-def mfun_start_lua_array =
- & "{"
-enddef ;
-
-def mfun_stop_lua_array =
- & "},"
-enddef ;
-
-def mfun_start_lua_hash =
- & "{"
-enddef ;
-
-def mfun_stop_lua_hash =
- & "},"
-enddef ;
-
-def mfun_lua_key(expr k) =
- & "['" & k & "']="
-enddef ;
-
-def mfun_lua_index(expr k) =
- & "[" & decimal k & "]="
-enddef ;
-
-def mfun_lua_value(expr v) =
- if numeric v : & mfun_numeric_to_lua(v) & ","
- elseif pair v : & mfun_pair_to_lua(v) & ","
- elseif string v : & mfun_string_to_lua(v) & ","
- elseif boolean v : & mfun_boolean_to_lua(v) & ","
- elseif path v : & mfun_path_to_lua(v) & ","
- elseif rgbcolor v : & mfun_rgbcolor_to_lua(v) & ","
- elseif cmykcolor v : & mfun_cmykcolor_to_lua(v) & ","
- elseif transform v : & mfun_transform_to_lua(v) & ","
- fi
-enddef ;
-
-def mfun_lua_entry(expr k, v) =
- mfun_lua_key(k)
- mfun_lua_value(v)
+ runscript("metapost.pushvariable(" & mfun_key_to_lua(k) & ")") ;
enddef ;
-def mfun_lua_slot(expr k, v) =
- mfun_lua_index(k)
- mfun_lua_value(v)
+def stoppassingvariable =
+ runscript("metapost.popvariable()") ;
enddef ;
% moved here from mp-grap.mpiv
diff --git a/metapost/context/base/mpiv/mp-tool.mpiv b/metapost/context/base/mpiv/mp-tool.mpiv
index 01691724f..97e817075 100644
--- a/metapost/context/base/mpiv/mp-tool.mpiv
+++ b/metapost/context/base/mpiv/mp-tool.mpiv
@@ -2615,41 +2615,41 @@ vardef undecorated (text imagedata) text decoration =
currentpicture
enddef ;
-if metapostversion < 1.770 :
-
- vardef decorated (text imagedata) text decoration =
- save mfun_decorated_path, currentpicture ;
- picture mfun_decorated_path, currentpicture ;
- currentpicture := nullpicture ;
- imagedata ;
- mfun_decorated_path := currentpicture ;
- currentpicture := nullpicture ;
- for i within mfun_decorated_path :
- addto currentpicture
- if stroked i :
- doublepath pathpart i
- dashed dashpart i
- withpen penpart i
- withcolor colorpart i
- decoration
- elseif filled i :
- contour pathpart i
- withpen penpart i
- withcolor colorpart i
- decoration
- elseif textual i :
- also i
- withcolor colorpart i
- decoration
- else :
- also i
- fi
- ;
- endfor ;
- currentpicture
- enddef ;
-
-else:
+% if metapostversion < 1.770 :
+%
+% vardef decorated (text imagedata) text decoration =
+% save mfun_decorated_path, currentpicture ;
+% picture mfun_decorated_path, currentpicture ;
+% currentpicture := nullpicture ;
+% imagedata ;
+% mfun_decorated_path := currentpicture ;
+% currentpicture := nullpicture ;
+% for i within mfun_decorated_path :
+% addto currentpicture
+% if stroked i :
+% doublepath pathpart i
+% dashed dashpart i
+% withpen penpart i
+% withcolor colorpart i
+% decoration
+% elseif filled i :
+% contour pathpart i
+% withpen penpart i
+% withcolor colorpart i
+% decoration
+% elseif textual i :
+% also i
+% withcolor colorpart i
+% decoration
+% else :
+% also i
+% fi
+% ;
+% endfor ;
+% currentpicture
+% enddef ;
+%
+% else:
vardef decorated (text imagedata) text decoration =
save mfun_decorated_path, currentpicture ;
@@ -2689,7 +2689,7 @@ else:
currentpicture
enddef ;
-fi ;
+% fi ;
vardef redecorated (text imagedata) text decoration =
save mfun_decorated_path, currentpicture ;
@@ -2918,7 +2918,7 @@ enddef ;
%D The sorter is used in:
-vardef shaped (suffix p) = % takes a list of paths
+vardef shapedlist(suffix p) = % takes a list of paths
save l ; pair l[] ;
save r ; pair r[] ;
save i ; i := 1 ;
diff --git a/scripts/context/lua/mtx-grep.lua b/scripts/context/lua/mtx-grep.lua
index d0f33cb21..0c4364630 100644
--- a/scripts/context/lua/mtx-grep.lua
+++ b/scripts/context/lua/mtx-grep.lua
@@ -6,6 +6,9 @@ if not modules then modules = { } end modules ['mtx-babel'] = {
license = "see context related readme files"
}
+-- If needed this one can be optimized for speed as well as use some existing
+-- helpers. We can quit faster on max, and probably use lpeg instead of find.
+
local helpinfo = [[
<?xml version="1.0"?>
<application>
@@ -20,10 +23,26 @@ local helpinfo = [[
<flag name="pattern"><short>search for pattern (optional)</short></flag>
<flag name="count"><short>count matches only</short></flag>
<flag name="nocomment"><short>skip lines that start with %% or #</short></flag>
+ <flag name="n"><short>show at most n matches</short></flag>
+ <flag name="first"><short>only show first match</short></flag>
+ <flag name="match"><short>return the match (if it is one)</short></flag>
<flag name="xml"><short>pattern is lpath expression</short></flag>
</subcategory>
</category>
</flags>
+ <examples>
+ <category>
+ <title>Examples</title>
+ <subcategory>
+ <example><command>mtxrun --script grep --pattern=module *.mkiv</command></example>
+ <example><command>mtxrun --script grep --pattern="modules.-%['(.-)'%]" char-*.lua --first</command></example>
+ <example><command>mtxrun --script grep --pattern=module --count *.mkiv</command></example>
+ <example><command>mtxrun --script grep --pattern=module --first *.mkiv</command></example>
+ <example><command>mtxrun --script grep --pattern=module --nocomment *.mkiv</command></example>
+ <example><command>mtxrun --script grep --pattern=module --n=10 *.mkiv</command></example>
+ </subcategory>
+ </category>
+ </examples>
<comments>
<comment>patterns are lua patterns and need to be escaped accordingly</comment>
</comments>
@@ -41,7 +60,8 @@ local report = application.report
scripts = scripts or { }
scripts.grep = scripts.grep or { }
-local find, format = string.find, string.format
+local find, match, format = string.find, string.match, string.format
+local lpegmatch = lpeg.match
local cr = lpeg.P("\r")
local lf = lpeg.P("\n")
@@ -59,14 +79,17 @@ function scripts.grep.find(pattern, files, offset)
if pattern and pattern ~= "" then
statistics.starttiming(scripts.grep)
local nofmatches, noffiles, nofmatchedfiles = 0, 0, 0
- local n, m, name, check = 0, 0, "", nil
- local count, nocomment = environment.argument("count"), environment.argument("nocomment")
+ local n, m, check = 0, 0, nil
+ local name = ""
+ local count = environment.argument("count")
+ local nocomment = environment.argument("nocomment")
+ local max = tonumber(environment.argument("n")) or (environment.argument("first") and 1) or false
+ local domatch = environment.argument("match")
if environment.argument("xml") then
for i=offset or 1, #files do
local globbed = dir.glob(files[i])
for i=1,#globbed do
- local nam = globbed[i]
- name = nam
+ name = globbed[i]
local data = xml.load(name)
if data and not data.error then
n, m, noffiles = 0, 0, noffiles + 1
@@ -83,7 +106,9 @@ function scripts.grep.find(pattern, files, offset)
else
for c in xml.collected(data,pattern) do
m = m + 1
- write_nl(format("%s: %s",name,xml.tostring(c)))
+ if not max or m <= max then
+ write_nl(format("%s: %s",name,xml.tostring(c)))
+ end
end
end
end
@@ -107,8 +132,14 @@ function scripts.grep.find(pattern, files, offset)
-- skip
elseif find(line,pattern) then
m = m + 1
- write_nl(format("%s %6i: %s",name,n,line))
- io.flush()
+ if not max or m <= max then
+ if domatch then
+ write_nl(match(line,pattern))
+ else
+ write_nl(format("%s %6i: %s",name,n,line))
+ end
+ io.flush()
+ end
end
end
end
@@ -125,22 +156,27 @@ function scripts.grep.find(pattern, files, offset)
n = n + 1
if find(line,pattern) then
m = m + 1
- write_nl(format("%s %6i: %s",name,n,line))
- io.flush()
+ if not max or m <= max then
+ if domatch then
+ write_nl(match(line,pattern))
+ else
+ write_nl(format("%s %6i: %s",name,n,line))
+ end
+ io.flush()
+ end
end
end
end
end
- local capture = (content/check)^0
+ local capture = (content/check)^0 -- todo: break out when max
for i=offset or 1, #files do
local globbed = dir.glob(files[i])
for i=1,#globbed do
- local nam = globbed[i]
- name = nam
+ name = globbed[i]
local data = io.loaddata(name)
if data then
n, m, noffiles = 0, 0, noffiles + 1
- capture:match(data)
+ lpegmatch(capture,data)
if count and m > 0 then
nofmatches = nofmatches + m
nofmatchedfiles = nofmatchedfiles + 1
diff --git a/tex/context/base/context-version.pdf b/tex/context/base/context-version.pdf
index 69fc2e6c2..372d2f1cc 100644
--- a/tex/context/base/context-version.pdf
+++ b/tex/context/base/context-version.pdf
Binary files differ
diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv
index aaf7f7186..91d6a5598 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{2016.08.19 00:30}
+\newcontextversion{2016.08.20 13:39}
%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 b49ed822b..8e4dcf8ea 100644
--- a/tex/context/base/mkiv/context.mkiv
+++ b/tex/context/base/mkiv/context.mkiv
@@ -39,7 +39,7 @@
%D up and the dependencies are more consistent.
\edef\contextformat {\jobname}
-\edef\contextversion{2016.08.19 00:30}
+\edef\contextversion{2016.08.20 13:39}
\edef\contextkind {beta}
%D For those who want to use this:
diff --git a/tex/context/base/mkiv/font-ext.lua b/tex/context/base/mkiv/font-ext.lua
index cadce625c..2fc85c266 100644
--- a/tex/context/base/mkiv/font-ext.lua
+++ b/tex/context/base/mkiv/font-ext.lua
@@ -1084,3 +1084,35 @@ implement {
end
end
}
+
+-- relatively new:
+
+do
+
+ local extraprivates = { }
+
+ function fonts.helpers.addextraprivate(name,f)
+ extraprivates[#extraprivates+1] = { name, f }
+ end
+
+ local function addextraprivates(tfmdata)
+ for i=1,#extraprivates do
+ local e = extraprivates[i]
+ local c = e[2](tfmdata)
+ if c then
+ fonts.helpers.addprivate(tfmdata, e[1], c)
+ end
+ end
+ end
+
+ fonts.constructors.newfeatures.otf.register {
+ name = "extraprivates",
+ description = "extra privates",
+ default = true,
+ manipulators = {
+ base = addextraprivates,
+ node = addextraprivates,
+ }
+ }
+
+end
diff --git a/tex/context/base/mkiv/font-osd.lua b/tex/context/base/mkiv/font-osd.lua
index 26af69187..8ddd9a272 100644
--- a/tex/context/base/mkiv/font-osd.lua
+++ b/tex/context/base/mkiv/font-osd.lua
@@ -613,13 +613,12 @@ local function initializedevanagi(tfmdata)
local steps = sequence.steps
local nofsteps = sequence.nofsteps
local features = sequence.features
- if features["rphf"] then
- -- deva
+ local has_rphf = features.rphf
+ local has_blwf = features.blwf
+ if has_rphf and has_rphf.deva then
devanagari.reph = true
- elseif features["blwf"] then
- -- deva
+ elseif has_blwf and has_blwf.deva then
devanagari.vattu = true
- -- dev2
for i=1,nofsteps do
local step = steps[i]
local coverage = step.coverage
@@ -632,59 +631,72 @@ local function initializedevanagi(tfmdata)
end
end
end
- if valid[kind] then
- for i=1,nofsteps do
- local step = steps[i]
- local coverage = step.coverage
- if coverage then
- local reph = false
- if step.osdstep then
- -- rphf acts on consonant + halant
- for k, v in next, ra do
- local r = coverage[k]
- if r then
- local h = false
- for k, v in next, halant do
- local h = r[k]
- if h then
- reph = h.ligature or false
- break
+ for kind, spec in next, features do -- beware, this is
+ if spec.dev2 and valid[kind] then
+ for i=1,nofsteps do
+ local step = steps[i]
+ local coverage = step.coverage
+ if coverage then
+ local reph = false
+ if kind == "rphf" then
+ --
+ -- KE: I don't understand the rationale behind osdstep. The original if
+ -- statement checked whether coverage is contextual chaining.
+ --
+ -- HH: The osdstep signals that we deal with our own feature here, not
+ -- one in the font itself so it was just a safeguard against us overloading
+ -- something driven by the font.
+ --
+ -- if step.osdstep then -- selective
+ if true then -- always
+ -- rphf acts on consonant + halant
+ for k, v in next, ra do
+ local r = coverage[k]
+ if r then
+ local h = false
+ for k, v in next, halant do
+ local h = r[k]
+ if h then
+ reph = h.ligature or false
+ break
+ end
+ end
+ if reph then
+ break
+ end
end
end
- if reph then
- break
- end
+ else
+ -- rphf might be result of other handler/chainproc
end
end
- else
- -- rphf might be result of other handler/chainproc
+ seqsubset[#seqsubset+1] = { kind, coverage, reph }
end
- seqsubset[#seqsubset+1] = { kind, coverage, reph }
end
end
- end
- if kind == "pref" then
- local sequence = dataset[3] -- was [5]
- local steps = sequence.steps
- local nofsteps = sequence.nofsteps
- for i=1,nofsteps do
- local step = steps[i]
- local coverage = step.coverage
- if coverage then
- for k, v in next, halant do
- local h = coverage[k]
- if h then
- local found = false
- for k, v in next, h do
- found = v and v.ligature
+ if kind == "pref" then
+ local sequence = dataset[3] -- was [5]
+ local steps = sequence.steps
+ local nofsteps = sequence.nofsteps
+ for i=1,nofsteps do
+ local step = steps[i]
+ local coverage = step.coverage
+ if coverage then
+ for k, v in next, halant do
+ local h = coverage[k]
+ if h then
+ local found = false
+ for k, v in next, h do
+ found = v and v.ligature
+ if found then
+ pre_base_reordering_consonants[k] = found
+ break
+ end
+ end
if found then
- pre_base_reordering_consonants[k] = found
break
end
end
- if found then
- break
- end
end
end
end
@@ -1132,6 +1144,8 @@ function handlers.devanagari_reorder_matras(head,start) -- no leak
start = startnext
break
end
+ else
+ break
end
current = next
end
@@ -1171,12 +1185,12 @@ function handlers.devanagari_reorder_reph(head,start)
local startfont = getfont(start)
local startattr = getprop(start,a_syllabe)
while current do
- local char = ischar(current,font)
+ local char = ischar(current,startfont)
if char and getprop(current,a_syllabe) == startattr then -- step 2
if halant[char] and not getprop(current,a_state) then
local next = getnext(current)
if next then
- local nextchar = ischar(next,font)
+ local nextchar = ischar(next,startfont)
if nextchar and zw_char[nextchar] and getprop(next,a_syllabe) == startattr then
current = next
next = getnext(current)
@@ -1198,7 +1212,7 @@ function handlers.devanagari_reorder_reph(head,start)
if not startnext then
current = getnext(start)
while current do
- local char = ischar(current,font)
+ local char = ischar(current,startfont)
if char and getprop(current,a_syllabe) == startattr then -- step 4
if getprop(current,a_state) == s_pstf then -- post-base
startnext = getnext(start)
@@ -1223,7 +1237,7 @@ function handlers.devanagari_reorder_reph(head,start)
current = getnext(start)
local c = nil
while current do
- local char = ischar(current,font)
+ local char = ischar(current,startfont)
if char and getprop(current,a_syllabe) == startattr then -- step 5
if not c and mark_above_below_post[char] and reorder_class[char] ~= "after subscript" then
c = current
@@ -1250,7 +1264,7 @@ function handlers.devanagari_reorder_reph(head,start)
current = start
local next = getnext(current)
while next do
- local nextchar = ischar(next,font)
+ local nextchar = ischar(next,startfont)
if nextchar and getprop(next,a_syllabe) == startattr then --step 6
current = next
next = getnext(current)
@@ -1263,7 +1277,7 @@ function handlers.devanagari_reorder_reph(head,start)
head = remove_node(head,start)
local next = getnext(current)
setlink(start,next)
- setlink(current,"next",start)
+ setlink(current,start)
start = startnext
end
end
@@ -1290,12 +1304,12 @@ function handlers.devanagari_reorder_pre_base_reordering_consonants(head,start)
local startattr = getprop(start,a_syllabe)
-- can be fast for loop + caching state
while current do
- local char = ischar(current,font)
+ local char = ischar(current,startfont)
if char and getprop(current,a_syllabe) == startattr then
local next = getnext(current)
if halant[char] and not getprop(current,a_state) then
if next then
- local nextchar = ischar(next,font)
+ local nextchar = ischar(next,startfont)
if nextchar and getprop(next,a_syllabe) == startattr then
if nextchar == c_zwnj or nextchar == c_zwj then
current = next
@@ -1319,13 +1333,13 @@ function handlers.devanagari_reorder_pre_base_reordering_consonants(head,start)
current = getnext(start)
startattr = getprop(start,a_syllabe)
while current do
- local char = ischar(current,font)
+ local char = ischar(current,startfont)
if char and getprop(current,a_syllabe) == startattr then
if not consonant[char] and getprop(current,a_state) then -- main
startnext = getnext(start)
removenode(start,start)
local prev = getprev(current)
- setlink(start,prev)
+ setlink(prev,start)
setlink(start,current)
start = startnext
break
@@ -1426,21 +1440,7 @@ local function dev2_reorder(head,start,stop,font,attr,nbspaces) -- maybe do a pa
local kind = subset[1]
local lookupcache = subset[2]
if kind == "rphf" then
- for k, v in next, ra do
- local r = lookupcache[k]
- if r then
- for k, v in next, halant do
- local h = r[k]
- if h then
- reph = h.ligature or false
- break
- end
- end
- if reph then
- break
- end
- end
- end
+ reph = subset[3]
local current = start
local last = getnext(stop)
while current ~= last do
@@ -1473,7 +1473,7 @@ local function dev2_reorder(head,start,stop,font,attr,nbspaces) -- maybe do a pa
if current ~= stop then
local c = locl[current] or getchar(current)
local found = lookupcache[c]
- if found then
+ if found then -- pre-base: pref Halant + Consonant
local next = getnext(current)
local n = locl[next] or getchar(next)
if found[n] then
@@ -1718,7 +1718,7 @@ local function dev2_reorder(head,start,stop,font,attr,nbspaces) -- maybe do a pa
local prev = getprev(current)
if prev ~= target then
local next = getnext(current)
- setlink(next,prev)
+ setlink(prev,next)
if current == stop then
stop = prev
end
@@ -1752,7 +1752,7 @@ local function dev2_reorder(head,start,stop,font,attr,nbspaces) -- maybe do a pa
stop = current
end
local prev = getprev(c)
- setlink(next,prev)
+ setlink(prev,next)
local nextnext = getnext(next)
setnext(current,nextnext)
local nextnextnext = getnext(nextnext)
@@ -1766,6 +1766,9 @@ local function dev2_reorder(head,start,stop,font,attr,nbspaces) -- maybe do a pa
end
if getchar(base) == c_nbsp then
+ if base == stop then
+ stop = getprev(stop)
+ end
nbspaces = nbspaces - 1
head = remove_node(head, base)
flush_node(base)
@@ -1815,7 +1818,7 @@ local function analyze_next_chars_one(c,font,variant) -- skip one dependent vowe
elseif (vv == c_zwnj or vv == c_zwj) and halant[vvv] then
local nnnn = getnext(nnn)
if nnnn then
- local vvvv = ischar(nnnn)
+ local vvvv = ischar(nnnn,font)
if vvvv and consonant[vvvv] then
c = nnnn
end
@@ -1838,7 +1841,7 @@ local function analyze_next_chars_one(c,font,variant) -- skip one dependent vowe
local nn = getnext(n)
if nn then
local vv = ischar(nn,font)
- if vv and zw_char[vv] then
+ if vv and zw_char[v] then
n = nn
v = vv
nn = getnext(nn)
diff --git a/tex/context/base/mkiv/meta-ini.mkiv b/tex/context/base/mkiv/meta-ini.mkiv
index b07574573..22856ec40 100644
--- a/tex/context/base/mkiv/meta-ini.mkiv
+++ b/tex/context/base/mkiv/meta-ini.mkiv
@@ -1492,6 +1492,12 @@
\def\MPruntab#1#2{\clf_mpruntab{#1}#2\relax} \let\mpruntab\MPruntab % #2 is number
\def\MPrunset#1#2{\clf_mprunset{#1}{#2}} \let\mprunset\MPrunset
+\prependtoks \clf_mppushvariables \to \everybeforepagebody
+\appendtoks \clf_mppopvariables \to \everyafterpagebody
+
+\let\MPpushvariables\clf_mppushvariables
+\let\MPpopvariables \clf_mppopvariables
+
%D We also provide an outputless run:
\unexpanded\def\startMPcalculation
diff --git a/tex/context/base/mkiv/mlib-ctx.lua b/tex/context/base/mkiv/mlib-ctx.lua
index 3fe7118b7..7b1584d7e 100644
--- a/tex/context/base/mkiv/mlib-ctx.lua
+++ b/tex/context/base/mkiv/mlib-ctx.lua
@@ -23,6 +23,8 @@ local mplib = mplib
metapost = metapost or {}
local metapost = metapost
+local context = context
+
local setters = tokens.setters
local setmacro = setters.macro
local implement = interfaces.implement
@@ -177,6 +179,7 @@ implement {
implement {
name = "mprunset",
+ arguments = { "string", "string" },
actions = function(name,connector)
local value = metapost.variables[name]
if value ~= nil then
@@ -282,7 +285,6 @@ end
function metapost.theclippath(...)
local result = metapost.getclippath(...)
if result then -- we could just print the table
--- return concat(metapost.flushnormalpath(result),"\n")
return concat(metapost.flushnormalpath(result)," ")
else
return ""
@@ -353,6 +355,16 @@ function mptex.reset()
end
implement {
+ name = "mppushvariables",
+ actions = metapost.pushvariables,
+}
+
+implement {
+ name = "mppopvariables",
+ actions = metapost.popvariables,
+}
+
+implement {
name = "mptexset",
arguments = "string",
actions = mptex.set
diff --git a/tex/context/base/mkiv/mlib-pdf.lua b/tex/context/base/mkiv/mlib-pdf.lua
index 5dbb308bc..5989b5b55 100644
--- a/tex/context/base/mkiv/mlib-pdf.lua
+++ b/tex/context/base/mkiv/mlib-pdf.lua
@@ -340,7 +340,7 @@ local variable =
local pattern_lst = (variable * newline^0)^0
-metapost.variables = { } -- to be stacked
+metapost.variables = { } -- currently across instances
metapost.properties = { } -- to be stacked
function metapost.untagvariable(str,variables) -- will be redone
@@ -385,12 +385,6 @@ local function setproperties(figure)
return properties
end
-local function setvariables(figure)
- local variables = { }
- metapost.variables = variables
- return variables
-end
-
local function nocomment() end
metapost.comment = nocomment
@@ -409,7 +403,6 @@ function metapost.flush(result,flusher,askedfig)
local flushfigure = flusher.flushfigure
local textfigure = flusher.textfigure
local processspecial = flusher.processspecial or metapost.processspecial
- local variables = setvariables(figure) -- also resets then in case of not found
metapost.comment = flusher.comment or nocomment
for index=1,#figures do
local figure = figures[index]
diff --git a/tex/context/base/mkiv/mlib-pps.lua b/tex/context/base/mkiv/mlib-pps.lua
index 23091342f..0c0cc6637 100644
--- a/tex/context/base/mkiv/mlib-pps.lua
+++ b/tex/context/base/mkiv/mlib-pps.lua
@@ -8,7 +8,7 @@ if not modules then modules = { } end modules ['mlib-pps'] = {
local format, gmatch, match, split = string.format, string.gmatch, string.match, string.split
local tonumber, type, unpack = tonumber, type, unpack
-local round, sqrt = math.round, math.sqrt
+local round, sqrt, min, max = math.round, math.sqrt, math.min, math.max
local insert, remove, concat = table.insert, table.remove, table.concat
local Cs, Cf, C, Cg, Ct, P, S, V, Carg = lpeg.Cs, lpeg.Cf, lpeg.C, lpeg.Cg, lpeg.Ct, lpeg.P, lpeg.S, lpeg.V, lpeg.Carg
local lpegmatch, tsplitat, tsplitter = lpeg.match, lpeg.tsplitat, lpeg.tsplitter
@@ -835,7 +835,15 @@ local function splitprescript(script)
local hash = lpegmatch(scriptsplitter,script)
for i=#hash,1,-1 do
local h = hash[i]
+if h == "reset" then
+ for k, v in next, hash do
+ if type(k) ~= "number" then
+ hash[k] = nil
+ end
+ end
+else
hash[h[1]] = h[2]
+end
end
if trace_scripts then
report_scripts(table.serialize(hash,"prescript"))
@@ -1494,28 +1502,31 @@ local types = {
local function gr_process(object,prescript,before,after)
local gr_state = prescript.gr_state
- if gr_state then
- if gr_state == "start" then
- local gr_type = utilities.parsers.settings_to_hash(prescript.gr_type)
- before[#before+1] = function()
- context.MPLIBstartgroup(
- gr_type.isolated and 1 or 0,
- gr_type.knockout and 1 or 0,
- prescript.gr_llx,
- prescript.gr_lly,
- prescript.gr_urx,
- prescript.gr_ury
- )
- end
- elseif gr_state == "stop" then
- after[#after+1] = function()
- context.MPLIBstopgroup()
- end
+ if not gr_state then
+ return
+ elseif gr_state == "start" then
+ local gr_type = utilities.parsers.settings_to_set(prescript.gr_type)
+ local path = object.path
+ local p1, p2, p3, p4 = path[1], path[2], path[3], path[4]
+ local llx = min(p1.x_coord,p2.x_coord,p3.x_coord,p4.x_coord)
+ local lly = min(p1.y_coord,p2.y_coord,p3.y_coord,p4.y_coord)
+ local urx = max(p1.x_coord,p2.x_coord,p3.x_coord,p4.x_coord)
+ local ury = max(p1.y_coord,p2.y_coord,p3.y_coord,p4.y_coord)
+ before[#before+1] = function()
+ context.MPLIBstartgroup(
+ gr_type.isolated and 1 or 0,
+ gr_type.knockout and 1 or 0,
+ llx, lly, urx, ury
+ )
+ end
+ elseif gr_state == "stop" then
+ after[#after+1] = function()
+ context.MPLIBstopgroup()
end
- object.path = false
- object.color = false
- object.grouped = true
end
+ object.path = false
+ object.color = false
+ object.grouped = true
end
-- outlines
diff --git a/tex/context/base/mkiv/mlib-pps.mkiv b/tex/context/base/mkiv/mlib-pps.mkiv
index 3a3ab2623..a2eb44826 100644
--- a/tex/context/base/mkiv/mlib-pps.mkiv
+++ b/tex/context/base/mkiv/mlib-pps.mkiv
@@ -161,12 +161,19 @@
\wd\scratchbox \dimexpr#5\onebasepoint-#3\onebasepoint+2\onebasepoint\relax
\ht\scratchbox #6\onebasepoint
\dp\scratchbox-#4\onebasepoint
+ \setbox\scratchbox\hpack\bgroup
+ \kern-#3\onebasepoint
+ \box\scratchbox
+ \egroup
\saveboxresource
- attr {/Group << /S /Transparency /I \ifnum#1=1 true \else false \fi /K \ifnum#1=1 true \else false \fi >>}
+ attr {/Group << /S /Transparency /I \ifnum#1=1 true \else false \fi /K \ifnum#2=1 true \else false \fi >>}
resources {\pdfbackendcurrentresources}
\scratchbox
- % \setbox\scratchbox\hbox\bgroup\kern-\onebasepoint\useboxresource\lastsavedboxresourceindex\egroup % why twice?
- \setbox\scratchbox\hpack\bgroup\kern-\onebasepoint\useboxresource\lastsavedboxresourceindex\egroup
+ \setbox\scratchbox\hpack\bgroup
+ \kern#3\onebasepoint
+ \kern-\onebasepoint
+ \useboxresource\lastsavedboxresourceindex
+ \egroup
\wd\scratchbox\zeropoint
\ht\scratchbox\zeropoint
\dp\scratchbox\zeropoint
diff --git a/tex/context/base/mkiv/mlib-run.lua b/tex/context/base/mkiv/mlib-run.lua
index 42fcdd26b..871889bbb 100644
--- a/tex/context/base/mkiv/mlib-run.lua
+++ b/tex/context/base/mkiv/mlib-run.lua
@@ -6,12 +6,12 @@ if not modules then modules = { } end modules ['mlib-run'] = {
license = "see context related readme files",
}
---~ cmyk -> done, native
---~ spot -> done, but needs reworking (simpler)
---~ multitone ->
---~ shade -> partly done, todo: cm
---~ figure -> done
---~ hyperlink -> low priority, easy
+-- cmyk -> done, native
+-- spot -> done, but needs reworking (simpler)
+-- multitone ->
+-- shade -> partly done, todo: cm
+-- figure -> done
+-- hyperlink -> low priority, easy
-- new * run
-- or
@@ -31,7 +31,8 @@ nears zero.</p>
local type, tostring, tonumber = type, tostring, tonumber
local format, gsub, match, find = string.format, string.gsub, string.match, string.find
-local concat = table.concat
+local concat, insert, remove = table.concat, table.insert, table.remove
+
local emptystring = string.is_empty
local P = lpeg.P
@@ -324,6 +325,46 @@ if not metapost.initializescriptrunner then
function metapost.initializescriptrunner() end
end
+do
+
+ local stack, top = { }, nil
+
+ function metapost.setvariable(k,v)
+ if top then
+ top[k] = v
+ else
+ metapost.variables[k] = v
+ end
+ end
+
+ function metapost.pushvariable(k)
+ local t = { }
+ if top then
+ insert(stack,top)
+ top[k] = t
+ else
+ metapost.variables[k] = t
+ end
+ top = t
+ end
+
+ function metapost.popvariable()
+ top = remove(stack)
+ end
+
+ local stack = { }
+
+ function metapost.pushvariables()
+ insert(stack,metapost.variables)
+ metapost.variables = { }
+ end
+
+ function metapost.popvariables()
+ metapost.variables = remove(stack) or metapost.variables
+ end
+
+end
+
function metapost.process(mpx, data, trialrun, flusher, multipass, isextrapass, askedfig)
local converted, result = false, { }
if type(mpx) == "string" then
@@ -332,6 +373,7 @@ function metapost.process(mpx, data, trialrun, flusher, multipass, isextrapass,
if mpx and data then
local tra = nil
starttiming(metapost)
+ metapost.variables = { }
metapost.initializescriptrunner(mpx,trialrun)
if trace_graphics then
tra = mp_tra[mpx]
diff --git a/tex/context/base/mkiv/mult-fun.lua b/tex/context/base/mkiv/mult-fun.lua
index 5996b9ac6..19abe1bcd 100644
--- a/tex/context/base/mkiv/mult-fun.lua
+++ b/tex/context/base/mkiv/mult-fun.lua
@@ -135,5 +135,7 @@ return {
"addbackground",
--
"shadedup", "shadeddown", "shadedleft", "shadedright",
+ --
+ "sortlist", "copylist", "shapedlist", "listtocurves", "listtolines", "listsize",
},
}
diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf
index eec704b7f..860a4022a 100644
--- a/tex/context/base/mkiv/status-files.pdf
+++ b/tex/context/base/mkiv/status-files.pdf
Binary files differ
diff --git a/tex/context/base/mkiv/status-lua.pdf b/tex/context/base/mkiv/status-lua.pdf
index 390810d51..1579c2465 100644
--- a/tex/context/base/mkiv/status-lua.pdf
+++ b/tex/context/base/mkiv/status-lua.pdf
Binary files differ
diff --git a/tex/context/fonts/mkiv/type-imp-libertinus.mkiv b/tex/context/fonts/mkiv/type-imp-libertinus.mkiv
new file mode 100644
index 000000000..62da09e16
--- /dev/null
+++ b/tex/context/fonts/mkiv/type-imp-libertinus.mkiv
@@ -0,0 +1,82 @@
+%D \module
+%D [ file=type-imp-libertinus,
+%D version=2016.08.18,
+%D title=\CONTEXT\ Typescript Macros,
+%D subtitle=Libertine fonts,
+%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.
+
+%D This typescript (submitted by by Henri Menke) is a follow up on libertine
+%D which is no longer maintained cq.\ developed further.
+
+\starttypescriptcollection[libertinus]
+
+ \starttypescript [\s!serif] [libertinus]
+ \definefontsynonym [LibertinusSerif-Regular] [\s!file:libertinusserif-regular]
+ \definefontsynonym [LibertinusSerif-Italic] [\s!file:libertinusserif-italic]
+ \definefontsynonym [LibertinusSerif-Slanted] [\s!file:libertinusserif-italic]
+ \definefontsynonym [LibertinusSerif-Bold] [\s!file:libertinusserif-bold]
+ \definefontsynonym [LibertinusSerif-BoldItalic] [\s!file:libertinusserif-bolditalic]
+ \definefontsynonym [LibertinusSerif-BoldSlanted] [\s!file:libertinusserif-bolditalic]
+ \stoptypescript
+
+ \starttypescript [\s!serif] [libertinus] [\s!name]
+ \setups[\s!font:\s!fallback:\s!serif]
+ \definefontsynonym [\s!Serif] [LibertinusSerif-Regular] [\s!features=\s!default]
+ \definefontsynonym [\s!SerifItalic] [LibertinusSerif-Italic] [\s!features=\s!default]
+ \definefontsynonym [\s!SerifSlanted] [LibertinusSerif-Slanted] [\s!features=\s!default]
+ \definefontsynonym [\s!SerifBold] [LibertinusSerif-Bold] [\s!features=\s!default]
+ \definefontsynonym [\s!SerifBoldItalic] [LibertinusSerif-BoldItalic] [\s!features=\s!default]
+ \definefontsynonym [\s!SerifBoldSlanted] [LibertinusSerif-BoldSlanted] [\s!features=\s!default]
+ \definefontsynonym [SerifCaps] [LibertinusSerif-Regular] [\s!features=\s!smallcaps]
+ \stoptypescript
+
+ \starttypescript [\s!sans] [libertinus]
+ \setups[\s!font:\s!fallback:\s!sans]
+ \definefontsynonym [LibertinusSans-Regular] [\s!file:libertinussans-regular]
+ \definefontsynonym [LibertinusSans-Italic] [\s!file:libertinussans-italic]
+ \definefontsynonym [LibertinusSans-Slanted] [\s!file:libertinussans-italic]
+ \definefontsynonym [LibertinusSans-Bold] [\s!file:libertinussans-bold]
+ \definefontsynonym [LibertinusSans-BoldItalic] [\s!file:libertinussans-bold]
+ \definefontsynonym [LibertinusSans-BoldSlanted] [\s!file:libertinussans-bold]
+ \stoptypescript
+
+ \starttypescript [\s!sans] [libertinus] [\s!name]
+ \setups[\s!font:\s!fallback:\s!sans]
+ \definefontsynonym [\s!Sans] [LibertinusSans-Regular] [\s!features=\s!default]
+ \definefontsynonym [\s!SansBold] [LibertinusSans-Bold] [\s!features=\s!default]
+ \definefontsynonym [\s!SansItalic] [LibertinusSans-Italic] [\s!features=\s!default]
+ \definefontsynonym [\s!SansSlanted] [LibertinusSans-Slanted] [\s!features=\s!default]
+ \definefontsynonym [\s!SansBoldItalic] [LibertinusSans-BoldSlanted] [\s!features=\s!default]
+ \definefontsynonym [SansCaps] [LibertinusSans-Regular] [\s!features=\s!smallcaps]
+ \stoptypescript
+
+ \starttypescript [\s!mono] [libertinus]
+ \setups[\s!font:\s!fallback:\s!mono]
+ \definefontsynonym [LibertinusMono-Regular] [\s!file:libertinusmono-regular]
+ \stoptypescript
+
+ \starttypescript [\s!mono] [libertinus] [\s!name]
+ \setups[\s!font:\s!fallback:\s!mono]
+ \definefontsynonym [\s!Mono] [LibertinusMono-Regular] [\s!features=\s!default]
+ \stoptypescript
+
+ \starttypescript [\s!math] [libertinus] [\s!name]
+ \definefontsynonym[\s!MathRoman ] [\s!file:libertinusmath-regular.otf] [\s!features=\s!math\mathsizesuffix]
+ \definefontsynonym[\s!MathRomanBold] [\s!file:libertinusmath-regular.otf] [\s!features=\s!math\mathsizesuffix]
+ \stoptypescript
+
+ \starttypescript [libertinus]
+ \definetypeface [libertinus] [\s!rm] [\s!serif] [libertinus] [\s!default]
+ \definetypeface [libertinus] [\s!ss] [\s!sans] [libertinus] [\s!default]
+ \definetypeface [libertinus] [\s!tt] [\s!mono] [libertinus] [\s!default]
+ \definetypeface [libertinus] [\s!mm] [\s!math] [libertinus] [\s!default]
+ \quittypescriptscanning
+ \stoptypescript
+
+\stoptypescriptcollection
diff --git a/tex/context/interface/mkiv/i-context.pdf b/tex/context/interface/mkiv/i-context.pdf
index 0d8d8ebff..5e8c5a2aa 100644
--- a/tex/context/interface/mkiv/i-context.pdf
+++ b/tex/context/interface/mkiv/i-context.pdf
Binary files differ
diff --git a/tex/context/interface/mkiv/i-readme.pdf b/tex/context/interface/mkiv/i-readme.pdf
index 41d9f8067..1421fcdc0 100644
--- a/tex/context/interface/mkiv/i-readme.pdf
+++ b/tex/context/interface/mkiv/i-readme.pdf
Binary files differ
diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua
index f8e12f741..133c8ffaa 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 : 08/19/16 00:30:40
+-- merge date : 08/20/16 13:39:39
do -- begin closure to overcome local limits and interference
@@ -21577,9 +21577,11 @@ local function initializedevanagi(tfmdata)
local steps=sequence.steps
local nofsteps=sequence.nofsteps
local features=sequence.features
- if features["rphf"] then
+ local has_rphf=features.rphf
+ local has_blwf=features.blwf
+ if has_rphf and has_rphf.deva then
devanagari.reph=true
- elseif features["blwf"] then
+ elseif has_blwf and has_blwf.deva then
devanagari.vattu=true
for i=1,nofsteps do
local step=steps[i]
@@ -21593,57 +21595,61 @@ local function initializedevanagi(tfmdata)
end
end
end
- if valid[kind] then
- for i=1,nofsteps do
- local step=steps[i]
- local coverage=step.coverage
- if coverage then
- local reph=false
- if step.osdstep then
- for k,v in next,ra do
- local r=coverage[k]
- if r then
- local h=false
- for k,v in next,halant do
- local h=r[k]
- if h then
- reph=h.ligature or false
- break
+ for kind,spec in next,features do
+ if spec.dev2 and valid[kind] then
+ for i=1,nofsteps do
+ local step=steps[i]
+ local coverage=step.coverage
+ if coverage then
+ local reph=false
+ if kind=="rphf" then
+ if true then
+ for k,v in next,ra do
+ local r=coverage[k]
+ if r then
+ local h=false
+ for k,v in next,halant do
+ local h=r[k]
+ if h then
+ reph=h.ligature or false
+ break
+ end
+ end
+ if reph then
+ break
+ end
end
end
- if reph then
- break
- end
+ else
end
end
- else
+ seqsubset[#seqsubset+1]={ kind,coverage,reph }
end
- seqsubset[#seqsubset+1]={ kind,coverage,reph }
end
end
- end
- if kind=="pref" then
- local sequence=dataset[3]
- local steps=sequence.steps
- local nofsteps=sequence.nofsteps
- for i=1,nofsteps do
- local step=steps[i]
- local coverage=step.coverage
- if coverage then
- for k,v in next,halant do
- local h=coverage[k]
- if h then
- local found=false
- for k,v in next,h do
- found=v and v.ligature
+ if kind=="pref" then
+ local sequence=dataset[3]
+ local steps=sequence.steps
+ local nofsteps=sequence.nofsteps
+ for i=1,nofsteps do
+ local step=steps[i]
+ local coverage=step.coverage
+ if coverage then
+ for k,v in next,halant do
+ local h=coverage[k]
+ if h then
+ local found=false
+ for k,v in next,h do
+ found=v and v.ligature
+ if found then
+ pre_base_reordering_consonants[k]=found
+ break
+ end
+ end
if found then
- pre_base_reordering_consonants[k]=found
break
end
end
- if found then
- break
- end
end
end
end
@@ -22030,6 +22036,8 @@ function handlers.devanagari_reorder_matras(head,start)
start=startnext
break
end
+ else
+ break
end
current=next
end
@@ -22042,12 +22050,12 @@ function handlers.devanagari_reorder_reph(head,start)
local startfont=getfont(start)
local startattr=getprop(start,a_syllabe)
while current do
- local char=ischar(current,font)
+ local char=ischar(current,startfont)
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
- local nextchar=ischar(next,font)
+ local nextchar=ischar(next,startfont)
if nextchar and zw_char[nextchar] and getprop(next,a_syllabe)==startattr then
current=next
next=getnext(current)
@@ -22069,7 +22077,7 @@ function handlers.devanagari_reorder_reph(head,start)
if not startnext then
current=getnext(start)
while current do
- local char=ischar(current,font)
+ local char=ischar(current,startfont)
if char and getprop(current,a_syllabe)==startattr then
if getprop(current,a_state)==s_pstf then
startnext=getnext(start)
@@ -22091,7 +22099,7 @@ function handlers.devanagari_reorder_reph(head,start)
current=getnext(start)
local c=nil
while current do
- local char=ischar(current,font)
+ local char=ischar(current,startfont)
if char and getprop(current,a_syllabe)==startattr then
if not c and mark_above_below_post[char] and reorder_class[char]~="after subscript" then
c=current
@@ -22115,7 +22123,7 @@ function handlers.devanagari_reorder_reph(head,start)
current=start
local next=getnext(current)
while next do
- local nextchar=ischar(next,font)
+ local nextchar=ischar(next,startfont)
if nextchar and getprop(next,a_syllabe)==startattr then
current=next
next=getnext(current)
@@ -22128,7 +22136,7 @@ function handlers.devanagari_reorder_reph(head,start)
head=remove_node(head,start)
local next=getnext(current)
setlink(start,next)
- setlink(current,"next",start)
+ setlink(current,start)
start=startnext
end
end
@@ -22141,12 +22149,12 @@ function handlers.devanagari_reorder_pre_base_reordering_consonants(head,start)
local startfont=getfont(start)
local startattr=getprop(start,a_syllabe)
while current do
- local char=ischar(current,font)
+ local char=ischar(current,startfont)
if char and getprop(current,a_syllabe)==startattr then
local next=getnext(current)
if halant[char] and not getprop(current,a_state) then
if next then
- local nextchar=ischar(next,font)
+ local nextchar=ischar(next,startfont)
if nextchar and getprop(next,a_syllabe)==startattr then
if nextchar==c_zwnj or nextchar==c_zwj then
current=next
@@ -22170,13 +22178,13 @@ function handlers.devanagari_reorder_pre_base_reordering_consonants(head,start)
current=getnext(start)
startattr=getprop(start,a_syllabe)
while current do
- local char=ischar(current,font)
+ local char=ischar(current,startfont)
if char and getprop(current,a_syllabe)==startattr then
if not consonant[char] and getprop(current,a_state) then
startnext=getnext(start)
removenode(start,start)
local prev=getprev(current)
- setlink(start,prev)
+ setlink(prev,start)
setlink(start,current)
start=startnext
break
@@ -22236,21 +22244,7 @@ local function dev2_reorder(head,start,stop,font,attr,nbspaces)
local kind=subset[1]
local lookupcache=subset[2]
if kind=="rphf" then
- for k,v in next,ra do
- local r=lookupcache[k]
- if r then
- for k,v in next,halant do
- local h=r[k]
- if h then
- reph=h.ligature or false
- break
- end
- end
- if reph then
- break
- end
- end
- end
+ reph=subset[3]
local current=start
local last=getnext(stop)
while current~=last do
@@ -22283,7 +22277,7 @@ local function dev2_reorder(head,start,stop,font,attr,nbspaces)
if current~=stop then
local c=locl[current] or getchar(current)
local found=lookupcache[c]
- if found then
+ if found then
local next=getnext(current)
local n=locl[next] or getchar(next)
if found[n] then
@@ -22510,7 +22504,7 @@ local function dev2_reorder(head,start,stop,font,attr,nbspaces)
local prev=getprev(current)
if prev~=target then
local next=getnext(current)
- setlink(next,prev)
+ setlink(prev,next)
if current==stop then
stop=prev
end
@@ -22541,7 +22535,7 @@ local function dev2_reorder(head,start,stop,font,attr,nbspaces)
stop=current
end
local prev=getprev(c)
- setlink(next,prev)
+ setlink(prev,next)
local nextnext=getnext(next)
setnext(current,nextnext)
local nextnextnext=getnext(nextnext)
@@ -22554,6 +22548,9 @@ local function dev2_reorder(head,start,stop,font,attr,nbspaces)
current=getnext(current)
end
if getchar(base)==c_nbsp then
+ if base==stop then
+ stop=getprev(stop)
+ end
nbspaces=nbspaces-1
head=remove_node(head,base)
flush_node(base)
@@ -22595,7 +22592,7 @@ local function analyze_next_chars_one(c,font,variant)
elseif (vv==c_zwnj or vv==c_zwj) and halant[vvv] then
local nnnn=getnext(nnn)
if nnnn then
- local vvvv=ischar(nnnn)
+ local vvvv=ischar(nnnn,font)
if vvvv and consonant[vvvv] then
c=nnnn
end
@@ -22618,7 +22615,7 @@ local function analyze_next_chars_one(c,font,variant)
local nn=getnext(n)
if nn then
local vv=ischar(nn,font)
- if vv and zw_char[vv] then
+ if vv and zw_char[v] then
n=nn
v=vv
nn=getnext(nn)