summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/luatex/luatexja/luatexja.lua
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/luatex/luatexja/luatexja.lua')
-rw-r--r--Master/texmf-dist/tex/luatex/luatexja/luatexja.lua66
1 files changed, 35 insertions, 31 deletions
diff --git a/Master/texmf-dist/tex/luatex/luatexja/luatexja.lua b/Master/texmf-dist/tex/luatex/luatexja/luatexja.lua
index 9a09db9e68c..c6ccda589fb 100644
--- a/Master/texmf-dist/tex/luatex/luatexja/luatexja.lua
+++ b/Master/texmf-dist/tex/luatex/luatexja/luatexja.lua
@@ -219,41 +219,45 @@ function luatexja.ext_print_global()
end
-- main process
--- mode = true iff main_process is called from pre_linebreak_filter
-local function main_process(head, mode, dir)
- local p = head
- p = ltjj.main(p,mode)
- if p then p = ltjw.set_ja_width(p, dir) end
- return p
+do
+ -- mode = true iff main_process is called from pre_linebreak_filter
+ local function main_process(head, mode, dir)
+ local p = head
+ p = ltjj.main(p,mode)
+ if p then p = ltjw.set_ja_width(p, dir) end
+ return p
+ end
+
+ -- callbacks
+
+ luatexbase.add_to_callback(
+ 'pre_linebreak_filter',
+ function (head,groupcode)
+ return main_process(head, true, tex.textdir)
+ end,'ltj.pre_linebreak_filter',
+ luatexbase.priority_in_callback('pre_linebreak_filter',
+ 'luaotfload.node_processor') + 1)
+ luatexbase.add_to_callback(
+ 'hpack_filter',
+ function (head,groupcode,size,packtype, dir)
+ return main_process(head, false, dir)
+ end,'ltj.hpack_filter',
+ luatexbase.priority_in_callback('hpack_filter',
+ 'luaotfload.node_processor') + 1)
end
--- callbacks
-
-luatexbase.add_to_callback('pre_linebreak_filter',
- function (head,groupcode)
- return main_process(head, true, tex.textdir)
- end,'ltj.pre_linebreak_filter',
- luatexbase.priority_in_callback('pre_linebreak_filter',
- 'luaotfload.node_processor') + 1)
-luatexbase.add_to_callback('hpack_filter',
- function (head,groupcode,size,packtype, dir)
- return main_process(head, false, dir)
- end,'ltj.hpack_filter',
- luatexbase.priority_in_callback('hpack_filter',
- 'luaotfload.node_processor') + 1)
-
-- define_font
-
-local otfl_fdr = fonts.definers.read
-function luatexja.font_callback(name, size, id)
- return ltjf.font_callback(
- name, size, id,
- function (name, size, id) return ltjr.font_callback(name, size, id, otfl_fdr) end
- )
+do
+ local otfl_fdr = fonts.definers.read
+ local ltjr_font_callback = ltjr.font_callback
+ function luatexja.font_callback(name, size, id)
+ return ltjf.font_callback(
+ name, size, id,
+ function (name, size, id) return ltjr_font_callback(name, size, id, otfl_fdr) end
+ )
+ end
+ luatexbase.add_to_callback('define_font',luatexja.font_callback,"luatexja.font_callback", 1)
end
---luatexbase.remove_from_callback('define_font',"luaotfload.define_font")
-luatexbase.add_to_callback('define_font',luatexja.font_callback,"luatexja.font_callback", 1)
-