%#! lualatex
\directlua{luatexja_debug=1}
\documentclass{ltjsarticle}
%\nonstopmode

\makeatletter

% for test
\DeclareTextFontCommand{\textix}{\fontshape{ix}\selectfont}
\DeclareFontFamily{OT1}{hoge}{}\DeclareFontShape{OT1}{hoge}{m}{n}{<-> pagk7t}{}
\DeclareKanjiFamily{JY3}{hoge}{}
\DeclareFontShape{JY3}{hoge}{m}{n}{<-> file:ipaexg.ttf:jfm=ujis}{}

\DeclareFontSubstitution{OT1}{cmss}{m}{n}

\makeatother
\begin{document}
\section{NFSS2 のテスト}

◆あいうえおabcかきく{\gt かきくa{\bf uyあ}いう}

{\ltjsetparameter{xkanjiskip=0pt}イタリック補正\textit{f}◆{\it f\/}◆\par}

\DeclareFixedFont{\dr}{JY3}{gt}{m}{n}{12}
あいうえおpqr{\dr かaiu}きく）{\bf （漢字}

{abcdfghjfgあいう辻）\textbf{（辻あ{\Large あ}いう）}}

{abcdfghjfgあいう辻）\textbf{\unkern（辻あ{\Large あ}いう}}

\noindent{\tiny ◆あいうえおabcかきく{\gt かきくa{\bf uyあ}いう}}

\noindent{\scriptsize ◆あいうえおabcかきく{\gt かきくa{\bf uyあ}いう}}

\noindent{\footnotesize ◆あいうえおabcかきく{\gt かきくa{\bf uyあ}いう}}

\noindent{\small ◆あいうえおabcかきく{\gt かきくa{\bf uyあ}いう}}

\noindent{\normalsize ◆あいうえおabcかきく{\gt かきくa{\bf uyあ}いう}}

\noindent{\large ◆あいうえおabcかきく{\gt かきくa{\bf uyあ}いう}}

\noindent{\Large ◆あいうえおabcかきく{\gt かきくa{\bf uyあ}いう}}

\noindent{\LARGE ◆あいうえおabcかきく{\gt かきくa{\bf uyあ}いう}}


\makeatletter
RM {\rmfamily (\f@family, \k@family) XYZかきく}\par
SF {\sffamily (\f@family, \k@family) XYZかきく}\par
TT {\ttfamily (\f@family, \k@family) XYZかきく}\verb+あいうABC+\par

\^{A}V\^{A}T\^{A}R

\usefont{OT1}{cmr}{m}{n} \^{A}V\^{A}T\^{A}R

\section{slanted, extended}
\DeclareFontShape{JY3}{mc}{m}{sl}{<-> s*[0.962216] 
  psft:Ryumin-Light:slant=0.25;jfm=ujiso25}{}
\DeclareFontShape{JY3}{mc}{x}{n}{<-> s*[0.962216] 
  psft:Ryumin-Light:extend=1.5;jfm=ujisx50}{}
\DeclareFontShape{JY3}{gt}{m}{sl}{<-> s*[0.962216] 
  file:ipam.ttf:slant=0.25;jfm=ujiso25}{}
\DeclareFontShape{JY3}{gt}{x}{n}{<-> s*[0.962216] 
  file:ipag.ttf:extend=1.5;jfm=ujisx50}{}

% for test
\DeclareFontShape{JY3}{gt}{m}{ix}{<-> s*[0.962216] 
  file:ipag.ttf:slant=0.25;jfm=ujiso25}{}

\paragraph{psft prefix でもOK?}\ 

\textsl{日本語の機械的な斜体}直立，
\textsl{あいう■\textup{■え■■}■おかき}

{\fontfamily{mc}\fontseries{x}\selectfont あいう}

\paragraph{TTF, OTFではOK}\ 

\textgt{\textsl{日本語の機械的な斜体}直立，
\textsl{あいう■\textup{■え■■}■おかき}}

{\fontfamily{gt}\fontseries{x}\selectfont あいう}

\end{document}

\paragraph{italic correction inserted by {\tt\char92text...}}\

font series `ix': 欧文は未定義，和文は機械的斜体．

{\gt■\textix{■あabcい■\textup{■うxyzえ■■}■おpqrか■}■}

{\gt■f\textix{f■あい■f\textup{f■うえ■■f}f■おか■f}f■}

イタリック補正なし：{\gt {\slshape ■}■}
イタリック補正あり：{\gt {\slshape ■\/}■}

\newpage{\obeylines\tt
\setbox0=\hbox{\gt\textsl{あいう■\textup{■え■}■おかき}}
\directlua{luatexja.ext_show_node_list(tex.box[0].head, '', tex.print)}\par}

\bigskip

正しい補正量：$0.962216\times 10 \times 0.88\times 0.25 \simeq
\directlua{tex.print(0.962216*10*0.88*0.25)}\,\textrm{pt}$

\paragraph{fontfamily}\
\makeatletter
\def\TEST#1{\par{\fontfamily{#1}\selectfont あいうabc: font\hfill(#1: \k@family, \f@family)}}

\gt
\TEST{mc}
\TEST{fuga}
\TEST{fuga}
\TEST{mc}

{\fontfamily{hoge}\selectfont あいうabc: font\hfill(\k@family, \f@family)}

{\romanfamily{hoge}\selectfont あいうabc: roman\hfill(\k@family, \f@family)}

{\kanjifamily{hoge}\selectfont あいうabc: kanji\hfill(\k@family, \f@family)}

\TEST{mc}
\TEST{ptm}
\TEST{ptm}

\makeatletter
\let\@@fontfamily=\fontfamily
\def\fontfamily#1{(\k@family, \f@family)\@@fontfamily{#1}(\k@family, \f@family)}

あい{うえお\texttt{abc}\globaldefs1あ\/い}うえお

あいうえお{\tt abc}あいうえお

\paragraph{font definition file}

{\fontfamily{afdtest}\selectfont abcあいう
\fontfamily{kfdtest}\selectfont abcあいう}\par

A
\fontfamily{kfdtest}\selectfont abcあいう



\end{document}
