%
% luatexja-fontspec.sty
%

\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{luatexja-fontspec}[2015/08/26 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{10}{10}\selectfont
\fp_gset:Nn \g_ltj_fontspec_scale_fp {\zw / 10}
\group_end:

\bool_new:N \ltj_fontspec_match
\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
\RequirePackage{luatexja-fontspec-24}

\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
