diff options
author | Context Git Mirror Bot <phg42.2a@gmail.com> | 2015-06-15 14:15:04 +0200 |
---|---|---|
committer | Context Git Mirror Bot <phg42.2a@gmail.com> | 2015-06-15 14:15:04 +0200 |
commit | ce4c6e98782de9bab14ed3963c403edbac974879 (patch) | |
tree | 3023797c740501bc60ad7a37533c34fd4491cb67 /tex | |
parent | bafe29de59fdc2a37922e198aebc9b04f518f152 (diff) | |
download | context-ce4c6e98782de9bab14ed3963c403edbac974879.tar.gz |
2015-06-15 13:45:00
Diffstat (limited to 'tex')
-rw-r--r-- | tex/context/base/cont-new.mkiv | 2 | ||||
-rw-r--r-- | tex/context/base/context-version.pdf | bin | 4202 -> 4203 bytes | |||
-rw-r--r-- | tex/context/base/context.mkiv | 2 | ||||
-rw-r--r-- | tex/context/base/font-cff.lua | 4 | ||||
-rw-r--r-- | tex/context/base/font-otf.lua | 7 | ||||
-rw-r--r-- | tex/context/base/font-otn.lua | 4 | ||||
-rw-r--r-- | tex/context/base/font-otr.lua | 7 | ||||
-rw-r--r-- | tex/context/base/lpdf-grp.lua | 61 | ||||
-rw-r--r-- | tex/context/base/mlib-pps.lua | 50 | ||||
-rw-r--r-- | tex/context/base/mult-fun.lua | 1 | ||||
-rw-r--r-- | tex/context/base/status-files.pdf | bin | 24425 -> 24442 bytes | |||
-rw-r--r-- | tex/context/base/status-lua.pdf | bin | 252045 -> 252050 bytes | |||
-rw-r--r-- | tex/generic/context/luatex/luatex-fonts-merged.lua | 4 | ||||
-rw-r--r-- | tex/generic/context/luatex/luatex-fonts-otn.lua | 2 |
14 files changed, 113 insertions, 31 deletions
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) |