diff options
19 files changed, 182 insertions, 65 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 189a275b7..1662eeebf 100644 --- a/context/data/scite/context/lexers/data/scite-context-data-metafun.lua +++ b/context/data/scite/context/lexers/data/scite-context-data-metafun.lua @@ -1,4 +1,4 @@ return { - ["commands"]={ "transparency", "sqr", "log", "ln", "exp", "inv", "pow", "pi", "radian", "tand", "cotd", "sin", "cos", "tan", "cot", "atan", "asin", "acos", "invsin", "invcos", "invtan", "acosh", "asinh", "sinh", "cosh", "zmod", "paired", "tripled", "unitcircle", "fulldiamond", "unitdiamond", "fullsquare", "llcircle", "lrcircle", "urcircle", "ulcircle", "tcircle", "bcircle", "lcircle", "rcircle", "lltriangle", "lrtriangle", "urtriangle", "ultriangle", "uptriangle", "downtriangle", "lefttriangle", "righttriangle", "triangle", "smoothed", "cornered", "superellipsed", "randomized", "squeezed", "enlonged", "shortened", "punked", "curved", "unspiked", "simplified", "blownup", "stretched", "enlarged", "leftenlarged", "topenlarged", "rightenlarged", "bottomenlarged", "crossed", "laddered", "randomshifted", "interpolated", "paralleled", "cutends", "peepholed", "llenlarged", "lrenlarged", "urenlarged", "ulenlarged", "llmoved", "lrmoved", "urmoved", "ulmoved", "rightarrow", "leftarrow", "centerarrow", "boundingbox", "innerboundingbox", "outerboundingbox", "pushboundingbox", "popboundingbox", "bottomboundary", "leftboundary", "topboundary", "rightboundary", "xsized", "ysized", "xysized", "sized", "xyscaled", "intersection_point", "intersection_found", "penpoint", "bbwidth", "bbheight", "withshade", "withcircularshade", "withlinearshade", "defineshade", "shaded", "shadedinto", "withshadecolors", "withshadedomain", "withshademethod", "withshadefactor", "withshadevector", "withshadecenter", "cmyk", "spotcolor", "multitonecolor", "namedcolor", "drawfill", "undrawfill", "inverted", "uncolored", "softened", "grayed", "greyed", "onlayer", "along", "graphictext", "loadfigure", "externalfigure", "figure", "register", "outlinetext", "withmask", "bitmapimage", "colordecimals", "ddecimal", "dddecimal", "ddddecimal", "textext", "thetextext", "rawtextext", "textextoffset", "verbatim", "thelabel", "label", "autoalign", "transparent", "withtransparency", "property", "properties", "withproperties", "asgroup", "infont", "space", "crlf", "dquote", "percent", "SPACE", "CRLF", "DQUOTE", "PERCENT", "grayscale", "greyscale", "withgray", "withgrey", "colorpart", "readfile", "clearxy", "unitvector", "center", "epsed", "anchored", "originpath", "infinite", "break", "xstretched", "ystretched", "snapped", "pathconnectors", "function", "constructedfunction", "constructedpath", "constructedpairs", "straightfunction", "straightpath", "straightpairs", "curvedfunction", "curvedpath", "curvedpairs", "evenly", "oddly", "condition", "pushcurrentpicture", "popcurrentpicture", "arrowpath", "tensecircle", "roundedsquare", "colortype", "whitecolor", "blackcolor", "basiccolors", "normalfill", "normaldraw", "visualizepaths", "naturalizepaths", "drawboundary", "drawwholepath", "drawpathonly", "visualizeddraw", "visualizedfill", "draworigin", "drawboundingbox", "drawpath", "drawpoint", "drawpoints", "drawcontrolpoints", "drawcontrollines", "drawpointlabels", "drawlineoptions", "drawpointoptions", "drawcontroloptions", "drawlabeloptions", "draworiginoptions", "drawboundoptions", "drawpathoptions", "resetdrawoptions", "undashed", "decorated", "redecorated", "undecorated", "passvariable", "passarrayvariable", "tostring", "format", "formatted", "startpassingvariable", "stoppassingvariable", "eofill", "eoclip", "nofill", "area" }, + ["commands"]={ "transparency", "sqr", "log", "ln", "exp", "inv", "pow", "pi", "radian", "tand", "cotd", "sin", "cos", "tan", "cot", "atan", "asin", "acos", "invsin", "invcos", "invtan", "acosh", "asinh", "sinh", "cosh", "zmod", "paired", "tripled", "unitcircle", "fulldiamond", "unitdiamond", "fullsquare", "llcircle", "lrcircle", "urcircle", "ulcircle", "tcircle", "bcircle", "lcircle", "rcircle", "lltriangle", "lrtriangle", "urtriangle", "ultriangle", "uptriangle", "downtriangle", "lefttriangle", "righttriangle", "triangle", "smoothed", "cornered", "superellipsed", "randomized", "squeezed", "enlonged", "shortened", "punked", "curved", "unspiked", "simplified", "blownup", "stretched", "enlarged", "leftenlarged", "topenlarged", "rightenlarged", "bottomenlarged", "crossed", "laddered", "randomshifted", "interpolated", "paralleled", "cutends", "peepholed", "llenlarged", "lrenlarged", "urenlarged", "ulenlarged", "llmoved", "lrmoved", "urmoved", "ulmoved", "rightarrow", "leftarrow", "centerarrow", "boundingbox", "innerboundingbox", "outerboundingbox", "pushboundingbox", "popboundingbox", "bottomboundary", "leftboundary", "topboundary", "rightboundary", "xsized", "ysized", "xysized", "sized", "xyscaled", "intersection_point", "intersection_found", "penpoint", "bbwidth", "bbheight", "withshade", "withcircularshade", "withlinearshade", "defineshade", "shaded", "shadedinto", "withshadecolors", "withshadedomain", "withshademethod", "withshadefactor", "withshadevector", "withshadecenter", "withshadestep", "withshadefraction", "cmyk", "spotcolor", "multitonecolor", "namedcolor", "drawfill", "undrawfill", "inverted", "uncolored", "softened", "grayed", "greyed", "onlayer", "along", "graphictext", "loadfigure", "externalfigure", "figure", "register", "outlinetext", "withmask", "bitmapimage", "colordecimals", "ddecimal", "dddecimal", "ddddecimal", "textext", "thetextext", "rawtextext", "textextoffset", "verbatim", "thelabel", "label", "autoalign", "transparent", "withtransparency", "property", "properties", "withproperties", "asgroup", "infont", "space", "crlf", "dquote", "percent", "SPACE", "CRLF", "DQUOTE", "PERCENT", "grayscale", "greyscale", "withgray", "withgrey", "colorpart", "readfile", "clearxy", "unitvector", "center", "epsed", "anchored", "originpath", "infinite", "break", "xstretched", "ystretched", "snapped", "pathconnectors", "function", "constructedfunction", "constructedpath", "constructedpairs", "straightfunction", "straightpath", "straightpairs", "curvedfunction", "curvedpath", "curvedpairs", "evenly", "oddly", "condition", "pushcurrentpicture", "popcurrentpicture", "arrowpath", "tensecircle", "roundedsquare", "colortype", "whitecolor", "blackcolor", "basiccolors", "normalfill", "normaldraw", "visualizepaths", "naturalizepaths", "drawboundary", "drawwholepath", "drawpathonly", "visualizeddraw", "visualizedfill", "draworigin", "drawboundingbox", "drawpath", "drawpoint", "drawpoints", "drawcontrolpoints", "drawcontrollines", "drawpointlabels", "drawlineoptions", "drawpointoptions", "drawcontroloptions", "drawlabeloptions", "draworiginoptions", "drawboundoptions", "drawpathoptions", "resetdrawoptions", "undashed", "decorated", "redecorated", "undecorated", "passvariable", "passarrayvariable", "tostring", "format", "formatted", "startpassingvariable", "stoppassingvariable", "eofill", "eoclip", "nofill", "area" }, ["internals"]={ "nocolormodel", "greycolormodel", "graycolormodel", "rgbcolormodel", "cmykcolormodel", "shadefactor", "textextoffset", "normaltransparent", "multiplytransparent", "screentransparent", "overlaytransparent", "softlighttransparent", "hardlighttransparent", "colordodgetransparent", "colorburntransparent", "darkentransparent", "lightentransparent", "differencetransparent", "exclusiontransparent", "huetransparent", "saturationtransparent", "colortransparent", "luminositytransparent", "metapostversion", "maxdimensions" }, }
\ No newline at end of file diff --git a/context/data/scite/context/lexers/scite-context-lexer-mps.lua b/context/data/scite/context/lexers/scite-context-lexer-mps.lua index 8f89ae9ef..fa335eb3f 100644 --- a/context/data/scite/context/lexers/scite-context-lexer-mps.lua +++ b/context/data/scite/context/lexers/scite-context-lexer-mps.lua @@ -122,7 +122,7 @@ local stopluacode = #stoplua * token("embedded", stoplua) lexer.embed_lexer(metafunlexer, cldlexer, startluacode, stopluacode) -local luacall = token("embedded",P("lua") * ( P(".") * R("az","AZ")^1 )^1) +local luacall = token("embedded",P("lua") * ( P(".") * R("az","AZ","__")^1 )^1) metafunlexer._rules = { { "whitespace", spacing }, diff --git a/context/data/scite/context/scite-context-data-metafun.properties b/context/data/scite/context/scite-context-data-metafun.properties index 1616bad9c..11d237013 100644 --- a/context/data/scite/context/scite-context-data-metafun.properties +++ b/context/data/scite/context/scite-context-data-metafun.properties @@ -22,32 +22,33 @@ xsized ysized xysized sized xyscaled \ intersection_point intersection_found penpoint bbwidth bbheight \ withshade withcircularshade withlinearshade defineshade shaded \ shadedinto withshadecolors withshadedomain withshademethod withshadefactor \ -withshadevector withshadecenter cmyk spotcolor multitonecolor \ -namedcolor drawfill undrawfill inverted uncolored \ -softened grayed greyed onlayer along \ -graphictext loadfigure externalfigure figure register \ -outlinetext withmask bitmapimage colordecimals ddecimal \ -dddecimal ddddecimal textext thetextext rawtextext \ -textextoffset verbatim thelabel label autoalign \ -transparent withtransparency property properties withproperties \ -asgroup infont space crlf dquote \ -percent SPACE CRLF DQUOTE PERCENT \ -grayscale greyscale withgray withgrey colorpart \ -readfile clearxy unitvector center epsed \ -anchored originpath infinite break xstretched \ -ystretched snapped pathconnectors function constructedfunction \ -constructedpath constructedpairs straightfunction straightpath straightpairs \ -curvedfunction curvedpath curvedpairs evenly oddly \ -condition pushcurrentpicture popcurrentpicture arrowpath tensecircle \ -roundedsquare colortype whitecolor blackcolor basiccolors \ -normalfill normaldraw visualizepaths naturalizepaths drawboundary \ -drawwholepath drawpathonly visualizeddraw visualizedfill draworigin \ -drawboundingbox drawpath drawpoint drawpoints drawcontrolpoints \ -drawcontrollines drawpointlabels drawlineoptions drawpointoptions drawcontroloptions \ -drawlabeloptions draworiginoptions drawboundoptions drawpathoptions resetdrawoptions \ -undashed decorated redecorated undecorated passvariable \ -passarrayvariable tostring format formatted startpassingvariable \ -stoppassingvariable eofill eoclip nofill area +withshadevector withshadecenter withshadestep withshadefraction cmyk \ +spotcolor multitonecolor namedcolor drawfill undrawfill \ +inverted uncolored softened grayed greyed \ +onlayer along graphictext loadfigure externalfigure \ +figure register outlinetext withmask bitmapimage \ +colordecimals ddecimal dddecimal ddddecimal textext \ +thetextext rawtextext textextoffset verbatim thelabel \ +label autoalign transparent withtransparency property \ +properties withproperties asgroup infont space \ +crlf dquote percent SPACE CRLF \ +DQUOTE PERCENT grayscale greyscale withgray \ +withgrey colorpart readfile clearxy unitvector \ +center epsed anchored originpath infinite \ +break xstretched ystretched snapped pathconnectors \ +function constructedfunction constructedpath constructedpairs straightfunction \ +straightpath straightpairs curvedfunction curvedpath curvedpairs \ +evenly oddly condition pushcurrentpicture popcurrentpicture \ +arrowpath tensecircle roundedsquare colortype whitecolor \ +blackcolor basiccolors normalfill normaldraw visualizepaths \ +naturalizepaths drawboundary drawwholepath drawpathonly visualizeddraw \ +visualizedfill draworigin drawboundingbox drawpath drawpoint \ +drawpoints drawcontrolpoints drawcontrollines drawpointlabels drawlineoptions \ +drawpointoptions drawcontroloptions drawlabeloptions draworiginoptions drawboundoptions \ +drawpathoptions resetdrawoptions undashed decorated redecorated \ +undecorated passvariable passarrayvariable tostring format \ +formatted startpassingvariable stoppassingvariable eofill eoclip \ +nofill area keywordclass.metafun.internals=\ nocolormodel greycolormodel graycolormodel rgbcolormodel \ diff --git a/metapost/context/base/mp-mlib.mpiv b/metapost/context/base/mp-mlib.mpiv index 94377e52d..decdda15b 100644 --- a/metapost/context/base/mp-mlib.mpiv +++ b/metapost/context/base/mp-mlib.mpiv @@ -476,10 +476,24 @@ boolean trace_shades ; trace_shades := false ; % still there % withshadecolors (red,green) % ; -path mfun_shade_path ; +path mfun_shade_path ; +numeric mfun_shade_step ; mfun_shade_step := 0 ; + +def withshadestep = + hide(mfun_shade_step := mfun_shade_step + 1 ;) + mfun_withshadestep +enddef ; + +def mfun_withshadestep (text t) = + withprescript "sh_step=" & decimal mfun_shade_step + t +enddef ; primarydef p withshademethod m = - hide(mfun_shade_path := p ;) + hide( + mfun_shade_path := p ; + mfun_shade_step := 1 ; + ) p withprescript "sh_domain=0 1" withprescript "sh_color=into" @@ -527,10 +541,28 @@ def withshadefactor expr f = withprescript "sh_factor=" & decimal f enddef ; +% def withshadebound (expr a) = +% if mfun_shade_step > 0 : +% withprescript "sh_bound_" & decimal mfun_shade_step & "=" & decimal a +% fi +% enddef ; + +def withshadefraction expr a = + if mfun_shade_step > 0 : + withprescript "sh_fraction_" & decimal mfun_shade_step & "=" & decimal a + fi +enddef ; + def withshadecolors (expr a, b) = - withprescript "sh_color=into" - withprescript "sh_color_a=" & colordecimals a - withprescript "sh_color_b=" & colordecimals b + if mfun_shade_step > 0 : + withprescript "sh_color=into" + withprescript "sh_color_a_" & decimal mfun_shade_step & "=" & colordecimals a + withprescript "sh_color_b_" & decimal mfun_shade_step & "=" & colordecimals b + else : + withprescript "sh_color=into" + withprescript "sh_color_a=" & colordecimals a + withprescript "sh_color_b=" & colordecimals b + fi enddef ; primarydef a shadedinto b = % withcolor red shadedinto green diff --git a/scripts/context/lua/mtx-fonts.lua b/scripts/context/lua/mtx-fonts.lua index 808f20358..7f2a6a87f 100644 --- a/scripts/context/lua/mtx-fonts.lua +++ b/scripts/context/lua/mtx-fonts.lua @@ -10,6 +10,8 @@ local getargument = environment.getargument local setargument = environment.setargument local givenfiles = environment.files +local otfversion = 2.815 + local helpinfo = [[ <?xml version="1.0"?> <application> @@ -401,7 +403,7 @@ end function scripts.fonts.unpack() local name = file.removesuffix(file.basename(givenfiles[1] or "")) if name and name ~= "" then - local cache = containers.define("fonts", "otf", 2.742, true) + local cache = containers.define("fonts", "otf", otfversion, true) local cleanname = containers.cleanname(name) local data = containers.read(cache,cleanname) if data then diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv index 399111c91..7e18ea207 100644 --- a/tex/context/base/cont-new.mkiv +++ b/tex/context/base/cont-new.mkiv @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2015.06.13 09:52} +\newcontextversion{2015.06.15 13:42} %D This file is loaded at runtime, thereby providing an excellent place for %D hacks, patches, extensions and new features. diff --git a/tex/context/base/context-version.pdf b/tex/context/base/context-version.pdf Binary files differindex 50515ecec..153a6475b 100644 --- a/tex/context/base/context-version.pdf +++ b/tex/context/base/context-version.pdf diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv index 462bbb538..6c8fc4559 100644 --- a/tex/context/base/context.mkiv +++ b/tex/context/base/context.mkiv @@ -39,7 +39,7 @@ %D up and the dependencies are more consistent. \edef\contextformat {\jobname} -\edef\contextversion{2015.06.13 09:52} +\edef\contextversion{2015.06.15 13:42} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/font-cff.lua b/tex/context/base/font-cff.lua index 271de834f..1de2b1117 100644 --- a/tex/context/base/font-cff.lua +++ b/tex/context/base/font-cff.lua @@ -1249,14 +1249,14 @@ do local glyph = glyphs[index] -- can be autodefined in otr if not glyph then glyphs[index] = { - segments = doshapes ~= false and result, -- optional + segments = doshapes ~= false and result or nil, -- optional boundingbox = boundingbox, width = width, name = charset[index], -- sidebearing = 0, } else - glyph.segments = doshapes ~= false and result + glyph.segments = doshapes ~= false and result or nil glyph.boundingbox = boundingbox if not glyph.width then glyph.width = width diff --git a/tex/context/base/font-otf.lua b/tex/context/base/font-otf.lua index 03463fdaa..bc401e490 100644 --- a/tex/context/base/font-otf.lua +++ b/tex/context/base/font-otf.lua @@ -60,7 +60,7 @@ local otf = fonts.handlers.otf otf.glists = { "gsub", "gpos" } -otf.version = 2.815 -- beware: also sync font-mis.lua +otf.version = 2.815 -- beware: also sync font-mis.lua and in mtx-fonts otf.cache = containers.define("fonts", "otf", otf.version, true) local hashes = fonts.hashes @@ -2060,7 +2060,9 @@ end -- we can share { } as it is never set ---- ligatures have an extra specification.char entry that we don't use +-- ligatures have an extra specification.char entry that we don't use + +-- mlookups probably only with pairs actions["reorganize glyph lookups"] = function(data,filename,raw) local resources = data.resources @@ -2141,6 +2143,7 @@ actions["reorganize glyph lookups"] = function(data,filename,raw) if mlookups then description.mlookups = mlookups end + -- description.lookups = nil end end diff --git a/tex/context/base/font-otn.lua b/tex/context/base/font-otn.lua index ffe5618b3..7736994de 100644 --- a/tex/context/base/font-otn.lua +++ b/tex/context/base/font-otn.lua @@ -3374,6 +3374,8 @@ local function featuresprocessor(head,font,attr) return head, done end +-- this might move to the loader + local function generic(lookupdata,lookupname,unicode,lookuphash) local target = lookuphash[lookupname] if target then @@ -3510,6 +3512,8 @@ local function prepare_lookups(tfmdata) end +-- so far + local function split(replacement,original) local result = { } for i=1,#replacement do diff --git a/tex/context/base/font-otr.lua b/tex/context/base/font-otr.lua index a83766f85..3ff260d44 100644 --- a/tex/context/base/font-otr.lua +++ b/tex/context/base/font-otr.lua @@ -1544,6 +1544,13 @@ local function readdata(f,offset,specification) readers["gpos"](f,fontdata,specification) readers["math"](f,fontdata,specification) -- + if readers.filterkerns then + readers.filterkerns(fontdata) + end + if readers.splitlookups then + readers.splitlookups(fontdata) + end + -- fontdata.locations = nil fontdata.tables = nil fontdata.cidmaps = nil diff --git a/tex/context/base/lpdf-grp.lua b/tex/context/base/lpdf-grp.lua index 36c3507be..95f093424 100644 --- a/tex/context/base/lpdf-grp.lua +++ b/tex/context/base/lpdf-grp.lua @@ -6,6 +6,7 @@ if not modules then modules = { } end modules ['lpdf-grp'] = { license = "see context related readme files" } +local type = type local formatters, gsub = string.formatters, string.gsub local concat = table.concat local round = math.round @@ -35,7 +36,11 @@ local pdfflushobject = lpdf.flushobject -- 22 : << /Bounds [ ] /Domain [ 0.0 1.0 ] /Encode [ 0.0 1.0 ] /FunctionType 3 /Functions [ 31 0 R ] >> -- 31 : << /C0 [ 1.0 0.0 ] /C1 [ 0.0 1.0 ] /Domain [ 0.0 1.0 ] /FunctionType 2 /N 1.0 >> -local function shade(stype,name,domain,color_a,color_b,n,colorspace,coordinates,separation) +local function shade(stype,name,domain,color_a,color_b,n,colorspace,coordinates,separation,steps) + if steps then + color_a = color_a[1] + color_b = color_b[1] + end local f = pdfdictionary { FunctionType = 2, Domain = pdfarray(domain), -- domain is actually a string @@ -55,12 +60,58 @@ local function shade(stype,name,domain,color_a,color_b,n,colorspace,coordinates, lpdf.adddocumentshade(name,pdfreference(pdfflushobject(s))) end -function lpdf.circularshade(name,domain,color_a,color_b,n,colorspace,coordinates,separation) - shade(3,name,domain,color_a,color_b,n,colorspace,coordinates,separation) +local function shade(stype,name,domain,color_a,color_b,n,colorspace,coordinates,separation,steps,fractions) + local func = nil + if steps then + local list = pdfarray() + local bounds = pdfarray() + local encode = pdfarray() + for i=1,steps do + bounds[i] = fractions[i] or 1 + encode[2*i-1] = 0 + encode[2*i] = 1 + list [i] = pdfdictionary { + FunctionType = 2, + Domain = pdfarray(domain), -- domain is actually a string + C0 = pdfarray(color_a[i]), + C1 = pdfarray(color_b[i]), + N = tonumber(n), + } + end + func = pdfdictionary { + FunctionType = 3, + Bounds = bounds, + Encode = encode, + Functions = list, + Domain = pdfarray(domain), -- domain is actually a string + } + else + func = pdfdictionary { + FunctionType = 2, + Domain = pdfarray(domain), -- domain is actually a string + C0 = pdfarray(color_a), + C1 = pdfarray(color_b), + N = tonumber(n), + } + end + separation = separation and registrations.getspotcolorreference(separation) + local s = pdfdictionary { + ShadingType = stype, + ColorSpace = separation and pdfreference(separation) or pdfconstant(colorspace), + Function = pdfreference(pdfflushobject(func)), + Coords = pdfarray(coordinates), + Extend = pdfarray { true, true }, + AntiAlias = pdfboolean(true), + } + lpdf.adddocumentshade(name,pdfreference(pdfflushobject(s))) +end + +function lpdf.circularshade(name,domain,color_a,color_b,n,colorspace,coordinates,separation,steps,fractions) + shade(3,name,domain,color_a,color_b,n,colorspace,coordinates,separation,steps,fractions) end -function lpdf.linearshade(name,domain,color_a,color_b,n,colorspace,coordinates,separation) - shade(2,name,domain,color_a,color_b,n,colorspace,coordinates,separation) +function lpdf.linearshade(name,domain,color_a,color_b,n,colorspace,coordinates,separation,steps,fractions) + shade(2,name,domain,color_a,color_b,n,colorspace,coordinates,separation,steps,fractions) end -- inline bitmaps but xform'd diff --git a/tex/context/base/mlib-pps.lua b/tex/context/base/mlib-pps.lua index a3a3bd9f6..0b31bd6bf 100644 --- a/tex/context/base/mlib-pps.lua +++ b/tex/context/base/mlib-pps.lua @@ -170,7 +170,7 @@ local function checkandconvertspot(n_a,f_a,c_a,v_a,n_b,f_b,c_b,v_b) end end -local function checkandconvert(ca,cb) +local function checkandconvert(ca,cb,model) local name = f_shade(nofshades) if not ca or not cb or type(ca) == "string" then return { 0 }, { 1 }, "DeviceGray", name @@ -180,7 +180,9 @@ local function checkandconvert(ca,cb) elseif #ca < #cb then normalize(cb,ca) end - local model = colors.model + if not model then + model = colors.model + end if model == "all" then model= (#ca == 4 and "cmyk") or (#ca == 3 and "rgb") or "gray" end @@ -193,7 +195,7 @@ local function checkandconvert(ca,cb) ca = { a, a, a } cb = { b, b, b } end - return ca, cb, "DeviceRGB", name + return ca, cb, "DeviceRGB", name, model elseif model == "cmyk" then if #ca == 3 then ca = { rgbtocmyk(ca[1],ca[2],ca[3]) } @@ -202,7 +204,7 @@ local function checkandconvert(ca,cb) ca = { 0, 0, 0, ca[1] } cb = { 0, 0, 0, ca[1] } end - return ca, cb, "DeviceCMYK", name + return ca, cb, "DeviceCMYK", name, model else if #ca == 4 then ca = { cmyktogray(ca[1],ca[2],ca[3],ca[4]) } @@ -212,7 +214,7 @@ local function checkandconvert(ca,cb) cb = { rgbtogray(cb[1],cb[2],cb[3]) } end -- backend specific (will be renamed) - return ca, cb, "DeviceGray", name + return ca, cb, "DeviceGray", name, model end end end @@ -1107,13 +1109,13 @@ local function sh_process(object,prescript,before,after) local sh_type = prescript.sh_type if sh_type then nofshades = nofshades + 1 - local domain = lpegmatch(domainsplitter,prescript.sh_domain or "0 1") - local centera = lpegmatch(centersplitter,prescript.sh_center_a or "0 0") - local centerb = lpegmatch(centersplitter,prescript.sh_center_b or "0 0") - -- - local sh_color_a = prescript.sh_color_a or "1" - local sh_color_b = prescript.sh_color_b or "1" - local ca, cb, colorspace, name, separation + local domain = lpegmatch(domainsplitter,prescript.sh_domain or "0 1") + local centera = lpegmatch(centersplitter,prescript.sh_center_a or "0 0") + local centerb = lpegmatch(centersplitter,prescript.sh_center_b or "0 0") + local steps = tonumber(prescript.sh_step) or 1 + local sh_color_a = prescript.sh_color_a_1 or prescript.sh_color_a or "1" + local sh_color_b = prescript.sh_color_b_1 or prescript.sh_color_b or "1" -- sh_color_b_<sh_steps> + local ca, cb, colorspace, name, model, separation, fractions if prescript.sh_color == "into" and prescript.sp_name then -- some spotcolor local value_a, components_a, fractions_a, name_a @@ -1149,27 +1151,41 @@ local function sh_process(object,prescript,before,after) else local colora = lpegmatch(colorsplitter,sh_color_a) local colorb = lpegmatch(colorsplitter,sh_color_b) - ca, cb, colorspace, name = checkandconvert(colora,colorb) + ca, cb, colorspace, name, model = checkandconvert(colora,colorb) + -- test: + if steps > 1 then + ca = { ca } + cb = { cb } + fractions = { tonumber(prescript[formatters["sh_fraction_%i"](1)]) or 0 } + for i=2,steps do + local colora = lpegmatch(colorsplitter,prescript[formatters["sh_color_a_%i"](i)]) + local colorb = lpegmatch(colorsplitter,prescript[formatters["sh_color_b_%i"](i)]) + ca[i], cb[i] = checkandconvert(colora,colorb,model) + fractions[i] = tonumber(prescript[formatters["sh_fraction_%i"](i)]) or (i/steps) + end + end end if not ca or not cb then ca, cb, colorspace, name = checkandconvert() + steps = 1 end if sh_type == "linear" then local coordinates = { centera[1], centera[2], centerb[1], centerb[2] } - lpdf.linearshade(name,domain,ca,cb,1,colorspace,coordinates,separation) -- backend specific (will be renamed) + lpdf.linearshade(name,domain,ca,cb,1,colorspace,coordinates,separation,steps>1 and steps,fractions) -- backend specific (will be renamed) elseif sh_type == "circular" then local factor = tonumber(prescript.sh_factor) or 1 local radiusa = factor * tonumber(prescript.sh_radius_a) local radiusb = factor * tonumber(prescript.sh_radius_b) local coordinates = { centera[1], centera[2], radiusa, centerb[1], centerb[2], radiusb } - lpdf.circularshade(name,domain,ca,cb,1,colorspace,coordinates,separation) -- backend specific (will be renamed) + lpdf.circularshade(name,domain,ca,cb,1,colorspace,coordinates,separation,steps>1 and steps,fractions) -- backend specific (will be renamed) else -- fatal error end - before[#before+1], after[#after+1] = "q /Pattern cs", formatters["W n /%s sh Q"](name) + before[#before+1] = "q /Pattern cs" + after [#after+1] = formatters["W n /%s sh Q"](name) -- false, not nil, else mt triggered object.colored = false -- hm, not object.color ? - object.type = false + object.type = false object.grouped = true end end diff --git a/tex/context/base/mult-fun.lua b/tex/context/base/mult-fun.lua index 9af3f05ec..1b750d73c 100644 --- a/tex/context/base/mult-fun.lua +++ b/tex/context/base/mult-fun.lua @@ -44,6 +44,7 @@ return { "defineshade", "shaded", -- "withshading", "withlinearshading", "withcircularshading", "withfromshadecolor", "withtoshadecolor", "shadedinto", "withshadecolors", "withshadedomain", "withshademethod", "withshadefactor", "withshadevector", "withshadecenter", + "withshadestep", "withshadefraction", "cmyk", "spotcolor", "multitonecolor", "namedcolor", "drawfill", "undrawfill", "inverted", "uncolored", "softened", "grayed", "greyed", diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf Binary files differindex 0f9551bc7..284cbe4ee 100644 --- a/tex/context/base/status-files.pdf +++ b/tex/context/base/status-files.pdf diff --git a/tex/context/base/status-lua.pdf b/tex/context/base/status-lua.pdf Binary files differindex f405b93ea..b6f735205 100644 --- a/tex/context/base/status-lua.pdf +++ b/tex/context/base/status-lua.pdf diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 2d39df62b..edbce4b8f 100644 --- a/tex/generic/context/luatex/luatex-fonts-merged.lua +++ b/tex/generic/context/luatex/luatex-fonts-merged.lua @@ -1,6 +1,6 @@ -- merged file : luatex-fonts-merged.lua -- parent file : luatex-fonts.lua --- merge date : 06/13/15 09:52:29 +-- merge date : 06/15/15 13:42:51 do -- begin closure to overcome local limits and interference @@ -12343,7 +12343,7 @@ function chainprocs.gsub_ligature(head,start,stop,kind,chainname,currentcontext, local s=getnext(start) local discfound=false local last=stop - local nofreplacements=0 + local nofreplacements=1 local skipmark=currentlookup.flags[1] while s do local id=getid(s) diff --git a/tex/generic/context/luatex/luatex-fonts-otn.lua b/tex/generic/context/luatex/luatex-fonts-otn.lua index d2ad07689..0bf231fff 100644 --- a/tex/generic/context/luatex/luatex-fonts-otn.lua +++ b/tex/generic/context/luatex/luatex-fonts-otn.lua @@ -1276,7 +1276,7 @@ function chainprocs.gsub_ligature(head,start,stop,kind,chainname,currentcontext, local s = getnext(start) local discfound = false local last = stop - local nofreplacements = 0 + local nofreplacements = 1 local skipmark = currentlookup.flags[1] while s do local id = getid(s) |