diff options
Diffstat (limited to 'Master/texmf-dist/tex/luatex/luaotfload/luaotfload-harf-define.lua')
-rw-r--r-- | Master/texmf-dist/tex/luatex/luaotfload/luaotfload-harf-define.lua | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/Master/texmf-dist/tex/luatex/luaotfload/luaotfload-harf-define.lua b/Master/texmf-dist/tex/luatex/luaotfload/luaotfload-harf-define.lua index e8154cb719d..ad02cdb99a0 100644 --- a/Master/texmf-dist/tex/luatex/luaotfload/luaotfload-harf-define.lua +++ b/Master/texmf-dist/tex/luatex/luaotfload/luaotfload-harf-define.lua @@ -5,8 +5,8 @@ do -- block to avoid to many local variables error local ProvidesLuaModule = { name = "luaotfload-harf-define", - version = "3.1", --TAGVERSION - date = "2019-11-04", --TAGDATE + version = "3.11", --TAGVERSION + date = "2019-11-10", --TAGDATE description = "luaotfload submodule / database", license = "GPL v2.0", author = "Khaled Hosny, Marcel Krüger", @@ -23,6 +23,7 @@ local stringupper = string.upper local gsub = string.gsub local hb = luaotfload.harfbuzz +local scriptlang_to_harfbuzz = require'luaotfload-scripts'.to_harfbuzz local hbfonts = {} @@ -32,6 +33,9 @@ local os2tag = hb.Tag.new("OS/2") local posttag = hb.Tag.new("post") local glyftag = hb.Tag.new("glyf") +local invalid_l = hb.Language.new() +local invalid_s = hb.Script.new() + local containers = luaotfload.fontloader.containers local hbcacheversion = 1.0 local facecache = containers.define("fonts", "hb", hbcacheversion, true) @@ -366,15 +370,23 @@ fonts.readers.harf = function(spec) local hb_features = {} spec.hb_features = hb_features - if rawfeatures.language then + if rawfeatures.script then + local script = stringlower(rawfeatures.script) + if script == "dflt" then -- Probably a noop, HarfBuzz normalizes anyway + script = "DFLT" + end + local language = stringupper(rawfeatures.language or 'dflt') + language = language == "DFLT" and "dflt" or language + local hb_script, hb_lang = scriptlang_to_harfbuzz(script, language) + spec.script, spec.language = hb.Script.new(hb_script), hb.Language.new(hb_lang) + elseif rawfeatures.language then local language = stringupper(rawfeatures.language) spec.language = hb.Language.new(language == "DFLT" and "dflt" or language) - end - if rawfeatures.script then - local script = stringlower(rawfeatures.script) - spec.script = hb.Script.new(script == "dflt" and "DFLT" - or script) + spec.script = invalid_s + else + spec.script = invalid_s + spec.language = invalid_l end for key, val in next, rawfeatures do if key:len() == 4 then |