diff options
author | Hans Hagen <pragma@wxs.nl> | 2011-02-08 18:41:00 +0100 |
---|---|---|
committer | Hans Hagen <pragma@wxs.nl> | 2011-02-08 18:41:00 +0100 |
commit | 631393e12fad038adbe9ab8408b89a7b5335820c (patch) | |
tree | c7b8f5e93fbf92550917b3235cff6f669ca5db01 /tex/context/base/font-gds.lua | |
parent | 94397b74482b88818f737145af99c883802210d7 (diff) | |
download | context-631393e12fad038adbe9ab8408b89a7b5335820c.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.lua | 77 |
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 |