diff options
Diffstat (limited to 'Master/texmf-dist/tex')
25 files changed, 1302 insertions, 528 deletions
diff --git a/Master/texmf-dist/tex/luatex/luatexja/addons/luatexja-preset.sty b/Master/texmf-dist/tex/luatex/luatexja/addons/luatexja-preset.sty index 0134a784564..7bf54a2081e 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/addons/luatexja-preset.sty +++ b/Master/texmf-dist/tex/luatex/luatexja/addons/luatexja-preset.sty @@ -1,11 +1,11 @@ % luatexja-preset.sty -\ProvidesPackage{luatexja-preset}[2013/05/25 Japanese font presets] -%% Sync with PXchfon 0.6a +\ProvidesPackage{luatexja-preset}[2013/10/28 Japanese font presets] \RequirePackage{expl3} \RequirePackage{luatexja-fontspec} \ExplSyntaxOn +%%%% message \bool_new:N \l_ltjpreset_bold_bool % bold \bool_set_false:N \l_ltjpreset_bold_bool @@ -37,12 +37,8 @@ % 漢字字形 \tl_new:N \l_ltjpreset_kanji_shape_tl -\DeclareOption{90jis}{ - \tl_set:Nn \l_ltjpreset_kanji_shape_tl { , CJKShape=JIS1990 } -} % 90jis -\DeclareOption{jis2004}{ - \tl_set:Nn \l_ltjpreset_kanji_shape_tl { , CJKShape=JIS2004 } -} % jis2004 +\DeclareOption{90jis}{ \tl_set:Nn \l_ltjpreset_kanji_shape_tl { , CJKShape=JIS1990 }} % 90jis +\DeclareOption{jis2004}{\tl_set:Nn \l_ltjpreset_kanji_shape_tl { , CJKShape=JIS2004 }} % jis2004 % font preset \bool_new:N \l_ltjpreset_office_bool % MS Office の HG 系フォントを使っているか @@ -67,122 +63,70 @@ \bool_set_true:N \l_ltjpreset_office_bool } -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%%% OBSOLETE -% kozuka -\DeclareOption{kozuka4}{ - \ltjpreset_set_multi:n { - KozMinPro-Regular.otf , KozMinPro-Bold.otf, % mc/m, mc/bx - KozGoPro-Regular.otf , KozGoPro-Bold.otf, % gt/m, gt/bx (multiweight)) - KozGoPro-Medium.otf , KozGoPro-Heavy.otf, % gt/m (uni), gt/eb - KozGoPro-Heavy.otf % mg/m - } -} -\DeclareOption{kozuka6}{ - \ltjpreset_set_multi:n { - KozMinProVI-Regular.otf , KozMinProVI-Bold.otf, % mc/m, mc/bx - KozGoProVI-Regular.otf , KozGoProVI-Bold.otf, % gt/m, gt/bx (multiweight)) - KozGoProVI-Medium.otf , KozGoProVI-Heavy.otf, % gt/m (uni), gt/eb - KozGoProVI-Heavy.otf % mg/m - } -} -\DeclareOption{kozuka6n}{ - \ltjpreset_set_multi:n { - KozMinPr6N-Regular.otf , KozMinPr6N-Bold.otf, % mc/m, mc/bx - KozGoPr6N-Regular.otf , KozGoPr6N-Bold.otf, % gt/m, gt/bx (multiweight)) - KozGoPr6N-Medium.otf , KozGoPr6N-Heavy.otf, % gt/m (uni), gt/eb - KozGoPr6N-Heavy.otf % mg/m - } -} -% hiragino -\DeclareOption{hiragino}{ - \ltjpreset_set_multi:n { - HiraMinPro-W3.otf , HiraMinPro-W6.otf, % mc/m, mc/bx - HiraKakuPro-W3.otf , HiraKakuPro-W6.otf, % gt/m, gt/bx (multiweight)) - HiraKakuPro-W3.otf , HiraKakuStd-W8.otf, % gt/m (uni), gt/eb - HiraMaruPro-W4.otf % mg/m - } -} -\DeclareOption{hiraginon}{ - \ltjpreset_set_multi:n { - HiraMinProN-W3.otf , HiraMinProN-W6.otf, % mc/m, mc/bx - HiraKakuProN-W3.otf , HiraKakuProN-W6.otf, % gt/m, gt/bx (multiweight)) - HiraKakuProN-W3.otf , HiraKakuStdN-W8.otf, % gt/m (uni), gt/eb - HiraMaruProN-W4.otf % mg/m - } -} - -% morisawa? -\DeclareOption{morisawa4}{ - \ltjpreset_set_multi:n { - A-OTF-RyuminPro-Light.otf , A-OTF-FutoMinA101Pro-Bold.otf , % mc/m, mc/bx - A-OTF-GothicBBBPro-Medium.otf , A-OTF-FutoGoB101Pro-Bold.otf , % gt/m, gt/bx (multiweight)) - A-OTF-GothicBBBPro-Medium.otf , A-OTF-MidashiGoPro-MB31.otf , % gt/m (uni), gt/eb - A-OTF-Jun101Pro-Light.otf % mg/m - } -} -\DeclareOption{morisawa6n}{ - \ltjpreset_set_multi:n { - A-OTF-RyuminPr6N-Light.otf , A-OTF-FutoMinA101Pr6N-Bold.otf , % mc/m, mc/bx - A-OTF-GothicBBBPr6N-Medium.otf , A-OTF-FutoGoB101Pr6N-Bold.otf , % gt/m, gt/bx (multiweight)) - A-OTF-GothicBBBPr6N-Medium.otf , A-OTF-MidashiGoPr6N-MB31.otf , % gt/m (uni), gt/eb - A-OTF-Jun101Pr6N-Light.otf % mg/m - } -} - -\DeclareOption{ipaex-dx}{\ltjpreset_set_office:nn { IPAExMincho } { IPAExGothic }} -\DeclareOption{ipa-dx} {\ltjpreset_set_office:nn { IPAMincho } { IPAGothic }} -\DeclareOption{ms-dx} {\ltjpreset_set_office:nn { MS-Mincho } { MS-Gothic }} -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - - - -% kozuka +% 小塚 (Adobe) +%% Pro \DeclareOption{kozuka-pro}{ \ltjpreset_set_multi:n { - KozMinPro-Regular.otf , KozMinPro-Bold.otf, % mc/m, mc/bx - KozGoPro-Regular.otf , KozGoPro-Bold.otf, % gt/m, gt/bx (multiweight)) - KozGoPro-Medium.otf , KozGoPro-Heavy.otf, % gt/m (uni), gt/eb - KozGoPro-Heavy.otf % mg/m + KozMinPro-Regular , % mc/m + KozMinPro-Bold , % mc/bx + KozGoPro-Regular , % gt/m (multi) + KozGoPro-Bold , % gt/bx + KozGoPro-Medium , % gt/m (uni) + KozGoPro-Heavy , % gt/eb + KozGoPro-Heavy % mg/m } } +%% Pr6 \DeclareOption{kozuka-pr6}{ \ltjpreset_set_multi:n { - KozMinProVI-Regular.otf , KozMinProVI-Bold.otf, % mc/m, mc/bx - KozGoProVI-Regular.otf , KozGoProVI-Bold.otf, % gt/m, gt/bx (multiweight)) - KozGoProVI-Medium.otf , KozGoProVI-Heavy.otf, % gt/m (uni), gt/eb - KozGoProVI-Heavy.otf % mg/m + KozMinProVI-Regular , % mc/m + KozMinProVI-Bold , % mc/bx + KozGoProVI-Regular , % gt/m (multi) + KozGoProVI-Bold , % gt/bx + KozGoProVI-Medium , % gt/m (uni) + KozGoProVI-Heavy , % gt/eb + KozGoProVI-Heavy % mg/m } } +%% Pr6N \DeclareOption{kozuka-pr6n}{ \ltjpreset_set_multi:n { - KozMinPr6N-Regular.otf , KozMinPr6N-Bold.otf, % mc/m, mc/bx - KozGoPr6N-Regular.otf , KozGoPr6N-Bold.otf, % gt/m, gt/bx (multiweight)) - KozGoPr6N-Medium.otf , KozGoPr6N-Heavy.otf, % gt/m (uni), gt/eb - KozGoPr6N-Heavy.otf % mg/m + KozMinPr6N-Regular , % mc/m + KozMinPr6N-Bold , % mc/bx + KozGoPr6N-Regular , % gt/m (multi) + KozGoPr6N-Bold , % gt/bx + KozGoPr6N-Medium , % gt/m (uni) + KozGoPr6N-Heavy , % gt/eb + KozGoPr6N-Heavy % mg/m } } -% hiragino +% ヒラギノ (OSX) \DeclareOption{hiragino-pro}{ \ltjpreset_set_multi:n { - HiraMinPro-W3.otf , HiraMinPro-W6.otf, % mc/m, mc/bx - HiraKakuPro-W3.otf , HiraKakuPro-W6.otf, % gt/m, gt/bx (multiweight)) - HiraKakuPro-W6.otf , HiraKakuStd-W8.otf, % gt/m (uni), gt/eb - HiraMaruPro-W4.otf % mg/m + Hiragino~Mincho~Pro~W3 , + Hiragino~Mincho~Pro~W6 , + Hiragino~Kaku~Gothic~Pro~W3 , % gt/m (multi) + Hiragino~Kaku~Gothic~Pro~W6 , + Hiragino~Kaku~Gothic~Pro~W6 , % gt/m (uni) + Hiragino~Kaku~Gothic~Std~W8 , + Hiragino~Maru~Gothic~Pro~W4 , } } \DeclareOption{hiragino-pron}{ \ltjpreset_set_multi:n { - HiraMinProN-W3.otf , HiraMinProN-W6.otf, % mc/m, mc/bx - HiraKakuProN-W3.otf , HiraKakuProN-W6.otf, % gt/m, gt/bx (multiweight)) - HiraKakuProN-W6.otf , HiraKakuStdN-W8.otf, % gt/m (uni), gt/eb - HiraMaruProN-W4.otf % mg/m + Hiragino~Mincho~ProN~W3 , + Hiragino~Mincho~ProN~W6 , + Hiragino~Kaku~Gothic~ProN~W3 , % gt/m (multi) + Hiragino~Kaku~Gothic~ProN~W6 , + Hiragino~Kaku~Gothic~ProN~W6 , % gt/m (uni) + Hiragino~Kaku~Gothic~StdN~W8 , + Hiragino~Maru~Gothic~ProN~W4 , } } -% morisawa +% モリサワ \DeclareOption{morisawa-pro}{ \ltjpreset_set_multi:n { A-OTF-RyuminPro-Light.otf , A-OTF-FutoMinA101Pro-Bold.otf , % mc/m, mc/bx @@ -200,6 +144,26 @@ } } +% 游明朝/游ゴシック (Win8.1) +\DeclareOption{yu-win}{ + \ltjpreset_set_multi:n { + YuMincho-Regular , YuMincho-Demibold , % mc/m, mc/bx + YuGothic-Regular , YuGothic-Bold , % gt/m, gt/bx (multiweight)) + YuGothic-Bold , YuGothic-Bold , % gt/m (uni), gt/eb + YuGothic-Bold % mg/m + } +} + +% Yu fonts in OSX +% according to http://support.apple.com/kb/HT5944 +\DeclareOption{yu-osx}{ + \ltjpreset_set_multi:n { + YuMincho~Medium , YuMincho~Demibold , % mc/m, mc/bx + YuGothic~Medium , YuGothic~Bold , % gt/m, gt/bx (multiweight)) + YuGothic~Bold , YuGothic~Bold , % gt/m (uni), gt/eb + YuGothic~Bold % mg/m + } +} % ipa, ipaex, ms \DeclareOption{ipa}{ @@ -234,7 +198,15 @@ \ProcessOptions* %% KozMinPr6N の場合はjp04 feature がないので,nlck にする -\clist_if_in:NnT \l_ltjpreset_font_list { KozMinPr6N-Regular.otf } { +\clist_if_in:NnT \l_ltjpreset_font_list { KozMinPr6N-Regular } { + \tl_set:Nn \l_tmpa_tl {, CJKShape=JIS2004 } + \tl_if_eq:NNT \l_ltjpreset_kanji_shape_tl \l_tmpa_tl { + \tl_set:Nn \l_ltjpreset_kanji_shape_tl { , CJKShape=NLC } + } +} + +%% HiraMinProN の場合はjp04 feature がない??ので,nlck にする +\clist_if_in:NnT \l_ltjpreset_font_list { Hiragino~Mincho~ProN~W3 } { \tl_set:Nn \l_tmpa_tl {, CJKShape=JIS2004 } \tl_if_eq:NNT \l_ltjpreset_kanji_shape_tl \l_tmpa_tl { \tl_set:Nn \l_ltjpreset_kanji_shape_tl { , CJKShape=NLC } @@ -292,7 +264,7 @@ } } -%%%% expert 用設定 +% expert 用設定 \tl_new:N \l_ltjpreset_add_features_tl \tl_set:Nx \l_ltjpreset_add_features_tl { @@ -305,17 +277,19 @@ \tl_put_left:Nn \l_ltjpreset_add_features_tl { Style = HorizontalKana, } } -%%%% (丸)ゴシック体の設定: bold option もここで +% (丸)ゴシック体の設定: bold option もここで \int_compare:nTF { \l_ltjpreset_deluxe_int == 2 } { -%%% mg - \newjfontfamily \mgfamily [ - BoldFont = \ltjpreset_font_mg:, +%% mg + \newjfontfamily \mgfamily [ + BoldFont = \ltjpreset_font_mg:, \tl_use:N \l_ltjpreset_add_features_tl \bool_if:NT \l_ltjpreset_noembed_bool { , NoEmbed }, \tl_use:N \l_ltjpreset_add_features_tl ] { \ltjpreset_font_mg: } - \DeclareTextFontCommand{\textmg}{\mgfamily} -%%% gteb + \DeclareTextFontCommand{\textmg}{\mgfamily} +%% gt/eb +%% 注意: ファミリは 'gteb'.シリーズは \mdseries のまま. +%% \bfseries を追加したほうが良い? \newjfontfamily \gtebfamily [ BoldFont = \ltjpreset_font_gt_eb:, \tl_use:N \l_ltjpreset_add_features_tl @@ -337,9 +311,10 @@ } -%%%% 実際の fontspec の呼びだし +% 実際の fontspec の呼びだし + +\addjfontfeature{ Kerning=Off } -\defaultjfontfeatures{ Kerning=Off } \setmainjfont [ BoldFont = \ltjpreset_font_mc_bx: \bool_if:NT \l_ltjpreset_noembed_bool { , NoEmbed }, @@ -351,6 +326,5 @@ \tl_use:N \l_ltjpreset_add_features_tl ] { \ltjpreset_font_gt_m: } - \ExplSyntaxOff -\endinput
\ No newline at end of file +\endinput diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltj-adjust.lua b/Master/texmf-dist/tex/luatex/luatexja/ltj-adjust.lua index 4c418b39552..c81930a5e8a 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/ltj-adjust.lua +++ b/Master/texmf-dist/tex/luatex/luatexja/ltj-adjust.lua @@ -16,6 +16,7 @@ local id_kern = node.id('kern') local id_hlist = node.id('hlist') local id_glue = node.id('glue') local id_glue_spec = node.id('glue_spec') +local id_whatsit = node.id('whatsit') local has_attr = node.has_attribute local set_attr = node.set_attribute local attr_icflag = luatexbase.attributes['ltj@icflag'] @@ -144,7 +145,6 @@ local function aw_step1(p, res, total) -- その前の node が本来の末尾文字となる x = node.prev(node.prev(x)) end - local xi, xc = x.id if xi == id_glyph and has_attr(x, attr_curjfnt) == x.font then -- 和文文字 @@ -152,13 +152,13 @@ local function aw_step1(p, res, total) elseif xi == id_hlist and get_attr_icflag(x) == PACKED then -- packed JAchar xc = x.head + while xc.id == id_whatsit do xc = node.next(xc) end else return false-- それ以外は対象外. end - local xk = ltjf_font_metric_table -- - [xc.font].char_type[has_attr(xc, attr_jchar_class) or 0] - ['end_' .. res.name] or 0 - --print(res.name, total, xk, unicode.utf8.char(xc.char)) + local xk = ltjf_font_metric_table[xc.font] + xk = xk.char_type[has_attr(xc, attr_jchar_class) or 0] + xk = xk['end_' .. res.name] or 0 if xk>0 and total>=xk then --print("ADDED") diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltj-base.lua b/Master/texmf-dist/tex/luatex/luatexja/ltj-base.lua index d45a376ee90..1ca2a0a8486 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/ltj-base.lua +++ b/Master/texmf-dist/tex/luatex/luatexja/ltj-base.lua @@ -1,14 +1,6 @@ -- --- luatexja/base.lua +-- luatexja/ltj-base.lua -- -luatexbase.provides_module({ - name = 'luatexja.base', - date = '2011/11/18', - description = '', -}) -module('luatexja.base', package.seeall) -local err, warn, info, log = luatexbase.errwarinf(_NAME) - local ltb = luatexbase local tostring = tostring local node, table, tex, token = node, table, tex, token @@ -17,10 +9,18 @@ local cat_lp = luatexbase.catcodetables['latex-package'] -------------------- -public_name = 'luatexja' -public_version = 'alpha' +local public_name = 'luatexja' +local public_version = 'alpha' -------------------- Fully-expandable error messaging +local _error_set_break, _error_set_message, _error_show +local generic_error, _generic_warn_info +local generic_warning, generic_warning_no_line +local generic_info, generic_info_no_line +local package_error, package_warning, package_warning_no_line +local package_info, package_info_no_line +local ltj_error, ltj_warning_no_line + do --! LaTeX 形式のエラーメッセージ(\PackageError 等)を --! Lua 関数の呼び出しで行う. @@ -37,16 +37,16 @@ do return str:gsub(err_break, LF):explode(LF) end - function _error_set_break(str) + _error_set_break = function (str) err_break = str end - function _error_set_message(msgcont, main, help) + _error_set_message = function (msgcont, main, help) err_main = message_cont(main, msgcont) err_help = into_lines(help) end - function _error_show(escchar) + _error_show = function (escchar) local escapechar = tex.escapechar local newlinechar = tex.newlinechar local errorcontextlines = tex.errorcontextlines @@ -61,13 +61,13 @@ do local message_a = "Type H <return> for immediate help" - function generic_error(msgcont, main, ref, help) + generic_error = function (msgcont, main, ref, help) local mainref = main..".\n\n"..ref.."\n"..message_a _error_set_message(msgcont, mainref, help) _error_show(true) end - function _generic_warn_info(msgcont, main, warn, line) + _generic_warn_info = function (msgcont, main, warn, line) local mainc = message_cont(main, msgcont) local br = warn and "\n" or "" local out = warn and "term and log" or "log" @@ -78,79 +78,78 @@ do tex.newlinechar = newlinechar end - function generic_warning(msgcont, main) + generic_warning = function (msgcont, main) _generic_warn_info(msgcont, main, true, true) end - function generic_warning_no_line(msgcont, main) + generic_warning_no_line = function (msgcont, main) _generic_warn_info(msgcont, main, true, false) end - function generic_info(msgcont, main) + generic_info = function (msgcont, main) _generic_warn_info(msgcont, main, false, true) end - function generic_info_no_line(msgcont, main) + generic_info_no_line = function (msgcont, main) _generic_warn_info(msgcont, main, false, false) end - function package_error(pkgname, main, help) + package_error = function (pkgname, main, help) generic_error("("..pkgname.." ", "Package "..pkgname.." Error: "..main, "See the "..pkgname.." package documentation for explanation.", help) end - function package_warning(pkgname, main) + package_warning = function (pkgname, main) generic_warning("("..pkgname.." ", "Package "..pkgname.." Warning: "..main) end - function package_warning_no_line(pkgname, main) + package_warning_no_line = function (pkgname, main) generic_warning_no_line("("..pkgname.." ", "Package "..pkgname.." Warning: "..main) end - function package_info(pkgname, main) + package_info = function (pkgname, main) generic_info("("..pkgname.." ", "Package "..pkgname.." Info: "..main) end - function package_info_no_line(pkgname, main) + package_info_no_line = function (pkgname, main) generic_info_no_line("("..pkgname.." ", "Package "..pkgname.." Info: "..main) end - function ltj_error(main, help) + ltj_error = function (main, help) package_error(public_name, main, help) end - function ltj_warning_no_line(main) + ltj_warning_no_line = function (main) package_warning_no_line(public_name, main, help) end end -------------------- TeX stream I/O -do - --! ixbase.print() と同じ - --- Extension to tex.print(). Each argument string may contain - -- newline characters, in which case the string is output (to - -- TeX input stream) as multiple lines. - -- @param ... (string) string to output - function mprint(...) - local arg = {...} - local lines = {} - if type(arg[1]) == "number" then +--- Extension to tex.print(). Each argument string may contain +-- newline characters, in which case the string is output (to +-- TeX input stream) as multiple lines. +-- @param ... (string) string to output +local function mprint(...) + local arg = {...} + local lines = {} + if type(arg[1]) == "number" then table.insert(lines, arg[1]) table.remove(arg, 1) - end - for _, cnk in ipairs(arg) do + end + for _, cnk in ipairs(arg) do local ls = cnk:explode("\n") if ls[#ls] == "" then - table.remove(ls, #ls) + table.remove(ls, #ls) end for _, l in ipairs(ls) do - table.insert(lines, l) + table.insert(lines, l) end - end - return tex.print(unpack(lines)) - end - + end + return tex.print(unpack(lines)) end + -------------------- Handling of TeX values +local to_dimen, to_skip, dump_skip + do local glue_spec_id = node.id("glue_spec") @@ -168,7 +167,7 @@ do end --! ixbase.to_dimen() と同じ - function to_dimen(val) + to_dimen = function (val) if val == nil then return 0 elseif type(val) == "number" then @@ -190,7 +189,7 @@ do end --! ixbase.to_skip() と同じ - function to_skip(val) + to_skip = function (val) if type(val) == "userdata" then return val end @@ -218,7 +217,7 @@ do return res end - function dump_skip(s) + dump_skip = function (s) print(("%s+%s<%s>-%s<%s>"):format( s.width or 0, s.stretch or 0, s.stretch_order or 0, s.shrink or 0, s.shrink_order or 0)) @@ -226,8 +225,9 @@ do end -------------------- Virtual table for LaTeX counters -do +local counter +do --! ixbase.counter と同じ counter = {} local mt_counter = {} @@ -241,9 +241,11 @@ do end --! ixbase.length は tex.skip と全く同じなので不要. - end + -------------------- Number handling in TeX source +local scan_brace, scan_number + do local tok_escape = token.create("ltj@@q@escape") @@ -252,7 +254,7 @@ do local c_id_char_given = token.command_id("char_given") local function error_scan() - _M.package_error("luatexja", + package_error("luatexja", "Missing number of a permitted form, treated as zero", "A number should have been here; I inserted '0'.") end @@ -336,7 +338,7 @@ do ltb.add_to_callback("token_filter", proc, "ltj@grab@num", 1) end - function scan_brace() + scan_brace = function () scan_with(1, function() local next = token.get_next() if next[1] == 1 then @@ -349,7 +351,7 @@ do end) end - function scan_number() + scan_number = function () scan_with(1, function() local next = get_expd_next() local res, ok = { tok_num }, false @@ -386,33 +388,35 @@ do end -------------------- TeX register allocation +local const_number, count_number, attribute_number, dimen_number, skip_number + do local cmod_base_count = token.create('ltj@@count@zero')[2] local cmod_base_attr = token.create('ltj@@attr@zero')[2] local cmod_base_dimen = token.create('ltj@@dimen@zero')[2] local cmod_base_skip = token.create('ltj@@skip@zero')[2] - function const_number(name) + const_number = function (name) if name:sub(1, 1) == '\\' then name = name:sub(2) end return token.create(name)[2] end - function count_number(name) + count_number = function (name) if name:sub(1, 1) == '\\' then name = name:sub(2) end return token.create(name)[2] - cmod_base_count end - function attribute_number(name) + attribute_number = function (name) if name:sub(1, 1) == '\\' then name = name:sub(2) end return token.create(name)[2] - cmod_base_attr end - function dimen_number(name) + dimen_number = function (name) if name:sub(1, 1) == '\\' then name = name:sub(2) end return token.create(name)[2] - cmod_base_dimen end - function skip_number(name) + skip_number = function (name) if name:sub(1, 1) == '\\' then name = name:sub(2) end return token.create(name)[2] - cmod_base_skip end @@ -420,7 +424,7 @@ do end -------------------- mock of debug logger -if not _M.debug or _M.debug == _G.debug then +if not debug or debug == _G.debug then local function no_op() end debug = no_op package_debug = no_op @@ -432,11 +436,159 @@ if not _M.debug or _M.debug == _G.debug then end -------------------- getting next token -cstemp = nil -function get_cs(s) +local cstemp = nil +local function get_cs(s) cstemp = token.csname_name(token.get_next()) tex.sprint(cat_lp,'\\' .. s) end + +-------------------- cache management +-- load_cache (filename, outdate) +-- * filename: without suffix '.lua' +-- * outdate(t): return true iff the cache is outdated +-- * return value: non-nil iff the cache is up-to-date +-- save_cache (filename, t): no return value +-- save_cache_luc (filename, t): no return value +-- save_cache always calls save_cache_luc. +-- But sometimes we want to create only the precompiled cache, +-- when its 'text' version is already present in LuaTeX-ja distribution. + +require('lualibs-lpeg') -- string.split +require('lualibs-os') -- os.type + +local load_cache, save_cache_luc, save_cache + +do + local path = kpse.expand_var("$TEXMFVAR;$TEXMFSYSVAR;$TEXMFCACHE") + if os.type~='windows' then path = string.gsub(path, ':', ';') end + path = string.split(path, ';') + + local cache_dir = '/luatexja' + local find_file = kpse.find_file + local join, isreadable = file.join, file.isreadable + local tofile, serialize = table.tofile, table.serialize + local luc_suffix = jit and '.lub' or '.luc' + + -- determine save path + local savepath = '' + for _,v in pairs(path) do + local testpath = join(v, cache_dir) + if not lfs.isdir(testpath) then dir.mkdirs(testpath) end + if lfs.isdir(testpath) then savepath = testpath; break end + end + + save_cache_luc = function (filename, t, serialized) + local fullpath = savepath .. '/' .. filename .. luc_suffix + local s = serialized or serialize(t, 'return', false) + if s then + local sa = load(s) + local f = io.open(fullpath, 'wb') + if f and sa then + f:write(string.dump(sa, true)) + texio.write('(save cache: ' .. fullpath .. ')') + end + f:close() + end + end + + save_cache = function (filename, t) + local fullpath = savepath .. '/' .. filename .. '.lua' + local s = serialize(t, 'return', false) + if s then + local f = io.open(fullpath, 'w') + if f then + f:write(s) + texio.write('(save cache: ' .. fullpath .. ')') + end + f:close() + save_cache_luc(filename, t, s) + end + end + + local function load_cache_a (filename, outdate) + local result + for _,v in pairs(path) do + local fn = join(v, cache_dir, filename) + if isreadable(fn) then + texio.write('(load cache: ' .. fn .. ')') + result = loadfile(fn) + result = result and result(); break + end + end + if (not result) or outdate(result) then + return nil + else + return result + end + end + load_cache = function (filename, outdate) + local r = load_cache_a(filename .. luc_suffix, outdate) + if r then + return r + else + local r = load_cache_a(filename .. '.lua', outdate) + if r then save_cache_luc(filename, r) end -- update the precompiled cache + return r + end + end + +end + + +luatexja.base = { + public_name = public_name, + public_version = public_version, + -- + _error_set_break = _error_set_break, + _error_set_message = _error_set_message, + _error_show = _error_show, + _generic_warn_info = _generic_warn_info, + -- + package_error = package_error, + package_warning = package_warning, + package_warning_no_line = package_warning_no_line, + package_info = package_info, + package_info_no_line = package_info_no_line, + -- + generic_error = generic_error, + generic_warning = generic_warning, + generic_warning_no_line = generic_warning_no_line, + generic_info = generic_info, + generic_info_no_line = generic_info_no_line, + -- + ltj_warning_no_line = ltj_warning_no_line, + ltj_error = ltj_error, + -- + mprint = mprint, + -- + to_dimen = to_dimen, + dump_skip = dump_skip, + to_skip = to_skip, + -- + counter = counter, + -- + scan_brace = scan_brace, + scan_number = scan_number, + -- + const_number = const_number, + count_number = count_number, + attribute_number = attribute_number, + dimen_number = dimen_number, + skip_number = skip_number, + -- + get_cs = get_cs, + -- + load_cache = load_cache, + save_cache_luc = save_cache_luc, + save_cache = save_cache, + -- + debug = debug, + package_debug = package_debug, + debug_logger = debug_logger, + show_term = show_term, + show_log = show_log, + -- +} -------------------- all done -- EOF diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltj-charrange.lua b/Master/texmf-dist/tex/luatex/luatexja/ltj-charrange.lua index f15a15b18f5..e3478ab8180 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/ltj-charrange.lua +++ b/Master/texmf-dist/tex/luatex/luatexja/ltj-charrange.lua @@ -28,7 +28,8 @@ pow_table[31*ATTR_RANGE] = pow(2, 31) -- external 1 2 216, (out of range): 'other' -- initialize -local jcr_table_main = {} +jcr_table_main = {} +local jcr_table_main = jcr_table_main local jcr_cjk = 0; local jcr_noncjk = 1; local ucs_out = 0x110000 for i=0x80 ,0xFF do jcr_table_main[i]=1 end @@ -36,11 +37,11 @@ for i=0x100,ucs_out-1 do jcr_table_main[i]=0 end -- EXT: add characters to a range function add_char_range(b,e,ind) -- ind: external range number - if not ind or ind<0 or ind>=7*ATTR_RANGE then -- 0 は error にしない(隠し) + if not ind or ind<0 or ind>=31*ATTR_RANGE then -- 0 は error にしない(隠し) ltjb.package_error('luatexja', "invalid character range number (" .. ind .. ")", "A character range number should be in the range 1.." - .. 7+ATTR_RANGE-1 .. ",\n" .. + .. 31*ATTR_RANGE-1 .. ",\n" .. "ignored.") return elseif b<0x80 or e>=ucs_out then diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltj-compat.lua b/Master/texmf-dist/tex/luatex/luatexja/ltj-compat.lua index 6f66b99891a..6fe8e4fd168 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/ltj-compat.lua +++ b/Master/texmf-dist/tex/luatex/luatexja/ltj-compat.lua @@ -5,6 +5,17 @@ luatexja.load_module('base'); local ltjb = luatexja.base luatexja.load_module('stack'); local ltjs = luatexja.stack +-- load jisx0208 table +local cache_ver = 2 + +local cache_outdate_fn = function (t) return t.version~=cache_ver end +local jisx0208 = ltjb.load_cache('ltj-jisx0208',cache_outdate_fn) +if not jisx0208 then -- make cache + jisx0208 = require('ltj-jisx0208.lua') + ltjb.save_cache_luc('ltj-jisx0208', jisx0208) +end + + -- \kuten, \jis, \euc, \sjis, \ucs, \kansuji local function to_kansuji(num) if not num then num=0; return @@ -40,7 +51,7 @@ local function from_kuten(i) "I'm going to use 0 instead of that illegal character code.") i=0 end - tex.write(tostring(luatexja.jisx0208.table_jisx0208_uptex[i] or 0)) + tex.write(tostring(jisx0208.table_jisx0208_uptex[i] or 0)) end -- \euc: EUC-JP による符号位置 => Unicode 符号位置 diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltj-jfmglue.lua b/Master/texmf-dist/tex/luatex/luatexja/ltj-jfmglue.lua index 7018c7adf4a..a0df4e7e530 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/ltj-jfmglue.lua +++ b/Master/texmf-dist/tex/luatex/luatexja/ltj-jfmglue.lua @@ -3,7 +3,7 @@ -- luatexbase.provides_module({ name = 'luatexja.jfmglue', - date = '2013/04/27', + date = '2013/12/05', description = 'Insertion process of JFM glues and kanjiskip', }) module('luatexja.jfmglue', package.seeall) @@ -336,11 +336,7 @@ local calc_np_auxtable = { [id_math] = function(lp) Np.first, Np.nuc = (Np.first or lp), lp; set_attr(lp, attr_icflag, PROCESSED) -- set_attr_icflag_processed(lp); - lp = node_next(lp) - while lp.id~=id_math do - set_attr(lp, attr_icflag, PROCESSED) -- set_attr_icflag_processed(lp); - lp = node_next(lp) - end + lp = node.end_of_math(lp) set_attr(lp, attr_icflag, PROCESSED) -- set_attr_icflag_processed(lp); Np.last, Np.id = lp, id_math; return true, node_next(lp); diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltj-jfont.lua b/Master/texmf-dist/tex/luatex/luatexja/ltj-jfont.lua index 1b4d04df4e7..0e2673400b5 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/ltj-jfont.lua +++ b/Master/texmf-dist/tex/luatex/luatexja/ltj-jfont.lua @@ -3,7 +3,7 @@ -- luatexbase.provides_module({ name = 'luatexja.jfont', - date = '2011/05/11', + date = '2014/01/02', description = 'Loader for Japanese fonts', }) module('luatexja.jfont', package.seeall) @@ -122,49 +122,51 @@ function define_jfm(t) defjfm_res = t end -local function mult_table(old,scale) -- modified from table.fastcopy - if old then - local new = { } - for k,v in next, old do - if type(v) == "table" then - new[k] = mult_table(v,scale) - elseif type(v) == "number" then - new[k] = round(v*scale) - else - new[k] = v - end - end - return new - else return nil end -end - -local function update_jfm_cache(j,sz) - if metrics[j].size_cache[sz] then return end - local t = {} - metrics[j].size_cache[sz] = t - t.chars = metrics[j].chars - t.char_type = mult_table(metrics[j].char_type, sz) - for i,v in pairs(t.char_type) do - if type(i) == 'number' then -- char_type - for k,w in pairs(v.glue) do - local g, h = node.new(id_glue), node_new(id_glue_spec) - v.glue[k] = {g, (w[5] and w[5]/sz or 0)} - h.width, h.stretch, h.shrink = w[1], w[2], w[3] - h.stretch_order, h.shrink_order = 0, 0 - g.subtype = 0; g.spec = h; set_attr(g, attr_icflag, FROM_JFM + - (w[4] and w[4]/sz or 0)); +do + local function mult_table(old,scale) -- modified from table.fastcopy + if old then + local new = { } + for k,v in next, old do + if type(v) == "table" then + new[k] = mult_table(v,scale) + elseif type(v) == "number" then + new[k] = round(v*scale) + else + new[k] = v + end end - for k,w in pairs(v.kern) do - w[2] = w[2]/sz + return new + else return nil end + end + + function update_jfm_cache(j,sz) + if metrics[j].size_cache[sz] then return end + local t = {} + metrics[j].size_cache[sz] = t + t.chars = metrics[j].chars + t.char_type = mult_table(metrics[j].char_type, sz) + for i,v in pairs(t.char_type) do + if type(i) == 'number' then -- char_type + for k,w in pairs(v.glue) do + local g, h = node.new(id_glue), node_new(id_glue_spec) + v.glue[k] = {g, (w[5] and w[5]/sz or 0)} + h.width, h.stretch, h.shrink = w[1], w[2], w[3] + h.stretch_order, h.shrink_order = 0, 0 + g.subtype = 0; g.spec = h; set_attr(g, attr_icflag, FROM_JFM + + (w[4] and w[4]/sz or 0)); + end + for k,w in pairs(v.kern) do + w[2] = w[2]/sz + end end end + t.kanjiskip = mult_table(metrics[j].kanjiskip, sz) + t.xkanjiskip = mult_table(metrics[j].xkanjiskip,sz) + t.zw = round(metrics[j].zw*sz) + t.zh = round(metrics[j].zh*sz) end - t.kanjiskip = mult_table(metrics[j].kanjiskip, sz) - t.xkanjiskip = mult_table(metrics[j].xkanjiskip,sz) - t.zw = round(metrics[j].zw*sz) - t.zh = round(metrics[j].zh*sz) end - +local update_jfm_cache = update_jfm_cache luatexbase.create_callback("luatexja.find_char_class", "data", function (arg, fmtable, char) return 0 @@ -177,124 +179,297 @@ function find_char_class(c,m) luatexbase.call_callback("luatexja.find_char_class", 0, m, c) end -local function load_jfont_metric() - if jfm_file_name=='' then - ltjb.package_error('luatexja', - 'no JFM specified', - 'To load and define a Japanese font, a JFM must be specified.'.. - "The JFM 'ujis' will be used for now.") - jfm_file_name='ujis' + +------------------------------------------------------------------------ +-- LOADING JAPANESE FONTS +------------------------------------------------------------------------ + +do + local cstemp + local function load_jfont_metric() + if jfm_file_name=='' then + ltjb.package_error('luatexja', + 'no JFM specified', + 'To load and define a Japanese font, a JFM must be specified.'.. + "The JFM 'ujis' will be used for now.") + jfm_file_name='ujis' + end + for j,v in ipairs(metrics) do + if v.name==jfm_file_name then return j end + end + luatexja.load_lua('jfm-' .. jfm_file_name .. '.lua') + if defjfm_res then + defjfm_res.name = jfm_file_name + table.insert(metrics, defjfm_res) + return #metrics + else + return nil + end + end + +-- EXT + function jfontdefX(g) + local t = token.get_next() + cstemp=token.csname_name(t) + if g then luatexja.is_global = '\\global' else luatexja.is_global = '' end + tex.sprint(cat_lp, '\\expandafter\\font\\csname ' .. cstemp .. '\\endcsname') end - for j,v in ipairs(metrics) do - if v.name==jfm_file_name then return j end + + luatexbase.create_callback("luatexja.define_jfont", "data", function (ft, fn) return ft end) + +-- EXT + function jfontdefY() -- for horizontal font + local j = load_jfont_metric() + local fn = font.id(cstemp) + local f = getfont(fn) + if not j then + ltjb.package_error('luatexja', + "bad JFM `" .. jfm_file_name .. "'", + 'The JFM file you specified is not valid JFM file.\n'.. + 'So defining Japanese font is cancelled.') + tex.sprint(cat_lp, luatexja.is_global .. '\\expandafter\\let\\csname ' ..cstemp + .. '\\endcsname=\\relax') + return + end + update_jfm_cache(j, f.size) + local sz = metrics[j].size_cache[f.size] + local fmtable = { jfm = j, size = f.size, var = jfm_var, + zw = sz.zw, zh = sz.zh, + chars = sz.chars, char_type = sz.char_type, + kanjiskip = sz.kanjiskip, xkanjiskip = sz.xkanjiskip, + } + + fmtable = luatexbase.call_callback("luatexja.define_jfont", fmtable, fn) + font_metric_table[fn]=fmtable + tex.sprint(cat_lp, luatexja.is_global .. '\\protected\\expandafter\\def\\csname ' + .. cstemp .. '\\endcsname{\\ltj@curjfnt=' .. fn .. '\\relax}') end - luatexja.load_lua('jfm-' .. jfm_file_name .. '.lua') - if defjfm_res then - defjfm_res.name = jfm_file_name - table.insert(metrics, defjfm_res) - return #metrics - else - return nil +end + +do +-- EXT: zw, zh + function load_zw() + local a = font_metric_table[tex.attribute[attr_curjfnt]] + tex.setdimen('ltj@zw', a and a.zw or 0) + end + + function load_zh() + local a = font_metric_table[tex.attribute[attr_curjfnt]] + tex.setdimen('ltj@zh', a and a.zh or 0) end end +do + -- extract jfm_file_name and jfm_var + local function extract_metric(name) + local basename=name + local tmp = utf.sub(basename, 1, 5) + jfm_file_name = ''; jfm_var = '' + if tmp == 'file:' or tmp == 'name:' or tmp == 'psft:' then + basename = utf.sub(basename, 6) + end + local p = utf.find(basename, ":") + if p then + basename = utf.sub(basename, p+1) + else return + end + -- now basename contains 'features' only. + p=1 + while p do + local q = utf.find(basename, ";", p+1) or utf.len(basename)+1 + if utf.sub(basename, p, p+3)=='jfm=' and q>p+4 then + jfm_file_name = utf.sub(basename, p+4, q-1) + elseif utf.sub(basename, p, p+6)=='jfmvar=' and q>p+6 then + jfm_var = utf.sub(basename, p+7, q-1) + end + if utf.len(basename)+1==q then p = nil else p = q + 1 end + end + return + end + + -- replace fonts.define.read() + function font_callback(name, size, id, fallback) + extract_metric(name) + -- In the present imple., we don't remove "jfm=..." from name. + return fallback(name, size, id) + end +end ------------------------------------------------------------------------ --- LOADING JAPANESE FONTS +-- ALTERNATE FONTS ------------------------------------------------------------------------ -local cstemp +alt_font_table = {} +local alt_font_table = alt_font_table +local attr_curaltfnt = {} +local ucs_out = 0x110000 +------ for TeX interface -- EXT -function jfontdefX(g) - local t = token.get_next() - cstemp=token.csname_name(t) - if g then luatexja.is_global = '\\global' else luatexja.is_global = '' end - tex.sprint(cat_lp, '\\expandafter\\font\\csname ' .. cstemp .. '\\endcsname') +function set_alt_font(b,e,ind,bfnt) + -- ind: 新フォント, bfnt: 基底フォント + if b>e then b, e = e, b end + if b*e<=0 then + ltjb.package_eror('luatexja', + 'bad character range ([' .. b .. ',' .. e .. ']). ' .. + 'I take the intersection with [0x80, 0x10ffff].') + b, e = math.max(0x80,b),math.min(ucs_out-1,e) + elseif e<0 then -- b<e<0 + -- do nothing + elseif b<0x80 or e>=ucs_out then + ltjb.package_warning('luatexja', + 'bad character range ([' .. b .. ',' .. e .. ']). ' .. + 'I take the intersection with [0x80, 0x10ffff].') + b, e = math.max(0x80,b), math.min(ucs_out-1,e) + end + if not alt_font_table[bfnt] then alt_font_table[bfnt]={} end + local t = alt_font_table[bfnt] + local ac = getfont(ind).characters + if bfnt==ind then ind = nil end -- ind == bfnt の場合はテーブルから削除 + if e>=0 then -- character range + for i=b, e do + if ac[i]then t[i]=ind end + end + else + b, e = -e, -b + local tx = font_metric_table[bfnt].chars + for i,v in pairs(tx) do + if b<=v and v<=e and ac[i] then t[i]=ind end + end + end end -luatexbase.create_callback("luatexja.define_jfont", "data", function (ft, fn) return ft end) - -- EXT -function jfontdefY() -- for horizontal font - local j = load_jfont_metric() - local fn = font.id(cstemp) - local f = getfont(fn) - if not j then - ltjb.package_error('luatexja', - "bad JFM `" .. jfm_file_name .. "'", - 'The JFM file you specified is not valid JFM file.\n'.. - 'So defining Japanese font is cancelled.') - tex.sprint(cat_lp, luatexja.is_global .. '\\expandafter\\let\\csname ' ..cstemp - .. '\\endcsname=\\relax') - return +function clear_alt_font(bfnt) + if alt_font_table[bfnt] then + local t = alt_font_table[bfnt] + for i,_ in pairs(t) do t[i]=nil; end end - update_jfm_cache(j, f.size) - local sz = metrics[j].size_cache[f.size] - local fmtable = { jfm = j, size = f.size, var = jfm_var, - zw = sz.zw, zh = sz.zh, - chars = sz.chars, char_type = sz.char_type, - kanjiskip = sz.kanjiskip, xkanjiskip = sz.xkanjiskip, - } - - fmtable = luatexbase.call_callback("luatexja.define_jfont", fmtable, fn) - font_metric_table[fn]=fmtable - tex.sprint(cat_lp, luatexja.is_global .. '\\protected\\expandafter\\def\\csname ' - .. cstemp .. '\\endcsname{\\ltj@curjfnt=' .. fn .. '\\relax}') end --- zw, zh -function load_zw() - local a = font_metric_table[tex.attribute[attr_curjfnt]] - if a then - tex.setdimen('ltj@zw', a.zw) - else - tex.setdimen('ltj@zw',0) +------ used in ltjp.suppress_hyphenate_ja callback +function replace_altfont(pf, pc) + return (alt_font_table[pf] and alt_font_table[pf][pc]) + and alt_font_table[pf][pc] or pf +end + +------ for LaTeX interface + +local alt_font_table_latex = {} + +-- EXT +function clear_alt_font_latex(bbase) + local t = alt_font_table_latex[bbase] + if t then + for j,v in pairs(t) do t[j] = nil end end end -function load_zh() - local a = font_metric_table[tex.attribute[attr_curjfnt]] - if a then - tex.setdimen('ltj@zh', a.zh) - else - tex.setdimen('ltj@zh',0) +-- EXT +function set_alt_font_latex(b,e,ind,bbase) + -- ind: Alt font の enc/fam/ser/shape, bbase: 基底フォントの enc/fam/ser/shape + if b>e then b, e = e, b end + if b*e<=0 then + ltjb.package_eror('luatexja', + 'bad character range ([' .. b .. ',' .. e .. ']). ' .. + 'I take the intersection with [0x80, 0x10ffff].') + b, e = math.max(0x80,b),math.min(ucs_out-1,e) + elseif e<0 then -- b<e<0 + -- do nothing + elseif b<0x80 or e>=ucs_out then + ltjb.package_warning('luatexja', + 'bad character range ([' .. b .. ',' .. e .. ']). ' .. + 'I take the intersection with [0x80, 0x10ffff].') + b, e = math.max(0x80,b), math.min(ucs_out-1,e) + end + + if not alt_font_table_latex[bbase] then alt_font_table_latex[bbase]={} end + local t = alt_font_table_latex[bbase] + if not t[ind] then t[ind] = {} end + for i=b, e do + for j,v in pairs(t) do + if v[i] then -- remove old entry + if j~=ind then v[i]=nil end; break + end + end + t[ind][i]=true + end + -- remove the empty tables + for j,v in pairs(t) do + local flag_clear = true + for k,_ in pairs(v) do flag_clear = false; break end + if flag_clear then t[j]=nil end end + if ind==bbase then t[bbase] = nil end end --- extract jfm_file_name and jfm_var -local function extract_metric(name) - local basename=name - local tmp = utf.sub(basename, 1, 5) - jfm_file_name = ''; jfm_var = '' - if tmp == 'file:' or tmp == 'name:' or tmp == 'psft:' then - basename = utf.sub(basename, 6) +-- ここから先は 新 \selectfont の内部でしか実行されない +do + local alt_font_base, alt_font_base_num + +-- EXT + function print_aftl_address(bbase) + local t = alt_font_table_latex[bbase] + if not t then t = {}; alt_font_table_latex[bbase] = t end + tex.sprint(cat_lp, (tostring(t):gsub('table: 0x','ltjaltfont'))) end - local p = utf.find(basename, ":") - if p then - basename = utf.sub(basename, p+1) - else return +-- EXT + function output_alt_font_cmd(bbase) + alt_font_base = bbase + alt_font_base_num = tex.getattribute(attr_curjfnt) + local t = alt_font_table[alt_font_base_num] + if t then + for i,_ in pairs(t) do t[i]=nil end + end + t = alt_font_table_latex[bbase] + if t then + for i,_ in pairs(t) do + tex.sprint(cat_lp, '\\ltj@pickup@altfont@aux{' .. i .. '}') + end + end end - -- now basename contains 'features' only. - p=1 - while p do - local q = utf.find(basename, ";", p+1) or utf.len(basename)+1 - if utf.sub(basename, p, p+3)=='jfm=' and q>p+4 then - jfm_file_name = utf.sub(basename, p+4, q-1) - elseif utf.sub(basename, p, p+6)=='jfmvar=' and q>p+6 then - jfm_var = utf.sub(basename, p+7, q-1) + +-- EXT + function pickup_alt_font_a(size_str) + local t = alt_font_table_latex[alt_font_base] + if t then + for i,v in pairs(t) do + tex.sprint(cat_lp, '\\expandafter\\ltj@pickup@altfont@copy' + .. '\\csname ' .. i .. '/' .. size_str .. '\\endcsname{' .. i .. '}') + end + end + end + + local function pickup_alt_font_class(class, afnt_num, afnt_chars) + local t = alt_font_table[alt_font_base_num] + local tx = font_metric_table[alt_font_base_num].chars + for i,v in pairs(tx) do + if v==class and afnt_chars[i] then t[i]=afnt_num end + end + end + +-- EXT + function pickup_alt_font_b(afnt_num, afnt_base) + local t = alt_font_table[alt_font_base_num] + local ac = getfont(afnt_num).characters + if not t then t = {}; alt_font_table[alt_font_base_num] = t end + for i,v in pairs(alt_font_table_latex[alt_font_base]) do + if i == afnt_base then + for j,_ in pairs(v) do + if j>=0 then + if ac[j] then t[j]=afnt_num end + else -- -n (n>=1) means that the character class n, + -- which is defined in the JFM + pickup_alt_font_class(-j, afnt_num, ac) + end + end + return + end end - if utf.len(basename)+1==q then p = nil else p = q + 1 end end - return -end --- replace fonts.define.read() -function font_callback(name, size, id, fallback) - extract_metric(name) - -- In the present imple., we don't remove "jfm=..." from name. - return fallback(name, size, id) end + ------------------------------------------------------------------------ -- MISC ------------------------------------------------------------------------ diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltj-jisx0208.lua b/Master/texmf-dist/tex/luatex/luatexja/ltj-jisx0208.lua index 1150dcb9804..1d9a70b7942 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/ltj-jisx0208.lua +++ b/Master/texmf-dist/tex/luatex/luatexja/ltj-jisx0208.lua @@ -1,4 +1,5 @@ -luatexja.jisx0208 = { +return { +version = 2, table_jisx0208_uptex = { [0x101] = 0x3000, --( ) [0x102] = 0x3001, --(、) diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltj-math.lua b/Master/texmf-dist/tex/luatex/luatexja/ltj-math.lua index 52548a76907..5f9e650c5ca 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/ltj-math.lua +++ b/Master/texmf-dist/tex/luatex/luatexja/ltj-math.lua @@ -34,7 +34,7 @@ local id_frac = node.id('fraction') local id_simple = node.id('noad') local id_sub_mlist = node.id('sub_mlist') -local PROCESSED = luatexja.icflag_table.PROCESSED +local PROCESSED = luatexja.icflag_table.PROCESSED local ltjf_font_metric_table = ltjf.font_metric_table local ltjf_find_char_class = ltjf.find_char_class @@ -89,24 +89,33 @@ local MJSS = luatexja.stack_table_index.MJSS conv_jchar_to_hbox_A = function (p, sty) if not p then return nil - elseif p.id == id_sub_mlist then - if p.head then - p.head = conv_jchar_to_hbox(p.head, sty) - end - elseif p.id == id_mchar then - local fam = has_attr(p, attr_jfam) or -1 - if (not is_math_letters[p.char]) and ltjc.is_ucs_in_japanese_char(p) and fam>=0 then - local f = ltjs.get_penalty_table(MJT + 0x100 * sty + fam, -1, tex_getcount('ltj@@stack')) - if f ~= -1 then - local q = node_new(id_sub_box) - local r = node_new(id_glyph); r.next = nil - r.char = p.char; r.font = f; r.subtype = 256 - set_attr(r, attr_ykblshift, 0) - set_attr(r, attr_icflag, PROCESSED) - local met = ltjf_font_metric_table[f] - ltjw.head = r; ltjw.capsule_glyph(r, tex.mathdir , true, met, ltjf_find_char_class(p.char, met)); - q.head = ltjw.head; node_free(p); p=q; - end + else + local pid = p.id + if pid == id_sub_mlist then + if p.head then + p.head = conv_jchar_to_hbox(p.head, sty) + end + elseif pid == id_mchar then + local fam = has_attr(p, attr_jfam) or -1 + if (not is_math_letters[p.char]) and ltjc.is_ucs_in_japanese_char(p) and fam>=0 then + local f = ltjs.get_penalty_table(MJT + 0x100 * sty + fam, -1, tex_getcount('ltj@@stack')) + if f ~= -1 then + local q = node_new(id_sub_box) + local r = node_new(id_glyph); r.next = nil + r.char = p.char; r.font = f; r.subtype = 256 + local k = has_attr(r,attr_ykblshift) or 0 + set_attr(r, attr_ykblshift, 0) + -- ltj-setwidth 内で実際の位置補正はおこなうので,補正量を退避 + ltjw.head = r; + local met = ltjf_font_metric_table[f] + ltjw.capsule_glyph(r, tex.mathdir , true, met, ltjf_find_char_class(p.char, met)); + q.head = ltjw.head; node_free(p); p=q; + set_attr(q.head, attr_yablshift, k) + end + end + elseif pid == id_sub_box and p.head then + -- \hbox で直に与えられた内容は上下位置を補正する必要はない + set_attr(p.head, attr_icflag, PROCESSED) end end return p diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltj-otf.lua b/Master/texmf-dist/tex/luatex/luatexja/ltj-otf.lua index cdcd7e21175..47973decb14 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/ltj-otf.lua +++ b/Master/texmf-dist/tex/luatex/luatexja/ltj-otf.lua @@ -1,15 +1,13 @@ -- --- luatexja/otf.lua +-- luatexja/ltj-otf.lua -- -luatexbase.provides_module({ - name = 'luatexja.otf', - date = '2013/05/11', - description = 'The OTF Lua module for LuaTeX-ja', -}) +require('unicode') +require('lualibs') luatexja.load_module('base'); local ltjb = luatexja.base luatexja.load_module('jfont'); local ltjf = luatexja.jfont luatexja.load_module('rmlgbm'); local ltjr = luatexja.rmlgbm +luatexja.load_module('charrange'); local ltjc = luatexja.charrange local id_glyph = node.id('glyph') local id_whatsit = node.id('whatsit') @@ -23,6 +21,7 @@ local has_attr = node.has_attribute local set_attr = node.set_attribute local unset_attr = node.unset_attribute local node_insert_after = node.insert_after +local identifiers = fonts.hashes.identifiers local attr_curjfnt = luatexbase.attributes['ltj@curjfnt'] local attr_jchar_class = luatexbase.attributes['ltj@charclass'] @@ -32,6 +31,7 @@ local attr_ykblshift = luatexbase.attributes['ltj@ykblshift'] local ltjf_font_metric_table = ltjf.font_metric_table local ltjf_find_char_class = ltjf.find_char_class local ltjr_cidfont_data = ltjr.cidfont_data +local ltjc_is_ucs_in_japanese_char = ltjc.is_ucs_in_japanese_char local OTF = luatexja.userid_table.OTF @@ -70,7 +70,7 @@ end local function cid(key) if key==0 then return append_jglyph(char) end - local curjfnt = fonts.hashes.identifiers[tex.attribute[attr_curjfnt]] + local curjfnt = identifiers[tex.attribute[attr_curjfnt]] if not curjfnt.cidinfo or curjfnt.cidinfo.ordering ~= "Japan1" and curjfnt.cidinfo.ordering ~= "GB1" and @@ -137,7 +137,7 @@ luatexbase.add_to_callback('pre_linebreak_filter', -- 和文フォント読み込み時に,CID -> unicode 対応をとっておく. local function cid_to_char(fmtable, fn) - local fi = fonts.hashes.identifiers[fn] + local fi = identifiers[fn] if fi.cidinfo and fi.cidinfo.ordering == "Japan1" then fmtable.cid_char_type = {} for i, v in pairs(fmtable.chars) do @@ -170,9 +170,167 @@ end luatexbase.add_to_callback("luatexja.find_char_class", cid_set_char_class, "ltj.otf.find_char_class", 1) --------------------- all done +-------------------- IVS +local font_ivs_table = {} -- key: fontnumber +local enable_ivs +do + local is_ivs_enabled = false + local ivs -- temp table + local sort = table.sort + local uniq_flag + local function add_ivs_table(tg, unitable) + for gu, gv in pairs(tg) do + local ga = gv.altuni + if ga then + for _,at in pairs(ga) do + local bu, vsel = at.unicode, (at.variant or -1) + if vsel~=-1 then + if vsel>=0xE0100 then vsel = vsel - 0xE0100 end + if not ivs[bu] then ivs[bu] = {} end + uniq_flag = true + for i,_ in pairs(ivs[bu]) do + if i==vs then uniq_flag = false; break end + end + if uniq_flag then + ivs[bu][vsel] = unitable[gv.name] + end + end + end + end + end + end + local function make_ivs_table(id, fname) + ivs = {} + local fl = fontloader.open(fname) + local ft = fontloader.to_table(fl) + local unicodes = id.resources.unicodes + add_ivs_table(ft.glyphs, id.resources.unicodes) + if ft.subfonts then + for _,v in pairs(ft.subfonts) do + add_ivs_table(v.glyphs, id.resources.unicodes) + end + end + fontloader.close(fl) + return ivs + end + +-- loading and saving + local font_ivs_basename = {} -- key: basename + local cache_ver = 4 + local checksum = file.checksum + + local function prepare_ivs_data(n, id) + -- test if already loaded + if type(id)=='number' then -- sometimes id is an integer + font_ivs_table[n] = font_ivs_table[id]; return + elseif not id then return + end + local fname = id.filename + local bname = file.basename(fname) + if not fname then + font_ivs_table[n] = {}; return + elseif font_ivs_basename[bname] then + font_ivs_table[n] = font_ivs_basename[bname]; return + end + + -- if the cache is present, read it + local newsum = checksum(fname) -- MD5 checksum of the fontfile + local v = "ivs_" .. string.lower(file.nameonly(fname)) + local dat = ltjb.load_cache(v, + function (t) return (t.version~=cache_ver) or (t.chksum~=newsum) end + ) + -- if the cache is not found or outdated, save the cache + if dat then + font_ivs_basename[bname] = dat[1] or {} + else + dat = make_ivs_table(id, fname) + font_ivs_basename[bname] = dat or {} + ltjb.save_cache( v, + { + chksum = checksum(fname), + version = cache_ver, + dat, + }) + end + font_ivs_table[n] = font_ivs_basename[bname] + end + +-- 組版時 + local function ivs_jglyph(char, bp, pf) + local p = node_new(id_whatsit,sid_user) + p.user_id=OTF; p.type=100; p.value=char + set_attr(p, attr_curjfnt, pf) + set_attr(p, attr_yablshift, has_attr(bp, attr_ykblshift) or 0) + return p + end + + local function do_ivs_repr(head) + local p = head + while p do + local pid = p.id + if pid==id_glyph then + local pf = p.font + if (has_attr(p, attr_curjfnt) or 0) == pf then + -- only works with JAchars + local q = node_next(p) -- the next node of p + if q and q.id==id_glyph then + local qc = q.char + if (qc>=0xFE00 and qc<=0xFE0F) or (qc>=0xE0100 and qc<0xE01F0) then + -- q is a variation selector + if qc>=0xE0100 then qc = qc - 0xE0100 end + local pt = font_ivs_table[pf] + pt = pt and pt[p.char]; pt = pt and pt[qc] + head = node_remove(head,q) + if pt then + local np = ivs_jglyph(pt, p, pf) + head = node_insert_after(head, p, np) + head = node_remove(head,p) + p = np + end + end + end + end + end + p = node_next(p) + end + return head + end + + -- font define + local function font_callback(name, size, id, fallback) + local d = fallback(name, size, id) + prepare_ivs_data(id, d) + return d + end + + enable_ivs = function () + if is_ivs_enabled then + ltjb.package_warning('luatexja-otf', + 'luatexja.otf.enable_ivs() was already called, so this call is ignored', '') + else + luatexbase.add_to_callback('hpack_filter', + function (head) return do_ivs_repr(head) end,'do_ivs', 1) + luatexbase.add_to_callback('pre_linebreak_filter', + function (head) return do_ivs_repr(head) end, 'do_ivs', 1) + local ivs_callback = function (name, size, id) + return font_callback( + name, size, id, + function (name, size, id) return luatexja.font_callback(name, size, id) end + ) + end + luatexbase.add_to_callback('define_font',ivs_callback,"luatexja.ivs_font_callback", 1) + for i=1,font.nextid()-1 do + if identifiers[i] then prepare_ivs_data(i, identifiers[i]) end + end + is_ivs_enabled = true + end + end +end + luatexja.otf = { append_jglyph = append_jglyph, + enable_ivs = enable_ivs, -- 隠し機能: IVS + font_ivs_table = font_ivs_table, cid = cid, } diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltj-plain.sty b/Master/texmf-dist/tex/luatex/luatexja/ltj-plain.sty index 7f48ff85897..c958ddd0b47 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/ltj-plain.sty +++ b/Master/texmf-dist/tex/luatex/luatexja/ltj-plain.sty @@ -66,10 +66,10 @@ "500-"10FF, "1200-"1DFF, "2440-"245F, "27C0-"28FF, "2A00-"2AFF, "2C00-"2E7F, "4DC0-"4DFF, "A4D0-"A82F, "A840-"ABFF, "FB00-"FE0F, "FE20-"FE2F, "FE70-"FEFF, "10000-"1FFFF, "E000-"F8FF} % non-Japanese -\ltjdefcharrange{5}{"D800-"DFFF, "E0000-"10FFFF} +\ltjdefcharrange{5}{"D800-"DFFF, "E0000-"E00FF, "E01F0-"10FFFF} \ltjdefcharrange{6}{% "2460-"24FF, "2E80-"2EFF, "3000-"30FF, "3190-"319F, "31F0-"4DBF, - "4E00-"9FFF, "F900-"FAFF, "FE10-"FE6F, "20000-"2FFFF} + "4E00-"9FFF, "F900-"FAFF, "FE10-"FE6F, "20000-"2FFFF,"E0100-"E01EF} \ltjdefcharrange{7}{ "1100-"11FF, "2F00-"2FFF, "3100-"31EF, "A000-"A4CF, "A830-"A83F, "AC00-"D7FF} diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltj-pretreat.lua b/Master/texmf-dist/tex/luatex/luatexja/ltj-pretreat.lua index 6f72256d05e..f8eed907d45 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/ltj-pretreat.lua +++ b/Master/texmf-dist/tex/luatex/luatexja/ltj-pretreat.lua @@ -4,6 +4,7 @@ luatexja.load_module('charrange'); local ltjc = luatexja.charrange luatexja.load_module('stack'); local ltjs = luatexja.stack +luatexja.load_module('jfont'); local ltjf = luatexja.jfont local floor = math.floor local has_attr = node.has_attribute @@ -24,6 +25,7 @@ local attr_curjfnt = luatexbase.attributes['ltj@curjfnt'] local attr_icflag = luatexbase.attributes['ltj@icflag'] local ltjc_is_ucs_in_japanese_char = ltjc.is_ucs_in_japanese_char +local ltjf_replace_altfont = ltjf.replace_altfont local attr_orig_char = luatexbase.attributes['ltj@origchar'] local STCK = luatexja.userid_table.STCK @@ -39,9 +41,11 @@ local function suppress_hyphenate_ja(head) local pid = p.id if pid == id_glyph then if (has_attr(p, attr_icflag) or 0)<=0 and ltjc_is_ucs_in_japanese_char(p) then - p.font = has_attr(p, attr_curjfnt) or p.font + local pc = p.char + local pf = ltjf_replace_altfont(has_attr(p, attr_curjfnt) or p.font, pc) + p.font = pf; set_attr(p, attr_curjfnt, pf) p.subtype = floor(p.subtype*0.5)*2 - set_attr(p, attr_orig_char, p.char) + set_attr(p, attr_orig_char, pc) end elseif pid == id_math then p = node_next(p) -- skip math on diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltj-rmlgbm.lua b/Master/texmf-dist/tex/luatex/luatexja/ltj-rmlgbm.lua index e08cbf1b85a..b81c269ab43 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/ltj-rmlgbm.lua +++ b/Master/texmf-dist/tex/luatex/luatexja/ltj-rmlgbm.lua @@ -1,26 +1,13 @@ -- --- luatexja/rmlgbm.lua +-- luatexja/ltj-rmlgbm.lua -- -luatexbase.provides_module({ - name = 'luatexja.rmlgbm', - date = '2013/05/14', - description = 'Definitions of non-embedded Japanese (or other CJK) fonts', -}) -module('luatexja.rmlgbm', package.seeall) -local err, warn, info, log = luatexbase.errwarinf(_NAME) - luatexja.load_module('base'); local ltjb = luatexja.base -cidfont_data = {} -local cidfont_data = cidfont_data +local cidfont_data = {} local cache_chars = {} -local path = { - localdir = file.join(kpse.expand_var("$TEXMFVAR"), aux_dir), - systemdir = file.join(kpse.expand_var("$TEXMFSYSVAR"), aux_dir), -} +local cache_ver = '2' local cid_reg, cid_order, cid_supp, cid_name -local taux_dir = 'luatex-cache/luatexja' local cid_replace = { ["Adobe-Japan1"] = {"UniJIS2004-UTF32", 23057, 6, function (i) @@ -56,6 +43,7 @@ local cid_replace = { } -- reading CID maps +local make_cid_font do local line, fh -- line, file handler local tt,cidm -- characters, cid->(Unicode) @@ -117,7 +105,7 @@ do local function entry(a) return {index = a} end - function make_cid_font() + make_cid_font = function () local kx = cid_replace[cid_name] if not kx then return end local k = { @@ -184,42 +172,23 @@ do end -- Save - local savepath = path.localdir .. '/luatexja/' - if not lfs.isdir(savepath) then - dir.mkdirs(savepath) - end - savepath = file.join(savepath, "ltj-cid-auto-" - .. string.lower(cid_name) .. ".lua") - if file.iswritable(savepath) then - k.characters[46].width = math.floor(655360/14); - -- Standard fonts are ``seriffed''. - table.tofile(savepath, k,'return', false, true, false ) - ltjb.package_info_no_line('luatexja', "saved :'" .. savepath .. "'", '') - else - ltjb.package_warning_no_line('luatexja', "failed to save to '" .. savepath .. "'", '') - end + k.characters[46].width = math.floor(655360/14); + ltjb.save_cache( "ltj-cid-auto-" .. string.lower(cid_name), + { + version = cache_ver, + k, + }) end end -local make_cid_font = make_cid_font -- -local function cid_cache_load(fullpath) - cidfont_data[cid_name] = require(fullpath) - cache_chars[cid_name] = { [655360] = cidfont_data[cid_name].characters } -end - +local function cid_cache_outdated(t) return t.version~=cache_ver end local function read_cid_font() - -- local v = "ltj-cid-" .. string.lower(cid_name) .. ".lua" - local v = "ltj-cid-auto-" .. string.lower(cid_name) .. ".lua" - local localpath = file.join(path.localdir .. '/luatexja', v) - local systempath = file.join(path.systemdir .. '/luatexja' , v) - local kpsefound = kpse.find_file(v) - if kpsefound and file.isreadable(kpsefound) then - cid_cache_load(kpsefound) - elseif file.isreadable(localpath) then - cid_cache_load(localpath) - elseif file.isreadable(systempath) then - cid_cache_load(systempath) + local dat = ltjb.load_cache("ltj-cid-auto-" .. string.lower(cid_name), + cid_cache_outdated ) + if dat then + cidfont_data[cid_name] = dat[1] + cache_chars[cid_name] = { [655360] = cidfont_data[cid_name].characters } else -- Now we must create the virtual metrics from CMap. make_cid_font() @@ -324,7 +293,7 @@ local function mk_rml(name, size, id) return fontdata end -function font_callback(name, size, id, fallback) +local function font_callback(name, size, id, fallback) local p = utf.find(name, ":") or utf.len(name)+1 if utf.sub(name, 1, p-1) == 'psft' then local s = "Adobe-Japan1-6" @@ -370,3 +339,9 @@ end cid_reg, cid_order, cid_name, cid_supp = 'Adobe', 'Japan1', 'Adobe-Japan1' read_cid_font() + + +luatexja.rmlgbm = { + cidfont_data = cidfont_data, + font_callback = font_callback, +} diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltj-setwidth.lua b/Master/texmf-dist/tex/luatex/luatexja/ltj-setwidth.lua index d20bb15fefe..a3e9f23bf1c 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/ltj-setwidth.lua +++ b/Master/texmf-dist/tex/luatex/luatexja/ltj-setwidth.lua @@ -3,7 +3,7 @@ -- luatexbase.provides_module({ name = 'luatexja.setwidth', - date = '2013/03/14', + date = '2013/12/05', description = '', }) module('luatexja.setwidth', package.seeall) @@ -37,10 +37,10 @@ local attr_icflag = luatexbase.attributes['ltj@icflag'] local ltjf_font_metric_table = ltjf.font_metric_table -local PACKED = 2 -local PROCESSED = 11 -local IC_PROCESSED = 12 -local PROCESSED_BEGIN_FLAG = 32 +local PACKED = luatexja.icflag_table.PACKED +local PROCESSED = luatexja.icflag_table.PROCESSED +local IC_PROCESSED = luatexja.icflag_table.IC_PROCESSED +local PROCESSED_BEGIN_FLAG = luatexja.icflag_table.PROCESSED_BEGIN_FLAG do local floor = math.floor @@ -51,7 +51,7 @@ do end local get_pr_begin_flag = get_pr_begin_flag -head = nil +head = nil; luatexbase.create_callback("luatexja.set_width", "data", function (fstable, fmtable, jchar_class) @@ -66,15 +66,17 @@ function capsule_glyph(p, dir, mode, met, class) if not char_data then return node_next(p) end local fwidth, pwidth = char_data.width, p.width fwidth = (fwidth ~= 'prop') and fwidth or pwidth - local fheight, fdepth = char_data.height, char_data.depth fshift.down = char_data.down; fshift.left = char_data.left fshift = luatexbase.call_callback("luatexja.set_width", fshift, met, class) + local fheight, fdepth = char_data.height, char_data.depth + fheight = (fheight ~= 'prop') and fheight or p.height + fdepth = (fdepth ~= 'prop') and fdepth or p.depth if (mode or pwidth ~= fwidth or p.height ~= fheight or p.depth ~= fdepth) then local y_shift, ca = - p.yoffset + (has_attr(p,attr_ykblshift) or 0), char_data.align local q; head, q = node.remove(head, p) p.yoffset, p.next = -fshift.down, nil - if total ~= 0 and ca~='left' then + if ca~='left' then p.xoffset = p.xoffset - fshift.left + (((ca=='right') and fwidth - pwidth) or round((fwidth - pwidth)*0.5)) else @@ -100,9 +102,10 @@ function set_ja_width(ahead, dir) local p = ahead; head = ahead local m = false -- is in math mode? while p do - if (p.id==id_glyph) + local pid = p.id + if (pid==id_glyph) and ((has_attr(p, attr_icflag) or 0)%PROCESSED_BEGIN_FLAG)<=0 then - local pf = p.font + local pf = p.font if pf == has_attr(p, attr_curjfnt) then p = capsule_glyph(p, dir, false, ltjf_font_metric_table[pf], has_attr(p, attr_jchar_class)) @@ -114,11 +117,17 @@ function set_ja_width(ahead, dir) m = (p.subtype==0); p = node_next(p) else if m then - if p.id==id_hlist or p.id==id_vlist then - p.shift = p.shift + (has_attr(p,attr_yablshift) or 0) - elseif p.id==id_rule then - local v = has_attr(p,attr_yablshift) or 0 - p.height = p.height - v; p.depth = p.depth + v + -- 数式の位置補正 + if pid==id_hlist or pid==id_vlist then + if (has_attr(p, attr_icflag) or 0) ~= PROCESSED then + p.shift = p.shift + (has_attr(p,attr_yablshift) or 0) + end + elseif pid==id_rule then + if (has_attr(p, attr_icflag) or 0) ~= PROCESSED then + local v = has_attr(p,attr_yablshift) or 0 + p.height = p.height - v; p.depth = p.depth + v + set_attr(p, attr_icflag, PROCESSED + get_pr_begin_flag(p)) + end end end p = node_next(p) diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltj-unicode-ccfix.tex b/Master/texmf-dist/tex/luatex/luatexja/ltj-unicode-ccfix.tex index 08b27a11262..0c85adeb899 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/ltj-unicode-ccfix.tex +++ b/Master/texmf-dist/tex/luatex/luatexja/ltj-unicode-ccfix.tex @@ -3754,5 +3754,10 @@ \ID 2FA1C 2FA1C \ID 2FA1D 2FA1D +\def\ND #1 #2 {\set{#1}{#2}{\global\catcode\n=12 }} +%\ND 3000 3000 +%\ND FF00 FFF0 +%\ID FF10 FF19 +%\ID FF21 FF3A +%\ID FF41 FF5A \endgroup - diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltjsarticle.cls b/Master/texmf-dist/tex/luatex/luatexja/ltjsarticle.cls index d1042ce9e49..a543e713dc4 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/ltjsarticle.cls +++ b/Master/texmf-dist/tex/luatex/luatexja/ltjsarticle.cls @@ -38,7 +38,7 @@ %% Right brace \} Tilde \~} \NeedsTeXFormat{LaTeX2e} \ProvidesClass{ltjsarticle} - [2013/06/06 ] + [2014/01/13 ] \RequirePackage{luatexja} \newif\if@restonecol \newif\if@titlepage @@ -325,7 +325,8 @@ \AtBeginDocument{% \reDeclareMathAlphabet{\mathrm}{\mathrm}{\mathmc} \reDeclareMathAlphabet{\mathbf}{\mathbf}{\mathgt}}% -\ltjsetparameter{jaxspmode={`〒,2}} +\ltjsetparameter{jaxspmode={`!,2}} +\ltjsetparameter{jaxspmode={`〒,1}} \ltjsetparameter{alxspmode={`+,3}} \ltjsetparameter{alxspmode={`\%,3}} \def\@{\spacefactor3000\space} @@ -1127,7 +1128,12 @@ \newcommand\@tocrmarg{2.55em} \newcommand\@dotsep{4.5} \setcounter{tocdepth}{2} +\newdimen\js@tocl@width \newcommand{\tableofcontents}{% + \settowidth\js@tocl@width{\headfont\presectionname\postsectionname}% + \settowidth\@tempdima{\headfont\appendixname}% + \ifdim\js@tocl@width<\@tempdima\relax\setlength\js@tocl@width{\@tempdima}\fi + \ifdim\js@tocl@width<2\zw \divide\js@tocl@width by 2 \advance\js@tocl@width 1\zw\fi \section*{\contentsname}% \@mkboth{\contentsname}{\contentsname}% \@starttoc{toc}% @@ -1156,15 +1162,24 @@ \rightskip\@tocrmarg \parfillskip-\rightskip \leavevmode\headfont - \setlength\@lnumwidth{4\zw}% 元1.5em [2003-03-02] + %\setlength\@lnumwidth{4\zw}% 元1.5em [2003-03-02] + \setlength\@lnumwidth{\js@tocl@width}\advance\@lnumwidth 2\zw \advance\leftskip\@lnumwidth \hskip-\leftskip #1\nobreak\hfil\nobreak\hbox to\@pnumwidth{\hss#2}\par \endgroup \fi} -\newcommand*{\l@subsection} {\@dottedtocline{2}{1\zw}{3\zw}} -\newcommand*{\l@subsubsection}{\@dottedtocline{3}{2\zw}{3\zw}} -\newcommand*{\l@paragraph} {\@dottedtocline{4}{3\zw}{3\zw}} -\newcommand*{\l@subparagraph} {\@dottedtocline{5}{4\zw}{3\zw}} +\newcommand*{\l@subsection}{% + \@tempdima\js@tocl@width \advance\@tempdima -1\zw + \@dottedtocline{2}{\@tempdima}{3\zw}} +\newcommand*{\l@subsubsection}{% + \@tempdima\js@tocl@width \advance\@tempdima 0\zw + \@dottedtocline{3}{\@tempdima}{4\zw}} +\newcommand*{\l@paragraph}{% + \@tempdima\js@tocl@width \advance\@tempdima 1\zw + \@dottedtocline{4}{\@tempdima}{5\zw}} +\newcommand*{\l@subparagraph}{% + \@tempdima\js@tocl@width \advance\@tempdima 2\zw + \@dottedtocline{5}{\@tempdima}{6\zw}} \newdimen\@lnumwidth \def\numberline#1{\hb@xt@\@lnumwidth{#1\hfil}\hspace{0pt}} \def\@dottedtocline#1#2#3#4#5{\ifnum #1>\c@tocdepth \else @@ -1262,6 +1277,9 @@ \def\footnote{\inhibitglue\footnotes@ve} \let\footnotemarks@ve=\footnotemark \def\footnotemark{\inhibitglue\footnotemarks@ve} +\renewcommand\@makefnmark{\hbox{}\hbox{% + \ifydir \@textsuperscript{\normalfont\@thefnmark}% + \else\hbox{\yoko\@textsuperscript{\normalfont\@thefnmark}}\fi}\hbox{}} \def\thefootnote{\ifnum\c@footnote>\z@\leavevmode\lower.5ex\hbox{*}\@arabic\c@footnote\fi} \renewcommand{\footnoterule}{% \kern-3\p@ @@ -1502,8 +1520,8 @@ \newcommand{\bibname}{\if@english Bibliography\else 参考文献\fi} \newcommand{\indexname}{\if@english Index\else 索引\fi} \newcommand{\figurename}{\if@english Fig.~\else 図\fi} -\newcommand{\tablename}{\if@english Table.~\else 表\fi} -\newcommand{\appendixname}{\if@english Appendix~\else 付録\fi} +\newcommand{\tablename}{\if@english Table~\else 表\fi} +\newcommand{\appendixname}{\if@english \else 付録\fi} \newcommand{\abstractname}{\if@english Abstract\else 概要\fi} \newif\if西暦 \西暦true \def\西暦{\西暦true} diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltjsbook.cls b/Master/texmf-dist/tex/luatex/luatexja/ltjsbook.cls index 44e8b29ca20..9721f05290c 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/ltjsbook.cls +++ b/Master/texmf-dist/tex/luatex/luatexja/ltjsbook.cls @@ -38,7 +38,7 @@ %% Right brace \} Tilde \~} \NeedsTeXFormat{LaTeX2e} \ProvidesClass{ltjsbook} - [2013/06/06 ] + [2014/01/13 ] \RequirePackage{luatexja} \newif\if@restonecol \newif\if@titlepage @@ -332,7 +332,8 @@ \AtBeginDocument{% \reDeclareMathAlphabet{\mathrm}{\mathrm}{\mathmc} \reDeclareMathAlphabet{\mathbf}{\mathbf}{\mathgt}}% -\ltjsetparameter{jaxspmode={`〒,2}} +\ltjsetparameter{jaxspmode={`!,2}} +\ltjsetparameter{jaxspmode={`〒,1}} \ltjsetparameter{alxspmode={`+,3}} \ltjsetparameter{alxspmode={`\%,3}} \def\@{\spacefactor3000\space} @@ -568,6 +569,7 @@ \def\@oddhead{% \hbox to \fullwidth{\hfil\textbf{\thepage}}\hss}} \if@report \let\ps@plain\ps@plainfoot \else \let\ps@plain\ps@plainhead \fi +\newif\if@omit@number \def\ps@headings{% \let\@oddfoot\@empty \let\@evenfoot\@empty @@ -582,7 +584,9 @@ \def\chaptermark##1{\markboth{% \ifnum \c@secnumdepth >\m@ne \if@mainmatter - \@chapapp\thechapter\@chappos\hskip1\zw + \if@omit@number\else + \@chapapp\thechapter\@chappos\hskip1\zw + \fi \fi \fi ##1}{}}% @@ -901,7 +905,9 @@ \plainifnotempty % 元: \thispagestyle{plain} \global\@topnum\z@ \if@english \@afterindentfalse \else \@afterindenttrue \fi - \secdef\@chapter\@schapter} + \secdef + {\@omit@numberfalse\@chapter}% + {\@omit@numbertrue\@schapter}} \def\@chapter[#1]#2{% \ifnum \c@secnumdepth >\m@ne \if@mainmatter @@ -909,7 +915,8 @@ \typeout{\@chapapp\thechapter\@chappos}% \addcontentsline{toc}{chapter}% {\protect\numberline - {\if@english\thechapter\else\@chapapp\thechapter\@chappos\fi}% + % {\if@english\thechapter\else\@chapapp\thechapter\@chappos\fi}% + {\@chapapp\thechapter\@chappos}% #1}% \else\addcontentsline{toc}{chapter}{#1}\fi \else @@ -1184,7 +1191,12 @@ \newcommand\@tocrmarg{2.55em} \newcommand\@dotsep{4.5} \setcounter{tocdepth}{1} +\newdimen\js@tocl@width \newcommand{\tableofcontents}{% + \settowidth\js@tocl@width{\headfont\prechaptername\postchaptername}% + \settowidth\@tempdima{\headfont\appendixname}% + \ifdim\js@tocl@width<\@tempdima \setlength\js@tocl@width{\@tempdima}\fi + \ifdim\js@tocl@width<2\zw \divide\js@tocl@width by 2 \advance\js@tocl@width 1\zw\fi \if@twocolumn \@restonecoltrue\onecolumn \else @@ -1221,17 +1233,29 @@ \rightskip\@tocrmarg \parfillskip-\rightskip \leavevmode\headfont - \if@english\setlength\@lnumwidth{5.5em}\else\setlength\@lnumwidth{4.683\zw}\fi + % \if@english\setlength\@lnumwidth{5.5em}\else\setlength\@lnumwidth{4.683\zw}\fi + \setlength\@lnumwidth{\js@tocl@width}\advance\@lnumwidth 2.683\zw \advance\leftskip\@lnumwidth \hskip-\leftskip #1\nobreak\hfil\nobreak\hbox to\@pnumwidth{\hss#2}\par \penalty\@highpenalty \endgroup \fi} -\newcommand*{\l@section}{\@dottedtocline{1}{1\zw}{3.683\zw}} -\newcommand*{\l@subsection} {\@dottedtocline{2}{3.8em}{3.2em}} -\newcommand*{\l@subsubsection}{\@dottedtocline{3}{7.0em}{4.1em}} -\newcommand*{\l@paragraph} {\@dottedtocline{4}{10em}{5em}} -\newcommand*{\l@subparagraph} {\@dottedtocline{5}{12em}{6em}} + % \newcommand*{\l@section}{\@dottedtocline{1}{1\zw}{3.683\zw}} +\newcommand*{\l@section}{% + \@tempdima\js@tocl@width \advance\@tempdima -1\zw + \@dottedtocline{1}{\@tempdima}{3.683\zw}} +\newcommand*{\l@subsection}{% + \@tempdima\js@tocl@width \advance\@tempdima 2.683\zw + \@dottedtocline{2}{\@tempdima}{3.5\zw}} +\newcommand*{\l@subsubsection}{% + \@tempdima\js@tocl@width \advance\@tempdima 6.183\zw + \@dottedtocline{3}{\@tempdima}{4.5\zw}} +\newcommand*{\l@paragraph}{% + \@tempdima\js@tocl@width \advance\@tempdima 10.683\zw + \@dottedtocline{4}{\@tempdima}{5.5\zw}} +\newcommand*{\l@subparagraph}{% + \@tempdima\js@tocl@width \advance\@tempdima 16.183\zw + \@dottedtocline{5}{\@tempdima}{6.5\zw}} \newdimen\@lnumwidth \def\numberline#1{\hb@xt@\@lnumwidth{#1\hfil}\hspace{0pt}} \def\@dottedtocline#1#2#3#4#5{\ifnum #1>\c@tocdepth \else @@ -1336,6 +1360,9 @@ \def\footnote{\inhibitglue\footnotes@ve} \let\footnotemarks@ve=\footnotemark \def\footnotemark{\inhibitglue\footnotemarks@ve} +\renewcommand\@makefnmark{\hbox{}\hbox{% + \ifydir \@textsuperscript{\normalfont\@thefnmark}% + \else\hbox{\yoko\@textsuperscript{\normalfont\@thefnmark}}\fi}\hbox{}} \def\thefootnote{\ifnum\c@footnote>\z@\leavevmode\lower.5ex\hbox{*}\@arabic\c@footnote\fi} \renewcommand{\footnoterule}{% \kern-3\p@ @@ -1579,8 +1606,8 @@ \newcommand{\bibname}{\if@english Bibliography\else 参考文献\fi} \newcommand{\indexname}{\if@english Index\else 索引\fi} \newcommand{\figurename}{\if@english Fig.~\else 図\fi} -\newcommand{\tablename}{\if@english Table.~\else 表\fi} -\newcommand{\appendixname}{\if@english Appendix~\else 付録\fi} +\newcommand{\tablename}{\if@english Table~\else 表\fi} +\newcommand{\appendixname}{\if@english \else 付録\fi} \newif\if西暦 \西暦true \def\西暦{\西暦true} \def\和暦{\西暦false} diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltjskiyou.cls b/Master/texmf-dist/tex/luatex/luatexja/ltjskiyou.cls index 31a4386e860..7de97f1c800 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/ltjskiyou.cls +++ b/Master/texmf-dist/tex/luatex/luatexja/ltjskiyou.cls @@ -38,7 +38,7 @@ %% Right brace \} Tilde \~} \NeedsTeXFormat{LaTeX2e} \ProvidesClass{ltjskiyou} - [2013/06/06 ] + [2014/01/13 ] \RequirePackage{luatexja} \newif\if@restonecol \newif\if@titlepage @@ -327,7 +327,8 @@ \AtBeginDocument{% \reDeclareMathAlphabet{\mathrm}{\mathrm}{\mathmc} \reDeclareMathAlphabet{\mathbf}{\mathbf}{\mathgt}}% -\ltjsetparameter{jaxspmode={`〒,2}} +\ltjsetparameter{jaxspmode={`!,2}} +\ltjsetparameter{jaxspmode={`〒,1}} \ltjsetparameter{alxspmode={`+,3}} \ltjsetparameter{alxspmode={`\%,3}} \def\@{\spacefactor3000\space} @@ -1111,7 +1112,12 @@ \newcommand\@tocrmarg{2.55em} \newcommand\@dotsep{4.5} \setcounter{tocdepth}{2} +\newdimen\js@tocl@width \newcommand{\tableofcontents}{% + \settowidth\js@tocl@width{\headfont\presectionname\postsectionname}% + \settowidth\@tempdima{\headfont\appendixname}% + \ifdim\js@tocl@width<\@tempdima\relax\setlength\js@tocl@width{\@tempdima}\fi + \ifdim\js@tocl@width<2\zw \divide\js@tocl@width by 2 \advance\js@tocl@width 1\zw\fi \section*{\contentsname}% \@mkboth{\contentsname}{\contentsname}% \@starttoc{toc}% @@ -1140,15 +1146,24 @@ \rightskip\@tocrmarg \parfillskip-\rightskip \leavevmode\headfont - \setlength\@lnumwidth{4\zw}% 元1.5em [2003-03-02] + %\setlength\@lnumwidth{4\zw}% 元1.5em [2003-03-02] + \setlength\@lnumwidth{\js@tocl@width}\advance\@lnumwidth 2\zw \advance\leftskip\@lnumwidth \hskip-\leftskip #1\nobreak\hfil\nobreak\hbox to\@pnumwidth{\hss#2}\par \endgroup \fi} -\newcommand*{\l@subsection} {\@dottedtocline{2}{1\zw}{3\zw}} -\newcommand*{\l@subsubsection}{\@dottedtocline{3}{2\zw}{3\zw}} -\newcommand*{\l@paragraph} {\@dottedtocline{4}{3\zw}{3\zw}} -\newcommand*{\l@subparagraph} {\@dottedtocline{5}{4\zw}{3\zw}} +\newcommand*{\l@subsection}{% + \@tempdima\js@tocl@width \advance\@tempdima -1\zw + \@dottedtocline{2}{\@tempdima}{3\zw}} +\newcommand*{\l@subsubsection}{% + \@tempdima\js@tocl@width \advance\@tempdima 0\zw + \@dottedtocline{3}{\@tempdima}{4\zw}} +\newcommand*{\l@paragraph}{% + \@tempdima\js@tocl@width \advance\@tempdima 1\zw + \@dottedtocline{4}{\@tempdima}{5\zw}} +\newcommand*{\l@subparagraph}{% + \@tempdima\js@tocl@width \advance\@tempdima 2\zw + \@dottedtocline{5}{\@tempdima}{6\zw}} \newdimen\@lnumwidth \def\numberline#1{\hb@xt@\@lnumwidth{#1\hfil}\hspace{0pt}} \def\@dottedtocline#1#2#3#4#5{\ifnum #1>\c@tocdepth \else @@ -1249,6 +1264,9 @@ \def\footnote{\inhibitglue\footnotes@ve} \let\footnotemarks@ve=\footnotemark \def\footnotemark{\inhibitglue\footnotemarks@ve} +\renewcommand\@makefnmark{\hbox{}\hbox{% + \ifydir \@textsuperscript{\normalfont\@thefnmark}% + \else\hbox{\yoko\@textsuperscript{\normalfont\@thefnmark}}\fi}\hbox{}} \def\thefootnote{\ifnum\c@footnote>\z@\leavevmode\lower.5ex\hbox{*}\@arabic\c@footnote\fi} \renewcommand{\footnoterule}{% \kern-3\p@ @@ -1489,8 +1507,8 @@ \newcommand{\bibname}{\if@english Bibliography\else 参考文献\fi} \newcommand{\indexname}{\if@english Index\else 索引\fi} \newcommand{\figurename}{\if@english Fig.~\else 図\fi} -\newcommand{\tablename}{\if@english Table.~\else 表\fi} -\newcommand{\appendixname}{\if@english Appendix~\else 付録\fi} +\newcommand{\tablename}{\if@english Table~\else 表\fi} +\newcommand{\appendixname}{\if@english \else 付録\fi} \newcommand{\abstractname}{\if@english Abstract\else 概要\fi} \newif\if西暦 \西暦true \def\西暦{\西暦true} diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltjspf.cls b/Master/texmf-dist/tex/luatex/luatexja/ltjspf.cls index facc1d40b15..829dc6e13ef 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/ltjspf.cls +++ b/Master/texmf-dist/tex/luatex/luatexja/ltjspf.cls @@ -38,7 +38,7 @@ %% Right brace \} Tilde \~} \NeedsTeXFormat{LaTeX2e} \ProvidesClass{ltjspf} - [2013/06/06 ] + [2014/01/13 ] \RequirePackage{luatexja} \newif\if@restonecol \newif\if@titlepage @@ -325,7 +325,8 @@ \AtBeginDocument{% \reDeclareMathAlphabet{\mathrm}{\mathrm}{\mathmc} \reDeclareMathAlphabet{\mathbf}{\mathbf}{\mathgt}}% -\ltjsetparameter{jaxspmode={`〒,2}} +\ltjsetparameter{jaxspmode={`!,2}} +\ltjsetparameter{jaxspmode={`〒,1}} \ltjsetparameter{alxspmode={`+,3}} \ltjsetparameter{alxspmode={`\%,3}} \def\@{\spacefactor3000\space} @@ -1010,7 +1011,12 @@ \newcommand\@tocrmarg{2.55em} \newcommand\@dotsep{4.5} \setcounter{tocdepth}{2} +\newdimen\js@tocl@width \newcommand{\tableofcontents}{% + \settowidth\js@tocl@width{\headfont\presectionname\postsectionname}% + \settowidth\@tempdima{\headfont\appendixname}% + \ifdim\js@tocl@width<\@tempdima\relax\setlength\js@tocl@width{\@tempdima}\fi + \ifdim\js@tocl@width<2\zw \divide\js@tocl@width by 2 \advance\js@tocl@width 1\zw\fi \section*{\contentsname}% \@mkboth{\contentsname}{\contentsname}% \@starttoc{toc}% @@ -1039,15 +1045,24 @@ \rightskip\@tocrmarg \parfillskip-\rightskip \leavevmode\headfont - \setlength\@lnumwidth{4\zw}% 元1.5em [2003-03-02] + %\setlength\@lnumwidth{4\zw}% 元1.5em [2003-03-02] + \setlength\@lnumwidth{\js@tocl@width}\advance\@lnumwidth 2\zw \advance\leftskip\@lnumwidth \hskip-\leftskip #1\nobreak\hfil\nobreak\hbox to\@pnumwidth{\hss#2}\par \endgroup \fi} -\newcommand*{\l@subsection} {\@dottedtocline{2}{1\zw}{3\zw}} -\newcommand*{\l@subsubsection}{\@dottedtocline{3}{2\zw}{3\zw}} -\newcommand*{\l@paragraph} {\@dottedtocline{4}{3\zw}{3\zw}} -\newcommand*{\l@subparagraph} {\@dottedtocline{5}{4\zw}{3\zw}} +\newcommand*{\l@subsection}{% + \@tempdima\js@tocl@width \advance\@tempdima -1\zw + \@dottedtocline{2}{\@tempdima}{3\zw}} +\newcommand*{\l@subsubsection}{% + \@tempdima\js@tocl@width \advance\@tempdima 0\zw + \@dottedtocline{3}{\@tempdima}{4\zw}} +\newcommand*{\l@paragraph}{% + \@tempdima\js@tocl@width \advance\@tempdima 1\zw + \@dottedtocline{4}{\@tempdima}{5\zw}} +\newcommand*{\l@subparagraph}{% + \@tempdima\js@tocl@width \advance\@tempdima 2\zw + \@dottedtocline{5}{\@tempdima}{6\zw}} \newdimen\@lnumwidth \def\numberline#1{\hb@xt@\@lnumwidth{#1\hfil}\hspace{0pt}} \def\@dottedtocline#1#2#3#4#5{\ifnum #1>\c@tocdepth \else @@ -1145,6 +1160,9 @@ \def\footnote{\inhibitglue\footnotes@ve} \let\footnotemarks@ve=\footnotemark \def\footnotemark{\inhibitglue\footnotemarks@ve} +\renewcommand\@makefnmark{\hbox{}\hbox{% + \ifydir \@textsuperscript{\normalfont\@thefnmark}% + \else\hbox{\yoko\@textsuperscript{\normalfont\@thefnmark}}\fi}\hbox{}} \def\thefootnote{\ifnum\c@footnote>\z@\leavevmode\lower.5ex\hbox{*}\@arabic\c@footnote\fi} \renewcommand{\footnoterule}{% \kern-3\p@ @@ -1386,7 +1404,7 @@ \newcommand{\indexname}{\if@english Index\else 索引\fi} \newcommand{\figurename}{Fig.~} \newcommand{\tablename}{Table~} -\newcommand{\appendixname}{\if@english Appendix~\else 付録\fi} +\newcommand{\appendixname}{\if@english \else 付録\fi} \newcommand{\abstractname}{\if@english Abstract\else 概要\fi} \newif\if西暦 \西暦true \def\西暦{\西暦true} diff --git a/Master/texmf-dist/tex/luatex/luatexja/luatexja-compat.sty b/Master/texmf-dist/tex/luatex/luatexja/luatexja-compat.sty index 7feb21a499b..8d1d2d647d1 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/luatexja-compat.sty +++ b/Master/texmf-dist/tex/luatex/luatexja/luatexja-compat.sty @@ -65,7 +65,7 @@ \expandafter\let\csname ifltj@in@latex\expandafter\endcsname \csname iftrue\endcsname \NeedsTeXFormat{LaTeX2e} - \ProvidesPackage{luatexja-compat}[2013/05/14 Compatibility with pTeX] + \ProvidesPackage{luatexja-compat}[2013/12/22 Compatibility with pTeX] \fi %</LaTeX> % ltj-compat-ptex.sty is not maintained for a long time. @@ -105,7 +105,6 @@ % not yet implemented. %%------------------ -\RequireLuaTeXjaSubmodule{jisx0208} \RequireLuaTeXjaSubmodule{compat} \def\euc{\ltj@code@conv{euc}} diff --git a/Master/texmf-dist/tex/luatex/luatexja/luatexja-core.sty b/Master/texmf-dist/tex/luatex/luatexja/luatexja-core.sty index d4487af2d7f..0995eb471a9 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/luatexja-core.sty +++ b/Master/texmf-dist/tex/luatex/luatexja/luatexja-core.sty @@ -435,6 +435,51 @@ \protected\def\ltjsetmathletter#1{\directlua{luatexja.math.is_math_letters[#1]=true}} \protected\def\ltjunsetmathletter#1{\directlua{luatexja.math.is_math_letters[#1]=false}} + +%%%%%%%% \ltjdeclarealtfont<base_font_cs><alt_font_cs>{100-200,3000-,5000,...} +% <base_font_cs> の 第 3 引数の文字達は <alt_font_cs> で組む +% いつも global +\def\ltj@@getjfontnumber#1{% result in \ltj@tempcntc + \ltj@reset@globaldefs + \bgroup\ltj@curjfnt=-1\relax + #1\directlua{luatexja.__temp = \the\ltj@curjfnt}\egroup + \ltj@tempcntc=\directlua{tex.sprint(luatexja.__temp)}\relax + \ifnum\ltj@tempcntc=-1 + \@PackageError{luatexja-core}% + {\string#1 is not a control sequence that represents \MessageBreak + a Japanese font}{I'll use the current Japanese font instead.^^J}% + \ltj@tempcntc=\ltj@curjfnt + \fi\ltj@restore@globaldefs} + +\protected\def\ltjdeclarealtfont#1#2#3{% + {\ltj@@getjfontnumber#1\@tempcnta=\ltj@tempcntc% \@tempcnta: 基底フォント + \ltj@@getjfontnumber#2% + \expandafter\ltj@@altfont#3,,}\ignorespaces} +\def\ltj@@altfont#1,{\def\ltj@temp{#1}% + \ifx\ltj@temp\empty\let\@next=\relax\else + \ltj@@altfontA{#1}\let\@next=\ltj@@altfont\fi\@next} +\def\ltj@@altfontA#1{\ltj@@altfontB#1--\@nil} +\def\ltj@@altfontB#1-#2-#3\@nil{\def\ltj@temp{#3}% + \ifx\ltj@temp\empty + \ltj@tempcnta=#1 \ltj@tempcntb=\ltj@tempcnta + \else + \def\ltj@temp{#1}% + \ifx\ltj@temp\empty\ltj@tempcnta='200\else\ltj@tempcnta=#1\fi\relax + \def\ltj@temp{#2}% + \ifx\ltj@temp\empty\ltj@tempcntb="10FFFF\else\ltj@tempcntb=#2\fi\relax%" + \fi + \directlua{luatexja.jfont.set_alt_font( + \the\ltj@tempcnta,\the\ltj@tempcntb, + \the\ltj@tempcntc, \the\@tempcnta)}% + } + +%%%%%%%% \ltjclearaltfont<font_cs> +% <font_cs> の文字は全部 <font_cs> 本来の文字で組む +\protected\def\ltjclearaltfont#1{% + {\ltj@@getjfontnumber#1% + \directlua{luatexja.jfont.clear_alt_font(\the\ltj@tempcntc)}}\ignorespaces} + + %%------------------ Load module for the format \ifltj@in@latex %<*LaTeX> 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) - diff --git a/Master/texmf-dist/tex/luatex/luatexja/patches/lltjdefs.sty b/Master/texmf-dist/tex/luatex/luatexja/patches/lltjdefs.sty index 03f4aaf170d..3fbc35372c9 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/patches/lltjdefs.sty +++ b/Master/texmf-dist/tex/luatex/luatexja/patches/lltjdefs.sty @@ -31,7 +31,8 @@ \DeclareFontShape{JY3}{gt}{bx}{n}{<-> ssub*gt/m/n}{} %fontencoding{JT3}\selectfont -\fontencoding{JY3}\selectfont +\fontencoding{JY3}\selectfont\adjustbaseline + \DeclareTextFontCommand{\textmc}{\mcfamily} \DeclareTextFontCommand{\textgt}{\gtfamily} \DeclareOldFontCommand{\mc}{\normalfont\mcfamily}{} @@ -51,10 +52,10 @@ "500-"10FF, "1200-"1DFF, "2440-"245F, "27C0-"28FF, "2A00-"2AFF, "2C00-"2E7F, "4DC0-"4DFF, "A4D0-"A82F, "A840-"ABFF, "FB00-"FE0F, "FE20-"FE2F, "FE70-"FEFF, "10000-"1FFFF, "E000-"F8FF} % non-Japanese -\ltjdefcharrange{5}{"D800-"DFFF, "E0000-"10FFFF} +\ltjdefcharrange{5}{"D800-"DFFF, "E0000-"E00FF, "E01F0-"10FFFF} \ltjdefcharrange{6}{% "2460-"24FF, "2E80-"2EFF, "3000-"30FF, "3190-"319F, "31F0-"4DBF, - "4E00-"9FFF, "F900-"FAFF, "FE10-"FE6F, "20000-"2FFFF} + "4E00-"9FFF, "F900-"FAFF, "FE10-"FE6F, "20000-"2FFFF, "E0100-"E01EF} \ltjdefcharrange{7}{ "1100-"11FF, "2F00-"2FFF, "3100-"31EF, "A000-"A4CF, "A830-"A83F, "AC00-"D7FF} @@ -112,8 +113,8 @@ NEGATIVE "FE20-"FE2F, "FE70-"FEFF, "10000-"1FFFF, "E000-"F8FF} } % non-Japanese -\ltjdefcharrange{5}{"D800-"DFFF, "E0000-"10FFFF} - % Surrogates, Tags and Variation Selectors Supplement +\ltjdefcharrange{5}{"D800-"DFFF, "E0000-"E00FF, "E01F0-"10FFFF} + % Surrogates, Tags % 208 "F0000-"FFFFF num = 0/65536 name = Supplementary Private Use Area-A % 209 "100000-"10FFFF num = 0/65536 name = Supplementary Private Use Area-B @@ -122,7 +123,7 @@ POSITIVE % Japanese \ltjdefcharrange{6}{% "2460-"24FF, "2E80-"2EFF, "3000-"30FF, "3190-"319F, "31F0-"4DBF, - "4E00-"9FFF, "F900-"FAFF, "FE10-"FE6F, "20000-"2FFFF} + "4E00-"9FFF, "F900-"FAFF, "FE10-"FE6F, "20000-"2FFFF, "E0100-"E01EF} % 77 "2460-"24FF num = 150/160 name = Enclosed Alphanumerics % 98 "2E80-"2EFF num = 21 name = CJK Radicals Supplement % 101 "3000-"303F num = 144 name = CJK Symbols and Punctuation @@ -139,6 +140,7 @@ POSITIVE % 149 "FE30-"FE4F num = 8/32 name = CJK Compatibility Forms % 150 "FE50-"FE6F num = 0/32 name = Small Form Variants % SIP +% "E0000-"E01EF Variation Selectors Supplement \ltjdefcharrange{7}{ "1100-"11FF, "2F00-"2FFF, "3100-"31EF, "A000-"A4CF, "A830-"A83F, diff --git a/Master/texmf-dist/tex/luatex/luatexja/patches/lltjfont.sty b/Master/texmf-dist/tex/luatex/luatexja/patches/lltjfont.sty index 00cb175ccaa..244ae453df2 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/patches/lltjfont.sty +++ b/Master/texmf-dist/tex/luatex/luatexja/patches/lltjfont.sty @@ -536,7 +536,6 @@ \romanseries{\seriesdefault}% \romanshape{\shapedefault}% \selectfont\ignorespaces} -\adjustbaseline \let\reset@font\normalfont \DeclareRobustCommand\mcfamily {\not@math@alphabet\mcfamily\mathmc @@ -583,8 +582,15 @@ \fi \let\getjfont\font@name} +% 異なる和文 enc/fam/ser/shape からは異なるフォント番号が振られるように +% わざと「ゴミをつける」 +\def\ltj@@patch@external@font#1 at{% + #1;\directlua{luatexja.jfont.print_aftl_address(% + '\luatexluaescapestring{\f@encoding/\f@family/\f@series/\f@shape}')}\space at% +} \def\extract@jfont{% - \get@external@font + \get@external@font + \edef\external@font{\expandafter\ltj@@patch@external@font\external@font}% \expandafter\globaljfont\font@name\external@font\relax \font@name%\global\zw=\zw\global\zh=\zh \csname \f@encoding+\f@family\endcsname @@ -641,4 +647,52 @@ \ifin@\jfam#2\relax\else\mathgroup#2\relax\fi \expandafter\math@egroup\fi}% +%%%%%% Alternate Japanese Fonts +%%%% \DeclareAlternateKanjiFont<Benc><Bfam><Bser><Bshape><Aenc><Afam><Aser><Ashape><range> +% いつも global +\def\DeclareAlternateKanjiFont#1#2#3#4#5#6#7#8#9{% + {\def\ltj@temp@bfont{#1/#2/#3/#4}\def\ltj@temp@afont{#5/#6/#7/#8}% + \expandafter\ltj@@altfont@latex#9,,}\ignorespaces} +\def\ltj@@altfont@latex#1,{\def\ltj@temp{#1}% + \ifx\ltj@temp\empty\let\@next=\relax\else + \ltj@@altfont@latexA{#1}\let\@next=\ltj@@altfont@latex\fi\@next} +\def\ltj@@altfont@latexA#1{\ltj@@altfont@latexB#1--\@nil} +\def\ltj@@altfont@latexB#1-#2-#3\@nil{\def\ltj@temp{#3}% + \ifx\ltj@temp\empty + \ltj@tempcnta=#1\relax\ltj@tempcntb=\ltj@tempcnta + \else + \def\ltj@temp{#1}% + \ifx\ltj@temp\empty\ltj@tempcnta='200\else\ltj@tempcnta=#1\fi\relax + \def\ltj@temp{#2}% + \ifx\ltj@temp\empty\ltj@tempcntb="10FFFF\else\ltj@tempcntb=#2\fi\relax%" + \fi + \directlua{luatexja.jfont.set_alt_font_latex( + \the\ltj@tempcnta,\the\ltj@tempcntb, + '\luatexluaescapestring{\ltj@temp@afont}', + '\luatexluaescapestring{\ltj@temp@bfont}')}% + } + +%%%% \ClearAlternateKanjiFont<Benc><Bfam><Bser><Bshape> +% いつも global +\def\ClearAlternateKanjiFont#1#2#3#4{% + \directlua{luatexja.jfont.clear_alt_font_latex( + '\luatexluaescapestring{#1/#2/#3/#4}')}} + +% \selectfont 上書き +\let\ltj@@alt@selectfont@orig=\selectfont +\def\selectfont{% + \ltj@@alt@selectfont@orig + % alt fonts の定義 + \directlua{luatexja.jfont.output_alt_font_cmd('\luatexluaescapestring{\curr@kfontshape}')}% + % 定義した alt fonts のデータを \ltjdeclarealtfont に渡すのと同等の処理をする + \directlua{luatexja.jfont.pickup_alt_font_a('\f@size')}% +} +\def\ltj@pickup@altfont@aux#1{% + {\edef\font@name{\csname #1/\f@size\endcsname}\pickup@jfont}% +} +\def\ltj@pickup@altfont@copy#1#2{% + \ltj@@getjfontnumber#1% + \directlua{luatexja.jfont.pickup_alt_font_b(\the\ltj@tempcntc,'\luatexluaescapestring{#2}')}% +} + \endinput diff --git a/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-listings.sty b/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-listings.sty index 4787bcc89a8..06f0918140c 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-listings.sty +++ b/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-listings.sty @@ -3,45 +3,81 @@ % \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{lltjp-listings}[2013/05/14 Patch to listings for LuaTeX-ja] +\ProvidesPackage{lltjp-listings}[2014/01/09 Patch to listings for LuaTeX-ja] \RequirePackage{listings,luatexbase-cctb} +%%%%%%%%%%%%%%%% Japanese support +%% IVS support +\newif\if@ltj@lst@vsraw \@ltj@lst@vsrawfalse +\def\ltj@lst@vscmd{} +\lst@Key{vsraw}f[t]{\lstKV@SetIf{#1}\if@ltj@lst@vsraw} +\lst@Key{vscmd}\relax{\def\ltj@lst@vscmd{#1}} + +% 既定の IVS 出力コマンド +\def\ltjlistingsvsstdcmd#1{\@tempdima=\f@size pt% + \smash{\raisebox{.35\@tempdima}{\tt% + \fboxsep=.1\@tempdima\fbox{\fontsize{.5\@tempdima}{\z@}\selectfont + \oalign{\hss VS\hss\crcr#1\crcr}}}}} +\def\ltj@lst@vscmd{\ltjlistingsvsstdcmd} + +% override \lst@FillFixed@ +% \ltj@hst@hss is \ltj@lst@hss@ivs or \ltj@lst@hss@normal, +% according to vsraw = true or not. +\def\lst@FillFixed@#1{% + \ifx\@empty#1\else\ltj@lst@hss#1\expandafter\lst@FillFixed@\fi} + +\directlua{ + local cat_str = luatexbase.catcodetables['string'] + local cat_lp = luatexbase.catcodetables['latex-package'] + local ubyte = unicode.utf8.byte + luatexja.lst = {} + function luatexja.lst.althss(t) + t = ubyte(t) + if not (t>=0xE0100 and t<0xE01F0) then + tex.sprint(cat_lp, string.char(0x5C) .. 'lst@hss') + end + end +} +\gdef\ltj@lst@hss@ivs#1{% + \directlua{luatexja.lst.althss('\luatexluaescapestring{#1}')}#1% +} + % lowest level -\def\lst@kanjitrue{\let\lst@ifkanji\iftrue} -\def\lst@kanjifalse{\let\lst@ifkanji\iffalse} -\lst@AddToHook{InitVars}{\lst@kanjifalse} +\newif\if@ltj@lst@kanji +\lst@AddToHook{InitVars}{\@ltj@lst@kanjifalse} \def\lst@AppendLetter{% \ltj@lst@setletterflag\lst@Append} \def\lst@AppendOther{% - \lst@ifletter\lst@Output\lst@letterfalse\fi\lst@kanjifalse + \lst@ifletter\lst@Output\lst@letterfalse\fi\@ltj@lst@kanjifalse \futurelet\lst@lastother\lst@Append} \def\ltj@lst@setletterflag{% \lst@ifletter - \lst@ifkanji\lst@Output\lst@kanjifalse\fi + \if@ltj@lst@kanji\lst@Output\@ltj@lst@kanjifalse\fi \else - \lst@lettertrue\lst@ifkanji\lst@kanjifalse\else\lst@OutputOther\fi + \lst@lettertrue\if@ltj@lst@kanji\@ltj@lst@kanjifalse\else\lst@OutputOther\fi \fi} \def\ltj@lst@setkanjiflag{% \lst@ifletter \lst@Output \else - \lst@ifkanji\else\lst@OutputOther\fi\lst@lettertrue + \if@ltj@lst@kanji\else\lst@OutputOther\fi\lst@lettertrue \fi} \def\ltj@lst@setopenflag{% \lst@ifletter \lst@letterfalse\lst@Output \else - \lst@ifkanji\else\lst@OutputOther\fi - \fi\lst@kanjitrue} + \if@ltj@lst@kanji\else\lst@OutputOther\fi + \fi\@ltj@lst@kanjitrue} \def\ltj@lst@setcloseflag{% - \lst@ifletter\else\lst@lettertrue\fi\lst@kanjitrue} + \lst@ifletter\else\lst@lettertrue\fi\@ltj@lst@kanjitrue} -\def\lst@ProcessJALetter#1{% +% Processing Japanese characters +\def\ltj@lst@ProcessJALetter#1{% \lst@whitespacefalse \ifnum\ltjgetparameter{jacharrange}{\ltjgetparameter{chartorange}{`#1}}=0 \ifnum\ltjgetparameter{postbreakpenalty}{`#1}>0 @@ -58,7 +94,8 @@ \fi \lst@Append#1} -\def\lst@ProcessJALetterHalf#1{% +% 半角カナ処理命令 +\def\ltj@lst@ProcessJALetterHalf#1{% \lst@whitespacefalse \ifnum\ltjgetparameter{jacharrange}{\ltjgetparameter{chartorange}{`#1}}=0 \ifnum\ltjgetparameter{postbreakpenalty}{`#1}>0 @@ -75,22 +112,27 @@ \fi \lst@Append#1} +% 漢字用異体字セレクタ命令 +\def\ltj@lst@ProcessIVS#1{% + \lst@whitespacefalse + \if@ltj@lst@vsraw + \lst@Append#1\advance\lst@length\m@ne + \else + \lst@TrackNewLines\lst@OutputLostSpace \lst@PrintToken + \setbox\@tempboxa\hbox to 2\lst@width{\hss + \expandafter\expandafter\expandafter\ltj@lst@vscmd + \expandafter{\the\numexpr`#1-"E00EF\relax}%" + \hss}% + \lst@CalcLostSpaceAndOutput\lst@whitespacefalse + \fi +} -% 半角カナの扱い +% 半角カナ,異体字セレクタはアクティブ化 \def\ltj@@listing@jpsetN#1#2#3{% for (not large) range - \@tempcnta=#1 \@tempcntb=\numexpr 1+#2\relax \@temptokena{}% + \@tempcnta=\numexpr#1-1\relax\@tempcntb=\numexpr 1+#2\relax \loop \global\advance\@tempcnta\@ne\ifnum\@tempcnta<\@tempcntb\relax \ltj@@listing@jpsetN@{\@tempcnta}{#3}\repeat - \ltj@@listing@jpset@after{#1} -} - -\def\ltj@@listing@jpset@after#1{% - \expandafter\edef\csname ltj@@listing@jpcmd@i#1\endcsname{\the\@temptokena}% - \toks@\expandafter\expandafter\expandafter\expandafter% - \expandafter\expandafter\expandafter{\expandafter\expandafter% - \expandafter\the\expandafter\toks@\csname ltj@@listing@jpcmd@i#1\endcsname}% - \@temptokena{}% } \def\ltj@@listing@jpsetN@#1#2{{% @@ -100,23 +142,42 @@ \expandafter\expandafter\expandafter{\expandafter\expandafter% \expandafter\the\expandafter\@temptokena\@temp}% } - -\toks@{} -\ltj@@listing@jpsetN{65377}{65439}{\lst@ProcessJALetterHalf} -\edef\ltj@@listing@jpcmd{\the\toks@}\toks@{} +\@temptokena{} +\ltj@@listing@jpsetN{65377}{65439}{\ltj@lst@ProcessJALetterHalf} +\ltj@@listing@jpsetN{917760}{917999}{\ltj@lst@ProcessIVS} +\xdef\ltj@@listing@jpcmd{\the\@temptokena}\@temptokena{} % catcode 対策 \newluatexcatcodetable\CatcodeTableLTJlistings -\setluatexcatcodetable\CatcodeTableLTJlistings{ +\setluatexcatcodetable\CatcodeTableLTJlistings{% \luatexcatcodetable\CatcodeTableLaTeXAtLetter \catcode"FFFFF=13%" - \setcatcoderange{"FF61}{"FF9F}{13}% 半角文字 + \SetCatcodeRange{"FF61}{"FF9F}{13}% 半角カナ + \SetCatcodeRange{"E0100}{"E01EF}{13}% 漢字用異体字セレクタ } +% We redefine \lst@BeginDropInput, since now we have +% two additional `process macros'. +\def\lst@BeginDropInput#1{% + \lst@EnterMode{#1}% + {\lst@modetrue + \let\lst@OutputBox\@gobble + \let\lst@ifdropinput\iftrue + \let\lst@ProcessLetter\@gobble + \let\lst@ProcessDigit\@gobble + \let\lst@ProcessOther\@gobble + \let\lst@ProcessSpace\@empty + \let\lst@ProcessTabulator\@empty + \let\lst@ProcessFormFeed\@empty + \let\ltj@lst@ProcessJALetter\@gobble % added + \let\ltj@lst@ProcessJALetterHalf\@gobble % added +}} + + % hook! \lst@AddToHook{Init}{ \luatexcatcodetable\CatcodeTableLTJlistings\ltj@@listing@jpcmd - \lccode`\~="FFFFF\lowercase{\let~\lst@ProcessJALetter}%" + \lccode`\~="FFFFF\lowercase{\def~{\ltj@lst@ProcessJALetter}}%" \directlua{luatexbase.add_to_callback('process_input_buffer', function(buf) local ret = '' @@ -129,8 +190,17 @@ ret = ret .. c end return ret - end, 'ltj.listings_unicode', 1)}} -\lst@AddToHook{ExitVars}{\directlua{luatexbase.remove_from_callback('process_input_buffer', 'ltj.listings_unicode')}} + end, 'ltj.listings_unicode', 1)}% + \if@ltj@lst@vsraw + \let\ltj@lst@hss=\ltj@lst@hss@ivs + \else + \let\ltj@lst@hss=\lst@hss + \fi +} +\lst@AddToHook{ExitVars}{% + \directlua{luatexbase.remove_from_callback('process_input_buffer', + 'ltj.listings_unicode')}% +} % 白線対策 @@ -151,6 +221,55 @@ \lst@CalcLostSpaceAndOutput}}% \lst@ResetToken} +%%%%%%%%%%%%%%%% escape to \LaTeX +\lstloadaspects{escape} +\gdef\lst@Escape#1#2#3#4{% + \lst@CArgX #1\relax\lst@CDefX + {}% + {\lst@ifdropinput\else + \lst@TrackNewLines\lst@OutputLostSpace \lst@XPrintToken + \lst@InterruptModes + \lst@EnterMode{\lst@TeXmode}{\lst@modetrue}% + \ifx\^^M#2% + \lst@CArg #2\relax\lst@ActiveCDefX + {}% + {\lst@escapeend #4\lst@LeaveAllModes\lst@ReenterModes}% + {\lst@MProcessListing}% + \else + \lst@CArg #2\relax\lst@ActiveCDefX + {}% + {\lst@escapeend #4\lst@LeaveAllModes\lst@ReenterModes + \lst@newlines\z@ \lst@whitespacefalse}% + {}% + \fi + #3\catcode"FFFFF=9\lst@escapebegin%" + \fi}% + {}} + +%%%%%%%%%%%%%%%% +\lstloadaspects{writefile} +\begingroup \catcode`\^^I=11 +\gdef\lst@WFBegin#1#2{% + \begingroup + \let\lst@OutputBox#1% + \def\lst@Append##1{% + \advance\lst@length\@ne + \expandafter\lst@token\expandafter{\the\lst@token##1}% + \ifx ##1\lst@outputspace \else + \lst@WFAppend##1% + \fi}% + \lst@lAddTo\lst@PreGotoTabStop{\lst@WFAppend{^^I}}% + \lst@lAddTo\lst@ProcessSpace{\lst@WFAppend{ }}% + \def\ltj@lst@ProcessIVS##1{\lst@whitespacefalse\lst@Append##1} + \let\lst@DeInit\lst@WFDeInit + \let\lst@MProcessListing\lst@WFMProcessListing + \lst@WFifopen\else + \immediate\openout\lst@WF=#2\relax + \global\let\lst@WFifopen\iftrue + \@gobbletwo\fi\fi + \fi} +\endgroup + % \begin{修正事項}{1.3} from jlisting.sty % ちょっとした修正 |