Last active
March 14, 2020 09:35
-
-
Save aminophen/935a0dab65096ebbc26fa6f50739fb16 to your computer and use it in GitHub Desktop.
pLaTeX: 和文フォントの警告を消す
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\makeatletter | |
% | |
\newif\if@shape@roman@kanji | |
% | |
\DeclareRobustCommand\romanshape[1]{\merge@font@shape{#1}} | |
\DeclareRobustCommand\kanjishape[1]{\merge@kanji@shape{#1}} | |
\DeclareRobustCommand\fontshape[1]{% | |
\@shape@roman@kanjitrue | |
\kanjishape{#1}\romanshape{#1}% | |
\@shape@roman@kanjifalse} | |
% | |
\DeclareRobustCommand\romanshapeforce[1]{\edef\f@shape{#1}} | |
\DeclareRobustCommand\kanjishapeforce[1]{\edef\k@shape{#1}} | |
\DeclareRobustCommand\fontshapeforce[1]{% | |
\set@safe@kanji@shape{#1}{}% | |
\edef\f@shape{#1}% | |
} | |
% | |
\def\merge@kanji@shape@#1#2#3\@nil{% | |
\def\reserved@a{#3}% | |
\ifx\reserved@a\@empty | |
%%% new code BEGIN | |
\if@shape@roman@kanji | |
\set@safe@kanji@shape{#2}{}% | |
\else | |
%%% new code END | |
\edef\k@shape{#2}% | |
%%% new code BEGIN | |
\fi | |
%%% new code END | |
\else | |
\begingroup\let\f@encoding\k@encoding\let\f@family\k@family | |
\maybe@load@fontshape\endgroup | |
\edef\reserved@a{\k@encoding /\k@family /\k@series/#1}% | |
\ifcsname \reserved@a\endcsname | |
\edef\k@shape{#1}% | |
\else | |
\ifcsname \k@encoding /\k@family /\k@series/#2\endcsname | |
\edef\k@shape{#2}% | |
{\let\curr@fontshape\curr@kfontshape\@font@shape@subst@warning}% | |
\else | |
%%% new code BEGIN | |
\if@shape@roman@kanji | |
\set@safe@kanji@shape{#3} | |
{{\let\curr@fontshape\curr@kfontshape\@font@shape@subst@warning}}% | |
\else | |
%%% new code END | |
\edef\k@shape{#3}% | |
{\let\curr@fontshape\curr@kfontshape\@font@shape@subst@warning}% | |
%%% new code BEGIN | |
\fi | |
%%% new code END | |
\fi | |
\fi | |
\fi | |
} | |
% | |
\def\set@safe@kanji@shape#1#2{% | |
\edef\reserved@b{\k@encoding /\k@family /\k@series/#1}% | |
\ifcsname \reserved@b\endcsname | |
\edef\k@shape{#1}% | |
#2% | |
\else | |
\@font@info{Kanji font shape `\reserved@b' undefined\MessageBreak | |
No change}% | |
\fi | |
} | |
\makeatother | |
\documentclass{article} | |
\begin{document} | |
{\itshape a} | |
% 内部で \fontshape が欧文と和文の両方を変えようとする | |
% => 和文の変更に失敗しても警告は出したくない | |
{\fontshape{ait} | |
\selectfont} | |
% \fontshape は欧文と和文の両方を変えようとする | |
% => 和文の変更に失敗しても警告は出したくない | |
{\fontshapeforce{asl} | |
\selectfont} | |
% \fontshapeforce は欧文と和文の両方を変えようとする | |
% => 和文の変更に失敗しても警告は出したくない | |
{\kanjishape{kit} | |
\selectfont} | |
% \kanjishape は和文だけを変更 => 警告すべき | |
{\kanjishapeforce{ksl} | |
\selectfont} | |
% \kanjishapeforce は和文だけを変更 => 警告すべき | |
{\usefont{JY1}{mc}{m}{ksc}} | |
% \usefont は encoding に応じて \useroman と \usekanji の一方だけを実行 | |
% この例は和文横組フォントだけを変えることを意図 => 警告すべき | |
{\fontshape{asc} | |
\selectfont} | |
% \fontshape は欧文と和文の両方を変えようとする | |
% => 和文の変更に失敗しても警告は出したくない | |
{\fontshapeforce{asw} | |
\selectfont} | |
% \fontshapeforce は欧文と和文の両方を変えようとする | |
% => 和文の変更に失敗しても警告は出したくない | |
\end{document} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
texjporg/platex#90 参照。