diff options
author | Karl Berry <karl@freefriends.org> | 2017-05-19 22:21:26 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2017-05-19 22:21:26 +0000 |
commit | 02d80ea895335df75e00859242939f1c46ef738b (patch) | |
tree | 321adf01c66b8d2925b191e5f710a4a97e980122 /Master/texmf-dist/tex/context | |
parent | 2f05e748b4a6adff09c1139331b4012419c52152 (diff) |
context/current (May 16 10:25)
git-svn-id: svn://tug.org/texlive/trunk@44436 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/context')
20 files changed, 192 insertions, 45 deletions
diff --git a/Master/texmf-dist/tex/context/base/mkii/cont-new.mkii b/Master/texmf-dist/tex/context/base/mkii/cont-new.mkii index 847856cb974..b23a010d939 100644 --- a/Master/texmf-dist/tex/context/base/mkii/cont-new.mkii +++ b/Master/texmf-dist/tex/context/base/mkii/cont-new.mkii @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2017.05.12 22:40} +\newcontextversion{2017.05.15 21:48} %D This file is loaded at runtime, thereby providing an %D excellent place for hacks, patches, extensions and new diff --git a/Master/texmf-dist/tex/context/base/mkii/context.mkii b/Master/texmf-dist/tex/context/base/mkii/context.mkii index 725f87c00a2..9b79652fee0 100644 --- a/Master/texmf-dist/tex/context/base/mkii/context.mkii +++ b/Master/texmf-dist/tex/context/base/mkii/context.mkii @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2017.05.12 22:40} +\edef\contextversion{2017.05.15 21:48} %D For those who want to use this: diff --git a/Master/texmf-dist/tex/context/base/mkiv/cont-new.mkiv b/Master/texmf-dist/tex/context/base/mkiv/cont-new.mkiv index 3aacc978cd6..cad08c512ea 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/cont-new.mkiv +++ b/Master/texmf-dist/tex/context/base/mkiv/cont-new.mkiv @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2017.05.12 22:40} +\newcontextversion{2017.05.15 21:48} %D This file is loaded at runtime, thereby providing an excellent place for %D hacks, patches, extensions and new features. diff --git a/Master/texmf-dist/tex/context/base/mkiv/context.mkiv b/Master/texmf-dist/tex/context/base/mkiv/context.mkiv index 6d946e0bc63..509077bc95f 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/context.mkiv +++ b/Master/texmf-dist/tex/context/base/mkiv/context.mkiv @@ -39,7 +39,7 @@ %D up and the dependencies are more consistent. \edef\contextformat {\jobname} -\edef\contextversion{2017.05.12 22:40} +\edef\contextversion{2017.05.15 21:48} \edef\contextkind {beta} %D For those who want to use this: diff --git a/Master/texmf-dist/tex/context/base/mkiv/font-col.mkvi b/Master/texmf-dist/tex/context/base/mkiv/font-col.mkvi index 88a3ff9412d..b13047e5091 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/font-col.mkvi +++ b/Master/texmf-dist/tex/context/base/mkiv/font-col.mkvi @@ -100,7 +100,7 @@ {\doifelsenothing{#3}% {\definedfont[#2 at #4sp]}% {\definedfont[#2*#3\space at #4\scaledpoint]}% - \ctxlua{mathematics.registerfallbackid(#1,\fontid\font)}} + \clf_registerfontfallbackid#1\space\fontid\font\space{#2}} % \def\font_fallbacks_finish_math % {\ctxlua{mathematics.finishfallbacks()}} diff --git a/Master/texmf-dist/tex/context/base/mkiv/font-ext.lua b/Master/texmf-dist/tex/context/base/mkiv/font-ext.lua index 6edfe702542..965b6e6dc26 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/font-ext.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/font-ext.lua @@ -1296,3 +1296,52 @@ do -- another hack for a crappy font } end + +do + + local tounicode = fonts.mappings.tounicode + + local function check(tfmdata,key,value) + if value == "ligatures" then + local private = fonts.constructors and fonts.constructors.privateoffset or 0xF0000 + local collected = fonts.handlers.otf.readers.getcomponents(tfmdata.shared.rawdata) + if collected and next(collected)then + for unicode, char in next, tfmdata.characters do + if true then -- if unicode >= private or (unicode >= 0xE000 and unicode <= 0xF8FF) then + local u = collected[unicode] + if u then + local n = #u + for i=1,n do + if u[i] > private then + n = 0 + break + end + end + if n > 0 then + if n == 1 then + u = u[1] + end + char.unicode = u + char.tounicode = tounicode(u) + end + end + end + end + end + end + end + + -- forceunicodes=ligatures : aggressive lig resolving (e.g. for emoji) + -- + -- kind of like: \enabletrackers[fonts.mapping.forceligatures] + + registerotffeature { + name = "forceunicodes", + description = "forceunicodes", + manipulators = { + base = check, + node = check, + } + } + +end diff --git a/Master/texmf-dist/tex/context/base/mkiv/font-map.lua b/Master/texmf-dist/tex/context/base/mkiv/font-map.lua index cf369708c62..706c5b70923 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/font-map.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/font-map.lua @@ -19,9 +19,9 @@ local trace_mapping = false trackers.register("fonts.mapping", function(v) trac local report_fonts = logs.reporter("fonts","loading") -- not otf only --- force_ligatures is true per 2017-04-20 so that these emoji's with bad names work too +-- force_ligatures was true for a while so that these emoji's with bad names work too -local force_ligatures = true directives.register("fonts.mapping.forceligatures",function(v) force_ligatures = v end) +local force_ligatures = false directives.register("fonts.mapping.forceligatures",function(v) force_ligatures = v end) local fonts = fonts or { } local mappings = fonts.mappings or { } @@ -279,6 +279,9 @@ do ffl = { name = "f_f_l", unicode = { 0x66, 0x66, 0x6C }, mess = 0xFB04 }, fj = { name = "f_j", unicode = { 0x66, 0x6A } }, fk = { name = "f_k", unicode = { 0x66, 0x6B } }, + + -- endash = { name = "endash", unicode = 0x2013, mess = 0x2013 }, + -- emdash = { name = "emdash", unicode = 0x2014, mess = 0x2014 }, } local o = { } @@ -299,7 +302,7 @@ do end -function mappings.addtounicode(data,filename,checklookups) +function mappings.addtounicode(data,filename,checklookups,forceligatures) local resources = data.resources local unicodes = resources.unicodes if not unicodes then @@ -517,22 +520,26 @@ function mappings.addtounicode(data,filename,checklookups) if not collected then -- move on - elseif force_ligatures then + elseif forceligatures or force_ligatures then for i=1,#dlist do local du = dlist[i] - local u = collected[du] -- always tables - if u then - resolve(descriptions[du],u) + if du >= private or (du >= 0xE000 and du <= 0xF8FF) then + local u = collected[du] -- always tables + if u then + resolve(descriptions[du],u) + end end end else for i=1,#dlist do - local du = dlist[i] - local glyph = descriptions[du] - if glyph.class == "ligature" and not glyph.unicode then - local u = collected[du] -- always tables - if u then - resolve(glyph,u) + local du = dlist[i] + if du >= private or (du >= 0xE000 and du <= 0xF8FF) then + local glyph = descriptions[du] + if glyph.class == "ligature" and not glyph.unicode then + local u = collected[du] -- always tables + if u then + resolve(glyph,u) + end end end end diff --git a/Master/texmf-dist/tex/context/base/mkiv/font-ocl.lua b/Master/texmf-dist/tex/context/base/mkiv/font-ocl.lua index c166f5ce4fe..2ecf1ba4242 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/font-ocl.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/font-ocl.lua @@ -40,7 +40,7 @@ else function otf.getactualtext(s) return - "/Span << /ActualText <feff" .. n .. "> >> BDC", + "/Span << /ActualText <feff" .. s .. "> >> BDC", "EMC" end diff --git a/Master/texmf-dist/tex/context/base/mkiv/font-otj.lua b/Master/texmf-dist/tex/context/base/mkiv/font-otj.lua index 634f8a83c05..2c79500e741 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/font-otj.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/font-otj.lua @@ -1434,6 +1434,35 @@ function injections.isspace(n,threshold,id) end end +-- We have a plugin so that Kai can use the next in plain. Such a plugin is rather application +-- specific. +-- +-- local getboth = nodes.direct.getboth +-- local getid = nodes.direct.getid +-- local getprev = nodes.direct.getprev +-- local getnext = nodes.direct.getnext +-- +-- local whatsit_code = nodes.nodecodes.whatsit +-- local glyph_code = nodes.nodecodes.glyph +-- +-- local function getspaceboth(n) -- fragile: what it prev/next has no width field +-- local prev, next = getboth(n) +-- while prev and (getid(prev) == whatsit_code or (getwidth(prev) == 0 and getid(prev) ~= glyph_code)) do +-- prev = getprev(prev) +-- end +-- while next and (getid(next) == whatsit_code or (getwidth(next) == 0 and getid(next) ~= glyph_code)) do +-- next = getnext(next) +-- end +-- end +-- +-- injections.installgetspaceboth(getspaceboth) + +local getspaceboth = getboth + +function injections.installgetspaceboth(gb) + getspaceboth = gb or getboth +end + local function injectspaces(head) if not triggers then @@ -1458,9 +1487,9 @@ local function injectspaces(head) end for n in traverse_id(glue_code,tonut(head)) do - local prev, next = getboth(n) - local prevchar = ischar(prev) - local nextchar = ischar(next) + local prev, next = getspaceboth(n) + local prevchar = prev and ischar(prev) + local nextchar = next and ischar(next) if nextchar then local font = getfont(next) local trig = triggers[font] diff --git a/Master/texmf-dist/tex/context/base/mkiv/font-otr.lua b/Master/texmf-dist/tex/context/base/mkiv/font-otr.lua index 3addf332493..4f93c5579ce 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/font-otr.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/font-otr.lua @@ -1130,9 +1130,10 @@ readers.hmtx = function(f,fontdata,specification) if width ~= 0 then glyph.width = width end - -- if leftsidebearing ~= 0 then - -- glyph.lsb = leftsidebearing - -- end +-- for now +-- if leftsidebearing ~= 0 then +-- glyph.lsb = leftsidebearing +-- end end -- The next can happen in for instance a monospace font or in a cjk font -- with fixed widths. diff --git a/Master/texmf-dist/tex/context/base/mkiv/font-ots.lua b/Master/texmf-dist/tex/context/base/mkiv/font-ots.lua index 16c2ce73581..04ecaa92341 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/font-ots.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/font-ots.lua @@ -4289,9 +4289,9 @@ local function spaceinitializer(tfmdata,value) -- attr if type(kern) ~= "table" then left[k] = kern elseif single then - left[k] = v[3] + left[k] = kern[3] else - local one = v[1] + local one = kern[1] if one then left[k] = one[3] end diff --git a/Master/texmf-dist/tex/context/base/mkiv/font-ttf.lua b/Master/texmf-dist/tex/context/base/mkiv/font-ttf.lua index 37b30f31448..339764d4a0d 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/font-ttf.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/font-ttf.lua @@ -160,11 +160,12 @@ local function applyaxis(glyph,shape,deltas,dowidth) local points = shape.points if points then local nofpoints = #points - local h = nofpoints + 1 -- weird, the example font seems to have left first - ----- l = nofpoints + 2 + local h = nofpoints + 2 -- weird, the example font seems to have left first + local l = nofpoints + 1 ----- v = nofpoints + 3 ----- t = nofpoints + 4 - local width = dowidth and glyph.width -- what if hvar + local dw = 0 + local dl = 0 for i=1,#deltas do local deltaset = deltas[i] local xvalues = deltaset.xvalues @@ -190,10 +191,22 @@ local function applyaxis(glyph,shape,deltas,dowidth) p[2] = p[2] + factor * y end end - elseif width then -- and p == h then - local x = xvalues[d+1] - if x then - width = width + factor * x + elseif dowidth then + -- we've now ran into phantom points which is a bit fuzzy because: + -- are there gaps in there? + -- + -- todo: move this outside the loop (when we can be sure of all 4 being there) + if d == h then + -- we have a phantom point hadvance + local x = xvalues[i] + if x then + dw = dw + factor * x + end + elseif d == l then + local x = xvalues[i] + if x then + dl = dl + factor * x + end end end end @@ -213,10 +226,14 @@ local function applyaxis(glyph,shape,deltas,dowidth) end end end - if width then + if dowidth then local x = xvalues[h] if x then - width = width + factor * x + dw = dw + factor * x + end + local x = xvalues[l] + if x then + dl = dl + factor * x end end end @@ -226,8 +243,10 @@ local function applyaxis(glyph,shape,deltas,dowidth) -- p[1] = round(p[1]) -- p[2] = round(p[2]) -- end - if width then - glyph.width = width + if dowidth then + local width = glyph.width or 0 + -- local lsb = glyph.lsb or 0 + glyph.width = width + dw - dl end else report("no points for glyph %a",glyph.name) @@ -1066,7 +1085,7 @@ function readers.gvar(f,fontdata,specification,glyphdata,shapedata) local data = { } local tuples = { } local glyphdata = fontdata.glyphs - local dowidth = fontdata.variabledata.hvarwidths + local dowidth = not fontdata.variabledata.hvarwidths -- there is one more offset (so that one can calculate the size i suppose) -- so we could test for overflows but we simply assume sane font files if bittest(flags,0x0001) then diff --git a/Master/texmf-dist/tex/context/base/mkiv/math-act.lua b/Master/texmf-dist/tex/context/base/mkiv/math-act.lua index 4fcac17d8a5..ddc7510b1d7 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/math-act.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/math-act.lua @@ -28,6 +28,7 @@ local appendgroup = sequencers.appendgroup local appendaction = sequencers.appendaction local fontchars = fonts.hashes.characters +local fontproperties = fonts.hashes.properties local mathfontparameteractions = sequencers.new { name = "mathparameters", @@ -664,10 +665,20 @@ blocks["uppercasedoublestruck"].gaps = { local stack = { } -function mathematics.registerfallbackid(n,id) +function mathematics.registerfallbackid(n,id,name) + if trace_collecting then + report_math("resolved fallback font %i, name %a, id %a, used %a", + n,name,id,fontproperties[id].fontname) + end stack[#stack][n] = id end +interfaces.implement { -- will be shared with text + name = "registerfontfallbackid", + arguments = { "integer", "integer", "string" }, + actions = mathematics.registerfallbackid, +} + function mathematics.resolvefallbacks(target,specification,fallbacks) local definitions = fonts.collections.definitions[fallbacks] if definitions then @@ -733,8 +744,8 @@ function mathematics.finishfallbacks(target,specification,fallbacks) end if force or (not done[unic] and not characters[unic]) then if trace_collecting then - report_math("replacing math character %C by %C using vector %a and font %a named %a%s%s", - unic,unicode,fallbacks,id,name,check and ", checked",gap and ", gap plugged") + report_math("replacing math character %C by %C using vector %a and font id %a for %a%s%s", + unic,unicode,fallbacks,id,fontproperties[id].fontname,check and ", checked",gap and ", gap plugged") end characters[unic] = copiedglyph(target,characters,chars,unicode,index) done[unic] = true diff --git a/Master/texmf-dist/tex/context/base/mkiv/node-nut.lua b/Master/texmf-dist/tex/context/base/mkiv/node-nut.lua index b23709ff000..7e5c3438bda 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/node-nut.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/node-nut.lua @@ -205,7 +205,9 @@ end if LUATEXVERSION < 1.005 then local getfield = direct.getfield - function direct.getsup(n) return getfield(n,"sup") end + function direct.getnucleus(n) return getfield(n,"nucleus") end + function direct.getsub (n) return getfield(n,"sub") end + function direct.getsup (n) return getfield(n,"sup") end end -- if LUATEXVERSION < 1.004 then diff --git a/Master/texmf-dist/tex/context/base/mkiv/status-files.pdf b/Master/texmf-dist/tex/context/base/mkiv/status-files.pdf Binary files differindex ac51837836f..56ab3aa69cb 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/status-files.pdf +++ b/Master/texmf-dist/tex/context/base/mkiv/status-files.pdf diff --git a/Master/texmf-dist/tex/context/base/mkiv/status-lua.pdf b/Master/texmf-dist/tex/context/base/mkiv/status-lua.pdf Binary files differindex 7e492a7e75b..85a976f7938 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/status-lua.pdf +++ b/Master/texmf-dist/tex/context/base/mkiv/status-lua.pdf diff --git a/Master/texmf-dist/tex/context/interface/mkiv/i-context.pdf b/Master/texmf-dist/tex/context/interface/mkiv/i-context.pdf Binary files differindex 304cdbe33f4..9d3fa3314db 100644 --- a/Master/texmf-dist/tex/context/interface/mkiv/i-context.pdf +++ b/Master/texmf-dist/tex/context/interface/mkiv/i-context.pdf diff --git a/Master/texmf-dist/tex/context/interface/mkiv/i-readme.pdf b/Master/texmf-dist/tex/context/interface/mkiv/i-readme.pdf Binary files differindex 9c05491bc1e..daf6f6248b2 100644 --- a/Master/texmf-dist/tex/context/interface/mkiv/i-readme.pdf +++ b/Master/texmf-dist/tex/context/interface/mkiv/i-readme.pdf diff --git a/Master/texmf-dist/tex/context/modules/mkiv/s-fonts-variable.lua b/Master/texmf-dist/tex/context/modules/mkiv/s-fonts-variable.lua index 2b2aa1dfc35..43f5f0d3d04 100644 --- a/Master/texmf-dist/tex/context/modules/mkiv/s-fonts-variable.lua +++ b/Master/texmf-dist/tex/context/modules/mkiv/s-fonts-variable.lua @@ -18,6 +18,9 @@ local context = context 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 +local show_glyphs = false trackers.register("modules.fonts.variables.glyphs", function(v) show_glyphs = v end) +local show_kerns = false trackers.register("modules.fonts.variables.kerns", function(v) show_kerns = v end) + function moduledata.fonts.variable.showvariations(specification) specification = interfaces.checkedspecification(specification) @@ -237,11 +240,21 @@ end context.startsubject { title = instance } context.start() context.definedfont { "name:" .. instance .. "*default" } + context.start() + if show_glyphs then + context.showglyphs() + end + if show_kerns then + context.showfontkerns() + end if sample and sample ~= "" then context(sample) else context.input("zapf.tex") end + context.stop() + context.blank { "big,samepage"} + context.showfontspacing() context.par() context.stop() context.stopsubject() diff --git a/Master/texmf-dist/tex/context/modules/mkiv/s-fonts-variable.mkiv b/Master/texmf-dist/tex/context/modules/mkiv/s-fonts-variable.mkiv index 6b84c2ebb33..64348b3245b 100644 --- a/Master/texmf-dist/tex/context/modules/mkiv/s-fonts-variable.mkiv +++ b/Master/texmf-dist/tex/context/modules/mkiv/s-fonts-variable.mkiv @@ -26,6 +26,18 @@ \installmodulecommandluasingle \showfontvariations {moduledata.fonts.variable.showvariations} +\unexpanded\def\showfontspacing + {\begingroup + \scratchskip \interwordspace plus \interwordstretch minus \interwordshrink + \normalexpanded{\hpack\bgroup + \tttf + sp: \the\scratchskip \hskip\emwidth + es: \the\extraspace\hskip\emwidth + ex: \the\exheight \hskip\emwidth + em: \the\emwidth \hskip\emwidth + \egroup}% + \endgroup} + \stopmodule \continueifinputfile{s-fonts-variable.mkiv} @@ -34,6 +46,9 @@ \setuphead[section][before={\testpage[5]\blank[2*big]}] +\enabletrackers[modules.fonts.variables.glyphs] +\enabletrackers[modules.fonts.variables.kerns] + \starttext \startbuffer[zycon] @@ -57,8 +72,9 @@ \char983040\relax\par \stopbuffer -% \showfontkerns -% \showglyphs +% \showfontvariations +% [font=file:VotoSerifGX.ttf, +% max=6] \showfontvariations [font=file:adobevfprototype.otf] |