summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/luatex/luatexja/addons/luatexja-fontspec.sty
blob: e98fbc7b9524e6705a1a0b6c21011f393b57d1de (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
58
59
60
%
% luatexja-fontspec.sty
%

\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{luatexja-fontspec}[2019/03/20 fontspec support of LuaTeX-ja]
\RequirePackage{l3keys2e,luatexja}
\ExplSyntaxOn

\cs_if_exist:NF \Cjascale {
  %% Default scale value for jfont.
  \group_begin:
  \fontsize{16}{16}\selectfont
  \cs_gset:Npx \Cjascale { \fp_to_decimal:n {\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 .code:n = \gdef\Cjascale{#1},
    unknown .code:n = \PassOptionsToPackage { \l_keys_key_tl } {fontspec},
  }
\ProcessKeysOptions{ luatexja-fontspec }

\RequirePackage{fontspec}[2017/01/01]% v2.5c
\@ifpackagelater{fontspec}{2018/07/29}%
  {\@ifpackagelater{fontspec}{2019/03/15}%
    {\RequirePackage{luatexja-fontspec-27c}} % v2.7c
    {\RequirePackage{luatexja-fontspec-26h}}}% v2.6h
  {\RequirePackage{luatexja-fontspec-25c}}   % v2.5c

\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