From 0835bc2af23d2631e986caef886337d9694b730f Mon Sep 17 00:00:00 2001 From: Context Git Mirror Bot Date: Sun, 17 Apr 2016 12:13:37 +0200 Subject: 2016-04-17 12:00:00 --- scripts/context/lua/mtx-server-ctx-help.lua | 1 - tex/context/base/context-version.pdf | Bin 4251 -> 4249 bytes tex/context/base/mkiv/cont-new.mkiv | 2 +- tex/context/base/mkiv/context.mkiv | 2 +- tex/context/base/mkiv/font-map.lua | 103 +++--------- tex/context/base/mkiv/font-otr.lua | 6 +- tex/context/base/mkiv/font-ots.lua | 4 +- tex/context/base/mkiv/font-oup.lua | 78 +++++++++ tex/context/base/mkiv/mult-def.lua | 23 +++ tex/context/base/mkiv/status-files.pdf | Bin 9126 -> 9196 bytes tex/context/base/mkiv/status-lua.pdf | Bin 267904 -> 267894 bytes tex/context/interface/mkiv/i-context.pdf | Bin 797034 -> 797044 bytes tex/context/interface/mkiv/i-readme.pdf | Bin 60791 -> 60793 bytes tex/generic/context/luatex/luatex-fonts-merged.lua | 180 ++++++++++++--------- 14 files changed, 232 insertions(+), 167 deletions(-) diff --git a/scripts/context/lua/mtx-server-ctx-help.lua b/scripts/context/lua/mtx-server-ctx-help.lua index 0a3081428..a67d69ffd 100644 --- a/scripts/context/lua/mtx-server-ctx-help.lua +++ b/scripts/context/lua/mtx-server-ctx-help.lua @@ -563,7 +563,6 @@ local function generate(configuration,filename,hashed) elseif lastcommand and lastcommand ~= "" then - local list = collect(current,lastcommand,lastinterface,lastmode) if list and #list > 0 then local data = list[1] diff --git a/tex/context/base/context-version.pdf b/tex/context/base/context-version.pdf index dcd95477a..29b499468 100644 Binary files a/tex/context/base/context-version.pdf and b/tex/context/base/context-version.pdf differ diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv index c5b7003fc..381f35eb7 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.04.16 15:27} +\newcontextversion{2016.04.17 11:56} %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 02f56afe0..e30d06432 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.04.16 15:27} +\edef\contextversion{2016.04.17 11:56} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/mkiv/font-map.lua b/tex/context/base/mkiv/font-map.lua index ce84ca692..db501f0b6 100644 --- a/tex/context/base/mkiv/font-map.lua +++ b/tex/context/base/mkiv/font-map.lua @@ -437,95 +437,42 @@ function mappings.addtounicode(data,filename,checklookups) if type(checklookups) == "function" then checklookups(data,missing,nofmissing) end + -- todo: go lowercase - local unset = { } - for unic, glyph in next, descriptions do + local collected = false + local unicoded = 0 + for unicode, glyph in next, descriptions do if not glyph.unicode and glyph.class == "ligature" then - unset[unic] = glyph - end - end - if next(unset) then - local sequences = resources.sequences - local collected = { } - for i=1,#sequences do - local sequence = sequences[i] - if sequence.type == "gsub_ligature" then - local steps = sequence.steps - if steps then - local l = { } - local function traverse(p,k,v) - if k == "ligature" then - collected[v] = { unpack(l) } - else - table.insert(l,k) - for k, vv in next, v do - traverse(p,k,vv) - end - table.remove(l) - end - end - for i=1,#steps do - -- we actually had/have this in base mode - local coverage = steps[i].coverage - if coverage then - for k, v in next, coverage do - traverse(k,k,v) - end - end - end + if not collected then + collected = fonts.handlers.otf.readers.getcomponents(data) + if not collected then + break end end - end - if next(collected) then - while true do - local done = false - for k, v in next, collected do - for i=1,#v do - local vi = v[i] - if vi == k then - collected[k] = nil - unset[k] = nil - else - local c = collected[vi] - if c then - done = true - local t = { } - local n = i - 1 - for j=1,n do - t[j] = t[j] - end - for j=1,#c do - n = n + 1 - t[n] = c[j] - end - for j=i+1,#v do - n = n + 1 - t[n] = t[j] - end - collected[k] = t - break - end - end + local u = collected[unicode] -- always tables + if u then + local n = #u + for i=1,n do + if u[i] > private then + n = 0 + break end end - if not done then - break - end - end - local n = 0 - for k, v in next, unset do - u = collected[k] - if u then - v.unicode = u - n = n + 1 + if n > 0 then + if n > 1 then + glyph.unicode = u + else + glyph.unicode = u[1] + end + unicoded = unicoded + 1 end end - if trace_mapping and n > 0 then - report_fonts("%n ligature tounicode mappings deduced from gsub ligature feaures",n) - end end end + if trace_mapping and unicoded > 0 then + report_fonts("%n ligature tounicode mappings deduced from gsub ligature features",unicoded) + end if trace_mapping then for unic, glyph in table.sortedhash(descriptions) do diff --git a/tex/context/base/mkiv/font-otr.lua b/tex/context/base/mkiv/font-otr.lua index c5f3d563a..7226907ca 100644 --- a/tex/context/base/mkiv/font-otr.lua +++ b/tex/context/base/mkiv/font-otr.lua @@ -21,10 +21,6 @@ if not modules then modules = { } end modules ['font-otr'] = { -- compatible output as well (We're not that far from it as currently I can load -- all data reasonable fast.) --- This code is not yet ready for generic i.e. I want to be free to change the --- keys and values. Especially the gpos/gsub/gdef/math needs checking (this --- is implemented in font-dsp.lua). - -- We can omit redundant glyphs names i.e. ones that match the agl or -- are just a unicode string but it doesn't save that much. It will be an option -- some day. @@ -2146,7 +2142,7 @@ function readers.getinfo(filename,specification) -- string, nil|number|table -- platformnames is optional and not used by context (a too unpredictable mess -- that only add to the confusion) .. so it's only for checking things local subfont = nil - local platformname = false + local platformnames = false local rawfamilynames = false if type(specification) == "table" then subfont = tonumber(specification.subfont) diff --git a/tex/context/base/mkiv/font-ots.lua b/tex/context/base/mkiv/font-ots.lua index 2e648c0c8..c3e1f48bd 100644 --- a/tex/context/base/mkiv/font-ots.lua +++ b/tex/context/base/mkiv/font-ots.lua @@ -22,8 +22,8 @@ if not modules then modules = { } end modules ['font-ots'] = { -- sequences -- -- This is a version of font-otn.lua adapted to the new font loader code. It -- is a context version which can contain experimental code, but when we --- have serious patches we will backport to the font-otn files. There will --- be a generic variant too. +-- have serious patches we will backport to the font-otn files. The plain +-- loader that ships with context also uses this now. -- -- todo: looks like we have a leak somewhere (probably in ligatures) -- todo: copy attributes to disc diff --git a/tex/context/base/mkiv/font-oup.lua b/tex/context/base/mkiv/font-oup.lua index b184a7f7f..59530af06 100644 --- a/tex/context/base/mkiv/font-oup.lua +++ b/tex/context/base/mkiv/font-oup.lua @@ -736,6 +736,83 @@ local function stripredundant(fontdata) end end +function readers.getcomponents(fontdata) -- handy for resolving ligatures when names are missing + local resources = fontdata.resources + local descriptions = fontdata.descriptions + if resources then + local sequences = resources.sequences + if sequences then + local collected = { } + for i=1,#sequences do + local sequence = sequences[i] + if sequence.type == "gsub_ligature" then + local steps = sequence.steps + if steps then + local l = { } + local function traverse(p,k,v) + if k == "ligature" then + collected[v] = { unpack(l) } + else + insert(l,k) + for k, vv in next, v do + traverse(p,k,vv) + end + remove(l) + end + end + for i=1,#steps do + -- we actually had/have this in base mode + local coverage = steps[i].coverage + if coverage then + for k, v in next, coverage do + traverse(k,k,v) + end + end + end + end + end + end + if next(collected) then + while true do + local done = false + for k, v in next, collected do + for i=1,#v do + local vi = v[i] + if vi == k then + collected[k] = nil + else + local c = collected[vi] + if c then + done = true + local t = { } + local n = i - 1 + for j=1,n do + t[j] = t[j] + end + for j=1,#c do + n = n + 1 + t[n] = c[j] + end + for j=i+1,#v do + n = n + 1 + t[n] = t[j] + end + collected[k] = t + break + end + end + end + end + if not done then + break + end + end + return collected + end + end + end +end + function readers.rehash(fontdata,hashmethod) -- TODO: combine loops in one if not (fontdata and fontdata.glyphs) then return @@ -757,6 +834,7 @@ function readers.rehash(fontdata,hashmethod) -- TODO: combine loops in one unifymissing(fontdata) stripredundant(fontdata) end + -- maybe here components end function readers.checkhash(fontdata) diff --git a/tex/context/base/mkiv/mult-def.lua b/tex/context/base/mkiv/mult-def.lua index 332f3d230..0d0c30c30 100644 --- a/tex/context/base/mkiv/mult-def.lua +++ b/tex/context/base/mkiv/mult-def.lua @@ -17254,6 +17254,15 @@ return { ["nl"]="file", ["ro"]="file", }, + ["cd:path"]={ + ["cs"]="path", + ["de"]="path", + ["en"]="path", + ["fr"]="path", + ["it"]="path", + ["nl"]="path", + ["ro"]="path", + }, ["cd:first"]={ ["cs"]="first", ["de"]="first", @@ -17698,5 +17707,19 @@ return { ["cd:assignmentparentheses-l"] = { en = "(..,..=..,..)" }, ["cd:apply-s"] = { en = "[..=>..]" }, ["cd:apply-l"] = { en = "[..,..=>..,..]" }, + ["cd:if-s"] = { en = "\\if... " }, + ["cd:if-l"] = { en = "\\if... " }, + ["cd:case-s"] = { en = "\\case " }, + ["cd:case-l"] = { en = "\\case " }, + ["cd:else-s"] = { en = "\\else " }, + ["cd:else-l"] = { en = "\\else " }, + ["cd:or-s"] = { en = "\\or " }, + ["cd:or-l"] = { en = "\\or " }, + ["cd:fi-s"] = { en = "\\fi " }, + ["cd:fi-l"] = { en = "\\fi " }, + ["cd:par-s"] = { en = "\\par " }, + ["cd:par-l"] = { en = "\\par " }, + ["cd:sep-s"] = { en = "\\" }, + ["cd:sep-l"] = { en = "\\" }, } } diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf index d775f0087..34a6ec049 100644 Binary files a/tex/context/base/mkiv/status-files.pdf and b/tex/context/base/mkiv/status-files.pdf differ diff --git a/tex/context/base/mkiv/status-lua.pdf b/tex/context/base/mkiv/status-lua.pdf index 2d597ef30..1c52234ba 100644 Binary files a/tex/context/base/mkiv/status-lua.pdf and b/tex/context/base/mkiv/status-lua.pdf differ diff --git a/tex/context/interface/mkiv/i-context.pdf b/tex/context/interface/mkiv/i-context.pdf index 7149f966c..9a07f9e50 100644 Binary files a/tex/context/interface/mkiv/i-context.pdf and b/tex/context/interface/mkiv/i-context.pdf differ diff --git a/tex/context/interface/mkiv/i-readme.pdf b/tex/context/interface/mkiv/i-readme.pdf index e4273d667..b5001749e 100644 Binary files a/tex/context/interface/mkiv/i-readme.pdf and b/tex/context/interface/mkiv/i-readme.pdf differ diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 24729032d..0d22a7390 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/16/16 15:27:56 +-- merge date : 04/17/16 11:56:26 do -- begin closure to overcome local limits and interference @@ -6673,92 +6673,39 @@ function mappings.addtounicode(data,filename,checklookups) if type(checklookups)=="function" then checklookups(data,missing,nofmissing) end - local unset={} - for unic,glyph in next,descriptions do + local collected=false + local unicoded=0 + for unicode,glyph in next,descriptions do if not glyph.unicode and glyph.class=="ligature" then - unset[unic]=glyph - end - end - if next(unset) then - local sequences=resources.sequences - local collected={} - for i=1,#sequences do - local sequence=sequences[i] - if sequence.type=="gsub_ligature" then - local steps=sequence.steps - if steps then - local l={} - local function traverse(p,k,v) - if k=="ligature" then - collected[v]={ unpack(l) } - else - table.insert(l,k) - for k,vv in next,v do - traverse(p,k,vv) - end - table.remove(l) - end - end - for i=1,#steps do - local coverage=steps[i].coverage - if coverage then - for k,v in next,coverage do - traverse(k,k,v) - end - end - end + if not collected then + collected=fonts.handlers.otf.readers.getcomponents(data) + if not collected then + break end end - end - if next(collected) then - while true do - local done=false - for k,v in next,collected do - for i=1,#v do - local vi=v[i] - if vi==k then - collected[k]=nil - unset[k]=nil - else - local c=collected[vi] - if c then - done=true - local t={} - local n=i-1 - for j=1,n do - t[j]=t[j] - end - for j=1,#c do - n=n+1 - t[n]=c[j] - end - for j=i+1,#v do - n=n+1 - t[n]=t[j] - end - collected[k]=t - break - end - end + 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 not done then - break - end - end - local n=0 - for k,v in next,unset do - u=collected[k] - if u then - v.unicode=u - n=n+1 + if n>0 then + if n>1 then + glyph.unicode=u + else + glyph.unicode=u[1] + end + unicoded=unicoded+1 end end - if trace_mapping and n>0 then - report_fonts("%n ligature tounicode mappings deduced from gsub ligature feaures",n) - end end end + if trace_mapping and unicoded>0 then + report_fonts("%n ligature tounicode mappings deduced from gsub ligature features",unicoded) + end if trace_mapping then for unic,glyph in table.sortedhash(descriptions) do local name=glyph.name @@ -9696,7 +9643,7 @@ function readers.loadfont(filename,n) end function readers.getinfo(filename,specification) local subfont=nil - local platformname=false + local platformnames=false local rawfamilynames=false if type(specification)=="table" then subfont=tonumber(specification.subfont) @@ -14220,6 +14167,81 @@ local function stripredundant(fontdata) end end end +function readers.getcomponents(fontdata) + local resources=fontdata.resources + local descriptions=fontdata.descriptions + if resources then + local sequences=resources.sequences + if sequences then + local collected={} + for i=1,#sequences do + local sequence=sequences[i] + if sequence.type=="gsub_ligature" then + local steps=sequence.steps + if steps then + local l={} + local function traverse(p,k,v) + if k=="ligature" then + collected[v]={ unpack(l) } + else + insert(l,k) + for k,vv in next,v do + traverse(p,k,vv) + end + remove(l) + end + end + for i=1,#steps do + local coverage=steps[i].coverage + if coverage then + for k,v in next,coverage do + traverse(k,k,v) + end + end + end + end + end + end + if next(collected) then + while true do + local done=false + for k,v in next,collected do + for i=1,#v do + local vi=v[i] + if vi==k then + collected[k]=nil + else + local c=collected[vi] + if c then + done=true + local t={} + local n=i-1 + for j=1,n do + t[j]=t[j] + end + for j=1,#c do + n=n+1 + t[n]=c[j] + end + for j=i+1,#v do + n=n+1 + t[n]=t[j] + end + collected[k]=t + break + end + end + end + end + if not done then + break + end + end + return collected + end + end + end +end function readers.rehash(fontdata,hashmethod) if not (fontdata and fontdata.glyphs) then return -- cgit v1.2.3