% luatexja-preset.sty
-\ProvidesPackage{luatexja-preset}[2017/08/17 Japanese font presets]
+\ProvidesPackage{luatexja-preset}[2017/12/15 Japanese font presets]
\RequirePackage{expl3,l3keys2e}
\RequirePackage{luatexja}
\ExplSyntaxOn
-\fp_new:N \g_ltjpreset_scale_fp
-\group_begin:
-\fontsize{10}{10}\selectfont
-\fp_gset:Nn \g_ltjpreset_scale_fp {\zw / 10}
-\group_end:
-
%% messages
\msg_new:nnn { luatexja-preset }{ ltj-fontspec }{
The~ luatexja-fontspec~ package~ is~ loaded~ already.~
\tl_if_empty:NT \l_tmpa_tl {
\PassOptionsToPackage { \l_tmpa_tl } { luatexja-fontspec }
},
- scale .fp_gset:N = \g_ltjpreset_scale_fp,
+ scale .code:n = \gdef\Cjascale{#1},
match .code: n =
\renewcommand\jttdefault{\gtdefault}\@ltj@match@familytrue
\PassOptionsToPackage { match } { luatexja-fontspec },
}
%%%%%%%% 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 }
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
+ mg-m = YuGothic-Bold, mc-l = YuMincho-Light,
__custom = false, __office = false, __noembed = false,
}
% 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
+ mg-m = YuGothic-Bold, mc-l = YuMincho-Light,
__custom = false, __office = false, __noembed = false,
}
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
+ mg-m = YuGothic~Bold,
__custom = false, __office = false, __noembed = false,
}
mc = Moga90Mincho, mc-bx = Moga90Mincho~Bold,
gt-m = Moga90Gothic, gt-bx = Moga90Gothic~Bold,
gt-u = Moga90Gothic, gt-eb = Moga90Gothic~Bold,
- mg-m = Mobo90Gothic
+ mg-m = Mobo90Gothic,
__custom = false, __office = false, __noembed = false,
}
\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
+ mg-m = MoboEx90Gothic,
__custom = false, __office = false, __noembed = false,
}
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
+ mg-m = Ume~Gothic~O4,
__custom = false, __office = false, __noembed = false,
}
%%%%%%%% main routine
\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 {
\bool_if:NTF \g_ltjpreset_nfssonly_bool {
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%% nfss only
- \msg_warning:nnx { luatexja-preset }{ scale }{ \fp_use:N \g_ltjpreset_scale_fp }
+ \msg_warning:nnx { luatexja-preset }{ scale }{ \Cjascale }
\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]
+ \DeclareFontShape{#1}{#2}{#3}{#4}{ <-> s*[\Cjascale]
{ \bool_if:NT \g_ltjpreset_noembed_bool {psft:} #5
;-kern \tl_use:N \l_ltjpreset_kanji_shape_tl; #6 } } {}
}
}
\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 }
- }
+ \tl_set:Nx \l_ltjpreset_kanji_shape_tl { ;+jp04 }
}
\ltj_preset_define_family:nnn {ltjpm} {m} {\ltjpreset_font_mc_m:}
\ltj_preset_define_family:nnn {ltjpm} {bx} {\ltjpreset_font_mc_bx:}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%% 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 }
+ \msg_warning:nnx { luatexja-preset }{ scale }{ \Cjascale }
\tl_new:N \l_ltjpreset_add_features_tl
\bool_if:NT \g_ltjpreset_expert_bool {
\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 },
} {
\keys_define:nn { luatexja-preset } {
#2 .meta:n = { #3, __custom = true, __noembed = false, __office = false, },
- #3 .value_forbidden:n = true, #1 .groups:n = { preset },
+ #2 .value_forbidden:n = true, #2 .groups:n = { preset },
}
\seq_put_right:Nn \g_ltjpreset_presets_seq { #2 }
}
\ltjpreset_extract_fonts:
\ltjpreset_check_deluxe_existence:
\ltjpreset_do_fontset:
+ \normalfont
}
\ltjapplypreset {}
+\@onlypreamble\ltjnewpreset
+\@onlypreamble\ltjapplypreset
+
\ExplSyntaxOff
+
\endinput