summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/luatex/luatexja/addons/luatexja-fontspec.sty
blob: 5ca4c48662b2663b643a384b3f30cfa63382ad22 (plain)
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
%
% luatexja-fontspec.sty
%

\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{luatexja-fontspec}[2017/01/23 fontspec support of LuaTeX-ja]
\RequirePackage{l3keys2e,luatexja}
\ExplSyntaxOn

%%%%%%%% \g_ltj_fontspec_scale_fp
%% Default scale value for jfont.
\fp_new:N \g_ltj_fontspec_scale_fp
\group_begin:
\fontsize{16}{16}\selectfont
\fp_gset:Nn \g_ltj_fontspec_scale_fp {\zw / 16}
\group_end:

\bool_new:N \ltj_fontspec_match_bool
\keys_define:nn { luatexja-fontspec }
  {
    match .bool_set:N = \ltj_fontspec_match_bool,
    match .default:n  = true,
    pass .code:n = \PassOptionsToPackage{#1} {fontspec},
      % 互換性のために残したオプション
    scale .fp_gset:N = \g_ltj_fontspec_scale_fp,
    unknown .code:n = \PassOptionsToPackage { \l_keys_key_tl } {fontspec},
  }
\ProcessKeysOptions{ luatexja-fontspec }
\RequirePackage{fontspec}[2014/06/01]% v2.4
\@ifpackagelater{fontspec}{2017/01/01}%
  {\RequirePackage{luatexja-fontspec-25c}}% v2.5c
  {\RequirePackage{luatexja-fontspec-24}}% --v2.5a

\ExplSyntaxOff
%%%%%%%% Now we completely ignore kanjifont definition file.
\def\@ltj@use@fd{false}

% We must redefine \try@load@fontshape to ignore kanjifont definitions at all.
\def\try@load@fontshape{%
   \expandafter
   \ifx\csname \f@encoding+\f@family\endcsname\relax
       \directlua{luatexja.jfont.is_kenc('\luatexluaescapestring{\f@encoding}')}%
\ifin@\else % Alphabetic font
    \@font@info{Try loading font information for \f@encoding+\f@family}%
    \global\expandafter\let
       \csname\f@encoding+\f@family\endcsname\@empty
     \nfss@catcodes
     \let\nfss@catcodes\relax
     \edef\reserved@a{%
       \lowercase{%
         \noexpand\InputIfFileExists{\f@encoding\f@family.fd}}}%
     \reserved@a\relax
          {\@input@{\f@encoding\f@family.fd}}%
\fi
   \fi}

\endinput