summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/font-col.lua
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/context/base/font-col.lua')
-rw-r--r--Master/texmf-dist/tex/context/base/font-col.lua34
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