diff options
author | Karl Berry <karl@freefriends.org> | 2014-06-23 23:35:40 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2014-06-23 23:35:40 +0000 |
commit | d82e5391f0626307e306305eb3fe00eac8c8da3f (patch) | |
tree | 4b85bc59b049d9b7025d666cd0fc324d83d98e4a /Master/texmf-dist/tex/luatex | |
parent | 2290bfdf9afc805d8a73d6d9728c1362486db3fd (diff) |
luatexja (22jun14)
git-svn-id: svn://tug.org/texlive/trunk@34369 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/luatex')
11 files changed, 769 insertions, 397 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 cdfad90572b..b25e7060d39 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/addons/luatexja-adjust.sty +++ b/Master/texmf-dist/tex/luatex/luatexja/addons/luatexja-adjust.sty @@ -82,6 +82,7 @@ \expandafter\endinput\fi\relax %%------------------ + %! Main part of luatexja-adjust \RequireLuaTeXjaSubmodule{adjust} @@ -94,23 +95,6 @@ \ifltj@japaram@adjust\ltjenableadjust\else\ltjdisableadjust\fi } -\ifltj@in@latex - \RequirePackage{expl3} - \ExplSyntaxOn - \cs_new:Nn \ltj_adjust_inittable: { - % To be filled... - } - \cs_new:Nn \ltj_adjust_appendtable:n { - % To be filled - } - \clist_new:N \l_ltj_adjust_priority - \define@key[ltj]{japaram}{adjustpriority}{% COMMA LIST - \clist_set:Nx \l_ltj_adjust_priority {#1} - \ltj_adjust_inittable: - \clist_map_function:NN \l_ltj_adjust_priority \ltj_adjust_appendtable:n - } - \ExplSyntaxOff -\fi %%------------------ all done \ltj@adjust@AtEnd diff --git a/Master/texmf-dist/tex/luatex/luatexja/addons/luatexja-fontspec-23.sty b/Master/texmf-dist/tex/luatex/luatexja/addons/luatexja-fontspec-23.sty new file mode 100644 index 00000000000..993cbf4670f --- /dev/null +++ b/Master/texmf-dist/tex/luatex/luatexja/addons/luatexja-fontspec-23.sty @@ -0,0 +1,334 @@ +% +% luatexja-fontspec-23.sty +% +% This package is compatible with fontspec <=2.3, +% will be removed in a future version. +% + + +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{luatexja-fontspec-23}[2014/06/19 fontspec support of LuaTeX-ja] +\RequirePackage{l3keys2e,luatexja} +\ExplSyntaxOn + +%%%%%%%% Change Japanese font family by \rmfamily or not +\bool_if:NTF \ltj_fontspec_match +{ + \renewcommand\jttdefault{\gtdefault} + \DeclareRobustCommand\rmfamily + {\not@math@alphabet\rmfamily\mathrm + \romanfamily\rmdefault\kanjifamily\mcdefault\selectfont} + \DeclareRobustCommand\sffamily + {\not@math@alphabet\sffamily\mathsf + \romanfamily\sfdefault\kanjifamily\gtdefault\selectfont} + \DeclareRobustCommand\ttfamily + {\not@math@alphabet\ttfamily\mathtt + \romanfamily\ttdefault\kanjifamily\jttdefault\selectfont} + \DeclareDocumentCommand \setmonojfont { O{} m } { + \__ltj_fontspec_set_family:Nnn \jttdefault {#1}{#2} + \normalfont + } +}{ +} + +%%%%%%%% Messages + +\msg_new:nnn {luatexja-fontspec} {addjfontfeatures-ignored} +{ + \string\addjfontfeature (s)~ ignored;\\ + it~ cannot~ be~ used~ with~ a~ font~ that~ wasn't~ selected~ by~ luatexja-fontspec. +} + +\msg_new:nnn {luatexja-fontspec} {altfont-ignored-by-norange} +{ + ignored~ sublist~ `#1'~ in~ AltFont~ (no~ range~ is~ specified). +} + +\msg_new:nnn {luatexja-fontspec} {altfont-ignored-by-rangeonly} +{ + ignored~ sublist~ `#1'~ in~ AltFont~ (only~ range~ is~ specified). +} + +\cs_generate_variant:Nn \prg_new_conditional:Nnn {Nnx} + +%%%%%%%% \g_ltj_fontspec_scale_fp +%% Default scale value for jfont. +\fp_new:N \g_ltj_fontspec_scale_fp +\group_begin: +\fontsize{10}{10}\selectfont +\fp_gset:Nn \g_ltj_fontspec_scale_fp {\zw / 10} +\group_end: + +%%%%%%%% Internal control sequences +%% Each CS is ltj_fontspec version that corresponds to original CS of fontspec. +\cs_new:Nn \ltj_fontspec_define_option:nn { + \keys_define:nn {fontspec} { #1 .code:n = {#2}} +} + +\cs_new:Nn \ltj_fontspec_define_preparse_external:nn { + \keys_define:nn {fontspec-preparse-external} { #1 .code:n = {#2}} +} + +\cs_new:Nn \ltj_fontspec_define_altfont_option:nn { + \keys_define:nn {fontspec-ltjaltfont} { #1 .code:n = {#2}} +} + +%% Alternate Fonts +%% Spec: AltFont = { +%% ... +%% { Range = <range>, <font features> }, +%% { Range = <range>, Font = <font name>, <font features> }, +%% { Range = <range>, Font = <font name> }, +%% ... +%% } +\tl_new:N \l_ltj_fontspec_altname_tl +\tl_new:N \l_ltj_fontspec_altrange_tl +\clist_new:N \l_ltj_fontspec_altfont_clist +\clist_new:N \l_ltj_fontspec_altfont_leftover_clist +\int_new:N \g_ltj_fontspec_altnumber_int + +\ltj_fontspec_define_altfont_option:nn {Range} { + \tl_set:Nn \l_ltj_fontspec_altrange_tl {#1} +} +\ltj_fontspec_define_altfont_option:nn {Font} { + \fontspec_complete_fontname:Nn \l_ltj_fontspec_altname_tl {#1} +} + +\cs_new:Nn \__ltj_fontspec_altfont_key_code:n + { + \clist_set:Nn \l_ltj_fontspec_altfont_clist {#1} + \fontspec_update_fontid:n {alt:#1} + } + +\cs_new:Nn \ltj_fontspec_select:nn { + \group_begin: + \ltj_fontspec_define_option:nn {AltFont} { + \__ltj_fontspec_altfont_key_code:n { ##1 } + } + \ltj_fontspec_define_option:nn {CID} { + \fontspec_update_fontid:n {+cid=##1} + \fontspec_update_featstr:n {cid=##1} + } + \ltj_fontspec_define_option:nn {JFM} { + \fontspec_update_fontid:n {+jfm=##1} + \fontspec_update_featstr:n {jfm=##1} + } + \ltj_fontspec_define_option:nn {JFM-var} { + \fontspec_update_fontid:n {+jfmvar=##1} + \fontspec_update_featstr:n {jfmvar=##1} + } + \ltj_fontspec_define_preparse_external:nn {NoEmbed} { + \cs_set:Nn \fontspec_namewrap:n {psft:####1} + } + %% Omit the warning message + %% "OpenType feature 'Kerning=Off' (-kern) not available ..." + \ltj_fontspec_define_option:nn {Kerning/Off} { + \fontspec_update_fontid:n {-kern} + \fontspec_update_featstr:n {-kern} + } + \tl_set:Nn \g_fontspec_encoding_tl {JY3} + \tl_set:Nx \g_fontspec_default_fontopts_tl + {JFM=ujis, Scale=\fp_use:N \g_ltj_fontspec_scale_fp, + Kerning=Off, \g_ltj_fontspec_default_fontopts_tl} + \prop_set_eq:NN \g__fontspec_fontopts_prop \g__ltj_fontspec_fontopts_prop + \cs_set_eq:NN \fontspec_make_font_shapes:nnnn \ltj_fontspec_make_font_shapes:nnnn + \cs_set_eq:NN \DeclareFontFamily \DeclareKanjiFamily + \fontspec_select:nn{#1}{#2} + \group_end: +} + +\cs_new:Nn \__ltj_fontspec_set_family:Nnn { + \ltj_fontspec_select:nn{#2}{#3} + \tl_set_eq:NN #1 \l_fontspec_family_tl +} +\cs_set_eq:NN \__ltj_orig_fontspec_make_font_shapes:nnnn \fontspec_make_font_shapes:nnnn +\cs_set_eq:NN \__ltj_fontspec_orig_DeclareFontShape \DeclareFontShape +\cs_new:Nn \ltj_fontspec_make_font_shapes:nnnn { + \__ltj_orig_fontspec_make_font_shapes:nnnn {#1} {#2} {#3} {#4} + \group_begin: + %% Parse font features. However, we have to avoid redefine already defined shape. + \__fontspec_load_fontname:n {#1} + \cs_set_eq:NN \DeclareFontShape \use_none:nnnnnn + \fontspec_declare_shape:nnn {#2}{#3} + { \quark_if_no_value:NF \l__fontspec_fontopts_clist {\l__fontspec_fontopts_clist,} #4 } + \cs_set_eq:NN \DeclareFontShape \__ltj_fontspec_orig_DeclareFontShape + %% + \clist_if_empty:NF \l_ltj_fontspec_altfont_clist { + \int_gzero:N \g_ltj_fontspec_altnumber_int + \clist_map_inline:Nn \l_ltj_fontspec_altfont_clist { + \tl_clear:N \l_ltj_fontspec_altrange_tl + \tl_set:Nn \l_ltj_fontspec_altname_tl { #1 } + \tl_set:Nn \l_tmpa_tl { #1 } + + \keys_set_known:nxN {fontspec-ltjaltfont} { \exp_after:wN \use:n ##1 } + \l_ltj_fontspec_altfont_leftover_clist + + \tl_if_empty:NT \l_ltj_fontspec_altrange_tl { + \msg_warning:nnn {luatexja-fontspec} {altfont-ignored-by-norange} { ##1 } + } { + \bool_if:nTF { + \tl_if_eq_p:NN \l_ltj_fontspec_altname_tl \l_tmpa_tl + && + \tl_if_empty_p:N \l_ltj_fontspec_altfont_leftover_clist + } { + \msg_warning:nnn {luatexja-fontspec} {altfont-ignored-by-rangeonly} { ##1 } + } { + \group_begin: + \__fontspec_load_fontname:n { \l_ltj_fontspec_altname_tl } + \fontspec_declare_shape:nnn {#2} + {#3 _ alt \int_use:N \g_ltj_fontspec_altnumber_int } + { + \quark_if_no_value:NF \l__fontspec_fontopts_clist {\l__fontspec_fontopts_clist,} + #4 , \l_ltj_fontspec_altfont_leftover_clist + } + \group_end: + \DeclareAlternateKanjiFont + {JY3}{ \l_fontspec_family_tl }{#2}{#3}% + {JY3}{ \l_fontspec_family_tl }{#2} + { #3 _alt \int_use:N \g_ltj_fontspec_altnumber_int } + { \l_ltj_fontspec_altrange_tl } + \int_gincr:N \g_ltj_fontspec_altnumber_int + } + } + } + } + \group_end: + } + +%%%%%%%% User commands +\DeclareDocumentCommand \jfontspec { O{} m } { + \__ltj_fontspec_set_family:Nnn \k@family {#1}{#2} + \selectfont + \ignorespaces +} + +\DeclareDocumentCommand \setmainjfont { O{} m } { + \__ltj_fontspec_set_family:Nnn \mcdefault {#1}{#2} + \DeclareSymbolFont{mincho}{JY3}{\l_fontspec_family_tl}{m}{n} + \SetSymbolFont{mincho}{bold}{JY3}{\l_fontspec_family_tl}{bx}{n} + \normalfont +} + +\DeclareDocumentCommand \setsansjfont { O{} m } { + \__ltj_fontspec_set_family:Nnn \gtdefault {#1}{#2} + \DeclareMathAlphabet{\mathgt}{JY3}{\l_fontspec_family_tl}{m}{n} + \normalfont +} + +\DeclareDocumentCommand \newjfontfamily { m O{} m } { + \ltj_fontspec_select:nn{#2}{#3} + \use:x { + \exp_not:N \DeclareRobustCommand \exp_not:N #1 { + \exp_not:N \kanjifamily {\l_fontspec_family_tl} \exp_not:N \selectfont + } + } +} + +\DeclareDocumentCommand \newjfontface { m O{} m } { + \newjfontfamily #1 [ BoldFont={},ItalicFont={},SmallCapsFont={},#2 ] {#3} +} + +\tl_new:N \g_ltj_fontspec_default_fontopts_tl +\prop_new:N \g__ltj_fontspec_fontopts_prop +\DeclareDocumentCommand \defaultjfontfeatures { o m } + { + \IfNoValueTF {#1} + { \__ltj_fontspec_set_default_features:n {#2} } + { \__ltj_fontspec_set_font_default_features:nn {#1} {#2} } + } +\cs_new:Nn \__ltj_fontspec_set_default_features:n + { + \tl_set:Nn \g_ltj_fontspec_default_fontopts_tl {#1,} + } +\cs_new:Nn \__ltj_fontspec_set_font_default_features:nn + { + \__fontspec_sanitise_fontname:Nn \l__fontspec_tmp_tl {#1} + \tl_if_empty:nTF {#2} + { \prop_gremove:NV \g__ltj_fontspec_fontopts_prop \l__fontspec_tmp_tl } + { \prop_gput:NVn \g__ltj_fontspec_fontopts_prop \l__fontspec_tmp_tl {#2} } + } + +\DeclareDocumentCommand \addjfontfeatures {m} { + \ifcsname zf@family@fontdef\k@family\endcsname + \group_begin: + \tl_clear:N \g_ltj_fontspec_default_fontopts_tl + \use:x { + \exp_not:N\ltj_fontspec_select:nn + {\csname zf@family@options\k@family\endcsname,#1} + {\csname zf@family@fontname\k@family\endcsname} + } + \group_end: + \fontfamily\l_fontspec_family_tl\selectfont + \else + \msg_warning:nn {luatexja-fontspec} {addjfontfeatures-ignored} + \fi + \ignorespaces +} + +\cs_set_eq:NN \addjfontfeature \addjfontfeatures + +%%% CJKShape=JIS2004 +\fontspec_define_feature_option:nnnnn{CJKShape}{JIS2004}{20}{5}{+jp04} + +\ExplSyntaxOff +%%%%%%%% Now we completely ignore kanjifont definition file. + +\DeclareRobustCommand\fontfamily[1]{% + \@notkfamfalse\@notffamfalse + \edef\tmp@item{'\luatexluaescapestring{#1}'}% + \edef\tmp@enc{'\luatexluaescapestring{\f@encoding}'}% + \ifcsname \k@encoding+#1\endcsname % if \k@encoding+#1 is already defined + \edef\k@family{#1}% + \else\@notkfamtrue\fi + \ifcsname \f@encoding+#1\endcsname + \edef\f@family{#1}% + \else % search font definition file... + \directlua{luatexja.jfont.is_ffam(\tmp@enc, \tmp@item)}% + \ifin@\edef\k@family{#1}\else% + \directlua{luatexja.jfont.is_Nffam(\tmp@enc, \tmp@item)}% + \ifin@\@notffamtrue\else% + % filename of font definition file is always lowercase + \edef\@temp{\lowercase{\noexpand\IfFileExists{\f@encoding#1.fd}}}% + \message{(I search font definition file)}% + \@temp{\@tempswztrue}{\@tempswzfalse}% + \if@tempswz + \directlua{luatexja.jfont.add_ffam_list(\tmp@enc, \tmp@item)}% + \edef\f@family{#1}% + \else + \directlua{luatexja.jfont.add_Nffam_list(\tmp@enc, \tmp@item)}% + \@notffamtrue% + \fi + \fi + \fi + \fi + \if@notkfam\if@notffam + {\ifcsname D@\k@encoding\endcsname\@nameuse{D@\k@encoding}\fi + \xdef\@@temp{\default@family}}\edef\k@family{\@@temp}% + {\ifcsname D@\f@encoding\endcsname\@nameuse{D@\f@encoding}\fi + \xdef\@@temp{\default@family}}\edef\f@family{\@@temp}% + \fi\fi +} + +% We must redefine \try@load@fontshape to ignore kanjifont definitions at all. +\def\try@load@fontshape{% + \expandafter + \ifx\csname \f@encoding+\f@family\endcsname\relax + \directlua{luatexja.jfont.is_kenc('\luatexluaescapestring{\f@encoding}')}% +\ifin@ % Japanese font: we don't search fd. + \@font@warning{We don't search kanjifont definition + \MessageBreak for \f@encoding/\f@family}% +\else % Alphabetic font + \@font@info{Try loading font information for \f@encoding+\f@family}% + \global\expandafter\let + \csname\f@encoding+\f@family\endcsname\@empty + \nfss@catcodes + \let\nfss@catcodes\relax + \edef\reserved@a{% + \lowercase{% + \noexpand\InputIfFileExists{\f@encoding\f@family.fd}}}% + \reserved@a\relax + {\@input@{\f@encoding\f@family.fd}}% +\fi + \fi} + +\endinput diff --git a/Master/texmf-dist/tex/luatex/luatexja/addons/luatexja-fontspec-24.sty b/Master/texmf-dist/tex/luatex/luatexja/addons/luatexja-fontspec-24.sty new file mode 100644 index 00000000000..4bd81c62cc9 --- /dev/null +++ b/Master/texmf-dist/tex/luatex/luatexja/addons/luatexja-fontspec-24.sty @@ -0,0 +1,332 @@ +% +% luatexja-fontspec-24.sty +% + +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{luatexja-fontspec-24}[2014/06/19 fontspec support of LuaTeX-ja] +\RequirePackage{l3keys2e,luatexja} +\ExplSyntaxOn + +%%%%%%%% Change Japanese font family by \rmfamily or not +\bool_if:NTF \ltj_fontspec_match +{ + \renewcommand\jttdefault{\gtdefault} + \DeclareRobustCommand\rmfamily + {\not@math@alphabet\rmfamily\mathrm + \romanfamily\rmdefault\kanjifamily\mcdefault\selectfont} + \DeclareRobustCommand\sffamily + {\not@math@alphabet\sffamily\mathsf + \romanfamily\sfdefault\kanjifamily\gtdefault\selectfont} + \DeclareRobustCommand\ttfamily + {\not@math@alphabet\ttfamily\mathtt + \romanfamily\ttdefault\kanjifamily\jttdefault\selectfont} + \DeclareDocumentCommand \setmonojfont { O{} m } { + \ltj_fontspec_set_family:Nnn \jttdefault {#1}{#2} + \normalfont + } +}{ +} + +%%%%%%%% Messages + +\msg_new:nnn {luatexja-fontspec} {addjfontfeatures-ignored} +{ + \string\addjfontfeature (s)~ ignored;\\ + it~ cannot~ be~ used~ with~ a~ font~ that~ wasn't~ selected~ by~ luatexja-fontspec. +} + +\msg_new:nnn {luatexja-fontspec} {altfont-ignored-by-norange} +{ + ignored~ sublist~ `#1'~ in~ AltFont~ (no~ range~ is~ specified). +} + +\msg_new:nnn {luatexja-fontspec} {altfont-ignored-by-rangeonly} +{ + ignored~ sublist~ `#1'~ in~ AltFont~ (only~ range~ is~ specified). +} + +\cs_generate_variant:Nn \prg_new_conditional:Nnn {Nnx} + +%%%%%%%% \g_ltj_fontspec_scale_fp +%% Default scale value for jfont. +\fp_new:N \g_ltj_fontspec_scale_fp +\group_begin: +\fontsize{10}{10}\selectfont +\fp_gset:Nn \g_ltj_fontspec_scale_fp {\zw / 10} +\group_end: + +%%%%%%%% Internal control sequences +%% Each CS is ltj_fontspec version that corresponds to original CS of fontspec. +\cs_new:Nn \ltj_fontspec_define_option:nn { + \__fontspec_keys_define_code:nnn {fontspec} {#1} {#2} +} + +\cs_new:Nn \ltj_fontspec_define_preparse_external:nn { + \__fontspec_keys_define_code:nnn {fontspec-preparse-external} {#1} {#2} +} + +\cs_new:Nn \ltj_fontspec_define_altfont_option:nn { + \__fontspec_keys_define_code:nnn {fontspec-ltjaltfont} {#1} {#2} +} + +%% Alternate Fonts +%% Spec: AltFont = { +%% ... +%% { Range = <range>, <font features> }, +%% { Range = <range>, Font = <font name>, <font features> }, +%% { Range = <range>, Font = <font name> }, +%% ... +%% } +\tl_new:N \l_ltj_fontspec_altname_tl +\tl_new:N \l_ltj_fontspec_altrange_tl +\clist_new:N \l_ltj_fontspec_altfont_clist +\clist_new:N \l_ltj_fontspec_altfont_leftover_clist +\int_new:N \g_ltj_fontspec_altnumber_int + +\ltj_fontspec_define_altfont_option:nn {Range} { + \tl_set:Nn \l_ltj_fontspec_altrange_tl {#1} +} +\ltj_fontspec_define_altfont_option:nn {Font} { + \fontspec_complete_fontname:Nn \l_ltj_fontspec_altname_tl {#1} +} + +\cs_new:Nn \__ltj_fontspec_altfont_key_code:n +{ + \clist_set:Nn \l_ltj_fontspec_altfont_clist {#1} +} + +\cs_set_eq:NN \__ltj_orig_fontspec_select:nn \fontspec_select:nn +\cs_new:Nn \ltj_fontspec_select:nn { + \group_begin: + \ltj_fontspec_define_option:nn {AltFont} { + \__ltj_fontspec_altfont_key_code:n { ##1 } + } + \ltj_fontspec_define_option:nn {CID} { + \__fontspec_update_featstr:n {cid=##1} + } + \ltj_fontspec_define_option:nn {JFM} { + \__fontspec_update_featstr:n {jfm=##1} + } + + \ltj_fontspec_define_option:nn {JFM-var} { + \__fontspec_update_featstr:n {jfmvar=##1} + } + \ltj_fontspec_define_preparse_external:nn {NoEmbed} { + \cs_set:Nn \__fontspec_namewrap:n {psft:####1} + } + %% Omit the warning message + %% "OpenType feature 'Kerning=Off' (-kern) not available ..." + \ltj_fontspec_define_option:nn {Kerning/Off} { + \__fontspec_update_featstr:n {-kern} + } + \tl_set:Nn \g_fontspec_encoding_tl {JY3} + \clist_set:Nx \g__fontspec_default_fontopts_clist + {JFM=ujis, Scale=\fp_use:N \g_ltj_fontspec_scale_fp, + Kerning=Off, \g__ltj_fontspec_default_fontopts_clist} + \prop_set_eq:NN \g__fontspec_fontopts_prop \g__ltj_fontspec_fontopts_prop + \cs_set_eq:NN \__fontspec_make_font_shapes:Nnnnn \ltj_fontspec_make_font_shapes:Nnnnn + \cs_set_eq:NN \DeclareFontFamily \DeclareKanjiFamily + \__ltj_orig_fontspec_select:nn{#1}{#2} + \group_end: +} + +\cs_new:Nn \ltj_fontspec_set_family:Nnn { + \cs_set_eq:NN \fontspec_select:nn \ltj_fontspec_select:nn + \__ltj_orig_fontspec_set_family:Nnn #1 {#2} {#3} + \cs_set_eq:NN \fontspec_select:nn \__ltj_orig_fontspec_select:nn +} +\cs_set_eq:NN \__ltj_orig_fontspec_set_family:Nnn \fontspec_set_family:Nnn +\cs_set_eq:NN \__ltj_orig_fontspec_make_font_shapes:Nnnnn \__fontspec_make_font_shapes:Nnnnn +\cs_set_eq:NN \__ltj_fontspec_orig_DeclareFontShape \DeclareFontShape +\cs_new:Nn \ltj_fontspec_make_font_shapes:Nnnnn { + \__ltj_orig_fontspec_make_font_shapes:Nnnnn {#1} {#2} {#3} {#4} {#5} + \group_begin: + %% Parse font features. However, we have to avoid redefine already defined shape. + \__fontspec_load_fontname:n {#1} + \cs_set_eq:NN \DeclareFontShape \use_none:nnnnnn + \__fontspec_declare_shape:nnxx {#2} {#3} { \l__fontspec_fontopts_clist, #4 } {#5} + \cs_set_eq:NN \DeclareFontShape \__ltj_fontspec_orig_DeclareFontShape + %% + \clist_if_empty:NF \l_ltj_fontspec_altfont_clist { + \int_gzero:N \g_ltj_fontspec_altnumber_int + \clist_map_inline:Nn \l_ltj_fontspec_altfont_clist { + \tl_clear:N \l_ltj_fontspec_altrange_tl + \tl_set:Nn \l_ltj_fontspec_altname_tl { #1 } + \tl_set:Nn \l_tmpa_tl { #1 } + + \keys_set_known:nxN {fontspec-ltjaltfont} { \exp_after:wN \use:n ##1 } + \l_ltj_fontspec_altfont_leftover_clist + + \tl_if_empty:NT \l_ltj_fontspec_altrange_tl { + \msg_warning:nnn {luatexja-fontspec} {altfont-ignored-by-norange} { ##1 } + } { + \bool_if:nTF { + \tl_if_eq_p:NN \l_ltj_fontspec_altname_tl \l_tmpa_tl + && + \tl_if_empty_p:N \l_ltj_fontspec_altfont_leftover_clist + } { + \msg_warning:nnn {luatexja-fontspec} {altfont-ignored-by-rangeonly} { ##1 } + } { + \group_begin: + \__fontspec_load_fontname:n { \l_ltj_fontspec_altname_tl } + \__fontspec_declare_shape:nnxx {#2} + {#3 _ alt \int_use:N \g_ltj_fontspec_altnumber_int } + {\l__fontspec_fontopts_clist, #4 , \l_ltj_fontspec_altfont_leftover_clist} + {#5} + \group_end: + \DeclareAlternateKanjiFont + {JY3}{ \l_fontspec_family_tl }{#2}{#3}% + {JY3}{ \l_fontspec_family_tl }{#2} + { #3 _alt \int_use:N \g_ltj_fontspec_altnumber_int } + { \l_ltj_fontspec_altrange_tl } + \int_gincr:N \g_ltj_fontspec_altnumber_int + } + } + } + } + \group_end: + } + +%%%%%%%% User commands +\DeclareDocumentCommand \jfontspec { O{} m O{} } { + \ltj_fontspec_set_family:Nnn \k@family {#1,#3}{#2} + \selectfont + \ignorespaces +} + +\DeclareDocumentCommand \setmainjfont { O{} m O{} } { + \ltj_fontspec_set_family:Nnn \mcdefault {#1,#3}{#2} + \DeclareSymbolFont{mincho}{JY3}{\l_fontspec_family_tl}{m}{n} + \SetSymbolFont{mincho}{bold}{JY3}{\l_fontspec_family_tl}{bx}{n} + \normalfont +} + +\DeclareDocumentCommand \setsansjfont { O{} m O{} } { + \ltj_fontspec_set_family:Nnn \gtdefault {#1,#3}{#2} + \DeclareMathAlphabet{\mathgt}{JY3}{\l_fontspec_family_tl}{m}{n} + \normalfont +} + +\DeclareDocumentCommand \newjfontfamily { m O{} m O{} } { + \cs_set_eq:NN \fontspec_set_family:Nnn \ltj_fontspec_set_family:Nnn + \newfontfamily #1 [#2] {#3} [#4] + \cs_set_eq:NN \fontspec_set_family:Nnn \__ltj_orig_fontspec_set_family:Nnn +} + +\DeclareDocumentCommand \newjfontface { m O{} m O{} } { + \newjfontfamily #1 [ BoldFont={},ItalicFont={},SmallCapsFont={},#2,#4 ] {#3} +} + +\clist_new:N \g__ltj_fontspec_default_fontopts_clist +\prop_new:N \g__ltj_fontspec_fontopts_prop +\DeclareDocumentCommand \defaultjfontfeatures { t+ o m } + { + \IfNoValueTF {#2} + { \__ltj_fontspec_set_default_features:nn {#1} {#3} } + { \__ltj_fontspec_set_font_default_features:nnn {#1} {#2} {#3} } + \ignorespaces + } +\cs_new:Nn \__ltj_fontspec_set_default_features:nn + { + \clist_set_eq:NN \l__ltj_fontspec_tmp_clist \g__fontspec_default_fontopts_clist + \clist_set_eq:NN \g__fontspec_default_fontopts_clist \g__ltj_fontspec_default_fontopts_clist + \__fontspec_set_default_features:nn {#1} {#2} + \clist_set_eq:NN \g__ltj_fontspec_default_fontopts_clist \g__fontspec_default_fontopts_clist + \clist_set_eq:NN \g__fontspec_default_fontopts_clist \l__ltj_fontspec_tmp_clist + } +\cs_new:Nn \__ltj_fontspec_set_font_default_features:nnn + { + \prop_set_eq:NN \l__ltj_fontspec_tmp_prop \g__fontspec_fontopts_prop + \prop_set_eq:NN \g__fontspec_fontopts_prop \g__ltj_fontspec_fontopts_prop + \__fontspec_set_font_default_features:nnn {#1} {#2} {#3} + \prop_set_eq:NN \g__ltj_fontspec_fontopts_prop \g__fontspec_fontopts_prop + \prop_set_eq:NN \g__fontspec_fontopts_prop \l__ltj_fontspec_tmp_prop + } + +\DeclareDocumentCommand \addjfontfeatures {m} { + \ltj_fontspec_if_fontspec_font:TF + { + \group_begin: + \tl_set_eq:NN \f@family \k@family + \cs_set_eq:NN \fontspec_select:nn \ltj_fontspec_select:nn + \addfontfeatures {#1} + \group_end: + \fontfamily\l_fontspec_family_tl\selectfont + }{ + \msg_warning:nn {luatexja-fontspec} {addjfontfeatures-ignored} + } + \ignorespaces +} + +\cs_set_eq:NN \addjfontfeature \addjfontfeatures + +\prg_new_conditional:Nnn \ltj_fontspec_if_fontspec_font: {TF,T,F} +{ + \cs_if_exist:cTF {g__fontspec_ \k@family _prop} \prg_return_true: \prg_return_false: +} + +%%% CJKShape=JIS2004 +\__fontspec_define_feature_option:nnnnn{CJKShape}{JIS2004}{20}{5}{+jp04} + +\ExplSyntaxOff +%%%%%%%% Now we completely ignore kanjifont definition file. + +\DeclareRobustCommand\fontfamily[1]{% + \@notkfamfalse\@notffamfalse + \edef\tmp@item{'\luatexluaescapestring{#1}'}% + \edef\tmp@enc{'\luatexluaescapestring{\f@encoding}'}% + \ifcsname \k@encoding+#1\endcsname % if \k@encoding+#1 is already defined + \edef\k@family{#1}% + \else\@notkfamtrue\fi + \ifcsname \f@encoding+#1\endcsname + \edef\f@family{#1}% + \else % search font definition file... + \directlua{luatexja.jfont.is_ffam(\tmp@enc, \tmp@item)}% + \ifin@\edef\k@family{#1}\else% + \directlua{luatexja.jfont.is_Nffam(\tmp@enc, \tmp@item)}% + \ifin@\@notffamtrue\else% + % filename of font definition file is always lowercase + \edef\@temp{\lowercase{\noexpand\IfFileExists{\f@encoding#1.fd}}}% + \message{(I search font definition file)}% + \@temp{\@tempswztrue}{\@tempswzfalse}% + \if@tempswz + \directlua{luatexja.jfont.add_ffam_list(\tmp@enc, \tmp@item)}% + \edef\f@family{#1}% + \else + \directlua{luatexja.jfont.add_Nffam_list(\tmp@enc, \tmp@item)}% + \@notffamtrue% + \fi + \fi + \fi + \fi + \if@notkfam\if@notffam + {\ifcsname D@\k@encoding\endcsname\@nameuse{D@\k@encoding}\fi + \xdef\@@temp{\default@family}}\edef\k@family{\@@temp}% + {\ifcsname D@\f@encoding\endcsname\@nameuse{D@\f@encoding}\fi + \xdef\@@temp{\default@family}}\edef\f@family{\@@temp}% + \fi\fi +} + +% We must redefine \try@load@fontshape to ignore kanjifont definitions at all. +\def\try@load@fontshape{% + \expandafter + \ifx\csname \f@encoding+\f@family\endcsname\relax + \directlua{luatexja.jfont.is_kenc('\luatexluaescapestring{\f@encoding}')}% +\ifin@ % Japanese font: we don't search fd. + \@font@warning{We don't search kanjifont definition + \MessageBreak for \f@encoding/\f@family}% +\else % Alphabetic font + \@font@info{Try loading font information for \f@encoding+\f@family}% + \global\expandafter\let + \csname\f@encoding+\f@family\endcsname\@empty + \nfss@catcodes + \let\nfss@catcodes\relax + \edef\reserved@a{% + \lowercase{% + \noexpand\InputIfFileExists{\f@encoding\f@family.fd}}}% + \reserved@a\relax + {\@input@{\f@encoding\f@family.fd}}% +\fi + \fi} + +\endinput diff --git a/Master/texmf-dist/tex/luatex/luatexja/addons/luatexja-fontspec.sty b/Master/texmf-dist/tex/luatex/luatexja/addons/luatexja-fontspec.sty index 43666d3b3f3..51346d56d14 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/addons/luatexja-fontspec.sty +++ b/Master/texmf-dist/tex/luatex/luatexja/addons/luatexja-fontspec.sty @@ -3,7 +3,7 @@ % \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{luatexja-fontspec}[2014/04/16 fontspec support of LuaTeX-ja] +\ProvidesPackage{luatexja-fontspec}[2014/06/19 fontspec support of LuaTeX-ja] \RequirePackage{l3keys2e,luatexja} \ExplSyntaxOn @@ -17,325 +17,10 @@ } \ProcessKeysOptions { luatexja-fontspec } \RequirePackage[\ltj_fontspec_pass_opts:]{fontspec}[2011/09/13] - -%%%%%%%% Change Japanese font family by \rmfamily or not -\bool_if:NTF \ltj_fontspec_match -{ - \renewcommand\jttdefault{\gtdefault} - \DeclareRobustCommand\rmfamily - {\not@math@alphabet\rmfamily\mathrm - \romanfamily\rmdefault\kanjifamily\mcdefault\selectfont} - \DeclareRobustCommand\sffamily - {\not@math@alphabet\sffamily\mathsf - \romanfamily\sfdefault\kanjifamily\gtdefault\selectfont} - \DeclareRobustCommand\ttfamily - {\not@math@alphabet\ttfamily\mathtt - \romanfamily\ttdefault\kanjifamily\jttdefault\selectfont} - \DeclareDocumentCommand \setmonojfont { O{} m } { - \__ltj_fontspec_set_family:Nnn \jttdefault {#1}{#2} - \normalfont - } -}{ -} - -%%%%%%%% Messages - -\msg_new:nnn {luatexja-fontspec} {addjfontfeatures-ignored} -{ - \string\addjfontfeature (s)~ ignored;\\ - it~ cannot~ be~ used~ with~ a~ font~ that~ wasn't~ selected~ by~ luatexja-fontspec. -} - -\msg_new:nnn {luatexja-fontspec} {altfont-ignored-by-norange} -{ - ignored~ sublist~ `#1'~ in~ AltFont~ (no~ range~ is~ specified). -} - -\msg_new:nnn {luatexja-fontspec} {altfont-ignored-by-rangeonly} -{ - ignored~ sublist~ `#1'~ in~ AltFont~ (only~ range~ is~ specified). -} - -\cs_generate_variant:Nn \prg_new_conditional:Nnn {Nnx} - -%%%%%%%% \g_ltj_fontspec_scale_fp -%% Default scale value for jfont. -\fp_new:N \g_ltj_fontspec_scale_fp -\group_begin: -\fontsize{10}{10}\selectfont -\fp_gset:Nn \g_ltj_fontspec_scale_fp {\zw / 10} -\group_end: - -%%%%%%%% Internal control sequences -%% Each CS is ltj_fontspec version that corresponds to original CS of fontspec. -\cs_new:Nn \ltj_fontspec_define_option:nn { - \keys_define:nn {fontspec} { #1 .code:n = {#2}} -} - -\cs_new:Nn \ltj_fontspec_define_preparse_external:nn { - \keys_define:nn {fontspec-preparse-external} { #1 .code:n = {#2}} -} - -\cs_new:Nn \ltj_fontspec_define_altfont_option:nn { - \keys_define:nn {fontspec-ltjaltfont} { #1 .code:n = {#2}} -} - -%% Alternate Fonts -%% Spec: AltFont = { -%% ... -%% { Range = <range>, <font features> }, -%% { Range = <range>, Font = <font name>, <font features> }, -%% { Range = <range>, Font = <font name> }, -%% ... -%% } -\tl_new:N \l_ltj_fontspec_altname_tl -\tl_new:N \l_ltj_fontspec_altrange_tl -\clist_new:N \l_ltj_fontspec_altfont_clist -\clist_new:N \l_ltj_fontspec_altfont_leftover_clist -\int_new:N \g_ltj_fontspec_altnumber_int - -\ltj_fontspec_define_altfont_option:nn {Range} { - \tl_set:Nn \l_ltj_fontspec_altrange_tl {#1} -} -\ltj_fontspec_define_altfont_option:nn {Font} { - \fontspec_complete_fontname:Nn \l_ltj_fontspec_altname_tl {#1} -} - -\cs_new:Nn \__ltj_fontspec_altfont_key_code:n - { - \clist_set:Nn \l_ltj_fontspec_altfont_clist {#1} - \fontspec_update_fontid:n {alt:#1} - } - -\cs_new:Nn \ltj_fontspec_select:nn { - \group_begin: - \ltj_fontspec_define_option:nn {AltFont} { - \__ltj_fontspec_altfont_key_code:n { ##1 } - } - \ltj_fontspec_define_option:nn {CID} { - \fontspec_update_fontid:n {+cid=##1} - \fontspec_update_featstr:n {cid=##1} - } - \ltj_fontspec_define_option:nn {JFM} { - \fontspec_update_fontid:n {+jfm=##1} - \fontspec_update_featstr:n {jfm=##1} - } - \ltj_fontspec_define_option:nn {JFM-var} { - \fontspec_update_fontid:n {+jfmvar=##1} - \fontspec_update_featstr:n {jfmvar=##1} - } - \ltj_fontspec_define_preparse_external:nn {NoEmbed} { - \cs_set:Nn \fontspec_namewrap:n {psft:####1} - } - %% Omit the warning message - %% "OpenType feature 'Kerning=Off' (-kern) not available ..." - \ltj_fontspec_define_option:nn {Kerning/Off} { - \fontspec_update_fontid:n {-kern} - \fontspec_update_featstr:n {-kern} - } - \tl_set:Nn \g_fontspec_encoding_tl {JY3} - \tl_set:Nx \g_fontspec_default_fontopts_tl - {JFM=ujis, Scale=\fp_use:N \g_ltj_fontspec_scale_fp, - Kerning=Off, \g_ltj_fontspec_default_fontopts_tl} - \prop_set_eq:NN \g__fontspec_fontopts_prop \g__ltj_fontspec_fontopts_prop - \cs_set_eq:NN \fontspec_make_font_shapes:nnnn \ltj_fontspec_make_font_shapes:nnnn - \cs_set_eq:NN \DeclareFontFamily \DeclareKanjiFamily - \fontspec_select:nn{#1}{#2} - \group_end: -} - -\cs_new:Nn \__ltj_fontspec_set_family:Nnn { - \ltj_fontspec_select:nn{#2}{#3} - \tl_set_eq:NN #1 \l_fontspec_family_tl -} -\cs_set_eq:NN \__ltj_orig_fontspec_make_font_shapes:nnnn \fontspec_make_font_shapes:nnnn -\cs_set_eq:NN \__ltj_fontspec_orig_DeclareFontShape \DeclareFontShape -\cs_new:Nn \ltj_fontspec_make_font_shapes:nnnn { - \__ltj_orig_fontspec_make_font_shapes:nnnn {#1} {#2} {#3} {#4} - \group_begin: - %% Parse font features. However, we have to avoid redefine already defined shape. - \__fontspec_load_fontname:n {#1} - \cs_set_eq:NN \DeclareFontShape \use_none:nnnnnn - \fontspec_declare_shape:nnn {#2}{#3} - { \quark_if_no_value:NF \l__fontspec_fontopts_clist {\l__fontspec_fontopts_clist,} #4 } - \cs_set_eq:NN \DeclareFontShape \__ltj_fontspec_orig_DeclareFontShape - %% - \clist_if_empty:NF \l_ltj_fontspec_altfont_clist { - \int_gzero:N \g_ltj_fontspec_altnumber_int - \clist_map_inline:Nn \l_ltj_fontspec_altfont_clist { - \tl_clear:N \l_ltj_fontspec_altrange_tl - \tl_set:Nn \l_ltj_fontspec_altname_tl { #1 } - \tl_set:Nn \l_tmpa_tl { #1 } - - \keys_set_known:nxN {fontspec-ltjaltfont} { \exp_after:wN \use:n ##1 } - \l_ltj_fontspec_altfont_leftover_clist - - \tl_if_empty:NT \l_ltj_fontspec_altrange_tl { - \msg_warning:nnn {luatexja-fontspec} {altfont-ignored-by-norange} { ##1 } - } { - \bool_if:nTF { - \tl_if_eq_p:NN \l_ltj_fontspec_altname_tl \l_tmpa_tl - && - \tl_if_empty_p:N \l_ltj_fontspec_altfont_leftover_clist - } { - \msg_warning:nnn {luatexja-fontspec} {altfont-ignored-by-rangeonly} { ##1 } - } { - \group_begin: - \__fontspec_load_fontname:n { \l_ltj_fontspec_altname_tl } - \fontspec_declare_shape:nnn {#2} - {#3 _ alt \int_use:N \g_ltj_fontspec_altnumber_int } - { - \quark_if_no_value:NF \l__fontspec_fontopts_clist {\l__fontspec_fontopts_clist,} - #4 , \l_ltj_fontspec_altfont_leftover_clist - } - \group_end: - \DeclareAlternateKanjiFont - {JY3}{ \l_fontspec_family_tl }{#2}{#3}% - {JY3}{ \l_fontspec_family_tl }{#2} - { #3 _alt \int_use:N \g_ltj_fontspec_altnumber_int } - { \l_ltj_fontspec_altrange_tl } - \int_gincr:N \g_ltj_fontspec_altnumber_int - } - } - } - } - \group_end: - } - -%%%%%%%% User commands -\DeclareDocumentCommand \jfontspec { O{} m } { - \__ltj_fontspec_set_family:Nnn \k@family {#1}{#2} - \selectfont - \ignorespaces -} - -\DeclareDocumentCommand \setmainjfont { O{} m } { - \__ltj_fontspec_set_family:Nnn \mcdefault {#1}{#2} - \DeclareSymbolFont{mincho}{JY3}{\l_fontspec_family_tl}{m}{n} - \SetSymbolFont{mincho}{bold}{JY3}{\l_fontspec_family_tl}{bx}{n} - \normalfont +\cs_if_exist:NTF \fontspec_update_featstr:n { + \RequirePackage{luatexja-fontspec-23} +} { + \RequirePackage{luatexja-fontspec-24} } -\DeclareDocumentCommand \setsansjfont { O{} m } { - \__ltj_fontspec_set_family:Nnn \gtdefault {#1}{#2} - \DeclareMathAlphabet{\mathgt}{JY3}{\l_fontspec_family_tl}{m}{n} - \normalfont -} - -\DeclareDocumentCommand \newjfontfamily { m O{} m } { - \ltj_fontspec_select:nn{#2}{#3} - \use:x { - \exp_not:N \DeclareRobustCommand \exp_not:N #1 { - \exp_not:N \kanjifamily {\l_fontspec_family_tl} \exp_not:N \selectfont - } - } -} - -\DeclareDocumentCommand \newjfontface { m O{} m } { - \newjfontfamily #1 [ BoldFont={},ItalicFont={},SmallCapsFont={},#2 ] {#3} -} - -\tl_new:N \g_ltj_fontspec_default_fontopts_tl -\prop_new:N \g__ltj_fontspec_fontopts_prop -\DeclareDocumentCommand \defaultjfontfeatures { o m } - { - \IfNoValueTF {#1} - { \__ltj_fontspec_set_default_features:n {#2} } - { \__ltj_fontspec_set_font_default_features:nn {#1} {#2} } - } -\cs_new:Nn \__ltj_fontspec_set_default_features:n - { - \tl_set:Nn \g_ltj_fontspec_default_fontopts_tl {#1,} - } -\cs_new:Nn \__ltj_fontspec_set_font_default_features:nn - { - \__fontspec_sanitise_fontname:Nn \l__fontspec_tmp_tl {#1} - \tl_if_empty:nTF {#2} - { \prop_gremove:NV \g__ltj_fontspec_fontopts_prop \l__fontspec_tmp_tl } - { \prop_gput:NVn \g__ltj_fontspec_fontopts_prop \l__fontspec_tmp_tl {#2} } - } - -\DeclareDocumentCommand \addjfontfeatures {m} { - \ifcsname zf@family@fontdef\k@family\endcsname - \group_begin: - \tl_clear:N \g_ltj_fontspec_default_fontopts_tl - \use:x { - \exp_not:N\ltj_fontspec_select:nn - {\csname zf@family@options\k@family\endcsname,#1} - {\csname zf@family@fontname\k@family\endcsname} - } - \group_end: - \fontfamily\l_fontspec_family_tl\selectfont - \else - \msg_warning:nn {luatexja-fontspec} {addjfontfeatures-ignored} - \fi - \ignorespaces -} - -\cs_set_eq:NN \addjfontfeature \addjfontfeatures - -%%% CJKShape=JIS2004 -\fontspec_define_feature_option:nnnnn{CJKShape}{JIS2004}{20}{5}{+jp04} - -\ExplSyntaxOff -%%%%%%%% Now we completely ignore kanjifont definition file. - -\DeclareRobustCommand\fontfamily[1]{% - \@notkfamfalse\@notffamfalse - \edef\tmp@item{'\luatexluaescapestring{#1}'}% - \edef\tmp@enc{'\luatexluaescapestring{\f@encoding}'}% - \ifcsname \k@encoding+#1\endcsname % if \k@encoding+#1 is already defined - \edef\k@family{#1}% - \else\@notkfamtrue\fi - \ifcsname \f@encoding+#1\endcsname - \edef\f@family{#1}% - \else % search font definition file... - \directlua{luatexja.jfont.is_ffam(\tmp@enc, \tmp@item)}% - \ifin@\edef\k@family{#1}\else% - \directlua{luatexja.jfont.is_Nffam(\tmp@enc, \tmp@item)}% - \ifin@\@notffamtrue\else% - % filename of font definition file is always lowercase - \edef\@temp{\lowercase{\noexpand\IfFileExists{\f@encoding#1.fd}}}% - \message{(I search font definition file)}% - \@temp{\@tempswztrue}{\@tempswzfalse}% - \if@tempswz - \directlua{luatexja.jfont.add_ffam_list(\tmp@enc, \tmp@item)}% - \edef\f@family{#1}% - \else - \directlua{luatexja.jfont.add_Nffam_list(\tmp@enc, \tmp@item)}% - \@notffamtrue% - \fi - \fi - \fi - \fi - \if@notkfam\if@notffam - {\ifcsname D@\k@encoding\endcsname\@nameuse{D@\k@encoding}\fi - \xdef\@@temp{\default@family}}\edef\k@family{\@@temp}% - {\ifcsname D@\f@encoding\endcsname\@nameuse{D@\f@encoding}\fi - \xdef\@@temp{\default@family}}\edef\f@family{\@@temp}% - \fi\fi -} - -% We must redefine \try@load@fontshape to ignore kanjifont definitions at all. -\def\try@load@fontshape{% - \expandafter - \ifx\csname \f@encoding+\f@family\endcsname\relax - \directlua{luatexja.jfont.is_kenc('\luatexluaescapestring{\f@encoding}')}% -\ifin@ % Japanese font: we don't search fd. - \@font@warning{We don't search kanjifont definition - \MessageBreak for \f@encoding/\f@family}% -\else % Alphabetic font - \@font@info{Try loading font information for \f@encoding+\f@family}% - \global\expandafter\let - \csname\f@encoding+\f@family\endcsname\@empty - \nfss@catcodes - \let\nfss@catcodes\relax - \edef\reserved@a{% - \lowercase{% - \noexpand\InputIfFileExists{\f@encoding\f@family.fd}}}% - \reserved@a\relax - {\@input@{\f@encoding\f@family.fd}}% -\fi - \fi} - \endinput diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltj-jfmglue.lua b/Master/texmf-dist/tex/luatex/luatexja/ltj-jfmglue.lua index eb0174729e3..9486c322ca6 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/ltj-jfmglue.lua +++ b/Master/texmf-dist/tex/luatex/luatexja/ltj-jfmglue.lua @@ -9,6 +9,7 @@ luatexbase.provides_module({ module('luatexja.jfmglue', package.seeall) local err, warn, info, log = luatexbase .errwarinf(_NAME) +luatexja.load_module('base'); local ltjb = luatexja.base luatexja.load_module('stack'); local ltjs = luatexja.stack luatexja.load_module('jfont'); local ltjf = luatexja.jfont local pairs = pairs @@ -100,11 +101,16 @@ local function fast_find_char_class(c,m) end -- 文字クラスの決定 -local function slow_find_char_class(c, m, oc) - local xc = c or oc - local cls = ltjf_find_char_class(oc, m) - if xc ~= oc and cls==0 then cls = ltjf_find_char_class(-xc, m) end - return cls, xc +local slow_find_char_class +do + slow_find_char_class = function (c, m, oc) + local cls = ltjf_find_char_class(oc, m) + if not c and cls==0 then + return ltjf_find_char_class(-c, m), oc + else + return cls, oc + end + end end local zero_glue = node_new(id_glue) diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltjsarticle.cls b/Master/texmf-dist/tex/luatex/luatexja/ltjsarticle.cls index 62ddad71674..3d31a054427 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} - [2014/03/28 ] + [2014/05/14 ] \RequirePackage{luatexja} \newif\if@restonecol \newif\if@titlepage @@ -363,9 +363,12 @@ \parindent=1\zw \fi \fi - \ltjsetparameter{kanjiskip={0\zw plus .1\zw minus .01\zw}} - \if@slide \ltjsetparameter{xkanjiskip={0.1em}} \else - \ltjsetparameter{xkanjiskip={0.25em plus 0.15em minus 0.06em}} + \ltj@setpar@global + \ltjsetkanjiskip{0pt plus .1\zw minus .01\zw} + \if@slide + \ltjsetxkanjiskip{0.1em} + \else + \ltjsetxkanjiskip{0.25em plus 0.15em minus 0.06em} \fi} \emergencystretch 3\zw \newif\ifnarrowbaselines @@ -1580,7 +1583,8 @@ \renewcommand\kanjifamilydefault{\gtdefault} \renewcommand\familydefault{\sfdefault} \raggedright - \ltjsetparameter{xkanjiskip={0.1em}}\relax + \ltj@setpar@global + \ltjsetxkanjiskip{0.1em}\relax \fi \endinput %% diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltjsbook.cls b/Master/texmf-dist/tex/luatex/luatexja/ltjsbook.cls index 813909f0d6f..4e3e12bf3d3 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} - [2014/03/28 ] + [2014/05/14 ] \RequirePackage{luatexja} \newif\if@restonecol \newif\if@titlepage @@ -370,9 +370,12 @@ \parindent=1\zw \fi \fi - \ltjsetparameter{kanjiskip={0\zw plus .1\zw minus .01\zw}} - \if@slide \ltjsetparameter{xkanjiskip={0.1em}} \else - \ltjsetparameter{xkanjiskip={0.25em plus 0.15em minus 0.06em}} + \ltj@setpar@global + \ltjsetkanjiskip{0pt plus .1\zw minus .01\zw} + \if@slide + \ltjsetxkanjiskip{0.1em} + \else + \ltjsetxkanjiskip{0.25em plus 0.15em minus 0.06em} \fi} \emergencystretch 3\zw \newif\ifnarrowbaselines @@ -1665,7 +1668,8 @@ \renewcommand\kanjifamilydefault{\gtdefault} \renewcommand\familydefault{\sfdefault} \raggedright - \ltjsetparameter{xkanjiskip={0.1em}}\relax + \ltj@setpar@global + \ltjsetxkanjiskip{0.1em}\relax \fi \endinput %% diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltjskiyou.cls b/Master/texmf-dist/tex/luatex/luatexja/ltjskiyou.cls index 145d94ba1b4..1311decaa0a 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} - [2014/03/28 ] + [2014/05/14 ] \RequirePackage{luatexja} \newif\if@restonecol \newif\if@titlepage @@ -365,9 +365,12 @@ \parindent=1\zw \fi \fi - \ltjsetparameter{kanjiskip={0\zw plus .1\zw minus .01\zw}} - \if@slide \ltjsetparameter{xkanjiskip={0.1em}} \else - \ltjsetparameter{xkanjiskip={0.25em plus 0.15em minus 0.06em}} + \ltj@setpar@global + \ltjsetkanjiskip{0pt plus .1\zw minus .01\zw} + \if@slide + \ltjsetxkanjiskip{0.1em} + \else + \ltjsetxkanjiskip{0.25em plus 0.15em minus 0.06em} \fi} \emergencystretch 3\zw \newif\ifnarrowbaselines @@ -1567,7 +1570,8 @@ \renewcommand\kanjifamilydefault{\gtdefault} \renewcommand\familydefault{\sfdefault} \raggedright - \ltjsetparameter{xkanjiskip={0.1em}}\relax + \ltj@setpar@global + \ltjsetxkanjiskip{0.1em}\relax \fi \endinput %% diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltjspf.cls b/Master/texmf-dist/tex/luatex/luatexja/ltjspf.cls index b56a2343531..fab8f0cd061 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} - [2014/03/28 ] + [2014/05/14 ] \RequirePackage{luatexja} \newif\if@restonecol \newif\if@titlepage @@ -363,9 +363,12 @@ \parindent=1\zw \fi \fi - \ltjsetparameter{kanjiskip={0\zw plus .1\zw minus .01\zw}} - \if@slide \ltjsetparameter{xkanjiskip={0.1em}} \else - \ltjsetparameter{xkanjiskip={0.25em plus 0.15em minus 0.06em}} + \ltj@setpar@global + \ltjsetkanjiskip{0pt plus .1\zw minus .01\zw} + \if@slide + \ltjsetxkanjiskip{0.1em} + \else + \ltjsetxkanjiskip{0.25em plus 0.15em minus 0.06em} \fi} \emergencystretch 3\zw \newif\ifnarrowbaselines @@ -1463,7 +1466,8 @@ \renewcommand\kanjifamilydefault{\gtdefault} \renewcommand\familydefault{\sfdefault} \raggedright - \ltjsetparameter{xkanjiskip={0.1em}}\relax + \ltj@setpar@global + \ltjsetxkanjiskip{0.1em}\relax \fi \endinput %% diff --git a/Master/texmf-dist/tex/luatex/luatexja/luatexja-core.sty b/Master/texmf-dist/tex/luatex/luatexja/luatexja-core.sty index d0a4a47fe43..b4fd007f79f 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/luatexja-core.sty +++ b/Master/texmf-dist/tex/luatex/luatexja/luatexja-core.sty @@ -339,16 +339,19 @@ \fi} % [x]]kanjiskip = <dimen> -\define@key[ltj]{japaram}{kanjiskip}{% % SKIP +\define@key[ltj]{japaram}{kanjiskip}{\ltjsetkanjiskip{#1}} +\define@key[ltj]{japaram}{xkanjiskip}{\ltjsetxkanjiskip{#1}} +\protected\def\ltjsetkanjiskip#1{% % SKIP \directlua{% local d = \ltj@safe@glue{#1} luatexja.stack.set_stack_skip(luatexja.stack_table_index.KSK, d); node.free(d) -}} -\define@key[ltj]{japaram}{xkanjiskip}{% % SKIP +}\ignorespaces} +\protected\def\ltjsetxkanjiskip#1{% % SKIP \directlua{% local d = \ltj@safe@glue{#1} luatexja.stack.set_stack_skip(luatexja.stack_table_index.XSK, d); node.free(d) -}} +}\ignorespaces} + % jcharwidowpenalty = <count> \define@key[ltj]{japaram}{jcharwidowpenalty}{% %COUNT @@ -387,11 +390,13 @@ \else\directlua{luatexja.isglobal=''}\fi } \protected\def\ltjsetparameter#1{% - \ltj@setpar@global\setkeys[ltj]{japaram}{#1}\ignorespaces} + \ltj@setpar@global\setkeys[ltj]{japaram}{#1}% + \ignorespaces} \protected\def\ltjglobalsetparameter#1{% \relax\ifnum\globaldefs<0\directlua{luatexja.isglobal=''}% \else\directlua{luatexja.isglobal='global'}\fi% - \setkeys[ltj]{japaram}{#1}\ignorespaces} + \setkeys[ltj]{japaram}{#1}% + \ignorespaces} %%%%%%%% \ltjgetparameter \def\ltj@@decl@array@param#1{% @@ -414,7 +419,8 @@ {\ltj@@getparam@one{#1}}% } \def\ltj@@getparam@one#1{% - \directlua{luatexja.ext_get_parameter_unary('#1')}}% + \directlua{luatexja.ext_get_parameter_unary('#1')}% +}% \def\ltj@@getparam@two#1#2{% \directlua{luatexja.ext_get_parameter_binary('#1', \ltj@safe@num@or{nil}{#2})}% } @@ -496,7 +502,6 @@ {\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/patches/lltjfont.sty b/Master/texmf-dist/tex/luatex/luatexja/patches/lltjfont.sty index 2933844817a..65d86aceced 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/patches/lltjfont.sty +++ b/Master/texmf-dist/tex/luatex/luatexja/patches/lltjfont.sty @@ -1,6 +1,6 @@ % % lltjfont.sty: derived from plfonts.dtx in pLaTeX. -% +% \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{lltjfont}[2014/01/23 Patch to NFSS2 for LuaTeX-ja] @@ -203,7 +203,7 @@ \else %\directlua{luatexja.jfont.is_ktenc('\luatexluaescapestring{#2}')}\ifin@% % \usekanji{#2}{#3}{#4}{#5}% - % \let\font\tfont + % \global\let#1\gettfont %\else \useroman{#2}{#3}{#4}{#5}% \global\expandafter\let\expandafter#1\the\font @@ -213,7 +213,7 @@ } \def\DLMfontsw@standard#1#2#3{#1{#2{#3}}} \def\reDeclareMathAlphabet#1#2#3{% - \ifdefined#2 + \ifdefined#2 \@temptokena\expandafter{#2}% \else \@temptokena{#2}% @@ -256,7 +256,18 @@ } \newif\if@knjcmd \def\userelfont{\@knjcmdtrue} -\DeclareRobustCommand\selectfont{% + + +\RequirePackage{everysel} +\let\ltj@@EverySelectfont@Init=\@EverySelectfont@Init +\expandafter\expandafter\expandafter\let +\expandafter\expandafter\csname ltj@@orig@selectfont\endcsname\csname selectfont\space\endcsname +\@EverySelectfont@Init +\def\@EverySelectfont@Init{% + \expandafter\let\csname selectfont\space \endcsname \ltj@@orig@selectfont + \ltj@@EverySelectfont@Init +} +\def\ltj@selectfont@patch{% \let\tmp@error@fontshape\error@fontshape \let\error@fontshape\error@kfontshape \directlua{luatexja.jfont.is_kyenc('\luatexluaescapestring{\k@encoding}')}\ifin@% @@ -270,41 +281,39 @@ \@latex@error{KANJI Encoding scheme `\k@encoding' unknown}\@eha %\fi \fi +% \let\k@encoding\cy@encoding \xdef\font@name{\csname\curr@kfontshape/\f@size\endcsname}% \pickup@jfont \font@name + \ltj@@does@alt@set{\curr@kfontshape}% + % alt fonts の定義 + \directlua{luatexja.jfont.output_alt_font_cmd('\luatexluaescapestring{\curr@kfontshape}')}% + % 定義した alt fonts のデータを \ltjdeclarealtfont に渡すのと同等の処理をする + \directlua{luatexja.jfont.pickup_alt_font_a('\f@size')}% + \fi +% \edef\tmp@item{{\k@encoding}}\expandafter\def\expandafter\k@encoding\tmp@item \kenc@update \let\error@fontshape\tmp@error@fontshape +% \if@knjcmd \@knjcmdfalse \expandafter\ifx \csname rel@\k@encoding/\k@family/\k@series/\k@shape\endcsname\relax \expandafter\ifx \csname rel@\k@encoding/\k@family/\k@series/all\endcsname\relax \else - \csname rel@\k@encoding/\k@family/\k@series/all\endcsname + \csname rel@\k@encoding/\k@family/\k@series/all\endcsname\selectfont + % 警告: 再び \selectfont を呼んでいる.無限ループの可能性あり \fi \else - \csname rel@\k@encoding/\k@family/\k@series/\k@shape\endcsname + \csname rel@\k@encoding/\k@family/\k@series/\k@shape\endcsname\selectfont + % 警告: 再び \selectfont を呼んでいる.無限ループの可能性あり \fi \fi - \xdef\font@name{\csname\curr@fontshape/\f@size\endcsname}% - \pickup@font - \font@name - \enc@update - \ifx\f@linespread\baselinestretch \else - \set@fontsize\baselinestretch\f@size\f@baselineskip - \fi - \size@update -% ここからは altfont 用 - \ltj@@does@alt@set{\curr@kfontshape}% - % alt fonts の定義 - \directlua{luatexja.jfont.output_alt_font_cmd('\luatexluaescapestring{\curr@kfontshape}')}% - % 定義した alt fonts のデータを \ltjdeclarealtfont に渡すのと同等の処理をする - \directlua{luatexja.jfont.pickup_alt_font_a('\f@size')}% - \fi } +\EverySelectfont{\ltj@selectfont@patch} + \def\KanjiEncodingPair#1#2{\@namedef{t@enc@#1}{#2}\@namedef{y@enc@#2}{#1}} \KanjiEncodingPair{JY3}{JT3} \def\set@fontsize#1#2#3{% @@ -332,7 +341,7 @@ \newbox\adjust@box \newdimen\adjust@dimen \def\adjustbaseline{% - \setbox\adjust@box\hbox{\ltjsetparameter{yjabaselineshift=\z@}あ}% + \setbox\adjust@box\hbox{\ltj@ykblshift=0あ}% \cht\ht\adjust@box \cdp\dp\adjust@box \cwd\wd\adjust@box @@ -340,14 +349,15 @@ \chs\cwd \cHT\cht \advance\cHT\cdp % \iftdir - % \setbox\adjust@box\hbox{\tbaselineshift\z@ M}% + % \setbox0\hbox{\tate\ltjsetparameter{tjabaselineshift=\z@}あ}% + % \setbox\adjust@box\hbox{\tate\ltjsetparameter{talbaselineshift=\z@}M}% % \adjust@dimen\ht\adjust@box % \advance\adjust@dimen\dp\adjust@box - % \advance\adjust@dimen-\cHT + % \advance\adjust@dimen-\ht0 % \divide\adjust@dimen\tw@ - % \advance\adjust@dimen\cdp + % \advance\adjust@dimen0.5\dp0 % \advance\adjust@dimen-\dp\adjust@box - % \tbaselineshift\adjust@dimen + % \ltjsetparameter{talbaselineshift=\adjust@dimen} % \fi } \DeclareRobustCommand\romanencoding[1]{% @@ -630,7 +640,7 @@ \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, + \the\ltj@tempcnta,\the\ltj@tempcntb, '\luatexluaescapestring{\ltj@temp@afont}', '\luatexluaescapestring{\ltj@temp@bfont}')}% } |