X-Git-Url: http://git.osdn.jp/view?a=blobdiff_plain;f=src%2Fluatexja-core.sty;h=c6ef2ef3120d287b7b7c032bfeb6bdc474f305cd;hb=79acad85e3b942cd4fe555c40886ad295b487fce;hp=53ef07766c2a3624aa922051775df57137b186f7;hpb=4b746683891210cff75916d8afd7c0c60ccfa622;p=luatex-ja%2Fluatexja.git diff --git a/src/luatexja-core.sty b/src/luatexja-core.sty index 53ef077..c6ef2ef 100644 --- a/src/luatexja-core.sty +++ b/src/luatexja-core.sty @@ -132,16 +132,16 @@ \def\ltj@defdimen{0} %%%%%%%% Attributes for Japanese typesetting. +\newluatexattribute\ltj@icflag % attribute for italic correction \newluatexattribute\ltj@curjfnt % index for ``current Japanese font'' -\newluatexattribute\jfam % index for current jfam -\newluatexattribute\ltj@charclass % \newluatexattribute\ltj@origchar % -\newluatexattribute\ltj@yablshift % attribute for \yabaselineshift -\newluatexattribute\ltj@ykblshift % attribute for \ykbaselineshift +\newluatexattribute\ltj@charclass % \newluatexattribute\ltj@autospc % attribute for autospacing \newluatexattribute\ltj@autoxspc % attribute for autoxspacing -\newluatexattribute\ltj@icflag % attribute for italic correction -\ltj@icflag=0 \ltj@origchar=0 +\newluatexattribute\ltj@yablshift % attribute for \yabaselineshift +\newluatexattribute\ltj@ykblshift % attribute for \ykbaselineshift +\newluatexattribute\jfam % index for current jfam +\ltj@icflag=0\ltj@origchar=0 %%%%%%%% Attributes for character ranges \newcount\ltj@tempcnta @@ -184,7 +184,6 @@ \input ltj-base.sty % \fi % - %%%%%%%% \asluastring \def\asluastring#1{'\luaescapestring{\detokenize{#1}}'} @@ -241,24 +240,30 @@ \newcount\ltj@@stack \newcount\ltj@@group@level \ltj@@group@level=0 \ltj@@stack=0 +\setbox0\hbox{% + \directlua{% This value depends on the version of LuaTeX. + luatexja.stack.hmode = -tex.nest[tex.nest.ptr].mode + } +} + % prebreakpenalty = {, } \define@key[ltj]{japaram}{kcatcode}{% - \expandafter\ltj@@set@stack#1:{kcat}{0}{0x7FFFFFFF}} + \expandafter\ltj@@set@stack#1:{KCAT}{0}{0x7FFFFFFF}} \define@key[ltj]{japaram}{prebreakpenalty}{% - \expandafter\ltj@@set@stack#1:{pre}{-10000}{10000}} + \expandafter\ltj@@set@stack#1:{PRE}{-10000}{10000}} \define@key[ltj]{japaram}{postbreakpenalty}{% - \expandafter\ltj@@set@stack#1:{post}{-10000}{10000}} + \expandafter\ltj@@set@stack#1:{POST}{-10000}{10000}} \def\ltj@@set@stack#1,#2:#3#4#5{% - \directlua{luatexja.stack.set_stack_table(luatexja.isglobal, \asluastring{#3}, + \directlua{luatexja.stack.set_stack_table(luatexja.isglobal, luatexja.stack_table_index.#3, \ltj@safe@num@or{nil}{#1},\ltj@safe@num@or{nil}{#2},#4,#5)}} % jatextfont = {, } \define@key[ltj]{japaram}{jatextfont}{% - \expandafter\ltj@@set@stackfont#1:{mjtext}} + \expandafter\ltj@@set@stackfont#1:{MJT}} \define@key[ltj]{japaram}{jascriptfont}{% - \expandafter\ltj@@set@stackfont#1:{mjscr}} + \expandafter\ltj@@set@stackfont#1:{MJS}} \define@key[ltj]{japaram}{jascriptscriptfont}{% - \expandafter\ltj@@set@stackfont#1:{mjss}} + \expandafter\ltj@@set@stackfont#1:{MJSS}} \protected\def\ltj@@set@stackfont#1,#2:#3{% \ltj@reset@globaldefs \ltj@tempcnta=\ltj@curjfnt\ltj@curjfnt=-1 #2% @@ -267,7 +272,8 @@ {\string#2 is not a control sequence that represents \MessageBreak a Japanese font}{}% \else - \directlua{luatexja.stack.set_stack_font(luatexja.isglobal, \asluastring{#3}, + \directlua{luatexja.stack.set_stack_font(luatexja.isglobal, + luatexja.stack_table_index.#3, \ltj@safe@num@or{nil}{#1}, \the\ltj@curjfnt)}% \fi \ltj@curjfnt=\ltj@tempcnta @@ -296,7 +302,8 @@ \def\ltj@tempa{preonly}\ifx\ltj@temp\ltj@tempa\def\ltj@temp{1}\fi \def\ltj@tempa{postonly}\ifx\ltj@temp\ltj@tempa\def\ltj@temp{2}\fi \def\ltj@tempa{allow}\ifx\ltj@temp\ltj@tempa\def\ltj@temp{3}\fi - \directlua{luatexja.stack.set_stack_table(luatexja.isglobal, 'xsp', + \directlua{luatexja.stack.set_stack_table(luatexja.isglobal, + luatexja.stack_table_index.XSP, \ltj@safe@num@or{nil}{#1}, \ltj@safe@num@or{nil}{\ltj@temp},0,3)}} @@ -311,7 +318,8 @@ \def\ltj@tempa{preonly}\ifx\ltj@temp\ltj@tempa\def\ltj@temp{1}\fi \def\ltj@tempa{postonly}\ifx\ltj@temp\ltj@tempa\def\ltj@temp{2}\fi \def\ltj@tempa{allow}\ifx\ltj@temp\ltj@tempa\def\ltj@temp{3}\fi - \directlua{luatexja.stack.set_stack_table(luatexja.isglobal, 'xsp', + \directlua{luatexja.stack.set_stack_table(luatexja.isglobal, + luatexja.stack_table_index.XSP, \ltj@safe@num@or{nil}{#1}, \ltj@safe@num@or{nil}{\ltj@temp},0,3)}} @@ -339,21 +347,24 @@ % jcharwidowpenalty = \define@key[ltj]{japaram}{jcharwidowpenalty}{% %COUNT - \ltj@@set@stack0,#1:{jwp}{-10000}{10000}} + \ltj@@set@stack0,#1:{JWP}{-10000}{10000}} -% differentjfm = { large | small | average | both } +% differentjfm = { large | small | average | pleft | pright | paverage | both} \define@choicekey*+[ltj]{japaram}{differentjfm}[\ltj@temp\ltj@tempr]% - {large,small,average,both}{% + {large,small,average,pleft,pright,paverage,both}{% \ifcase\ltj@tempr \directlua{luatexja.jfmglue.diffmet_rule = math.max}\or \directlua{luatexja.jfmglue.diffmet_rule = math.min}\or \directlua{luatexja.jfmglue.diffmet_rule = math.two_average}\or + \directlua{luatexja.jfmglue.diffmet_rule = math.two_pleft}\or + \directlua{luatexja.jfmglue.diffmet_rule = math.two_pright}\or + \directlua{luatexja.jfmglue.diffmet_rule = math.two_paverage}\or \directlua{luatexja.jfmglue.diffmet_rule = math.two_add} \fi }{\ltj@PackageError{luatexja}{invalid argument `#1' for `differentjfm'}{% Argument for `differentjfm' must be one of `large', `small', `average',^^J% - and `both'. }} - % large, small, average, both + `pleft', `pright', 'paverage' or `both'. }} + % large, small, average, pleft, pright, paverage, both % jacharrange = { +- }