summaryrefslogtreecommitdiff
path: root/tex/context/base/mkiv/font-col.lua
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2018-09-02 00:04:51 +0200
committerContext Git Mirror Bot <phg@phi-gamma.net>2018-09-02 00:04:51 +0200
commitfd9c4ecd4421d087de21bef1e53d8ffb016285b0 (patch)
tree64606204adcabe2f197984ca8d063891b770bace /tex/context/base/mkiv/font-col.lua
parent2106beefbc854f77a92264c815d3cf2b3460f0b6 (diff)
downloadcontext-fd9c4ecd4421d087de21bef1e53d8ffb016285b0.tar.gz
2018-09-01 23:20:00
Diffstat (limited to 'tex/context/base/mkiv/font-col.lua')
-rw-r--r--tex/context/base/mkiv/font-col.lua88
1 files changed, 33 insertions, 55 deletions
diff --git a/tex/context/base/mkiv/font-col.lua b/tex/context/base/mkiv/font-col.lua
index 6d35a8e35..0af6f3188 100644
--- a/tex/context/base/mkiv/font-col.lua
+++ b/tex/context/base/mkiv/font-col.lua
@@ -58,6 +58,7 @@ local fontdata = hashes.identifiers
local fontquads = hashes.quads
local chardata = hashes.characters
local propdata = hashes.properties
+local mathparameters = hashes.mathparameters
local currentfont = font.current
local addcharacters = font.addcharacters
@@ -68,6 +69,15 @@ local list = { }
local current = 0
local enabled = false
+local validvectors = table.setmetatableindex(function(t,k)
+ local v = false
+ if not mathparameters[k] then
+ v = vectors[k]
+ end
+ t[k] = v
+ return v
+end)
+
local function checkenabled()
-- a bit ugly but nicer than a fuzzy state while defining math
if next(vectors) then
@@ -112,6 +122,18 @@ function collections.define(name,font,ranges,details)
end
details = settings_to_hash(details)
-- todo, combine per font start/stop as arrays
+ local offset = details.offset
+ if type(offset) == "string" then
+ local start = characters.getrange(offset,true)
+ offset = start or false
+ else
+ offset = tonumber(offset) or false
+ end
+ local rscale = tonumber (details.rscale) or 1
+ local force = toboolean(details.force,true)
+ local check = toboolean(details.check,true)
+ local factor = tonumber(details.factor)
+ local features = details.features
for s in gmatch(ranges,"[^, ]+") do
local start, stop, description, gaps = characters.getrange(s,true)
if start and stop then
@@ -126,24 +148,17 @@ function collections.define(name,font,ranges,details)
end
end
end
- local offset = details.offset
- if type(offset) == "string" then
- local start = characters.getrange(offset,true)
- offset = start or false
- else
- offset = tonumber(offset) or false
- end
d[#d+1] = {
font = font,
start = start,
stop = stop,
gaps = gaps,
offset = offset,
- rscale = tonumber (details.rscale) or 1,
- force = toboolean(details.force,true),
- check = toboolean(details.check,true),
- factor = tonumber(details.factor),
- features = details.features,
+ rscale = rscale,
+ force = force,
+ check = check,
+ factor = factor,
+ features = features,
}
end
end
@@ -218,8 +233,11 @@ function collections.clonevector(name)
if trace_collecting then
report_fonts("activating collection %a for font %a",name,current)
end
- checkenabled()
statistics.stoptiming(fonts)
+ -- for WS: needs checking
+ if validvectors[current] then
+ checkenabled()
+ end
end
-- we already have this parser
@@ -310,11 +328,9 @@ local function monoslot(font,char,parent,factor)
end
function collections.process(head) -- this way we keep feature processing
- for n in nextchar, head do
- local font = getfont(n)
- local vector = vectors[font]
+ for n, char, font in nextchar, head do
+ local vector = validvectors[font]
if vector then
- local char = getchar(n)
local vect = vector[char]
if not vect then
-- keep it
@@ -345,44 +361,6 @@ function collections.process(head) -- this way we keep feature processing
return head
end
-if LUATEXVERSION >= 1.080 then
-
- function collections.process(head) -- this way we keep feature processing
- for n, char, font in nextchar, head do
- local vector = vectors[font]
- if vector then
- local vect = vector[char]
- if not vect then
- -- keep it
- elseif type(vect) == "table" then
- local newfont = vect[1]
- local newchar = vect[2]
- if trace_collecting then
- report_fonts("remapping character %C in font %a to character %C in font %a%s",
- char,font,newchar,newfont,not chardata[newfont][newchar] and " (missing)" or ""
- )
- end
- setfont(n,newfont,newchar)
- else
- local fakemono = vector.factor
- if trace_collecting then
- report_fonts("remapping font %a to %a for character %C%s",
- font,vect,char,not chardata[vect][char] and " (missing)" or ""
- )
- end
- if fakemono then
- setfont(n,vect,monoslot(vect,char,font,fakemono))
- else
- setfont(n,vect)
- end
- end
- end
- end
- return head
- end
-
-end
-
function collections.found(font,char) -- this way we keep feature processing
if not char then
font, char = currentfont(), font