OSDN Git Service

Add callback "luatexja.load_jfm" and revert jfm-min.lua.
authorHironori Kitagawa <h_kitagawa2001@yahoo.co.jp>
Mon, 10 Oct 2011 10:41:15 +0000 (19:41 +0900)
committerHironori Kitagawa <h_kitagawa2001@yahoo.co.jp>
Mon, 10 Oct 2011 10:41:15 +0000 (19:41 +0900)
13 files changed:
doc/man-en.pdf
doc/man-ja.pdf [new file with mode: 0644]
doc/manual.dtx
doc/manual.ins
src/jfm-min.lua
src/ltjclasses/ltjarticle.cls
src/ltjclasses/ltjbook.cls
src/ltjclasses/ltjclasses.dtx
src/ltjclasses/ltjreport.cls
src/luatexja/jfont.lua
src/luatexja/otf.lua
test/test12-ltjarticle.pdf [moved from test/test12-ltjartile.pdf with 97% similarity]
test/test12-ltjarticle.tex [moved from test/test12-ltjartile.tex with 91% similarity]

index 9847a1a..c7a3b88 100644 (file)
Binary files a/doc/man-en.pdf and b/doc/man-en.pdf differ
diff --git a/doc/man-ja.pdf b/doc/man-ja.pdf
new file mode 100644 (file)
index 0000000..f2d39ca
Binary files /dev/null and b/doc/man-ja.pdf differ
index 8ea5b72..0bfa617 100644 (file)
@@ -11,7 +11,7 @@
 % \def\headfont{\sffamily\gtfamily} is needed in ordinal documents
 %</ja>
 
-\usepackage{amsmath,amssymb,xcolor,pict2e,multienum}
+\usepackage{amsmath,amssymb,xcolor,pict2e,multienum,amsthm}
 \usepackage{booktabs,listings,lltjlisting,showexpl,multicol}
 \usepackage{luatexja-otf}
 \usepackage[unicode=true]{hyperref}
@@ -26,6 +26,8 @@
 \DeclareRobustCommand\pLaTeXe{p\kern-.05em\LaTeXe}
 \DeclareRobustCommand\epTeX{\ensuremath{\varepsilon}-\kern-.125em\pTeX}
 
+\theoremstyle{definition}
+\newtheorem{defn}{Definition}
 
 \makeatletter
 \long\def\@makecaption#1#2{%
@@ -854,19 +856,8 @@ This field is a list of characters which are in this character
             than 0 (hence, the character class~0 contains most of
             \textbf{JAchar}s). In the list, a character can be
             specified by its code number, or by the character itself
-            (as a string of length~1). 
-
-In addition to those `real' characters, the following `imaginary
-            characters' can be specified in the list:
-\begin{list}{}{\def\makelabel{\ttfamily}\def\{{\char`\{}\def\}{\char`\}}}
-\item['lineend'] An ending of a line. 
-\item['diffmet'] Used at a boundary between two \textbf{JAchar}s whose JFM or size is different.
-\item['boxbdd'] The beginning/ending of a horizontal box, and the beginging of a noindented paragraph.
-\item['parbdd'] The beginning of an (indented) paragraph.
-\item['jcharbdd'] A boundary between \textbf{JAchar} and anything else
-            (such as \textbf{ALchar}, kern, glue, ...).
-\item[$-1$] The left/right boundary of an inline math formula.
-\end{list}
+            (as a string of length~1). Moreover, there are `imaginary
+            characters' which specified in the list. We will describe these later.
 
 \item[width=<length>, height=<length>, depth=<length>, italic=<length>]\ (required)
 
@@ -965,6 +956,78 @@ the `real' glyph is centered horizontally (the green rectangle).
 \item[glue={\{[$j$]=\{<width>, <stretch>, <shrink>\}, ...\}}]
 \end{list}
 
+%<*en>
+\begin{list}{}{\def\makelabel{\ttfamily}\def\{{\char`\{}\def\}{\char`\}}}
+\item['lineend'] An ending of a line. 
+\item['diffmet'] Used at a boundary between two \textbf{JAchar}s whose JFM or size is different.
+\item['boxbdd'] The beginning/ending of a horizontal box, and the beginging of a noindented paragraph.
+\item['parbdd'] The beginning of an (indented) paragraph.
+\item['jcharbdd'] A boundary between \textbf{JAchar} and anything else
+            (such as \textbf{ALchar}, kern, glue, ...).
+\item[$-1$] The left/right boundary of an inline math formula.
+\end{list}
+%</en>
+
+%<*ja>
+上で説明した通り,\texttt{chars}フィールド中にはいくつかの「特殊文字」も
+指定可能である.これらは,大半が\pTeX のJFMグルーの挿入処理ではみな「文字
+クラス0の文字」として扱われていた文字であり,その結果として\pTeX より細か
+い組版調整ができるようになっている.以下のその一覧を述べる:
+\begin{list}{}{\def\makelabel{\ttfamily}\def\{{\char`\{}\def\}{\char`\}}}
+\item['lineend'] 行の終端を表す.
+\item['diffmet'] 
+
+\item['boxbdd'] hboxの先頭と末尾,及びインデントされていない
+            (\verb+\noindent+で開始された)段落の先頭を表す.
+\item['parbdd'] 通常の(\verb+\noindent+で開始されていない)段落の先頭.
+\item['jcharbdd'] 和文文字と「その他のもの」(欧文文字,glue,kern等)との境界.
+\item[$-1$] 行中数式と地の文との境界.
+\end{list}
+
+\paragraph{\pTeX 用和文フォントメトリックの移植}
+以下に,\pTeX 用和文フォントメトリックを\LuaTeX-ja用に移植する場合の注意点を挙げておく.
+\begin{itemize}
+\item 実際に出力される和文フォントのサイズがdesign sizeとなる.
+このため,例えば$1\,\textrm{zw}$がdesign sizeの0.962216倍であるJISフォン
+      トメトリック等を移植する場合は,
+\begin{itemize}
+\item JFM中の全ての数値を$1/0.962216$倍しておく.
+\item \TeX ソース中で使用するところで,サイズ指定を0.962216倍にする.
+      \LaTeX でのフォント宣言なら,例えば次のように:
+\begin{verbatim}
+\DeclareFontShape{JY3}{mc}{m}{n}{<-> s*[0.962216] psft:Ryumin-Light:jfm=jis}{}
+\end{verbatim}
+\end{itemize}
+\item 上に述べた特殊文字は,\texttt{'boxbdd'}を除き文字クラスを全部0とする
+      (JFM中に単に書かなければよい).
+\item \texttt{'boxbdd'}については,それのみで一つの文字クラスを形成し,その
+      文字クラスに関してはglue/kernの設定はしない.
+
+これは,\pTeX では,
+      hboxの先頭・末尾とインデントされていない(\verb+\noindent+で開始さ
+      れた)段落の先頭にはJFMグルーは入らないという仕様を実現させるためである.
+\item \pTeX の組版を再現させようというのが目的であれば以上の注意を守れば十分である.
+
+ところで,\pTeX では通常の段落の先頭にJFMグルーが残るという仕様があるので,
+      段落先頭の開き括弧は全角二分下がりになる.全角下がりを実現させるに
+      は,段落の最初に手動で\verb+\inhibitglue+を追加するか,あるいは
+      \verb+\everypar+のhackを行い,それを自動化させるしかなかった.
+
+一方,\LuaTeX-jaでは,\texttt{'parbdd'}によって,それがJFM側で調整できるよ
+うになった.例えば,\LuaTeX-ja同梱のJFMのように,\texttt{'boxbdd'}と同じ文字クラスに
+\texttt{'parbdd'}を入れれば全角下がりとなる.
+
+\begin{LTXexample}
+\jfont\g=psft:Ryumin-Light:jfm=test \g
+\parindent1\zw\noindent{}◆◆◆◆◆
+\par{}「◆◆←二分下がり
+\par{}【◆◆←全角下がり
+\par{}〔◆◆←全角二分下がり
+\end{LTXexample}
+\end{itemize}
+
+%</ja>
+
 \subsection{Math Font Family}
 \TeX\ handles fonts in math formulas by 16~font families\footnote{Omega,
 Aleph, \LuaTeX~and $\varepsilon$-\kern-.125em(u)\pTeX can handles 256~families, but
@@ -993,6 +1056,77 @@ scriptscript size&\tt\textsf{jascriptscriptfont}\,=\{<jfam>,<jfont\_cs>\}&\tt\ve
 \end{center}
 \end{table}
 
+\subsection{Callbacks}
+Like \LuaTeX\ itself, \LuaTeX-ja also has callbacks. These callbacks can
+be accessed via \verb+luatexbase.add_to_callback+ function and so on, as other callbacks
+\begin{list}{}%
+{\def\makelabel#1{\bfseries#1}}
+\item[\texttt{luatexja.load\_jfm} callback]
+With this callback you can overwrite JFMs.
+
+\begin{verbatim}
+function (<table> jfm_info, <string> jfm_name)
+  return <table> new_jfm_info
+end
+\end{verbatim}
+
+The argument \verb+jfm_info+ contains a table similar to the table in a JFM file, except 
+this argument has \texttt{chars} field which contains character codes
+            whose character class is not~0. This callback doesn't replace any code of \LuaTeX-ja.
+
+\item[\texttt{luatexja.define\_font} callback]
+This callback and the next callback form a pair, and you can assign letters which don't have
+            fixed codepoints in Unicode to non-zero character classes.
+This \texttt{luatexja.define\_font} callback is called just when new Japanese font is loaded.
+\begin{verbatim}
+function (<table> jfont_info, <number> font_number)
+  return <table> new_jfont_info
+end
+\end{verbatim}
+
+You may assume that \verb+jfont_info+ has the following fields:
+\begin{description}
+\item[\tt jfm] The index number of JFM.
+\item[\tt size] Font size in a scaled point (${}=2^{-16}\,\textrm{pt}$).
+\item[\tt var] The value specified in \texttt{jfmvar=...} at a call of \verb+\jfont+.
+\end{description}
+
+The returned table \verb+new_jfont_info+ also should include these three fields. 
+The \verb+font_number+ is a font number. 
+
+An example of this callback is the \texttt{ltjarticle} class, with
+            forcefully assigning character class~0 to \texttt{'parbdd'}
+            in the JFM \texttt{jfm-min.lua}. This callback doesn't
+            replace any code of \LuaTeX-ja.
+
+
+\item[\texttt{luatexja.find\_char\_class} callback]
+This callback is called just when \LuaTeX-ja inready to determine which
+            character class a character \verb+chr_code+ belongs.
+A function used in this callback should be in the following form:
+\begin{lstlisting}[numbers=left]
+function (<number> char_class, <table> jfont_info, <number> chr_code)
+  if char_class~=0 then return char_class
+  else
+    ....
+    return (<number> new_char_class or 0)
+  end
+end
+\end{lstlisting}
+
+The argument \verb+char_class+ is the result of \LuaTeX-ja's default
+            routine or previous function calls in this callback, hence
+            this argument may not be 0. 
+
+A good example of this and the next callbacks is \texttt{luatexja-otf}
+            package, supporting \verb+"AJ1-xxx"+ form for Adobe-Japan1
+            CID characters in a JFM.
+This callback doesn't replace any code of \LuaTeX-ja.
+
+
+
+\end{list}
+
 
 
 \section{Parameters}
@@ -1210,23 +1344,22 @@ There is also a unit called `歯' which equals to $0.25\,\textrm{mm}$ and
                        fonts in scaled point ($2^{-16}\,\textrm{pt}$).
 \attr{ltj@autospc} Whether the auto insertion of \textsf{kanjiskip} is allowed at the node.
 \attr{ltj@autoxspc} Whether the auto insertion of \textsf{xkanjiskip} is allowed at the node.
-\attr{ltj@icflag} For distinguishing `kinds' of the node. To this
-                       attribute, one of the following value is
-                       assigned:
+\attr{ltj@icflag} An attribute for distinguishing `kinds' of a node. One of the following value is
+                       assigned to this attribute:
 \begin{description}
-\item[ITALIC (1)] Glues from an itaric correction
+\item[\textit{italic} (1)] Glues from an itaric correction
           (\verb+\/+). This distinction of origins of glues 
           (from explicit \verb+\kern+, or from \verb+\/+)
           is needed in the insertion process of \textsf{xkanjiskip}.
-\item[PACKED (2)] 
-\item[KINSOKU (3)] Penalties inserted for the word-wrapping  process of Japanese characters (\emph{kinsoku}).
-\item[FROM\_JFM (4)] Glues/kerns from JFM.
-\item[LINE\_END (5)] Kerns for ...
-\item[KANJI\_SKIP (6)] Glues for \textsf{kanjiskip}.
-\item[XKANJI\_SKIP (7)] Glues for \textsf{xkanjiskip}.
-\item[PROCESSED (8)] Nodes which is already processed by ...
-\item[IC\_PROCESSED (9)] Glues from an itaric correction, but also already processed.
-\item[BOXBDD (15)] Glues/kerns that inserted just the beginning or the ending of an hbox or a paragraph.
+\item[\textit{packed} (2)] 
+\item[\textit{kinsoku} (3)] Penalties inserted for the word-wrapping  process of Japanese characters (\emph{kinsoku}).
+\item[\textit{from\_jfm} (4)] Glues/kerns from JFM.
+\item[\textit{line\_end} (5)] Kerns for ...
+\item[\textit{kanji\_skip} (6)] Glues for \textsf{kanjiskip}.
+\item[\textit{xkanji\_skip} (7)] Glues for \textsf{xkanjiskip}.
+\item[\textit{processed} (8)] Nodes which is already processed by ...
+\item[\textit{ic\_processed} (9)] Glues from an itaric correction, but also already processed.
+\item[\textit{boxbdd} (15)] Glues/kerns that inserted just the beginning or the ending of an hbox or a paragraph.
 \end{description}
 \attr{ltj@kcat$i$} Where $i$~is a natural number which is less than~7.
 These 7~attributes store bit~vectors indicating which character block is regarded as a block of \textbf{JAchar}s.
 
 
 \section{Insertion of JFM glues, \textsf{kanjiskip} and \textsf{xkanjiskip}}
+\subsection{Overview}
 %<*en>
-This will be the longest section of the document.
-However, ...
+NOT COMPLETED
 %</en>
 
 %<*ja>
-\LuaTeX-ja における和文処理グルーの挿入方法は,\pTeX のそれとは全く異なる.……
-
+\LuaTeX-ja における和文処理グルーの挿入方法は,\pTeX のそれとは全く異なる.
+\pTeX では次のような仕様であった:
+\begin{itemize}
+\item JFMグルーの挿入は,和文文字を表すトークンを元に水平リストに(文字を表す)<char\_node>を
+追加する過程で行われる.
+\item \textsf{xkanjiskip}の挿入は,hboxへのパッケージングや行分割前に行われる.
+\item \textsf{kanjiskip}はノードとしては挿入されない.パッケージングや行分割の計算時に
+「和文文字を表す2つの<char\_node>の間には\textsf{kanjiskip}がある」ものとみなされる.
+\end{itemize}
+しかし,\LuaTeX-jaでは,hboxへのパッケージングや行分割前に全ての
+\textbf{JAglue},即ちJFMグルー・\textsf{xkanjiskip}・\textsf{kanjiskip}の
+3種類を一度に挿入することになっている.これは,\LuaTeX において欧文の合字・
+カーニング処理がノードベースになったことに対応する変更である.
+
+\LuaTeX-jaにおける\textbf{JAglue}挿入処理では,下の図\ref{fig-clu}のよう
+に「塊」を単位にして行われる.大雑把にいうと,「塊」は文字とそれに付随す
+るノード達(アクセント位置補正用のkernや,イタリック補正)をまとめたもの
+であり,2つの塊の間には,ペナルティ,\verb+\vadjust+,whatsitなど,行組版
+には関係しないものがある.そのため,……
 %</ja>
 
+% \begin{figure}[tb]
+% \unitlength=10mm
+% \end{figure}
+
+\subsection{Definition of a `cluster'}
+
+\begin{defn}
+A \emph{cluster} is a list of nodes in one of the following forms, with the \textit{id} of it:
+\begin{enumerate}
+\item Nodes whose value of \verb+\ltj@icflag+ is in $[3,15)$.  These
+      nodes come from a hbox which is already packaged, by unpackaging
+      (\verb+\unhbox+).
+      The \textit{id} is \textit{id\_pbox}.
+\item A inline math formula, including two \textit{math\_node}s at the boundary of it:
+HOGE
+      The \textit{id} is \textit{id\_math}.
+\item A \textit{glyph\_node} with nodes which relate with it: 
+HOGE
+The \textit{id} is \textit{id\_jglyph} or
+\textit{id\_glyph}, according to whether the \textit{glyph\_node}
+represents a Japanese character or not.
+\item An box-like node, that is, an hbox, an vbox and an rule (\verb+\vrule+). 
+The \textit{id} is \textit{id\_hlist} if the node is an
+      hbox which is not shifted vertically, or \textit{id\_box\_like}
+      otherwise.
+\item A glue, a kern whose subtype is not 2~(\textit{accent}), and a discretionary break.
+The \textit{id} is \textit{id\_glue}, \textit{id\_kern}
+      and \textit{id\_disc}, respectively.
+%Just a node which will \dots, \textit{i.e.}, a node which is \emph{not} one of the following:
+%\textit{ins\_node}, \textit{mark\_node}, \textit{adjust\_node}, \textit{whatsit\_node}
+%and \textit{penalty\_node}.
+\end{enumerate}
+We denote a cluster by \textit{Np}, \textit{Nq} and \textit{Nr}.
+\end{defn}
+
+Internally, a cluster is represented by a table $\textit{Np}$ with the following fields.
 
+\begin{description}
+\def\makelabel#1{\textbf{\textit{#1}}}
+\item[first, last] The first/last node of the cluster.
+\item[id] The \textit{id} in above definition.
+\item[nuc]
+
+% jachar
+\item[auto\_kspc, auto\_xspc]
+\item[xspc\_before, xspc\_after]
+
+% alchar, jachar
+\item[pre, post]
+\item[char]
+\item[class]
+\item[lend]
+\item[met, var]
+\end{description}
 \end{document}
index 025e778..9e91906 100644 (file)
@@ -3,6 +3,6 @@
 \askforoverwritefalse
 \generate{\file{man-ja.tex}{\from{manual.dtx}{ja}}
           \file{man-en.tex}{\from{manual.dtx}{en}}}
-%\immediate\write18{lualatex man-ja}
+\immediate\write18{lualatex man-ja}
 \immediate\write18{lualatex man-en}
  \endbatchfile
index 91a71a4..ff00229 100644 (file)
@@ -11,9 +11,6 @@ luatexja.jfont.define_jfm {
    zw = 1.0, zh = vscale,
 
    [0] = {
-      chars = {'parbdd'}, 
-        -- this line has no effect, but it is useful to note 
-        -- that 'parbdd' is in the character class 0.
       align = 'left', left = 0.0, down = 0.0,
       width = 1.0, height = vht, depth = vdp, italic=0.0,
       glue = {
@@ -258,6 +255,6 @@ luatexja.jfont.define_jfm {
    },
 
    [99] = { -- box末尾
-      chars = {'boxbdd'},
+      chars = {'boxbdd', 'parbdd'},
    },
 }
index a157f90..53a8530 100644 (file)
 \ExecuteOptions{a4paper,10pt,oneside,onecolumn,final}
 \ProcessOptions\relax
 \input{ltjsize1\@ptsize.clo}
-\DeclareFontShape{JY3}{mc}{m}{n}{<-> s * [0.924872] psft:Ryumin-Light:jfm=min}{}
-\DeclareFontShape{JY3}{gt}{m}{n}{<-> s * [0.924872] psft:GothicBBB-Medium:jfm=min;jfmvar=goth}{}
+\directlua{luatexbase.add_to_callback('luatexja.load_jfm',
+  function (ji, jn) ji.chars['parbdd'] = 0; return ji end,
+  'ltj.jclasses_load_jfm', 1)}
+{\jfont\g=psft:Ryumin-Light:jfm=min } % loading jfm-min.lua
+\expandafter\let\csname JY3/mc/m/n/10\endcsname\relax
+\DeclareFontShape{JY3}{mc}{m}{n}{<-> s * [0.962216] psft:Ryumin-Light:jfm=min}{}
+\DeclareFontShape{JY3}{gt}{m}{n}{<-> s * [0.962216] psft:GothicBBB-Medium:jfm=min;jfmvar=goth}{}
 \ltjglobalsetparameter{differentjfm=both}
+\directlua{luatexbase.remove_from_callback('luatexja.load_jfm', 'ltj.jclasses_load_jfm')}
 \if@stysize
   \setlength\columnsep{2\Cwd}
 \else
index 991534c..c33acef 100644 (file)
 \ExecuteOptions{a4paper,10pt,twoside,onecolumn,final,openright}
 \ProcessOptions\relax
 \input{ltjbk1\@ptsize.clo}
-\DeclareFontShape{JY3}{mc}{m}{n}{<-> s * [0.924872] psft:Ryumin-Light:jfm=min}{}
-\DeclareFontShape{JY3}{gt}{m}{n}{<-> s * [0.924872] psft:GothicBBB-Medium:jfm=min;jfmvar=goth}{}
+\directlua{luatexbase.add_to_callback('luatexja.load_jfm',
+  function (ji, jn) ji.chars['parbdd'] = 0; return ji end,
+  'ltj.jclasses_load_jfm', 1)}
+{\jfont\g=psft:Ryumin-Light:jfm=min } % loading jfm-min.lua
+\expandafter\let\csname JY3/mc/m/n/10\endcsname\relax
+\DeclareFontShape{JY3}{mc}{m}{n}{<-> s * [0.962216] psft:Ryumin-Light:jfm=min}{}
+\DeclareFontShape{JY3}{gt}{m}{n}{<-> s * [0.962216] psft:GothicBBB-Medium:jfm=min;jfmvar=goth}{}
 \ltjglobalsetparameter{differentjfm=both}
+\directlua{luatexbase.remove_from_callback('luatexja.load_jfm', 'ltj.jclasses_load_jfm')}
 \if@stysize
   \setlength\columnsep{2\Cwd}
 \else
index a58fd97..0a2171a 100644 (file)
@@ -8,7 +8,7 @@
 %  This file is part of the pLaTeX2e system.
 %  -----------------------------------------
 %
-% \fi
+% \fi 
 %
 % \CheckSum{4468}
 %% \CharacterTable
 %
 % \section{フォント}
 %
-% Lua\LaTeX-jaの標準では,OTFパッケージ由来のメトリックが使われるようになっています.
-% 本クラスでは,「p\TeX の組版と互換性をできだけ持たせる」例を提示するため,
+% Lua\LaTeX-jaの標準では、OTFパッケージ由来のメトリックが使われるようになっています。
+% 本クラスでは、「p\TeX の組版と互換性をできだけ持たせる」例を提示するため、
 % \begin{itemize}
-% \item メトリックを\texttt{min10.tfm}ベースの\texttt{jfm-min.lua}に変更
-% \item 明朝とゴシックは両方とも\texttt{jfm-min.lua}を用いるが
-%   和文処理用グルー挿入時には「違うメトリックを使用」として思わせる
-% \item p\TeX と同様に,「異なるメトリックの2つの和文文字」の間には,両者から定める
-%   グルーを両方挿入する
-% \item \texttt{jfm-min.lua}では,段落始めの括弧が全角二分下がりになるようになっている.
+% \item メトリックを\texttt{min10.tfm}ベースの\texttt{jfm-min.lua}に変更
+% \item 明朝とゴシックは両方とも\texttt{jfm-min.lua}を用いるが
+%   和文処理用グルー挿入時には「違うメトリックを使用」として思わせる
+% \item p\TeX と同様に、「異なるメトリックの2つの和文文字」の間には、両者から定める
+%   グルーを両方挿入する
+% \item calllback を利用し、標準で用いる\texttt{jfm-min.lua}を、段落始めの括弧が全角二分下がりになるように内部で変更している。
 % 
 % \end{itemize}
 %
 %    \begin{macrocode}
 %<*article|report|book>
-\DeclareFontShape{JY3}{mc}{m}{n}{<-> s * [0.924872] psft:Ryumin-Light:jfm=min}{}
-\DeclareFontShape{JY3}{gt}{m}{n}{<-> s * [0.924872] psft:GothicBBB-Medium:jfm=min;jfmvar=goth}{}
+\directlua{luatexbase.add_to_callback('luatexja.load_jfm', 
+  function (ji, jn) ji.chars['parbdd'] = 0; return ji end, 
+  'ltj.jclasses_load_jfm', 1)}
+{\jfont\g=psft:Ryumin-Light:jfm=min } % loading jfm-min.lua
+\expandafter\let\csname JY3/mc/m/n/10\endcsname\relax
+\DeclareFontShape{JY3}{mc}{m}{n}{<-> s * [0.962216] psft:Ryumin-Light:jfm=min}{}
+\DeclareFontShape{JY3}{gt}{m}{n}{<-> s * [0.962216] psft:GothicBBB-Medium:jfm=min;jfmvar=goth}{}
 \ltjglobalsetparameter{differentjfm=both}
+\directlua{luatexbase.remove_from_callback('luatexja.load_jfm', 'ltj.jclasses_load_jfm')}
 %</article|report|book>
 %    \end{macrocode}
 %
index 5c1a6d4..f79447d 100644 (file)
 \ExecuteOptions{a4paper,10pt,oneside,onecolumn,final,openany}
 \ProcessOptions\relax
 \input{ltjsize1\@ptsize.clo}
-\DeclareFontShape{JY3}{mc}{m}{n}{<-> s * [0.924872] psft:Ryumin-Light:jfm=min}{}
-\DeclareFontShape{JY3}{gt}{m}{n}{<-> s * [0.924872] psft:GothicBBB-Medium:jfm=min;jfmvar=goth}{}
+\directlua{luatexbase.add_to_callback('luatexja.load_jfm',
+  function (ji, jn) ji.chars['parbdd'] = 0; return ji end,
+  'ltj.jclasses_load_jfm', 1)}
+{\jfont\g=psft:Ryumin-Light:jfm=min } % loading jfm-min.lua
+\expandafter\let\csname JY3/mc/m/n/10\endcsname\relax
+\DeclareFontShape{JY3}{mc}{m}{n}{<-> s * [0.962216] psft:Ryumin-Light:jfm=min}{}
+\DeclareFontShape{JY3}{gt}{m}{n}{<-> s * [0.962216] psft:GothicBBB-Medium:jfm=min;jfmvar=goth}{}
 \ltjglobalsetparameter{differentjfm=both}
+\directlua{luatexbase.remove_from_callback('luatexja.load_jfm', 'ltj.jclasses_load_jfm')}
 \if@stysize
   \setlength\columnsep{2\Cwd}
 \else
index 0106dbb..fb43564 100644 (file)
@@ -29,6 +29,8 @@ local ITALIC = 1
 metrics={} -- this table stores all metric informations
 font_metric_table={} -- [font number] -> jfm_name, jfm_var, size
 
+luatexbase.create_callback("luatexja.load_jfm", "data", function (ft, jn) return ft end)
+
 local jfm_file_name, jfm_var
 local defjfm_res
 
@@ -96,8 +98,9 @@ function define_jfm(t)
         t[i] = nil
       end
    end
+   t = luatexbase.call_callback("luatexja.load_jfm", t, jfm_file_name)
    t.size_cache = {}
-   defjfm_res= t
+   defjfm_res = t
 end
 
 local function mult_table(old,scale) -- modified from table.fastcopy
@@ -126,7 +129,7 @@ local function update_jfm_cache(j,sz)
    metrics[j].size_cache[sz].zh = round(metrics[j].zh*sz)
 end
 
-luatexbase.create_callback("ltj.find_char_class", "data", 
+luatexbase.create_callback("luatexja.find_char_class", "data", 
                           function (arg, fmtable, char)
                              return 0
                           end)
@@ -135,7 +138,7 @@ function find_char_class(c,m)
 -- c: character code, m: index in font_metric table
    if not metrics[m.jfm] then return 0 end
    return metrics[m.jfm].chars[c] or 
-      luatexbase.call_callback("ltj.find_char_class", 0, m, c)
+      luatexbase.call_callback("luatexja.find_char_class", 0, m, c)
 end
 
 local function load_jfont_metric()
@@ -173,9 +176,9 @@ function jfontdefX(g)
   tex.sprint(cat_lp, '\\expandafter\\font\\csname ' .. cstemp .. '\\endcsname')
 end
 
--- EXT
-luatexbase.create_callback("ltj.define_jfont", "data", function (ft, fn) return ft end)
+luatexbase.create_callback("luatexja.define_jfont", "data", function (ft, fn) return ft end)
 
+-- EXT
 function jfontdefY() -- for horizontal font
    local j = load_jfont_metric()
    local fn = font.id(cstemp)
@@ -191,7 +194,7 @@ function jfontdefY() -- for horizontal font
    end
    update_jfm_cache(j, f.size)
    local fmtable = { jfm = j, size = f.size, var = jfm_var }
-   fmtable = luatexbase.call_callback("ltj.define_jfont", fmtable, fn)
+   fmtable = luatexbase.call_callback("luatexja.define_jfont", fmtable, fn)
    font_metric_table[fn]=fmtable
    tex.sprint(cat_lp, ltj.is_global .. '\\protected\\expandafter\\def\\csname ' 
           .. cstemp  .. '\\endcsname{\\ltj@curjfnt=' .. fn .. '\\relax}')
index 3f6348f..d0f657f 100644 (file)
@@ -122,7 +122,7 @@ local function cid_to_char(fmtable, fn)
    end
    return fmtable
 end
-luatexbase.add_to_callback("ltj.define_jfont", 
+luatexbase.add_to_callback("luatexja.define_jfont", 
                           cid_to_char, "ltj.otf.define_jfont", 1)
 --  既に読み込まれているフォントに対しても,同じことをやらないといけない
 for fn, v in pairs(ltjf_font_metric_table) do
@@ -137,7 +137,7 @@ local function cid_set_char_class(arg, fmtable, char)
    else return 0
    end
 end
-luatexbase.add_to_callback("ltj.find_char_class", 
+luatexbase.add_to_callback("luatexja.find_char_class", 
                           cid_set_char_class, "ltj.otf.find_char_class", 1)
 
 -------------------- all done
similarity index 97%
rename from test/test12-ltjartile.pdf
rename to test/test12-ltjarticle.pdf
index 26eb25c..69c6e16 100644 (file)
Binary files a/test/test12-ltjartile.pdf and b/test/test12-ltjarticle.pdf differ
similarity index 91%
rename from test/test12-ltjartile.tex
rename to test/test12-ltjarticle.tex
index 52c8c34..73cd832 100644 (file)
@@ -1,7 +1,7 @@
 %#!lualatex
 \documentclass{ltjarticle}
 \begin{document}
-\noindent 漢字漢字
+\noindent 漢字漢字ちょっと\textgt{チェック}
 
 「漢字←全角二分下がり?\\
 「あいうえお」\textgt{「かきくけこ」}{\Large 「}