OSDN Git Service

Removed the process of searching kanjifont definition file in \fontfamily.
[luatex-ja/luatexja.git] / src / luatexja-fontspec.sty
1 %
2 % luatexja-fontspec.sty
3 %
4
5 \NeedsTeXFormat{LaTeX2e}
6 \ProvidesPackage{luatexja-fontspec}[2011/08/17 v0.1]
7
8 \RequirePackage{luatexja,fontspec}
9
10 \ExplSyntaxOn
11
12 \define@key[zf]{options}{JFM}{
13   \fontspec_update_fontid:n  {+jfm=#1}
14   \fontspec_update_featstr:n {jfm=#1}
15 }
16
17 \cs_new:Nn \ltj_fontspec_select:nn {
18   \group_begin:
19   \tl_set:Nn \zf@enc {JY3}
20   \cs_set_eq:NN \DeclareFontFamily \DeclareKanjiFamily
21   \fontspec_select:nn{JFM=ujis,#1}{#2}
22   \group_end:
23 }
24
25 \cs_new:Nn \ltj_fontspec_set_family:Nnn {
26   \ltj_fontspec_select:nn{#2}{#3}
27   \tl_set_eq:NN #1 \zf@family
28 }
29
30 \DeclareDocumentCommand \jfontspec { O{} m } {
31   \ltj_fontspec_set_family:Nnn \k@family {#1}{#2}
32   \selectfont
33   \ignorespaces
34 }
35
36 \DeclareDocumentCommand \setmainjfont { O{} m } {
37   \ltj_fontspec_set_family:Nnn \mcdefault {#1}{#2}
38   \normalfont
39 }
40
41 \DeclareDocumentCommand \setsansjfont { O{} m } {
42   \ltj_fontspec_set_family:Nnn \gtdefault {#1}{#2}
43   \normalfont
44 }
45
46 \DeclareDocumentCommand \newjfontfamily { m O{} m } {
47   \ltj_fontspec_select:nn{#2}{#3}
48   \use:x {
49     \exp_not:N \DeclareRobustCommand \exp_not:N #1 {
50       \exp_not:N \kanjifamily {\zf@family} \exp_not:N \selectfont
51     }
52   }
53 }
54
55 \endinput