summaryrefslogtreecommitdiff
path: root/tex/context/base/font-ctx.lua
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2014-08-19 11:57:00 +0200
committerHans Hagen <pragma@wxs.nl>2014-08-19 11:57:00 +0200
commit7169f20fa4a82724c4050f1c2756b303db5e2749 (patch)
tree455657221509ccda235cff8b7370d3a9efc29129 /tex/context/base/font-ctx.lua
parent24ec7789fc1ebd336fa907e58266e03134b6bbd2 (diff)
downloadcontext-7169f20fa4a82724c4050f1c2756b303db5e2749.tar.gz
beta 2014.08.19 11:57
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