summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Gesang <phg42.2a@gmail.com>2013-06-22 12:38:04 +0200
committerPhilipp Gesang <phg42.2a@gmail.com>2013-06-22 12:38:04 +0200
commitdbe92b0e0e771352c4307ff3eb8f04f9cfd8ec02 (patch)
tree85c041065c4a24e3a32cc81d198736cfde245820
parent51360bd326da1e0fcb10b1b311b49284ec480ed5 (diff)
downloadluaotfload-dbe92b0e0e771352c4307ff3eb8f04f9cfd8ec02.tar.gz
add unsafe fallback to character data lookup
-rw-r--r--luaotfload-auxiliary.lua2
-rw-r--r--luaotfload-extralibs.lua12
-rwxr-xr-xmkcharacters7
3 files changed, 15 insertions, 6 deletions
diff --git a/luaotfload-auxiliary.lua b/luaotfload-auxiliary.lua
index 0dfabe6..8fc8477 100644
--- a/luaotfload-auxiliary.lua
+++ b/luaotfload-auxiliary.lua
@@ -358,7 +358,7 @@ do
local index = function (t, k)
if chardata == nil then
log("Loading character metadata from %s.", chardef)
- chardata = dofile(kpse.find_file("luaotfload-characters.lua", "lua"))
+ chardata = dofile(kpse.find_file(chardef, "lua"))
if chardata == nil then
warning("Could not load %s; continuing with empty character table.",
chardef)
diff --git a/luaotfload-extralibs.lua b/luaotfload-extralibs.lua
index 90dbf09..3204229 100644
--- a/luaotfload-extralibs.lua
+++ b/luaotfload-extralibs.lua
@@ -176,9 +176,15 @@ if not chardata then
if k == true then
return chardata[currentfont()]
else
- local characters = identifiers[k].characters
- t[k] = characters
- return characters
+ local tfmdata = identifiers[k]
+ if not tfmdata then --- unsafe
+ tfmdata = font.fonts[k]
+ end
+ if tfmdata then
+ local characters = tfmdata.characters
+ t[k] = characters
+ return characters
+ end
end
end)
fonthashes.characters = chardata
diff --git a/mkcharacters b/mkcharacters
index a627ea9..a1c4204 100755
--- a/mkcharacters
+++ b/mkcharacters
@@ -5,7 +5,7 @@
-- DESCRIPTION: import parts of char-def.lua
-- REQUIREMENTS: lua, ConTeXt, the lualibs package
-- AUTHOR: Philipp Gesang (Phg), <phg42.2a@gmail.com>
--- VERSION: 1.0
+-- VERSION: 1.1
-- CREATED: 2013-05-17 12:41:39+0200
-----------------------------------------------------------------------
-- we create a stripped-down version of char-def.lua
@@ -16,7 +16,10 @@
-----------------------------------------------------------------------
local charfile = "./luaotfload-characters.lua"
local chardef = "~phg/base/char-def.lua"
-local import = { "direction", "mirror", } --> πολυγλωσσία/uax9
+local import = {
+ "direction", "mirror", --> πολυγλωσσία/uax9
+ "category", --> https://gist.github.com/phi-gamma/5812290
+}
-----------------------------------------------------------------------
-- includes