local function skip_table_to_glue(n)
local g, st = node_new(id_glue), ltjs.fast_get_stack_skip(n)
setglue(g, st.width, st.stretch, st.shrink, st.stretch_order, st.shrink_order)
- -- luatexja.ext_show_node(to_node(g), 'sg ',print)
return g, (st.width==1073741823)
end
local ltjw_apply_ashift_math = ltjw.apply_ashift_math
local ltjw_apply_ashift_disc = ltjw.apply_ashift_disc
local min, max = math.min, math.max
-local function calc_np_aux_glyph_common(lp)
+local function calc_np_aux_glyph_common(lp, acc_flag)
Np.nuc = lp
Np.first= (Np.first or lp)
if getfield(lp, 'lang') == lang_ja then
node_free(r)
elseif (ct.left_protruding or 0) == 0 then
head = insert_before(head, npn, r)
- Np.first = (Np.first==npn) and r or npn
+ Np.first = acc_flag and Np.first or ((Np.first==npn) and r or npn)
elseif (ct.right_protruding or 0) == 0 then
insert_after(head, npn, r); Np.last, lp = r, r
else
set_attr(lp, attr_icflag, PROCESSED); lp = node_next(lp)
set_attr(lp, attr_icflag, PROCESSED); lp = node_next(lp)
set_attr(lp, attr_icflag, PROCESSED);
- return calc_np_aux_glyph_common(lp)
+ return calc_np_aux_glyph_common(lp, true)
else
Np.first = Np.first or lp
Np.id = id_kern; set_attr(lp, attr_icflag, PROCESSED)
\protected\def\ltjsetht{\directlua{luatexja.direction.set_box_dim('height')}}
\protected\def\ltjsetdp{\directlua{luatexja.direction.set_box_dim('depth')}}
+
%%------------------ Load module for the format
\ifltj@in@latex %<*LaTeX>
do
luatexja.binary_pars = {
jacharrange = function(c, t)
- if type(c)~='number' or c<0 or c>31*ltjc.ATTR_RANGE then
- -- 0 はエラーにしない(隠し)
+ if type(c)~='number' or c<-1 or c>31*ltjc.ATTR_RANGE then
+ -- 0, -1 はエラーにしない(隠し)
ltjb.package_error('luatexja',
'invalid character range number (' .. tostring(c) .. ')',
'A character range number should be in the range 1..'
end
+-- lastnodechar
+do
+ local id_glyph = node.id('glyph')
+ function luatexja.pltx_composite_last_node_char()
+ local n = tex.nest[tex.nest.ptr].tail
+ local r = '-1'
+ if n then
+ if n.id==id_glyph then
+ while n.componetns and n.subtype and n.subtype%4 >= 2 do
+ n = node.tail(n)
+ end
+ r = tostring(n.char)
+ end
+ end
+ tex.sprint(r)
+ end
+end
+
-- debug
do
%%%% patch \@text@composite because of {y,t}albaselineshift
+%% \pltx@isletter from plfonts.dtx
+\def\pltx@mark{\pltx@mark@}
+\let\pltx@scanstop\relax
+\long\def\pltx@cond#1\fi{%
+ #1\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi}
+\long\def\pltx@isletter#1{%
+ \expandafter\pltx@isletter@i\romannumeral-`0#1\pltx@scanstop}
+\long\def\pltx@isletter@i#1\pltx@scanstop{%
+ \pltx@cond\ifx\pltx@mark#1\pltx@mark\fi{\@firstoftwo}%
+ {\pltx@isletter@ii\pltx@scanstop#1\pltx@scanstop{}#1\pltx@mark}}
+\long\def\pltx@isletter@ii#1\pltx@scanstop#{%
+ \pltx@cond\ifx\pltx@mark#1\pltx@mark\fi%
+ {\pltx@isletter@iii}{\pltx@isletter@iv}}
+\long\def\pltx@isletter@iii#1\pltx@mark{\@secondoftwo}
+\long\def\pltx@isletter@iv#1#2#3\pltx@mark{%
+ \pltx@cond\ifx\pltx@mark#3\pltx@mark\fi{%
+ \pltx@cond{\ifnum0\ifcat A\noexpand#21\fi\ifcat=\noexpand#21\fi>\z@}\fi
+ {\@firstoftwo}{\@secondoftwo}%
+ }{\@secondoftwo}}
+
+\def\@text@composite@x#1#2{%
+ \ifx#1\relax
+ #2%
+ \else\pltx@isletter{#1}{#1}{%
+ \begingroup
+ \setbox\z@\hbox\bgroup%
+ \ltj@yablshift\z@ \ltj@tablshift\z@
+ #1%
+ \@tempcntb\directlua{luatexja.pltx_composite_last_node_char()}%)
+ \xdef\pltx@composite@temp{\noexpand\@tempcntb=\the\@tempcntb\relax}%
+ \aftergroup\pltx@composite@temp
+ \egroup
+ \ifnum\ltjgetparameter{direction}=3 %
+ \@tempdima=\ltj@tablshift sp\else\@tempdima=\ltj@yablshift sp\fi
+ \ifnum\@tempcntb<\z@\@tempcnta\z@\else
+ \@tempcnta=\ltjgetparameter{jacharrange}{\ltjgetparameter{chartorange}{\@tempcntb}}\relax
+ \ifnum\@tempcnta=\z@\@tempdima\z@\fi
+ \fi
+ \ifnum\@tempcnta>\z@
+ \ifodd\ltjgetparameter{alxspmode}{\@tempcntb}\else\leavevmode\hbox{}\fi
+ \begingroup\mathsurround\z@$%
+ \hbox{\lower\@tempdima\box\z@}
+ $\endgroup%
+ \ifnum\ltjgetparameter{alxspmode}{\@tempcntb}<2\hbox{}\fi
+ \else
+ \ifdim\@tempdima=\z@{\ltj@yablshift\z@ \ltj@tablshift\z@#1}%
+ \else\lower\@tempdima\box\z@\fi
+ \fi
+ \endgroup}%
+ \fi
+}
+
\endinput
--- /dev/null
+%#!ptex2pdf -l text_composite.tex
+\documentclass{ltjarticle}
+%\DeclareTextComposite{\"}{OT1}{圏}{`点}% invalid
+%\usepackage[utf8x]{inputenc}
+%\usepackage[T1]{fontenc}
+\DeclareTextCompositeCommand{\"}{OT1}{圏}{テン}
+\DeclareTextCompositeCommand{\"}{T1}{圏}{テン}
+\def\test{あ\AA あ\'(あ\'eあ\'圏い\"圏うa\"圏a\AA a(\AA)\'e}
+\makeatletter
+\begin{document}
+\ltjsetparameter{xkanjiskip=15pt, yalbaselineshift=10pt}
+\test
+\setbox2=\hbox{あ\'eい}
+\directlua{luatexja.ext_show_node_list(tex.getbox(2), ' ', print)}
+\par
+\ltjsetparameter{yalbaselineshift=0pt}
+\test
+
+\mathsurround20pt
+\test
+
+\end{document}