diff options
author | Hans Hagen <pragma@wxs.nl> | 2010-05-18 10:57:00 +0200 |
---|---|---|
committer | Hans Hagen <pragma@wxs.nl> | 2010-05-18 10:57:00 +0200 |
commit | cf10a29d938a8fd2ad81f8034b53ee7409990169 (patch) | |
tree | 1c53e21b95e86196c426a4cdda48000c6174eb8e /tex/context/base/font-dum.lua | |
parent | 89f1dbd1efbc71e5a74d798142ae5275e6f097ff (diff) | |
download | context-cf10a29d938a8fd2ad81f8034b53ee7409990169.tar.gz |
beta 2010.05.18 10:57
Diffstat (limited to 'tex/context/base/font-dum.lua')
-rw-r--r-- | tex/context/base/font-dum.lua | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tex/context/base/font-dum.lua b/tex/context/base/font-dum.lua index 5ba8e6015..8b35c3278 100644 --- a/tex/context/base/font-dum.lua +++ b/tex/context/base/font-dum.lua @@ -257,3 +257,23 @@ fonts.otf.meanings.normalize = fonts.otf.meanings.normalize or function(t) t.rand = "random" end end + +-- bonus + +function fonts.otf.name_to_slot(name) + local tfmdata = fonts.ids[font.current()] + if tfmdata and tfmdata.shared then + local otfdata = tfmdata.shared.otfdata + local unicode = otfdata.luatex.unicodes[name] + return unicode and (type(unicode) == "number" and unicode or unicode[1]) + end +end + +function fonts.otf.char(n) + if type(n) == "string" then + n = fonts.otf.name_to_slot(n) + end + if type(n) == "number" then + tex.sprint("\\char" .. n) + end +end |