diff options
35 files changed, 1205 insertions, 353 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 e26349697..a6b89c073 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"]={ "loadfile", "loadimage", "loadmodule", "dispose", "nothing", "transparency", "tolist", "topath", "tocycle", "sqr", "log", "ln", "exp", "inv", "pow", "pi", "radian", "tand", "cotd", "sin", "cos", "tan", "cot", "atan", "asin", "acos", "invsin", "invcos", "invtan", "acosh", "asinh", "sinh", "cosh", "tanh", "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", "perpendicular", "paralleled", "cutends", "peepholed", "llenlarged", "lrenlarged", "urenlarged", "ulenlarged", "llmoved", "lrmoved", "urmoved", "ulmoved", "rightarrow", "leftarrow", "centerarrow", "drawdoublearrows", "boundingbox", "innerboundingbox", "outerboundingbox", "pushboundingbox", "popboundingbox", "boundingradius", "boundingcircle", "boundingpoint", "crossingunder", "insideof", "outsideof", "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", "withshadecenterone", "withshadecentertwo", "withshadestep", "withshadefraction", "withshadeorigin", "shownshadevector", "shownshadeorigin", "shownshadedirection", "shownshadecenter", "cmyk", "spotcolor", "multitonecolor", "namedcolor", "drawfill", "undrawfill", "inverted", "uncolored", "softened", "grayed", "greyed", "onlayer", "along", "graphictext", "loadfigure", "externalfigure", "figure", "register", "outlinetext", "filloutlinetext", "drawoutlinetext", "outlinetexttopath", "checkedbounds", "checkbounds", "strut", "rule", "withmask", "bitmapimage", "colordecimals", "ddecimal", "dddecimal", "ddddecimal", "colordecimalslist", "textext", "thetextext", "rawtextext", "textextoffset", "texbox", "thetexbox", "rawtexbox", "istextext", "rawmadetext", "validtexbox", "onetimetextext", "rawfmttext", "thefmttext", "fmttext", "onetimefmttext", "notcached", "keepcached", "verbatim", "thelabel", "label", "autoalign", "transparent", "withtransparency", "withopacity", "property", "properties", "withproperties", "asgroup", "infont", "space", "crlf", "dquote", "percent", "SPACE", "CRLF", "DQUOTE", "PERCENT", "grayscale", "greyscale", "withgray", "withgrey", "colorpart", "colorlike", "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", "resetarrows", "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", "pencilled", "decorated", "redecorated", "undecorated", "passvariable", "passarrayvariable", "tostring", "topair", "format", "formatted", "quotation", "quote", "startpassingvariable", "stoppassingvariable", "eofill", "eoclip", "nofill", "dofill", "fillup", "eofillup", "nodraw", "dodraw", "area", "addbackground", "shadedup", "shadeddown", "shadedleft", "shadedright", "sortlist", "copylist", "shapedlist", "listtocurves", "listtolines", "listsize", "listlast", "uniquelist", "circularpath", "squarepath", "linearpath", "theoffset", "texmode", "systemmode", "texvar", "texstr", "isarray", "prefix", "dimension", "getmacro", "getdimen", "getcount", "gettoks", "setmacro", "setdimen", "setcount", "settoks", "setglobalmacro", "setglobaldimen", "setglobalcount", "setglobaltoks", "positionpath", "positioncurve", "positionxy", "positionpxy", "positionwhd", "positionpage", "positionregion", "positionbox", "positionanchor", "positioninregion", "positionatanchor", "wdpart", "htpart", "dppart", "texvar", "texstr", "inpath", "pointof", "leftof", "rightof", "utfnum", "utflen", "utfsub", "newhash", "disposehash", "inhash", "tohash", "isarray", "prefix", "isobject", "comment", "report", "lua", "lualist", "mp", "MP", "luacall", "mirrored", "mirroredabout", "scriptindex", "newscriptindex", "newcolor", "newrgbcolor", "newcmykcolor", "newnumeric", "newboolean", "newtransform", "newpath", "newpicture", "newstring", "newpair", "mpvar", "withtolerance" }, + ["commands"]={ "loadfile", "loadimage", "loadmodule", "dispose", "nothing", "transparency", "tolist", "topath", "tocycle", "sqr", "log", "ln", "exp", "inv", "pow", "pi", "radian", "tand", "cotd", "sin", "cos", "tan", "cot", "atan", "asin", "acos", "invsin", "invcos", "invtan", "acosh", "asinh", "sinh", "cosh", "tanh", "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", "perpendicular", "paralleled", "cutends", "peepholed", "llenlarged", "lrenlarged", "urenlarged", "ulenlarged", "llmoved", "lrmoved", "urmoved", "ulmoved", "rightarrow", "leftarrow", "centerarrow", "drawdoublearrows", "boundingbox", "innerboundingbox", "outerboundingbox", "pushboundingbox", "popboundingbox", "boundingradius", "boundingcircle", "boundingpoint", "crossingunder", "insideof", "outsideof", "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", "withshadecenterone", "withshadecentertwo", "withshadestep", "withshadefraction", "withshadeorigin", "shownshadevector", "shownshadeorigin", "shownshadedirection", "shownshadecenter", "cmyk", "spotcolor", "multitonecolor", "namedcolor", "drawfill", "undrawfill", "inverted", "uncolored", "softened", "grayed", "greyed", "onlayer", "along", "graphictext", "loadfigure", "externalfigure", "figure", "register", "outlinetext", "filloutlinetext", "drawoutlinetext", "outlinetexttopath", "checkedbounds", "checkbounds", "strut", "rule", "withmask", "bitmapimage", "colordecimals", "ddecimal", "dddecimal", "ddddecimal", "colordecimalslist", "textext", "thetextext", "rawtextext", "textextoffset", "texbox", "thetexbox", "rawtexbox", "istextext", "rawmadetext", "validtexbox", "onetimetextext", "rawfmttext", "thefmttext", "fmttext", "onetimefmttext", "notcached", "keepcached", "verbatim", "thelabel", "label", "autoalign", "transparent", "withtransparency", "withopacity", "property", "properties", "withproperties", "asgroup", "withpattern", "withpatternscale", "withpatternfloat", "infont", "space", "crlf", "dquote", "percent", "SPACE", "CRLF", "DQUOTE", "PERCENT", "grayscale", "greyscale", "withgray", "withgrey", "colorpart", "colorlike", "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", "resetarrows", "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", "pencilled", "decorated", "redecorated", "undecorated", "passvariable", "passarrayvariable", "tostring", "topair", "format", "formatted", "quotation", "quote", "startpassingvariable", "stoppassingvariable", "eofill", "eoclip", "nofill", "dofill", "fillup", "eofillup", "nodraw", "dodraw", "area", "addbackground", "shadedup", "shadeddown", "shadedleft", "shadedright", "sortlist", "copylist", "shapedlist", "listtocurves", "listtolines", "listsize", "listlast", "uniquelist", "circularpath", "squarepath", "linearpath", "theoffset", "texmode", "systemmode", "texvar", "texstr", "isarray", "prefix", "dimension", "getmacro", "getdimen", "getcount", "gettoks", "setmacro", "setdimen", "setcount", "settoks", "setglobalmacro", "setglobaldimen", "setglobalcount", "setglobaltoks", "positionpath", "positioncurve", "positionxy", "positionpxy", "positionwhd", "positionpage", "positionregion", "positionbox", "positionanchor", "positioninregion", "positionatanchor", "wdpart", "htpart", "dppart", "texvar", "texstr", "inpath", "pointof", "leftof", "rightof", "utfnum", "utflen", "utfsub", "newhash", "disposehash", "inhash", "tohash", "isarray", "prefix", "isobject", "comment", "report", "lua", "lualist", "mp", "MP", "luacall", "mirrored", "mirroredabout", "scriptindex", "newscriptindex", "newcolor", "newrgbcolor", "newcmykcolor", "newnumeric", "newboolean", "newtransform", "newpath", "newpicture", "newstring", "newpair", "mpvar", "withtolerance" }, ["internals"]={ "nocolormodel", "greycolormodel", "graycolormodel", "rgbcolormodel", "cmykcolormodel", "shadefactor", "shadeoffset", "textextoffset", "textextanchor", "normaltransparent", "multiplytransparent", "screentransparent", "overlaytransparent", "softlighttransparent", "hardlighttransparent", "colordodgetransparent", "colorburntransparent", "darkentransparent", "lightentransparent", "differencetransparent", "exclusiontransparent", "huetransparent", "saturationtransparent", "colortransparent", "luminositytransparent", "ahvariant", "ahdimple", "ahfactor", "ahscale", "metapostversion", "maxdimensions", "drawoptionsfactor", "dq", "sq", "crossingscale", "crossingoption", "contextlmtxmode", "metafunversion", "minifunversion", "getparameters", "presetparameters", "hasparameter", "hasoption", "getparameter", "getparameterdefault", "getparametercount", "getmaxparametercount", "getparameterpath", "getparameterpen", "getparametertext", "applyparameters", "pushparameters", "popparameters", "definecolor" }, }
\ 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 8a645785a..dde76c2f6 100644 --- a/context/data/scite/context/scite-context-data-metafun.properties +++ b/context/data/scite/context/scite-context-data-metafun.properties @@ -41,45 +41,46 @@ rawmadetext validtexbox onetimetextext rawfmttext thefmttext \ fmttext onetimefmttext notcached keepcached verbatim \ thelabel label autoalign transparent withtransparency \ withopacity property properties withproperties asgroup \ -infont space crlf dquote percent \ -SPACE CRLF DQUOTE PERCENT grayscale \ -greyscale withgray withgrey colorpart colorlike \ -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 resetarrows \ -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 pencilled decorated redecorated \ -undecorated passvariable passarrayvariable tostring topair \ -format formatted quotation quote startpassingvariable \ -stoppassingvariable eofill eoclip nofill dofill \ -fillup eofillup nodraw dodraw area \ -addbackground shadedup shadeddown shadedleft shadedright \ -sortlist copylist shapedlist listtocurves listtolines \ -listsize listlast uniquelist circularpath squarepath \ -linearpath theoffset texmode systemmode texvar \ -texstr isarray prefix dimension getmacro \ -getdimen getcount gettoks setmacro setdimen \ -setcount settoks setglobalmacro setglobaldimen setglobalcount \ -setglobaltoks positionpath positioncurve positionxy positionpxy \ -positionwhd positionpage positionregion positionbox positionanchor \ -positioninregion positionatanchor wdpart htpart dppart \ -texvar texstr inpath pointof leftof \ -rightof utfnum utflen utfsub newhash \ -disposehash inhash tohash isarray prefix \ -isobject comment report lua lualist \ -mp MP luacall mirrored mirroredabout \ -scriptindex newscriptindex newcolor newrgbcolor newcmykcolor \ -newnumeric newboolean newtransform newpath newpicture \ -newstring newpair mpvar withtolerance +withpattern withpatternscale withpatternfloat infont space \ +crlf dquote percent SPACE CRLF \ +DQUOTE PERCENT grayscale greyscale withgray \ +withgrey colorpart colorlike 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 resetarrows 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 \ +pencilled decorated redecorated undecorated passvariable \ +passarrayvariable tostring topair format formatted \ +quotation quote startpassingvariable stoppassingvariable eofill \ +eoclip nofill dofill fillup eofillup \ +nodraw dodraw area addbackground shadedup \ +shadeddown shadedleft shadedright sortlist copylist \ +shapedlist listtocurves listtolines listsize listlast \ +uniquelist circularpath squarepath linearpath theoffset \ +texmode systemmode texvar texstr isarray \ +prefix dimension getmacro getdimen getcount \ +gettoks setmacro setdimen setcount settoks \ +setglobalmacro setglobaldimen setglobalcount setglobaltoks positionpath \ +positioncurve positionxy positionpxy positionwhd positionpage \ +positionregion positionbox positionanchor positioninregion positionatanchor \ +wdpart htpart dppart texvar texstr \ +inpath pointof leftof rightof utfnum \ +utflen utfsub newhash disposehash inhash \ +tohash isarray prefix isobject comment \ +report lua lualist mp MP \ +luacall mirrored mirroredabout scriptindex newscriptindex \ +newcolor newrgbcolor newcmykcolor newnumeric newboolean \ +newtransform newpath newpicture newstring newpair \ +mpvar withtolerance keywordclass.metafun.internals=\ nocolormodel greycolormodel graycolormodel rgbcolormodel \ diff --git a/context/data/textadept/context/data/scite-context-data-metafun.lua b/context/data/textadept/context/data/scite-context-data-metafun.lua index e26349697..a6b89c073 100644 --- a/context/data/textadept/context/data/scite-context-data-metafun.lua +++ b/context/data/textadept/context/data/scite-context-data-metafun.lua @@ -1,4 +1,4 @@ return { - ["commands"]={ "loadfile", "loadimage", "loadmodule", "dispose", "nothing", "transparency", "tolist", "topath", "tocycle", "sqr", "log", "ln", "exp", "inv", "pow", "pi", "radian", "tand", "cotd", "sin", "cos", "tan", "cot", "atan", "asin", "acos", "invsin", "invcos", "invtan", "acosh", "asinh", "sinh", "cosh", "tanh", "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", "perpendicular", "paralleled", "cutends", "peepholed", "llenlarged", "lrenlarged", "urenlarged", "ulenlarged", "llmoved", "lrmoved", "urmoved", "ulmoved", "rightarrow", "leftarrow", "centerarrow", "drawdoublearrows", "boundingbox", "innerboundingbox", "outerboundingbox", "pushboundingbox", "popboundingbox", "boundingradius", "boundingcircle", "boundingpoint", "crossingunder", "insideof", "outsideof", "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", "withshadecenterone", "withshadecentertwo", "withshadestep", "withshadefraction", "withshadeorigin", "shownshadevector", "shownshadeorigin", "shownshadedirection", "shownshadecenter", "cmyk", "spotcolor", "multitonecolor", "namedcolor", "drawfill", "undrawfill", "inverted", "uncolored", "softened", "grayed", "greyed", "onlayer", "along", "graphictext", "loadfigure", "externalfigure", "figure", "register", "outlinetext", "filloutlinetext", "drawoutlinetext", "outlinetexttopath", "checkedbounds", "checkbounds", "strut", "rule", "withmask", "bitmapimage", "colordecimals", "ddecimal", "dddecimal", "ddddecimal", "colordecimalslist", "textext", "thetextext", "rawtextext", "textextoffset", "texbox", "thetexbox", "rawtexbox", "istextext", "rawmadetext", "validtexbox", "onetimetextext", "rawfmttext", "thefmttext", "fmttext", "onetimefmttext", "notcached", "keepcached", "verbatim", "thelabel", "label", "autoalign", "transparent", "withtransparency", "withopacity", "property", "properties", "withproperties", "asgroup", "infont", "space", "crlf", "dquote", "percent", "SPACE", "CRLF", "DQUOTE", "PERCENT", "grayscale", "greyscale", "withgray", "withgrey", "colorpart", "colorlike", "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", "resetarrows", "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", "pencilled", "decorated", "redecorated", "undecorated", "passvariable", "passarrayvariable", "tostring", "topair", "format", "formatted", "quotation", "quote", "startpassingvariable", "stoppassingvariable", "eofill", "eoclip", "nofill", "dofill", "fillup", "eofillup", "nodraw", "dodraw", "area", "addbackground", "shadedup", "shadeddown", "shadedleft", "shadedright", "sortlist", "copylist", "shapedlist", "listtocurves", "listtolines", "listsize", "listlast", "uniquelist", "circularpath", "squarepath", "linearpath", "theoffset", "texmode", "systemmode", "texvar", "texstr", "isarray", "prefix", "dimension", "getmacro", "getdimen", "getcount", "gettoks", "setmacro", "setdimen", "setcount", "settoks", "setglobalmacro", "setglobaldimen", "setglobalcount", "setglobaltoks", "positionpath", "positioncurve", "positionxy", "positionpxy", "positionwhd", "positionpage", "positionregion", "positionbox", "positionanchor", "positioninregion", "positionatanchor", "wdpart", "htpart", "dppart", "texvar", "texstr", "inpath", "pointof", "leftof", "rightof", "utfnum", "utflen", "utfsub", "newhash", "disposehash", "inhash", "tohash", "isarray", "prefix", "isobject", "comment", "report", "lua", "lualist", "mp", "MP", "luacall", "mirrored", "mirroredabout", "scriptindex", "newscriptindex", "newcolor", "newrgbcolor", "newcmykcolor", "newnumeric", "newboolean", "newtransform", "newpath", "newpicture", "newstring", "newpair", "mpvar", "withtolerance" }, + ["commands"]={ "loadfile", "loadimage", "loadmodule", "dispose", "nothing", "transparency", "tolist", "topath", "tocycle", "sqr", "log", "ln", "exp", "inv", "pow", "pi", "radian", "tand", "cotd", "sin", "cos", "tan", "cot", "atan", "asin", "acos", "invsin", "invcos", "invtan", "acosh", "asinh", "sinh", "cosh", "tanh", "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", "perpendicular", "paralleled", "cutends", "peepholed", "llenlarged", "lrenlarged", "urenlarged", "ulenlarged", "llmoved", "lrmoved", "urmoved", "ulmoved", "rightarrow", "leftarrow", "centerarrow", "drawdoublearrows", "boundingbox", "innerboundingbox", "outerboundingbox", "pushboundingbox", "popboundingbox", "boundingradius", "boundingcircle", "boundingpoint", "crossingunder", "insideof", "outsideof", "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", "withshadecenterone", "withshadecentertwo", "withshadestep", "withshadefraction", "withshadeorigin", "shownshadevector", "shownshadeorigin", "shownshadedirection", "shownshadecenter", "cmyk", "spotcolor", "multitonecolor", "namedcolor", "drawfill", "undrawfill", "inverted", "uncolored", "softened", "grayed", "greyed", "onlayer", "along", "graphictext", "loadfigure", "externalfigure", "figure", "register", "outlinetext", "filloutlinetext", "drawoutlinetext", "outlinetexttopath", "checkedbounds", "checkbounds", "strut", "rule", "withmask", "bitmapimage", "colordecimals", "ddecimal", "dddecimal", "ddddecimal", "colordecimalslist", "textext", "thetextext", "rawtextext", "textextoffset", "texbox", "thetexbox", "rawtexbox", "istextext", "rawmadetext", "validtexbox", "onetimetextext", "rawfmttext", "thefmttext", "fmttext", "onetimefmttext", "notcached", "keepcached", "verbatim", "thelabel", "label", "autoalign", "transparent", "withtransparency", "withopacity", "property", "properties", "withproperties", "asgroup", "withpattern", "withpatternscale", "withpatternfloat", "infont", "space", "crlf", "dquote", "percent", "SPACE", "CRLF", "DQUOTE", "PERCENT", "grayscale", "greyscale", "withgray", "withgrey", "colorpart", "colorlike", "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", "resetarrows", "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", "pencilled", "decorated", "redecorated", "undecorated", "passvariable", "passarrayvariable", "tostring", "topair", "format", "formatted", "quotation", "quote", "startpassingvariable", "stoppassingvariable", "eofill", "eoclip", "nofill", "dofill", "fillup", "eofillup", "nodraw", "dodraw", "area", "addbackground", "shadedup", "shadeddown", "shadedleft", "shadedright", "sortlist", "copylist", "shapedlist", "listtocurves", "listtolines", "listsize", "listlast", "uniquelist", "circularpath", "squarepath", "linearpath", "theoffset", "texmode", "systemmode", "texvar", "texstr", "isarray", "prefix", "dimension", "getmacro", "getdimen", "getcount", "gettoks", "setmacro", "setdimen", "setcount", "settoks", "setglobalmacro", "setglobaldimen", "setglobalcount", "setglobaltoks", "positionpath", "positioncurve", "positionxy", "positionpxy", "positionwhd", "positionpage", "positionregion", "positionbox", "positionanchor", "positioninregion", "positionatanchor", "wdpart", "htpart", "dppart", "texvar", "texstr", "inpath", "pointof", "leftof", "rightof", "utfnum", "utflen", "utfsub", "newhash", "disposehash", "inhash", "tohash", "isarray", "prefix", "isobject", "comment", "report", "lua", "lualist", "mp", "MP", "luacall", "mirrored", "mirroredabout", "scriptindex", "newscriptindex", "newcolor", "newrgbcolor", "newcmykcolor", "newnumeric", "newboolean", "newtransform", "newpath", "newpicture", "newstring", "newpair", "mpvar", "withtolerance" }, ["internals"]={ "nocolormodel", "greycolormodel", "graycolormodel", "rgbcolormodel", "cmykcolormodel", "shadefactor", "shadeoffset", "textextoffset", "textextanchor", "normaltransparent", "multiplytransparent", "screentransparent", "overlaytransparent", "softlighttransparent", "hardlighttransparent", "colordodgetransparent", "colorburntransparent", "darkentransparent", "lightentransparent", "differencetransparent", "exclusiontransparent", "huetransparent", "saturationtransparent", "colortransparent", "luminositytransparent", "ahvariant", "ahdimple", "ahfactor", "ahscale", "metapostversion", "maxdimensions", "drawoptionsfactor", "dq", "sq", "crossingscale", "crossingoption", "contextlmtxmode", "metafunversion", "minifunversion", "getparameters", "presetparameters", "hasparameter", "hasoption", "getparameter", "getparameterdefault", "getparametercount", "getmaxparametercount", "getparameterpath", "getparameterpen", "getparametertext", "applyparameters", "pushparameters", "popparameters", "definecolor" }, }
\ No newline at end of file diff --git a/context/data/vscode/extensions/context/syntaxes/context-syntax-mps.json b/context/data/vscode/extensions/context/syntaxes/context-syntax-mps.json index cc3c8b483..a729a57ba 100644 --- a/context/data/vscode/extensions/context/syntaxes/context-syntax-mps.json +++ b/context/data/vscode/extensions/context/syntaxes/context-syntax-mps.json @@ -60,7 +60,7 @@ "name" : "context.extra" }, "helper" : { - "match" : "(zmod|ystretched|ysized|xysized|xyscaled|xstretched|xsized|withtransparency|withtolerance|withshadevector|withshadetransform|withshadestep|withshaderadius|withshadeorigin|withshademethod|withshadefraction|withshadefactor|withshadedomain|withshadedirection|withshadecolors|withshadecentertwo|withshadecenterone|withshadecenter|withshade|withproperties|withopacity|withmask|withlinearshade|withgrey|withgray|withcircularshade|whitecolor|wdpart|visualizepaths|visualizedfill|visualizeddraw|verbatim|validtexbox|utfsub|utfnum|utflen|urtriangle|urmoved|urenlarged|urcircle|uptriangle|unspiked|unitvector|unittriangle|unitdiamond|unitcircle|uniquelist|undrawfill|undecorated|undashed|uncolored|ultriangle|ulmoved|ulenlarged|ulcircle|tripled|triangle|transparent|transparency|tostring|topenlarged|topboundary|topath|topair|tolist|tohash|tocycle|thetextext|thetexbox|theoffset|thelabel|thefmttext|texvar|texvar|textextoffset|textext|texstr|texstr|texmode|texbox|tensecircle|tcircle|tanh|tand|tan|systemmode|superellipsed|strut|stretched|straightpath|straightpairs|straightfunction|stoppassingvariable|startpassingvariable|squeezed|squarepath|sqr|spotcolor|space|sortlist|softened|snapped|smoothed|sized|sinh|sin|simplified|shownshadevector|shownshadeorigin|shownshadedirection|shownshadecenter|shortened|shapedlist|shadedup|shadedright|shadedleft|shadedinto|shadeddown|shaded|settoks|setmacro|setglobaltoks|setglobalmacro|setglobaldimen|setglobalcount|setdimen|setcount|scriptindex|rule|roundedsquare|righttriangle|rightof|rightenlarged|rightboundary|rightarrow|resolvedcolor|resetdrawoptions|resetarrows|report|register|redecorated|readfile|rcircle|rawtextext|rawtexbox|rawmadetext|rawfmttext|randomshifted|randomizedcontrols|randomized|radian|quote|quotation|pushcurrentpicture|pushboundingbox|punked|property|properties|prefix|prefix|pow|positionxy|positionwhd|positionregion|positionpxy|positionpath|positionpage|positioninregion|positioncurve|positionbox|positionatanchor|positionanchor|popcurrentpicture|popboundingbox|pointof|pi|perpendicular|percent|penpoint|pencilled|peepholed|pathconnectors|passvariable|passarrayvariable|paralleled|paired|outsideof|outlinetexttopath|outlinetext|outerboundingbox|originpath|onlayer|onetimetextext|onetimefmttext|oddly|nothing|notcached|normalfill|normaldraw|nofill|nodraw|newtransform|newstring|newscriptindex|newrgbcolor|newpicture|newpath|newpair|newnumeric|newhash|newcolor|newcmykcolor|newboolean|naturalizepaths|namedcolor|multitonecolor|mpvar|mp|mirroredabout|mirrored|lualist|luacall|lua|lrtriangle|lrmoved|lrenlarged|lrcircle|log|loadmodule|loadimage|loadfile|loadfigure|ln|lltriangle|llmoved|llenlarged|llcircle|listtolines|listtocurves|listsize|listlast|linearpath|lefttriangle|leftof|leftenlarged|leftboundary|leftarrow|lcircle|laddered|label|keepcached|istextext|isobject|isarray|isarray|invtan|invsin|inverted|invcos|inv|intersection_point|intersection_found|interpolated|insideof|inpath|innerboundingbox|inhash|infont|infinite|htpart|greyscale|greyed|grayscale|grayed|graphictext|gettoks|getmacro|getdimen|getcount|function|fulltriangle|fullsquare|fulldiamond|formatted|format|fmttext|fillup|filloutlinetext|figure|externalfigure|exp|evenly|epsed|eofillup|eofill|eoclip|enlonged|enlarged|drawwholepath|drawpoints|drawpointoptions|drawpointlabels|drawpoint|drawpathoptions|drawpathonly|drawpath|drawoutlinetext|draworiginoptions|draworigin|drawlineoptions|drawlabeloptions|drawfill|drawdoublearrows|drawcontrolpoints|drawcontroloptions|drawcontrollines|drawboundoptions|drawboundingbox|drawboundary|dquote|dppart|downtriangle|dofill|dodraw|disposehash|dispose|dimension|detailpaths|detaileddraw|defineshade|decorated|ddecimal|dddecimal|ddddecimal|cutends|curvedpath|curvedpairs|curvedfunction|curved|crossingunder|crossed|crlf|cotd|cot|cosh|cos|cornered|copylist|constructedpath|constructedpairs|constructedfunction|condition|complemented|complementary|comment|colortype|colorpart|colorlike|colordecimalslist|colordecimals|cmyk|clearxy|circularpath|checkedbounds|checkbounds|centerarrow|center|break|boundingradius|boundingpoint|boundingcircle|boundingbox|bottomenlarged|bottomboundary|blownup|blackcolor|bitmapimage|bcircle|bbwidth|bbheight|basiccolors|autoalign|atan|asinh|asin|asgroup|arrowpath|area|anchored|along|addbackground|acosh|acos|SPACE|PERCENT|MP|DQUOTE|CRLF)(?=[^a-zA-Z\u005C_@!?-ÿ])", + "match" : "(zmod|ystretched|ysized|xysized|xyscaled|xstretched|xsized|withtransparency|withtolerance|withshadevector|withshadetransform|withshadestep|withshaderadius|withshadeorigin|withshademethod|withshadefraction|withshadefactor|withshadedomain|withshadedirection|withshadecolors|withshadecentertwo|withshadecenterone|withshadecenter|withshade|withproperties|withpatternscale|withpatternfloat|withpattern|withopacity|withmask|withlinearshade|withgrey|withgray|withcircularshade|whitecolor|wdpart|visualizepaths|visualizedfill|visualizeddraw|verbatim|validtexbox|utfsub|utfnum|utflen|urtriangle|urmoved|urenlarged|urcircle|uptriangle|unspiked|unitvector|unittriangle|unitdiamond|unitcircle|uniquelist|undrawfill|undecorated|undashed|uncolored|ultriangle|ulmoved|ulenlarged|ulcircle|tripled|triangle|transparent|transparency|tostring|topenlarged|topboundary|topath|topair|tolist|tohash|tocycle|thetextext|thetexbox|theoffset|thelabel|thefmttext|texvar|texvar|textextoffset|textext|texstr|texstr|texmode|texbox|tensecircle|tcircle|tanh|tand|tan|systemmode|superellipsed|strut|stretched|straightpath|straightpairs|straightfunction|stoppassingvariable|startpassingvariable|squeezed|squarepath|sqr|spotcolor|space|sortlist|softened|snapped|smoothed|sized|sinh|sin|simplified|shownshadevector|shownshadeorigin|shownshadedirection|shownshadecenter|shortened|shapedlist|shadedup|shadedright|shadedleft|shadedinto|shadeddown|shaded|settoks|setmacro|setglobaltoks|setglobalmacro|setglobaldimen|setglobalcount|setdimen|setcount|scriptindex|rule|roundedsquare|righttriangle|rightof|rightenlarged|rightboundary|rightarrow|resolvedcolor|resetdrawoptions|resetarrows|report|register|redecorated|readfile|rcircle|rawtextext|rawtexbox|rawmadetext|rawfmttext|randomshifted|randomizedcontrols|randomized|radian|quote|quotation|pushcurrentpicture|pushboundingbox|punked|property|properties|prefix|prefix|pow|positionxy|positionwhd|positionregion|positionpxy|positionpath|positionpage|positioninregion|positioncurve|positionbox|positionatanchor|positionanchor|popcurrentpicture|popboundingbox|pointof|pi|perpendicular|percent|penpoint|pencilled|peepholed|pathconnectors|passvariable|passarrayvariable|paralleled|paired|outsideof|outlinetexttopath|outlinetext|outerboundingbox|originpath|onlayer|onetimetextext|onetimefmttext|oddly|nothing|notcached|normalfill|normaldraw|nofill|nodraw|newtransform|newstring|newscriptindex|newrgbcolor|newpicture|newpath|newpair|newnumeric|newhash|newcolor|newcmykcolor|newboolean|naturalizepaths|namedcolor|multitonecolor|mpvar|mp|mirroredabout|mirrored|lualist|luacall|lua|lrtriangle|lrmoved|lrenlarged|lrcircle|log|loadmodule|loadimage|loadfile|loadfigure|ln|lltriangle|llmoved|llenlarged|llcircle|listtolines|listtocurves|listsize|listlast|linearpath|lefttriangle|leftof|leftenlarged|leftboundary|leftarrow|lcircle|laddered|label|keepcached|istextext|isobject|isarray|isarray|invtan|invsin|inverted|invcos|inv|intersection_point|intersection_found|interpolated|insideof|inpath|innerboundingbox|inhash|infont|infinite|htpart|greyscale|greyed|grayscale|grayed|graphictext|gettoks|getmacro|getdimen|getcount|function|fulltriangle|fullsquare|fulldiamond|formatted|format|fmttext|fillup|filloutlinetext|figure|externalfigure|exp|evenly|epsed|eofillup|eofill|eoclip|enlonged|enlarged|drawwholepath|drawpoints|drawpointoptions|drawpointlabels|drawpoint|drawpathoptions|drawpathonly|drawpath|drawoutlinetext|draworiginoptions|draworigin|drawlineoptions|drawlabeloptions|drawfill|drawdoublearrows|drawcontrolpoints|drawcontroloptions|drawcontrollines|drawboundoptions|drawboundingbox|drawboundary|dquote|dppart|downtriangle|dofill|dodraw|disposehash|dispose|dimension|detailpaths|detaileddraw|defineshade|decorated|ddecimal|dddecimal|ddddecimal|cutends|curvedpath|curvedpairs|curvedfunction|curved|crossingunder|crossed|crlf|cotd|cot|cosh|cos|cornered|copylist|constructedpath|constructedpairs|constructedfunction|condition|complemented|complementary|comment|colortype|colorpart|colorlike|colordecimalslist|colordecimals|cmyk|clearxy|circularpath|checkedbounds|checkbounds|centerarrow|center|break|boundingradius|boundingpoint|boundingcircle|boundingbox|bottomenlarged|bottomboundary|blownup|blackcolor|bitmapimage|bcircle|bbwidth|bbheight|basiccolors|autoalign|atan|asinh|asin|asgroup|arrowpath|area|anchored|along|addbackground|acosh|acos|SPACE|PERCENT|MP|DQUOTE|CRLF)(?=[^a-zA-Z\u005C_@!?-ÿ])", "name" : "context.command.metafun.helper.mps" }, "identifier" : { diff --git a/doc/context/sources/general/manuals/svg/svg-lmtx-mozilla.lua b/doc/context/sources/general/manuals/svg/svg-lmtx-mozilla.lua index 8bf00c72b..781dc01da 100644 --- a/doc/context/sources/general/manuals/svg/svg-lmtx-mozilla.lua +++ b/doc/context/sources/general/manuals/svg/svg-lmtx-mozilla.lua @@ -463,5 +463,30 @@ return { <text x="15" y="140" fill="white" font-family="sans-serif" font-size="12pt">Repeat</text> <text x="125" y="140" fill="white" font-family="sans-serif" font-size="12pt">Reflect</text> </svg> + ]], + [[ + <svg viewBox="0 0 80 20" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> + <symbol id="myDot" width="10" height="10" viewBox="0 0 2 2"> + <circle cx="1" cy="1" r="1" /> + </symbol> + <path d="M0,10 h80 M10,0 v20 M25,0 v20 M40,0 v20 M55,0 v20 M70,0 v20" fill="none" stroke="pink" /> + <use xlink:href="#myDot" x="5" y="5" style="opacity:1.0" /> + <use xlink:href="#myDot" x="20" y="5" style="opacity:0.8" /> + <use xlink:href="#myDot" x="35" y="5" style="opacity:0.6" /> + <use xlink:href="#myDot" x="50" y="5" style="opacity:0.4" /> + <use xlink:href="#myDot" x="65" y="5" style="opacity:0.2" /> + </svg> + ]], + [[ + <svg width="200" height="250" version="1.1" xmlns="http://www.w3.org/2000/svg"> + <rect x="10" y="10" width="30" height="30" stroke="black" fill="transparent" stroke-width="5"/> + <rect x="60" y="10" rx="10" ry="10" width="30" height="30" stroke="black" fill="transparent" stroke-width="5"/> + <circle cx="25" cy="75" r="20" stroke="red" fill="transparent" stroke-width="5"/> + <ellipse cx="75" cy="75" rx="20" ry="5" stroke="red" fill="transparent" stroke-width="5"/> + <line x1="10" x2="50" y1="110" y2="150" stroke="orange" stroke-width="5"/> + <polyline points="60 110 65 120 70 115 75 130 80 125 85 140 90 135 95 150 100 145" stroke="orange" fill="transparent" stroke-width="5"/> + <polygon points="50 160 55 180 70 180 60 190 65 205 50 195 35 205 40 190 30 180 45 180" stroke="green" fill="transparent" stroke-width="5"/> + <path d="M20,230 Q40,205 50,230 T90,230" fill="none" stroke="blue" stroke-width="5"/> + </svg> ]] } diff --git a/metapost/context/base/mpxl/mp-mlib.mpxl b/metapost/context/base/mpxl/mp-mlib.mpxl index 40be3dd2d..ed3f79be5 100644 --- a/metapost/context/base/mpxl/mp-mlib.mpxl +++ b/metapost/context/base/mpxl/mp-mlib.mpxl @@ -123,12 +123,12 @@ def withtransparency(expr a, t) = withprescript "tr_transparency=" & decimal t enddef ; -% works reverse from transparency (for svg) +% for svg: def withopacity expr o = if o <> 1 : withprescript "tr_alternative=" & decimal normaltransparent - withprescript "tr_transparency=" & decimal (1 - o) + withprescript "tr_transparency=" & decimal o fi enddef ; @@ -1126,6 +1126,11 @@ def figure primary filename = rawtextext("\externalfigure[" & filename & "]") enddef ; +vardef svgembeddedfigure primary index = +% mfun_onetime_textext := true ; + rawtextext("\svgembeddedfigure{" & decimal index & "}") +enddef ; + permanent withmask, externalfigure, figure ; % Positions @@ -1425,16 +1430,75 @@ primarydef t asgroup s = % s = isolated|knockout temp_q:= nullpicture ; addto temp_q contour temp_r withprescript "gr_state=start" - withprescript "gr_type=" & s ; + withprescript "gr_type=" & s + ; addto temp_q also temp_p ; addto temp_q contour temp_r - withprescript "gr_state=stop" ; + withprescript "gr_state=stop" + ; temp_q endgroup enddef ; permanent asgroup ; +% Even more experimental: + +pair mfun_pattern_s ; mfun_pattern_s := origin ; % auto scale to fraction of shape (svg) +boolean mfun_pattern_f ; mfun_pattern_f := false ; % anchor or not (normally we do that) + +def withpatternscale primary s = hide (mfun_pattern_s := s ;) enddef ; +def withpatternfloat primary s = hide (mfun_pattern_f := s ;) enddef ; + +primarydef t withpattern p = + begingroup + % + save temp_q, temp_r ; + picture temp_q ; path temp_r ; + % the combination + temp_q:= nullpicture ; + % the pattern + temp_r := boundingbox p ; + if mfun_pattern_s <> origin : + sx := (xpart mfun_pattern_s) * bbwidth (t) ; + sy := (ypart mfun_pattern_s) * bbheight(t) ; + temp_r := temp_r xysized (sx,sy) ; + addto temp_q contour temp_r + withprescript "pt_state=start" + withprescript "pt_action=set" + withprescript "pt_float=" & tostring(mfun_pattern_f) + ; + addto temp_q also (p xysized (sx,sy)); + else : + addto temp_q contour temp_r + withprescript "pt_state=start" + withprescript "pt_action=set" + withprescript "pt_float=" & tostring(mfun_pattern_f) + ; + addto temp_q also p ; + fi ; + addto temp_q contour temp_r + withprescript "pt_state=stop" + withprescript "pt_action=set" ; + % the path + temp_r := boundingbox t ; + addto temp_q contour temp_r + withprescript "pt_state=start" + withprescript "pt_action=get" + ; + addto temp_q contour temp_r + withprescript "pt_state=stop" + withprescript "pt_action=get" ; + % make sure we fill only t + clip temp_q to t ; + % reset + mfun_pattern_s := origin ; + mfun_pattern_f := false ; + % the path + temp_q + endgroup +enddef ; + % Also experimental ... needs to be made better ... so it can change! string mfun_auto_align[] ; diff --git a/scripts/context/lua/mtx-patterns.lua b/scripts/context/lua/mtx-patterns.lua index 36b60192d..c1178b2d0 100644 --- a/scripts/context/lua/mtx-patterns.lua +++ b/scripts/context/lua/mtx-patterns.lua @@ -150,6 +150,7 @@ scripts.patterns.list = { -- { "sa", "hyph-sa", "sanskrit" }, { "sk", "hyph-sk", "slovak" }, { "sl", "hyph-sl", "slovenian" }, + { "sq", "hyph-sq", "albanian" }, { "sr", "hyph-sr", "serbian", false, { "hyph-sr-cyrl", "hyph-sr-latn" }, }, -- { "sr", "hyph-sr-cyrl", "serbian", false }, -- { "sr", "hyph-sr-latn", "serbian" }, @@ -186,6 +187,7 @@ function scripts.patterns.load(path,name,mnemonic,ignored, merged) local splitpatternsold, splithyphenationsold = { }, { } local usedpatterncharactersnew, usedhyphenationcharactersnew = { }, { } if merged then + -- no version info report("using merged txt files %s.[hyp|pat|lic].txt",name) for i=1,#merged do local fullname = file.join(path,merged[i]) @@ -194,11 +196,13 @@ function scripts.patterns.load(path,name,mnemonic,ignored, merged) hyphenations = hyphenations .. (io.loaddata(addsuffix(fullname,"hyp.txt")) or "") .. "\n\n" end elseif lfs.isfile(patfile) then + -- no version info report("using txt files %s.[hyp|pat|lic].txt",name) comment = io.loaddata(licfile) or "" patterns = io.loaddata(patfile) or "" hyphenations = io.loaddata(hypfile) or "" elseif lfs.isfile(texfile) then + -- version info in comment blob report("using tex file %s.txt",name) local data = io.loaddata(texfile) or "" if data ~= "" then diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii index 3ebbdc60a..160f34997 100644 --- a/tex/context/base/mkii/cont-new.mkii +++ b/tex/context/base/mkii/cont-new.mkii @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2021.03.21 21:05} +\newcontextversion{2021.03.25 13:59} %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 01caed60f..99edd79c5 100644 --- a/tex/context/base/mkii/context.mkii +++ b/tex/context/base/mkii/context.mkii @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2021.03.21 21:05} +\edef\contextversion{2021.03.25 13:59} %D For those who want to use this: diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv index e0afd5492..b05ae7ee2 100644 --- a/tex/context/base/mkiv/cont-new.mkiv +++ b/tex/context/base/mkiv/cont-new.mkiv @@ -13,7 +13,7 @@ % \normalend % uncomment this to get the real base runtime -\newcontextversion{2021.03.21 21:05} +\newcontextversion{2021.03.25 13:59} %D This file is loaded at runtime, thereby providing an excellent place for hacks, %D patches, extensions and new features. There can be local overloads in cont-loc diff --git a/tex/context/base/mkiv/context.mkiv b/tex/context/base/mkiv/context.mkiv index f6100e4a7..b1d8cad34 100644 --- a/tex/context/base/mkiv/context.mkiv +++ b/tex/context/base/mkiv/context.mkiv @@ -45,7 +45,7 @@ %D {YYYY.MM.DD HH:MM} format. \edef\contextformat {\jobname} -\edef\contextversion{2021.03.21 21:05} +\edef\contextversion{2021.03.25 13:59} %D Kind of special: diff --git a/tex/context/base/mkiv/lxml-css.lua b/tex/context/base/mkiv/lxml-css.lua index 76cc4891e..48177c47c 100644 --- a/tex/context/base/mkiv/lxml-css.lua +++ b/tex/context/base/mkiv/lxml-css.lua @@ -233,7 +233,7 @@ do end end - function css.size(str,factors) + function css.size(str,factors, pct) local size, unit if type(str) == "table" then size, unit = str[1], str[2] @@ -241,7 +241,9 @@ do size, unit = lpegmatch(p_size,lower(str)) end if size and unit then - if factors then + if unit == "%" and pct then + return size * pct + elseif factors then return (factors[unit] or 1) * size else return size, unit diff --git a/tex/context/base/mkiv/mult-fun.lua b/tex/context/base/mkiv/mult-fun.lua index 759424f53..2bb101ae7 100644 --- a/tex/context/base/mkiv/mult-fun.lua +++ b/tex/context/base/mkiv/mult-fun.lua @@ -94,6 +94,7 @@ return { "transparent", "withtransparency", "withopacity", "property", "properties", "withproperties", "asgroup", + "withpattern", "withpatternscale", "withpatternfloat", "infont", -- redefined using textext -- "set_linear_vector", "set_circular_vector", -- "linear_shade", "circular_shade", diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf Binary files differindex dc1553a92..68e0cd0a1 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 560c58c4e..378081cf9 100644 --- a/tex/context/base/mkiv/status-lua.pdf +++ b/tex/context/base/mkiv/status-lua.pdf diff --git a/tex/context/base/mkxl/cont-new.mkxl b/tex/context/base/mkxl/cont-new.mkxl index 73b7d4664..b79c1fe25 100644 --- a/tex/context/base/mkxl/cont-new.mkxl +++ b/tex/context/base/mkxl/cont-new.mkxl @@ -13,7 +13,7 @@ % \normalend % uncomment this to get the real base runtime -\newcontextversion{2021.03.21 21:05} +\newcontextversion{2021.03.25 13:59} %D This file is loaded at runtime, thereby providing an excellent place for hacks, %D patches, extensions and new features. There can be local overloads in cont-loc diff --git a/tex/context/base/mkxl/context.mkxl b/tex/context/base/mkxl/context.mkxl index 6fe6e92a8..09a0d8dff 100644 --- a/tex/context/base/mkxl/context.mkxl +++ b/tex/context/base/mkxl/context.mkxl @@ -29,7 +29,7 @@ %D {YYYY.MM.DD HH:MM} format. \immutable\edef\contextformat {\jobname} -\immutable\edef\contextversion{2021.03.21 21:05} +\immutable\edef\contextversion{2021.03.25 13:59} %overloadmode 1 % check frozen / warning %overloadmode 2 % check frozen / error diff --git a/tex/context/base/mkxl/font-ots.lmt b/tex/context/base/mkxl/font-ots.lmt index 37f76b258..6d9ee1a00 100644 --- a/tex/context/base/mkxl/font-ots.lmt +++ b/tex/context/base/mkxl/font-ots.lmt @@ -294,9 +294,9 @@ local marks = false local classes = false local currentfont = false local currentdynamic = false -local currentscale = false -local currentxscale = false -local currentyscale = false +local currentscale = 1000 -- false +local currentxscale = 1000 -- false +local currentyscale = 1000 -- false local factor = 0 local threshold = 0 local checkmarks = false @@ -3783,9 +3783,12 @@ do if nesting == 1 then currentfont = font currentdynamic = dynamic - currentscale = false - currentxscale = false - currentyscale = false +-- currentscale = false +-- currentxscale = false +-- currentyscale = false + currentscale = 1000 + currentxscale = 1000 + currentyscale = 1000 tfmdata = fontdata[font] descriptions = tfmdata.descriptions -- only needed in gref so we could pass node there instead characters = tfmdata.characters -- but this branch is not entered that often anyway @@ -4039,9 +4042,12 @@ do currentfont = font currentdynamic = false - currentscale = false - currentxscale = false - currentyscale = false +-- currentscale = false +-- currentxscale = false +-- currentyscale = false + currentscale = 1000 + currentxscale = 1000 + currentyscale = 1000 tfmdata = fontdata[font] descriptions = tfmdata.descriptions -- only needed in gref so we could pass node there instead characters = tfmdata.characters -- but this branch is not entered that often anyway diff --git a/tex/context/base/mkxl/grph-inc.lmt b/tex/context/base/mkxl/grph-inc.lmt index 4fa562cb8..2066b31b0 100644 --- a/tex/context/base/mkxl/grph-inc.lmt +++ b/tex/context/base/mkxl/grph-inc.lmt @@ -2158,3 +2158,88 @@ implement { end end } + +-- for the moment we keep this here: + +do + + local stores = setmetatableindex("table") + local defaultwidth = 6553600 -- maybe bp + + function images.resetstore(name) + stores[name] = { } + end + + local function resetdata(name,n) + local store = stores[name] + store[n] = false + end + + local function storedata(name,data) + local store = stores[name] + store[#store+1] = data + return #store + end + + local function fetchdata(name,n) + local store = stores[name] + return store and store[n] + end + + images.storedata = storedata + images.fetchdata = fetchdata + images.resetdata = resetdata + + -- function images.filetostore(name,kind,filename) + -- return storedata(name, { + -- data = io.loaddata(filename), + -- kind = kind or file.suffix(filename), + -- }) + -- end + -- + -- function images.datatostore(name,kind,data) + -- return storedata(name, { + -- data = data, + -- kind = kind, + -- }) + -- end + + -- local embedimage = images.embed + -- local wrapimage = images.wrap + + function images.embedfromstore(name,n,reset) + local blob = fetchdata(name,n) + if blob then + local kind = blob.kind + if kind then + local identify = graphics.identifiers[kind] + local inject = backends.codeinjections[kind] + if identify and inject then + local info = blob.info or identify(blob.data,"string") -- could already be done + if info then + info.width = defaultwidth + info.height = (info.ysize /info.xsize) * defaultwidth + local image = blob.image + if not image then + image = inject(info,"string") + blob.image = image + end + image.width = info.width + image.height = info.height + context(wrapimage(image)) + -- if reset then + -- resetdata(name,n) + -- end + end + end + end + end + end + + implement { + name = "embedimagefromstore", + arguments = { "string", "integer", "boolean" }, + actions = images.embedfromstore, + } + +end diff --git a/tex/context/base/mkxl/grph-pat.mkxl b/tex/context/base/mkxl/grph-pat.mkxl index 92fd5ad74..3b51dc258 100644 --- a/tex/context/base/mkxl/grph-pat.mkxl +++ b/tex/context/base/mkxl/grph-pat.mkxl @@ -64,7 +64,7 @@ \endgroup} \permanent\tolerant\protected\def\applypattern[#1]#*[#2]% - {\hbox\bgroup + {\hpack\bgroup \letdummyparameter\c!name \s!dummy \letdummyparameter\c!width \zeropoint \letdummyparameter\c!height\zeropoint diff --git a/tex/context/base/mkxl/lang-hyp.mkxl b/tex/context/base/mkxl/lang-hyp.mkxl index 87423d6d3..bf3e253dc 100644 --- a/tex/context/base/mkxl/lang-hyp.mkxl +++ b/tex/context/base/mkxl/lang-hyp.mkxl @@ -196,9 +196,6 @@ % \sethyphenationfeatures % [default,fences] -% \setuphyphenation % will be default -% [method=expanded] - \protect \endinput % \starttext diff --git a/tex/context/base/mkxl/lpdf-grp.lmt b/tex/context/base/mkxl/lpdf-grp.lmt index 6adbe8c3c..9040e1252 100644 --- a/tex/context/base/mkxl/lpdf-grp.lmt +++ b/tex/context/base/mkxl/lpdf-grp.lmt @@ -287,8 +287,9 @@ function lpdf.registerpattern(specification) }, } - local resources = lpdf.collectedresources{ patterns = false } - local attributes = d() + -- local resources = lpdf.collectedresources{ patterns = false } -- we don't want duplicates, so no serialize here: + local resources = lpdf.collectedresources{ patterns = false, serialize = false } + local attributes = d -- () -- we need to check for patterns local onlybounds = 1 local patternobj = saveboxresource(specification.number,attributes,resources,true,onlybounds) lpdf.adddocumentpattern("Pt" .. nofpatterns,lpdf.reference(patternobj )) diff --git a/tex/context/base/mkxl/lpdf-lmt.lmt b/tex/context/base/mkxl/lpdf-lmt.lmt index 14b51b3b1..8d8220230 100644 --- a/tex/context/base/mkxl/lpdf-lmt.lmt +++ b/tex/context/base/mkxl/lpdf-lmt.lmt @@ -87,6 +87,7 @@ local pdf_pages = pdfconstant("Pages") local pdf_page = pdfconstant("Page") local pdf_xobject = pdfconstant("XObject") local pdf_form = pdfconstant("Form") +local pdf_pattern = pdfconstant("Pattern") local fonthashes = fonts.hashes local characters = fonthashes.characters @@ -1821,9 +1822,16 @@ local finalize do wrapper.Matrix = pdfarray { 1, 0, 0, 1, 0, 0 } end - -- todo: additional = resources + local patterns = true - local boxresources = lpdf.collectedresources { serialize = false } + if attributes.Type and attributes.Type == pdf_pattern then + patterns = false + end + + local boxresources = lpdf.collectedresources { + patterns = patterns, + serialize = false, + } boxresources.Font = fonts boxresources.XObject = xforms diff --git a/tex/context/base/mkxl/meta-tex.mkxl b/tex/context/base/mkxl/meta-tex.mkxl index 17dc788ef..5c58240a1 100644 --- a/tex/context/base/mkxl/meta-tex.mkxl +++ b/tex/context/base/mkxl/meta-tex.mkxl @@ -29,7 +29,7 @@ \aliased\let\stopTeXtexts\relax \permanent\tolerant\protected\def\TeXtext[#1]#:#2#3% contrary to mkii we don't process yet but we do expand - {\setxvalue{\??graphictextext#2}{\meta_textext_indeed{#1}{#3}}} + {\xdefcsname\??graphictextext#2\endcsname{\meta_textext_indeed{#1}{#3}}} \protected\def\meta_textext_indeed#1#2% {\begingroup @@ -157,6 +157,13 @@ \definefontsynonym[sans-bold-italic] [\s!SansBoldItalic] \definefontsynonym[sans-bold-oblique] [\s!SansBoldSlanted] +\definefontsynonym[sansserif-normal-normal] [\s!Sans] +\definefontsynonym[sansserif-normal-italic] [\s!SansItalic] +\definefontsynonym[sansserif-normal-oblique] [\s!SansSlanted] +\definefontsynonym[sansserif-bold-normal] [\s!SansBold] +\definefontsynonym[sansserif-bold-italic] [\s!SansBoldItalic] +\definefontsynonym[sansserif-bold-oblique] [\s!SansBoldSlanted] + \definefontsynonym[mono-normal-normal] [\s!Mono] \definefontsynonym[mono-normal-italic] [\s!MonoItalic] \definefontsynonym[mono-normal-oblique] [\s!MonoSlanted] @@ -173,6 +180,11 @@ \definelayer[svgmps][\c!method=\v!fit] +\permanent\protected\def\svgembeddedfigure#1% + {\clf_embedimagefromstore {svg} #1 true\relax} + +% todo: use the independent color and transparency mechanism + \permanent\protected\def\svghashed#1% {\clf_svghashed#1\relax} @@ -202,26 +214,22 @@ {\egroup \flushlayer[svgmps]} -\permanent\protected\def\svg_normal_color#1#2#3#4% - {\colored[r=#1,g=#2,b=#3]{#4}} +\permanent\protected\def\svg_normal_color_c#1#2#3%#4% % color + {\colored[r=#1,g=#2,b=#3]}%{#4}} + +\permanent\protected\def\svg_normal_color_o#1%#2% % opace + {\colored[a=1,t=#1]}%{#2}} + +\permanent\protected\def\svg_normal_color_b#1#2#3#4%#5% % both + {\colored[r=#1,g=#2,b=#3,a=1,t=#4]}% {#5}} \permanent\protected\def\svg_normal_set#1#2#3% {\setlayer[svgmps]{\hbox xoffset #1\onebasepoint yoffset #2\onebasepoint to 10sp{#3}}} -% \permanent\protected\def\svg_normal_font#1#2#3#4#5% -% {\hbox\bgroup -% \iftok{#2}\emptytoks\else -% \edef\p_font{\ifcsname\??svgfamily#2\endcsname\lastnamedcs\else#2\fi-#3-#4}% -% \predefinedfont[\s!spec:\p_font*\s!default\space @ 10bp]% -% \fi -% \glyphscale\numericscale#1\relax % we need a period ! -% #5% -% \egroup} - -\permanent\protected\def\svg_normal_font#1#2#3#4#5% +\permanent\protected\def\svg_normal_font#1#2#3%#4% {\hbox\bgroup \iftok{#2}\emptytoks\else - \edef\p_font{\ifcsname\??svgfamily#2\endcsname\lastnamedcs\else#2\fi-#3-#4}% + \edef\p_font{\ifcsname\??svgfamily#1\endcsname\lastnamedcs\else#1\fi-#2-#3}% \ifcsname svg:\p_font\endcsname \lastnamedcs \else @@ -229,9 +237,16 @@ \csname svg:\p_font\endcsname \fi \fi + \let\next} + % #4% + % \egroup} + +\permanent\protected\def\svg_normal_size#1%#2% + {\hbox\bgroup \glyphscale\numericscale#1\relax % we need a period ! - #5% - \egroup} + \let\next} + % #2% + % \egroup} \permanent\protected\def\svg_traced_pcode#1#2#3% {\writestatus{SVG TEXT}{....[poscode #1 #2 \Uchar #3]}% @@ -265,46 +280,67 @@ {\svg_normal_stop \writestatus{SVG TEXT}{[stop layer]}} -\permanent\protected\def\svg_traced_color#1#2#3#4% - {\writestatus{SVG TEXT}{.[start color #1 #2 #3]}% - \svg_normal_color{#1}{#2}{#3}{#4}% - \writestatus{SVG TEXT}{.[stop color]}} +\permanent\protected\def\svg_traced_color_c#1#2#3#4% + {\writestatus{SVG TEXT}{..[start color #1 #2 #3]}% + \svg_normal_color_c{#1}{#2}{#3}{#4}% + \writestatus{SVG TEXT}{..[stop color]}} + +\permanent\protected\def\svg_traced_color_o#1#2% + {\writestatus{SVG TEXT}{..[start opace #1]}% + \svg_normal_color_o{#1}{#2}% + \writestatus{SVG TEXT}{..[stop opace]}} + +\permanent\protected\def\svg_traced_color_b#1#2#3#4#5% + {\writestatus{SVG TEXT}{..[start color #1 #2 #3 opace #4]}% + \svg_normal_color_b{#1}{#2}{#3}{#4}{#5}% + \writestatus{SVG TEXT}{..[stop color opace]}} \permanent\protected\def\svg_traced_set#1#2#3% {\writestatus{SVG TEXT}{...[start set layer #1 #2]}% \svg_normal_set{#1}{#2}{#3}% \writestatus{SVG TEXT}{...[stop set setlayer]}} -\permanent\protected\def\svg_traced_font#1#2#3#4#5% - {\writestatus{SVG TEXT}{..[start scaled font #1 #2 #3 #4]}% - \svg_normal_font{#1}{#2}{#3}{#4}{#5}% - \writestatus{SVG TEXT}{..[stop scaled font]}} +\permanent\protected\def\svg_traced_font#1#2#3#4% + {\writestatus{SVG TEXT}{.[start font #1 #2 #3]}% + \svg_normal_font{#1}{#2}{#3}{#4}% + \writestatus{SVG TEXT}{.[stop font]}} + +\permanent\protected\def\svg_traced_size#1#2% + {\writestatus{SVG TEXT}{.[start size #1]}% + \svg_normal_size{#1}{#2}% + \writestatus{SVG TEXT}{.[stop size]}} \permanent\protected\def\svg_normal_text - {\let\svgpcode \svg_normal_pcode - \let\svgpchar \svg_normal_pchar - \let\svgpspace\svg_normal_pspace - \let\svgcode \svg_normal_code - \let\svgchar \svg_normal_char - \let\svgspace \svg_normal_space - \let\svgstart \svg_normal_start - \let\svgstop \svg_normal_stop - \let\svgcolor \svg_normal_color - \let\svgset \svg_normal_set - \let\svgfont \svg_normal_font} + {\enforced\let\svgpcode \svg_normal_pcode + \enforced\let\svgpchar \svg_normal_pchar + \enforced\let\svgpspace\svg_normal_pspace + \enforced\let\svgcode \svg_normal_code + \enforced\let\svgchar \svg_normal_char + \enforced\let\svgspace \svg_normal_space + \enforced\let\svgstart \svg_normal_start + \enforced\let\svgstop \svg_normal_stop + \enforced\let\svgcolorc\svg_normal_color_c + \enforced\let\svgcoloro\svg_normal_color_o + \enforced\let\svgcolorb\svg_normal_color_b + \enforced\let\svgset \svg_normal_set + \enforced\let\svgfont \svg_normal_font + \enforced\let\svgsize \svg_normal_size} \permanent\protected\def\svg_traced_text - {\let\svgpcode \svg_traced_pcode - \let\svgpchar \svg_traced_pchar - \let\svgpspace\svg_traced_pspace - \let\svgcode \svg_traced_code - \let\svgchar \svg_traced_char - \let\svgspace \svg_traced_space - \let\svgstart \svg_traced_start - \let\svgstop \svg_traced_stop - \let\svgcolor \svg_traced_color - \let\svgset \svg_traced_set - \let\svgfont \svg_traced_font} + {\enforced\let\svgpcode \svg_traced_pcode + \enforced\let\svgpchar \svg_traced_pchar + \enforced\let\svgpspace\svg_traced_pspace + \enforced\let\svgcode \svg_traced_code + \enforced\let\svgchar \svg_traced_char + \enforced\let\svgspace \svg_traced_space + \enforced\let\svgstart \svg_traced_start + \enforced\let\svgstop \svg_traced_stop + \enforced\let\svgcolorc\svg_traced_color_c + \enforced\let\svgcoloro\svg_traced_color_o + \enforced\let\svgcolorb\svg_traced_color_b + \enforced\let\svgset \svg_traced_set + \enforced\let\svgfont \svg_traced_font + \enforced\let\svgsize \svg_traced_size} \installtextracker {svg.text} diff --git a/tex/context/base/mkxl/mlib-pdf.lmt b/tex/context/base/mkxl/mlib-pdf.lmt index f3226d14d..0373c22f8 100644 --- a/tex/context/base/mkxl/mlib-pdf.lmt +++ b/tex/context/base/mkxl/mlib-pdf.lmt @@ -389,6 +389,10 @@ function metapost.flush(specification,result) local textfigure = flusher.textfigure -- local processspecial = flusher.processspecial or metapost.processspecial local tocomment = flusher.tocomment + + -- patterns: we always use image 1 and then can use patterns for 2..n (or one number) + -- we can then do an intermediate flush + for index=1,#figures do local figure = figures[index] local properties = pushproperties(figure) diff --git a/tex/context/base/mkxl/mlib-pps.lmt b/tex/context/base/mkxl/mlib-pps.lmt index 45ae9bf24..20593f5f2 100644 --- a/tex/context/base/mkxl/mlib-pps.lmt +++ b/tex/context/base/mkxl/mlib-pps.lmt @@ -8,11 +8,11 @@ if not modules then modules = { } end modules ['mlib-pps'] = { local format, gmatch, match, split, gsub = string.format, string.gmatch, string.match, string.split, string.gsub local tonumber, type, unpack, next, select = tonumber, type, unpack, next, select -local round, sqrt, min, max = math.round, math.sqrt, math.min, math.max +local round, sqrt, min, max, abs = math.round, math.sqrt, math.min, math.max, math.abs 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 -local formatters = string.formatters +local formatters, toboolean = string.formatters, string.toboolean local exists, savedata = io.exists, io.savedata local mplib = mplib @@ -256,6 +256,8 @@ local function preset(t,k) return v end +-- todo: nested startMPcode .. stopMPcode does weird + local function startjob(plugmode,kind,mpx) insert(stack,top) top = { @@ -1019,7 +1021,7 @@ local tx_reset, tx_process do end end - local fasttrack = false directives.register("metapost.text.fasttrack", function(v) fasttrack = v end) + local fasttrack = directives.register("metapost.text.fasttrack", function(v) fasttrack = v end) tx_process = function(object,prescript,before,after) local data = top.texdata[metapost.properties.number] -- the current figure number, messy @@ -1542,21 +1544,25 @@ end -- groups +local function getcorners(path) + local p1 = path[1] + local p2 = path[2] + local p3 = path[3] + local p4 = path[4] + return + min(p1.x_coord,p2.x_coord,p3.x_coord,p4.x_coord), + min(p1.y_coord,p2.y_coord,p3.y_coord,p4.y_coord), + max(p1.x_coord,p2.x_coord,p3.x_coord,p4.x_coord), + max(p1.y_coord,p2.y_coord,p3.y_coord,p4.y_coord) +end + local function gr_process(object,prescript,before,after) local gr_state = prescript.gr_state 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 = path[1] - local p2 = path[2] - local p3 = path[3] - local p4 = 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) + local llx, lly, urx, ury = getcorners(object.path) before[#before+1] = function() context.MPLIBstartgroup( gr_type.isolated and 1 or 0, @@ -1574,6 +1580,44 @@ local function gr_process(object,prescript,before,after) object.grouped = true end +-- patterns + +local pattern_index = 0 + +local function pt_process(object,prescript,before,after) + local pt_state = prescript.pt_state + if not pt_state then + return + else + local pt_action = prescript.pt_action + if pt_state == "start" then + local float = toboolean(prescript.pt_float) and 1 or 0 + local llx, lly, urx, ury = getcorners(object.path) + if abs(llx) < 0.0001 then llx = 0 end + if abs(lly) < 0.0001 then lly = 0 end + before[#before+1] = function() + if pt_action == "set" then + pattern_index = pattern_index + 1 + context.MPLIBstartsetpattern(pattern_index, llx, lly, urx, ury, float) + else + context.MPLIBstartgetpattern(pattern_index, llx, lly, urx, ury, float) + end + end + elseif pt_state == "stop" then + after[#after+1] = function() + if pt_action == "set" then + context.MPLIBstopsetpattern() + else + context.MPLIBstopgetpattern() + end + end + end + end + object.path = false + object.color = false + object.grouped = true +end + -- outlines local ot_reset, ot_process do @@ -1653,6 +1697,7 @@ installplugin { name = "outline", reset = ot_reset, process = ot_process } installplugin { name = "color", reset = cl_reset, process = cl_process } installplugin { name = "text", reset = tx_reset, process = tx_process } installplugin { name = "group", reset = gr_reset, process = gr_process } +installplugin { name = "pattern", reset = pt_reset, process = pt_process } installplugin { name = "graphictext", reset = gt_reset, process = gt_process } installplugin { name = "shade", reset = sh_reset, process = sh_process } installplugin { name = "bitmap", reset = bm_reset, process = bm_process } diff --git a/tex/context/base/mkxl/mlib-pps.mkxl b/tex/context/base/mkxl/mlib-pps.mkxl index 2fa721445..75ebcff67 100644 --- a/tex/context/base/mkxl/mlib-pps.mkxl +++ b/tex/context/base/mkxl/mlib-pps.mkxl @@ -214,6 +214,48 @@ \setbox\scratchbox\hpack\bgroup \enforced\permanent\protected\def\MPLIBstopgroup{\mlib_stop_group{#1}{#2}{#3}{#4}{#5}{#6}}} +%D Not that much code is needed because we already have a mechanism already. For +%D some reason there is no option to use the current positions (pattern space mess) +%D so we need a position. I could delegate this to the backend but patterns are +%D selsom used. + +\permanent\protected\def\MPLIBstartsetpattern#1#2#3#4#5#6% + {\normalexpanded{\registerpattern[mp-pattern-#1]\ifnum#6=\zerocount[hoffset=\MPx{mp-pattern-#1},voffset=\MPy{mp-pattern-#1}]\fi}% + \bgroup + \dowithnextbox{% + \boxxoffset\nextbox-#2\onebasepoint + \boxyoffset\nextbox-#3\onebasepoint + \wd\nextbox\dimexpr#4\onebasepoint-#2\onebasepoint\relax + \ht\nextbox\dimexpr#5\onebasepoint-#3\onebasepoint\relax + \box\nextbox}% + \hpack\bgroup} + +\permanent\protected\def\MPLIBstopsetpattern + {\egroup + \egroup} + +\permanent\protected\def\MPLIBstartgetpattern#1#2#3#4#5#6% + {\setbox\nextbox\hpack\bgroup + \applypattern + [\c!name=mp-pattern-#1, +% \c!width=2\dimexpr#4\onebasepoint-#2\onebasepoint\relax, + \c!width=\dimexpr#4\onebasepoint-#2\onebasepoint\relax, +% \c!height=2\dimexpr#5\onebasepoint-#3\onebasepoint\relax]% + \c!height=\dimexpr#5\onebasepoint-#3\onebasepoint\relax]% + \hss + \egroup + % \boxyoffset\nextbox -.5\dimexpr#5\onebasepoint-#3\onebasepoint\relax + \boxyoffset\nextbox \dimexpr#3\onebasepoint\relax + % \boxxoffset\nextbox -.5\dimexpr#4\onebasepoint-#2\onebasepoint\relax + \boxxoffset\nextbox \dimexpr#2\onebasepoint\relax + \ht\nextbox\zeropoint + \wd\nextbox\zeropoint + \dp\nextbox\zeropoint + \normalexpanded{\ifnum#6=\zerocount\hpos{mp-pattern-#1}\fi}{\box\nextbox}} + +\permanent\protected\def\MPLIBstopgetpattern + {} + % For now here ... will be cleaned up: \newtoks\mptexttoks diff --git a/tex/context/base/mkxl/mlib-run.lmt b/tex/context/base/mkxl/mlib-run.lmt index c85acdee3..82ca32c75 100644 --- a/tex/context/base/mkxl/mlib-run.lmt +++ b/tex/context/base/mkxl/mlib-run.lmt @@ -567,69 +567,6 @@ if not metapost.convert then end --- This will be redone as we no longer output svg of ps! - --- function metapost.directrun(formatname,filename,outputformat,astable,mpdata) --- local fullname = file.addsuffix(filename,"mp") --- local data = mpdata or io.loaddata(fullname) --- if outputformat ~= "svg" then --- outputformat = "mps" --- end --- if not data then --- report_metapost("unknown file %a",filename) --- else --- local mpx = metapost.checkformat(formatname) --- if not mpx then --- report_metapost("unknown format %a",formatname) --- else --- report_metapost("processing %a",(mpdata and (filename or "data")) or fullname) --- local result = executempx(mpx,data) --- if not result then --- report_metapost("error: no result object returned") --- elseif result.status > 0 then --- report_metapost("error: %s",(result.term or "no-term") .. "\n" .. (result.error or "no-error")) --- else --- if metapost.showlog then --- metapost.lastlog = metapost.lastlog .. "\n" .. result.term --- report_metapost("info: %s",result.term or "no-term") --- end --- local figures = result.fig --- if figures then --- local sorted = table.sortedkeys(figures) --- if astable then --- local result = { } --- report_metapost("storing %s figures in table",#sorted) --- for k=1,#sorted do --- local v = sorted[k] --- if outputformat == "mps" then --- result[v] = figures[v]:postscript() --- else --- result[v] = figures[v]:svg() -- (3) for prologues --- end --- end --- return result --- else --- local basename = file.removesuffix(file.basename(filename)) --- for k=1,#sorted do --- local v = sorted[k] --- local output --- if outputformat == "mps" then --- output = figures[v]:postscript() --- else --- output = figures[v]:svg() -- (3) for prologues --- end --- local outname = formatters["%s-%s.%s"](basename,v,outputformat) --- report_metapost("saving %s bytes in %a",#output,outname) --- io.savedata(outname,output) --- end --- return #sorted --- end --- end --- end --- end --- end --- end - function metapost.directrun(formatname,filename,outputformat,astable,mpdata) report_metapost("producing postscript and svg is no longer supported") end diff --git a/tex/context/base/mkxl/mlib-svg.lmt b/tex/context/base/mkxl/mlib-svg.lmt index 496d4ed0d..8409be11b 100644 --- a/tex/context/base/mkxl/mlib-svg.lmt +++ b/tex/context/base/mkxl/mlib-svg.lmt @@ -9,6 +9,8 @@ if not modules then modules = { } end modules ['mlib-svg'] = { -- todo: svg stripper +-- todo: check clip: what if larger than bbox + -- todo: when opacity is 1 don't flush it -- Just a few notes: @@ -96,20 +98,20 @@ local xmltext, xmltextonly = xml.text, xml.textonly local css = xml.css or { } -- testing local function xmlinheritattributes(c,pa) - local at = c.at - local dt = c.dt - if at and dt then - if pa then - setmetatableindex(at,pa) - end - for i=1,#dt do - local dti = dt[i] - if type(dti) == "table" then - xmlinheritattributes(dti,at) + if not c.special then + local at = c.at + local dt = c.dt + if at and dt then + if pa then + setmetatableindex(at,pa) + end + for i=1,#dt do + local dti = dt[i] + if type(dti) == "table" then + xmlinheritattributes(dti,at) + end end end - else - -- comment of so end end @@ -130,12 +132,14 @@ local trace_result = false trackers.register("metapost.svg.result", function(v) local trace_colors = false trackers.register("metapost.svg.colors", function(v) trace_colors = v end) local trace_fonts = false trackers.register("metapost.svg.fonts", function(v) trace_fonts = v end) --- This is just an experiment. Todo: reset hash etc. Also implement --- an option handler. +-- This is just an experiment. Todo: reset hash etc. Also implement an option handler. local s_draw_image_start = "draw image (" local s_draw_image_stop = ") ;" + +local ignoredopacity = 1 + local svghash = false do local svglast = 0 @@ -196,7 +200,7 @@ local a2c do a2c = function(x1, y1, rx, ry, angle, large, sweep, x2, y2, f1, f2, cx, cy) - if (rx == 0 or ry == 0 ) or (x1 == x2 and y1 == y2) then + if (rx == 0 or ry == 0) or (x1 == x2 and y1 == y2) then return { x1, y1, x2, y2, x2, y2 } end @@ -310,6 +314,8 @@ local factors = { ["in"] = 90, ["em"] = 12 * 1.25, ["ex"] = 8 * 1.25, + ["%"] = 0.1, + ["bp"] = 1, } metapost.svgfactors = factors @@ -541,17 +547,18 @@ local colorcomponents, withcolor, thecolor, usedcolors do local hwbtorgb = colors.hwbtorgb local forcedmodel = colors.forcedmodel - local p_splitcolor = + local p_splitcolor = -- offet lowercase ff P("#") * C(p_hexdigit*p_hexdigit)^1 / function(r,g,b) if not r then return "gray", 0 elseif not (g and b) then - return "gray", tonumber(r or "0", 16) / 255 or 0 + return "gray", + (r == "00" and 0) or (r == "ff" and 1) or (tonumber(r,16)/255) else return "rgb", - tonumber(r or "0", 16) / 255 or 0, - tonumber(g or "0", 16) / 255 or 0, - tonumber(b or "0", 16) / 255 or 0 + (r == "00" and 0) or (r == "ff" and 1) or (tonumber(r,16)/255), + (g == "00" and 0) or (g == "ff" and 1) or (tonumber(g,16)/255), + (b == "00" and 0) or (b == "ff" and 1) or (tonumber(b,16)/255) end end + P("rgb") * p_a @@ -640,19 +647,25 @@ local colorcomponents, withcolor, thecolor, usedcolors do color = c end end - local what, s1, s2, s3, s4 = registeredcolor(color) - if what then - return what, s1, s2, s3, s4 - end - what, s1, s2, s3, s4 = lpegmatch(p_splitcolor,color) - if not what then - local t = triplets[color] - if t then - s1, s2, s3 = t[1], t[2], t[3] - what = "rgb" + if color == "#000000" then + return "rgb", 0, 0, 0 + elseif color == "#ffffff" then + return "rgb", 1, 1, 1 + else + local what, s1, s2, s3, s4 = registeredcolor(color) + if not what then + what, s1, s2, s3, s4 = lpegmatch(p_splitcolor,color) + -- we could cache + if not what then + local t = triplets[color] + if t then + s1, s2, s3 = t[1], t[2], t[3] + what = "rgb" + end + end end + return what, s1, s2, s3, s4 end - return what, s1, s2, s3, s4 end colorcomponents = function(color) @@ -730,6 +743,9 @@ local grabpath, grablist do local m = { __index = function() return 0 end } + -- local t = { } -- no real saving here if we share + -- local n = 0 + grabpath = function(str) local p = lpegmatch(p_path,str) or { } local np = #p @@ -740,6 +756,7 @@ local grabpath, grablist do setmetatable(p,m) local t = { } -- no real saving here if we share local n = 0 + -- n = 0 local a = 0 local i = 0 local last = "M" @@ -1302,9 +1319,7 @@ local handletransform, handleviewbox do lpegmatch(p_transform,t) if noftransforms > 0 then -- currentpicture - local start = s_transform_start - local stop = f_transform_stop(concat(transforms,"",1,noftransforms)) - return start, stop, t + return s_transform_start, f_transform_stop(concat(transforms,"",1,noftransforms)), t end end end @@ -1398,7 +1413,7 @@ do -- ["missing-glyph"] = true, -- ["mpath"] = true, ["path"] = true, - -- ["pattern"] = true, + ["pattern"] = true, ["polygon"] = true, ["polyline"] = true, ["radialGradient"] = true, @@ -1642,10 +1657,10 @@ do local p = grabpath(d) p.evenodd = ca["clip-rule"] == "evenodd" p.close = true -local transform = rawget(ca,"transform") -if transform then - transform = handletransformstring(transform) -end + local transform = rawget(ca,"transform") + if transform then + transform = handletransformstring(transform) + end return p, clippath, transform else return @@ -1656,6 +1671,82 @@ end end end + -- todo: clip = [ auto | rect(llx,lly,urx,ury) ] + + local s_rotation_start = "draw image ( " + local f_rotation_stop = formatters[") rotatedaround((0,0),-angle((%N,%N))) ;"] + local f_rotation_angle = formatters[") rotatedaround((0,0),-%N) ;"] + + local handleoffset, handlesize do + + local s_offset_start = "draw image ( " + local f_offset_stop = formatters[") shifted (%N,%N) ;"] + local s_size_start = "draw image ( " + local f_size_stop = formatters[") xysized (%N,%N) ;"] + + handleoffset = function(at) + local x = asnumber_vx(rawget(at,"x")) + local y = asnumber_vy(rawget(at,"y")) + if x ~= 0 or y ~= 0 then + return s_offset_start, f_offset_stop(x,y) + end + end + + handlesize = function(at) + local width = asnumber_x(rawget(at,"width")) + local height = asnumber_y(rawget(at,"height")) + if width == 0 or height == 0 then + -- bad scaling + elseif width == 1 and height == 1 then + -- no need for scaling + else + return s_size_start, f_size_stop(width,height) + end + end + + end + + function handlers.symbol(c) + local at = c.at + -- x y refX refY + local boffset, eoffset = handleoffset(at) + local bsize, esize = handlesize(at) + local btransform, etransform, transform = handletransform(at) + + if boffset then + r = r + 1 result[r] = boffset + end + if btransform then + r = r + 1 result[r] = btransform + end + if bsize then + r = r + 1 ; result[r] = bsize + end + +-- local _x = at.x at.x = 0 +-- local _y = at.y at.y = 0 +-- local _w = at.width at.width = 0 +-- local _h = at.height at.height = 0 + + process(c,"/*") +-- at.x = _x +-- at.y = _y +-- at.width = _w +-- at.height = _h + + if esize then + r = r + 1 result[r] = esize + end + if etransform then + r = r + 1 ; result[r] = etransform + end + if eoffset then + r = r + 1 result[r] = eoffset + end + end + + -- do + local s_shade_linear = ' withshademethod "linear" ' local s_shade_circular = ' withshademethod "circular" ' local f_color = formatters[' withcolor "%s"'] @@ -1686,6 +1777,85 @@ end -- stop-opacity = "0" : strange, just use steps for that + -- todo: test for kind independently in caller, make a plug instead + + local function pattern(id) + local c = definitions[id] -- no locate ! + if c and c.tg == "pattern" then + -- just use result and then prune + local _r = r + local _result = result + r = 0 + result = { } + -- + -- handlers.pattern(spec) + -- + -- inlined because of width + -- + local at = c.at + + local width = asnumber_x(rawget(at,"width")) + local height = asnumber_y(rawget(at,"height")) + if width == 0 or height == 0 then + -- bad scaling + width = nil + height = nil + elseif width == 1 and height == 1 then + -- no need for scaling + width = nil + height = nil + else + -- for now only relative + end + + local boffset, eoffset = handleoffset(at) + -- local bsize, esize = handlesize(at) + local btransform, etransform, transform = handletransform(at) + + if boffset then + r = r + 1 result[r] = boffset + end + if btransform then + r = r + 1 result[r] = btransform + end + -- if bsize then + -- r = r + 1 ; result[r] = bsize + -- end + + local _x = at.x at.x = 0 + local _y = at.y at.y = 0 + local _w = at.width at.width = 0 + local _h = at.height at.height = 0 + + process(c,"/*") + + at.x = _x + at.y = _y + at.width = _w + at.height = _h + + -- if esize then + -- r = r + 1 result[r] = esize + -- end + if etransform then + r = r + 1 ; result[r] = etransform + end + if eoffset then + r = r + 1 result[r] = eoffset + end + -- + local okay + if width and height then + okay = formatters[" withpattern image ( % t )\n withpatternscale(%N,%N)"](result,width,height) + else + okay = formatters[" withpattern image ( % t )"](result) + end + r = _r + result = _result + return okay + end + end + local function gradient(id) local spec = definitions[id] -- no locate ! if spec then @@ -1729,7 +1899,6 @@ end -- todo end else - report("unknown gradient %a",id) return end -- local gu = a.gradientUnits @@ -1752,7 +1921,6 @@ end -- for now fraction = xmlcount(spec,"/stop")/100 -- asnumber_p ? end - if colora and colorb and colora ~= "" and colorb ~= "" then n = n + 1 -- if opacity then @@ -1761,7 +1929,6 @@ end shade[n] = f_shade_step(fraction,thecolor(colora),thecolor(colorb)) -- end end - colora = colorb end return concat(shade,"\n ") @@ -1791,8 +1958,9 @@ end o = nil elseif o then o = asnumber_r(o) --- if o and o ~= 0 then - if o then + if o == ignoredopacity then + o = nil + elseif o then o = f_opacity(o) else o = nil @@ -1809,7 +1977,9 @@ end local o = at["opacity"] if o and o ~= "none" then o = asnumber_r(o) --- if o and o ~= 1 then + if o == ignoredopacity then + return + end if o then return s_opacity_start, f_opacity_content(o), s_opacity_stop end @@ -1819,67 +1989,72 @@ end -- it looks like none and transparent are both used (mozilla examples) local function fillproperties(fill,at,opacity) - local c = c ~= "none" and (gradient(fill) or withcolor(fill)) or nil local o = at["fill-opacity"] or (opacity and at["opacity"]) - if o and o ~= "none" then + local c = nil + if c ~= "none" then + c = gradient(fill) + if not c then + c = pattern(fill) + if c then + if o and o ~= "none" then + o = asnumber_r(o) + if o ~= ignoredopacity then + return c, f_opacity(o), "pattern" + end + end + return c, false, "pattern" + else + c = withcolor(fill) + end + end + end + if not o and fill == "transparent" then + return nil, f_opacity(0), true + elseif o and o ~= "none" then o = asnumber_r(o) --- if o == 1 then --- return c --- else + if o == ignoredopacity then + return c + end if o then - return c, f_opacity(o), o == 0 -- hm this check should be: o == 1 + return c, f_opacity(o), (o == 1 and "invisible") end - elseif fill == "transparent" then - return nil, f_opacity(1), false -- o == 1 -- hm this check should be: o == 1 end return c end - -- todo: clip = [ auto | rect(llx,lly,urx,ury) ] - - local s_offset_start = "draw image ( " - local f_offset_stop = formatters[") shifted (%N,%N) ;"] - local s_rotation_start = "draw image ( " - local f_rotation_stop = formatters[") rotatedaround((0,0),-angle((%N,%N))) ;"] - local f_rotation_angle = formatters[") rotatedaround((0,0),-%N) ;"] + local viewport do - local function offset(at) - local x = asnumber_vx(rawget(at,"x")) - local y = asnumber_vy(rawget(at,"y")) - if x ~= 0 or y ~= 0 then - return s_offset_start, f_offset_stop(x,y) - end - end + local s_viewport_start = s_draw_image_start + local s_viewport_stop = s_draw_image_stop + local f_viewport_shift = formatters["currentpicture := currentpicture shifted (%N,%N);"] + local f_viewport_scale = formatters["currentpicture := currentpicture xysized (%N,%N);"] + local f_viewport_clip = formatters["clip currentpicture to (unitsquare xyscaled (%N,%N));"] - local s_viewport_start = s_draw_image_start - local s_viewport_stop = s_draw_image_stop - local f_viewport_shift = formatters["currentpicture := currentpicture shifted (%N,%N);"] - local f_viewport_scale = formatters["currentpicture := currentpicture xysized (%N,%N);"] - local f_viewport_clip = formatters["clip currentpicture to (unitsquare xyscaled (%N,%N));"] + viewport = function(x,y,w,h,noclip,scale) + r = r + 1 ; result[r] = s_viewport_start + return function() + local okay = w ~= 0 and h ~= 0 + if okay and scale then + r = r + 1 ; result[r] = f_viewport_scale(w,h) + end + if x ~= 0 or y ~= 0 then + r = r + 1 ; result[r] = f_viewport_shift(-x,y) + end + if okay and not noclip then + r = r + 1 ; result[r] = f_viewport_clip(w,-h) + end - local function viewport(x,y,w,h,noclip,scale) - r = r + 1 ; result[r] = s_viewport_start - return function() - local okay = w ~= 0 and h ~= 0 - if okay and scale then - r = r + 1 ; result[r] = f_viewport_scale(w,h) - end - if x ~= 0 or y ~= 0 then - r = r + 1 ; result[r] = f_viewport_shift(-x,y) + r = r + 1 ; result[r] = s_viewport_stop end - if okay and not noclip then - r = r + 1 ; result[r] = f_viewport_clip(w,-h) - end - - r = r + 1 ; result[r] = s_viewport_stop end + end -- maybe forget about defs and just always locate (and then backtrack - -- over <g> if needed) + -- over <g> if needed) .. so, only store after locating - function handlers.defs(c) - for c in xmlcollected(c,"/*") do + function handledefinitions(c) + for c in xmlcollected(c,"defs/*") do local a = c.at if a then local id = rawget(a,"id") @@ -1889,31 +2064,39 @@ end end end end - end - - function handlers.symbol(c) - if uselevel == 0 then + for c in xmlcollected(c,"symbol") do local id = rawget(c.at,"id") if id then definitions["#" .. id ] = c definitions["url(#" .. id .. ")"] = c end - else - handlers.g(c) end end - local uselevel = 0 - -- local bodyfontscale = 1 + -- function handlers.defs(c) + -- for c in xmlcollected(c,"/*") do + -- local a = c.at + -- if a then + -- local id = rawget(a,"id") + -- if id then + -- definitions["#" .. id ] = c + -- definitions["url(#" .. id .. ")"] = c + -- end + -- end + -- end + -- end + + -- lots of stuff todo: transform + + local uselevel = 0 function handlers.use(c) local at = c.at local id = rawget(at,"href") or rawget(at,"xlink:href") -- better a rawget local res = locate(id,c) if res then - -- width height ? uselevel = uselevel + 1 - local boffset, eoffset = offset(at) + local boffset, eoffset = handleoffset(at) local btransform, etransform, transform = handletransform(at) if boffset then @@ -1931,12 +2114,14 @@ end at["transform"] = false -- at["clip-path"] = false +setmetatableindex(res.at,at) + local tg = res.tg - if usetags[tg] then +-- if usetags[tg] then process(res,".") - else - process(res,"/*") - end +-- else +-- process(res,"/*") +-- end at["transform"] = _transform -- at["clip-path"] = _clippath @@ -1963,6 +2148,7 @@ end local f_no_fill_l = formatters[' nofill closedlines(%s)'] local f_do_fill_l = formatters[' fill closedlines(%s)'] local f_eo_fill_l = formatters[' eofill closedlines(%s)'] + local f_closed_draw = formatters[' draw closedcurve(%s)'] local f_do_fill = f_do_fill_c local f_eo_fill = f_eo_fill_c local f_no_fill = f_no_fill_c @@ -2258,12 +2444,16 @@ end end if has_fill then - local color, opacity = fillproperties(fill,at,not has_stroke) + local color, opacity, option = fillproperties(fill,at,not has_stroke) local f_xx_fill = at["fill-rule"] == "evenodd" and f_eo_fill or f_do_fill if btransform then r = r + 1 ; result[r] = btransform end - r = r + 1 result[r] = f_xx_fill(shape) + if option == "pattern" then + r = r + 1 result[r] = f_closed_draw(shape) + else + r = r + 1 result[r] = f_xx_fill(shape) + end if color then r = r + 1 ; result[r] = color end @@ -2440,9 +2630,11 @@ end -- todo: image (nicer for transform too) if fill and fill ~= "none" then - local color, opacity = fillproperties(fill,at) + local color, opacity, option = fillproperties(fill,at) local f_xx_fill = at["fill-rule"] == "evenodd" - if shape.closed then + if option == "pattern" then + f_xx_fill = f_closed_draw + elseif shape.closed then f_xx_fill = f_xx_fill and f_eo_fill or f_do_fill elseif shape.curve then f_xx_fill = f_xx_fill and f_eo_fill_c or f_do_fill_c @@ -2556,9 +2748,10 @@ end -- inclusion takes from data -- specification.data = false - local f_image = formatters[ [[figure("%s") xysized (%N,%N) shifted (%N,%N)]] ] + -- local f_image = formatters[ [[figure("%s") xysized (%N,%N) shifted (%N,%N)]] ] + local f_image = formatters[ [[svgembeddedfigure(%i) xysized (%N,%N) shifted (%N,%N)]] ] - local nofimages = 0 + -- local nofimages = 0 function handlers.image(c) local at = c.at @@ -2581,12 +2774,15 @@ end h = h and asnumber_y(h) x = x and asnumber_vx(x) or 0 y = y and asnumber_vy(y) or 0 - nofimages = nofimages + 1 - local name = "temp-svg-image-" .. nofimages .. "." .. kind local data = basexx.decode64(data) - io.savedata(name,data) + -- local name = "temp-svg-image-" .. nofimages .. "." .. kind + local index = images.storedata("svg", { + kind = kind, + data = data, + info = graphics.identifiers[kind](data,"string"), + }) + -- io.savedata(name,data) if not w or not h then - local info = graphics.identifiers[kind](data,"string") if info then -- todo: keep aspect ratio attribute local xsize = info.xsize @@ -2606,9 +2802,9 @@ end -- safeguard: if not w then w = h or 1 end if not h then h = w or 1 end - luatex.registertempfile(name) - -- done: - flushobject(f_image(name,w,h,x,y - h),at) + -- luatex.registertempfile(name) + -- flushobject(f_image(name,w,h,x,y - h),at) + flushobject(f_image(index,w,h,x,y - h),at) else -- nothing done end @@ -2644,7 +2840,7 @@ end at["transform"] = false at["clip-path"] = false - process(c,"/*") + process(c,"/!(defs|symbol)") -- /* at["transform"] = _transform at["clip-path"] = _clippath @@ -2684,14 +2880,17 @@ end local s_start = "\\svgstart " local s_stop = "\\svgstop " local f_set = formatters["\\svgset{%N}{%N}"] -- we need a period - local f_colored = formatters["\\svgcolor{%.3N}{%.3N}{%.3N}{"] + local f_color_c = formatters["\\svgcolorc{%.3N}{%.3N}{%.3N}{"] + local f_color_o = formatters["\\svgcoloro{%.3N}{"] + local f_color_b = formatters["\\svgcolorb{%.3N}{%.3N}{%.3N}{%.3N}{"] local f_poscode = formatters["\\svgpcode{%N}{%N}{%s}"] local f_poschar = formatters["\\svgpchar{%N}{%N}{%s}"] local f_posspace = formatters["\\svgpspace{%N}{%N}"] local f_code = formatters["\\svgcode{%s}"] local f_char = formatters["\\svgchar{%s}"] local s_space = "\\svgspace " - local f_scaled = formatters["\\svgfont{%0.6f}{%s}{%s}{%s}"] -- we need a period + local f_size = formatters["\\svgsize{%0.6f}"] -- we need a period + local f_font = formatters["\\svgfont{%s}{%s}{%s}"] local f_hashed = formatters["\\svghashed{%s}"] ----- p_texescape = lpegpatterns.texescape @@ -2777,6 +2976,12 @@ end end end + local cleanfontname = fonts.names.cleanname + + local x_family = false + local x_weight = false + local x_style = false + local function collect(parent,t,c,x,y,size,scale,family,tx,ty,tdx,tdy) if c.special then return nil @@ -2787,6 +2992,7 @@ end local tg = c.tg local ax = rawget(at,"x") local ay = rawget(at,"y") + local v_opacity = tonumber(at["fill-opacity"]) local v_fill = at["fill"] local v_family = at["font-family"] local v_style = at["font-style"] @@ -2800,14 +3006,14 @@ end if v_family then v_family = cssfamily(v_family) end if v_style then v_style = cssstyle (v_style) end if v_weight then v_weight = cssweight(v_weight) end - if v_size then v_size = csssize (v_size,factors) or tonumber(v_size) end + if v_size then v_size = csssize (v_size,factors,size/100) or tonumber(v_size) end -- if not v_family then v_family = family end if not v_weight then v_weight = "normal" end if not v_style then v_style = "normal" end -- if v_family then - v_family = fonts.names.cleanname(v_family) + v_family = cleanfontname(v_family) v_family = checkedfamily(v_family) end -- @@ -2821,22 +3027,24 @@ end local usedsize = v_size or defaultsize local usedscale = usedsize / defaultsize -- --- todo: rotate : list of numbers --- todo: lengthAdjust : spacing|spacingAndGlyphs --- todo: textLength : scale to width --- toto: font-size-adjust --- toto: font-stretch --- letter-spacing --- word-spacing --- writing-mode:lr-tb + -- todo: rotate : list of numbers + -- todo: lengthAdjust : spacing|spacingAndGlyphs + -- todo: textLength : scale to width + -- toto: font-size-adjust + -- toto: font-stretch + -- letter-spacing + -- word-spacing + -- writing-mode:lr-tb -- --- local useddelta = d_x ~= 0 or d_y ~= 0 or false --- if useddelta then --- dx = validdelta(usedscale,dx) --- dy = validdelta(usedscale,dy) --- end - -- - t[#t+1] = f_scaled(usedscale,v_family,v_weight,v_style) + local newfont = v_family ~= x_family or v_weight ~= x_weight or v_style ~= x_style + if newfont then + x_family = v_family + x_weight = v_weight + x_style = v_style + t[#t+1] = f_font(v_family,v_weight,v_style) + t[#t+1] = "{" + end + t[#t+1] = f_size(usedscale) t[#t+1] = "{" -- if trace_fonts then @@ -2850,15 +3058,26 @@ end report(" used size : %s",v_size or defaultsize) end -- - local ecolored = v_fill and v_fill ~= "" or false + local ecolored = v_fill ~= "" and v_fill or false + local opacity = v_opacity ~= ignoredopacity and v_opacity or false + -- + -- todo cmyk + -- if ecolored then - -- todo cmyk local r, g, b = colorcomponents(v_fill) if r and g and b then - t[#t+1] = f_colored(r,g,b) + if opacity then + t[#t+1] = f_color_b(r,g,b,opacity) + else + t[#t+1] = f_color_c(r,g,b) + end + elseif opacity then + t[#t+1] = f_color_o(opacity) else ecolored = false end + elseif opacity then + t[#t+1] = f_color_o(opacity) end -- local hasa = ax ~= 0 or ay ~= 0 @@ -2917,7 +3136,7 @@ end if ci == " " then chars[i] = s_space elseif sensitive[ci] then - chars[i] = f_code(utfbyte(chars[i])) + chars[i] = f_code(utfbyte(ci)) else chars[i] = f_char(ci) -- chars[i] = ci @@ -2928,23 +3147,26 @@ end end end end - if hasa then - if t[#t] == "{" then - t[#t] = nil - t[#t] = nil - else - t[#t+1] = "}" - end + end + if hasa then + if t[#t] == "{" then + t[#t] = nil + t[#t] = nil + else + t[#t+1] = "}" end - end -- - if ecolored then + if opacity or ecolored then t[#t+1] = "}" end -- t[#t+1] = "}" -- + if newfont then + t[#t+1] = "}" + end + -- return t end @@ -2955,6 +3177,12 @@ end local textlevel = 0 function handlers.text(c) + if textlevel == 0 then + x_family = v_family + x_weight = v_weight + x_style = v_style + end + -- textlevel = textlevel + 1 -- analyze local only = fullstrip(xmltextonly(c)) @@ -2981,7 +3209,7 @@ end if not v_fill or v_fill == "none" then v_fill = "black" end - local color, opacity, invisible = fillproperties(v_fill,at) + local color, opacity, option = fillproperties(v_fill,at) local anchor = anchors[at["text-anchor"] or "start"] or "drt" local remap = metapost.remappedtext(only) -- x = x + dx @@ -2996,7 +3224,11 @@ end if trace_text then report("text: %s",only) end - elseif not invisible then -- can be an option + elseif option == "invisible" then + if trace_text then + report("invisible text: %s",only) + end + else local scale = 1 local textid = 0 local result = { } @@ -3019,12 +3251,11 @@ end else -- dx dy t = f_text_normal_svg(anchor,t,x,y) end - flushobject(t,at,color,opacity) + -- flushobject(t,at,color,opacity) -- otherwise mixup with transparency + flushobject(t,at,false,false) if trace_text then report("text: %s",result) end - elseif trace_text then - report("invisible text: %s",only) end -- textlevel = textlevel - 1 @@ -3072,8 +3303,6 @@ end local btransform, etransform, transform = handletransform(at) - -- bodyfontscale = tex.getdimen("bodyfontsize") / 65536 - if trace then report("view: %s, xpct %N, ypct %N","before",percentage_x,percentage_y) end @@ -3120,7 +3349,7 @@ end if bhacked then r = r + 1 ; result[r] = bhacked end - local boffset, eoffset = offset(at) + local boffset, eoffset = handleoffset(at) if boffset then r = r + 1 result[r] = boffset end @@ -3128,7 +3357,7 @@ end at["transform"] = false at["viewBox"] = false - process(c,"/*") + process(c,"/!(defs|symbol)") at["transform"] = transform at["viewBox"] = viewbox @@ -3177,6 +3406,7 @@ end function metapost.svgtomp(specification,pattern,notransform,normalize) local mps = "" local svg = specification.data + images.resetstore("svg") if type(svg) == "string" then svg = xmlconvert(svg) end @@ -3196,6 +3426,7 @@ end end handlechains(c) xmlinheritattributes(c) -- put this in handlechains + handledefinitions(c) handlers.svg ( c, specification.x, diff --git a/tex/context/modules/mkiv/s-system-macros.mkxl b/tex/context/modules/mkiv/s-system-macros.mkxl index 0f2644403..4fd723285 100644 --- a/tex/context/modules/mkiv/s-system-macros.mkxl +++ b/tex/context/modules/mkiv/s-system-macros.mkxl @@ -108,12 +108,31 @@ local data = scripts.interface.editor("data") local files = data and data.common and data.common.filenames or { } + local macros = { } local flagged = 0 local total = 0 local list = tex.hashtokens() local all = not tex.modes.notmarked local everything = tex.modes.everything + local fmtname = resolvers.locateformat("cont-en.fmt") + if fmtname then + local logname = file.replacesuffix(fmtname,"log") + for filename in string.gmatch(io.loaddata(logname),"fullname=(%S+)") do + local s = file.suffix(filename) + local b = file.basename(filename) + if s ~= "lua" and s ~= "lmt" then + local d = io.loaddata(filename) + for m in string.gmatch(d,"\n[\\a-z]*[exg]*def\\([a-zA-Z_]+)") do + macros[m] = b + end + for m in string.gmatch(d,"\n[\\a-z]*[g]*let\\([a-zA-Z_]+)") do + macros[m] = b + end + end + end + end + table.sort(list) local function show(visible, check) @@ -137,7 +156,7 @@ if everything or ((all or not marked) and not find(k,"^[pvm]_") and not find(k,"^![tT]")) then local parameters = v.parameters local noaligned = v.noaligned and "noaligned" - local filename = files[k] + local filename = files[k] or macros[k] local csname = context.escape(k) if undefined then marked = "?" diff --git a/tex/context/patterns/common/lang-sq.rme b/tex/context/patterns/common/lang-sq.rme new file mode 100644 index 000000000..a686fa549 --- /dev/null +++ b/tex/context/patterns/common/lang-sq.rme @@ -0,0 +1,4 @@ +% generated by mtxrun --script pattern --convert + + +\message{Albanian Hyphenation Patterns }
\ No newline at end of file diff --git a/tex/context/patterns/mkii/lang-sq.hyp b/tex/context/patterns/mkii/lang-sq.hyp new file mode 100644 index 000000000..55df0504a --- /dev/null +++ b/tex/context/patterns/mkii/lang-sq.hyp @@ -0,0 +1,8 @@ +% generated by mtxrun --script pattern --convert + +% for comment and copyright, see lang-sq.rme + +% used: + +\hyphenation{ +}
\ No newline at end of file diff --git a/tex/context/patterns/mkii/lang-sq.pat b/tex/context/patterns/mkii/lang-sq.pat new file mode 100644 index 000000000..ff07d88b9 --- /dev/null +++ b/tex/context/patterns/mkii/lang-sq.pat @@ -0,0 +1,312 @@ +% generated by mtxrun --script pattern --convert + +% for comment and copyright, see lang-sq.rme + +% used: ' a b c d e f g h i j k l m n o p q r s t u v x y z ç ë + +\patterns{ +2'2 +.a1jo. +a1a +1b +.b2 +2b. +b2l +2bsh +1c +.c2 +2c. +2cj +2cn +2ct +1ç +.ç2 +2ç. +2çs +ç2k +1d +d2h +.d2 +2d. +d2j +2dn +d2r +2drr +2dt +d2shm +2dh. +2dhj2dht +2dhsh +2dhj +2dht +dh2r +dh2j +e1a +e3ll +e1u +ë1a +1f +.f2 +2f. +f2l +f2r +2fs +2ft +3f2sh +2f2t. +1g +.g2 +2g. +g2j +2gj. +2gjv +2gl +2gm +2gr +2gt +1h +.h2 +2h. +2hd +2hj +2hm +2hn +2ht +2hrr +i1a +i1e +i1u +.i2k3i +.i2k3j +1j2 +.j2 +2j. +2j3c2 +2j3d +2j3m +2j3p +2j3r +2j3t +2j3v +2j3s +2jf. +j4tp +2jt. +j3sh2m +1k +.k2 +2k. +k2j +2kl +2km +2kth. +k2r +2kt +2ks +2ksh +1l +.l2 +2l. +2lb +2lç +2lf +2lj +2lm +2ln +l3n2g +2ls +2lt +l2l2 +4ll. +2ll3s +4ll3z +2ll3k +4ll3gj +2ll3n +2ll3t +1m +.m2 +2m. +m2b +mb2j +mb2l +mb2r +m2j +2m3n2d +2mt +2mr +2m3sh2 +2m4sh. +2m1v +1n +.n2 +2n. +.ng2r +2nc +2nd +n2dm +n2dv +n2d3sh +2ng +2nk +2nsp +2nsh +n3sh2m +2nt +2nv +2nx +2nz +n2j +2njt +2nj. +2njv +o1i +1p +.p2 +2p. +p2j +2pn +2pt +p2je. +2ps +p2r +pa2s3her +.pe2r3af +.pë2r3af +1q +.q2 +2q. +2qj +2qk +2qm +2qn +2qt +q2v +1r +.r2 +2r. +2rt +2rb2 +2r2b3r +2rc +2rç +2rd +2rc2rd +2rf +2rg +2rh +.ri3n2d +2rk +2rl +2rm +2rn +r2n3d2 +2rp +2rq +2rs +2r3sh2m +2rdh +r2dht +2r3dr +2rj +2rv +2rz +r2r +.rr2 +2rr. +2rrj +2rrk +2rrm +2rrn +2rrt +2rrs +1s +.s2 +2s. +2sh. +2sb +2sc +2sd +2sf +2sg +2sj +2sk +2sm +2sn +sn2k +2sp +2ssh +2st +st2r +3s2je2ll +sk2ll +s2ve. +s2h +.sh4 +2shm +3sh2mj +2shj +.sh2j +sh2k +2shk. +sh2n +shn4d +sh2p +.sh2q +4sh3k2r +2shq +2sh3nj +2shpr +3sh4pj +3sh4pr +2shr +2shs +2sht +.sh2t +3sh2te. +1t +.t2 +4t. +2tk +t2j +2tm +2tn +2tp +2t3sh2m +t2r +2tv +t2h +.th2 +2th. +2thç +2ths +2thf +2thm +2tht +u1ar. +u1a +u1e +1v +.v2 +2v. +2vr +v2j +1x +x2h +.x2 +2x. +y1 +1z +.zb2r +.z2 +2z. +2zhd +2zm +2zn +2zj +2zs +2zt +2zv +z3sh2m +z2h +.zh2}
\ No newline at end of file diff --git a/tex/context/patterns/mkiv/lang-sq.lua b/tex/context/patterns/mkiv/lang-sq.lua new file mode 100644 index 000000000..ba9977df6 --- /dev/null +++ b/tex/context/patterns/mkiv/lang-sq.lua @@ -0,0 +1,20 @@ +return { + ["comment"]="% generated by mtxrun --script pattern --convert", + ["exceptions"]={ + ["n"]=0, + }, + ["metadata"]={ + ["mnemonic"]="sq", + ["source"]="hyph-sq", + ["texcomment"]="% \n% \\message{Albanian Hyphenation Patterns }", + }, + ["patterns"]={ + ["characters"]="'abcdefghijklmnopqrstuvxyzçë", + ["data"]="2'2 .a1jo. a1a 1b .b2 2b. b2l 2bsh 1c .c2 2c. 2cj 2cn 2ct 1ç .ç2 2ç. 2çs ç2k 1d d2h .d2 2d. d2j 2dn d2r 2drr 2dt d2shm 2dh. 2dhj2dht 2dhsh 2dhj 2dht dh2r dh2j e1a e3ll e1u ë1a 1f .f2 2f. f2l f2r 2fs 2ft 3f2sh 2f2t. 1g .g2 2g. g2j 2gj. 2gjv 2gl 2gm 2gr 2gt 1h .h2 2h. 2hd 2hj 2hm 2hn 2ht 2hrr i1a i1e i1u .i2k3i .i2k3j 1j2 .j2 2j. 2j3c2 2j3d 2j3m 2j3p 2j3r 2j3t 2j3v 2j3s 2jf. j4tp 2jt. j3sh2m 1k .k2 2k. k2j 2kl 2km 2kth. k2r 2kt 2ks 2ksh 1l .l2 2l. 2lb 2lç 2lf 2lj 2lm 2ln l3n2g 2ls 2lt l2l2 4ll. 2ll3s 4ll3z 2ll3k 4ll3gj 2ll3n 2ll3t 1m .m2 2m. m2b mb2j mb2l mb2r m2j 2m3n2d 2mt 2mr 2m3sh2 2m4sh. 2m1v 1n .n2 2n. .ng2r 2nc 2nd n2dm n2dv n2d3sh 2ng 2nk 2nsp 2nsh n3sh2m 2nt 2nv 2nx 2nz n2j 2njt 2nj. 2njv o1i 1p .p2 2p. p2j 2pn 2pt p2je. 2ps p2r pa2s3her .pe2r3af .pë2r3af 1q .q2 2q. 2qj 2qk 2qm 2qn 2qt q2v 1r .r2 2r. 2rt 2rb2 2r2b3r 2rc 2rç 2rd 2rc2rd 2rf 2rg 2rh .ri3n2d 2rk 2rl 2rm 2rn r2n3d2 2rp 2rq 2rs 2r3sh2m 2rdh r2dht 2r3dr 2rj 2rv 2rz r2r .rr2 2rr. 2rrj 2rrk 2rrm 2rrn 2rrt 2rrs 1s .s2 2s. 2sh. 2sb 2sc 2sd 2sf 2sg 2sj 2sk 2sm 2sn sn2k 2sp 2ssh 2st st2r 3s2je2ll sk2ll s2ve. s2h .sh4 2shm 3sh2mj 2shj .sh2j sh2k 2shk. sh2n shn4d sh2p .sh2q 4sh3k2r 2shq 2sh3nj 2shpr 3sh4pj 3sh4pr 2shr 2shs 2sht .sh2t 3sh2te. 1t .t2 4t. 2tk t2j 2tm 2tn 2tp 2t3sh2m t2r 2tv t2h .th2 2th. 2thç 2ths 2thf 2thm 2tht u1ar. u1a u1e 1v .v2 2v. 2vr v2j 1x x2h .x2 2x. y1 1z .zb2r .z2 2z. 2zhd 2zm 2zn 2zj 2zs 2zt 2zv z3sh2m z2h .zh2", + ["lefthyphenmin"]=1, + ["length"]=1428, + ["n"]=305, + ["righthyphenmax"]=1, + }, + ["version"]="1.001", +}
\ No newline at end of file diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 0870487e9..c616a4e68 100644 --- a/tex/generic/context/luatex/luatex-fonts-merged.lua +++ b/tex/generic/context/luatex/luatex-fonts-merged.lua @@ -1,6 +1,6 @@ -- merged file : c:/data/develop/context/sources/luatex-fonts-merged.lua -- parent file : c:/data/develop/context/sources/luatex-fonts.lua --- merge date : 2021-03-21 21:05 +-- merge date : 2021-03-25 13:59 do -- begin closure to overcome local limits and interference |