diff options
Diffstat (limited to 'tex/context/base/mkiv')
-rw-r--r-- | tex/context/base/mkiv/cont-new.mkiv | 2 | ||||
-rw-r--r-- | tex/context/base/mkiv/context.mkiv | 2 | ||||
-rw-r--r-- | tex/context/base/mkiv/font-dsp.lua | 40 | ||||
-rw-r--r-- | tex/context/base/mkiv/font-mis.lua | 2 | ||||
-rw-r--r-- | tex/context/base/mkiv/font-ocl.lua | 113 | ||||
-rw-r--r-- | tex/context/base/mkiv/font-otf.lua | 4 | ||||
-rw-r--r-- | tex/context/base/mkiv/font-otl.lua | 5 | ||||
-rw-r--r-- | tex/context/base/mkiv/status-files.pdf | bin | 9200 -> 9090 bytes | |||
-rw-r--r-- | tex/context/base/mkiv/status-lua.pdf | bin | 269053 -> 269068 bytes |
9 files changed, 96 insertions, 72 deletions
diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv index 0e2566f1b..94efa3473 100644 --- a/tex/context/base/mkiv/cont-new.mkiv +++ b/tex/context/base/mkiv/cont-new.mkiv @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2016.06.15 20:18} +\newcontextversion{2016.06.16 11:48} %D This file is loaded at runtime, thereby providing an excellent place for %D hacks, patches, extensions and new features. diff --git a/tex/context/base/mkiv/context.mkiv b/tex/context/base/mkiv/context.mkiv index febdef216..8bf91ef04 100644 --- a/tex/context/base/mkiv/context.mkiv +++ b/tex/context/base/mkiv/context.mkiv @@ -39,7 +39,7 @@ %D up and the dependencies are more consistent. \edef\contextformat {\jobname} -\edef\contextversion{2016.06.15 20:18} +\edef\contextversion{2016.06.16 11:48} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/mkiv/font-dsp.lua b/tex/context/base/mkiv/font-dsp.lua index 1e8b3bd0c..36511743a 100644 --- a/tex/context/base/mkiv/font-dsp.lua +++ b/tex/context/base/mkiv/font-dsp.lua @@ -365,7 +365,9 @@ end -- We generalize the chained lookups so that we can do with only one handler -- when processing them. -local function readlookuparray(f,noflookups) +-- pruned + +local function readlookuparray(f,noflookups,nofcurrent) local lookups = { } if noflookups > 0 then local length = 0 @@ -381,10 +383,34 @@ local function readlookuparray(f,noflookups) lookups[index] = false end end + -- if length > nofcurrent then + -- report_issue("more lookups than currently matched characters") + -- end end return lookups end +-- not pruned +-- +-- local function readlookuparray(f,noflookups,nofcurrent) +-- local lookups = { } +-- for i=1,nofcurrent do +-- lookups[i] = false +-- end +-- for i=1,noflookups do +-- local index = readushort(f) + 1 +-- if index > nofcurrent then +-- report_issue("more lookups than currently matched characters") +-- for i=nofcurrent+1,index-1 do +-- lookups[i] = false +-- end +-- nofcurrent = index +-- end +-- lookups[index] = readushort(f) + 1 +-- end +-- return lookups +-- end + local function unchainedcontext(f,fontdata,lookupid,lookupoffset,offset,glyphs,nofglyphs,what) local tableoffset = lookupoffset + offset setposition(f,tableoffset) @@ -409,7 +435,7 @@ local function unchainedcontext(f,fontdata,lookupid,lookupoffset,offset,glyphs,n for i=2,nofcurrent do current[i] = { readushort(f) } end - local lookups = readlookuparray(f,noflookups) + local lookups = readlookuparray(f,noflookups,nofcurrent) rules[#rules+1] = { current = current, lookups = lookups @@ -452,7 +478,7 @@ local function unchainedcontext(f,fontdata,lookupid,lookupoffset,offset,glyphs,n for i=2,nofcurrent do current[i] = currentclasses[readushort(f) + 1] end - local lookups = readlookuparray(f,noflookups) + local lookups = readlookuparray(f,noflookups,nofcurrent) rules[#rules+1] = { current = current, lookups = lookups @@ -476,7 +502,7 @@ local function unchainedcontext(f,fontdata,lookupid,lookupoffset,offset,glyphs,n elseif subtype == 3 then local current = readarray(f) local noflookups = readushort(f) - local lookups = readlookuparray(f,noflookups) + local lookups = readlookuparray(f,noflookups,#current) current = readcoveragearray(f,tableoffset,current,true) return { format = "coverage", @@ -536,7 +562,7 @@ local function chainedcontext(f,fontdata,lookupid,lookupoffset,offset,glyphs,nof end end local noflookups = readushort(f) - local lookups = readlookuparray(f,noflookups) + local lookups = readlookuparray(f,noflookups,nofcurrent) rules[#rules+1] = { before = before, current = current, @@ -604,7 +630,7 @@ local function chainedcontext(f,fontdata,lookupid,lookupoffset,offset,glyphs,nof end -- no sequence index here (so why in context as it saves nothing) local noflookups = readushort(f) - local lookups = readlookuparray(f,noflookups) + local lookups = readlookuparray(f,noflookups,nofcurrent) rules[#rules+1] = { before = before, current = current, @@ -632,7 +658,7 @@ local function chainedcontext(f,fontdata,lookupid,lookupoffset,offset,glyphs,nof local current = readarray(f) local after = readarray(f) local noflookups = readushort(f) - local lookups = readlookuparray(f,noflookups) + local lookups = readlookuparray(f,noflookups,#current) before = readcoveragearray(f,tableoffset,before,true) current = readcoveragearray(f,tableoffset,current,true) after = readcoveragearray(f,tableoffset,after,true) diff --git a/tex/context/base/mkiv/font-mis.lua b/tex/context/base/mkiv/font-mis.lua index 9426c3148..7278f283f 100644 --- a/tex/context/base/mkiv/font-mis.lua +++ b/tex/context/base/mkiv/font-mis.lua @@ -21,7 +21,7 @@ local readers = otf.readers if readers then - otf.version = otf.version or 3.023 + otf.version = otf.version or 3.024 otf.cache = otf.cache or containers.define("fonts", "otl", otf.version, true) function fonts.helpers.getfeatures(name,save) diff --git a/tex/context/base/mkiv/font-ocl.lua b/tex/context/base/mkiv/font-ocl.lua index b2aba7ac7..ed1be9535 100644 --- a/tex/context/base/mkiv/font-ocl.lua +++ b/tex/context/base/mkiv/font-ocl.lua @@ -8,7 +8,7 @@ if not modules then modules = { } end modules ['font-ocl'] = { -- todo : user list of colors -local tostring, next = tostring, next +local tostring, next, format = tostring, next, string.format local formatters = string.formatters @@ -166,34 +166,56 @@ do end -if context and xml.convert then + +do local report_svg = logs.reporter("fonts","svg conversion") - local xmlconvert = xml.convert - local xmlfirst = xml.first local loaddata = io.loaddata local savedata = io.savedata local remove = os.remove + if context and xml.convert then + + local xmlconvert = xml.convert + local xmlfirst = xml.first + + function otfsvg.filterglyph(entry,index) + local svg = xmlconvert(entry.data) + local root = svg and xmlfirst(svg,"/svg[@id='glyph"..index.."']") + local data = root and tostring(root) + -- report_svg("data for glyph %04X: %s",index,data) + return data + end + + else + + function otfsvg.filterglyph(entry,index) -- can be overloaded + return entry.data + end + + end + -- function otfsvg.topdf(svgshapes) - -- local svgfile = "temp-otf-svg-shape.svg" - -- local pdffile = "temp-otf-svg-shape.pdf" - -- local command = "inkscape " .. svgfile .. " --export-pdf=" .. pdffile - -- local testrun = false - -- local pdfshapes = { } - -- local nofshapes = #svgshapes + -- local svgfile = "temp-otf-svg-shape.svg" + -- local pdffile = "temp-otf-svg-shape.pdf" + -- local command = "inkscape " .. svgfile .. " --export-pdf=" .. pdffile + -- local testrun = false + -- local pdfshapes = { } + -- local nofshapes = #svgshapes + -- local filterglyph = otfsvg.filterglyph -- report_svg("processing %i svg containers",nofshapes) -- statistics.starttiming() -- for i=1,nofshapes do -- local entry = svgshapes[i] - -- for j=entry.first,entry.last do - -- local svg = xmlconvert(entry.data) - -- local data = xmlfirst(svg,"/svg[@id='glyph"..j.."']") + -- for index=entry.first,entry.last do + -- local data = filterglyph(entry,index) -- savedata(svgfile,tostring(data)) - -- report_svg("processing svg shape of glyph %i in container %i",j,i) - -- os.execute(command) - -- pdfshapes[j] = loaddata(pdffile) + -- if data and data ~= "" then + -- report_svg("processing svg shape of glyph %i in container %i",index,i) + -- os.execute(command) + -- pdfshapes[index] = loaddata(pdffile) + -- end -- end -- if testrun and i > testrun then -- report_svg("quiting test run") @@ -207,26 +229,25 @@ if context and xml.convert then -- end function otfsvg.topdf(svgshapes) - local inkscape = io.popen("inkscape --shell 2>&1","w") - local pdfshapes = { } - local nofshapes = #svgshapes - local f_svgfile = formatters["temp-otf-svg-shape-%i.svg"] - local f_pdffile = formatters["temp-otf-svg-shape-%i.pdf"] - local f_convert = formatters["%s --export-pdf=%s\n"] + local inkscape = io.popen("inkscape --shell > temp-otf-svg-shape.log","w") + local pdfshapes = { } + local nofshapes = #svgshapes + local f_svgfile = formatters["temp-otf-svg-shape-%i.svg"] + local f_pdffile = formatters["temp-otf-svg-shape-%i.pdf"] + local f_convert = formatters["%s --export-pdf=%s\n"] + local filterglyph = otfsvg.filterglyph report_svg("processing %i svg containers",nofshapes) statistics.starttiming() for i=1,nofshapes do local entry = svgshapes[i] - for j=entry.first,entry.last do - local svg = xmlconvert(entry.data) - local root = svg and xmlfirst(svg,"/svg[@id='glyph"..j.."']") - local data = root and tostring(root) + for index=entry.first,entry.last do + local data = filterglyph(entry,index) if data and data ~= "" then - local svgfile = f_svgfile(j) - local pdffile = f_pdffile(j) + local svgfile = f_svgfile(index) + local pdffile = f_pdffile(index) savedata(svgfile,data) inkscape:write(f_convert(svgfile,pdffile)) - pdfshapes[j] = true + pdfshapes[index] = true end end end @@ -236,39 +257,17 @@ if context and xml.convert then -- end inkscape:close() report_svg("processing %i pdf results",nofshapes) - for i in next, pdfshapes do - local svgfile = f_svgfile(i) - local pdffile = f_pdffile(i) - pdfshapes[i] = loaddata(pdffile) + for index in next, pdfshapes do + local svgfile = f_svgfile(index) + local pdffile = f_pdffile(index) + pdfshapes[index] = loaddata(pdffile) remove(svgfile) remove(pdffile) end statistics.stoptiming() - report_svg("conversion time: %0.3f",statistics.elapsedtime()) - return pdfshapes - end - -else - - function otfsvg.topdf(svgshapes) - local svgfile = "temp-otf-svg-shape.svg" - local pdffile = "temp-otf-svg-shape.pdf" - local command = "inkscape " .. svgfile .. " --export-pdf=" .. pdffile - local pdfshapes = { } - local nofshapes = #svgshapes - texio.write(formatters["[converting %i svg glyphs to pdf using command %q : "](nofshapes,command)) - for i=1,nofshapes do - local entry = svgshapes[i] - for j=entry.first,entry.last do - -- cross our fingers .. some, day i will filter - texio.write(formatters["%i "](j)) - io.savedata(svgfile,tostring(entry.data)) - os.execute(command) - pdfshapes[j] = io.loaddata(pdffile) - end + if statistics.elapsedseconds then + report_svg("svg conversion time %s",statistics.elapsedseconds()) end - os.remove(svgfile) - texio.write("done]") return pdfshapes end diff --git a/tex/context/base/mkiv/font-otf.lua b/tex/context/base/mkiv/font-otf.lua index 891577849..3a8894ea7 100644 --- a/tex/context/base/mkiv/font-otf.lua +++ b/tex/context/base/mkiv/font-otf.lua @@ -540,7 +540,7 @@ function otf.load(filename,sub,featurefile) -- second argument (format) is gone collectgarbage("collect") end stoptiming("fontloader") - if elapsedtime then -- not in generic + if elapsedtime then report_otf("loading, optimizing, packing and caching time %s, pack time %s", elapsedtime("fontloader"),packdata and elapsedtime(packtime) or 0) end @@ -1279,7 +1279,7 @@ end -- local private = fonts.constructors and fonts.constructors.privateoffset or 0xF0000 -- 0x10FFFF -- -- -- local ns, nl = 0, 0 - +-- -- local guess = { } -- -- helper -- local function check(gname,code,unicode) diff --git a/tex/context/base/mkiv/font-otl.lua b/tex/context/base/mkiv/font-otl.lua index 59d868bee..5c63ea312 100644 --- a/tex/context/base/mkiv/font-otl.lua +++ b/tex/context/base/mkiv/font-otl.lua @@ -53,7 +53,7 @@ local report_otf = logs.reporter("fonts","otf loading") local fonts = fonts local otf = fonts.handlers.otf -otf.version = 3.023 -- beware: also sync font-mis.lua and in mtx-fonts +otf.version = 3.024 -- beware: also sync font-mis.lua and in mtx-fonts otf.cache = containers.define("fonts", "otl", otf.version, true) otf.svgcache = containers.define("fonts", "svg", otf.version, true) otf.pdfcache = containers.define("fonts", "pdf", otf.version, true) @@ -305,7 +305,7 @@ function otf.load(filename,sub,featurefile) -- second argument (format) is gone collectgarbage("collect") end stoptiming(otfreaders) - if elapsedtime then -- not in generic + if elapsedtime then report_otf("loading, optimizing, packing and caching time %s", elapsedtime(otfreaders)) end if cleanup > 3 then @@ -340,7 +340,6 @@ function otf.load(filename,sub,featurefile) -- second argument (format) is gone data.metadata.math = data.resources.mathconstants end - return data end diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf Binary files differindex 465f7243d..b42440d3a 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 4cca7e3be..703ddfb32 100644 --- a/tex/context/base/mkiv/status-lua.pdf +++ b/tex/context/base/mkiv/status-lua.pdf |