diff options
author | Hans Hagen <pragma@wxs.nl> | 2017-05-07 01:01:21 +0200 |
---|---|---|
committer | Context Git Mirror Bot <phg42.2a@gmail.com> | 2017-05-07 01:01:21 +0200 |
commit | 57c3891a6b93b57f91ea77c9bbecffacbcc0da28 (patch) | |
tree | 410b95f8a809ab33ffba6ac69bac7c466b4d514d | |
parent | 762562da00d0ec1d50e6d3c2a701156ab42e6d71 (diff) | |
download | context-57c3891a6b93b57f91ea77c9bbecffacbcc0da28.tar.gz |
2017-05-06 23:13:00
27 files changed, 304 insertions, 161 deletions
diff --git a/doc/context/documents/general/qrcs/setup-cs.pdf b/doc/context/documents/general/qrcs/setup-cs.pdf Binary files differindex 4c29b57e6..d8d51f91a 100644 --- a/doc/context/documents/general/qrcs/setup-cs.pdf +++ b/doc/context/documents/general/qrcs/setup-cs.pdf diff --git a/doc/context/documents/general/qrcs/setup-de.pdf b/doc/context/documents/general/qrcs/setup-de.pdf Binary files differindex f9aa7e4d9..ed335ce57 100644 --- a/doc/context/documents/general/qrcs/setup-de.pdf +++ b/doc/context/documents/general/qrcs/setup-de.pdf diff --git a/doc/context/documents/general/qrcs/setup-en.pdf b/doc/context/documents/general/qrcs/setup-en.pdf Binary files differindex 60d780fef..17ac84dd3 100644 --- a/doc/context/documents/general/qrcs/setup-en.pdf +++ b/doc/context/documents/general/qrcs/setup-en.pdf diff --git a/doc/context/documents/general/qrcs/setup-fr.pdf b/doc/context/documents/general/qrcs/setup-fr.pdf Binary files differindex 8d4bd1fbe..f0f1a3773 100644 --- a/doc/context/documents/general/qrcs/setup-fr.pdf +++ b/doc/context/documents/general/qrcs/setup-fr.pdf diff --git a/doc/context/documents/general/qrcs/setup-it.pdf b/doc/context/documents/general/qrcs/setup-it.pdf Binary files differindex ccc464822..36db2c357 100644 --- a/doc/context/documents/general/qrcs/setup-it.pdf +++ b/doc/context/documents/general/qrcs/setup-it.pdf diff --git a/doc/context/documents/general/qrcs/setup-nl.pdf b/doc/context/documents/general/qrcs/setup-nl.pdf Binary files differindex fc8ef52a0..f90f09ca1 100644 --- a/doc/context/documents/general/qrcs/setup-nl.pdf +++ b/doc/context/documents/general/qrcs/setup-nl.pdf diff --git a/doc/context/documents/general/qrcs/setup-ro.pdf b/doc/context/documents/general/qrcs/setup-ro.pdf Binary files differindex fcb3ba153..83b6f2d98 100644 --- a/doc/context/documents/general/qrcs/setup-ro.pdf +++ b/doc/context/documents/general/qrcs/setup-ro.pdf diff --git a/doc/context/presentations/bachotex/2016/bachotex-2016-toolbox.tex b/doc/context/presentations/bachotex/2016/bachotex-2016-toolbox.tex index 7d958d907..972630fbb 100644 --- a/doc/context/presentations/bachotex/2016/bachotex-2016-toolbox.tex +++ b/doc/context/presentations/bachotex/2016/bachotex-2016-toolbox.tex @@ -143,7 +143,7 @@ \startsection[title={history cycles}] \startitemize - \startitem there id this historic cycle (reinvent the wheel) \stopitem + \startitem there is this historic cycle (reinvent the wheel) \stopitem \startitem for instance we currently see a revival of vinyl \stopitem \startitem is this a side effect of crappy mp3 and/or poor digital equipment? \stopitem \startitem does it mean that eventually paper books will florish again too? \stopitem diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii index 0a74d9611..d75587f56 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{2017.04.27 01:00} +\newcontextversion{2017.05.06 23:06} %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 e6dc51a82..dfbd7e33a 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{2017.04.27 01:00} +\edef\contextversion{2017.05.06 23:06} %D For those who want to use this: diff --git a/tex/context/base/mkiv/char-ini.lua b/tex/context/base/mkiv/char-ini.lua index 4f2b7a4d5..f673a6a86 100644 --- a/tex/context/base/mkiv/char-ini.lua +++ b/tex/context/base/mkiv/char-ini.lua @@ -1496,8 +1496,8 @@ do local p_special = p_family + p_couple + p_kiss --- print(lpeg.match(p_special,"family man woman girl")) --- print(lpeg.match(p_special,"family man dark skin tone woman girl girl")) + -- print(lpeg.match(p_special,"family man woman girl")) + -- print(lpeg.match(p_special,"family man dark skin tone woman girl girl")) -- local p_special = P { "all", -- all = Cs (V("family") + V("couple") + V("kiss")), @@ -1509,11 +1509,11 @@ do -- rest = (space * skin)^0/"" * ((space^1/zwj) + P(-1)), -- } - -- maybe characters.emoji.toutf - local emoji = { } characters.emoji = emoji +local cache = setmetatable({ }, { __mode = "k" } ) + function emoji.resolve(name) if not hash then data, hash = load() @@ -1522,25 +1522,35 @@ do if h then return h end +local h = cache[name] +if h then + return h +elseif h == false then + return +end -- expand shortcuts local name = lpegmatch(pattern_0,name) or name -- expand some 25K variants local h = lpegmatch(p_special,name) if h then +cache[name] = h return h end -- simplify local s = lpegmatch(pattern_1,name) local h = hash[s] if h then +cache[name] = h return h end -- simplify local s = lpegmatch(pattern_2,name) local h = hash[s] if h then +cache[name] = h return h end +cache[name] = false end function emoji.known() diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv index 9e4ac8149..c539cac7e 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{2017.04.27 01:00} +\newcontextversion{2017.05.06 23:06} %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 51e0ae893..bc713993f 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{2017.04.27 01:00} +\edef\contextversion{2017.05.06 23:06} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/mkiv/font-lib.mkvi b/tex/context/base/mkiv/font-lib.mkvi index e37da2545..d9cae503b 100644 --- a/tex/context/base/mkiv/font-lib.mkvi +++ b/tex/context/base/mkiv/font-lib.mkvi @@ -87,7 +87,6 @@ \registerctxluafile{font-vf} {1.001} \registerctxluafile{font-enh}{1.001} -%registerctxluafile{font-gds}{1.001} \registerctxluafile{good-ini}{1.001} \registerctxluafile{good-gen}{1.001} \registerctxluafile{good-ctx}{1.001} diff --git a/tex/context/base/mkiv/font-ocl.lua b/tex/context/base/mkiv/font-ocl.lua index 5ab90084b..c166f5ce4 100644 --- a/tex/context/base/mkiv/font-ocl.lua +++ b/tex/context/base/mkiv/font-ocl.lua @@ -11,6 +11,7 @@ if not modules then modules = { } end modules ['font-ocl'] = { local tostring, next, format = tostring, next, string.format local round, max = math.round, math.round local sortedkeys, sortedhash = table.sortedkeys, table.sortedhash +local setmetatableindex = table.setmetatableindex local formatters = string.formatters local tounicode = fonts.mappings.tounicode @@ -47,7 +48,7 @@ end local sharedpalettes = { } -local hash = table.setmetatableindex(function(t,k) +local hash = setmetatableindex(function(t,k) local v = { "special", k } t[k] = v return v @@ -130,7 +131,7 @@ local function initializecolr(tfmdata,kind,value) -- hm, always value -- local converted = resources.converted if not converted then - converted = table.setmetatableindex(convert) + converted = setmetatableindex(convert) resources.converted = converted end local colorvalues = sharedpalettes[value] or converted[palettes[tonumber(value) or 1] or palettes[1]] or { } @@ -147,7 +148,7 @@ local function initializecolr(tfmdata,kind,value) -- hm, always value tfmdata.fonts = { { id = 0 } } - local widths = table.setmetatableindex(function(t,k) + local widths = setmetatableindex(function(t,k) local v = { "right", -k } t[k] = v return v @@ -155,24 +156,32 @@ local function initializecolr(tfmdata,kind,value) -- hm, always value -- local getactualtext = otf.getactualtext local default = colorvalues[#colorvalues] - local endactual = nil + local b, e = getactualtext(tounicode(0xFFFD)) local start = { "special", "pdf:page:q" } local stop = { "special", "pdf:raw:Q" } + local actualb = { "special", "pdf:page:" .. b } -- saves tables + local actuale = { "special", "pdf:page:" .. e } -- saves tables + -- + local cache = setmetatableindex(function(t,k) + local v = { "char", k } + t[k] = v + return v + end) -- for unicode, character in next, characters do local description = descriptions[unicode] if description then local colorlist = description.colors if colorlist then - local b, e = getactualtext(tounicode(characters[unicode].unicode or 0xFFFD)) + local u = description.unicode or characters[unicode].unicode local w = character.width or 0 local s = #colorlist - local goback = w ~= 0 and widths[w] or nil + local goback = w ~= 0 and widths[w] or nil -- needs checking: are widths the same local t = { start, - { "special", "pdf:raw:" .. b } + not u and actualb or { "special", "pdf:raw:" .. getactualtext(tounicode(u)) } } - local n = #t + local n = 2 local l = nil for i=1,s do local entry = colorlist[i] @@ -181,15 +190,12 @@ local function initializecolr(tfmdata,kind,value) -- hm, always value n = n + 1 t[n] = v l = v end - n = n + 1 t[n] = { "char", entry.slot } + n = n + 1 t[n] = cache[entry.slot] if s > 1 and i < s and goback then n = n + 1 t[n] = goback end end - if not endactual then - endactual = { "special", "pdf:page:" .. e } -- saves tables - end - n = n + 1 t[n] = endactual + n = n + 1 t[n] = actuale n = n + 1 t[n] = stop character.commands = t end diff --git a/tex/context/base/mkiv/font-otr.lua b/tex/context/base/mkiv/font-otr.lua index 4c29d05f6..977be70a6 100644 --- a/tex/context/base/mkiv/font-otr.lua +++ b/tex/context/base/mkiv/font-otr.lua @@ -2039,7 +2039,7 @@ local function readtable(tag,f,fontdata,specification,...) end end -local variablefonts_supported = context and true or false +local variablefonts_supported = (context and true) or (logs and logs.application and true) or false local function readdata(f,offset,specification) @@ -2100,6 +2100,8 @@ local function readdata(f,offset,specification) else report("user instance: %s, bad factors",instance) end + else + report("unknown instance") end end diff --git a/tex/context/base/mkiv/font-ttf.lua b/tex/context/base/mkiv/font-ttf.lua index b44f5d7bd..290a3dfe8 100644 --- a/tex/context/base/mkiv/font-ttf.lua +++ b/tex/context/base/mkiv/font-ttf.lua @@ -555,7 +555,7 @@ local function repackpoints(glyphs,shapes) -- we merged them else local contours = shape.contours - local nofcontours = #contours + local nofcontours = contours and #contours or 0 local boundingbox = glyph.boundingbox or noboundingbox r = r + 1 result[r] = toshort(nofcontours) r = r + 1 result[r] = toshort(boundingbox[1]) -- xmin @@ -696,7 +696,7 @@ local function readglyph(f,nofcontours) -- read deltas here, saves space else x = x + readshort(f) end - points[i] = { x, y, bittest(flag,0x01) } + points[i] = { x, 0, bittest(flag,0x01) } end local y = 0 for i=1,nofpoints do @@ -924,6 +924,9 @@ local function readtuplerecord(f,nofaxis) return record end +-- (1) the first is a real point the rest deltas +-- (2) points can be present more than once (multiple deltas then) + local function readpoints(f) local count = readbyte(f) if count == 0 then @@ -937,7 +940,7 @@ local function readpoints(f) end local points = { } local p = 0 - local n = 1 + local n = 1 -- indices while p < count do local control = readbyte(f) local runreader = bittest(control,0x80) and readushort or readbyte @@ -955,22 +958,24 @@ end local function readdeltas(f,nofpoints) local deltas = { } local p = 0 - local n = 0 - local z = false + local z = 0 while nofpoints > 0 do local control = readbyte(f) +if not control then + break +end local allzero = bittest(control,0x80) - local runreader = bittest(control,0x40) and readshort or readinteger local runlength = band(control,0x3F) + 1 if allzero then - z = runlength + z = z + runlength else - if z then + local runreader = bittest(control,0x40) and readshort or readinteger + if z > 0 then for i=1,z do p = p + 1 deltas[p] = 0 end - z = false + z = 0 end for i=1,runlength do p = p + 1 @@ -980,12 +985,12 @@ local function readdeltas(f,nofpoints) nofpoints = nofpoints - runlength end -- saves space - -- if z then - -- for i=1,z do - -- p = p + 1 - -- deltas[p] = 0 - -- end - -- end +-- if z > 0 then +-- for i=1,z do +-- p = p + 1 +-- deltas[p] = 0 +-- end +-- end if p > 0 then -- forget about trailing zeros return deltas @@ -994,7 +999,42 @@ local function readdeltas(f,nofpoints) end end +local function readdeltas(f,nofpoints) + local deltas = { } + local p = 0 + while nofpoints > 0 do + local control = readbyte(f) + if control then + local allzero = bittest(control,0x80) + local runlength = band(control,0x3F) + 1 + if allzero then + for i=1,runlength do + p = p + 1 + deltas[p] = 0 + end + else + local runreader = bittest(control,0x40) and readshort or readinteger + for i=1,runlength do + p = p + 1 + deltas[p] = runreader(f) + end + end + nofpoints = nofpoints - runlength + else + -- it happens + break + end + end + -- saves space + if p > 0 then + return deltas + else + -- forget about all zeros + end +end + function readers.gvar(f,fontdata,specification,glyphdata,shapedata) + -- this is one of the messiest tables local instance = specification.instance if not instance then return @@ -1008,7 +1048,7 @@ function readers.gvar(f,fontdata,specification,glyphdata,shapedata) local version = readulong(f) -- 1.0 local nofaxis = readushort(f) local noftuples = readushort(f) - local tupleoffset = readulong(f) -- shared + local tupleoffset = tableoffset + readulong(f) local nofglyphs = readushort(f) local flags = readushort(f) local dataoffset = tableoffset + readulong(f) @@ -1027,89 +1067,89 @@ function readers.gvar(f,fontdata,specification,glyphdata,shapedata) end end -- - setposition(f,tableoffset+tupleoffset) - for i=1,noftuples do - tuples[i] = readtuplerecord(f,nofaxis) -- used ? + if noftuples > 0 then + setposition(f,tupleoffset) + for i=1,noftuples do + tuples[i] = readtuplerecord(f,nofaxis) + end end local lastoffset = false for i=1,nofglyphs do -- hm one more cf spec - local shape = shapedata[i-1] -- todo 0 - if shape then - local startoffset = dataoffset + data[i] - if startoffset == lastoffset then - -- in the font that i used for testing there were the same offsets so - -- we can assume that this indicates a zero entry + local startoffset = dataoffset + data[i] + if startoffset == lastoffset then + -- no deltas + else + local shape = shapedata[i-1] -- todo 0 + if not shape then + -- no shape else - -- todo: args_are_xy_values mess .. i have to be really bored - -- and motivated to deal with it - lastoffset = startoffset setposition(f,startoffset) local flags = readushort(f) local count = band(flags,0x0FFF) - local points = bittest(flags,0x8000) local offset = startoffset + readushort(f) -- to serialized local deltas = { } - local nofpoints = 0 - local allpoints = (shape.nofpoints or 0) + 1 - if points then + local allpoints = (shape.nofpoints or 0) -- + 1 + local shared = false + local nofshared = 0 + if bittest(flags,0x8000) then -- has shared points -- go to the packed stream (get them once) local current = getposition(f) setposition(f,offset) - points, nofpoints = readpoints(f) + shared, nofshared = readpoints(f) offset = getposition(f) setposition(f,current) -- and back to the table - else - points, nofpoints = nil, 0 end - for i=1,count do - local currentstart = getposition(f) + for j=1,count do local size = readushort(f) -- check local flags = readushort(f) local index = band(flags,0x0FFF) local haspeak = bittest(flags,0x8000) local intermediate = bittest(flags,0x4000) - local private = bittest(flags,0x1000) + local private = bittest(flags,0x2000) local peak = nil local start = nil local stop = nil local xvalues = nil local yvalues = nil - local points = points -- we default to shared - local nofpoints = nofpoints -- we default to shared - local advance = 4 - if peak then + local points = shared -- we default to shared + local nofpoints = nofshared -- we default to shared + -- local advance = 4 + if haspeak then peak = readtuplerecord(f,nofaxis) - advance = advance + 2*nofaxis + -- advance = advance + 2*nofaxis else if index+1 > #tuples then print("error, bad index",index) end peak = tuples[index+1] -- hm, needs checking, only peak? end --- what start otherwise ? if intermediate then start = readtuplerecord(f,nofaxis) stop = readtuplerecord(f,nofaxis) - advance = advance + 4*nofaxis + -- advance = advance + 4*nofaxis end -- get the deltas if size > 0 then + local current = getposition(f) -- goto the packed stream setposition(f,offset) if private then points, nofpoints = readpoints(f) - elseif nofpoints == 0 then - nofpoints = allpoints + end -- else + if nofpoints == 0 then + nofpoints = allpoints + 4 end if nofpoints > 0 then + -- a nice test is to do only one xvalues = readdeltas(f,nofpoints) yvalues = readdeltas(f,nofpoints) end - offset = getposition(f) + -- resync offset + offset = offset + size -- back to the table - setposition(f,currentstart+advance) + setposition(f,current) end if not xvalues and not yvalues then points = nil @@ -1117,9 +1157,11 @@ function readers.gvar(f,fontdata,specification,glyphdata,shapedata) local s = 1 for i=1,nofaxis do local f = factors[i] - local start = start and start[i] or 0 local peak = peak and peak [i] or 0 - local stop = stop and stop [i] or 0 + -- local start = start and start[i] or 0 + -- local stop = stop and stop [i] or 0 + local start = start and start[i] or (peak < 0 and peak or 0) + local stop = stop and stop [i] or (peak > 0 and peak or 0) -- do we really need these tests ... can't we assume sane values if start > peak or peak > stop then -- * 1 @@ -1150,8 +1192,24 @@ function readers.gvar(f,fontdata,specification,glyphdata,shapedata) end end if shape.type == "glyph" then +-- if fontdata.glyphs[i-1].name == "X" then +-- if deltas then +-- for i=1,#deltas do +-- local d = deltas[i] +-- local x = d.xvalues +-- local y = d.yvalues +-- if x and y then +-- for i=1,#x do +-- print(i-1,x[i],y[i]) +-- end +-- end +-- end +-- end +-- end applyaxis(glyphdata[i],shape,shape.points,deltas) else + -- todo: args_are_xy_values mess .. i have to be really bored + -- and motivated to deal with it shape.deltas = deltas end end diff --git a/tex/context/base/mkiv/m-oldotf.mkiv b/tex/context/base/mkiv/m-oldotf.mkiv index 313f9f484..f860df712 100644 --- a/tex/context/base/mkiv/m-oldotf.mkiv +++ b/tex/context/base/mkiv/m-oldotf.mkiv @@ -28,7 +28,6 @@ "font-one", "font-map", "font-fbk", - "font-gds", } local report = logs.reporter("oldotf") local findfile = resolvers.findfile diff --git a/tex/context/base/mkiv/spac-grd.mkiv b/tex/context/base/mkiv/spac-grd.mkiv index 4864cd646..899b6e890 100644 --- a/tex/context/base/mkiv/spac-grd.mkiv +++ b/tex/context/base/mkiv/spac-grd.mkiv @@ -314,14 +314,14 @@ \fi \endgroup} -\unexpanded\def\spac_fake_next_line_old - {\par - \begingroup - \reseteverypar - \dontleavehmode\hpack to \zeropoint{\page_sides_anchor\hss\strut}% just a tracer - \vskip-\parskip - \vskip-\struttotal - \endgroup} +% \unexpanded\def\spac_fake_next_line_old +% {\par +% \begingroup +% \reseteverypar +% \dontleavehmode\hpack to \zeropoint{\page_sides_anchor\hss\strut}% just a tracer +% \vskip-\parskip +% \vskip-\struttotal +% \endgroup} %let\fakenextstrutline\spac_fake_next_line_old \let\fakenextstrutline\spac_fake_next_line_new diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf Binary files differindex c923f8a0f..0440c4cd8 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 1f3c85b74..db8b36d2f 100644 --- a/tex/context/base/mkiv/status-lua.pdf +++ b/tex/context/base/mkiv/status-lua.pdf diff --git a/tex/context/fonts/mkiv/type-imp-koeielettersot.mkiv b/tex/context/fonts/mkiv/type-imp-koeielettersot.mkiv index b878c9f4e..e3e8fc277 100644 --- a/tex/context/fonts/mkiv/type-imp-koeielettersot.mkiv +++ b/tex/context/fonts/mkiv/type-imp-koeielettersot.mkiv @@ -132,9 +132,9 @@ \starttext -\setupbodyfont[sheep] +\setupbodyfont[cows] -$1^1$ +\input tufte \stoptext diff --git a/tex/context/interface/mkiv/i-context.pdf b/tex/context/interface/mkiv/i-context.pdf Binary files differindex 60d780fef..17ac84dd3 100644 --- a/tex/context/interface/mkiv/i-context.pdf +++ b/tex/context/interface/mkiv/i-context.pdf diff --git a/tex/context/interface/mkiv/i-readme.pdf b/tex/context/interface/mkiv/i-readme.pdf Binary files differindex 847d275cb..9b3f5127d 100644 --- a/tex/context/interface/mkiv/i-readme.pdf +++ b/tex/context/interface/mkiv/i-readme.pdf diff --git a/tex/context/modules/mkiv/s-fonts-variable.lua b/tex/context/modules/mkiv/s-fonts-variable.lua index d166e320c..d4e3244a9 100644 --- a/tex/context/modules/mkiv/s-fonts-variable.lua +++ b/tex/context/modules/mkiv/s-fonts-variable.lua @@ -15,7 +15,7 @@ local lower = string.lower local rep = string.rep local context = context -local NC, NR, HL = context.NC, context.NR, context.HL +local NC, NR, HL, ML = context.NC, context.NR, context.HL, context.ML local bold, monobold, mono, formattedmono = context.bold, context.monobold, context.mono, context.formatted.mono function moduledata.fonts.variable.showvariations(specification) @@ -36,6 +36,7 @@ function moduledata.fonts.variable.showvariations(specification) if not fontdata then context.type("no font with name %a found",fontname) + return end local resources = fontdata.resources @@ -119,21 +120,24 @@ function moduledata.fonts.variable.showvariations(specification) local tag = axis.tag local name = axis.name local variants = axis.variants - local haslimits = variants[1].maximum - local haslink = variants[1].link - for i=1,#variants do - local variant = variants[i] - NC() monobold(tag) - NC() context(name) - NC() context(variant.name) - NC() formattedmono("0x%04x",variant.flags) - NC() context(variant.value) - NC() context(variant.minimum or "-") - NC() context(variant.maximum or "-") - NC() context(variant.link or "-") - NC() NR() - tag = nil - name = nil + local first = variants and variants[1] + if first then + local haslimits = first.maximum + local haslink = first.link + for i=1,#variants do + local variant = variants[i] + NC() monobold(tag) + NC() context(name) + NC() context(variant.name) + NC() formattedmono("0x%04x",variant.flags) + NC() context(variant.value) + NC() context(variant.minimum or "-") + NC() context(variant.maximum or "-") + NC() context(variant.link or "-") + NC() NR() + tag = nil + name = nil + end end end context.stoptabulate() @@ -175,7 +179,16 @@ function moduledata.fonts.variable.showvariations(specification) local collected = { } context.startsubject { title = "instances" } - if instances and #list > 0 then + if not instances or #instances == 0 or not list or #list == 0 then + context("no instances defined, incomplete \\type{fvar}/\\type{stat} table") + else + if #axis > 8 then + context.start() + context.switchtobodyfont { "small" } + if #axis > 12 then + context.switchtobodyfont { "small" } + end + end context.starttabulate { "||" .. rep("c|",#list) .. "|" } NC() for i=1,#list do @@ -185,7 +198,7 @@ function moduledata.fonts.variable.showvariations(specification) local fullname = lower(stripstring(fontdata.shared.rawdata.metadata.fullname)) formattedmono("%s*",fullname) NC() NR() - HL() + ML() for k=1,#instances do local i = instances[k] NC() monobold(i.subfamily) @@ -205,8 +218,9 @@ function moduledata.fonts.variable.showvariations(specification) NC() NR() end context.stoptabulate() - else - context("no instances defined, incomplete \\type{fvar} table") + if #axis > 8 then + context.stop() + end end context.stopsubject() diff --git a/tex/context/modules/mkiv/s-fonts-variable.mkiv b/tex/context/modules/mkiv/s-fonts-variable.mkiv index 176432630..7779eb701 100644 --- a/tex/context/modules/mkiv/s-fonts-variable.mkiv +++ b/tex/context/modules/mkiv/s-fonts-variable.mkiv @@ -32,8 +32,12 @@ \usemodule[art-01] +\setuphead[section][before={\testpage[5]\blank[2*big]}] + \starttext +% \showfontkerns + \showfontvariations [font=file:adobevfprototype.otf] @@ -43,7 +47,20 @@ % \showfontvariations % [font=file:kairossansvariable.ttf] +% \showfontvariations +% [font=file:sourcecode-regular.otf] + +% \showfontvariations +% [font=file:AmstelvarAlpha-VF.ttf] + \showfontvariations - [font=file:sourcecode-regular.otf] + [font=file:DecoVar-VF.ttf] + + % This is Adam's version of noto .. has lots of instances so it takes a while + % the first time. Looks like I do somethign wrong (bad a's and widths). + +% \showfontvariations +% [font=file:VotoSerifGX.ttf] + \stoptext diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index cb95e9a87..a31f35866 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 : 04/27/17 01:00:26 +-- merge date : 05/06/17 23:06:49 do -- begin closure to overcome local limits and interference @@ -9509,7 +9509,7 @@ local function readtable(tag,f,fontdata,specification,...) reader(f,fontdata,specification,...) end end -local variablefonts_supported=context and true or false +local variablefonts_supported=(context and true) or (logs and logs.application and true) or false local function readdata(f,offset,specification) local fontdata=loadtables(f,specification,offset) if specification.glyphs then @@ -9560,6 +9560,8 @@ local function readdata(f,offset,specification) else report("user instance: %s, bad factors",instance) end + else + report("unknown instance") end end end @@ -12181,7 +12183,7 @@ local function repackpoints(glyphs,shapes) if false then else local contours=shape.contours - local nofcontours=#contours + local nofcontours=contours and #contours or 0 local boundingbox=glyph.boundingbox or noboundingbox r=r+1 result[r]=toshort(nofcontours) r=r+1 result[r]=toshort(boundingbox[1]) @@ -12313,7 +12315,7 @@ local function readglyph(f,nofcontours) else x=x+readshort(f) end - points[i]={ x,y,bittest(flag,0x01) } + points[i]={ x,0,bittest(flag,0x01) } end local y=0 for i=1,nofpoints do @@ -12521,7 +12523,7 @@ local function readpoints(f) end local points={} local p=0 - local n=1 + local n=1 while p<count do local control=readbyte(f) local runreader=bittest(control,0x80) and readushort or readbyte @@ -12538,22 +12540,24 @@ end local function readdeltas(f,nofpoints) local deltas={} local p=0 - local n=0 - local z=false + local z=0 while nofpoints>0 do local control=readbyte(f) +if not control then + break +end local allzero=bittest(control,0x80) - local runreader=bittest(control,0x40) and readshort or readinteger local runlength=band(control,0x3F)+1 if allzero then - z=runlength + z=z+runlength else - if z then + local runreader=bittest(control,0x40) and readshort or readinteger + if z>0 then for i=1,z do p=p+1 deltas[p]=0 end - z=false + z=0 end for i=1,runlength do p=p+1 @@ -12567,6 +12571,36 @@ local function readdeltas(f,nofpoints) else end end +local function readdeltas(f,nofpoints) + local deltas={} + local p=0 + while nofpoints>0 do + local control=readbyte(f) + if control then + local allzero=bittest(control,0x80) + local runlength=band(control,0x3F)+1 + if allzero then + for i=1,runlength do + p=p+1 + deltas[p]=0 + end + else + local runreader=bittest(control,0x40) and readshort or readinteger + for i=1,runlength do + p=p+1 + deltas[p]=runreader(f) + end + end + nofpoints=nofpoints-runlength + else + break + end + end + if p>0 then + return deltas + else + end +end function readers.gvar(f,fontdata,specification,glyphdata,shapedata) local instance=specification.instance if not instance then @@ -12581,7 +12615,7 @@ function readers.gvar(f,fontdata,specification,glyphdata,shapedata) local version=readulong(f) local nofaxis=readushort(f) local noftuples=readushort(f) - local tupleoffset=readulong(f) + local tupleoffset=tableoffset+readulong(f) local nofglyphs=readushort(f) local flags=readushort(f) local dataoffset=tableoffset+readulong(f) @@ -12597,54 +12631,52 @@ function readers.gvar(f,fontdata,specification,glyphdata,shapedata) data[i]=2*readushort(f) end end - setposition(f,tableoffset+tupleoffset) - for i=1,noftuples do - tuples[i]=readtuplerecord(f,nofaxis) + if noftuples>0 then + setposition(f,tupleoffset) + for i=1,noftuples do + tuples[i]=readtuplerecord(f,nofaxis) + end end local lastoffset=false for i=1,nofglyphs do - local shape=shapedata[i-1] - if shape then - local startoffset=dataoffset+data[i] - if startoffset==lastoffset then + local startoffset=dataoffset+data[i] + if startoffset==lastoffset then + else + local shape=shapedata[i-1] + if not shape then else lastoffset=startoffset setposition(f,startoffset) local flags=readushort(f) local count=band(flags,0x0FFF) - local points=bittest(flags,0x8000) local offset=startoffset+readushort(f) local deltas={} - local nofpoints=0 - local allpoints=(shape.nofpoints or 0)+1 - if points then + local allpoints=(shape.nofpoints or 0) + local shared=false + local nofshared=0 + if bittest(flags,0x8000) then local current=getposition(f) setposition(f,offset) - points,nofpoints=readpoints(f) + shared,nofshared=readpoints(f) offset=getposition(f) setposition(f,current) - else - points,nofpoints=nil,0 end - for i=1,count do - local currentstart=getposition(f) + for j=1,count do local size=readushort(f) local flags=readushort(f) local index=band(flags,0x0FFF) local haspeak=bittest(flags,0x8000) local intermediate=bittest(flags,0x4000) - local private=bittest(flags,0x1000) + local private=bittest(flags,0x2000) local peak=nil local start=nil local stop=nil local xvalues=nil local yvalues=nil - local points=points - local nofpoints=nofpoints - local advance=4 - if peak then + local points=shared + local nofpoints=nofshared + if haspeak then peak=readtuplerecord(f,nofaxis) - advance=advance+2*nofaxis else if index+1>#tuples then print("error, bad index",index) @@ -12654,21 +12686,22 @@ function readers.gvar(f,fontdata,specification,glyphdata,shapedata) if intermediate then start=readtuplerecord(f,nofaxis) stop=readtuplerecord(f,nofaxis) - advance=advance+4*nofaxis end if size>0 then + local current=getposition(f) setposition(f,offset) if private then points,nofpoints=readpoints(f) - elseif nofpoints==0 then - nofpoints=allpoints + end + if nofpoints==0 then + nofpoints=allpoints+4 end if nofpoints>0 then xvalues=readdeltas(f,nofpoints) yvalues=readdeltas(f,nofpoints) end - offset=getposition(f) - setposition(f,currentstart+advance) + offset=offset+size + setposition(f,current) end if not xvalues and not yvalues then points=nil @@ -12676,9 +12709,9 @@ function readers.gvar(f,fontdata,specification,glyphdata,shapedata) local s=1 for i=1,nofaxis do local f=factors[i] - local start=start and start[i] or 0 local peak=peak and peak [i] or 0 - local stop=stop and stop [i] or 0 + local start=start and start[i] or (peak<0 and peak or 0) + local stop=stop and stop [i] or (peak>0 and peak or 0) if start>peak or peak>stop then elseif start<0 and stop>0 and peak~=0 then elseif peak==0 then @@ -25960,6 +25993,7 @@ if not modules then modules={} end modules ['font-ocl']={ local tostring,next,format=tostring,next,string.format local round,max=math.round,math.round local sortedkeys,sortedhash=table.sortedkeys,table.sortedhash +local setmetatableindex=table.setmetatableindex local formatters=string.formatters local tounicode=fonts.mappings.tounicode local otf=fonts.handlers.otf @@ -25984,7 +26018,7 @@ else end end local sharedpalettes={} -local hash=table.setmetatableindex(function(t,k) +local hash=setmetatableindex(function(t,k) local v={ "special",k } t[k]=v return v @@ -26051,7 +26085,7 @@ local function initializecolr(tfmdata,kind,value) if palettes then local converted=resources.converted if not converted then - converted=table.setmetatableindex(convert) + converted=setmetatableindex(convert) resources.converted=converted end local colorvalues=sharedpalettes[value] or converted[palettes[tonumber(value) or 1] or palettes[1]] or {} @@ -26066,30 +26100,37 @@ local function initializecolr(tfmdata,kind,value) tfmdata.fonts={ { id=0 } } - local widths=table.setmetatableindex(function(t,k) + local widths=setmetatableindex(function(t,k) local v={ "right",-k } t[k]=v return v end) local getactualtext=otf.getactualtext local default=colorvalues[#colorvalues] - local endactual=nil + local b,e=getactualtext(tounicode(0xFFFD)) local start={ "special","pdf:page:q" } local stop={ "special","pdf:raw:Q" } + local actualb={ "special","pdf:page:"..b } + local actuale={ "special","pdf:page:"..e } + local cache=setmetatableindex(function(t,k) + local v={ "char",k } + t[k]=v + return v + end) for unicode,character in next,characters do local description=descriptions[unicode] if description then local colorlist=description.colors if colorlist then - local b,e=getactualtext(tounicode(characters[unicode].unicode or 0xFFFD)) + local u=description.unicode or characters[unicode].unicode local w=character.width or 0 local s=#colorlist - local goback=w~=0 and widths[w] or nil + local goback=w~=0 and widths[w] or nil local t={ start, - { "special","pdf:raw:"..b } + not u and actualb or { "special","pdf:raw:"..getactualtext(tounicode(u)) } } - local n=#t + local n=2 local l=nil for i=1,s do local entry=colorlist[i] @@ -26098,15 +26139,12 @@ local function initializecolr(tfmdata,kind,value) n=n+1 t[n]=v l=v end - n=n+1 t[n]={ "char",entry.slot } + n=n+1 t[n]=cache[entry.slot] if s>1 and i<s and goback then n=n+1 t[n]=goback end end - if not endactual then - endactual={ "special","pdf:page:"..e } - end - n=n+1 t[n]=endactual + n=n+1 t[n]=actuale n=n+1 t[n]=stop character.commands=t end |