summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/luatex/luaotfload/luaotfload-auxiliary.lua
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/luatex/luaotfload/luaotfload-auxiliary.lua')
-rw-r--r--Master/texmf-dist/tex/luatex/luaotfload/luaotfload-auxiliary.lua58
1 files changed, 50 insertions, 8 deletions
diff --git a/Master/texmf-dist/tex/luatex/luaotfload/luaotfload-auxiliary.lua b/Master/texmf-dist/tex/luatex/luaotfload/luaotfload-auxiliary.lua
index 14a66da3591..2d4e757bc0c 100644
--- a/Master/texmf-dist/tex/luatex/luaotfload/luaotfload-auxiliary.lua
+++ b/Master/texmf-dist/tex/luatex/luaotfload/luaotfload-auxiliary.lua
@@ -4,19 +4,14 @@
-- AUTHOR: Khaled Hosny, Élie Roux, Philipp Gesang
-----------------------------------------------------------------------
-local ProvidesLuaModule = {
+assert(luaotfload_module, "This is a part of luaotfload and should not be loaded independently") {
name = "luaotfload-auxiliary",
- version = "3.15", --TAGVERSION
- date = "2020-09-02", --TAGDATE
+ version = "3.16", --TAGVERSION
+ date = "2020-12-31", --TAGDATE
description = "luaotfload submodule / auxiliary functions",
license = "GPL v2.0"
}
-if luatexbase and luatexbase.provides_module then
- luatexbase.provides_module (ProvidesLuaModule)
-end
-
-
luaotfload = luaotfload or { }
local log = luaotfload.log
local logreport = log.report
@@ -912,6 +907,53 @@ function aux.get_quad(font_id)
end
-----------------------------------------------------------------------
+--- Script/language fixup
+-----------------------------------------------------------------------
+local otftables = fonts.constructors.handlers.otf.tables
+local function setscript(tfmdata, value)
+ if value then
+ local cleanvalue = string.lower(value)
+ local scripts = otftables and otftables.scripts
+ local properties = tfmdata.properties
+ if not scripts then
+ properties.script = cleanvalue
+ elseif scripts[value] then
+ properties.script = cleanvalue
+ else
+ properties.script = "dflt"
+ end
+ end
+ local resources = tfmdata.resources
+ local features = resources and resources.features
+ if features then
+ local properties = tfmdata.properties
+ local script, language = properties.script, properties.language
+ local script_found, language_found = false, false
+ for _, data in next, features do for _, feature_data in next, data do
+ local scr = feature_data[script]
+ if scr then
+ script_found = true
+ if scr[language] then
+ language_found = true
+ goto double_break
+ end
+ end
+ end end
+ ::double_break::
+ if not script_found then properties.script = "dflt" end
+ if not language_found then properties.language = "dflt" end
+ end
+end
+fonts.constructors.features.otf.register {
+ name = "script",
+ initializers = {
+ base = setscript,
+ node = setscript,
+ plug = setscript,
+ },
+}
+
+-----------------------------------------------------------------------
--- initialization
-----------------------------------------------------------------------