jlreq icon indicating copy to clipboard operation
jlreq copied to clipboard

jlreq + \DeclareFontShape

Open h-kitagawa opened this issue 4 years ago • 1 comments

以下のように,jlreq 下で新たに \DeclareFontShape を使ってフォント定義を行うと,\selectfont した地点で ! LaTeX Error: Font JY3/hoge/m/n/10 not found. というエラーが発生します:

%#!lualatex
\documentclass{jlreq}
\DeclareKanjiFamily{JY3}{hoge}{}
\DeclareFontShape{JY3}{hoge}{m}{n}{<-> s*file:HaranoAjiMincho-Heavy.otf:jfm=ujis}{}
\makeatletter
%\jlreq@useoriginalcs{DeclareFontShape}{JY3}{hoge}{m}{n}{<-> s*file:HaranoAjiMincho-Heavy.otf:jfm=ujis}{}
% ==> OK
\makeatother
\kanjifamily{hoge}\selectfont % ==> ! LaTeX Error: Font JY3/hoge/m/n/10 not found.
\begin{document}
\end{document}
% LaTeX2e <2021-11-15>
% luatexja 2021-10-24
% jlreq 2021/11/05

オリジナルの\DeclareFontShapeでは

\def\DeclareFontShape{\begingroup
   \nfss@catcodes
   \expandafter\endgroup
   \DeclareFontShape@}

と catcode の変更後に引数を読んでいることを考えると,jlreq による \DeclareFontShape の再定義のところには \scantokens あたりが必要な気がしています.

h-kitagawa avatar Nov 27 '21 22:11 h-kitagawa

とりあえず\DeclareFontShape@の再定義に切り替えてみました( 1284baa ).本体の変更をおっかけないとならないのは変わらなそうなのでもっとさぼれないか考えてみます.

abenori avatar Nov 28 '21 07:11 abenori