[latex3-commits] [latex2e-public] r1327 - xetex \showhyphens

noreply at latex-project.org noreply at latex-project.org
Tue Jan 10 11:56:59 CET 2017


Author: carlisle
Date: 2017-01-10 11:56:58 +0100 (Tue, 10 Jan 2017)
New Revision: 1327

Modified:
   trunk/base/changes.txt
   trunk/base/ltfssbas.dtx
Log:
xetex \showhyphens

Modified: trunk/base/changes.txt
===================================================================
--- trunk/base/changes.txt	2017-01-10 09:28:31 UTC (rev 1326)
+++ trunk/base/changes.txt	2017-01-10 10:56:58 UTC (rev 1327)
@@ -4,6 +4,10 @@
 are not part of the distribution.
 =======================================================================
 
+2017-01-10  David Carlisle  <latex-bugs at latex-project.org>
+
+	* ltfssbas.dtx: Add version of \showhyphens that works in XeTeX.
+
 2016-12-30  David Carlisle  <latex-bugs at latex-project.org>
 
 	* ltluatex.dtx: build_page_insert callback and documentation updates.

Modified: trunk/base/ltfssbas.dtx
===================================================================
--- trunk/base/ltfssbas.dtx	2017-01-10 09:28:31 UTC (rev 1326)
+++ trunk/base/ltfssbas.dtx	2017-01-10 10:56:58 UTC (rev 1327)
@@ -35,7 +35,7 @@
 %
 %
 \ProvidesFile{ltfssbas.dtx}
-             [2015/04/07 v3.1a LaTeX Kernel (NFSS Basic Macros)]
+             [2017/01/10 v3.2a LaTeX Kernel (NFSS Basic Macros)]
 % \iffalse
 \documentclass{ltxdoc}
 \begin{document}
@@ -1799,10 +1799,20 @@
 %    {Use \cs{normalfont} and make colour safe, and autoloadable}
 % \changes{v3.0u}{1998/03/25}
 %    {Suppress unnecessary error when used in preamble}
+% \changes{v3.2a}{2017/01/10}
+%    {Add version of \cs{showhyphens} that works with Xe\TeX.}
 %    The |\showhyphens| command must be redefined since the version in
 %    \texttt{plain.tex} uses |\tenrm|.  We have also made some further
 %    adjustments for its use in \LaTeX.
 %    \begin{macrocode}
+%</2ekernel>
+%<latexrelease>\IncludeInRelease{2017/01/01}{\showhyphens}%
+%<latexrelease>                 {XeTeX support for \showhyphens}%
+%<*2ekernel|latexrelease>
+\ifx\XeTeXcharclass\@undefined
+%    \end{macrocode}
+% Version for engines other than Xe\TeX.
+%    \begin{macrocode}
 \gdef\showhyphens#1{%
   \setbox0\vbox{%
     \color at begingroup
@@ -1812,6 +1822,95 @@
     \pretolerance\m at ne\tolerance\m at ne\hbadness\z@\showboxdepth\z@\ #1%
     \color at endgroup}}
 %    \end{macrocode}
+%    \begin{macrocode}
+\else
+%    \end{macrocode}
+% Xe\TeX\ version. When using system fonts Xe\TeX\ reports consecutive
+% runs of characters as a single item in box logging, which means the
+% standard |\showhyphens| does not work.  This version typesets the
+% text into a narrow box to force hyphenation and then reconstructs a
+% horizontal list with explicit hyphens to generate the display. Note
+% that the |lmr| OpenType font is forced, this works even if the
+% characters are not in the font as hyphenation is attempted due to
+% the width of the space and hyphen character. It may generate
+% spurious Missing Character warnings in the log, these are however
+% suppressed from the terminal output by ensuring that
+% |\tracingonline| is locally zero.
+%    \begin{macrocode}
+\long\def\showhyphens#1{%
+  \setbox0\vbox{%
+    \usefont{TU}{lmr}{m}{n}%
+    \hsize 1sp %
+    \hbadness\@M
+    \hfuzz\maxdimen
+    \tracingonline\z@
+    \everypar={}%
+    \leftskip\z at skip
+    \rightskip\z at skip
+    \parfillskip\z at skip
+    \hyphenpenalty=-\@M
+    \pretolerance\m at ne
+    \interlinepenalty\z@
+    \clubpenalty\z@
+    \widowpenalty\z@
+    \brokenpenalty1127 %
+    \setbox\z@\hbox{}%
+    \noindent
+    \hskip\z at skip
+    #1%
+    \par
+%    \end{macrocode}
+% Note here we stop the loop if made no progress, non-removable items
+% may mean that we can not process the whole list (which would be
+% testable as |\lastnodetype=-1|).
+%    \begin{macrocode}
+     \loop
+     \@tempswafalse
+     \ifnum\lastnodetype=11\unskip\@tempswatrue\fi
+     \ifnum\lastnodetype=12\unkern\@tempswatrue\fi
+     \ifnum\lastnodetype=13 %
+      \count@\lastpenalty
+      \unpenalty\@tempswatrue
+    \fi
+    \ifnum\lastnodetype=\@ne
+     \setbox\tw@\lastbox\@tempswatrue
+     \setbox0\hbox{\unhbox\tw@\unskip\unskip\unpenalty
+                   \ifnum\count@=1127 \else\ \fi
+                   \unhbox0}%
+     \count@\z@
+    \fi
+    \if at tempswa
+    \repeat
+   \hbadness\z@
+   \hsize\maxdimen
+   \showboxdepth\z@
+   \tolerance\m at ne
+   \hyphenpenalty\z@
+   \noindent\unhbox\z@
+}}
+%    \end{macrocode}
+%
+%    \begin{macrocode}
+\fi
+%    \end{macrocode}
+%
+%    \begin{macrocode}
+%</2ekernel|latexrelease>
+%<latexrelease>\EndIncludeInRelease
+%<latexrelease>\IncludeInRelease{0000/00/00}{\showhyphens}%
+%<latexrelease>                 {XeTeX support for \showhyphens}%
+%<latexrelease>\gdef\showhyphens#1{%
+%<latexrelease>  \setbox0\vbox{%
+%<latexrelease>    \color at begingroup
+%<latexrelease>    \everypar{}%
+%<latexrelease>    \parfillskip\z at skip\hsize\maxdimen
+%<latexrelease>    \normalfont
+%<latexrelease>    \pretolerance\m at ne\tolerance\m at ne
+%<latexrelease>    \hbadness\z@\showboxdepth\z@\ #1%
+%<latexrelease>    \color at endgroup}}
+%<latexrelease>\EndIncludeInRelease
+%<*2ekernel>
+%    \end{macrocode}
 % \end{macro}
 %
 %



More information about the latex3-commits mailing list