X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=src%2Faddons%2Fluatexja-preset.sty;h=fee3f21ea381440b496d3926cef8d39da8559055;hb=241cb739e4344dfe7e8e412cdb25615da9047ccc;hp=ad0a21b886faf4dca1a53ba8c70a7d06c3f14eb5;hpb=41b03ea6a8c8f1254aca62ff30b8abe53786ac7c;p=luatex-ja%2Fluatexja.git diff --git a/src/addons/luatexja-preset.sty b/src/addons/luatexja-preset.sty index ad0a21b..fee3f21 100644 --- a/src/addons/luatexja-preset.sty +++ b/src/addons/luatexja-preset.sty @@ -1,343 +1,613 @@ % luatexja-preset.sty -\ProvidesPackage{luatexja-preset}[2013/05/14 Japanese font presets] -%% Sync with PXchfon 0.6a +\ProvidesPackage{luatexja-preset}[2017/08/23 Japanese font presets] -\RequirePackage{expl3} -\RequirePackage{luatexja-fontspec} +\RequirePackage{expl3,l3keys2e} +\RequirePackage{luatexja} \ExplSyntaxOn -%%%% message +\fp_new:N \g_ltjpreset_scale_fp +\group_begin: +\fontsize{10}{10}\selectfont +\fp_gset:Nn \g_ltjpreset_scale_fp {\zw / 10} +\group_end: -\bool_new:N \l_ltjpreset_bold_bool % bold -\bool_set_false:N \l_ltjpreset_bold_bool -\DeclareOption{bold} {\bool_set_true:N \l_ltjpreset_bold_bool} -\DeclareOption{nobold}{\bool_set_false:N \l_ltjpreset_bold_bool} +%% messages +\msg_new:nnn { luatexja-preset }{ ltj-fontspec }{ + The~ luatexja-fontspec~ package~ is~ loaded~ already.~ + Hence~ we~ ignore~ `nfssonly'~option. +} +\msg_new:nnn { luatexja-preset }{ no-font }{ + Font~ #1~ (#2)~ is~ not~found.~ Hence~ I~ substitute~ #3~ (#4)~ for~ it. +} +\msg_new:nnn { luatexja-preset }{ scale }{ + Japanese~fonts~will~be~scaled~by~#1. +} -\bool_new:N \l_ltjpreset_expert_bool % expert -\bool_set_false:N \l_ltjpreset_expert_bool -\DeclareOption{expert} {\bool_set_true:N \l_ltjpreset_expert_bool} -\DeclareOption{noexpert}{\bool_set_false:N \l_ltjpreset_expert_bool} +\msg_new:nnn { luatexja-preset }{ exist-preset-nooverwrite }{ + The~ preset~ `#1'~ is~ already~ defined.~ + To~ redefine~ this~ preset,~ use~ \str_use:N \c_backslash_str ltjnewpreset*~ instead. +} +\msg_new:nnn { luatexja-preset }{ exist-preset-overwrite }{ + The~ preset~ `#1'~ is~ redefined. +} -\int_new:N \l_ltjpreset_deluxe_int % expert -\int_set:Nn \l_ltjpreset_deluxe_int { 0 } -\DeclareOption{deluxe}{\int_set:Nn \l_ltjpreset_deluxe_int { 2 }} % 7 fonts -\DeclareOption{nodeluxe}{\int_set:Nn \l_ltjpreset_deluxe_int { 0 }} % 2 fonts +\msg_new:nnn { luatexja-preset }{ illegal-preset-name }{ + The~ preset~ `#1'~ cannot~ be~ defined,~ + since~ the~ luatexja-preset~ package~ an~ option~ with~ the~ same~ name. +} -% scale -\msg_new:nnn { luatexja-preset }{ scale }{ - Japanese~fonts~will~be~scaled~by~\fp_use:N \g_ltj_fontspec_scale_fp. +\seq_new:N \g_ltjpreset_presets_seq + +\keys_define:nn { luatexja-preset }{ + unknown .code:n = + \keys_set_known:noN { ltjpreset-presets } { \tl_use:N \l_keys_tl } \l_tmpa_tl + \tl_if_empty:NT \l_tmpa_tl { + \PassOptionsToPackage { \l_tmpa_tl } { luatexja-fontspec } + }, + scale .fp_gset:N = \g_ltjpreset_scale_fp, + match .code: n = + \renewcommand\jttdefault{\gtdefault}\@ltj@match@familytrue + \PassOptionsToPackage { match } { luatexja-fontspec }, + match .value_forbidden:n = true, + __custom .bool_set:N = \g_ltjpreset_custom_bool, __custom .groups:n = { preset }, + __office .bool_set:N = \g_ltjpreset_office_bool, __office .groups:n = { preset }, + __noembed .bool_set:N = \g_ltjpreset_noembed_bool, __noembed .groups:n = { preset }, } -\msg_warning:nn { luatexja-preset }{ scale } +\cs_new:Nn \ltjpreset_declare_option:nn { + \keys_define:nn { luatexja-preset }{ + #1 .code:n = { #2 }, + #1 .value_forbidden:n = true + } +} +\cs_new:Nn \ltjpreset_declare_preset:nn { + \keys_define:nn { luatexja-preset }{ + #1 .meta:n = { #2 }, + #1 .value_forbidden:n = true, #1 .groups:n = { preset }, + } + \seq_put_right:Nn \g_ltjpreset_presets_seq { #1 } +} +\cs_generate_variant:Nn \ltjpreset_declare_preset:nn {nx} +\cs_new:Nn \ltjpreset_declare_bool_option:nn { + \bool_new:c { g_ltjpreset_#1_bool } + \bool_set_false:c { g_ltjpreset_#1_bool } + \keys_define:nn { luatexja-preset }{ + #1 .bool_set:c = { g_ltjpreset_#1_bool }, + #2 .bool_set_inverse:c = { g_ltjpreset_#1_bool }, + #1 .default:n = true, #2 .default:n = true, + } +} + +%%%%%%%% bool options +\bool_new:N \l_ltjpreset_shape_nlck_bool +\ltjpreset_declare_bool_option:nn { nfssonly }{ fontspec } +\ltjpreset_declare_bool_option:nn { bold }{ nobold } +\ltjpreset_declare_bool_option:nn { expert }{ noexpert } +\ltjpreset_declare_bool_option:nn { deluxe }{ nodeluxe } % JFM -\cs_set:Npn \ltjpreset_use_jfm: {ujis} % 使用する JFM -%%% \DeclareOption{min}{\cs_set:Npn \ltjpreset_use_jfm: {min}} % min -%%% ↑jfm-min.lua が横組み・縦組み専用仮名に追いついていないので使用禁止 -\DeclareOption{jis}{\cs_set:Npn \ltjpreset_use_jfm: {jis}} % jis -\DeclareOption{ujis}{\cs_set:Npn \ltjpreset_use_jfm: {ujis}} % ujis +\tl_new:N \ltjpreset_use_jfm_yoko_tl % 使用する JFM(横) +\tl_set:Nn \ltjpreset_use_jfm_yoko_tl {ujis} +\tl_new:N \ltjpreset_use_jfm_tate_tl % 使用する JFM(縦) +\tl_set:Nn \ltjpreset_use_jfm_tate_tl {ujisv} +\ltjpreset_declare_option:nn{jis}{\tl_set:Nn \ltjpreset_use_jfm_yoko_tl {jis}} % jis +\ltjpreset_declare_option:nn{ujis}{\tl_set:Nn \ltjpreset_use_jfm_yoko_tl {ujis}} % ujis % 漢字字形 \tl_new:N \l_ltjpreset_kanji_shape_tl -\DeclareOption{90jis}{ \tl_set:Nn \l_ltjpreset_kanji_shape_tl { , RawFeature = +jp90 }} % 90jis -\DeclareOption{jis2004}{\tl_set:Nn \l_ltjpreset_kanji_shape_tl { , RawFeature = +jp04 }} % jis2004 +\ltjpreset_declare_option:nn{90jis}{ \tl_set:Nn \l_ltjpreset_kanji_shape_tl { , CJKShape=JIS1990 }} % 90jis +\ltjpreset_declare_option:nn{jis2004}{\tl_set:Nn \l_ltjpreset_kanji_shape_tl { , CJKShape=JIS2004 }} % jis2004 % font preset -\bool_new:N \l_ltjpreset_office_bool % MS Office の HG 系フォントを使っているか -\bool_new:N \l_ltjpreset_noembed_bool % 非埋込か -\clist_new:N \l_ltjpreset_font_list - -\cs_new:Npn \ltjpreset_set_uni:nn #1#2 { - \ltjpreset_set_multi:n { #1, #1, #2, #2, #2, #2, #1 } -} -\cs_new:Npn \ltjpreset_set_multi:n #1 { - \clist_set:Nn \l_ltjpreset_font_list { #1 } - \bool_set_false:N \l_ltjpreset_office_bool - \bool_set_false:N \l_ltjpreset_noembed_bool +\prop_new:N \g_ltjpreset_font_prop +\keys_define:nn { luatexja-preset } { + mc .code:n = + \prop_put:Nnn \g_ltjpreset_font_prop { mc-l } {#1} + \prop_put:Nnn \g_ltjpreset_font_prop { mc-m } {#1} + \prop_put:Nnn \g_ltjpreset_font_prop { mc-bx } {#1}, + mc .groups:n = { preset }, mc .value_required:n = true, + gt .code:n = + \prop_put:Nnn \g_ltjpreset_font_prop { gt-u } {#1} + \prop_put:Nnn \g_ltjpreset_font_prop { gt-m } {#1} + \prop_put:Nnn \g_ltjpreset_font_prop { gt-bx } {#1} + \prop_put:Nnn \g_ltjpreset_font_prop { gt-eb } {#1}, + gt .groups:n = { preset }, gt .value_required:n = true, } -\cs_new:Npn \ltjpreset_set_office:nn #1 #2{ - \ltjpreset_set_multi:n { - #1, HGMinchoE , % mc/m, mc/bx - HGGothicM , HGGothicE , % gt/m, gt/bx (multiweight)) - #2 , HGSoeiKakugothicUB , % gt/m (uni), gt/eb - HGMaruGothicMPRO % mg/m - } - \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 +\cs_set:Nn \g_ltjpreset_tmp_cs:n { + \keys_define:nn { luatexja-preset } { + #1 .code:n = \prop_put:Non \g_ltjpreset_font_prop { #1 } { ##1 }, + #1 .groups:n = { preset }, #1 .value_required:n = true, } } -\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 - } +\g_ltjpreset_tmp_cs:n { mc-l } +\g_ltjpreset_tmp_cs:n { mc-m } +\g_ltjpreset_tmp_cs:n { mc-bx } +\g_ltjpreset_tmp_cs:n { gt-u } +\g_ltjpreset_tmp_cs:n { gt-m } +\g_ltjpreset_tmp_cs:n { gt-bx } +\g_ltjpreset_tmp_cs:n { gt-eb} +\g_ltjpreset_tmp_cs:n { mg-m } +\cs_undefine:N \g_ltjpreset_tmp_cs:n + +\cs_new:Nn \ltjpreset_set_uni:nn { + mc = #1, gt = #2, mc-bx = #2, mg-m = #2, + __custom = false, __office = false, __noembed = false, } -\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 - } +\cs_new:Npn \ltjpreset_set_office:nn #1 #2{ + mc = #1, mc-bx = HGMinchoE , + gt-m = HGGothicM , gt-bx = HGGothicE , + gt-u = #2 , gt-eb = HGSoeiKakugothicUB , + mg-m = HGMaruGothicMPRO, + __custom = false, __office = true, __noembed = false, } -% 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 - } +%%%%%%%% プリセット達 + +% カスタム指定 + \keys_define:nn { luatexja-preset }{ + custom .meta:n = { #1, __custom = true, }, + custom .value_required:n = true, + jfm_yoko .tl_set:N = \ltjpreset_use_jfm_yoko_tl, + jfm_tate .tl_set:N = \ltjpreset_use_jfm_tate_tl, } -\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 - } + +% 小塚 (Adobe) +%% Pro +\ltjpreset_declare_preset:nx{kozuka-pro}{ + mc-m = KozMinPro-Regular, mc-bx = KozMinPro-Bold, + gt-m = KozGoPro-Regular, gt-bx = KozGoPro-Bold, + gt-u = KozGoPro-Medium, gt-eb = KozGoPro-Heavy, + mg-m = KozGoPro-Heavy, mc-l = KozMinPro-Light, + __custom = false, __office = false, __noembed = false, +} +%% Pr6 +\ltjpreset_declare_preset:nx{kozuka-pr6}{ + mc-m = KozMinProVI-Regular, mc-bx = KozMinProVI-Bold, + gt-m = KozGoProVI-Regular, gt-bx = KozGoProVI-Bold, + gt-u = KozGoProVI-Medium, gt-eb = KozGoProVI-Heavy, + mg-m = KozGoProVI-Heavy, mc-l = KozMinProVI-Light, + __custom = false, __office = false, __noembed = false, +} +%% Pr6N +\ltjpreset_declare_preset:nx{kozuka-pr6n}{ + mc-m = KozMinPr6N-Regular, mc-bx = KozMinPr6N-Bold, + gt-m = KozGoPr6N-Regular, gt-bx = KozGoPr6N-Bold, + gt-u = KozGoPr6N-Medium, gt-eb = KozGoPr6N-Heavy, + mg-m = KozGoPr6N-Heavy, mc-l = KozMinPr6N-Light, + __custom = false, __office = false, __noembed = false, } -% 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 - } +% ヒラギノ (OSX) +\ltjpreset_declare_preset:nx{hiragino-pro}{ + mc-m = HiraMinPro-W3, mc-bx = HiraMinPro-W6, + gt-m = HiraKakuPro-W3, gt-bx = HiraKakuPro-W6, + gt-u = HiraKakuPro-W6, gt-eb = HiraKakuStd-W8, + mg-m = HiraMaruPro-W4, mc-l = HiraMinPro-W2, + __custom = false, __office = false, __noembed = false, } -\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 - } +\ltjpreset_declare_preset:nx{hiragino-pron}{ + mc-m = HiraMinProN-W3, mc-bx = HiraMinProN-W6, + gt-m = HiraKakuProN-W3, gt-bx = HiraKakuProN-W6, + gt-u = HiraKakuProN-W6, gt-eb = HiraKakuStdN-W8, + mg-m = HiraMaruProN-W4, mc-l = HiraMinProN-W2, + __custom = false, __office = false, __noembed = false, } -\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 }} -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% モリサワ +\ltjpreset_declare_preset:nx{morisawa-pro}{ + mc = A-OTF-RyuminPro-Light.otf, mc-bx = A-OTF-FutoMinA101Pro-Bold.otf, + gt-m = A-OTF-GothicBBBPro-Medium.otf , gt-bx = A-OTF-FutoGoB101Pro-Bold.otf, + gt-u = A-OTF-GothicBBBPro-Medium.otf , gt-eb = A-OTF-MidashiGoPro-MB31.otf, + mg-m = A-OTF-Jun101Pro-Light.otf, + __custom = false, __office = false, __noembed = false, +} +\ltjpreset_declare_preset:nx{morisawa-pr6n}{ + mc = A-OTF-RyuminPr6N-Light.otf, mc-bx = A-OTF-FutoMinA101Pr6N-Bold.otf, + gt-m = A-OTF-GothicBBBPr6N-Medium.otf , gt-bx = A-OTF-FutoGoB101Pr6N-Bold.otf, + gt-u = A-OTF-GothicBBBPr6N-Medium.otf , gt-eb = A-OTF-MidashiGoPr6N-MB31.otf, + mg-m = A-OTF-Jun101Pr6N-Light.otf, + __custom = false, __office = false, __noembed = false, +} +% 游明朝/游ゴシック (Win8.1) +\ltjpreset_declare_preset:nx{yu-win}{ + mc-m = YuMincho-Regular, mc-bx = YuMincho-Demibold, + gt-m = YuGothic-Regular, gt-bx = YuGothic-Bold, + gt-u = YuGothic-Regular, gt-eb = YuGothic-Bold, + mg-m = YuGothic-Bold, mc-l = YuMincho-Light, + __custom = false, __office = false, __noembed = false, +} +% Win10 +\ltjpreset_declare_preset:nx{yu-win10}{ + mc-m = YuMincho-Regular, mc-bx = YuMincho-Demibold, + gt-m = YuGothic-Regular, gt-bx = YuGothic-Bold, + gt-u = YuGothic-Medium, gt-eb = YuGothic-Bold, + mg-m = YuGothic-Bold, mc-l = YuMincho-Light, + __custom = false, __office = false, __noembed = false, +} +% Yu fonts in OSX +% according to http://support.apple.com/kb/HT5944 +\ltjpreset_declare_preset:nx{yu-osx}{ + mc = YuMincho~Medium, mc-bx = YuMincho~Demibold, + gt-m = YuGothic~Medium, gt-u = YuGothic~Medium, + gt-bx = YuGothic~Bold, gt-eb = YuGothic~Bold, + mg-m = YuGothic~Bold, + __custom = false, __office = false, __noembed = false, +} -% kozuka -\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 - } +% moga-mobo +\ltjpreset_declare_preset:nx{moga-mobo}{ + mc = Moga90Mincho, mc-bx = Moga90Mincho~Bold, + gt-m = Moga90Gothic, gt-bx = Moga90Gothic~Bold, + gt-u = Moga90Gothic, gt-eb = Moga90Gothic~Bold, + mg-m = Mobo90Gothic, + __custom = false, __office = false, __noembed = false, } -\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 - } +\ltjpreset_declare_preset:nx{moga-mobo-ex}{ + mc = MogaEx90Mincho, mc-bx = MogaEx90Mincho~Bold, + gt-m = MogaEx90Gothic, gt-bx = MogaEx90Gothic~Bold, + gt-u = MogaEx90Gothic, gt-eb = MogaEx90Gothic~Bold, + mg-m = MoboEx90Gothic, + __custom = false, __office = false, __noembed = false, } -\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 - } + +% Ume fones +\ltjpreset_declare_preset:nx{ume}{ + mc = Ume~Mincho, + gt-m = Ume~Gothic, gt-bx = Ume~Gothic~O5, + gt-u = Ume~Gothic~O5, gt-eb = Ume~Gothic~O5, + mg-m = Ume~Gothic~O4, + __custom = false, __office = false, __noembed = false, } -% hiragino -\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 - } +% Source Han {Serif,Sans} +\ltjpreset_declare_preset:nx{sourcehan}{ + mc-m = Source~Han~Serif~Regular, + mc-bx = Source~Han~Serif~Bold, + gt-m = Source~Han~Sans~Regular, + gt-bx = Source~Han~Sans~Bold, + gt-u = Source~Han~Sans~Medium, + gt-eb = Source~Han~Sans~Heavy, + mg-m = Source~Han~Sans~Heavy, + mc-l = Source~Han~Serif~Light, + __custom = false, __office = false, __noembed = false, } -\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 - } +\ltjpreset_declare_preset:nx{sourcehan-jp}{ + mc-m = Source~Han~Serif~JP~Regular, + mc-bx = Source~Han~Serif~JP~Bold, + gt-m = Source~Han~Sans~JP~Regular, + gt-bx = Source~Han~Sans~JP~Bold, + gt-u = Source~Han~Sans~JP~Medium, + gt-eb = Source~Han~Sans~JP~Heavy, + mg-m = Source~Han~Sans~JP~Heavy, + mc-l = Source~Han~Serif~JP~Light, + __custom = false, __office = false, __noembed = false, } - -% morisawa -\DeclareOption{morisawa-pro}{ - \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 - } +\ltjpreset_declare_preset:nx{noto-otc}{ + mc-m = Noto~Serif~CJK~Regular, + mc-bx = Noto~Serif~CJK~Bold, + gt-m = Noto~Sans~CJK~Regular, + gt-bx = Noto~Sans~CJK~Bold, + gt-u = Noto~Sans~CJK~Medium, + gt-eb = Noto~Sans~CJK~Black, + mg-m = Noto~Sans~CJK~Black, + mc-l = Noto~Serif~CJK~Light, + __custom = false, __office = false, __noembed = false, } -\DeclareOption{morisawa-pr6n}{ - \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 - } +\ltjpreset_declare_preset:nx{noto-otf}{ + mc-m = Noto~Serif~CJK~JP~Regular, + mc-bx = Noto~Serif~CJK~JP~Bold, + gt-m = Noto~Sans~CJK~JP~Regular, + gt-bx = Noto~Sans~CJK~JP~Bold, + gt-u = Noto~Sans~CJK~JP~Medium, + gt-eb = Noto~Sans~CJK~JP~Black, + mg-m = Noto~Sans~CJK~JP~Black, + mc-l = Noto~Serif~CJK~JP~Light, + __custom = false, __office = false, __noembed = false, } % ipa, ipaex, ms -\DeclareOption{ipa}{ +\ltjpreset_declare_preset:nx{ipa}{ \ltjpreset_set_uni:nn { IPAMincho } { IPAGothic } } -\DeclareOption{ipaex}{ +\ltjpreset_declare_preset:nx{ipaex}{ \ltjpreset_set_uni:nn { IPAExMincho } { IPAExGothic } } -\DeclareOption{ms}{ +\ltjpreset_declare_preset:nx{ms}{ \ltjpreset_set_uni:nn { MS-Mincho } { MS-Gothic } } % {ipa,ipaex,ms}-dx % Office 付属フォントを利用 -\DeclareOption{ipaex-hg}{ +\ltjpreset_declare_preset:nx{ipaex-hg}{ \ltjpreset_set_office:nn { IPAExMincho } { IPAExGothic } } -\DeclareOption{ipa-hg}{ +\ltjpreset_declare_preset:nx{ipa-hg}{ \ltjpreset_set_office:nn { IPAMincho } { IPAGothic } } -\DeclareOption{ms-hg}{ +\ltjpreset_declare_preset:nx{ms-hg}{ \ltjpreset_set_office:nn { MS-Mincho } { MS-Gothic } } % 非埋込 -\DeclareOption{noembed}{ - \ltjpreset_set_uni:nn { Ryumin-Light } { GothicBBB-Medium } - \bool_set_true:N \l_ltjpreset_noembed_bool +\ltjpreset_declare_preset:nx{noembed}{ + \ltjpreset_set_uni:nn { Ryumin-Light } { GothicBBB-Medium }, + __custom = false, __office = false, __noembed = true, } -\ExecuteOptions{noembed} -\ProcessOptions* - -%% KozMinPr6N の場合はjp04 feature がないので,nlck にする -\clist_if_in:NnT \l_ltjpreset_font_list { KozMinPr6N-Regular.otf } { - \tl_set:Nn \l_tmpa_tl {, RawFeature = +jp04} - \tl_if_eq:NNT \l_ltjpreset_kanji_shape_tl \l_tmpa_tl { - \tl_set:Nn \l_ltjpreset_kanji_shape_tl { , RawFeature = +nlck } - } -} +\keys_set:nn {luatexja-preset} { ipaex } +\ProcessKeysOptions { luatexja-preset } +\@ifpackageloaded{luatexja-fontspec}{ + \bool_if:NT \g_ltjpreset_nfssonly_bool + { \msg_warning:nn { luatexja-preset }{ ltj-fontspec } } + \bool_set_false:N \g_ltjpreset_nfssonly_bool +}{} %%%%%%%% main routine -%%%% リストからの展開 -% mc/m -\clist_pop:NN \l_ltjpreset_font_list \l_tmpa_tl -\cs_set:Nx \ltjpreset_font_mc_m: { \tl_use:N \l_tmpa_tl } - -% mc/bx -\clist_pop:NN \l_ltjpreset_font_list \l_tmpa_tl -\cs_set:Nx \ltjpreset_font_mc_bx: { \tl_use:N \l_tmpa_tl } - -% gt/m -\clist_pop:NN \l_ltjpreset_font_list \l_tmpa_tl -\cs_set:Nx \ltjpreset_font_gt_m: { \tl_use:N \l_tmpa_tl } - -% gt/bx -\clist_pop:NN \l_ltjpreset_font_list \l_tmpa_tl -\cs_set:Nx \ltjpreset_font_gt_bx: { \tl_use:N \l_tmpa_tl } - -% gt/m-uni -\clist_pop:NN \l_ltjpreset_font_list \l_tmpa_tl -\cs_set:Nx \ltjpreset_font_gt_n_uni: { \tl_use:N \l_tmpa_tl } - -% gt/eb -\clist_pop:NN \l_ltjpreset_font_list \l_tmpa_tl -\cs_set:Nx \ltjpreset_font_gt_eb: { \tl_use:N \l_tmpa_tl } - -% mg/m -\clist_pop:NN \l_ltjpreset_font_list \l_tmpa_tl -\cs_set:Nx \ltjpreset_font_mg: { \tl_use:N \l_tmpa_tl } - -%% HG 系フォント + JIS2004/90JIS のときはフォント名を置換 -\bool_if:NT \l_ltjpreset_office_bool { - \tl_set:Nn \l_tmpa_tl {, RawFeature = +jp04} - \tl_if_eq:NNT \l_ltjpreset_kanji_shape_tl \l_tmpa_tl { - \cs_set:Nx \ltjpreset_font_mc_bx: { hgrme04.ttc } - \cs_set:Nx \ltjpreset_font_gt_bx: { hgrge04.ttc } - \cs_set:Nx \ltjpreset_font_gt_eb: { hgrsgu04.ttc } - \cs_set:Nx \ltjpreset_font_mg: { hgrsmp04.ttf } - \cs_set_eq:NN \ltjpreset_font_gt_m: \ltjpreset_font_gt_n_uni: - % HG ゴシックM のときはそうはいかないので 1 ウェイト時のゴシック体を使う +\cs_new:Nn \ltjpreset_extract_fonts: { + %% KozMinPr6N, HiraMinProN-W3 の場合はjp04 feature がないので,nlck にする + %% MogaMincho の場合は 90 をつける/はずす + \bool_if:NF \g_ltjpreset_custom_bool { + \tl_set:Nn \l_tmpa_tl {, CJKShape=JIS2004 } + \tl_if_eq:NNT \l_ltjpreset_kanji_shape_tl \l_tmpa_tl { + \tl_set:Nx \l_tmpb_tl { \prop_item:Nn \g_ltjpreset_font_prop { mc-m } } + \tl_if_in:NnT \l_tmpb_tl { KozMinPr6N-Regular } + { \bool_set_true:N \l_ltjpreset_shape_nlck_bool } + \tl_if_in:NnT \l_tmpb_tl { HiraMinProN-W3 } + { \bool_set_true:N \l_ltjpreset_shape_nlck_bool } + \tl_if_in:NnT \l_tmpb_tl { Moga90Mincho } { + \prop_clear:N \l_tmpa_prop + \prop_map_inline:Nn \g_ltjpreset_font_prop { + \tl_set:Nn \l_tmpb_tl { ##2 } \tl_remove_all:Nn \l_tmpb_tl {90} + \prop_put:Nnx \l_tmpa_prop { ##1 } { \tl_use:N \l_tmpb_tl } + } + \prop_set_eq:NN \g_ltjpreset_font_prop \l_tmpa_prop + } + \tl_if_in:NnT \l_tmpb_tl { MogaEx90Mincho } { + \prop_clear:N \l_tmpa_prop + \prop_map_inline:Nn \g_ltjpreset_font_prop { + \tl_set:Nn \l_tmpb_tl { ##2 } \tl_remove_all:Nn \l_tmpb_tl {90} + \prop_put:Nnx \l_tmpa_prop { ##1 } { \tl_use:N \l_tmpb_tl } + } + \prop_set_eq:NN \g_ltjpreset_font_prop \l_tmpa_prop + } + } + } + %%%% リストからの展開 + \cs_set:Nx \ltjpreset_font_mc_l: { \prop_item:Nn \g_ltjpreset_font_prop { mc-l } } + \cs_set:Nx \ltjpreset_font_mc_m: { \prop_item:Nn \g_ltjpreset_font_prop { mc-m } } + \cs_set:Nx \ltjpreset_font_mc_bx: { \prop_item:Nn \g_ltjpreset_font_prop { mc-bx } } + \cs_set:Nx \ltjpreset_font_gt_m: { \prop_item:Nn \g_ltjpreset_font_prop { gt-m } } + \cs_set:Nx \ltjpreset_font_gt_u: { \prop_item:Nn \g_ltjpreset_font_prop { gt-u } } + \cs_set:Nx \ltjpreset_font_gt_bx: { \prop_item:Nn \g_ltjpreset_font_prop { gt-bx } } + \cs_set:Nx \ltjpreset_font_gt_eb: { \prop_item:Nn \g_ltjpreset_font_prop { gt-eb } } + \cs_set:Nx \ltjpreset_font_mg_m: { \prop_item:Nn \g_ltjpreset_font_prop { mg-m } } + %% HG 系フォント + JIS2004/90JIS のときはフォント名を置換 + \bool_if:nT { !\g_ltjpreset_custom_bool && \g_ltjpreset_office_bool } { + \tl_set:Nn \l_tmpa_tl {, CJKShape=JIS2004 } + \tl_if_eq:NNT \l_ltjpreset_kanji_shape_tl \l_tmpa_tl { + \cs_set:Nx \ltjpreset_font_mc_bx: { hgrme04.ttc } + \cs_set:Nx \ltjpreset_font_gt_bx: { hgrge04.ttc } + \cs_set:Nx \ltjpreset_font_gt_eb: { hgrsgu04.ttc } + \cs_set:Nx \ltjpreset_font_mg_m: { hgrsmp04.ttf } + \cs_set_eq:NN \ltjpreset_font_gt_m: \ltjpreset_font_gt_u: + % HG ゴシックM のときはそうはいかないので 1 ウェイト時のゴシック体を使う + } + \tl_set:Nn \l_tmpa_tl {, CJKShape=JIS1990 } + \tl_if_eq:NNT \l_ltjpreset_kanji_shape_tl \l_tmpa_tl { + \cs_set:Nx \ltjpreset_font_mc_bx: { hgrme.ttc } + \cs_set:Nx \ltjpreset_font_gt_bx: { hgrge.ttc } + \cs_set:Nx \ltjpreset_font_gt_eb: { hgrsgu.ttc } + \cs_set:Nx \ltjpreset_font_mg_m: { hgrsmp.ttf } + } + } + % mc/l + \tl_set:Nx \l_tmpa_tl { \ltjpreset_font_mc_l: } + \tl_if_empty:NT \l_tmpa_tl {\tl_set:Nn \l_tmpa_tl {~}} + \cs_set:Nx \ltjpreset_font_mc_l: { + \tl_if_blank:nTF \l_tmpa_tl { \ltjpreset_font_mc_m: } {\tl_use:N \l_tmpa_tl } } - \tl_set:Nn \l_tmpa_tl {, RawFeature = +jp90} - \tl_if_eq:NNT \l_ltjpreset_kanji_shape_tl \l_tmpa_tl { - \cs_set:Nx \ltjpreset_font_mc_bx: { hgrme.ttc } - \cs_set:Nx \ltjpreset_font_gt_bx: { hgrge.ttc } - \cs_set:Nx \ltjpreset_font_gt_eb: { hgrsgu.ttc } - \cs_set:Nx \ltjpreset_font_mg: { hgrsmp.ttf } + %% bold オプションの処理 + \bool_if:NTF \g_ltjpreset_deluxe_bool { + \bool_if:NT \g_ltjpreset_bold_bool { + \cs_set_eq:NN \ltjpreset_font_mc_bx: \ltjpreset_font_gt_bx: + } + }{ + \bool_if:NTF \g_ltjpreset_bold_bool + { \cs_set_eq:NN \ltjpreset_font_gt_m: \ltjpreset_font_gt_bx: } + { \cs_set_eq:NN \ltjpreset_font_gt_m: \ltjpreset_font_gt_u: } + \cs_set_eq:NN \ltjpreset_font_gt_bx: \ltjpreset_font_gt_m: + \cs_set_eq:NN \ltjpreset_font_mc_bx: \ltjpreset_font_gt_m: } } -%%%% expert 用設定 -\tl_new:N \l_ltjpreset_add_features_tl - -\tl_set:Nx \l_ltjpreset_add_features_tl { - \tl_use:N \l_ltjpreset_kanji_shape_tl, - JFM = \ltjpreset_use_jfm: +%%%%%%%% 存在判定 +\cs_new:Nn \ltjpreset_substitute:nnnn { + \group_begin: + \suppressfontnotfounderror=1 + \font \g_ltjpreset_font_test: = "\cs:w ltjpreset_font_#1_#2: \cs_end:"\relax + \ifx \g_ltjpreset_font_test: \nullfont + \msg_warning:nnxxxx { luatexja-preset }{ no-font } + { \cs:w ltjpreset_font_#1_#2: \cs_end: }{ #1/#2 } + { \cs:w ltjpreset_font_#3_#4: \cs_end: }{ #3/#4 } + \cs_gset_eq:cc { ltjpreset_font_#1_#2: } { ltjpreset_font_#3_#4: } + \fi + \group_end: } -\bool_if:NT \l_ltjpreset_expert_bool { - \cs_set:Npn \rubyfamily { \addfontfeatures { Style = Ruby} } - \tl_put_left:Nn \l_ltjpreset_add_features_tl { Style = HorizontalKana, } +%%%%%%%% deluxe (\mgfamily はあとで定義) +\bool_if:NTF \g_ltjpreset_deluxe_bool { + \cs_new:Nn \ltjpreset_check_deluxe_existence: { + \ltjpreset_substitute:nnnn { gt } { eb } { gt } { bx } + \ltjpreset_substitute:nnnn { mg } { m } { gt } { bx } + \ltjpreset_substitute:nnnn { mc } { l } { mc } { m } + } + \def\ltdefault{l} + \DeclareRobustCommand\ltseries { \not@math@alphabet\ltseries\relax\fontseries\ltdefault\selectfont } + \def\ebdefault{eb} + \DeclareRobustCommand\ebseries { \not@math@alphabet\ebseries\relax\fontseries\ebdefault\selectfont } + \DeclareRobustCommand\gtebfamily { \gtfamily\fontseries{\ebdefault}\selectfont } +} { + \cs_set_eq:NN \ltjpreset_check_deluxe_existence: \prg_do_nothing: } -%%%% (丸)ゴシック体の設定: bold option もここで -\int_compare:nTF { \l_ltjpreset_deluxe_int == 2 } { - \newjfontfamily \mgfamily [ - \tl_use:N \l_ltjpreset_add_features_tl - \bool_if:NT \l_ltjpreset_noembed_bool { , NoEmbed } - ] { \ltjpreset_font_mg: } - \newjfontfamily \gtebfamily [ - \tl_use:N \l_ltjpreset_add_features_tl - \bool_if:NT \l_ltjpreset_noembed_bool { , NoEmbed } - ] { \ltjpreset_font_gt_eb: } - \bool_if:NT \l_ltjpreset_bold_bool { - \cs_set_eq:NN \ltjpreset_font_mc_bx: \ltjpreset_font_gt_bx: +\bool_if:NTF \g_ltjpreset_nfssonly_bool { +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%% nfss only + \msg_warning:nnx { luatexja-preset }{ scale }{ \fp_use:N \g_ltjpreset_scale_fp } + + \cs_new:Nn \ltj_preset_declare_font_shape:nnnnnn { + \cs_if_exist:cT { #1/#2/#3/#4/10 } { \cs_undefine:c { #1/#2/#3/#4/10 } } + \DeclareFontShape{#1}{#2}{#3}{#4}{ <-> s*[\fp_use:N \g_ltjpreset_scale_fp] + { \bool_if:NT \g_ltjpreset_noembed_bool {psft:} #5 + ;-kern \tl_use:N \l_ltjpreset_kanji_shape_tl; #6 } } {} } -}{ - \bool_if:NTF \l_ltjpreset_bold_bool { - \cs_set_eq:NN \ltjpreset_font_gt_m: \ltjpreset_font_gt_bx: - }{ - \cs_set_eq:NN \ltjpreset_font_gt_m: \ltjpreset_font_gt_n_uni: + \cs_new:Nn \ltj_preset_define_family:nnn { + \ltj_preset_declare_font_shape:nnnnnn { JY3 } { #1 } { #2 } { n } + { "#3" : jfm=\tl_use:N \ltjpreset_use_jfm_yoko_tl } + { script=hani \bool_if:NT \g_ltjpreset_expert_bool { ;+hkna } } + \ltj_preset_declare_font_shape:nnnnnn { JT3 } { #1 } { #2 } { n } + { "#3" : jfm=\tl_use:N \ltjpreset_use_jfm_tate_tl } + { script=hani \bool_if:NT \g_ltjpreset_expert_bool { ;+vkna } } + \bool_if:NT \g_ltjpreset_expert_bool { + \ltj_preset_declare_font_shape:nnnnnn { JY3 } { #1 } { #2 } { rb } + { "#3" : jfm=\tl_use:N \ltjpreset_use_jfm_yoko_tl } { script=kana; +ruby } + \ltj_preset_declare_font_shape:nnnnnn { JT3 } { #1 } { #2 } { rb } + { "#3" : jfm=\tl_use:N \ltjpreset_use_jfm_tate_tl } { script=kana; +ruby } + } + } + + \DeclareKanjiFamily{JY3}{ltjpm}{}\DeclareKanjiFamily{JT3}{ltjpm}{} + \DeclareKanjiFamily{JY3}{ltjpg}{}\DeclareKanjiFamily{JT3}{ltjpg}{} + \def\mcdefault{ltjpm}\def\gtdefault{ltjpg} + \SetSymbolFont{mincho}{normal}{JY3}{ltjpm}{m}{n} + \SetSymbolFont{mincho}{bold}{JY3}{ltjpm}{bx}{n} + \DeclareMathAlphabet{\mathgt}{JY3}{ltjpg}{m}{n} + \bool_if:NT \g_ltjpreset_expert_bool { + \DeclareRobustCommand\rubyfamily { \kanjishape{rb}\selectfont } + } + + \bool_if:NT \g_ltjpreset_deluxe_bool { + \DeclareKanjiFamily{JY3}{ltjpmg}{}\DeclareKanjiFamily{JT3}{ltjpmg}{} + \DeclareRobustCommand\mgfamily { + \not@math@alphabet\mgfamily\relax\kanjifamily{ltjpmg}\selectfont + } + \DeclareTextFontCommand{\textmg}{\mgfamily} + } + % + \cs_new:Nn \ltjpreset_do_fontset: { \group_begin: + \tl_set:Nn \l_tmpa_tl {, CJKShape=JIS1990 } + \tl_if_eq:NNT \l_ltjpreset_kanji_shape_tl \l_tmpa_tl { + \tl_set:Nn \l_ltjpreset_kanji_shape_tl { ;+jp90 } + } + \tl_set:Nn \l_tmpa_tl {, CJKShape=JIS2004 } + \tl_if_eq:NNT \l_ltjpreset_kanji_shape_tl \l_tmpa_tl { + \tl_set:Nx \l_ltjpreset_kanji_shape_tl { + \bool_if:NTF \l_ltjpreset_shape_nlck_bool { ;+nlck } { ;+jp04 } + } + } + \ltj_preset_define_family:nnn {ltjpm} {m} {\ltjpreset_font_mc_m:} + \ltj_preset_define_family:nnn {ltjpm} {bx} {\ltjpreset_font_mc_bx:} + \ltj_preset_define_family:nnn {ltjpg} {m} {\ltjpreset_font_gt_m:} + \ltj_preset_define_family:nnn {ltjpg} {bx} {\ltjpreset_font_gt_bx:} + \normalfont + \bool_if:NT \g_ltjpreset_deluxe_bool { + \ltj_preset_define_family:nnn {ltjpm} {l} {\ltjpreset_font_mc_l:} + \ltj_preset_define_family:nnn {ltjpg} {eb} {\ltjpreset_font_gt_eb:} + \ltj_preset_define_family:nnn {ltjpmg} {m} {\ltjpreset_font_mg_m:} + } + \group_end: + } +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%% fontspec +} { + \PassOptionsToPackage { scale = \fp_use:N \g_ltjpreset_scale_fp } { luatexja-fontspec } + \RequirePackage{luatexja-fontspec} + % scale + \msg_warning:nnx { luatexja-preset }{ scale }{ \fp_use:N \g_ltj_fontspec_scale_fp } + \tl_new:N \l_ltjpreset_add_features_tl + + \bool_if:NT \g_ltjpreset_expert_bool { + \cs_set:Npn \rubyfamily { \addjfontfeatures { + Style=Ruby , YokoFeatures={RawFeature=-hkna} , TateFeatures={RawFeature=-vkna} + } } + } + \addjfontfeature{ Kerning=Off } + % 実際の fontspec の呼びだし + \cs_new:Nn \ltjpreset_do_fontset: { \group_begin: + \tl_set:Nn \l_tmpa_tl {, CJKShape=JIS2004 } + \tl_if_eq:NNT \l_ltjpreset_kanji_shape_tl \l_tmpa_tl { + \bool_if:NT \l_ltjpreset_shape_nlck_bool + { \tl_set:Nn \l_ltjpreset_kanji_shape_tl { , CJKShape=NLC } } + } + \tl_gset:Nx \l_ltjpreset_add_features_tl { + \tl_use:N \l_ltjpreset_kanji_shape_tl, + YokoFeatures = { JFM = \tl_use:N \ltjpreset_use_jfm_yoko_tl }, + TateFeatures = { JFM = \tl_use:N \ltjpreset_use_jfm_tate_tl }, + Script=CJK, \bool_if:NT \g_ltjpreset_noembed_bool { , NoEmbed } + } + \group_end: + \bool_if:NT \g_ltjpreset_expert_bool { + \tl_put_left:Nn \l_ltjpreset_add_features_tl { + , YokoFeatures = {Style = HorizontalKana}, TateFeatures = {Style = VerticalKana} + } + } + \setmainjfont [ + \bool_if:NT \g_ltjpreset_deluxe_bool { FontFace={l}{n}{\ltjpreset_font_mc_l:}, } + BoldFont = \ltjpreset_font_mc_bx: \tl_use:N \l_ltjpreset_add_features_tl + ] { \ltjpreset_font_mc_m: } + \setsansjfont [ + \bool_if:NT \g_ltjpreset_deluxe_bool { FontFace={eb}{n}{\ltjpreset_font_gt_eb:}, } + BoldFont = \ltjpreset_font_gt_bx: \tl_use:N \l_ltjpreset_add_features_tl + ] { \ltjpreset_font_gt_m: } + \bool_if:NT \g_ltjpreset_deluxe_bool { + %% mg + \newjfontfamily \mgfamily [ + BoldFont = \ltjpreset_font_mg_m: \tl_use:N \l_ltjpreset_add_features_tl + ] { \ltjpreset_font_mg_m: } + \DeclareTextFontCommand{\textmg}{\mgfamily} + } } - \cs_set_eq:NN \ltjpreset_font_gt_bx: \ltjpreset_font_gt_m: - \cs_set_eq:NN \ltjpreset_font_mc_bx: \ltjpreset_font_gt_m: +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% } +\def\ltjnewpreset{ + \@ifstar{\ltjpreset_new_preset:nnn{ true }}{\ltjpreset_new_preset:nnn{ false }}} +\cs_set:Nn \ltjpreset_new_preset:nnn { + \keys_if_exist:nnTF { luatexja-preset } { #2 } { + \seq_if_in:NnTF \g_ltjpreset_presets_seq { #2 } { + \bool_if:cTF { c_ #1 _bool } { + \msg_warning:nnn { luatexja-preset }{ exist-preset-overwrite } { #2 } + } { + \msg_error:nnn { luatexja-preset }{ exist-preset-nooverwrite } { #2 } + } + } { + \msg_error:nnn { luatexja-preset }{ illegal-preset-name } { #2 } + } + } { + \keys_define:nn { luatexja-preset } { + #2 .meta:n = { #3, __custom = true, __noembed = false, __office = false, }, + #2 .value_forbidden:n = true, #2 .groups:n = { preset }, + } + \seq_put_right:Nn \g_ltjpreset_presets_seq { #2 } + } +} -%%%% 実際の fontspec の呼びだし +\cs_set:Npn \ltjapplypreset #1 { + \keys_set_groups:nnn { luatexja-preset } { preset } { #1 } + \ltjpreset_extract_fonts: + \ltjpreset_check_deluxe_existence: + \ltjpreset_do_fontset: + \normalfont +} -\defaultjfontfeatures{ Kerning=Off, \tl_use:N \l_ltjpreset_add_features_tl } +\ltjapplypreset {} -\setmainjfont [ - BoldFont = \ltjpreset_font_mc_bx: - \bool_if:NT \l_ltjpreset_noembed_bool { , NoEmbed } -] { \ltjpreset_font_mc_m: } -\setsansjfont [ - BoldFont = \ltjpreset_font_gt_bx: - \bool_if:NT \l_ltjpreset_noembed_bool { , NoEmbed } -] { \ltjpreset_font_gt_m: } +\@onlypreamble\ltjnewpreset +\@onlypreamble\ltjapplypreset \ExplSyntaxOff -\endinput \ No newline at end of file + +\endinput