summaryrefslogtreecommitdiff
path: root/tex/context/base/font-gds.lua
diff options
context:
space:
mode:
authorMarius <mariausol@gmail.com>2011-02-08 20:00:11 +0200
committerMarius <mariausol@gmail.com>2011-02-08 20:00:11 +0200
commit556ad6378a5b0f52e594350b3bba9d06e5eb79f2 (patch)
treee29af88a6e7014c3ed13220871d83ffa97268b0d /tex/context/base/font-gds.lua
parentba57766270809c52c95122555a32b30ccbb5eba1 (diff)
downloadcontext-556ad6378a5b0f52e594350b3bba9d06e5eb79f2.tar.gz
beta 2011.02.08 18:41
Diffstat (limited to 'tex/context/base/font-gds.lua')
-rw-r--r--tex/context/base/font-gds.lua77
1 files changed, 66 insertions, 11 deletions
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