summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2011-02-08 18:41:00 +0100
committerHans Hagen <pragma@wxs.nl>2011-02-08 18:41:00 +0100
commit631393e12fad038adbe9ab8408b89a7b5335820c (patch)
treec7b8f5e93fbf92550917b3235cff6f669ca5db01
parent94397b74482b88818f737145af99c883802210d7 (diff)
downloadcontext-631393e12fad038adbe9ab8408b89a7b5335820c.tar.gz
beta 2011.02.08 18:41
-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/font-def.lua8
-rw-r--r--tex/context/base/font-gds.lua77
-rw-r--r--tex/context/base/font-tfm.lua3
-rw-r--r--tex/context/base/status-files.pdfbin23266 -> 23258 bytes
-rw-r--r--tex/context/fonts/demo.lfg25
-rw-r--r--tex/generic/context/luatex-fonts-merged.lua13
10 files changed, 117 insertions, 17 deletions
diff --git a/tex/context/base/cont-new.mkii b/tex/context/base/cont-new.mkii
index 03427c7fa..66505ff4e 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.02.08 17:08}
+\newcontextversion{2011.02.08 18:41}
%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 a648f186a..4ad3f18d3 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.02.08 17:08}
+\newcontextversion{2011.02.08 18:41}
%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 2bf65c51f..07832d91e 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.02.08 17:08}
+\edef\contextversion{2011.02.08 18:41}
%D For those who want to use this:
diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv
index 040a93f6b..86588ab88 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.02.08 17:08}
+\edef\contextversion{2011.02.08 18:41}
%D For those who want to use this:
diff --git a/tex/context/base/font-def.lua b/tex/context/base/font-def.lua
index 678f7feed..09b23f8dc 100644
--- a/tex/context/base/font-def.lua
+++ b/tex/context/base/font-def.lua
@@ -368,6 +368,14 @@ function tfm.read(specification)
else
tfmtable.embedding = "subset"
end
+ -- fonts.goodies.postprocessors.apply(tfmdata) -- only here
+ local postprocessors = tfmtable.postprocessors
+ if postprocessors then
+ for i=1,#postprocessors do
+ postprocessors[i](tfmtable) -- after scaling etc
+ end
+ end
+ --
tfm.fonts[hash] = tfmtable
fonts.designsizes[specification.hash] = tfmtable.designsize -- we only know this for sure after loading once
--~ tfmtable.mode = specification.features.normal.mode or "base"
diff --git a/tex/context/base/font-gds.lua b/tex/context/base/font-gds.lua
index 21833ace9..048eecd12 100644
--- a/tex/context/base/font-gds.lua
+++ b/tex/context/base/font-gds.lua
@@ -171,6 +171,52 @@ local function setfeatureset(tfmdata,set)
end
end
+-- postprocessors (we could hash processor and share code)
+
+local function setpostprocessor(tfmdata,processor)
+ local goodies = tfmdata.goodies
+ if goodies and type(processor) == "string" then
+ local found = { }
+ local asked = utilities.parsers.settings_to_array(processor)
+ for i=1,#goodies do
+ local g = goodies[i]
+ local p = g.postprocessors
+ if p then
+ for i=1,#asked do
+ local a = asked[i]
+ local f = p[a]
+ if type(f) == "function" then
+ found[a] = f
+ end
+ end
+ end
+ end
+ local postprocessors = { }
+ for i=1,#asked do
+ local a = asked[i]
+ local f = found[a]
+ if f then
+ postprocessors[#postprocessors+1] = f
+ end
+ end
+ if #postprocessors > 0 then
+ tfmdata.postprocessors = postprocessors
+ end
+ end
+end
+
+-- fontgoodies.postprocessors = fontgoodies.postprocessors or { }
+-- local postprocessors = fontgoodies.postprocessors
+
+-- function postprocessors.apply(tfmdata)
+-- local postprocessors = tfmdata.postprocessors
+-- if postprocessors then
+-- for i=1,#postprocessors do
+-- postprocessors[i](tfmdata)
+-- end
+-- end
+-- end
+
-- colorschemes
fontgoodies.colorschemes = fontgoodies.colorschemes or { }
@@ -246,35 +292,44 @@ end
-- installation (collected to keep the overview) -- also for type 1
-fonts.otf.tables.features['goodies'] = 'Goodies on top of built in features'
-fonts.otf.tables.features['featureset'] = 'Goodie Feature Set'
-fonts.otf.tables.features['colorscheme'] = 'Goodie Color Scheme'
+fonts.otf.tables.features['goodies'] = 'Goodies on top of built in features'
+fonts.otf.tables.features['featureset'] = 'Goodie Feature Set'
+fonts.otf.tables.features['colorscheme'] = 'Goodie Color Scheme'
+fonts.otf.tables.features['postprocessor'] = 'Goodie Postprocessor'
fonts.otf.features.register('goodies')
fonts.otf.features.register('featureset')
fonts.otf.features.register('colorscheme')
+fonts.otf.features.register('postprocessor')
table.insert(fonts.triggers, 1, "goodies")
table.insert(fonts.triggers, 2, "featureset") -- insert after
table.insert(fonts.triggers, "colorscheme")
+table.insert(fonts.triggers, "postprocessor")
local base_initializers = fonts.initializers.base.otf
local node_initializers = fonts.initializers.node.otf
-base_initializers.goodies = setgoodies
-node_initializers.goodies = setgoodies
+base_initializers.goodies = setgoodies
+node_initializers.goodies = setgoodies
-base_initializers.featureset = setfeatureset
-node_initializers.featureset = setfeatureset
+base_initializers.featureset = setfeatureset
+node_initializers.featureset = setfeatureset
-base_initializers.colorscheme = setcolorscheme
-node_initializers.colorscheme = setcolorscheme
+base_initializers.colorscheme = setcolorscheme
+node_initializers.colorscheme = setcolorscheme
+
+base_initializers.postprocessor = setpostprocessor
+node_initializers.postprocessor = setpostprocessor
local base_initializers = fonts.initializers.base.afm
local node_initializers = fonts.initializers.node.afm
-base_initializers.goodies = setgoodies
-node_initializers.goodies = setgoodies
+base_initializers.goodies = setgoodies
+node_initializers.goodies = setgoodies
+
+base_initializers.postprocessor = setpostprocessor
+node_initializers.postprocessor = setpostprocessor
-- experiment, we have to load the definitions immediately as they precede
-- the definition so they need to be initialized in the typescript
diff --git a/tex/context/base/font-tfm.lua b/tex/context/base/font-tfm.lua
index ece478502..d7cd0c15e 100644
--- a/tex/context/base/font-tfm.lua
+++ b/tex/context/base/font-tfm.lua
@@ -322,8 +322,11 @@ function tfm.scale(tfmtable, scaledpoints, relativeid)
t.unicodes = tfmtable.unicodes
t.indices = tfmtable.indices
t.marks = tfmtable.marks
+ -- this will move to some subtable so that it is copied at once
t.goodies = tfmtable.goodies
t.colorscheme = tfmtable.colorscheme
+ t.postprocessors = tfmtable.postprocessors
+ --
-- t.embedding = tfmtable.embedding
t.descriptions = descriptions
if tfmtable.fonts then
diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf
index e4f845c7a..3df8fa58d 100644
--- a/tex/context/base/status-files.pdf
+++ b/tex/context/base/status-files.pdf
Binary files differ
diff --git a/tex/context/fonts/demo.lfg b/tex/context/fonts/demo.lfg
index b27db8545..c76a58d25 100644
--- a/tex/context/fonts/demo.lfg
+++ b/tex/context/fonts/demo.lfg
@@ -11,6 +11,25 @@ local smallcaps = {
smcp = yes,
}
+local report_statistics = logs.reporter("fonts","statistics")
+
+local function statistics(tfmdata)
+ for k, v in table.sortedpairs(tfmdata) do
+ if type(v) == "table" then
+ report_statistics("%s: <table>",k)
+ else
+ report_statistics("%s: %s",k,tostring(v))
+ end
+ end
+end
+
+local function squeeze(tfmdata)
+ for k, v in next, tfmdata.characters do
+ v.height = 0.75 * (v.height or 0)
+ v.depth = 0.75 * (v.depth or 0)
+ end
+end
+
return {
name = "demo",
version = "1.00",
@@ -33,5 +52,9 @@ return {
"two", "four", "six", "eight", "ten",
},
}
- }
+ },
+ postprocessors = {
+ statistics = statistics,
+ squeeze = squeeze,
+ },
}
diff --git a/tex/generic/context/luatex-fonts-merged.lua b/tex/generic/context/luatex-fonts-merged.lua
index b9a85a292..6b0e89fa0 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 : 02/08/11 17:08:08
+-- merge date : 02/08/11 18:41:10
do -- begin closure to overcome local limits and interference
@@ -3753,8 +3753,11 @@ function tfm.scale(tfmtable, scaledpoints, relativeid)
t.unicodes = tfmtable.unicodes
t.indices = tfmtable.indices
t.marks = tfmtable.marks
+ -- this will move to some subtable so that it is copied at once
t.goodies = tfmtable.goodies
t.colorscheme = tfmtable.colorscheme
+ t.postprocessors = tfmtable.postprocessors
+ --
-- t.embedding = tfmtable.embedding
t.descriptions = descriptions
if tfmtable.fonts then
@@ -15797,6 +15800,14 @@ function tfm.read(specification)
else
tfmtable.embedding = "subset"
end
+ -- fonts.goodies.postprocessors.apply(tfmdata) -- only here
+ local postprocessors = tfmtable.postprocessors
+ if postprocessors then
+ for i=1,#postprocessors do
+ postprocessors[i](tfmtable) -- after scaling etc
+ end
+ end
+ --
tfm.fonts[hash] = tfmtable
fonts.designsizes[specification.hash] = tfmtable.designsize -- we only know this for sure after loading once
--~ tfmtable.mode = specification.features.normal.mode or "base"