\expandafter\let\csname ifltj@in@latex\expandafter\endcsname
\csname iftrue\endcsname
\NeedsTeXFormat{LaTeX2e}
- \ProvidesPackage{luatexja-adjust}[2022-01-03]
+ \ProvidesPackage{luatexja-adjust}[2022-02-07]
\fi %</LaTeX>
% Load core module if not yet.
\define@key[ltj]{japaram}{profile_hgap_factor}{%
\directlua{luatexja.adjust.profile_hgap_factor = math.abs(#1)}\relax}
+\newluafunction\ltj@@ghost@jachar@inner
+\typeout{\the\ltj@@ghost@jachar@inner.}
+\directlua{
+ local t = lua.get_functions_table(); local cgj = luatexja.adjust.create_ghost_jachar_node;
+ t[\the\ltj@@ghost@jachar@inner] = function() cgj(0) end
+}%
+\protected\def\ltjghostjachar{\ifhmode\relax\luafunction\ltj@@ghost@jachar@inner\fi}
+
%%------------------ all done
\ltj@adjust@AtEnd
end
end
-
+do
+ local ltja = luatexja.adjust
+ local sid_user = node.subtype 'user_defined'
+ local node_remove = node.direct.remove
+ local node_write = node.direct.write
+ local GHOST_JACHAR = luatexbase.newuserwhatsitid('ghost of a jachar', 'luatexja')
+ luatexja.userid_table.GHOST_JACHAR = GHOST_JACHAR
+ function ltja.create_ghost_jachar_node(cl)
+ local tn = node_new(id_whatsit, sid_user)
+ setfield(tn, 'user_id', GHOST_JACHAR)
+ setfield(tn, 'type', 100)
+ setfield(tn, 'value', cl)
+ node_write(tn)
+ end
+ local function whatsit_callback(Np, lp, Nq)
+ if Np and Np.nuc then return Np
+ elseif Np and getfield(lp, 'user_id') == GHOST_JACHAR then
+ Np.first = lp; Np.nuc = lp; Np.last = lp; Np.class = getfield(lp,'value')
+ if Nq then Np.met = Nq.met; Np.pre = 0; Np.post = 0; Np.xspc = 3 end
+ Np.auto_kspc, Np.auto_xspc = (has_attr(lp, attr_autospc)==1), (has_attr(lp, attr_autoxspc)==1)
+ return Np
+ else return Np end
+ end
+ local function whatsit_after_callback(s, Nq, Np, head)
+ if not s and getfield(Nq.nuc, 'user_id') == GHOST_JACHAR then
+ local x, y = node_prev(Nq.nuc), Nq.nuc
+ Nq.first, Nq.nuc, Nq.last = x, x, x
+ if Np then Nq.met = Np.met end
+ s = node_remove(head, y); node_free(y)
+ end
+ return s
+ end
+ luatexbase.add_to_callback("luatexja.jfmglue.whatsit_getinfo", whatsit_callback,
+ "ghost of a JACHAR", 1)
+ luatexbase.add_to_callback("luatexja.jfmglue.whatsit_after", whatsit_after_callback,
+ "ghost of a JACHAR", 1)
+end
\documentclass{ltjsarticle}
\usepackage{luatexja-fontspec,luatexja-adjust,xcolor,amsmath,amssymb}
+\DeclareKanjiFamily{JY3}{piyo}{}
+\DeclareFontShape{JY3}{piyo}{m}{n}{<-> s*[\Cjascale] file:ipaexg.ttf:jfm=jlreq}{}
\def\sq{%
\hbox to 1\zw{\hss\fboxsep=-.5\fboxrule\fbox{%
+\newpage
+
+\def\MYGUARDA#1{ \kern-\zw#1\kern-\zw \ignorespaces}
+\def\MYGUARDB#1{{\kanjifamily{mc}\selectfont }%
+ \kern-\zw#1\kern-\zw{\kanjifamily{mc}\selectfont }\ignorespaces}
+\def\MYGUARDC#1{\ltjghostjachar#1\ltjghostjachar\ignorespaces}
+\def\MYVRULE{\raisebox{-2pt}{漢}}
+
+\paragraph{jfm: ujis}\
+
+\leavevmode\hbox to 15\zw{◆\MYVRULE ◆◆◆◆$f$◆}\par
+\leavevmode\hbox to 15\zw{◆\MYGUARDA{\MYVRULE}◆◆◆◆$f$◆} A\par
+\leavevmode\hbox to 15\zw{◆\MYGUARDB{\MYVRULE}◆◆◆◆$f$◆} B\par
+\leavevmode\hbox to 15\zw{◆\MYGUARDC{\MYVRULE}◆◆◆◆$f$◆} C\par
+\leavevmode\hbox to 15\zw{◆◇◆◆◆◆$f$◆} 比較用\par
+
+\paragraph{jfm: jlreq}\
+\kanjifamily{piyo}\selectfont
+\leavevmode\hbox to 15\zw{◆\MYVRULE ◆◆◆◆$f$◆}\par
+\leavevmode\hbox to 15\zw{◆\MYGUARDA{\MYVRULE}◆◆◆◆$f$◆} A\par
+\leavevmode\hbox to 15\zw{◆\MYGUARDB{\MYVRULE}◆◆◆◆$f$◆} B\par
+\leavevmode\hbox to 15\zw{◆\MYGUARDC{\MYVRULE}◆◆◆◆$f$◆} C\par
+\leavevmode\hbox to 15\zw{◆◇◆◆◆◆$f$◆} 比較用\par
\end{document}