1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
|
%
% zxjafont.sty
%
%%%% package declaration
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{zxjafont}[2015/05/08 v0.3]
\RequirePackage{ifxetex}
\RequireXeTeX
%%%% preparation
\def\zxjf@pkgname{zxjafont}
\def\zxjf@error{\PackageError\zxjf@pkgname}
\def\zxjf@warn{\PackageInfo\zxjf@pkgname}
\RequirePackage{fontspec}
\RequirePackage{keyval}
\ifx\bxUseDebug\relax \let\zxjf@debug\@gobble
\else \def\zxjf@debug#1{\typeout{\zxjf@pkgname: #1}}
\fi
%%%% options handling
%% \zxjf@main@preset
\def\zxjf@all@main@preset{%
ms,ipa,ipaex,%
ms-hg,ipa-hg,ipaex-hg,moga,moga-90,%
kozuka-pro,kozuka-pr6,kozuka-pr6n,hiragino-pro,hiragino-pron,%
morisawa-pro,morisawa-pr6n,yu-win,yu-osx,%
kozuka4,kozuka6,kozuka6n,hiragino,%
ms-dx,ipa-dx,hiragino-dx,moga-mobo}
\def\zxjf@all@sub@preset{%
hg,hiraginomg-pro,hiraginomg-pron,mobo,mobo-90,maruberi,%
hiraginomg}
\let\zxjf@main@preset\relax
\def\zxjf@do#1{\DeclareOption{#1}{\def\zxjf@main@preset{#1}}}
\@for\zxjf@x:=\zxjf@all@main@preset\do{%
\expandafter\zxjf@do\expandafter{\zxjf@x}}
\let\zxjf@sub@preset\@empty
\def\zxjf@do#1{\DeclareOption{#1}{\zxjf@add@sub@preset{#1}}}
\@for\zxjf@x:=\zxjf@all@sub@preset\do{%
\expandafter\zxjf@do\expandafter{\zxjf@x}}
\def\zxjf@add@sub@preset#1{%
\edef\zxjf@sub@preset{\zxjf@sub@preset#1,}}
%
\newif\ifzxjf@prop
\DeclareOption{prop}{\zxjf@proptrue}
\newif\ifzxjf@oneweight
\DeclareOption{oneweight}{\zxjf@oneweighttrue}
\define@key{zxjf}{scale}{\def\zxjf@scale{#1}}
% options using keyval
\let\zxjf@scale\relax
\define@key{zxjf}{scale}{\def\zxjf@scale{#1}}
\let\zxjf@feat\@empty
\define@key{zxjf}{feature}{\def\zxjf@feat{#1}}
\DeclareOption*{\def\zxjf@nxt{\setkeys{zxjf}}%
\expandafter\zxjf@nxt\expandafter{\CurrentOption}}
% dispatch
\let\@org@use@ption\@use@ption
\def\@use@ption{\csname ds@\CurrentOption \endcsname}
\ProcessOptions*
\let\@use@ption\@org@use@ption
% preset must be given
\ifx\zxjf@main@preset\relax
\zxjf@error{Preset name not specified}
{You must give one of the following names as option.\MessageBreak
\space\space\zxjf@all@main@preset}
\endinput\fi
%%%% detect bxjatype
\newif\ifzxjf@zxjatype
\@ifpackageloaded{zxjatype}{\zxjf@zxjatypetrue}{}
\AtBeginDocument{%
\ifzxjf@zxjatype\else\@ifpackageloaded{zxjatype}{%
\zxjf@error{zxjatype must be loaded before me}\@ehc
}\fi}
\ifzxjf@zxjatype\ifzxjf@prop
\zxjf@error{Option 'prop' cannot be used with zxjatype}\@ehc
\zxjf@propfalse
\fi\fi
%%%% decide scale factor
\ifx\zxjf@scale\relax
% If zxjatype is used, try \JaFontScale, \zxjt@scale,
% and \__zxjt_scale_tl.
\ifzxjf@zxjatype
\ifdefined\JaFontScale \let\zxjf@scale\JaFontScale
\else\ifdefined\zxjt@scale \let\zxjf@scale\zxjt@scale
\else\ifcsname __zxjt_scale_tl\endcsname
\expandafter\let\expandafter\zxjf@scale
\csname __zxjt_scale_tl\endcsname
\fi\fi\fi
\fi
\ifx\zxjf@scale\relax % still unknown
% Try \Cjascale and \jsScale.
\ifdefined\Cjascale \let\zxjf@scale\Cjascale
\else\ifdefined\jsScale \let\zxjf@scale\jsScale
\fi\fi
\fi
\ifx\zxjf@scale\relax % still unknown
\def\zxjf@scale{1}%
\fi
\fi
\edef\zxjf@xfeat{Scale=\zxjf@scale,\zxjf@feat}
\zxjf@debug{scale=\zxjf@scale/feat={\zxjf@feat}/%
preset=\zxjf@main@preset/\zxjf@sub@preset}
%%-------- preset japanese font mappings
%% \zxjf@setmainfont{<attributes>}{<fam_name>}, etc.
\ifzxjf@zxjatype
\def\zxjf@setmainfont#1{\setjamainfont[\zxjf@xfeat,#1]}
\def\zxjf@setsansfont#1{\setjasansfont[\zxjf@xfeat,#1]}
\def\zxjf@setmonofont#1{\setjamonofont[\zxjf@xfeat,#1]}
\def\zxjf@newfamily#1#2#3{%
\expandafter\def\csname #1family\expandafter\endcsname\expandafter
{\csname a#1family\endcsname\CJKfamily{#1}}%
\expandafter\newfontfamily\csname a#1family\endcsname[\zxjf@feat,#2]{#3}%
\setjafamilyfont{#1}[\zxjf@xfeat,#2]{#3}}
\else
\def\zxjf@setmainfont#1{\setmainfont[\zxjf@xfeat,#1]}
\def\zxjf@setsansfont#1{\setsansfont[\zxjf@xfeat,#1]}
\def\zxjf@setmonofont#1{\setmonofont[\zxjf@xfeat,#1]}
\def\zxjf@newfamily#1#2{%
\expandafter\newfontfamily\csname #1family\endcsname[\zxjf@xfeat,#2]}
\fi
%% \zxjf@declare@preset{<name>}{<text>}, etc.
\def\zxjf@declare@preset#1{%
\expandafter\zxjf@decl@preset@a\csname zxjf@the@preset@#1\endcsname}
\def\zxjf@decl@preset@a#1{\@onlypreamble#1\def#1}
\@onlypreamble\zxjf@uniweight
\def\zxjf@uniweight#1#2{%
\zxjf@uniweight@opt{#1}{#2}{}}
\@onlypreamble\zxjf@uniweight@opt
\def\zxjf@uniweight@opt#1#2#3{%
\zxjf@setmainfont{#3,BoldFont=#2}{#1}%
\zxjf@setsansfont{#3}{#2}%
\zxjf@setmonofont{#3}{#2}}
\@onlypreamble\zxjf@multiweight
\def\zxjf@multiweight#1#2#3#4#5{%
\zxjf@multiweight@opt{#1}{#2}{#3}{#4}{#5}{}}
\@onlypreamble\zxjf@multiweight@opt
\def\zxjf@multiweight@opt#1#2#3#4#5#6{%
\ifzxjf@oneweight
\zxjf@setmainfont{#6,BoldFont=#5}{#1}%
\zxjf@setsansfont{#6}{#5}%
\zxjf@setmonofont{#6}{#5}%
\else
\zxjf@setmainfont{#6,BoldFont=#2}{#1}%
\zxjf@setsansfont{#6,BoldFont=#4}{#3}%
\zxjf@setmonofont{#6,BoldFont=#4}{#3}%
\fi}
%% \zxjf@declare@preset@alias{<name1>}{<name2>}
\def\zxjf@declare@preset@alias#1#2{%
\expandafter\let\csname zxjf@the@preset@#1\expandafter\endcsname
\csname zxjf@the@preset@#2\endcsname}
%% \zxjf@use@preset{<name>}
\def\zxjf@use@preset#1{%
\ifzxjf@prop \zxjf@use@preset@a{#1/prop}%
\else \let\zxjf@nxt\relax \fi
\ifx\zxjf@nxt\relax \zxjf@use@preset@a{#1}\fi
\zxjf@nxt}
\def\zxjf@use@preset@a#1{%
\expandafter\let\expandafter\zxjf@nxt
\csname zxjf@the@preset@#1\endcsname}
%% definitions of main preset mappings
\zxjf@declare@preset{ms}{%
\zxjf@uniweight{MS-Mincho}{MS-Gothic}}
\zxjf@declare@preset{ms/prop}{%
\zxjf@uniweight{MS-PMincho}{MS-PGothic}}
\zxjf@declare@preset{ms-hg}{%
\zxjf@multiweight{MS-Mincho}{HGMinchoE}%
{HGGothicM}{HGGothicE}{MS-Gothic}}
\zxjf@declare@preset{ms-hg/prop}{%
\zxjf@multiweight{MS-PMincho}{HGPMinchoE}%
{HGPGothicM}{HGGothicE}{MS-PGothic}}
\zxjf@declare@preset{ipa}{%
\zxjf@uniweight{IPAMincho}{IPAGothic}}
\zxjf@declare@preset{ipa/prop}{%
\zxjf@uniweight{IPAPMincho}{IPAPGothic}}
\zxjf@declare@preset{ipa-hg}{%
\zxjf@multiweight{IPAMincho}{HGMinchoE}%
{HGGothicM}{HGGothicE}{IPAGothic}}
\zxjf@declare@preset{ipa-hg/prop}{%
\zxjf@multiweight{IPAPMincho}{HGPMinchoE}%
{HGPGothicM}{HGGothicE}{IPAPGothic}}
\zxjf@declare@preset{ipaex}{%
\zxjf@uniweight{IPAexMincho}{IPAexGothic}}
\zxjf@declare@preset{ipaex-hg}{%
\zxjf@multiweight{IPAexMincho}{HGSMinchoE}%
{HGSGothicM}{HGSGothicE}{IPAexGothic}}
\zxjf@declare@preset{moga}{%
\zxjf@multiweight{MogaExMincho}{MogaExMincho Bold}%
{MogaExGothic}{MogaExGothic Bold}{MogaExGothic}}
\zxjf@declare@preset{moga-90}{%
\zxjf@multiweight{MogaEx90Mincho}{MogaEx90Mincho Bold}%
{MogaEx90Gothic}{MogaEx90Gothic Bold}{MogaEx90Gothic}}
\zxjf@declare@preset{kozuka-pro}{%
\zxjf@multiweight@opt{KozMinPro-Regular}{KozMinPro-Bold}%
{KozGoPro-Regular}{KozGoPro-Bold}%
{KozGoPro-Medium}{RawFeature=-palt;-kern}}
\zxjf@declare@preset{kozuka-pro/prop}{%
\zxjf@multiweight@opt{KozMinPro-Regular}{KozMinPro-Bold}%
{KozGoPro-Regular}{KozGoPro-Bold}%
{KozGoPro-Medium}{RawFeature=+palt;+kern}}
\zxjf@declare@preset{kozuka-pr6}{%
\zxjf@multiweight@opt{KozMinProVI-Regular}{KozMinProVI-Bold}%
{KozGoProVI-Regular}{KozGoProVI-Bold}%
{KozGoProVI-Medium}{RawFeature=-palt;-kern}}
\zxjf@declare@preset{kozuka-pr6/prop}{%
\zxjf@multiweight@opt{KozMinProVI-Regular}{KozMinProVI-Bold}%
{KozGoProVI-Regular}{KozGoProVI-Bold}%
{KozGoProVI-Medium}{RawFeature=+palt;+kern}}
\zxjf@declare@preset{kozuka-pr6n}{%
\zxjf@multiweight@opt{KozMinPr6N-Regular}{KozMinPr6N-Bold}%
{KozGoPr6N-Regular}{KozGoPr6N-Bold}%
{KozGoPr6N-Medium}{RawFeature=-palt;-kern}}
\zxjf@declare@preset{kozuka-pr6n/prop}{%
\zxjf@multiweight@opt{KozMinPr6N-Regular}{KozMinPr6N-Bold}%
{KozGoPr6N-Regular}{KozGoPr6N-Bold}%
{KozGoPr6N-Medium}{RawFeature=+palt;+kern}}
\zxjf@declare@preset{hiragino-pro}{%
\zxjf@multiweight@opt{Hiragino Mincho Pro W3}{Hiragino Mincho Pro W6}%
{Hiragino Kaku Gothic Pro W3}{Hiragino Kaku Gothic Pro W6}%
{Hiragino Kaku Gothic Pro W6}{RawFeature=-palt;-kern}}
\zxjf@declare@preset{hiragino-pro/prop}{%
\zxjf@multiweight@opt{Hiragino Mincho Pro W3}{Hiragino Mincho Pro W6}%
{Hiragino Kaku Gothic Pro W3}{Hiragino Kaku Gothic Pro W6}%
{Hiragino Kaku Gothic Pro W6}{RawFeature=+palt;+kern}}
\zxjf@declare@preset{hiragino-pron}{%
\zxjf@multiweight@opt{Hiragino Mincho ProN W3}{Hiragino Mincho ProN W6}%
{Hiragino Kaku Gothic ProN W3}{Hiragino Kaku Gothic ProN W6}%
{Hiragino Kaku Gothic ProN W6}{RawFeature=-palt;-kern}}
\zxjf@declare@preset{hiragino-pron/prop}{%
\zxjf@multiweight@opt{Hiragino Mincho ProN W3}{Hiragino Mincho ProN W6}%
{Hiragino Kaku Gothic ProN W3}{Hiragino Kaku Gothic ProN W6}%
{Hiragino Kaku Gothic ProN W6}{RawFeature=+palt;+kern}}
\zxjf@declare@preset{morisawa-pro}{%
\zxjf@multiweight@opt{A-OTF-RyuminPro-Light.otf}{A-OTF-FutoMinA101Pro-Bold.otf}%
{A-OTF-GothicBBBPro-Medium.otf}{A-OTF-FutoGoB101Pro-Bold.otf}%
{A-OTF-GothicBBBPro-Medium.otf}{RawFeature=-palt;-kern}}
\zxjf@declare@preset{morisawa-pro/prop}{%
\zxjf@multiweight@opt{A-OTF-RyuminPro-Light.otf}{A-OTF-FutoMinA101Pro-Bold.otf}%
{A-OTF-GothicBBBPro-Medium.otf}{A-OTF-FutoGoB101Pro-Bold.otf}%
{A-OTF-GothicBBBPro-Medium.otf}{RawFeature=+palt;+kern}}
\zxjf@declare@preset{morisawa-pr6n}{%
\zxjf@multiweight@opt{A-OTF-RyuminPr6N-Light.otf}{A-OTF-FutoMinA101Pr6N-Bold.otf}%
{A-OTF-GothicBBBPr6N-Medium.otf}{A-OTF-FutoGoB101Pr6N-Bold.otf}%
{A-OTF-GothicBBBPr6N-Medium.otf}{RawFeature=-palt;-kern}}
\zxjf@declare@preset{morisawa-pr6n/prop}{%
\zxjf@multiweight@opt{A-OTF-RyuminPr6N-Light.otf}{A-OTF-FutoMinA101Pr6N-Bold.otf}%
{A-OTF-GothicBBBPr6N-Medium.otf}{A-OTF-FutoGoB101Pr6N-Bold.otf}%
{A-OTF-GothicBBBPr6N-Medium.otf}{RawFeature=+palt;+kern}}
\zxjf@declare@preset{yu-win}{%
\zxjf@multiweight@opt{YuMincho-Regular}{YuMincho-Demibold}%
{YuGothic-Regular}{YuGothic-Bold}%
{YuGothic-Regular}{RawFeature=-palt;-kern}}
\zxjf@declare@preset{yu-win/prop}{%
\zxjf@multiweight@opt{YuMincho-Regular}{YuMincho-Demibold}%
{YuGothic-Regular}{YuGothic-Bold}%
{YuGothic-Regular}{RawFeature=+palt;+kern}}
\zxjf@declare@preset{yu-osx}{%
\zxjf@multiweight@opt{YuMincho-Medium}{YuMincho-Demibold}%
{YuGothic-Medium}{YuGothic-Bold}%
{YuGothic-Medium}{RawFeature=-palt;-kern}}
\zxjf@declare@preset{yu-osx/prop}{%
\zxjf@multiweight@opt{YuMincho-Medium}{YuMincho-Demibold}%
{YuGothic-Medium}{YuGothic-Bold}%
{YuGothic-Medium}{RawFeature=+palt;+kern}}
%(obsolete)
\zxjf@declare@preset{kozuka4}{%
\zxjf@uniweight@opt{Kozuka Mincho Pro}{Kozuka Gothic Pro}%
{RawFeature=-palt;-kern}}
\zxjf@declare@preset{kozuka4/prop}{%
\zxjf@uniweight@opt{Kozuka Mincho Pro}{Kozuka Gothic Pro}%
{RawFeature=+palt;+kern}}
\zxjf@declare@preset{kozuka6}{%
\zxjf@uniweight@opt{Kozuka Mincho Pro-VI}{Kozuka Gothic Pro-VI}%
{RawFeature=-palt;-kern}}
\zxjf@declare@preset{kozuka6/prop}{%
\zxjf@uniweight@opt{Kozuka Mincho Pro-VI}{Kozuka Gothic Pro-VI}%
{RawFeature=+palt;+kern}}
\zxjf@declare@preset{kozuka6n}{%
\zxjf@uniweight@opt{Kozuka Mincho Pr6N}{Kozuka Gothic Pr6N}%
{RawFeature=-palt;-kern}}
\zxjf@declare@preset{kozuka6n/prop}{%
\zxjf@uniweight@opt{Kozuka Mincho Pr6N}{Kozuka Gothic Pr6N}%
{RawFeature=+palt;+kern}}
\zxjf@declare@preset{hiragino}{%
\zxjf@uniweight@opt{Hiragino Mincho Pro W3}{Hiragino Kaku Gothic Pro W6}%
{RawFeature=-palt;-kern}}
\zxjf@declare@preset{hiragino/prop}{%
\zxjf@uniweight@opt{Hiragino Mincho Pro W3}{Hiragino Kaku Gothic Pro W6}%
{RawFeature=+palt;+kern}}
%(alias)
\zxjf@declare@preset@alias{ms-dx}{ms-hg}
\zxjf@declare@preset@alias{ms-dx/prop}{ms-hg/prop}
\zxjf@declare@preset@alias{ipa-dx}{ipa-hg}
\zxjf@declare@preset@alias{ipa-dx/prop}{ipa-hg/prop}
\zxjf@declare@preset@alias{hiragino-dx}{hiragino-pro}
\zxjf@declare@preset@alias{hiragino-dx/prop}{hiragino-pro/prop}
\zxjf@declare@preset@alias{moga-mobo}{moga}
\zxjf@declare@preset{hg}{%
\zxjf@newfamily{hgmc}{BoldFont=HGSMinchoE}{HGSMinchoB}%
\zxjf@newfamily{hgpr}{}{HGSSoeiPresenceEB}%
\zxjf@newfamily{hggt}{BoldFont=HGSGothicE}{HGSGothicM}%
\zxjf@newfamily{hggu}{}{HGSSoeiKakugothicUB}%
\zxjf@newfamily{hgmg}{}{HGMaruGothicMPRO}%
\zxjf@newfamily{hgkk}{}{HGSKyokashotai}%
\zxjf@newfamily{hgks}{}{HGSeikaishotaiPRO}%
\zxjf@newfamily{hggs}{}{HGSGyoshotai}%
\zxjf@newfamily{hgpp}{}{HGSSoeiKakupoptai}%
}
\zxjf@declare@preset{hg/prop}{%
\zxjf@newfamily{hgmc}{BoldFont=HGPMinchoE}{HGPMinchoB}%
\zxjf@newfamily{hgpr}{}{HGPSoeiPresenceEB}%
\zxjf@newfamily{hggt}{BoldFont=HGPGothicE}{HGPGothicM}%
\zxjf@newfamily{hggu}{}{HGPSoeiKakugothicUB}%
\zxjf@newfamily{hgmg}{}{HGMaruGothicMPRO}%
\zxjf@newfamily{hgkk}{}{HGPKyokashotai}%
\zxjf@newfamily{hgks}{}{HGSeikaishotaiPRO}%
\zxjf@newfamily{hggs}{}{HGPGyoshotai}%
\zxjf@newfamily{hgpp}{}{HGPSoeiKakupoptai}%
}
\zxjf@declare@preset{hiraginomg-pro}{%
\zxjf@newfamily{hmg}{RawFeature=-palt;-kern}{Hiragino Maru Gothic Pro W4}}
\zxjf@declare@preset{hiraginomg-pro/prop}{%
\zxjf@newfamily{hmg}{RawFeature=+palt;+kern}{Hiragino Maru Gothic Pro W4}}
\zxjf@declare@preset{hiraginomg-pron}{%
\zxjf@newfamily{hmg}{RawFeature=-palt;-kern}{Hiragino Maru Gothic ProN W4}}
\zxjf@declare@preset{hiraginomg-pron/prop}{%
\zxjf@newfamily{hmg}{RawFeature=+palt;+kern}{Hiragino Maru Gothic ProN W4}}
\zxjf@declare@preset@alias{hiraginomg}{hiraginomg-pro}
\zxjf@declare@preset@alias{hiraginomg/prop}{hiraginomg-pro/prop}
\zxjf@declare@preset{mobo}{%
\zxjf@newfamily{mobo}{Bold=MoboExGothic Bold}{MoboExGothic}}
\zxjf@declare@preset{mobo-90}{%
\zxjf@newfamily{mobo}{Bold=MoboEx90Gothic Bold}{MoboEx90Gothic}}
\zxjf@declare@preset{maruberi}{%
\zxjf@newfamily{mmg}{}{MotoyaLMaru}}
%%%% ... and invokes the specified one!
\zxjf@use@preset{\zxjf@main@preset}
\@for\zxjf@x:=\zxjf@sub@preset\do{\zxjf@use@preset\zxjf@x}
%%------ and some extras
\def\useeasyjapanesesettings{%
\XeTeXlinebreaklocale "ja"\relax
\XeTeXlinebreakskip=0pt plus 1pt minus 0.1pt\relax
\XeTeXlinebreakpenalty=0\relax
}
%%------ all done
\endinput
%% EOF
|