2 \ProvidesPackage{luatexja-preset}[2013/05/25 Japanese font presets]
3 %% Sync with PXchfon 0.6a
6 \RequirePackage{luatexja-fontspec}
11 \bool_new:N \l_ltjpreset_bold_bool % bold
12 \bool_set_false:N \l_ltjpreset_bold_bool
13 \DeclareOption{bold} {\bool_set_true:N \l_ltjpreset_bold_bool}
14 \DeclareOption{nobold}{\bool_set_false:N \l_ltjpreset_bold_bool}
16 \bool_new:N \l_ltjpreset_expert_bool % expert
17 \bool_set_false:N \l_ltjpreset_expert_bool
18 \DeclareOption{expert} {\bool_set_true:N \l_ltjpreset_expert_bool}
19 \DeclareOption{noexpert}{\bool_set_false:N \l_ltjpreset_expert_bool}
21 \int_new:N \l_ltjpreset_deluxe_int % expert
22 \int_set:Nn \l_ltjpreset_deluxe_int { 0 }
23 \DeclareOption{deluxe}{\int_set:Nn \l_ltjpreset_deluxe_int { 2 }} % 7 fonts
24 \DeclareOption{nodeluxe}{\int_set:Nn \l_ltjpreset_deluxe_int { 0 }} % 2 fonts
27 \msg_new:nnn { luatexja-preset }{ scale }{
28 Japanese~fonts~will~be~scaled~by~\fp_use:N \g_ltj_fontspec_scale_fp.
30 \msg_warning:nn { luatexja-preset }{ scale }
33 \cs_set:Npn \ltjpreset_use_jfm: {ujis} % 使用する JFM
34 %%% \DeclareOption{min}{\cs_set:Npn \ltjpreset_use_jfm: {min}} % min
35 %%% ↑jfm-min.lua が横組み・縦組み専用仮名に追いついていないので使用禁止
36 \DeclareOption{jis}{\cs_set:Npn \ltjpreset_use_jfm: {jis}} % jis
37 \DeclareOption{ujis}{\cs_set:Npn \ltjpreset_use_jfm: {ujis}} % ujis
40 \tl_new:N \l_ltjpreset_kanji_shape_tl
41 \DeclareOption{90jis}{ \tl_set:Nn \l_ltjpreset_kanji_shape_tl { , CJKShape=JIS1990 }} % 90jis
42 \DeclareOption{jis2004}{\tl_set:Nn \l_ltjpreset_kanji_shape_tl { , CJKShape=JIS2004 }} % jis2004
45 \bool_new:N \l_ltjpreset_office_bool % MS Office の HG 系フォントを使っているか
46 \bool_new:N \l_ltjpreset_noembed_bool % 非埋込か
47 \clist_new:N \l_ltjpreset_font_list
49 \cs_new:Npn \ltjpreset_set_uni:nn #1#2 {
50 \ltjpreset_set_multi:n { #1, #1, #2, #2, #2, #2, #1 }
52 \cs_new:Npn \ltjpreset_set_multi:n #1 {
53 \clist_set:Nn \l_ltjpreset_font_list { #1 }
54 \bool_set_false:N \l_ltjpreset_office_bool
55 \bool_set_false:N \l_ltjpreset_noembed_bool
57 \cs_new:Npn \ltjpreset_set_office:nn #1 #2{
58 \ltjpreset_set_multi:n {
59 #1, HGMinchoE , % mc/m, mc/bx
60 HGGothicM , HGGothicE , % gt/m, gt/bx (multiweight))
61 #2 , HGSoeiKakugothicUB , % gt/m (uni), gt/eb
62 HGMaruGothicMPRO % mg/m
64 \bool_set_true:N \l_ltjpreset_office_bool
67 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
70 \DeclareOption{kozuka4}{
71 \ltjpreset_set_multi:n {
72 KozMinPro-Regular.otf , KozMinPro-Bold.otf, % mc/m, mc/bx
73 KozGoPro-Regular.otf , KozGoPro-Bold.otf, % gt/m, gt/bx (multiweight))
74 KozGoPro-Medium.otf , KozGoPro-Heavy.otf, % gt/m (uni), gt/eb
75 KozGoPro-Heavy.otf % mg/m
78 \DeclareOption{kozuka6}{
79 \ltjpreset_set_multi:n {
80 KozMinProVI-Regular.otf , KozMinProVI-Bold.otf, % mc/m, mc/bx
81 KozGoProVI-Regular.otf , KozGoProVI-Bold.otf, % gt/m, gt/bx (multiweight))
82 KozGoProVI-Medium.otf , KozGoProVI-Heavy.otf, % gt/m (uni), gt/eb
83 KozGoProVI-Heavy.otf % mg/m
86 \DeclareOption{kozuka6n}{
87 \ltjpreset_set_multi:n {
88 KozMinPr6N-Regular.otf , KozMinPr6N-Bold.otf, % mc/m, mc/bx
89 KozGoPr6N-Regular.otf , KozGoPr6N-Bold.otf, % gt/m, gt/bx (multiweight))
90 KozGoPr6N-Medium.otf , KozGoPr6N-Heavy.otf, % gt/m (uni), gt/eb
91 KozGoPr6N-Heavy.otf % mg/m
96 \DeclareOption{hiragino}{
97 \ltjpreset_set_multi:n {
98 HiraMinPro-W3.otf , HiraMinPro-W6.otf, % mc/m, mc/bx
99 HiraKakuPro-W3.otf , HiraKakuPro-W6.otf, % gt/m, gt/bx (multiweight))
100 HiraKakuPro-W3.otf , HiraKakuStd-W8.otf, % gt/m (uni), gt/eb
101 HiraMaruPro-W4.otf % mg/m
104 \DeclareOption{hiraginon}{
105 \ltjpreset_set_multi:n {
106 HiraMinProN-W3.otf , HiraMinProN-W6.otf, % mc/m, mc/bx
107 HiraKakuProN-W3.otf , HiraKakuProN-W6.otf, % gt/m, gt/bx (multiweight))
108 HiraKakuProN-W3.otf , HiraKakuStdN-W8.otf, % gt/m (uni), gt/eb
109 HiraMaruProN-W4.otf % mg/m
114 \DeclareOption{morisawa4}{
115 \ltjpreset_set_multi:n {
116 A-OTF-RyuminPro-Light.otf , A-OTF-FutoMinA101Pro-Bold.otf , % mc/m, mc/bx
117 A-OTF-GothicBBBPro-Medium.otf , A-OTF-FutoGoB101Pro-Bold.otf , % gt/m, gt/bx (multiweight))
118 A-OTF-GothicBBBPro-Medium.otf , A-OTF-MidashiGoPro-MB31.otf , % gt/m (uni), gt/eb
119 A-OTF-Jun101Pro-Light.otf % mg/m
122 \DeclareOption{morisawa6n}{
123 \ltjpreset_set_multi:n {
124 A-OTF-RyuminPr6N-Light.otf , A-OTF-FutoMinA101Pr6N-Bold.otf , % mc/m, mc/bx
125 A-OTF-GothicBBBPr6N-Medium.otf , A-OTF-FutoGoB101Pr6N-Bold.otf , % gt/m, gt/bx (multiweight))
126 A-OTF-GothicBBBPr6N-Medium.otf , A-OTF-MidashiGoPr6N-MB31.otf , % gt/m (uni), gt/eb
127 A-OTF-Jun101Pr6N-Light.otf % mg/m
131 \DeclareOption{ipaex-dx}{\ltjpreset_set_office:nn { IPAExMincho } { IPAExGothic }}
132 \DeclareOption{ipa-dx} {\ltjpreset_set_office:nn { IPAMincho } { IPAGothic }}
133 \DeclareOption{ms-dx} {\ltjpreset_set_office:nn { MS-Mincho } { MS-Gothic }}
134 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
139 \DeclareOption{kozuka-pro}{
140 \ltjpreset_set_multi:n {
141 KozMinPro-Regular.otf , KozMinPro-Bold.otf, % mc/m, mc/bx
142 KozGoPro-Regular.otf , KozGoPro-Bold.otf, % gt/m, gt/bx (multiweight))
143 KozGoPro-Medium.otf , KozGoPro-Heavy.otf, % gt/m (uni), gt/eb
144 KozGoPro-Heavy.otf % mg/m
147 \DeclareOption{kozuka-pr6}{
148 \ltjpreset_set_multi:n {
149 KozMinProVI-Regular.otf , KozMinProVI-Bold.otf, % mc/m, mc/bx
150 KozGoProVI-Regular.otf , KozGoProVI-Bold.otf, % gt/m, gt/bx (multiweight))
151 KozGoProVI-Medium.otf , KozGoProVI-Heavy.otf, % gt/m (uni), gt/eb
152 KozGoProVI-Heavy.otf % mg/m
155 \DeclareOption{kozuka-pr6n}{
156 \ltjpreset_set_multi:n {
157 KozMinPr6N-Regular.otf , KozMinPr6N-Bold.otf, % mc/m, mc/bx
158 KozGoPr6N-Regular.otf , KozGoPr6N-Bold.otf, % gt/m, gt/bx (multiweight))
159 KozGoPr6N-Medium.otf , KozGoPr6N-Heavy.otf, % gt/m (uni), gt/eb
160 KozGoPr6N-Heavy.otf % mg/m
165 \DeclareOption{hiragino-pro}{
166 \ltjpreset_set_multi:n {
167 HiraMinPro-W3.otf , HiraMinPro-W6.otf, % mc/m, mc/bx
168 HiraKakuPro-W3.otf , HiraKakuPro-W6.otf, % gt/m, gt/bx (multiweight))
169 HiraKakuPro-W6.otf , HiraKakuStd-W8.otf, % gt/m (uni), gt/eb
170 HiraMaruPro-W4.otf % mg/m
173 \DeclareOption{hiragino-pron}{
174 \ltjpreset_set_multi:n {
175 HiraMinProN-W3.otf , HiraMinProN-W6.otf, % mc/m, mc/bx
176 HiraKakuProN-W3.otf , HiraKakuProN-W6.otf, % gt/m, gt/bx (multiweight))
177 HiraKakuProN-W6.otf , HiraKakuStdN-W8.otf, % gt/m (uni), gt/eb
178 HiraMaruProN-W4.otf % mg/m
183 \DeclareOption{morisawa-pro}{
184 \ltjpreset_set_multi:n {
185 A-OTF-RyuminPro-Light.otf , A-OTF-FutoMinA101Pro-Bold.otf , % mc/m, mc/bx
186 A-OTF-GothicBBBPro-Medium.otf , A-OTF-FutoGoB101Pro-Bold.otf , % gt/m, gt/bx (multiweight))
187 A-OTF-GothicBBBPro-Medium.otf , A-OTF-MidashiGoPro-MB31.otf , % gt/m (uni), gt/eb
188 A-OTF-Jun101Pro-Light.otf % mg/m
191 \DeclareOption{morisawa-pr6n}{
192 \ltjpreset_set_multi:n {
193 A-OTF-RyuminPr6N-Light.otf , A-OTF-FutoMinA101Pr6N-Bold.otf , % mc/m, mc/bx
194 A-OTF-GothicBBBPr6N-Medium.otf , A-OTF-FutoGoB101Pr6N-Bold.otf , % gt/m, gt/bx (multiweight))
195 A-OTF-GothicBBBPr6N-Medium.otf , A-OTF-MidashiGoPr6N-MB31.otf , % gt/m (uni), gt/eb
196 A-OTF-Jun101Pr6N-Light.otf % mg/m
203 \ltjpreset_set_uni:nn { IPAMincho } { IPAGothic }
205 \DeclareOption{ipaex}{
206 \ltjpreset_set_uni:nn { IPAExMincho } { IPAExGothic }
209 \ltjpreset_set_uni:nn { MS-Mincho } { MS-Gothic }
212 % {ipa,ipaex,ms}-dx % Office 付属フォントを利用
213 \DeclareOption{ipaex-hg}{
214 \ltjpreset_set_office:nn { IPAExMincho } { IPAExGothic }
216 \DeclareOption{ipa-hg}{
217 \ltjpreset_set_office:nn { IPAMincho } { IPAGothic }
219 \DeclareOption{ms-hg}{
220 \ltjpreset_set_office:nn { MS-Mincho } { MS-Gothic }
225 \DeclareOption{noembed}{
226 \ltjpreset_set_uni:nn { Ryumin-Light } { GothicBBB-Medium }
227 \bool_set_true:N \l_ltjpreset_noembed_bool
230 \ExecuteOptions{noembed}
233 %% KozMinPr6N の場合はjp04 feature がないので,nlck にする
234 \clist_if_in:NnT \l_ltjpreset_font_list { KozMinPr6N-Regular.otf } {
235 \tl_set:Nn \l_tmpa_tl {, CJKShape=JIS2004 }
236 \tl_if_eq:NNT \l_ltjpreset_kanji_shape_tl \l_tmpa_tl {
237 \tl_set:Nn \l_ltjpreset_kanji_shape_tl { , CJKShape=NLC }
241 %%%%%%%% main routine
245 \clist_pop:NN \l_ltjpreset_font_list \l_tmpa_tl
246 \cs_set:Nx \ltjpreset_font_mc_m: { \tl_use:N \l_tmpa_tl }
249 \clist_pop:NN \l_ltjpreset_font_list \l_tmpa_tl
250 \cs_set:Nx \ltjpreset_font_mc_bx: { \tl_use:N \l_tmpa_tl }
253 \clist_pop:NN \l_ltjpreset_font_list \l_tmpa_tl
254 \cs_set:Nx \ltjpreset_font_gt_m: { \tl_use:N \l_tmpa_tl }
257 \clist_pop:NN \l_ltjpreset_font_list \l_tmpa_tl
258 \cs_set:Nx \ltjpreset_font_gt_bx: { \tl_use:N \l_tmpa_tl }
261 \clist_pop:NN \l_ltjpreset_font_list \l_tmpa_tl
262 \cs_set:Nx \ltjpreset_font_gt_n_uni: { \tl_use:N \l_tmpa_tl }
265 \clist_pop:NN \l_ltjpreset_font_list \l_tmpa_tl
266 \cs_set:Nx \ltjpreset_font_gt_eb: { \tl_use:N \l_tmpa_tl }
269 \clist_pop:NN \l_ltjpreset_font_list \l_tmpa_tl
270 \cs_set:Nx \ltjpreset_font_mg: { \tl_use:N \l_tmpa_tl }
272 %% HG 系フォント + JIS2004/90JIS のときはフォント名を置換
273 \bool_if:NT \l_ltjpreset_office_bool {
274 \tl_set:Nn \l_tmpa_tl {, CJKShape=JIS2004 }
275 \tl_if_eq:NNT \l_ltjpreset_kanji_shape_tl \l_tmpa_tl {
276 \cs_set:Nx \ltjpreset_font_mc_bx: { hgrme04.ttc }
277 \cs_set:Nx \ltjpreset_font_gt_bx: { hgrge04.ttc }
278 \cs_set:Nx \ltjpreset_font_gt_eb: { hgrsgu04.ttc }
279 \cs_set:Nx \ltjpreset_font_mg: { hgrsmp04.ttf }
280 \cs_set_eq:NN \ltjpreset_font_gt_m: \ltjpreset_font_gt_n_uni:
281 % HG ゴシックM のときはそうはいかないので 1 ウェイト時のゴシック体を使う
283 \tl_set:Nn \l_tmpa_tl {, CJKShape=JIS1990 }
284 \tl_if_eq:NNT \l_ltjpreset_kanji_shape_tl \l_tmpa_tl {
285 \cs_set:Nx \ltjpreset_font_mc_bx: { hgrme.ttc }
286 \cs_set:Nx \ltjpreset_font_gt_bx: { hgrge.ttc }
287 \cs_set:Nx \ltjpreset_font_gt_eb: { hgrsgu.ttc }
288 \cs_set:Nx \ltjpreset_font_mg: { hgrsmp.ttf }
293 \tl_new:N \l_ltjpreset_add_features_tl
295 \tl_set:Nx \l_ltjpreset_add_features_tl {
296 \tl_use:N \l_ltjpreset_kanji_shape_tl,
297 JFM = \ltjpreset_use_jfm:
300 \bool_if:NT \l_ltjpreset_expert_bool {
301 \cs_set:Npn \rubyfamily { \addfontfeatures { Style = Ruby} }
302 \tl_put_left:Nn \l_ltjpreset_add_features_tl { Style = HorizontalKana, }
305 %%%% (丸)ゴシック体の設定: bold option もここで
306 \int_compare:nTF { \l_ltjpreset_deluxe_int == 2 } {
307 \newjfontfamily \mgfamily [
308 \tl_use:N \l_ltjpreset_add_features_tl
309 \bool_if:NT \l_ltjpreset_noembed_bool { , NoEmbed },
310 \tl_use:N \l_ltjpreset_add_features_tl
311 ] { \ltjpreset_font_mg: }
312 \newjfontfamily \gtebfamily [
313 \tl_use:N \l_ltjpreset_add_features_tl
314 \bool_if:NT \l_ltjpreset_noembed_bool { , NoEmbed },
315 \tl_use:N \l_ltjpreset_add_features_tl
316 ] { \ltjpreset_font_gt_eb: }
317 \bool_if:NT \l_ltjpreset_bold_bool {
318 \cs_set_eq:NN \ltjpreset_font_mc_bx: \ltjpreset_font_gt_bx:
321 \bool_if:NTF \l_ltjpreset_bold_bool {
322 \cs_set_eq:NN \ltjpreset_font_gt_m: \ltjpreset_font_gt_bx:
324 \cs_set_eq:NN \ltjpreset_font_gt_m: \ltjpreset_font_gt_n_uni:
326 \cs_set_eq:NN \ltjpreset_font_gt_bx: \ltjpreset_font_gt_m:
327 \cs_set_eq:NN \ltjpreset_font_mc_bx: \ltjpreset_font_gt_m:
331 %%%% 実際の fontspec の呼びだし
333 \defaultjfontfeatures{ Kerning=Off }
336 BoldFont = \ltjpreset_font_mc_bx:
337 \bool_if:NT \l_ltjpreset_noembed_bool { , NoEmbed },
338 \tl_use:N \l_ltjpreset_add_features_tl
339 ] { \ltjpreset_font_mc_m: }
341 BoldFont = \ltjpreset_font_gt_bx:
342 \bool_if:NT \l_ltjpreset_noembed_bool { , NoEmbed },
343 \tl_use:N \l_ltjpreset_add_features_tl
344 ] { \ltjpreset_font_gt_m: }