--- /dev/null
+luatexja.jfont.define_jfm {
+ dir = 'yoko',
+ zw = 1.0, zh = 1.0,
+ kanjiskip = { 0.1, 0.04, 0.05 },
+ xkanjiskip = { 0.31, 0.045, 0.057 },
+
+ [0] = {
+ align = 'left', left = 0.0, down = 0.0,
+ width = 1.0, height = 0.88, depth = 0.12, italic=0.0,
+ },
+ [1] = {
+ chars = { 'あ' },
+ align = 'left', left = 0.0, down = 0.0,
+ width = 1.0, height = 0.88, depth = 0.12, italic=0.0,
+ glue = { [3] = { 1.41, 0, 0} },
+ kern = { [8] = -1.41 , [2] = 2.0, [99] = 1.21 }
+ },
+ [11] = {
+ chars = { 'い' },
+ align = 'left', left = 0.0, down = 0.0,
+ width = 1.0, height = 0.88, depth = 0.12, italic=0.0,
+ glue = { [3] = { 1.41, 0, 0} },
+ kern = { [2] = 2.0, }
+ },
+ [21] = {
+ chars = { 'う' },
+ align = 'left', left = 0.0, down = 0.0,
+ width = 1.0, height = 0.88, depth = 0.12, italic=0.0,
+ glue = { [3] = { 1.41, 0, 0}, [99] ={ 1.73, 0, 0} },
+ kern = { [8] = -1.41 , [2] = 2.0, }
+ },
+ [31] = {
+ chars = { 'え' },
+ align = 'left', left = 0.0, down = 0.0,
+ width = 1.0, height = 0.88, depth = 0.12, italic=0.0,
+ glue = { [3] = { 1.41, 0, 0} },
+ kern = { [2] = 2.0, [99] = 1.73}
+ },
+ [41] = {
+ chars = { 'お' },
+ align = 'left', left = 0.0, down = 0.0,
+ width = 1.0, height = 0.88, depth = 0.12, italic=0.0,
+ kern = { [8] = -1.41 , [2] = 2.0}
+ },
+ [51] = {
+ chars = { 'か' },
+ align = 'left', left = 0.0, down = 0.0,
+ width = 1.0, height = 0.88, depth = 0.12, italic=0.0,
+ kern = { [199] = 0.85 },
+ },
+
+ [2] = {
+ chars = { 'ア' },
+ align = 'left', left = 0.0, down = 0.0,
+ width = 1.0, height = 0.88, depth = 0.12, italic=0.0
+ },
+ [3] = {
+ chars = { 'ウ' },
+ align = 'left', left = 0.0, down = 0.0,
+ width = 1.0, height = 0.88, depth = 0.12, italic=0.0
+ },
+ [99] = {
+ chars = { 'jcharbdd' },
+ glue = { [11] = { 1.41, 0, 0} },
+ kern = { [21] = 2.0, }
+ },
+ [199] = {
+ chars = { 'boxbdd' },
+ glue = { [51] = { 1.03, 0, 0} , [1] = { 0.94, 0.23, 0.45 }},
+ },
+ [8] = {
+ chars = { 'lineend' },
+ }
+}
\item[ucs]
\item[kansuji]
\end{list}
+\subsection{{\tt\char92 inhibitglue}}
+The primitive \verb+\inhibitglue+ suppresses the insertion of \textbf{JAglue}.
+The following is an example, using a special JFM that there will be a glue between
+the beginning of a box and `あ', and also between `あ' and `ウ'.
+
+\begin{LTXexample}
+\jfont\g=psft:Ryumin-Light:jfm=test \g
+あウあ\inhibitglue{}ウ\inhibitglue\par
+あ\par\inhibitglue{}あ
+\par\inhibitglue\hrule{}あoff\inhibitglue ice
+\end{LTXexample}
+
+With the help of this example, we remark the specification of \verb+\inhibitglue+:
+\begin{itemize}
+\item The call of \verb+\inhibitglue+ in the (internal) vertical mode is
+ effective at the beginning of the next paragraph. This is realized
+ by hacking \verb+\everypar+.
+\item The call of \verb+\inhibitglue+ in the (restricted) horizontal
+ mode is only effective on the spot; does not get over boundary of
+ paragraphs. Moreover, \verb+\inhibitglue+ cancels ligatures and
+ kernings, as shown in l.~4 of above example.
+\item The call of \verb+\inhibitglue+ in math mode is just ignored.
+\end{itemize}
\section{Control Sequences for \LaTeXe}
\subsection{Patch for NFSS2}
-As described in Subsection~\ref{ssec-ltx}, \LuaTeX-ja simply adopted \texttt{plfonts.dtx} in \pLaTeXe\ for the Japanese patch for NFSS2.
+As described in Subsection~\ref{ssec-ltx}, \LuaTeX-ja simply adopted
+\texttt{plfonts.dtx} in \pLaTeXe\ for the Japanese patch for NFSS2.
\subsection{Cropmark/`tombow'}
\texttt{type} is 100).
\begin{description}
\item[30111] Nodes for indicating that \verb+\inhibitglue+ is
- specified. The \texttt{value} field of these nodes is not
- used.
+ specified. The \texttt{value} field of these nodes doesn't matter.
\item[30112] Nodes for \LuaTeX-ja's stack system (see the next
subsection). The \texttt{value} field of these nodes is
current group.
\verb+user_id+ is converted to a `glyph\_node' \emph{after}
the callback process of luaotfload.
\end{description}
+These whatsits will be removed during the process of inserting \textbf{JAglue}s.
\subsection{Stack System of \LuaTeX-ja}\label{ssec-stack}
\paragraph{Background}
\newcount\ltj@tempcntc
\newdimen\ltj@tempdima
\newskip\ltj@tempskipa
+\newtoks\ltj@temptoks
\newdimen\ltj@zw
\newdimen\ltj@zh
\newdimen\jQ \jQ=0.25mm
-\newdimen\jH \jH=0.25mm
+\let\jH=\jQ
%%%%%%%% error message
\def\ltj@defnum{0}
\def\zh{\directlua{luatexja.jfont.load_zh()}\ltj@zh}
%%%%%%%% \inhibitglue
-\protected\def\inhibitglue{\ifvmode\leavevmode\fi
- \ifmmode\else\directlua{luatexja.jfmglue.create_inhibitglue_node()}\fi}
+\let\new@everypar=\everypar
+\protected\def\inhibitglue{%
+ \ifvmode
+ \directlua{ltj.global_temp = tex.globaldefs; tex.globaldefs = 0}% trick
+ \xdef\@@tempa{\the\everypar}%
+ \xdef\@@tempb{\everypar={\@@tempa}\@@tempa\noexpand\ltj@@ihb}%
+ \everypar\expandafter{\@@tempb}%
+ \directlua{tex.globaldefs = ltj.global_temp}% trick
+ \else\ifhmode\ltj@@ihb\fi\fi}
+\def\ltj@@ihb{\directlua{luatexja.jfmglue.create_inhibitglue_node()}}
%%%%%%%% \yoko, \tate, \ifydir, \iftdir
%% At this moment, tategaki mode is not implemented;
local ltjs_get_skip_table = ltjs.get_skip_table
local ltjf_font_metric_table = ltjf.font_metric_table
local ltjf_metrics = ltjf.metrics
+local box_stack_level
-------------------- Helper functions
local function skip_table_to_spec(n)
local g = node_new(id_glue_spec)
- local st = ltjs_get_skip_table(n, ltjp.box_stack_level)
+ local st = ltjs_get_skip_table(n, box_stack_level)
g.width = st.width; g.stretch = st.stretch; g.shrink = st.shrink
g.stretch_order = st.stretch_order; g.shrink_order = st.shrink_order
return g
Np.size= z.size
Np.met = ltjf_metrics[z.jfm]
Np.var = z.var
- Np.pre = ltjs_get_penalty_table('pre', c, 0, ltjp.box_stack_level)
- Np.post = ltjs_get_penalty_table('post', c, 0, ltjp.box_stack_level)
+ Np.pre = ltjs_get_penalty_table('pre', c, 0, box_stack_level)
+ Np.post = ltjs_get_penalty_table('post', c, 0, box_stack_level)
z = find_char_class('lineend', Np.met)
local y = Np.met.size_cache[Np.size].char_type[Np.class]
if y.kern and y.kern[z] then
else
Np.lend = 0
end
- y = ltjs_get_penalty_table('xsp', c, 3, ltjp.box_stack_level)
+ y = ltjs_get_penalty_table('xsp', c, 3, box_stack_level)
Np.xspc_before = (y>=2)
Np.xspc_after = (y%2==1)
Np.auto_kspc = (has_attr(x, attr_autospc)==1)
x = node_tail(x.components); c = x.char
end
end
- Np.pre = ltjs_get_penalty_table('pre', c, 0, ltjp.box_stack_level)
- Np.post = ltjs_get_penalty_table('post', c, 0, ltjp.box_stack_level)
+ Np.pre = ltjs_get_penalty_table('pre', c, 0, box_stack_level)
+ Np.post = ltjs_get_penalty_table('post', c, 0, box_stack_level)
else
Np.pre = 0; Np.post = 0
end
Np.met = nil
- local y = ltjs_get_penalty_table('xsp', c, 3, ltjp.box_stack_level)
+ local y = ltjs_get_penalty_table('xsp', c, 3, box_stack_level)
Np.xspc_before = (y%2==1)
Np.xspc_after = (y>=2)
Np.auto_xspc = (has_attr(x, attr_autoxspc)==1)
real_insert(0, g)
end
-- \jcharwidowpenalty 挿入予定箇所更新
- if mode and ltjs_get_penalty_table('kcat', Np.char, 0, ltjp.box_stack_level)%2~=1 then
+ if mode and ltjs_get_penalty_table('kcat', Np.char, 0, box_stack_level)%2~=1 then
widow_Np.first = Np.first;
local Bpr = widow_Bp; widow_Bp = Bp; Bp = Bpr
end
Bp = widow_Bp; Np = widow_Np; Nq.lend = 0
if Np.first then
handle_penalty_normal(0,
- ltjs_get_penalty_table('jwp', 0, 0, ltjp.box_stack_level))
+ ltjs_get_penalty_table('jwp', 0, 0, box_stack_level))
end
else
-- the current list is the contents of a hbox
local function handle_list_head()
if Np.id == id_jglyph or (Np.id==id_pbox and Np.met) then
local g = new_jfm_glue(Np, find_char_class('boxbdd',Np.met), Np.class)
- if g then
+ if g and not ihb_flag then
set_attr(g, attr_icflag, BOXBDD)
if g.id==id_glue and #Bp==0 then
local h = node_new(id_penalty)
-- initialize
local function init_var()
lp = head; Bp = {}; widow_Bp = {}; widow_Np = {first = nil}
+ box_stack_level = ltjp.box_stack_level
kanji_skip=skip_table_to_spec('kanjiskip')
xkanji_skip=skip_table_to_spec('xkanjiskip')
Np = {
if mode then
-- the current list is to be line-breaked:
-- hbox from \parindent is skipped.
- while lp and (lp.id==id_whatsit or ((lp.id==id_hlist) and (lp.subtype==3))) do
+ while lp and ((lp.id==id_whatsit and lp.subtype~=sid_user)
+ or ((lp.id==id_hlist) and (lp.subtype==3))) do
lp=node_next(lp) end
last=node.tail(head)
else