summaryrefslogtreecommitdiff
path: root/otfl-font-dum.lua
diff options
context:
space:
mode:
authorKhaled Hosny <khaledhosny@eglug.org>2010-05-21 06:46:45 +0300
committerKhaled Hosny <khaledhosny@eglug.org>2010-05-21 07:07:28 +0300
commit3cbef76101d9aaef3b2c355c58675bf9f386d949 (patch)
treee11465e3a2ae642973a74ec1a5202d5cf815b176 /otfl-font-dum.lua
parent7714c6972814b0ff3175479b09d0139dd67c6ab0 (diff)
downloadluaotfload-3cbef76101d9aaef3b2c355c58675bf9f386d949.tar.gz
Sync with ConTeXt beta (beta 2010.05.20)
Diffstat (limited to 'otfl-font-dum.lua')
-rw-r--r--otfl-font-dum.lua25
1 files changed, 24 insertions, 1 deletions
diff --git a/otfl-font-dum.lua b/otfl-font-dum.lua
index 5224ae1..2de1ae1 100644
--- a/otfl-font-dum.lua
+++ b/otfl-font-dum.lua
@@ -55,11 +55,14 @@ fonts.names.old_to_new = { }
local data, loaded = nil, false
+local fileformats = { "lua", "tex", "other text files" }
+
function fonts.names.resolve(name,sub)
if not loaded then
local basename = fonts.names.basename
if basename and basename ~= "" then
- for _, format in ipairs { "lua", "tex", "other text files" } do
+ for i=1,#fileformats do
+ local format = fileformats[i]
local foundname = resolvers.find_file(basename,format) or ""
if foundname ~= "" then
data = dofile(foundname)
@@ -356,3 +359,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