summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--scripts/context/lua/mtx-fonts.lua19
-rw-r--r--tex/context/base/cont-new.mkii2
-rw-r--r--tex/context/base/cont-new.mkiv2
-rw-r--r--tex/context/base/context.mkii2
-rw-r--r--tex/context/base/context.mkiv2
-rw-r--r--tex/context/base/export-example.tex4
-rw-r--r--tex/context/base/font-mis.lua2
-rw-r--r--tex/context/base/font-otf.lua33
-rw-r--r--tex/context/base/font-otn.lua16
-rw-r--r--tex/context/base/status-files.pdfbin23629 -> 23636 bytes
-rw-r--r--tex/context/base/status-lua.pdfbin155951 -> 155951 bytes
-rw-r--r--tex/context/base/strc-flt.mkiv20
-rw-r--r--tex/generic/context/luatex-fonts-merged.lua51
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, <n replacement)
+ local cp = chainlookup and chainmores[chainlookup.type]
if cp then
local ok, n
start, ok, n = cp(start,last,kind,chainname,ck,lookuphash,chainlookup,chainlookupname,i,sequence)
@@ -1774,7 +1774,8 @@ local function normal_handle_contextchain(start,kind,chainname,contexts,sequence
i = i + 1
end
else
- logprocess("%s: multiple subchains for %s are not yet supported",cref(kind,chainname,chainlookupname),chainlookup.type)
+ -- is valid
+ -- logprocess("%s: multiple subchains for %s are not yet supported",cref(kind,chainname,chainlookupname),chainlookup and chainlookup.type or "?")
i = i + 1
end
start = start.next
@@ -1957,8 +1958,7 @@ local function featuresprocessor(head,font,attr)
featurevalue = dataset and dataset[1] -- todo: pass to function instead of using a global
if featurevalue then
local attribute, chain, typ, subtables = dataset[2], dataset[3], sequence.type, sequence.subtables
---~ print(typ)
---~ table.print(table.keys(sequence))
+--~ inspect(sequence)
if chain < 0 then
-- this is a limited case, no special treatments like 'init' etc
local handler = handlers[typ]
@@ -2009,7 +2009,8 @@ local function featuresprocessor(head,font,attr)
if ns == 1 then
local lookupname = subtables[1]
local lookupcache = lookuphash[lookupname]
- if not lookupcache then
+--~ inspect(lookupcache)
+ if not lookupcache then -- also check for empty cache
report_missing_cache(typ,lookupname)
else
while start do
@@ -2022,6 +2023,7 @@ local function featuresprocessor(head,font,attr)
else
a = not attribute or has_attribute(start,state,attribute)
end
+--~ print(a,start.char)
if a then
local lookupmatch = lookupcache[start.char]
if lookupmatch then
@@ -2502,7 +2504,7 @@ end
--~ end
local valid = {
- coverage = { chainsub = true, chainpos = true },
+ coverage = { chainsub = true, chainpos = true, contextsub = true },
reversecoverage = { reversesub = true },
glyphs = { chainsub = true, chainpos = true },
}
diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf
index 32bfa2650..41307afde 100644
--- a/tex/context/base/status-files.pdf
+++ b/tex/context/base/status-files.pdf
Binary files differ
diff --git a/tex/context/base/status-lua.pdf b/tex/context/base/status-lua.pdf
index cbce48dac..465b798c1 100644
--- a/tex/context/base/status-lua.pdf
+++ b/tex/context/base/status-lua.pdf
Binary files differ
diff --git a/tex/context/base/strc-flt.mkiv b/tex/context/base/strc-flt.mkiv
index 9d0b5b0d7..4d3689b3c 100644
--- a/tex/context/base/strc-flt.mkiv
+++ b/tex/context/base/strc-flt.mkiv
@@ -1233,12 +1233,22 @@
\ifdefined\moveboxontogrid\else \let\movecaptionontogrid\gobblethreearguments \fi
+% \def\locatefloatbox
+% {\alignstrutmode\zerocount
+% \shiftalignedline
+% {\floatparameter\c!leftmargin }{\floatparameter\c!rightmargin}%
+% {\floatparameter\c!innermargin}{\floatparameter\c!outermargin}%
+% \alignedline{\floatparameter\c!location}\v!middle}
+%
+% A quick hack by WS:
+
\def\locatefloatbox
- {\alignstrutmode\zerocount
- \shiftalignedline
- {\floatparameter\c!leftmargin }{\floatparameter\c!rightmargin}%
- {\floatparameter\c!innermargin}{\floatparameter\c!outermargin}%
- \alignedline{\floatparameter\c!location}\v!middle}
+ {\alignstrutmode\zerocount
+ \doifnotcommon{\floatcaptionparameter\c!location}{\v!outermargin,\v!innermargin,\v!leftmargin,\v!rightmargin}
+ {\shiftalignedline
+ {\floatparameter\c!leftmargin }{\floatparameter\c!rightmargin}%
+ {\floatparameter\c!innermargin}{\floatparameter\c!outermargin}}%
+ \alignedline{\floatparameter\c!location}\v!middle}
\def\locatecaptionbox
{\alignstrutmode\zerocount
diff --git a/tex/generic/context/luatex-fonts-merged.lua b/tex/generic/context/luatex-fonts-merged.lua
index 831a39164..d2e14b55d 100644
--- a/tex/generic/context/luatex-fonts-merged.lua
+++ b/tex/generic/context/luatex-fonts-merged.lua
@@ -1,6 +1,6 @@
-- merged file : luatex-fonts-merged.lua
-- parent file : luatex-fonts.lua
--- merge date : 06/16/11 00:34:14
+-- merge date : 06/16/11 12:50:49
do -- begin closure to overcome local limits and interference
@@ -4915,7 +4915,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
@@ -5827,6 +5827,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 = { }
@@ -5840,10 +5849,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 = { }
@@ -5945,19 +5951,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
@@ -6041,7 +6048,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)
@@ -9696,8 +9703,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, <n replacement)
+ local cp = chainlookup and chainmores[chainlookup.type]
if cp then
local ok, n
start, ok, n = cp(start,last,kind,chainname,ck,lookuphash,chainlookup,chainlookupname,i,sequence)
@@ -9710,7 +9717,8 @@ local function normal_handle_contextchain(start,kind,chainname,contexts,sequence
i = i + 1
end
else
- logprocess("%s: multiple subchains for %s are not yet supported",cref(kind,chainname,chainlookupname),chainlookup.type)
+ -- is valid
+ -- logprocess("%s: multiple subchains for %s are not yet supported",cref(kind,chainname,chainlookupname),chainlookup and chainlookup.type or "?")
i = i + 1
end
start = start.next
@@ -9893,8 +9901,7 @@ local function featuresprocessor(head,font,attr)
featurevalue = dataset and dataset[1] -- todo: pass to function instead of using a global
if featurevalue then
local attribute, chain, typ, subtables = dataset[2], dataset[3], sequence.type, sequence.subtables
---~ print(typ)
---~ table.print(table.keys(sequence))
+--~ inspect(sequence)
if chain < 0 then
-- this is a limited case, no special treatments like 'init' etc
local handler = handlers[typ]
@@ -9945,7 +9952,8 @@ local function featuresprocessor(head,font,attr)
if ns == 1 then
local lookupname = subtables[1]
local lookupcache = lookuphash[lookupname]
- if not lookupcache then
+--~ inspect(lookupcache)
+ if not lookupcache then -- also check for empty cache
report_missing_cache(typ,lookupname)
else
while start do
@@ -9958,6 +9966,7 @@ local function featuresprocessor(head,font,attr)
else
a = not attribute or has_attribute(start,state,attribute)
end
+--~ print(a,start.char)
if a then
local lookupmatch = lookupcache[start.char]
if lookupmatch then
@@ -10438,7 +10447,7 @@ end
--~ end
local valid = {
- coverage = { chainsub = true, chainpos = true },
+ coverage = { chainsub = true, chainpos = true, contextsub = true },
reversecoverage = { reversesub = true },
glyphs = { chainsub = true, chainpos = true },
}