summaryrefslogtreecommitdiff
path: root/tex/context/base/font-ctx.lua
diff options
context:
space:
mode:
Diffstat (limited to 'tex/context/base/font-ctx.lua')
-rw-r--r--tex/context/base/font-ctx.lua33
1 files changed, 30 insertions, 3 deletions
diff --git a/tex/context/base/font-ctx.lua b/tex/context/base/font-ctx.lua
index 2f5ae57e2..e366f746d 100644
--- a/tex/context/base/font-ctx.lua
+++ b/tex/context/base/font-ctx.lua
@@ -78,12 +78,11 @@ local texdefinefont = tex.definefont
local texsp = tex.sp
local fontdata = hashes.identifiers
-local characters = hashes.chardata
+local characters = hashes.characters
local descriptions = hashes.descriptions
local properties = hashes.properties
local resources = hashes.resources
local csnames = hashes.csnames
-local marks = hashes.markdata
local lastmathids = hashes.lastmathids
local exheights = hashes.exheights
local emwidths = hashes.emwidths
@@ -1449,7 +1448,28 @@ local function nametoslot(name)
end
end
-helpers.nametoslot = nametoslot
+local function indextoslot(index)
+ local r = resources[true]
+ if r then
+ local indices = r.indices
+ if not indices then
+ indices = { }
+ local c = characters[true]
+ for unicode, data in next, c do
+ local di = data.index
+ if di then
+ indices[di] = unicode
+ end
+ end
+ r.indices = indices
+ end
+ return indices[tonumber(index)]
+ end
+end
+
+
+helpers.nametoslot = nametoslot
+helpers.indextoslot = indextoslot
-- this will change ...
@@ -1604,6 +1624,13 @@ function commands.fontchar(n)
end
end
+function commands.fontcharbyindex(n)
+ n = indextoslot(n)
+ if n then
+ context_char(n)
+ end
+end
+
function commands.doifelsecurrentfonthasfeature(name) -- can be made faster with a supportedfeatures hash
local f = fontdata[currentfont()]
f = f and f.shared