OSDN Git Service

Support \ltjgetparameter{linestep_factor} and \ltjgetparameter{profile_hgap_factor}
[luatex-ja/luatexja.git] / src / addons / luatexja-fontspec.sty
1 %
2 % luatexja-fontspec.sty
3 %
4
5 \NeedsTeXFormat{LaTeX2e}
6 \ProvidesPackage{luatexja-fontspec}[2018/09/01 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}[2017/01/01]% v2.5c
31 \@ifpackagelater{fontspec}{2018/07/29}%
32   {\RequirePackage{luatexja-fontspec-26h}}% v2.6h
33   {\RequirePackage{luatexja-fontspec-25c}}% v2.5c
34
35 \ExplSyntaxOff
36 %%%%%%%% Now we completely ignore kanjifont definition file.
37 \def\@ltj@use@fd{false}
38
39 % We must redefine \try@load@fontshape to ignore kanjifont definitions at all.
40 \def\try@load@fontshape{%
41    \expandafter
42    \ifx\csname \f@encoding+\f@family\endcsname\relax
43        \directlua{luatexja.jfont.is_kenc('\luatexluaescapestring{\f@encoding}')}%
44 \ifin@\else % Alphabetic font
45     \@font@info{Try loading font information for \f@encoding+\f@family}%
46     \global\expandafter\let
47        \csname\f@encoding+\f@family\endcsname\@empty
48      \nfss@catcodes
49      \let\nfss@catcodes\relax
50      \edef\reserved@a{%
51        \lowercase{%
52          \noexpand\InputIfFileExists{\f@encoding\f@family.fd}}}%
53      \reserved@a\relax
54           {\@input@{\f@encoding\f@family.fd}}%
55 \fi
56    \fi}
57
58 \endinput