2021-04-18 15:19:52 +02:00
|
|
|
local inspect = require'inspect'
|
|
|
|
local function show(t) return print(inspect(t)) end
|
|
|
|
|
2021-04-22 23:38:28 +02:00
|
|
|
local mlist_to_mml = require'mlist_to_mml'
|
|
|
|
local process_mlist = mlist_to_mml.process
|
|
|
|
local register_family = mlist_to_mml.register_family
|
|
|
|
|
|
|
|
local mappings = require'remap'
|
2021-04-18 15:19:52 +02:00
|
|
|
local write_xml = require'write_xml'
|
|
|
|
|
2021-04-22 23:38:28 +02:00
|
|
|
local funcid = luatexbase.new_luafunction'RegisterFamilyMapping'
|
|
|
|
token.set_lua('RegisterFamilyMapping', funcid, 'protected')
|
|
|
|
lua.get_functions_table()[funcid] = function()
|
|
|
|
local fam = token.scan_int()
|
|
|
|
local mapping = token.scan_string()
|
|
|
|
if mappings[mapping] then
|
|
|
|
register_family(fam, mappings[mapping])
|
|
|
|
else
|
|
|
|
tex.error(string.format('Unknown font mapping %q', mapping))
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2021-04-19 13:30:54 +02:00
|
|
|
luatexbase.add_to_callback('pre_mlist_to_hlist_filter', function(mlist, style)
|
2021-04-22 23:38:28 +02:00
|
|
|
print''
|
|
|
|
local xml = process_mlist(mlist, style == 'display' and 2 or 0)
|
2021-04-19 13:30:54 +02:00
|
|
|
print(write_xml(xml))
|
|
|
|
-- print(write_xml(xml, '\n'))
|
2021-04-22 23:38:28 +02:00
|
|
|
print''
|
2021-04-18 15:19:52 +02:00
|
|
|
return true
|
|
|
|
end, 'dump_list')
|