Jonathan Kew wrote:

See https://tug.org/pipermail/xetex/2014-January/025129.html

Thank you, Jonathan.  Now formatted and included in the next iteration (code below, with "showhyphens.tex" attached).  I /believe/ that "showhyphens.tex" is functionally equivalent to David's code, but as he appears to have had a broken space bar and an intermittent "=" key, I cannot be sure that they are functionally identical ... And I /stil//l /don't understand why the code generates two pages.

% !TeX Program=Ini-XeTeX

\catcode `\ = 10
\catcode `\{ = 1
\catcode `\} = 2
\catcode `\# = 6
\catcode `\^ = 7
\catcode `\^^I = 10
\catcode `\% = 14

\let \bgroup = {
\let \egroup = }
\let \endgraf = \par

\tracingonline = 1
\tracinglostchars = 2

\input showhyphens
\message {\meaning \showhyphens}

\font \tenrm = "Amiri"
\tenrm
\hyphenchar \font = `\‐

\lccode "200D = "200D
\catcode "200D = 11
\patterns {^^^^200d1^^^^200d}

\def \text {foo^^^^200d^^^^200dbar}
\hsize = 0 pt
\vsize = \dimen 10
\noindent \ \text
\showhyphens \text
\end
--
/** Phil./

\def \loop #1\pool {\def \body {#1}\iterate}
\def \iterate {\body \let \next = \iterate \else \let \next = \relax \fi \next}
\let \pool = \fi

\def \showhyphenspace #1 
        {%
                \ifx \valign #1\valign
                \else
                        #1\vadjust {\penalty 1 } \expandafter \showhyphenspace
                \fi
        }

\def \showhyphens #1%
        {%
                \begingroup
                        \showboxbreadth =\dimen 10 
                        \showboxdepth =\dimen 10 
                        \pretolerance = -1 
                        \tolerance = -1 
                        \setbox 2 = \hbox {}%
                        \setbox 0 = \vbox
                        \bgroup
                                \pretolerance = -1 
                                \tolerance = -1 
                                \hbadness = 0
                                \parfillskip = 0 pt 
                                \hsize = 1 sp
                                \noindent
                                \hskip 0 pt
                                \hfuzz =\dimen 10 
                                \hbadness =\dimen 10 
                                \showhyphenspace #1 {} \endgraf
                                \loop
                                        \count 0 = 1 
                                        \ifnum \lastnodetype = 1 
                                                \setbox 4 = \lastbox
                                                \setbox 2 = \hbox {\unhbox 4 
\unhbox 2}%
                                                \count 0 = 0 
                                        \fi
                                        \ifnum \lastnodetype = 11 \unskip 
\count 0 = 0 \fi
                                        \ifnum \lastnodetype = 13
                                                 \count 2 = \lastpenalty
                                                 \unpenalty
                                                 \count 0 = 0 
                                                 \ifnum \count 2 = 1 \setbox 2 
= \hbox { \unhbox 2 }\count 0 = 0 \fi
                                        \fi
                                \ifnum \count 0 = 0
                                \pool
                                \hsize =\dimen 10 
                                \hfuzz = 0 pt
                                \hbadness 0
                                \par
                                \unhbox 2
                                \par
                        \egroup
                \endgroup
}

Reply via email to