From 0d4cabde0e301b63631e876116e5743e294bcdb0 Mon Sep 17 00:00:00 2001 From: Hironori Kitagawa Date: Tue, 1 Jan 2013 21:43:46 +0900 Subject: [PATCH] Revert 1b1d3c3 and 3b2bba1. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 2コミットの内容を luatexja-fontspec.sty に移動させるための準備. 実際の移動は kitagawa_jfont_fd branch で行う予定であり, この revert commit では単に a72f9fa と同じ状況になっているはず. --- doc/luatexja.dtx | 56 ++++++++++++-------------------- src/patches/lltjfont.sty | 83 +++++++++++++++++------------------------------- 2 files changed, 50 insertions(+), 89 deletions(-) diff --git a/doc/luatexja.dtx b/doc/luatexja.dtx index 85b990a..c57030f 100644 --- a/doc/luatexja.dtx +++ b/doc/luatexja.dtx @@ -4409,7 +4409,7 @@ Like \verb+\fontfamily+, \verb+\selectfont+ is required to take an effect. \item[adjustbaseline] \ldots -\item[fontfamily\{\}] +\item[fontfamily\{\}] {\let\item\origitem %<*en> As in \LaTeXe, this command changes current font family (alphabetic, Japanese,~\emph{or both}) @@ -4427,75 +4427,59 @@ to . Which family will be changed is determined as follows: %<*en> \item Let current encoding scheme for Japanese fonts be . Current Japanese font family will be changed to - , if the family under the encoding has been already defined by - \verb+\DeclareKanijFamily+. + , if one of the following two conditions is met: % %<*ja> \item 現在の和文フォントに対するエンコーディングがであるとしよう. - 現在の和文フォントファミリは,エンコーディングにおけるファミリが - 既に \verb+\DeclareKanjiFamily+ によって定義されているときにに変更される. -% -%<*en> -\item Let current encoding scheme for alphabetic fonts be - . Current Alphabetic font family will be changed to - , if one of the following two conditions is met -% -%<*ja> -\item 現在の欧文フォントに対するエンコーディングをとする. - 現在の欧文フォントファミリは,以下の2つの条件のうちの1つが満たされているときに - に変更される: + 現在の和文フォントファミリは,以下の2つの条件のうちの1つが満たされているときに + に変更される: % \begin{itemize} %<*en> -\item The family under the encoding has been already defined by - \verb+\DeclareFontFamily+. +\item The family under the encoding has been already defined by + \verb+\DeclareKanijFamily+. % %<*ja> -\item エンコーディングにおけるファミリが - 既に \verb+\DeclareFontFamily+ によって定義されている. +\item エンコーディングにおけるファミリが既に \verb+\DeclareKanjiFamily+ によって定義されている. % %<*en> -\item A font definition named \texttt{.fd} exists. +\item A font definition named \texttt{.fd} (the file name is + all lowercase) exists. % %<*zh> \item % %<*ja> -\item フォント定義ファイル \texttt{.fd} が存在する. +\item フォント定義ファイル\texttt{.fd}(ファイル名は全て小文字)が存在する. % \end{itemize} %<*en> +\item Let current encoding scheme for alphabetic fonts be + . For alphabetic font family, the criterion as above is used. +% +%<*ja> +\item 現在の欧文フォントに対するエンコーディングをとする. + 欧文フォントファミリに対しても,上記の基準が用いられる. +% +%<*en> \item There is a case which none of the above applies, that is, the font family named doesn't seem to be defined neither under the encoding , nor under . In this case, the default family for font substitution is used for alphabetic and Japanese fonts. Note that current encoding will not - be set to , unlike the original implementation in \LaTeX. + be set to , unlike the original implementation in \LaTeX. % %<*ja> \item 上記のいずれもが適用されない,つまりがとの どちらでも定義されないような場合がある. この場合,代替フォントに用いられるデフォルトのフォントファミリが欧文フォントと 和文フォントに用いられる.\LaTeX のオリジナルの実装とは異なり, - 現在のエンコーディングはには設定されないことに注意する. + 現在のエンコーディングはには設定されないことに注意する. % \end{itemize} } \end{cslist} - \verb+\fontfamily+ によって和文フォントファミリを変更するかどうかの決定には, - フォント定義ファイル \texttt{*.fd} が一切関わらないことに注意. - これは「\Pkg{fontspec}パッケージの普及により,\texttt{*.fd} の使用は - 徐々にされなくなっていくであろう」という勝手な予測に基づいている. - また,\verb+\kanjifamily+ で和文フォントファミリを変更した場合でも, - \verb+\selectfont+ によって\emph{実際に}変更が反映される際には - 和文フォント定義ファイル \texttt{*.fd} は読み込まれない. -%%%% OLD: -%%%% 和文フォント用の \texttt{*.fd} をどうしても用いたい場合% -%%%% \footnote{例えば,3ウェイト以上を1ファミリにまとめたい場合など.}には, -%%%% \verb+\fontfamily+ の代わりに \verb+\kanjifamily+ を用いて -%%%% 和文フォントファミリを切り替えれば良い. - %<*en> As closing this subsection, we shall introduce an example of \verb+\SetRelationFont+ and \verb+\userelfont+: diff --git a/src/patches/lltjfont.sty b/src/patches/lltjfont.sty index 454683f..936b625 100644 --- a/src/patches/lltjfont.sty +++ b/src/patches/lltjfont.sty @@ -444,34 +444,35 @@ \newif\if@tempswz \DeclareRobustCommand\romanfamily[1]{\edef\f@family{#1}} \DeclareRobustCommand\kanjifamily[1]{\edef\k@family{#1}} +% \notkfam@list@: list of non-defined kanji families under +% \kfam@list@: list of kanji families under , defined in a .fd file \DeclareRobustCommand\fontfamily[1]{% \@notkfamfalse\@notffamfalse\edef\tmp@item{{#1}}% \ifcsname \k@encoding+#1\endcsname % if \k@encoding+#1 is already defined \edef\k@family{#1}% - \else - \@notkfamtrue - % \ifcsname kfam@list@\k@encoding\endcsname\else - % \expandafter\gdef\csname kfam@list@\k@encoding\endcsname{}% - % \expandafter\gdef\csname notkfam@list@\k@encoding\endcsname{}% - % \fi - % \edef\@templist{\@nameuse{kfam@list@\k@encoding}}% - % \expandafter\expandafter\expandafter\inlist@\expandafter\tmp@item\expandafter{\@templist}% - % \ifin@\edef\k@family{#1}\else% - % \edef\@templist{\@nameuse{notkfam@list@\k@encoding}}% - % \expandafter\expandafter\expandafter\inlist@\expandafter\tmp@item\expandafter{\@templist}% - % \ifin@\@notkfamtrue\else% - % \def\@temp##1+{\lowercase{\def\@@temp{##1}}}\expandafter\@temp\k@encoding+% - % \message{(I search kanjifont definition file: \@@temp#1.fd)}% - % \IfFileExists{\@@temp#1.fd}{\@tempswztrue}{\@tempswzfalse}% - % \if@tempswz - % \expandafter\xdef\csname kfam@list@\k@encoding\endcsname - % {\@nameuse{kfam@list@\k@encoding}\fam@elt<#1>}\edef\k@family{#1}% - % \else - % \expandafter\xdef\csname notkfam@list@\k@encoding\endcsname - % {\@nameuse{notkfam@list@\k@encoding}\fam@elt<#1>}\@notkfamtrue% - % \fi - % \fi - % \fi + \else % search font definition file... + \ifcsname kfam@list@\k@encoding\endcsname\else + \expandafter\gdef\csname kfam@list@\k@encoding\endcsname{}% + \expandafter\gdef\csname notkfam@list@\k@encoding\endcsname{}% + \fi + \edef\@templist{\@nameuse{kfam@list@\k@encoding}}% + \expandafter\expandafter\expandafter\inlist@\expandafter\tmp@item\expandafter{\@templist}% + \ifin@\edef\k@family{#1}\else% + \edef\@templist{\@nameuse{notkfam@list@\k@encoding}}% + \expandafter\expandafter\expandafter\inlist@\expandafter\tmp@item\expandafter{\@templist}% + \ifin@\@notkfamtrue\else% + \def\@temp##1+{\lowercase{\def\@@temp{##1}}}\expandafter\@temp\k@encoding+% + \message{(I search kanjifont definition file: \@@temp#1.fd)}% + \IfFileExists{\@@temp#1.fd}{\@tempswztrue}{\@tempswzfalse}% + \if@tempswz + \expandafter\xdef\csname kfam@list@\k@encoding\endcsname + {\@nameuse{kfam@list@\k@encoding}\fam@elt<#1>}\edef\k@family{#1}% + \else + \expandafter\xdef\csname notkfam@list@\k@encoding\endcsname + {\@nameuse{notkfam@list@\k@encoding}\fam@elt<#1>}\@notkfamtrue% + \fi + \fi + \fi \fi \ifcsname \f@encoding+#1\endcsname \edef\f@family{#1}% @@ -486,9 +487,9 @@ \edef\@templist{\@nameuse{notffam@list@\f@encoding}}% \expandafter\expandafter\expandafter\inlist@\expandafter\tmp@item\expandafter{\@templist}% \ifin@\@notffamtrue\else - \def\@temp##1+{\lowercase{\def\@@temp{##1#1.fd}}}\expandafter\@temp\f@encoding+% - \message{(I search font definition file. \@@temp)}% - \IfFileExists{\@@temp}{\@tempswztrue}{\@tempswzfalse}% + \def\@temp##1+{\lowercase{\def\@@temp{##1}}}\expandafter\@temp\f@encoding+% + \message{(I search font definition file: \@@temp#1.fd)}% + \IfFileExists{\@@temp#1.fd}{\@tempswztrue}{\@tempswzfalse}% \if@tempswz \expandafter\xdef\csname ffam@list@\f@encoding\endcsname {\@nameuse{ffam@list@\f@encoding}\fam@elt<#1>}\edef\f@family{#1}% @@ -562,32 +563,6 @@ \vbox{\hrule\@width.3em}} %%%%%% LuaTeX-ja specific -\def\try@load@fontshape{% - \expandafter - \ifx\csname \f@encoding+\f@family\endcsname\relax - \edef\tmp@item{{\directlua{% - tex.print(luatexbase.catcodetables["latex-package"], '\f@encoding')}% - }}% - \expandafter\expandafter\expandafter - \inlist@\expandafter\tmp@item\expandafter{\kenc@list}% -\ifin@ - \@font@warning{We don't search kanjifont definition - \MessageBreak for \f@encoding/\f@family}% -\else - \@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} - % #1 の展開結果から encoding 部分をとりだし,それが和文用かどうかの結果を \ifin@ に代入 \def\ltj@@IsFontJapanese#1{% @@ -598,6 +573,7 @@ tex.print(luatexbase.catcodetables["latex-package"], '#1')}% }}} + \let\extract@afont\extract@font \def\pickup@jfont{% \expandafter \ifx \font@name \relax @@ -606,6 +582,7 @@ \let\extract@font\extract@afont \fi \let\getjfont\font@name} + \def\extract@jfont{% \get@external@font \expandafter\globaljfont\font@name\external@font\relax -- 2.11.0