2 \ProvidesPackage{luatexja-preset}[2017/08/17 Japanese font presets]
4 \RequirePackage{expl3,l3keys2e}
5 \RequirePackage{luatexja}
8 \fp_new:N \g_ltjpreset_scale_fp
10 \fontsize{10}{10}\selectfont
11 \fp_gset:Nn \g_ltjpreset_scale_fp {\zw / 10}
15 \msg_new:nnn { luatexja-preset }{ ltj-fontspec }{
16 The~ luatexja-fontspec~ package~ is~ loaded~ already.~
17 Hence~ we~ ignore~ `nfssonly'~option.
19 \msg_new:nnn { luatexja-preset }{ no-font }{
20 Font~ #1~ (#2)~ is~ not~found.~ Hence~ I~ substitute~ #3~ (#4)~ for~ it.
22 \msg_new:nnn { luatexja-preset }{ scale }{
23 Japanese~fonts~will~be~scaled~by~#1.
26 \msg_new:nnn { luatexja-preset }{ exist-preset-nooverwrite }{
27 The~ preset~ `#1'~ is~ already~ defined.~
28 To~ redefine~ this~ preset,~ use~ \str_use:N \c_backslash_str ltjnewpreset*~ instead.
30 \msg_new:nnn { luatexja-preset }{ exist-preset-overwrite }{
31 The~ preset~ `#1'~ is~ redefined.
34 \msg_new:nnn { luatexja-preset }{ illegal-preset-name }{
35 The~ preset~ `#1'~ cannot~ be~ defined,~
36 since~ the~ luatexja-preset~ package~ an~ option~ with~ the~ same~ name.
39 \seq_new:N \g_ltjpreset_presets_seq
41 \keys_define:nn { luatexja-preset }{
43 \keys_set_known:noN { ltjpreset-presets } { \tl_use:N \l_keys_tl } \l_tmpa_tl
44 \tl_if_empty:NT \l_tmpa_tl {
45 \PassOptionsToPackage { \l_tmpa_tl } { luatexja-fontspec }
47 scale .fp_gset:N = \g_ltjpreset_scale_fp,
49 \renewcommand\jttdefault{\gtdefault}\@ltj@match@familytrue
50 \PassOptionsToPackage { match } { luatexja-fontspec },
51 match .value_forbidden:n = true,
52 __custom .bool_set:N = \g_ltjpreset_custom_bool, __custom .groups:n = { preset },
53 __office .bool_set:N = \g_ltjpreset_office_bool, __office .groups:n = { preset },
54 __noembed .bool_set:N = \g_ltjpreset_noembed_bool, __noembed .groups:n = { preset },
56 \cs_new:Nn \ltjpreset_declare_option:nn {
57 \keys_define:nn { luatexja-preset }{
59 #1 .value_forbidden:n = true
62 \cs_new:Nn \ltjpreset_declare_preset:nn {
63 \keys_define:nn { luatexja-preset }{
65 #1 .value_forbidden:n = true, #1 .groups:n = { preset },
67 \seq_put_right:Nn \g_ltjpreset_presets_seq { #1 }
69 \cs_generate_variant:Nn \ltjpreset_declare_preset:nn {nx}
70 \cs_new:Nn \ltjpreset_declare_bool_option:nn {
71 \bool_new:c { g_ltjpreset_#1_bool }
72 \bool_set_false:c { g_ltjpreset_#1_bool }
73 \keys_define:nn { luatexja-preset }{
74 #1 .bool_set:c = { g_ltjpreset_#1_bool },
75 #2 .bool_set_inverse:c = { g_ltjpreset_#1_bool },
76 #1 .default:n = true, #2 .default:n = true,
81 \bool_new:N \l_ltjpreset_shape_nlck_bool
82 \ltjpreset_declare_bool_option:nn { nfssonly }{ fontspec }
83 \ltjpreset_declare_bool_option:nn { bold }{ nobold }
84 \ltjpreset_declare_bool_option:nn { expert }{ noexpert }
85 \ltjpreset_declare_bool_option:nn { deluxe }{ nodeluxe }
88 \tl_new:N \ltjpreset_use_jfm_yoko_tl % 使用する JFM(横)
89 \tl_set:Nn \ltjpreset_use_jfm_yoko_tl {ujis}
90 \tl_new:N \ltjpreset_use_jfm_tate_tl % 使用する JFM(縦)
91 \tl_set:Nn \ltjpreset_use_jfm_tate_tl {ujisv}
92 \ltjpreset_declare_option:nn{jis}{\tl_set:Nn \ltjpreset_use_jfm_yoko_tl {jis}} % jis
93 \ltjpreset_declare_option:nn{ujis}{\tl_set:Nn \ltjpreset_use_jfm_yoko_tl {ujis}} % ujis
96 \tl_new:N \l_ltjpreset_kanji_shape_tl
97 \ltjpreset_declare_option:nn{90jis}{ \tl_set:Nn \l_ltjpreset_kanji_shape_tl { , CJKShape=JIS1990 }} % 90jis
98 \ltjpreset_declare_option:nn{jis2004}{\tl_set:Nn \l_ltjpreset_kanji_shape_tl { , CJKShape=JIS2004 }} % jis2004
101 \prop_new:N \g_ltjpreset_font_prop
102 \keys_define:nn { luatexja-preset } {
104 \prop_put:Nnn \g_ltjpreset_font_prop { mc-l } {#1}
105 \prop_put:Nnn \g_ltjpreset_font_prop { mc-m } {#1}
106 \prop_put:Nnn \g_ltjpreset_font_prop { mc-bx } {#1},
107 mc .groups:n = { preset }, mc .value_required:n = true,
109 \prop_put:Nnn \g_ltjpreset_font_prop { gt-u } {#1}
110 \prop_put:Nnn \g_ltjpreset_font_prop { gt-m } {#1}
111 \prop_put:Nnn \g_ltjpreset_font_prop { gt-bx } {#1}
112 \prop_put:Nnn \g_ltjpreset_font_prop { gt-eb } {#1},
113 gt .groups:n = { preset }, gt .value_required:n = true,
115 \cs_set:Nn \g_ltjpreset_tmp_cs:n {
116 \keys_define:nn { luatexja-preset } {
117 #1 .code:n = \prop_put:Non \g_ltjpreset_font_prop { #1 } { ##1 },
118 #1 .groups:n = { preset }, #1 .value_required:n = true,
121 \g_ltjpreset_tmp_cs:n { mc-l }
122 \g_ltjpreset_tmp_cs:n { mc-m }
123 \g_ltjpreset_tmp_cs:n { mc-bx }
124 \g_ltjpreset_tmp_cs:n { gt-u }
125 \g_ltjpreset_tmp_cs:n { gt-m }
126 \g_ltjpreset_tmp_cs:n { gt-bx }
127 \g_ltjpreset_tmp_cs:n { gt-eb}
128 \g_ltjpreset_tmp_cs:n { mg-m }
129 \cs_undefine:N \g_ltjpreset_tmp_cs:n
131 \cs_new:Nn \ltjpreset_set_uni:nn {
132 mc = #1, gt = #2, mc-bx = #2, mg-m = #2,
133 __custom = false, __office = false, __noembed = false,
135 \cs_new:Npn \ltjpreset_set_office:nn #1 #2{
136 mc = #1, mc-bx = HGMinchoE ,
137 gt-m = HGGothicM , gt-bx = HGGothicE ,
138 gt-u = #2 , gt-eb = HGSoeiKakugothicUB ,
139 mg-m = HGMaruGothicMPRO,
140 __custom = false, __office = true, __noembed = false,
146 \keys_define:nn { luatexja-preset }{
147 custom .meta:n = { #1, __custom = true, },
148 custom .value_required:n = true,
149 jfm_yoko .tl_set:N = \ltjpreset_use_jfm_yoko_tl,
150 jfm_tate .tl_set:N = \ltjpreset_use_jfm_tate_tl,
155 \ltjpreset_declare_preset:nx{kozuka-pro}{
156 mc-m = KozMinPro-Regular, mc-bx = KozMinPro-Bold,
157 gt-m = KozGoPro-Regular, gt-bx = KozGoPro-Bold,
158 gt-u = KozGoPro-Medium, gt-eb = KozGoPro-Heavy,
159 mg-m = KozGoPro-Heavy, mc-l = KozMinPro-Light,
160 __custom = false, __office = false, __noembed = false,
163 \ltjpreset_declare_preset:nx{kozuka-pr6}{
164 mc-m = KozMinProVI-Regular, mc-bx = KozMinProVI-Bold,
165 gt-m = KozGoProVI-Regular, gt-bx = KozGoProVI-Bold,
166 gt-u = KozGoProVI-Medium, gt-eb = KozGoProVI-Heavy,
167 mg-m = KozGoProVI-Heavy, mc-l = KozMinProVI-Light,
168 __custom = false, __office = false, __noembed = false,
171 \ltjpreset_declare_preset:nx{kozuka-pr6n}{
172 mc-m = KozMinPr6N-Regular, mc-bx = KozMinPr6N-Bold,
173 gt-m = KozGoPr6N-Regular, gt-bx = KozGoPr6N-Bold,
174 gt-u = KozGoPr6N-Medium, gt-eb = KozGoPr6N-Heavy,
175 mg-m = KozGoPr6N-Heavy, mc-l = KozMinPr6N-Light,
176 __custom = false, __office = false, __noembed = false,
180 \ltjpreset_declare_preset:nx{hiragino-pro}{
181 mc-m = HiraMinPro-W3, mc-bx = HiraMinPro-W6,
182 gt-m = HiraKakuPro-W3, gt-bx = HiraKakuPro-W6,
183 gt-u = HiraKakuPro-W6, gt-eb = HiraKakuStd-W8,
184 mg-m = HiraMaruPro-W4, mc-l = HiraMinPro-W2,
185 __custom = false, __office = false, __noembed = false,
187 \ltjpreset_declare_preset:nx{hiragino-pron}{
188 mc-m = HiraMinProN-W3, mc-bx = HiraMinProN-W6,
189 gt-m = HiraKakuProN-W3, gt-bx = HiraKakuProN-W6,
190 gt-u = HiraKakuProN-W6, gt-eb = HiraKakuStdN-W8,
191 mg-m = HiraMaruProN-W4, mc-l = HiraMinProN-W2,
192 __custom = false, __office = false, __noembed = false,
196 \ltjpreset_declare_preset:nx{morisawa-pro}{
197 mc = A-OTF-RyuminPro-Light.otf, mc-bx = A-OTF-FutoMinA101Pro-Bold.otf,
198 gt-m = A-OTF-GothicBBBPro-Medium.otf , gt-bx = A-OTF-FutoGoB101Pro-Bold.otf,
199 gt-u = A-OTF-GothicBBBPro-Medium.otf , gt-eb = A-OTF-MidashiGoPro-MB31.otf,
200 mg-m = A-OTF-Jun101Pro-Light.otf,
201 __custom = false, __office = false, __noembed = false,
203 \ltjpreset_declare_preset:nx{morisawa-pr6n}{
204 mc = A-OTF-RyuminPr6N-Light.otf, mc-bx = A-OTF-FutoMinA101Pr6N-Bold.otf,
205 gt-m = A-OTF-GothicBBBPr6N-Medium.otf , gt-bx = A-OTF-FutoGoB101Pr6N-Bold.otf,
206 gt-u = A-OTF-GothicBBBPr6N-Medium.otf , gt-eb = A-OTF-MidashiGoPr6N-MB31.otf,
207 mg-m = A-OTF-Jun101Pr6N-Light.otf,
208 __custom = false, __office = false, __noembed = false,
212 \ltjpreset_declare_preset:nx{yu-win}{
213 mc-m = YuMincho-Regular, mc-bx = YuMincho-Demibold,
214 gt-m = YuGothic-Regular, gt-bx = YuGothic-Bold,
215 gt-u = YuGothic-Regular, gt-eb = YuGothic-Bold,
216 mg-m = YuGothic-Bold, mc-l = YuMincho-Light
217 __custom = false, __office = false, __noembed = false,
220 \ltjpreset_declare_preset:nx{yu-win10}{
221 mc-m = YuMincho-Regular, mc-bx = YuMincho-Demibold,
222 gt-m = YuGothic-Regular, gt-bx = YuGothic-Bold,
223 gt-u = YuGothic-Medium, gt-eb = YuGothic-Bold,
224 mg-m = YuGothic-Bold, mc-l = YuMincho-Light
225 __custom = false, __office = false, __noembed = false,
229 % according to http://support.apple.com/kb/HT5944
230 \ltjpreset_declare_preset:nx{yu-osx}{
231 mc = YuMincho~Medium, mc-bx = YuMincho~Demibold,
232 gt-m = YuGothic~Medium, gt-u = YuGothic~Medium,
233 gt-bx = YuGothic~Bold, gt-eb = YuGothic~Bold,
235 __custom = false, __office = false, __noembed = false,
239 \ltjpreset_declare_preset:nx{moga-mobo}{
240 mc = Moga90Mincho, mc-bx = Moga90Mincho~Bold,
241 gt-m = Moga90Gothic, gt-bx = Moga90Gothic~Bold,
242 gt-u = Moga90Gothic, gt-eb = Moga90Gothic~Bold,
244 __custom = false, __office = false, __noembed = false,
246 \ltjpreset_declare_preset:nx{moga-mobo-ex}{
247 mc = MogaEx90Mincho, mc-bx = MogaEx90Mincho~Bold,
248 gt-m = MogaEx90Gothic, gt-bx = MogaEx90Gothic~Bold,
249 gt-u = MogaEx90Gothic, gt-eb = MogaEx90Gothic~Bold,
250 mg-m = MoboEx90Gothic
251 __custom = false, __office = false, __noembed = false,
255 \ltjpreset_declare_preset:nx{ume}{
257 gt-m = Ume~Gothic, gt-bx = Ume~Gothic~O5,
258 gt-u = Ume~Gothic~O5, gt-eb = Ume~Gothic~O5,
260 __custom = false, __office = false, __noembed = false,
263 % Source Han {Serif,Sans}
264 \ltjpreset_declare_preset:nx{sourcehan}{
265 mc-m = Source~Han~Serif~Regular,
266 mc-bx = Source~Han~Serif~Bold,
267 gt-m = Source~Han~Sans~Regular,
268 gt-bx = Source~Han~Sans~Bold,
269 gt-u = Source~Han~Sans~Medium,
270 gt-eb = Source~Han~Sans~Heavy,
271 mg-m = Source~Han~Sans~Heavy,
272 mc-l = Source~Han~Serif~Light,
273 __custom = false, __office = false, __noembed = false,
275 \ltjpreset_declare_preset:nx{sourcehan-jp}{
276 mc-m = Source~Han~Serif~JP~Regular,
277 mc-bx = Source~Han~Serif~JP~Bold,
278 gt-m = Source~Han~Sans~JP~Regular,
279 gt-bx = Source~Han~Sans~JP~Bold,
280 gt-u = Source~Han~Sans~JP~Medium,
281 gt-eb = Source~Han~Sans~JP~Heavy,
282 mg-m = Source~Han~Sans~JP~Heavy,
283 mc-l = Source~Han~Serif~JP~Light,
284 __custom = false, __office = false, __noembed = false,
286 \ltjpreset_declare_preset:nx{noto-otc}{
287 mc-m = Noto~Serif~CJK~Regular,
288 mc-bx = Noto~Serif~CJK~Bold,
289 gt-m = Noto~Sans~CJK~Regular,
290 gt-bx = Noto~Sans~CJK~Bold,
291 gt-u = Noto~Sans~CJK~Medium,
292 gt-eb = Noto~Sans~CJK~Black,
293 mg-m = Noto~Sans~CJK~Black,
294 mc-l = Noto~Serif~CJK~Light,
295 __custom = false, __office = false, __noembed = false,
297 \ltjpreset_declare_preset:nx{noto-otf}{
298 mc-m = Noto~Serif~CJK~JP~Regular,
299 mc-bx = Noto~Serif~CJK~JP~Bold,
300 gt-m = Noto~Sans~CJK~JP~Regular,
301 gt-bx = Noto~Sans~CJK~JP~Bold,
302 gt-u = Noto~Sans~CJK~JP~Medium,
303 gt-eb = Noto~Sans~CJK~JP~Black,
304 mg-m = Noto~Sans~CJK~JP~Black,
305 mc-l = Noto~Serif~CJK~JP~Light,
306 __custom = false, __office = false, __noembed = false,
311 \ltjpreset_declare_preset:nx{ipa}{
312 \ltjpreset_set_uni:nn { IPAMincho } { IPAGothic }
314 \ltjpreset_declare_preset:nx{ipaex}{
315 \ltjpreset_set_uni:nn { IPAExMincho } { IPAExGothic }
317 \ltjpreset_declare_preset:nx{ms}{
318 \ltjpreset_set_uni:nn { MS-Mincho } { MS-Gothic }
321 % {ipa,ipaex,ms}-dx % Office 付属フォントを利用
322 \ltjpreset_declare_preset:nx{ipaex-hg}{
323 \ltjpreset_set_office:nn { IPAExMincho } { IPAExGothic }
325 \ltjpreset_declare_preset:nx{ipa-hg}{
326 \ltjpreset_set_office:nn { IPAMincho } { IPAGothic }
328 \ltjpreset_declare_preset:nx{ms-hg}{
329 \ltjpreset_set_office:nn { MS-Mincho } { MS-Gothic }
334 \ltjpreset_declare_preset:nx{noembed}{
335 \ltjpreset_set_uni:nn { Ryumin-Light } { GothicBBB-Medium },
336 __custom = false, __office = false, __noembed = true,
339 \keys_set:nn {luatexja-preset} { ipaex }
340 \ProcessKeysOptions { luatexja-preset }
341 \@ifpackageloaded{luatexja-fontspec}{
342 \bool_if:NT \g_ltjpreset_nfssonly_bool
343 { \msg_warning:nn { luatexja-preset }{ ltj-fontspec } }
344 \bool_set_false:N \g_ltjpreset_nfssonly_bool
347 %%%%%%%% main routine
349 \cs_new:Nn \ltjpreset_extract_fonts: {
350 %% KozMinPr6N, HiraMinProN-W3 の場合はjp04 feature がないので,nlck にする
351 %% MogaMincho の場合は 90 をつける/はずす
352 \bool_if:NF \g_ltjpreset_custom_bool {
353 \tl_set:Nn \l_tmpa_tl {, CJKShape=JIS2004 }
354 \tl_if_eq:NNT \l_ltjpreset_kanji_shape_tl \l_tmpa_tl {
355 \tl_set:Nx \l_tmpb_tl { \prop_item:Nn \g_ltjpreset_font_prop { mc-m } }
356 \tl_if_in:NnT \l_tmpb_tl { KozMinPr6N-Regular }
357 { \bool_set_true:N \l_ltjpreset_shape_nlck_bool }
358 \tl_if_in:NnT \l_tmpb_tl { HiraMinProN-W3 }
359 { \bool_set_true:N \l_ltjpreset_shape_nlck_bool }
360 \tl_if_in:NnT \l_tmpb_tl { Moga90Mincho } {
361 \prop_clear:N \l_tmpa_prop
362 \prop_map_inline:Nn \g_ltjpreset_font_prop {
363 \tl_set:Nn \l_tmpb_tl { ##2 } \tl_remove_all:Nn \l_tmpb_tl {90}
364 \prop_put:Nnx \l_tmpa_prop { ##1 } { \tl_use:N \l_tmpb_tl }
366 \prop_set_eq:NN \g_ltjpreset_font_prop \l_tmpa_prop
368 \tl_if_in:NnT \l_tmpb_tl { MogaEx90Mincho } {
369 \prop_clear:N \l_tmpa_prop
370 \prop_map_inline:Nn \g_ltjpreset_font_prop {
371 \tl_set:Nn \l_tmpb_tl { ##2 } \tl_remove_all:Nn \l_tmpb_tl {90}
372 \prop_put:Nnx \l_tmpa_prop { ##1 } { \tl_use:N \l_tmpb_tl }
374 \prop_set_eq:NN \g_ltjpreset_font_prop \l_tmpa_prop
379 \cs_set:Nx \ltjpreset_font_mc_l: { \prop_item:Nn \g_ltjpreset_font_prop { mc-l } }
380 \cs_set:Nx \ltjpreset_font_mc_m: { \prop_item:Nn \g_ltjpreset_font_prop { mc-m } }
381 \cs_set:Nx \ltjpreset_font_mc_bx: { \prop_item:Nn \g_ltjpreset_font_prop { mc-bx } }
382 \cs_set:Nx \ltjpreset_font_gt_m: { \prop_item:Nn \g_ltjpreset_font_prop { gt-m } }
383 \cs_set:Nx \ltjpreset_font_gt_u: { \prop_item:Nn \g_ltjpreset_font_prop { gt-u } }
384 \cs_set:Nx \ltjpreset_font_gt_bx: { \prop_item:Nn \g_ltjpreset_font_prop { gt-bx } }
385 \cs_set:Nx \ltjpreset_font_gt_eb: { \prop_item:Nn \g_ltjpreset_font_prop { gt-eb } }
386 \cs_set:Nx \ltjpreset_font_mg_m: { \prop_item:Nn \g_ltjpreset_font_prop { mg-m } }
387 %% HG 系フォント + JIS2004/90JIS のときはフォント名を置換
388 \bool_if:nT { !\g_ltjpreset_custom_bool && \g_ltjpreset_office_bool } {
389 \tl_set:Nn \l_tmpa_tl {, CJKShape=JIS2004 }
390 \tl_if_eq:NNT \l_ltjpreset_kanji_shape_tl \l_tmpa_tl {
391 \cs_set:Nx \ltjpreset_font_mc_bx: { hgrme04.ttc }
392 \cs_set:Nx \ltjpreset_font_gt_bx: { hgrge04.ttc }
393 \cs_set:Nx \ltjpreset_font_gt_eb: { hgrsgu04.ttc }
394 \cs_set:Nx \ltjpreset_font_mg_m: { hgrsmp04.ttf }
395 \cs_set_eq:NN \ltjpreset_font_gt_m: \ltjpreset_font_gt_u:
396 % HG ゴシックM のときはそうはいかないので 1 ウェイト時のゴシック体を使う
398 \tl_set:Nn \l_tmpa_tl {, CJKShape=JIS1990 }
399 \tl_if_eq:NNT \l_ltjpreset_kanji_shape_tl \l_tmpa_tl {
400 \cs_set:Nx \ltjpreset_font_mc_bx: { hgrme.ttc }
401 \cs_set:Nx \ltjpreset_font_gt_bx: { hgrge.ttc }
402 \cs_set:Nx \ltjpreset_font_gt_eb: { hgrsgu.ttc }
403 \cs_set:Nx \ltjpreset_font_mg_m: { hgrsmp.ttf }
407 \tl_set:Nx \l_tmpa_tl { \ltjpreset_font_mc_l: }
408 \tl_if_empty:NT \l_tmpa_tl {\tl_set:Nn \l_tmpa_tl {~}}
409 \cs_set:Nx \ltjpreset_font_mc_l: {
410 \tl_if_blank:nTF \l_tmpa_tl { \ltjpreset_font_mc_m: } {\tl_use:N \l_tmpa_tl }
413 \bool_if:NTF \g_ltjpreset_deluxe_bool {
414 \bool_if:NT \g_ltjpreset_bold_bool {
415 \cs_set_eq:NN \ltjpreset_font_mc_bx: \ltjpreset_font_gt_bx:
418 \bool_if:NTF \g_ltjpreset_bold_bool
419 { \cs_set_eq:NN \ltjpreset_font_gt_m: \ltjpreset_font_gt_bx: }
420 { \cs_set_eq:NN \ltjpreset_font_gt_m: \ltjpreset_font_gt_u: }
421 \cs_set_eq:NN \ltjpreset_font_gt_bx: \ltjpreset_font_gt_m:
422 \cs_set_eq:NN \ltjpreset_font_mc_bx: \ltjpreset_font_gt_m:
427 \cs_new:Nn \ltjpreset_substitute:nnnn {
429 \suppressfontnotfounderror=1
430 \font \g_ltjpreset_font_test: = "\cs:w ltjpreset_font_#1_#2: \cs_end:"\relax
431 \ifx \g_ltjpreset_font_test: \nullfont
432 \msg_warning:nnxxxx { luatexja-preset }{ no-font }
433 { \cs:w ltjpreset_font_#1_#2: \cs_end: }{ #1/#2 }
434 { \cs:w ltjpreset_font_#3_#4: \cs_end: }{ #3/#4 }
435 \cs_gset_eq:cc { ltjpreset_font_#1_#2: } { ltjpreset_font_#3_#4: }
440 %%%%%%%% deluxe (\mgfamily はあとで定義)
441 \bool_if:NTF \g_ltjpreset_deluxe_bool {
442 \cs_new:Nn \ltjpreset_check_deluxe_existence: {
443 \ltjpreset_substitute:nnnn { gt } { eb } { gt } { bx }
444 \ltjpreset_substitute:nnnn { mg } { m } { gt } { bx }
445 \ltjpreset_substitute:nnnn { mc } { l } { mc } { m }
448 \DeclareRobustCommand\ltseries { \not@math@alphabet\ltseries\relax\fontseries\ltdefault\selectfont }
450 \DeclareRobustCommand\ebseries { \not@math@alphabet\ebseries\relax\fontseries\ebdefault\selectfont }
451 \DeclareRobustCommand\gtebfamily { \gtfamily\fontseries{\ebdefault}\selectfont }
453 \cs_set_eq:NN \ltjpreset_check_deluxe_existence: \prg_do_nothing:
456 \bool_if:NTF \g_ltjpreset_nfssonly_bool {
457 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
459 \msg_warning:nnx { luatexja-preset }{ scale }{ \fp_use:N \g_ltjpreset_scale_fp }
461 \cs_new:Nn \ltj_preset_declare_font_shape:nnnnnn {
462 \cs_if_exist:cT { #1/#2/#3/#4/10 } { \cs_undefine:c { #1/#2/#3/#4/10 } }
463 \DeclareFontShape{#1}{#2}{#3}{#4}{ <-> s*[\fp_use:N \g_ltjpreset_scale_fp]
464 { \bool_if:NT \g_ltjpreset_noembed_bool {psft:} #5
465 ;-kern \tl_use:N \l_ltjpreset_kanji_shape_tl; #6 } } {}
467 \cs_new:Nn \ltj_preset_define_family:nnn {
468 \ltj_preset_declare_font_shape:nnnnnn { JY3 } { #1 } { #2 } { n }
469 { "#3" : jfm=\tl_use:N \ltjpreset_use_jfm_yoko_tl }
470 { script=hani \bool_if:NT \g_ltjpreset_expert_bool { ;+hkna } }
471 \ltj_preset_declare_font_shape:nnnnnn { JT3 } { #1 } { #2 } { n }
472 { "#3" : jfm=\tl_use:N \ltjpreset_use_jfm_tate_tl }
473 { script=hani \bool_if:NT \g_ltjpreset_expert_bool { ;+vkna } }
474 \bool_if:NT \g_ltjpreset_expert_bool {
475 \ltj_preset_declare_font_shape:nnnnnn { JY3 } { #1 } { #2 } { rb }
476 { "#3" : jfm=\tl_use:N \ltjpreset_use_jfm_yoko_tl } { script=kana; +ruby }
477 \ltj_preset_declare_font_shape:nnnnnn { JT3 } { #1 } { #2 } { rb }
478 { "#3" : jfm=\tl_use:N \ltjpreset_use_jfm_tate_tl } { script=kana; +ruby }
482 \DeclareKanjiFamily{JY3}{ltjpm}{}\DeclareKanjiFamily{JT3}{ltjpm}{}
483 \DeclareKanjiFamily{JY3}{ltjpg}{}\DeclareKanjiFamily{JT3}{ltjpg}{}
484 \def\mcdefault{ltjpm}\def\gtdefault{ltjpg}
485 \SetSymbolFont{mincho}{normal}{JY3}{ltjpm}{m}{n}
486 \SetSymbolFont{mincho}{bold}{JY3}{ltjpm}{bx}{n}
487 \DeclareMathAlphabet{\mathgt}{JY3}{ltjpg}{m}{n}
488 \bool_if:NT \g_ltjpreset_expert_bool {
489 \DeclareRobustCommand\rubyfamily { \kanjishape{rb}\selectfont }
492 \bool_if:NT \g_ltjpreset_deluxe_bool {
493 \DeclareKanjiFamily{JY3}{ltjpmg}{}\DeclareKanjiFamily{JT3}{ltjpmg}{}
494 \DeclareRobustCommand\mgfamily {
495 \not@math@alphabet\mgfamily\relax\kanjifamily{ltjpmg}\selectfont
497 \DeclareTextFontCommand{\textmg}{\mgfamily}
500 \cs_new:Nn \ltjpreset_do_fontset: { \group_begin:
501 \tl_set:Nn \l_tmpa_tl {, CJKShape=JIS1990 }
502 \tl_if_eq:NNT \l_ltjpreset_kanji_shape_tl \l_tmpa_tl {
503 \tl_set:Nn \l_ltjpreset_kanji_shape_tl { ;+jp90 }
505 \tl_set:Nn \l_tmpa_tl {, CJKShape=JIS2004 }
506 \tl_if_eq:NNT \l_ltjpreset_kanji_shape_tl \l_tmpa_tl {
507 \tl_set:Nx \l_ltjpreset_kanji_shape_tl {
508 \bool_if:NTF \l_ltjpreset_shape_nlck_bool { ;+nlck } { ;+jp04 }
511 \ltj_preset_define_family:nnn {ltjpm} {m} {\ltjpreset_font_mc_m:}
512 \ltj_preset_define_family:nnn {ltjpm} {bx} {\ltjpreset_font_mc_bx:}
513 \ltj_preset_define_family:nnn {ltjpg} {m} {\ltjpreset_font_gt_m:}
514 \ltj_preset_define_family:nnn {ltjpg} {bx} {\ltjpreset_font_gt_bx:}
516 \bool_if:NT \g_ltjpreset_deluxe_bool {
517 \ltj_preset_define_family:nnn {ltjpm} {l} {\ltjpreset_font_mc_l:}
518 \ltj_preset_define_family:nnn {ltjpg} {eb} {\ltjpreset_font_gt_eb:}
519 \ltj_preset_define_family:nnn {ltjpmg} {m} {\ltjpreset_font_mg_m:}
523 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
526 \PassOptionsToPackage { scale = \fp_use:N \g_ltjpreset_scale_fp } { luatexja-fontspec }
527 \RequirePackage{luatexja-fontspec}
529 \msg_warning:nnx { luatexja-preset }{ scale }{ \fp_use:N \g_ltj_fontspec_scale_fp }
530 \tl_new:N \l_ltjpreset_add_features_tl
532 \bool_if:NT \g_ltjpreset_expert_bool {
533 \cs_set:Npn \rubyfamily { \addjfontfeatures {
534 Style=Ruby , YokoFeatures={RawFeature=-hkna} , TateFeatures={RawFeature=-vkna}
537 \addjfontfeature{ Kerning=Off }
539 \cs_new:Nn \ltjpreset_do_fontset: { \group_begin:
540 \tl_set:Nn \l_tmpa_tl {, CJKShape=JIS2004 }
541 \tl_if_eq:NNT \l_ltjpreset_kanji_shape_tl \l_tmpa_tl {
542 \bool_if:NT \l_ltjpreset_shape_nlck_bool
543 { \tl_set:Nn \l_ltjpreset_kanji_shape_tl { , CJKShape=NLC } }
545 \tl_gset:Nx \l_ltjpreset_add_features_tl {
546 \tl_use:N \l_ltjpreset_kanji_shape_tl,
547 YokoFeatures = { JFM = \tl_use:N \ltjpreset_use_jfm_yoko_tl },
548 TateFeatures = { JFM = \tl_use:N \ltjpreset_use_jfm_tate_tl },
549 Script=CJK, \bool_if:NT \g_ltjpreset_noembed_bool { , NoEmbed }
552 \bool_if:NT \g_ltjpreset_expert_bool {
553 \tl_put_left:Nn \l_ltjpreset_add_features_tl {
554 , YokoFeatures = {Style = HorizontalKana}, TateFeatures = {Style = VerticalKana}
558 \bool_if:NT \g_ltjpreset_deluxe_bool { FontFace={l}{n}{\ltjpreset_font_mc_l:}, }
559 BoldFont = \ltjpreset_font_mc_bx: \tl_use:N \l_ltjpreset_add_features_tl
560 ] { \ltjpreset_font_mc_m: }
562 \bool_if:NT \g_ltjpreset_deluxe_bool { FontFace={eb}{n}{\ltjpreset_font_gt_eb:}, }
563 BoldFont = \ltjpreset_font_gt_bx: \tl_use:N \l_ltjpreset_add_features_tl
564 ] { \ltjpreset_font_gt_m: }
565 \bool_if:NT \g_ltjpreset_deluxe_bool {
567 \newjfontfamily \mgfamily [
568 BoldFont = \ltjpreset_font_mg_m: \tl_use:N \l_ltjpreset_add_features_tl
569 ] { \ltjpreset_font_mg_m: }
570 \DeclareTextFontCommand{\textmg}{\mgfamily}
573 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
577 \@ifstar{\ltjpreset_new_preset:nnn{ true }}{\ltjpreset_new_preset:nnn{ false }}}
578 \cs_set:Nn \ltjpreset_new_preset:nnn {
579 \keys_if_exist:nnTF { luatexja-preset } { #2 } {
580 \seq_if_in:NnTF \g_ltjpreset_presets_seq { #2 } {
581 \bool_if:cTF { c_ #1 _bool } {
582 \msg_warning:nnn { luatexja-preset }{ exist-preset-overwrite } { #2 }
584 \msg_error:nnn { luatexja-preset }{ exist-preset-nooverwrite } { #2 }
587 \msg_error:nnn { luatexja-preset }{ illegal-preset-name } { #2 }
590 \keys_define:nn { luatexja-preset } {
591 #2 .meta:n = { #3, __custom = true, __noembed = false, __office = false, },
592 #3 .value_forbidden:n = true, #1 .groups:n = { preset },
594 \seq_put_right:Nn \g_ltjpreset_presets_seq { #2 }
598 \cs_set:Npn \ltjapplypreset #1 {
599 \keys_set_groups:nnn { luatexja-preset } { preset } { #1 }
600 \ltjpreset_extract_fonts:
601 \ltjpreset_check_deluxe_existence:
602 \ltjpreset_do_fontset: