summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/luatex/luaotfload/luaotfload-database.lua
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/luatex/luaotfload/luaotfload-database.lua')
-rw-r--r--Master/texmf-dist/tex/luatex/luaotfload/luaotfload-database.lua76
1 files changed, 36 insertions, 40 deletions
diff --git a/Master/texmf-dist/tex/luatex/luaotfload/luaotfload-database.lua b/Master/texmf-dist/tex/luatex/luaotfload/luaotfload-database.lua
index 322cd5e9144..0cff8f51b4b 100644
--- a/Master/texmf-dist/tex/luatex/luaotfload/luaotfload-database.lua
+++ b/Master/texmf-dist/tex/luatex/luaotfload/luaotfload-database.lua
@@ -5,8 +5,8 @@
do -- block to avoid to many local variables error
local ProvidesLuaModule = {
name = "luaotfload-database",
- version = "2.98", --TAGVERSION
- date = "2019-07-04", --TAGDATE
+ version = "2.99", --TAGVERSION
+ date = "2019-08-11", --TAGDATE
description = "luaotfload submodule / database",
license = "GPL v2.0",
author = "Khaled Hosny, Elie Roux, Philipp Gesang, Marcel Krüger",
@@ -171,9 +171,8 @@ local stringsub = string.sub
local stringupper = string.upper
local tableconcat = table.concat
local tablesort = table.sort
-local utf8gsub = unicode.utf8.gsub
-local utf8lower = unicode.utf8.lower
-local utf8len = unicode.utf8.len
+local utf8len = utf8.len
+local utf8offset = utf8.offset
--- these come from Lualibs/Context
local filebasename = file.basename
@@ -203,6 +202,11 @@ local tabletohash = table.tohash
local tableserialize = table.serialize
local names = fonts and fonts.names or { }
+--- some of our own
+local unicode = require'luaotfload-unicode'
+local casefold = unicode.casefold
+local alphnum_only = unicode.alphnum_only
+
local name_index = nil --> upvalue for names.data
local lookup_cache = nil --> for names.lookups
@@ -235,11 +239,9 @@ end
--- string -> string
-local invalidchars = "[^%a%d]"
-
local sanitize_fontname = function (str)
if str ~= nil then
- str = utf8gsub (utf8lower (str), invalidchars, "")
+ str = alphnum_only(casefold(str, true))
return str
end
return nil
@@ -250,15 +252,11 @@ local sanitize_fontnames = function (rawnames)
for category, namedata in next, rawnames do
if type (namedata) == "string" then
- result [category] = utf8gsub (utf8lower (namedata),
- invalidchars,
- "")
+ result [category] = alphnum_only(casefold(namedata, true))
else
local target = { }
for field, name in next, namedata do
- target [field] = utf8gsub (utf8lower (name),
- invalidchars,
- "")
+ target [field] = alphnum_only(casefold(name, true))
end
result [category] = target
end
@@ -2239,7 +2237,7 @@ local truncate_string = function (str, restrict)
local len = utf8len (str)
if wd - len < 0 then
--- combined length exceeds terminal,
- str = ".." .. stringsub(str, len - wd + 2)
+ str = ".." .. stringsub(str, utf8offset(str, - wd + 2))
end
return str
end
@@ -3725,30 +3723,28 @@ local export = {
find_closest = find_closest,
}
-return {
- init = function ()
- --- the font loader namespace is “fonts”, same as in Context
- --- we need to put some fallbacks into place for when running
- --- as a script
- if not fonts then return false end
- logreport = luaotfload.log.report
- local fonts = fonts
- fonts.names = fonts.names or names
- fonts.formats = fonts.formats or { }
- fonts.definers = fonts.definers or { resolvers = { } }
-
- names.blacklist = blacklist
- -- MK Changed to rebuild with case insensitive fallback.
- -- Negative version to indicate generation by modified code.
- names.version = -1 --- decrease monotonically
- -- /MK
- names.data = nil --- contains the loaded database
- names.lookups = nil --- contains the lookup cache
-
- for sym, ref in next, export do names[sym] = ref end
- for sym, ref in next, api do names[sym] = names[sym] or ref end
- return true
- end
-}
+return function ()
+ --- the font loader namespace is “fonts”, same as in Context
+ --- we need to put some fallbacks into place for when running
+ --- as a script
+ if not fonts then return false end
+ logreport = luaotfload.log.report
+ local fonts = fonts
+ fonts.names = fonts.names or names
+ fonts.formats = fonts.formats or { }
+ fonts.definers = fonts.definers or { resolvers = { } }
+
+ names.blacklist = blacklist
+ -- MK Changed to rebuild with case insensitive fallback.
+ -- Negative version to indicate generation by modified code.
+ names.version = -1 --- decrease monotonically
+ -- /MK
+ names.data = nil --- contains the loaded database
+ names.lookups = nil --- contains the lookup cache
+
+ for sym, ref in next, export do names[sym] = ref end
+ for sym, ref in next, api do names[sym] = names[sym] or ref end
+ return true
+end
-- vim:tw=71:sw=4:ts=4:expandtab