From 7169f20fa4a82724c4050f1c2756b303db5e2749 Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Tue, 19 Aug 2014 11:57:00 +0200 Subject: beta 2014.08.19 11:57 --- tex/context/base/font-ctx.lua | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) (limited to 'tex/context/base/font-ctx.lua') 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 -- cgit v1.2.3