summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/luatex/luaotfload/luaotfload.lua
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2010-05-23 23:49:58 +0000
committerKarl Berry <karl@freefriends.org>2010-05-23 23:49:58 +0000
commit64ba2a9dbcc524178aec8cecbb6947b449724990 (patch)
tree6da81cb5f197163c244c4fb30af9221f538193d6 /Master/texmf-dist/tex/luatex/luaotfload/luaotfload.lua
parentbdbf5181624ab958acf8225d0fc3c95b9894c5ea (diff)
luaotfload update
git-svn-id: svn://tug.org/texlive/trunk@18437 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/luatex/luaotfload/luaotfload.lua')
-rw-r--r--Master/texmf-dist/tex/luatex/luaotfload/luaotfload.lua170
1 files changed, 58 insertions, 112 deletions
diff --git a/Master/texmf-dist/tex/luatex/luaotfload/luaotfload.lua b/Master/texmf-dist/tex/luatex/luaotfload/luaotfload.lua
index 2c63bd9a22c..6e76fa57f8f 100644
--- a/Master/texmf-dist/tex/luatex/luaotfload/luaotfload.lua
+++ b/Master/texmf-dist/tex/luatex/luaotfload/luaotfload.lua
@@ -15,106 +15,59 @@
-- and the derived files
-- luaotfload.sty, luaotfload.lua
--
-luaotfload = { }
+module('luaotfload', package.seeall)
luaotfload.module = {
name = "luaotfload",
- version = 1.06,
- date = "2010/02/22",
+ version = 1.07,
+ date = "2010/05/10",
description = "ConTeXt font loading system.",
author = "Elie Roux & Hans Hagen",
copyright = "Elie Roux",
license = "CC0"
}
-luatextra.provides_module(luaotfload.module)
+luatexbase.provides_module(luaotfload.module)
-function luaotfload.loadmodule(name, compat)
- local tofind
- if compat then
- if tex.luatexversion < 45 then
- tofind = 'otfl-compat-'..name
- else
- tofind = 'otfl-'..name
- end
- else
- tofind = 'otfl-'..name
- end
- local found = kpse.find_file(tofind,"tex")
- if not found then
- luatextra.module_error('luaotfload', string.format('file %s not found.', tofind))
- return
- end
- luatextra.module_log('luaotfload', "loading file "..found)
- dofile(found)
-end
-
-
-string.strip = string.stripspaces
-
-file = fpath
-file.extname = fpath.suffix
+local format = string.format
-
-local splitters_s, splitters_m = { }, { }
-
-function lpeg.splitat(separator,single)
- local splitter = (single and splitters_s[separator]) or splitters_m[separator]
- if not splitter then
- separator = lpeg.P(separator)
- if single then
- local other, any = lpeg.C((1 - separator)^0), lpeg.P(1)
- splitter = other * (separator * lpeg.C(any^0) + "")
- splitters_s[separator] = splitter
- else
- local other = lpeg.C((1 - separator)^0)
- splitter = other * (separator * other)^0
- splitters_m[separator] = splitter
- end
- end
- return splitter
+local function log(...)
+ luatexbase.module_log ('luaotfload', format(...))
end
-function table.compact(t)
- if t then
- for k,v in next, t do
- if not next(v) then
- t[k] = nil
- end
- end
- end
+local function error(...)
+ luatexbase.module_error ('luaotfload', format(...))
end
-function table.sortedhashkeys(tab) -- fast one
- local srt = { }
- for key,_ in next, tab do
- srt[#srt+1] = key
- end
- table.sort(srt)
- return srt
+local function warning(...)
+ luatexbase.module_warning('luaotfload', format(...))
end
-function table.reverse_hash(h)
- local r = { }
- for k,v in next, h do
- r[v] = string.lower(string.gsub(k," ",""))
- end
- return r
+
+local luatex_version = 60
+
+if tex.luatexversion < luatex_version then
+ warning('LuaTeX v%.2f is old, v%.2f is recommended.',
+ tex.luatexversion/100,
+ luatex_version /100)
end
-function table.reverse(t)
- local tt = { }
- if #t > 0 then
- for i=#t,1,-1 do
- tt[#tt+1] = t[i]
- end
+
+function luaotfload.loadmodule(name)
+ local tofind = 'otfl-'..name
+ local found = kpse.find_file(tofind,"tex")
+ if found then
+ log('loading file %s.', found)
+ dofile(found)
+ else
+ error('file %s not found.', tofind)
end
- return tt
end
luaotfload.loadmodule('luat-dum.lua') -- not used in context at all
+luaotfload.loadmodule('luat-ovr.lua') -- override some luat-dum functions
luaotfload.loadmodule('data-con.lua') -- maybe some day we don't need this one
@@ -122,9 +75,11 @@ luaotfload.loadmodule('node-ini.lua')
function attributes.private(name)
- local number = tex.attributenumber['otfl@'..name]
+ local number = luatexbase.attributes['otfl@'..name]
if not number then
- luatextra.module_error('luaotfload', string.format('asking for attribute %s, but not declared. Please report to the maintainer of luaotfload.', name))
+ error('asking for attribute %s, but not declared. '
+ ..'Please report to the maintainer of luaotfload.',
+ name)
end
return number
end
@@ -140,56 +95,47 @@ luaotfload.loadmodule('node-dum.lua')
luaotfload.loadmodule('font-ini.lua')
luaotfload.loadmodule('font-tfm.lua')
luaotfload.loadmodule('font-cid.lua')
+luaotfload.loadmodule('font-map.lua')
luaotfload.loadmodule('font-ott.lua')
-luaotfload.loadmodule('font-otf.lua', 1)
+luaotfload.loadmodule('font-otf.lua')
luaotfload.loadmodule('font-otd.lua')
luaotfload.loadmodule('font-oti.lua')
luaotfload.loadmodule('font-otb.lua')
luaotfload.loadmodule('font-otn.lua')
luaotfload.loadmodule('font-ota.lua')
luaotfload.loadmodule('font-otc.lua')
-
-
-do
- local temp = callback.register
- callback.register = function (...)
- return
- end
- luaotfload.loadmodule('font-def.lua')
- callback.register = temp
-end
-
+luaotfload.loadmodule('font-def.lua')
luaotfload.loadmodule('font-xtx.lua')
-luaotfload.loadmodule('font-map.lua')
luaotfload.loadmodule('font-dum.lua')
-
-
-fonts.enc.known = {}
-
-
-function luaotfload.find_vf_file(name)
- name = file.removesuffix(file.basename(name))
- local result = kpse.find_file(name, "vf") or ""
- if result == "" then
- result = kpse.find_file(name, "ovf") or ""
- end
- return result
-end
+luaotfload.loadmodule('font-nms.lua')
+luaotfload.loadmodule('font-clr.lua')
function luaotfload.register_callbacks()
- callback.add('pre_linebreak_filter', nodes.simple_font_handler, 'luaotfload.pre_linebreak_filter')
- callback.add('hpack_filter', nodes.simple_font_handler, 'luaotfload.hpack_filter')
- callback.reset('define_font')
- callback.add('define_font', fonts.define.read, 'luaotfload.define_font', 1)
- callback.add('find_vf_file', luaotfload.find_vf_file, 'luaotfload.find_vf_file')
+ luatexbase.add_to_callback('pre_linebreak_filter',
+ nodes.simple_font_handler,
+ 'luaotfload.pre_linebreak_filter')
+ luatexbase.add_to_callback('hpack_filter',
+ nodes.simple_font_handler,
+ 'luaotfload.hpack_filter')
+ luatexbase.reset_callback('define_font')
+ luatexbase.add_to_callback('define_font',
+ fonts.define.read,
+ 'luaotfload.define_font', 1)
+ luatexbase.add_to_callback('find_vf_file',
+ fonts.vf.find,
+ 'luaotfload.find_vf_file')
end
function luaotfload.unregister_callbacks()
- callback.remove('pre_linebreak_filter', 'luaotfload.pre_linebreak_filter')
- callback.remove('hpack_filter', 'luaotfload.hpack_filter')
- callback.remove('define_font', 'luaotfload.define_font')
- callback.remove('find_vf_file', 'luaotfload.find_vf_file')
+ luatexbase.remove_from_callback('pre_linebreak_filter',
+ 'luaotfload.pre_linebreak_filter')
+ luatexbase.remove_from_callback('hpack_filter',
+ 'luaotfload.hpack_filter')
+ luatexbase.remove_from_callback('define_font',
+ 'luaotfload.define_font')
+ luatexbase.remove_from_callback('find_vf_file',
+ 'luaotfload.find_vf_file')
end
--
-- End of File `luaotfload.lua'.