From f7430075a5d36ba3731ab77b157f6df498ef17e8 Mon Sep 17 00:00:00 2001 From: Marius Date: Thu, 16 Jun 2011 14:00:12 +0300 Subject: beta 2011.06.16 12:50 --- scripts/context/lua/mtx-fonts.lua | 19 +++++++++++ tex/context/base/cont-new.mkii | 2 +- tex/context/base/cont-new.mkiv | 2 +- tex/context/base/context.mkii | 2 +- tex/context/base/context.mkiv | 2 +- tex/context/base/export-example.tex | 4 +-- tex/context/base/font-mis.lua | 2 +- tex/context/base/font-otf.lua | 33 +++++++++++------- tex/context/base/font-otn.lua | 16 +++++---- tex/context/base/status-files.pdf | Bin 23629 -> 23636 bytes tex/context/base/status-lua.pdf | Bin 155951 -> 155951 bytes tex/context/base/strc-flt.mkiv | 20 ++++++++--- tex/generic/context/luatex-fonts-merged.lua | 51 ++++++++++++++++------------ 13 files changed, 100 insertions(+), 53 deletions(-) diff --git a/scripts/context/lua/mtx-fonts.lua b/scripts/context/lua/mtx-fonts.lua index 8c8f47a70..90fa1b03e 100644 --- a/scripts/context/lua/mtx-fonts.lua +++ b/scripts/context/lua/mtx-fonts.lua @@ -334,6 +334,23 @@ function scripts.fonts.list() end +function scripts.fonts.unpack() + local name = file.removesuffix(file.basename(environment.files[1] or "")) + if name and name ~= "" then + local cache = containers.define("fonts", "otf", 2.730, true) + local cleanname = containers.cleanname(name) + local data = containers.read(cache,cleanname) + if data then + local savename = file.addsuffix(cleanname .. "-unpacked","tma") + report("fontsave, saving data in %s",savename) + fonts.handlers.otf.enhancers.unpack(data) + io.savedata(savename,table.serialize(data,true)) + else + report("unknown file '%s'",name) + end + end +end + function scripts.fonts.save() local name = environment.files[1] or "" local sub = environment.files[2] or "" @@ -387,6 +404,8 @@ elseif environment.argument("reload") then scripts.fonts.reload() elseif environment.argument("save") then scripts.fonts.save() +elseif environment.argument("unpack") then + scripts.fonts.unpack() elseif environment.argument("statistics") then fonts.names.statistics() else diff --git a/tex/context/base/cont-new.mkii b/tex/context/base/cont-new.mkii index dc6ae455a..ba30f0046 100644 --- a/tex/context/base/cont-new.mkii +++ b/tex/context/base/cont-new.mkii @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2011.06.16 00:34} +\newcontextversion{2011.06.16 12:50} %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/cont-new.mkiv b/tex/context/base/cont-new.mkiv index 8a183de5c..590e9a6fa 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{2011.06.16 00:34} +\newcontextversion{2011.06.16 12:50} %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/context.mkii b/tex/context/base/context.mkii index 124d3e62c..674f1e702 100644 --- a/tex/context/base/context.mkii +++ b/tex/context/base/context.mkii @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2011.06.16 00:34} +\edef\contextversion{2011.06.16 12:50} %D For those who want to use this: diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv index 2980629a6..f5c4c4c90 100644 --- a/tex/context/base/context.mkiv +++ b/tex/context/base/context.mkiv @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2011.06.16 00:34} +\edef\contextversion{2011.06.16 12:50} %D For those who want to use this: diff --git a/tex/context/base/export-example.tex b/tex/context/base/export-example.tex index 8584d74a5..6181c9125 100644 --- a/tex/context/base/export-example.tex +++ b/tex/context/base/export-example.tex @@ -17,8 +17,6 @@ \startchapter[title=Example] -\typefile{export.tex} - \startparagraph \input zapf (Zapf) \stopparagraph \placefigure @@ -66,6 +64,8 @@ Okay, it's somewhat boring to always use the same formula, so how about $\sqrt{4} = 2$ or traveling at \unit{120 km/h} instead of $\unit{110 km/h}$. \stopparagraph +\typefile{export-example.tex} + \stopchapter \stoptext diff --git a/tex/context/base/font-mis.lua b/tex/context/base/font-mis.lua index 198293ba1..03a8c73ae 100644 --- a/tex/context/base/font-mis.lua +++ b/tex/context/base/font-mis.lua @@ -22,7 +22,7 @@ local handlers = fonts.handlers handlers.otf = handlers.otf or { } local otf = handlers.otf -otf.version = otf.version or 2.730 +otf.version = otf.version or 2.731 otf.cache = otf.cache or containers.define("fonts", "otf", otf.version, true) function otf.loadcached(filename,format,sub) diff --git a/tex/context/base/font-otf.lua b/tex/context/base/font-otf.lua index 29735dee0..ebcdea958 100644 --- a/tex/context/base/font-otf.lua +++ b/tex/context/base/font-otf.lua @@ -47,7 +47,7 @@ local otf = fonts.handlers.otf otf.glists = { "gsub", "gpos" } -otf.version = 2.730 -- beware: also sync font-mis.lua +otf.version = 2.731 -- beware: also sync font-mis.lua otf.cache = containers.define("fonts", "otf", otf.version, true) local fontdata = fonts.hashes.identifiers @@ -959,6 +959,15 @@ actions["prepare tounicode"] = function(data,filename,raw) fonts.mappings.addtounicode(data,filename) end +local g_directions = { + gsub_contextchain = 1, + gpos_contextchain = 1, + -- gsub_context = 1, + -- gpos_context = 1, + gsub_reversecontextchain = -1, + gpos_reversecontextchain = -1, +} + actions["reorganize subtables"] = function(data,filename,raw) local resources = data.resources local sequences = { } @@ -972,10 +981,7 @@ actions["reorganize subtables"] = function(data,filename,raw) for k=1,#dw do local gk = dw[k] local typ = gk.type - local chain = - (typ == "gsub_contextchain" or typ == "gpos_contextchain") and 1 or - (typ == "gsub_reversecontextchain" or typ == "gpos_reversecontextchain") and -1 or 0 - -- + local chain = g_directions[typ] or 0 local subtables = gk.subtables if subtables then local t = { } @@ -1077,19 +1083,20 @@ end local function t_hashed(t,cache) if t then - local h = { } + local ht = { } for i=1,#t do local ti = t[i] - local h = cache[ti] - if not h then - h = { } + local tih = cache[ti] + if not tih then + tih = { } for i=1,#ti do - h[ti] = true + tih[ti[i]] = true end + cache[ti] = tih end - cache[ti] = h + ht[i] = tih end - return h + return ht else return nil end @@ -1173,7 +1180,7 @@ actions["reorganize lookups"] = function(data,filename,raw) for i=1,#current do current[i] = current_class[current[i]] or { } if lookups and not lookups[i] then - lookups[i] = false + lookups[i] = false -- e.g. we can have two lookups and one replacement end end rule.current = t_hashed(current,h_cache) diff --git a/tex/context/base/font-otn.lua b/tex/context/base/font-otn.lua index 81b3fd267..0d11d3a8b 100644 --- a/tex/context/base/font-otn.lua +++ b/tex/context/base/font-otn.lua @@ -1760,8 +1760,8 @@ local function normal_handle_contextchain(start,kind,chainname,contexts,sequence end end local chainlookupname = chainlookups[i] - local chainlookup = lookuptable[chainlookupname] - local cp = chainmores[chainlookup.type] + local chainlookup = lookuptable[chainlookupname] -- can be false (n matches,