diff options
author | Mojca Miklavec <mojca.miklavec@gmail.com> | 2012-05-14 17:38:55 +0000 |
---|---|---|
committer | Mojca Miklavec <mojca.miklavec@gmail.com> | 2012-05-14 17:38:55 +0000 |
commit | 15995e10bfc68edf79970c4ea4fbb6678566c46e (patch) | |
tree | 2de7ca2a83f2d37ef043ad7429a5cb945bb79ddb /Master/texmf-dist/tex/context/base/font-col.lua | |
parent | c9a39f716f1e5ec820ed3aab2c9aef25c5a9d730 (diff) |
ConTeXt 2012.05.14 16:00
git-svn-id: svn://tug.org/texlive/trunk@26371 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/context/base/font-col.lua')
-rw-r--r-- | Master/texmf-dist/tex/context/base/font-col.lua | 34 |
1 files changed, 24 insertions, 10 deletions
diff --git a/Master/texmf-dist/tex/context/base/font-col.lua b/Master/texmf-dist/tex/context/base/font-col.lua index e0d2fed112d..f8add1e4e1d 100644 --- a/Master/texmf-dist/tex/context/base/font-col.lua +++ b/Master/texmf-dist/tex/context/base/font-col.lua @@ -11,6 +11,7 @@ if not modules then modules = { } end modules ['font-col'] = { local gmatch, type = string.gmatch, type local traverse_id = node.traverse_id local lpegmatch = lpeg.match +local fastcopy = table.fastcopy local settings_to_hash = utilities.parsers.settings_to_hash local trace_collecting = false trackers.register("fonts.collecting", function(v) trace_collecting = v end) @@ -82,12 +83,14 @@ function collections.define(name,font,ranges,details) end end details.font, details.start, details.stop = font, start, stop - d[#d+1] = table.fastcopy(details) + d[#d+1] = fastcopy(details) end end end -function collections.stage_one(name) +-- todo: provide a lua variant (like with definefont) + +function collections.registermain(name) local last = font.current() if trace_collecting then report_fonts("def: registering font %s with name %s",last,name) @@ -95,7 +98,7 @@ function collections.stage_one(name) list[#list+1] = last end -function collections.stage_two(name) +function collections.clonevector(name) statistics.starttiming(fonts) local d = definitions[name] local t = { } @@ -166,27 +169,29 @@ function collections.prepare(name) report_fonts("def: applying collection %s to %s (file: %s)",name,current,filename) end list = { } - context.dostartcloningfonts() -- move this to tex \dostart... + context.pushcatcodes("prt") -- context.unprotect() + context.font_fallbacks_start_cloning() for i=1,#d do local f = d[i] local name = f.font local scale = f.rscale or 1 if lpegmatch(okay,name) then - context.doclonefonta(name,scale) -- define with unique specs + context.font_fallbacks_clone_unique(name,scale) else - context.doclonefontb(name,scale) -- define with inherited specs + context.font_fallbacks_clone_inherited(name,scale) end - context.doclonefontstageone(name) -- registering main font + context.font_fallbacks_register_main(name) end - context.doclonefontstagetwo(name) -- preparing clone vectors - context.dostopcloningfonts() + context.font_fallbacks_prepare_clone_vectors(name) + context.font_fallbacks_stop_cloning() + context.popcatcodes() -- context.protect() elseif trace_collecting then local filename = file.basename(fontdata[current].properties.filename or "?") report_fonts("def: error in applying collection %s to %s (file: %s)",name,current,filename) end end -function collections.message(message) +function collections.report(message) if trace_collecting then report_fonts("tex: %s",message) end @@ -220,3 +225,12 @@ function collections.process(head) -- this way we keep feature processing return head, false end end + +-- interface + +commands.fontcollectiondefine = collections.define +commands.fontcollectionreset = collections.reset +commands.fontcollectionprepare = collections.prepare +commands.fontcollectionreport = collections.report +commands.fontcollectionregister = collections.registermain +commands.fontcollectionclone = collections.clonevector |