OSDN Git Service

Target release date: 2019-11-17
[luatex-ja/luatexja.git] / src / addons / luatexja-fontspec.sty
1 %
2 % luatexja-fontspec.sty
3 %
4
5 \NeedsTeXFormat{LaTeX2e}
6 \ProvidesPackage{luatexja-fontspec}[2019/09/26 fontspec support of LuaTeX-ja]
7 \RequirePackage{l3keys2e,luatexja}
8 \ExplSyntaxOn
9
10 \cs_if_exist:NF \Cjascale {
11   %% Default scale value for jfont.
12   \group_begin:
13   \fontsize{16}{16}\selectfont
14   \cs_gset:Npx \Cjascale { \fp_to_decimal:n {\zw / 16} }
15   \group_end:
16 }
17
18 \bool_new:N \__ltj_fontspec_match_bool
19 \keys_define:nn { luatexja-fontspec }
20   {
21     match .bool_set:N = \__ltj_fontspec_match_bool,
22     match .default:n  = true,
23     pass .code:n = \PassOptionsToPackage{#1} {fontspec},
24       % 互換性のために残したオプション
25     scale .code:n = \gdef\Cjascale{#1},
26     unknown .code:n = \PassOptionsToPackage { \l_keys_key_tl } {fontspec},
27   }
28 \ProcessKeysOptions{ luatexja-fontspec }
29
30 \RequirePackage{fontspec}[2019/03/15]% v2.7c
31 \RequirePackage{luatexja-fontspec-27c} % v2.7c
32
33 \ExplSyntaxOff
34 %%%%%%%% Now we completely ignore kanjifont definition file.
35 \def\@ltj@use@fd{false}
36
37 % We must redefine \try@load@fontshape to ignore kanjifont definitions at all.
38 \def\try@load@fontshape{%
39    \expandafter
40    \ifx\csname \f@encoding+\f@family\endcsname\relax
41        \directlua{luatexja.jfont.is_kenc('\luatexluaescapestring{\f@encoding}')}%
42 \ifin@\else % Alphabetic font
43     \@font@info{Trying loading font information for \f@encoding+\f@family}%
44     \global\expandafter\let
45        \csname\f@encoding+\f@family\endcsname\@empty
46      \nfss@catcodes
47      \let\nfss@catcodes\relax
48      \edef\reserved@a{%
49        \lowercase{%
50          \noexpand\InputIfFileExists{\f@encoding\f@family.fd}}}%
51      \reserved@a\relax
52           {\@input@{\f@encoding\f@family.fd}}%
53 \fi
54    \fi}
55
56 \endinput