diff options
author | Philipp Gesang <phg@phi-gamma.net> | 2015-12-23 22:57:00 +0100 |
---|---|---|
committer | Philipp Gesang <phg@phi-gamma.net> | 2015-12-23 22:57:00 +0100 |
commit | 07cc29d8658360e9e6ddecf7f251e518b9ea99c9 (patch) | |
tree | d1844d7e844f4135b8c634f07d31a39dff4b663c /src | |
parent | e7fc73c0cb9a56c394d12f4967dbcffe93923afd (diff) | |
parent | 9320186751b6c6a1113f41331716d3b68d73af7a (diff) | |
download | luaotfload-07cc29d8658360e9e6ddecf7f251e518b9ea99c9.tar.gz |
Merge pull request #316 from phi-gamma/master
fix tex ligatures
Diffstat (limited to 'src')
-rw-r--r-- | src/fontloader/runtime/fontloader-reference.lua | 4 | ||||
-rw-r--r-- | src/luaotfload-auxiliary.lua | 81 | ||||
-rw-r--r-- | src/luaotfload-features.lua | 13 | ||||
-rw-r--r-- | src/luaotfload-main.lua | 2 |
4 files changed, 61 insertions, 39 deletions
diff --git a/src/fontloader/runtime/fontloader-reference.lua b/src/fontloader/runtime/fontloader-reference.lua index 46de1d0..9208e52 100644 --- a/src/fontloader/runtime/fontloader-reference.lua +++ b/src/fontloader/runtime/fontloader-reference.lua @@ -1,6 +1,6 @@ -- merged file : c:/data/develop/context/sources/luatex-fonts-merged.lua -- parent file : c:/data/develop/context/sources/luatex-fonts.lua --- merge date : 12/21/15 16:29:15 +-- merge date : 12/22/15 10:50:54 do -- begin closure to overcome local limits and interference @@ -7418,6 +7418,7 @@ local ordered_enhancers={ "check encoding", "add duplicates", "expand lookups", + "check extra features", "cleanup tables", "compact lookups", "purge names", @@ -7688,7 +7689,6 @@ function otf.load(filename,sub,featurefile) applyruntimefixes(filename,data) end enhance("add dimensions",data,filename,nil,false) -enhance("check extra features",data,filename) if trace_sequences then showfeatureorder(data,filename) end diff --git a/src/luaotfload-auxiliary.lua b/src/luaotfload-auxiliary.lua index 11d3101..8292ddd 100644 --- a/src/luaotfload-auxiliary.lua +++ b/src/luaotfload-auxiliary.lua @@ -10,10 +10,7 @@ --- this file addresses issue #24 --- https://github.com/lualatex/luaotfload/issues/24# -luaotfload = luaotfload or {} -luaotfload.aux = luaotfload.aux or { } - -local aux = luaotfload.aux +luaotfload = luaotfload or { } local log = luaotfload.log local logreport = log.report local fonthashes = fonts.hashes @@ -35,6 +32,9 @@ local stringbyte = string.byte local stringfind = string.find local tablecopy = table.copy +local aux = { } +local luaotfload_callbacks = { } + ----------------------------------------------------------------------- --- font patches ----------------------------------------------------------------------- @@ -89,10 +89,9 @@ local set_sscale_dimens = function (fontdata) return fontdata end -luatexbase.add_to_callback( - "luaotfload.patch_font", - set_sscale_dimens, - "luaotfload.aux.set_sscale_dimens") +luaotfload_callbacks [#luaotfload_callbacks + 1] = { + "patch_font", set_sscale_dimens, "set_sscale_dimens", +} --- fontobj -> int local lookup_units = function (fontdata) @@ -124,11 +123,10 @@ local patch_cambria_domh = function (fontdata) end end -luatexbase.add_to_callback( - "luaotfload.patch_font", - patch_cambria_domh, - "luaotfload.aux.patch_cambria_domh") - +luaotfload_callbacks [#luaotfload_callbacks + 1] = { + "patch_font", patch_cambria_domh, "patch_cambria_domh", +} + --[[doc-- @@ -152,11 +150,10 @@ local fixup_fontdata = function (data) end -luatexbase.add_to_callback( - "luaotfload.patch_font_unsafe", - fixup_fontdata, - "luaotfload.aux.fixup_fontdata") - +luaotfload_callbacks [#luaotfload_callbacks + 1] = { + "patch_font_unsafe", fixup_fontdata, "fixup_fontdata", +} + --[[doc-- @@ -204,10 +201,9 @@ local set_capheight = function (fontdata) end end -luatexbase.add_to_callback( - "luaotfload.patch_font", - set_capheight, - "luaotfload.aux.set_capheight") +luaotfload_callbacks [#luaotfload_callbacks + 1] = { + "patch_font", set_capheight, "set_capheight", +} ----------------------------------------------------------------------- --- glyphs and characters @@ -843,4 +839,43 @@ end aux.get_quad = get_quad --- vim:tw=71:sw=2:ts=2:expandtab + +----------------------------------------------------------------------- +--- initialization +----------------------------------------------------------------------- + +local inject_callbacks = function (lst) + if not lst and next (lst) then return false end + + local inject = function (def) + local cb, fn, id = unpack (def) + cb = tostring (cb) + id = tostring (id) + if not cb or not fn or not id or not type (fn) == "function" then + logreport ("both", 0, "aux", "Invalid callback requested (%q, %s, %q).", + cb, tostring (fn), id) + return false + end + cb = stringformat ("luaotfload.%s", cb) + id = stringformat ("luaotfload.aux.%s", id) + logreport ("log", 5, "aux", "Installing callback %q->%q.", cb, id) + luatexbase.add_to_callback (cb, fn, id) + return true + end + + local ret = true + for i = 1, #lst do ret = inject (lst [i]) end + return ret +end + +return { + init = function () + local ret = true + luaotfload.aux = aux + ret = inject_callbacks (luaotfload_callbacks) + return ret + end +} + +-- vim:tw=79:sw=2:ts=8:et + diff --git a/src/luaotfload-features.lua b/src/luaotfload-features.lua index 3f9d67a..3922882 100644 --- a/src/luaotfload-features.lua +++ b/src/luaotfload-features.lua @@ -1405,19 +1405,6 @@ local tlig_specification = { }, } -local tlig_specification = { - type = "substitution", - features = everywhere, - data = { - [0x0022] = 0x201D, -- quotedblright - [0x0027] = 0x2019, -- quoteleft - [0x0060] = 0x2018, -- quoteright - }, - flags = noflags, - order = { "tlig" }, - prepend = true, -} - local anum_arabic = { --- these are the same as in font-otc [0x0030] = 0x0660, [0x0031] = 0x0661, diff --git a/src/luaotfload-main.lua b/src/luaotfload-main.lua index 9525ca4..c843f26 100644 --- a/src/luaotfload-main.lua +++ b/src/luaotfload-main.lua @@ -254,7 +254,7 @@ luaotfload.main = function () initialize "features" --- font request and feature handling loadmodule "letterspace" --- extra character kerning - loadmodule "auxiliary" --- additional high-level functionality + initialize "auxiliary" --- additional high-level functionality luaotfload.aux.start_rewrite_fontname () --- to be migrated to fontspec |