diff options
Diffstat (limited to 'Master/texmf-dist/tex/luatex/luatexja/addons/luatexja-adjust.sty')
-rw-r--r-- | Master/texmf-dist/tex/luatex/luatexja/addons/luatexja-adjust.sty | 41 |
1 files changed, 35 insertions, 6 deletions
diff --git a/Master/texmf-dist/tex/luatex/luatexja/addons/luatexja-adjust.sty b/Master/texmf-dist/tex/luatex/luatexja/addons/luatexja-adjust.sty index c14c52e93ca..be15fbba183 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/addons/luatexja-adjust.sty +++ b/Master/texmf-dist/tex/luatex/luatexja/addons/luatexja-adjust.sty @@ -68,6 +68,7 @@ \fi %</LaTeX> % Load core module if not yet. +% xkeyval.sty is already required in luatexja.sty. \ifx\luatexjacoreLoaded\@undefined \ifltj@in@latex %<*LaTeX> \RequirePackage{luatexja}[2016/05/15] @@ -90,13 +91,41 @@ \RequireLuaTeXjaSubmodule{adjust_85} \fi -% enable/disable ``advanced'' line adjustment -\protected\def\ltjdisableadjust{\directlua{luatexja.adjust.disable_cb()}} -\protected\def\ltjenableadjust{\directlua{luatexja.adjust.enable_cb()}} + +\newcount\ltjadj@status@le +\newcount\ltjadj@status@pr +\let\ltj@adjust@temp=\relax +\define@choicekey[ltj]{adjust}{lineend}[\@@temp\ltj@adjust@temp]% +{false,true,extended}[true]{% + \ifnum\ltj@adjust@temp=-1 \else\ltjadj@status@le=\ltj@adjust@temp\fi\relax} +\define@boolkey[ltj]{adjust}{priority}[true]{% + \ltjadj@status@pr=\ifltj@adjust@priority1\else0\fi\relax} +\protected\def\@@ltjenableadjust[#1]{% + \setkeys[ltj]{adjust}{#1}% + \directlua{luatexja.adjust.enable_cb(\the\ltjadj@status@le, \the\ltjadj@status@pr)}\ignorespaces +} +\protected\def\ltjdisableadjust{\ltjenableadjust[lineend=false,priority=false]} +\protected\def\ltjenableadjust{% + \ltx@ifnextchar[{\@@ltjenableadjust}{\@@ltjenableadjust[lineend,priority]}}%] + \ltjenableadjust -% there is also a key for \ltjsetparameter, for same effect -\define@boolkey[ltj]{japaram}{adjust}[true]{% - \ifltj@japaram@adjust\ltjenableadjust\else\ltjdisableadjust\fi + +%%% 優先順位の設定 +\define@key[ltj]{adjpri}{kanjiskip}{% + \directlua{luatexja.adjust.priority_table[\the\count@][1] = token.scan_int()}#1\relax} +\define@key[ltj]{adjpri}{xkanjiskip}{% + \directlua{luatexja.adjust.priority_table[\the\count@][2] = token.scan_int()}#1\relax} +\define@key[ltj]{adjpri}{others}{% + \directlua{luatexja.adjust.priority_table[\the\count@][3] = token.scan_int()}#1\relax} +\define@key[ltj]{japaram}{stretch_priority}{% + \begingroup\count@=1 \setkeys[ltj]{adjpri}{#1}\relax + \directlua{luatexja.adjust.make_priority_table(1)}\endgroup} +\define@key[ltj]{japaram}{shrink_priority}{% + \begingroup\count@=2 \setkeys[ltj]{adjpri}{#1}\relax + \directlua{luatexja.adjust.make_priority_table(2)}\endgroup} +\ltjsetparameter{% + stretch_priority={kanjiskip=-35, xkanjiskip=-25, others=50}, + shrink_priority={kanjiskip=-35, xkanjiskip=-25, others=50}, } |