2 \ProvidesPackage{luatexja-preset}[2017/12/15 Japanese font presets]
4 \RequirePackage{expl3,l3keys2e}
5 \RequirePackage{luatexja}
9 \msg_new:nnn { luatexja-preset }{ ltj-fontspec }{
10 The~ luatexja-fontspec~ package~ is~ loaded~ already.~
11 Hence~ we~ ignore~ `nfssonly'~option.
13 \msg_new:nnn { luatexja-preset }{ no-font }{
14 Font~ #1~ (#2)~ is~ not~found.~ Hence~ I~ substitute~ #3~ (#4)~ for~ it.
16 \msg_new:nnn { luatexja-preset }{ scale }{
17 Japanese~fonts~will~be~scaled~by~#1.
20 \msg_new:nnn { luatexja-preset }{ exist-preset-nooverwrite }{
21 The~ preset~ `#1'~ is~ already~ defined.~
22 To~ redefine~ this~ preset,~ use~ \str_use:N \c_backslash_str ltjnewpreset*~ instead.
24 \msg_new:nnn { luatexja-preset }{ exist-preset-overwrite }{
25 The~ preset~ `#1'~ is~ redefined.
28 \msg_new:nnn { luatexja-preset }{ illegal-preset-name }{
29 The~ preset~ `#1'~ cannot~ be~ defined,~
30 since~ the~ luatexja-preset~ package~ an~ option~ with~ the~ same~ name.
33 \seq_new:N \g_ltjpreset_presets_seq
35 \keys_define:nn { luatexja-preset }{
37 \keys_set_known:noN { ltjpreset-presets } { \tl_use:N \l_keys_tl } \l_tmpa_tl
38 \tl_if_empty:NT \l_tmpa_tl {
39 \PassOptionsToPackage { \l_tmpa_tl } { luatexja-fontspec }
41 scale .code:n = \gdef\Cjascale{#1},
43 \renewcommand\jttdefault{\gtdefault}\@ltj@match@familytrue
44 \PassOptionsToPackage { match } { luatexja-fontspec },
45 match .value_forbidden:n = true,
46 __custom .bool_set:N = \g_ltjpreset_custom_bool, __custom .groups:n = { preset },
47 __office .bool_set:N = \g_ltjpreset_office_bool, __office .groups:n = { preset },
48 __noembed .bool_set:N = \g_ltjpreset_noembed_bool, __noembed .groups:n = { preset },
50 \cs_new:Nn \ltjpreset_declare_option:nn {
51 \keys_define:nn { luatexja-preset }{
53 #1 .value_forbidden:n = true
56 \cs_new:Nn \ltjpreset_declare_preset:nn {
57 \keys_define:nn { luatexja-preset }{
59 #1 .value_forbidden:n = true, #1 .groups:n = { preset },
61 \seq_put_right:Nn \g_ltjpreset_presets_seq { #1 }
63 \cs_generate_variant:Nn \ltjpreset_declare_preset:nn {nx}
64 \cs_new:Nn \ltjpreset_declare_bool_option:nn {
65 \bool_new:c { g_ltjpreset_#1_bool }
66 \bool_set_false:c { g_ltjpreset_#1_bool }
67 \keys_define:nn { luatexja-preset }{
68 #1 .bool_set:c = { g_ltjpreset_#1_bool },
69 #2 .bool_set_inverse:c = { g_ltjpreset_#1_bool },
70 #1 .default:n = true, #2 .default:n = true,
75 \ltjpreset_declare_bool_option:nn { nfssonly }{ fontspec }
76 \ltjpreset_declare_bool_option:nn { bold }{ nobold }
77 \ltjpreset_declare_bool_option:nn { expert }{ noexpert }
78 \ltjpreset_declare_bool_option:nn { deluxe }{ nodeluxe }
81 \tl_new:N \ltjpreset_use_jfm_yoko_tl % 使用する JFM(横)
82 \tl_set:Nn \ltjpreset_use_jfm_yoko_tl {ujis}
83 \tl_new:N \ltjpreset_use_jfm_tate_tl % 使用する JFM(縦)
84 \tl_set:Nn \ltjpreset_use_jfm_tate_tl {ujisv}
85 \ltjpreset_declare_option:nn{jis}{\tl_set:Nn \ltjpreset_use_jfm_yoko_tl {jis}} % jis
86 \ltjpreset_declare_option:nn{ujis}{\tl_set:Nn \ltjpreset_use_jfm_yoko_tl {ujis}} % ujis
89 \tl_new:N \l_ltjpreset_kanji_shape_tl
90 \ltjpreset_declare_option:nn{90jis}{ \tl_set:Nn \l_ltjpreset_kanji_shape_tl { , CJKShape=JIS1990 }} % 90jis
91 \ltjpreset_declare_option:nn{jis2004}{\tl_set:Nn \l_ltjpreset_kanji_shape_tl { , CJKShape=JIS2004 }} % jis2004
94 \prop_new:N \g_ltjpreset_font_prop
95 \keys_define:nn { luatexja-preset } {
97 \prop_put:Nnn \g_ltjpreset_font_prop { mc-l } {#1}
98 \prop_put:Nnn \g_ltjpreset_font_prop { mc-m } {#1}
99 \prop_put:Nnn \g_ltjpreset_font_prop { mc-bx } {#1},
100 mc .groups:n = { preset }, mc .value_required:n = true,
102 \prop_put:Nnn \g_ltjpreset_font_prop { gt-u } {#1}
103 \prop_put:Nnn \g_ltjpreset_font_prop { gt-m } {#1}
104 \prop_put:Nnn \g_ltjpreset_font_prop { gt-bx } {#1}
105 \prop_put:Nnn \g_ltjpreset_font_prop { gt-eb } {#1},
106 gt .groups:n = { preset }, gt .value_required:n = true,
108 \cs_set:Nn \g_ltjpreset_tmp_cs:n {
109 \keys_define:nn { luatexja-preset } {
110 #1 .code:n = \prop_put:Non \g_ltjpreset_font_prop { #1 } { ##1 },
111 #1 .groups:n = { preset }, #1 .value_required:n = true,
114 \g_ltjpreset_tmp_cs:n { mc-l }
115 \g_ltjpreset_tmp_cs:n { mc-m }
116 \g_ltjpreset_tmp_cs:n { mc-bx }
117 \g_ltjpreset_tmp_cs:n { gt-u }
118 \g_ltjpreset_tmp_cs:n { gt-m }
119 \g_ltjpreset_tmp_cs:n { gt-bx }
120 \g_ltjpreset_tmp_cs:n { gt-eb}
121 \g_ltjpreset_tmp_cs:n { mg-m }
122 \cs_undefine:N \g_ltjpreset_tmp_cs:n
124 \cs_new:Nn \ltjpreset_set_uni:nn {
125 mc = #1, gt = #2, mc-bx = #2, mg-m = #2,
126 __custom = false, __office = false, __noembed = false,
128 \cs_new:Npn \ltjpreset_set_office:nn #1 #2{
129 mc = #1, mc-bx = HGMinchoE ,
130 gt-m = HGGothicM , gt-bx = HGGothicE ,
131 gt-u = #2 , gt-eb = HGSoeiKakugothicUB ,
132 mg-m = HGMaruGothicMPRO,
133 __custom = false, __office = true, __noembed = false,
139 \keys_define:nn { luatexja-preset }{
140 custom .meta:n = { #1, __custom = true, },
141 custom .value_required:n = true,
142 jfm_yoko .tl_set:N = \ltjpreset_use_jfm_yoko_tl,
143 jfm_tate .tl_set:N = \ltjpreset_use_jfm_tate_tl,
148 \ltjpreset_declare_preset:nx{kozuka-pro}{
149 mc-m = KozMinPro-Regular, mc-bx = KozMinPro-Bold,
150 gt-m = KozGoPro-Regular, gt-bx = KozGoPro-Bold,
151 gt-u = KozGoPro-Medium, gt-eb = KozGoPro-Heavy,
152 mg-m = KozGoPro-Heavy, mc-l = KozMinPro-Light,
153 __custom = false, __office = false, __noembed = false,
156 \ltjpreset_declare_preset:nx{kozuka-pr6}{
157 mc-m = KozMinProVI-Regular, mc-bx = KozMinProVI-Bold,
158 gt-m = KozGoProVI-Regular, gt-bx = KozGoProVI-Bold,
159 gt-u = KozGoProVI-Medium, gt-eb = KozGoProVI-Heavy,
160 mg-m = KozGoProVI-Heavy, mc-l = KozMinProVI-Light,
161 __custom = false, __office = false, __noembed = false,
164 \ltjpreset_declare_preset:nx{kozuka-pr6n}{
165 mc-m = KozMinPr6N-Regular, mc-bx = KozMinPr6N-Bold,
166 gt-m = KozGoPr6N-Regular, gt-bx = KozGoPr6N-Bold,
167 gt-u = KozGoPr6N-Medium, gt-eb = KozGoPr6N-Heavy,
168 mg-m = KozGoPr6N-Heavy, mc-l = KozMinPr6N-Light,
169 __custom = false, __office = false, __noembed = false,
173 \ltjpreset_declare_preset:nx{hiragino-pro}{
174 mc-m = HiraMinPro-W3, mc-bx = HiraMinPro-W6,
175 gt-m = HiraKakuPro-W3, gt-bx = HiraKakuPro-W6,
176 gt-u = HiraKakuPro-W6, gt-eb = HiraKakuStd-W8,
177 mg-m = HiraMaruPro-W4, mc-l = HiraMinPro-W2,
178 __custom = false, __office = false, __noembed = false,
180 \ltjpreset_declare_preset:nx{hiragino-pron}{
181 mc-m = HiraMinProN-W3, mc-bx = HiraMinProN-W6,
182 gt-m = HiraKakuProN-W3, gt-bx = HiraKakuProN-W6,
183 gt-u = HiraKakuProN-W6, gt-eb = HiraKakuStdN-W8,
184 mg-m = HiraMaruProN-W4, mc-l = HiraMinProN-W2,
185 __custom = false, __office = false, __noembed = false,
189 \ltjpreset_declare_preset:nx{morisawa-pro}{
190 mc = A-OTF-RyuminPro-Light.otf, mc-bx = A-OTF-FutoMinA101Pro-Bold.otf,
191 gt-m = A-OTF-GothicBBBPro-Medium.otf , gt-bx = A-OTF-FutoGoB101Pro-Bold.otf,
192 gt-u = A-OTF-GothicBBBPro-Medium.otf , gt-eb = A-OTF-MidashiGoPro-MB31.otf,
193 mg-m = A-OTF-Jun101Pro-Light.otf,
194 __custom = false, __office = false, __noembed = false,
196 \ltjpreset_declare_preset:nx{morisawa-pr6n}{
197 mc = A-OTF-RyuminPr6N-Light.otf, mc-bx = A-OTF-FutoMinA101Pr6N-Bold.otf,
198 gt-m = A-OTF-GothicBBBPr6N-Medium.otf , gt-bx = A-OTF-FutoGoB101Pr6N-Bold.otf,
199 gt-u = A-OTF-GothicBBBPr6N-Medium.otf , gt-eb = A-OTF-MidashiGoPr6N-MB31.otf,
200 mg-m = A-OTF-Jun101Pr6N-Light.otf,
201 __custom = false, __office = false, __noembed = false,
205 \ltjpreset_declare_preset:nx{yu-win}{
206 mc-m = YuMincho-Regular, mc-bx = YuMincho-Demibold,
207 gt-m = YuGothic-Regular, gt-bx = YuGothic-Bold,
208 gt-u = YuGothic-Regular, gt-eb = YuGothic-Bold,
209 mg-m = YuGothic-Bold, mc-l = YuMincho-Light,
210 __custom = false, __office = false, __noembed = false,
213 \ltjpreset_declare_preset:nx{yu-win10}{
214 mc-m = YuMincho-Regular, mc-bx = YuMincho-Demibold,
215 gt-m = YuGothic-Regular, gt-bx = YuGothic-Bold,
216 gt-u = YuGothic-Medium, gt-eb = YuGothic-Bold,
217 mg-m = YuGothic-Bold, mc-l = YuMincho-Light,
218 __custom = false, __office = false, __noembed = false,
222 % according to http://support.apple.com/kb/HT5944
223 \ltjpreset_declare_preset:nx{yu-osx}{
224 mc = YuMincho~Medium, mc-bx = YuMincho~Demibold,
225 gt-m = YuGothic~Medium, gt-u = YuGothic~Medium,
226 gt-bx = YuGothic~Bold, gt-eb = YuGothic~Bold,
227 mg-m = YuGothic~Bold,
228 __custom = false, __office = false, __noembed = false,
232 \ltjpreset_declare_preset:nx{moga-mobo}{
233 mc = Moga90Mincho, mc-bx = Moga90Mincho~Bold,
234 gt-m = Moga90Gothic, gt-bx = Moga90Gothic~Bold,
235 gt-u = Moga90Gothic, gt-eb = Moga90Gothic~Bold,
237 __custom = false, __office = false, __noembed = false,
239 \ltjpreset_declare_preset:nx{moga-mobo-ex}{
240 mc = MogaEx90Mincho, mc-bx = MogaEx90Mincho~Bold,
241 gt-m = MogaEx90Gothic, gt-bx = MogaEx90Gothic~Bold,
242 gt-u = MogaEx90Gothic, gt-eb = MogaEx90Gothic~Bold,
243 mg-m = MoboEx90Gothic,
244 __custom = false, __office = false, __noembed = false,
248 \ltjpreset_declare_preset:nx{ume}{
250 gt-m = Ume~Gothic, gt-bx = Ume~Gothic~O5,
251 gt-u = Ume~Gothic~O5, gt-eb = Ume~Gothic~O5,
252 mg-m = Ume~Gothic~O4,
253 __custom = false, __office = false, __noembed = false,
256 % Source Han {Serif,Sans}
257 \ltjpreset_declare_preset:nx{sourcehan}{
258 mc-m = Source~Han~Serif~Regular,
259 mc-bx = Source~Han~Serif~Bold,
260 gt-m = Source~Han~Sans~Regular,
261 gt-bx = Source~Han~Sans~Bold,
262 gt-u = Source~Han~Sans~Medium,
263 gt-eb = Source~Han~Sans~Heavy,
264 mg-m = Source~Han~Sans~Heavy,
265 mc-l = Source~Han~Serif~Light,
266 __custom = false, __office = false, __noembed = false,
268 \ltjpreset_declare_preset:nx{sourcehan-jp}{
269 mc-m = Source~Han~Serif~JP~Regular,
270 mc-bx = Source~Han~Serif~JP~Bold,
271 gt-m = Source~Han~Sans~JP~Regular,
272 gt-bx = Source~Han~Sans~JP~Bold,
273 gt-u = Source~Han~Sans~JP~Medium,
274 gt-eb = Source~Han~Sans~JP~Heavy,
275 mg-m = Source~Han~Sans~JP~Heavy,
276 mc-l = Source~Han~Serif~JP~Light,
277 __custom = false, __office = false, __noembed = false,
279 \ltjpreset_declare_preset:nx{noto-otc}{
280 mc-m = Noto~Serif~CJK~Regular,
281 mc-bx = Noto~Serif~CJK~Bold,
282 gt-m = Noto~Sans~CJK~Regular,
283 gt-bx = Noto~Sans~CJK~Bold,
284 gt-u = Noto~Sans~CJK~Medium,
285 gt-eb = Noto~Sans~CJK~Black,
286 mg-m = Noto~Sans~CJK~Black,
287 mc-l = Noto~Serif~CJK~Light,
288 __custom = false, __office = false, __noembed = false,
290 \ltjpreset_declare_preset:nx{noto-otf}{
291 mc-m = Noto~Serif~CJK~JP~Regular,
292 mc-bx = Noto~Serif~CJK~JP~Bold,
293 gt-m = Noto~Sans~CJK~JP~Regular,
294 gt-bx = Noto~Sans~CJK~JP~Bold,
295 gt-u = Noto~Sans~CJK~JP~Medium,
296 gt-eb = Noto~Sans~CJK~JP~Black,
297 mg-m = Noto~Sans~CJK~JP~Black,
298 mc-l = Noto~Serif~CJK~JP~Light,
299 __custom = false, __office = false, __noembed = false,
304 \ltjpreset_declare_preset:nx{ipa}{
305 \ltjpreset_set_uni:nn { IPAMincho } { IPAGothic }
307 \ltjpreset_declare_preset:nx{ipaex}{
308 \ltjpreset_set_uni:nn { IPAExMincho } { IPAExGothic }
310 \ltjpreset_declare_preset:nx{ms}{
311 \ltjpreset_set_uni:nn { MS-Mincho } { MS-Gothic }
314 % {ipa,ipaex,ms}-dx % Office 付属フォントを利用
315 \ltjpreset_declare_preset:nx{ipaex-hg}{
316 \ltjpreset_set_office:nn { IPAExMincho } { IPAExGothic }
318 \ltjpreset_declare_preset:nx{ipa-hg}{
319 \ltjpreset_set_office:nn { IPAMincho } { IPAGothic }
321 \ltjpreset_declare_preset:nx{ms-hg}{
322 \ltjpreset_set_office:nn { MS-Mincho } { MS-Gothic }
327 \ltjpreset_declare_preset:nx{noembed}{
328 \ltjpreset_set_uni:nn { Ryumin-Light } { GothicBBB-Medium },
329 __custom = false, __office = false, __noembed = true,
332 \keys_set:nn {luatexja-preset} { ipaex }
333 \ProcessKeysOptions { luatexja-preset }
334 \@ifpackageloaded{luatexja-fontspec}{
335 \bool_if:NT \g_ltjpreset_nfssonly_bool
336 { \msg_warning:nn { luatexja-preset }{ ltj-fontspec } }
337 \bool_set_false:N \g_ltjpreset_nfssonly_bool
340 %%%%%%%% main routine
342 \cs_new:Nn \ltjpreset_extract_fonts: {
343 %% MogaMincho の場合は 90 をつける/はずす
344 \bool_if:NF \g_ltjpreset_custom_bool {
345 \tl_set:Nn \l_tmpa_tl {, CJKShape=JIS2004 }
346 \tl_if_eq:NNT \l_ltjpreset_kanji_shape_tl \l_tmpa_tl {
347 \tl_set:Nx \l_tmpb_tl { \prop_item:Nn \g_ltjpreset_font_prop { mc-m } }
348 \tl_if_in:NnT \l_tmpb_tl { Moga90Mincho } {
349 \prop_clear:N \l_tmpa_prop
350 \prop_map_inline:Nn \g_ltjpreset_font_prop {
351 \tl_set:Nn \l_tmpb_tl { ##2 } \tl_remove_all:Nn \l_tmpb_tl {90}
352 \prop_put:Nnx \l_tmpa_prop { ##1 } { \tl_use:N \l_tmpb_tl }
354 \prop_set_eq:NN \g_ltjpreset_font_prop \l_tmpa_prop
356 \tl_if_in:NnT \l_tmpb_tl { MogaEx90Mincho } {
357 \prop_clear:N \l_tmpa_prop
358 \prop_map_inline:Nn \g_ltjpreset_font_prop {
359 \tl_set:Nn \l_tmpb_tl { ##2 } \tl_remove_all:Nn \l_tmpb_tl {90}
360 \prop_put:Nnx \l_tmpa_prop { ##1 } { \tl_use:N \l_tmpb_tl }
362 \prop_set_eq:NN \g_ltjpreset_font_prop \l_tmpa_prop
367 \cs_set:Nx \ltjpreset_font_mc_l: { \prop_item:Nn \g_ltjpreset_font_prop { mc-l } }
368 \cs_set:Nx \ltjpreset_font_mc_m: { \prop_item:Nn \g_ltjpreset_font_prop { mc-m } }
369 \cs_set:Nx \ltjpreset_font_mc_bx: { \prop_item:Nn \g_ltjpreset_font_prop { mc-bx } }
370 \cs_set:Nx \ltjpreset_font_gt_m: { \prop_item:Nn \g_ltjpreset_font_prop { gt-m } }
371 \cs_set:Nx \ltjpreset_font_gt_u: { \prop_item:Nn \g_ltjpreset_font_prop { gt-u } }
372 \cs_set:Nx \ltjpreset_font_gt_bx: { \prop_item:Nn \g_ltjpreset_font_prop { gt-bx } }
373 \cs_set:Nx \ltjpreset_font_gt_eb: { \prop_item:Nn \g_ltjpreset_font_prop { gt-eb } }
374 \cs_set:Nx \ltjpreset_font_mg_m: { \prop_item:Nn \g_ltjpreset_font_prop { mg-m } }
375 %% HG 系フォント + JIS2004/90JIS のときはフォント名を置換
376 \bool_if:nT { !\g_ltjpreset_custom_bool && \g_ltjpreset_office_bool } {
377 \tl_set:Nn \l_tmpa_tl {, CJKShape=JIS2004 }
378 \tl_if_eq:NNT \l_ltjpreset_kanji_shape_tl \l_tmpa_tl {
379 \cs_set:Nx \ltjpreset_font_mc_bx: { hgrme04.ttc }
380 \cs_set:Nx \ltjpreset_font_gt_bx: { hgrge04.ttc }
381 \cs_set:Nx \ltjpreset_font_gt_eb: { hgrsgu04.ttc }
382 \cs_set:Nx \ltjpreset_font_mg_m: { hgrsmp04.ttf }
383 \cs_set_eq:NN \ltjpreset_font_gt_m: \ltjpreset_font_gt_u:
384 % HG ゴシックM のときはそうはいかないので 1 ウェイト時のゴシック体を使う
386 \tl_set:Nn \l_tmpa_tl {, CJKShape=JIS1990 }
387 \tl_if_eq:NNT \l_ltjpreset_kanji_shape_tl \l_tmpa_tl {
388 \cs_set:Nx \ltjpreset_font_mc_bx: { hgrme.ttc }
389 \cs_set:Nx \ltjpreset_font_gt_bx: { hgrge.ttc }
390 \cs_set:Nx \ltjpreset_font_gt_eb: { hgrsgu.ttc }
391 \cs_set:Nx \ltjpreset_font_mg_m: { hgrsmp.ttf }
395 \tl_set:Nx \l_tmpa_tl { \ltjpreset_font_mc_l: }
396 \tl_if_empty:NT \l_tmpa_tl {\tl_set:Nn \l_tmpa_tl {~}}
397 \cs_set:Nx \ltjpreset_font_mc_l: {
398 \tl_if_blank:nTF \l_tmpa_tl { \ltjpreset_font_mc_m: } {\tl_use:N \l_tmpa_tl }
401 \bool_if:NTF \g_ltjpreset_deluxe_bool {
402 \bool_if:NT \g_ltjpreset_bold_bool {
403 \cs_set_eq:NN \ltjpreset_font_mc_bx: \ltjpreset_font_gt_bx:
406 \bool_if:NTF \g_ltjpreset_bold_bool
407 { \cs_set_eq:NN \ltjpreset_font_gt_m: \ltjpreset_font_gt_bx: }
408 { \cs_set_eq:NN \ltjpreset_font_gt_m: \ltjpreset_font_gt_u: }
409 \cs_set_eq:NN \ltjpreset_font_gt_bx: \ltjpreset_font_gt_m:
410 \cs_set_eq:NN \ltjpreset_font_mc_bx: \ltjpreset_font_gt_m:
415 \cs_new:Nn \ltjpreset_substitute:nnnn {
417 \suppressfontnotfounderror=1
418 \font \g_ltjpreset_font_test: = "\cs:w ltjpreset_font_#1_#2: \cs_end:"\relax
419 \ifx \g_ltjpreset_font_test: \nullfont
420 \msg_warning:nnxxxx { luatexja-preset }{ no-font }
421 { \cs:w ltjpreset_font_#1_#2: \cs_end: }{ #1/#2 }
422 { \cs:w ltjpreset_font_#3_#4: \cs_end: }{ #3/#4 }
423 \cs_gset_eq:cc { ltjpreset_font_#1_#2: } { ltjpreset_font_#3_#4: }
428 %%%%%%%% deluxe (\mgfamily はあとで定義)
429 \bool_if:NTF \g_ltjpreset_deluxe_bool {
430 \cs_new:Nn \ltjpreset_check_deluxe_existence: {
431 \ltjpreset_substitute:nnnn { gt } { eb } { gt } { bx }
432 \ltjpreset_substitute:nnnn { mg } { m } { gt } { bx }
433 \ltjpreset_substitute:nnnn { mc } { l } { mc } { m }
436 \DeclareRobustCommand\ltseries { \not@math@alphabet\ltseries\relax\fontseries\ltdefault\selectfont }
438 \DeclareRobustCommand\ebseries { \not@math@alphabet\ebseries\relax\fontseries\ebdefault\selectfont }
439 \DeclareRobustCommand\gtebfamily { \gtfamily\fontseries{\ebdefault}\selectfont }
441 \cs_set_eq:NN \ltjpreset_check_deluxe_existence: \prg_do_nothing:
444 \bool_if:NTF \g_ltjpreset_nfssonly_bool {
445 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
447 \msg_warning:nnx { luatexja-preset }{ scale }{ \Cjascale }
449 \cs_new:Nn \ltj_preset_declare_font_shape:nnnnnn {
450 \cs_if_exist:cT { #1/#2/#3/#4/10 } { \cs_undefine:c { #1/#2/#3/#4/10 } }
451 \DeclareFontShape{#1}{#2}{#3}{#4}{ <-> s*[\Cjascale]
452 { \bool_if:NT \g_ltjpreset_noembed_bool {psft:} #5
453 ;-kern \tl_use:N \l_ltjpreset_kanji_shape_tl; #6 } } {}
455 \cs_new:Nn \ltj_preset_define_family:nnn {
456 \ltj_preset_declare_font_shape:nnnnnn { JY3 } { #1 } { #2 } { n }
457 { "#3" : jfm=\tl_use:N \ltjpreset_use_jfm_yoko_tl }
458 { script=hani \bool_if:NT \g_ltjpreset_expert_bool { ;+hkna } }
459 \ltj_preset_declare_font_shape:nnnnnn { JT3 } { #1 } { #2 } { n }
460 { "#3" : jfm=\tl_use:N \ltjpreset_use_jfm_tate_tl }
461 { script=hani \bool_if:NT \g_ltjpreset_expert_bool { ;+vkna } }
462 \bool_if:NT \g_ltjpreset_expert_bool {
463 \ltj_preset_declare_font_shape:nnnnnn { JY3 } { #1 } { #2 } { rb }
464 { "#3" : jfm=\tl_use:N \ltjpreset_use_jfm_yoko_tl } { script=kana; +ruby }
465 \ltj_preset_declare_font_shape:nnnnnn { JT3 } { #1 } { #2 } { rb }
466 { "#3" : jfm=\tl_use:N \ltjpreset_use_jfm_tate_tl } { script=kana; +ruby }
470 \DeclareKanjiFamily{JY3}{ltjpm}{}\DeclareKanjiFamily{JT3}{ltjpm}{}
471 \DeclareKanjiFamily{JY3}{ltjpg}{}\DeclareKanjiFamily{JT3}{ltjpg}{}
472 \def\mcdefault{ltjpm}\def\gtdefault{ltjpg}
473 \SetSymbolFont{mincho}{normal}{JY3}{ltjpm}{m}{n}
474 \SetSymbolFont{mincho}{bold}{JY3}{ltjpm}{bx}{n}
475 \DeclareMathAlphabet{\mathgt}{JY3}{ltjpg}{m}{n}
476 \bool_if:NT \g_ltjpreset_expert_bool {
477 \DeclareRobustCommand\rubyfamily { \kanjishape{rb}\selectfont }
480 \bool_if:NT \g_ltjpreset_deluxe_bool {
481 \DeclareKanjiFamily{JY3}{ltjpmg}{}\DeclareKanjiFamily{JT3}{ltjpmg}{}
482 \DeclareRobustCommand\mgfamily {
483 \not@math@alphabet\mgfamily\relax\kanjifamily{ltjpmg}\selectfont
485 \DeclareTextFontCommand{\textmg}{\mgfamily}
488 \cs_new:Nn \ltjpreset_do_fontset: { \group_begin:
489 \tl_set:Nn \l_tmpa_tl {, CJKShape=JIS1990 }
490 \tl_if_eq:NNT \l_ltjpreset_kanji_shape_tl \l_tmpa_tl {
491 \tl_set:Nn \l_ltjpreset_kanji_shape_tl { ;+jp90 }
493 \tl_set:Nn \l_tmpa_tl {, CJKShape=JIS2004 }
494 \tl_if_eq:NNT \l_ltjpreset_kanji_shape_tl \l_tmpa_tl {
495 \tl_set:Nx \l_ltjpreset_kanji_shape_tl { ;+jp04 }
497 \ltj_preset_define_family:nnn {ltjpm} {m} {\ltjpreset_font_mc_m:}
498 \ltj_preset_define_family:nnn {ltjpm} {bx} {\ltjpreset_font_mc_bx:}
499 \ltj_preset_define_family:nnn {ltjpg} {m} {\ltjpreset_font_gt_m:}
500 \ltj_preset_define_family:nnn {ltjpg} {bx} {\ltjpreset_font_gt_bx:}
502 \bool_if:NT \g_ltjpreset_deluxe_bool {
503 \ltj_preset_define_family:nnn {ltjpm} {l} {\ltjpreset_font_mc_l:}
504 \ltj_preset_define_family:nnn {ltjpg} {eb} {\ltjpreset_font_gt_eb:}
505 \ltj_preset_define_family:nnn {ltjpmg} {m} {\ltjpreset_font_mg_m:}
509 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
512 \RequirePackage{luatexja-fontspec}
514 \msg_warning:nnx { luatexja-preset }{ scale }{ \Cjascale }
515 \tl_new:N \l_ltjpreset_add_features_tl
517 \bool_if:NT \g_ltjpreset_expert_bool {
518 \cs_set:Npn \rubyfamily { \addjfontfeatures {
519 Style=Ruby , YokoFeatures={RawFeature=-hkna} , TateFeatures={RawFeature=-vkna}
522 \addjfontfeature{ Kerning=Off }
524 \cs_new:Nn \ltjpreset_do_fontset: { \group_begin:
525 \tl_gset:Nx \l_ltjpreset_add_features_tl {
526 \tl_use:N \l_ltjpreset_kanji_shape_tl,
527 YokoFeatures = { JFM = \tl_use:N \ltjpreset_use_jfm_yoko_tl },
528 TateFeatures = { JFM = \tl_use:N \ltjpreset_use_jfm_tate_tl },
529 Script=CJK, \bool_if:NT \g_ltjpreset_noembed_bool { , NoEmbed }
532 \bool_if:NT \g_ltjpreset_expert_bool {
533 \tl_put_left:Nn \l_ltjpreset_add_features_tl {
534 , YokoFeatures = {Style = HorizontalKana}, TateFeatures = {Style = VerticalKana}
538 \bool_if:NT \g_ltjpreset_deluxe_bool { FontFace={l}{n}{\ltjpreset_font_mc_l:}, }
539 BoldFont = \ltjpreset_font_mc_bx: \tl_use:N \l_ltjpreset_add_features_tl
540 ] { \ltjpreset_font_mc_m: }
542 \bool_if:NT \g_ltjpreset_deluxe_bool { FontFace={eb}{n}{\ltjpreset_font_gt_eb:}, }
543 BoldFont = \ltjpreset_font_gt_bx: \tl_use:N \l_ltjpreset_add_features_tl
544 ] { \ltjpreset_font_gt_m: }
545 \bool_if:NT \g_ltjpreset_deluxe_bool {
547 \newjfontfamily \mgfamily [
548 BoldFont = \ltjpreset_font_mg_m: \tl_use:N \l_ltjpreset_add_features_tl
549 ] { \ltjpreset_font_mg_m: }
550 \DeclareTextFontCommand{\textmg}{\mgfamily}
553 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
557 \@ifstar{\ltjpreset_new_preset:nnn{ true }}{\ltjpreset_new_preset:nnn{ false }}}
558 \cs_set:Nn \ltjpreset_new_preset:nnn {
559 \keys_if_exist:nnTF { luatexja-preset } { #2 } {
560 \seq_if_in:NnTF \g_ltjpreset_presets_seq { #2 } {
561 \bool_if:cTF { c_ #1 _bool } {
562 \msg_warning:nnn { luatexja-preset }{ exist-preset-overwrite } { #2 }
564 \msg_error:nnn { luatexja-preset }{ exist-preset-nooverwrite } { #2 }
567 \msg_error:nnn { luatexja-preset }{ illegal-preset-name } { #2 }
570 \keys_define:nn { luatexja-preset } {
571 #2 .meta:n = { #3, __custom = true, __noembed = false, __office = false, },
572 #2 .value_forbidden:n = true, #2 .groups:n = { preset },
574 \seq_put_right:Nn \g_ltjpreset_presets_seq { #2 }
578 \cs_set:Npn \ltjapplypreset #1 {
579 \keys_set_groups:nnn { luatexja-preset } { preset } { #1 }
580 \ltjpreset_extract_fonts:
581 \ltjpreset_check_deluxe_existence:
582 \ltjpreset_do_fontset:
588 \@onlypreamble\ltjnewpreset
589 \@onlypreamble\ltjapplypreset