Armenian hyphenation

David Carlisle d.p.carlisle at gmail.com
Mon Jun 17 13:30:26 CEST 2024


you now (always?) also need \tracinglostchars=0

\documentclass[12pt]{article}

\usepackage{fontspec}
\setmainfont{FreeSans}
\begin{document}

\makeatletter
\DeclareRobustCommand\showhyphens[1]{%
  \setbox0\vbox{%
    \usefont{TU}{lmr}{m}{n}%
    \hsize 1sp %
    \hbadness\@M
    \hfuzz\maxdimen
    \tracingonline\z@
    \tracinglostchars\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
     \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@
}}

\showhyphens{ինչու ինչպես որտեղ հիվանդանոց հիվանդանոցում Երևան Երևանում
Նամակ Երևանիս ԵՐԵՎԱՆ
ԵՐԵՎԱՆՈՒՄ ԵՐԵՎԱՆԻՍ շնորհակալություն անպայման այրվել անգին անձրևանոց
ԱՆՁՐԵՎԱՆՈՑ հիվանդանոցու՞մ}


\end{document}

On Mon, 17 Jun 2024 at 12:25, David Carlisle <d.p.carlisle at gmail.com> wrote:

> This is unrelated to polyglossia the latex format does
>
> \ifx\XeTeXcharclass\@undefined
> \DeclareRobustCommand\showhyphens[1]{%
> ....
> \else
> \DeclareRobustCommand\showhyphens[1]{%
>   \setbox0\vbox{%
>     \usefont{TU}{lmr}{m}{n}%
>
>
> % 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.
> %
>
>
> That last line seems no longer true as the warnings are emitted, I'll
> check.... (latex2e github issue would be easier place to track any changes
> than this list but no matter really)
>
> david
>
>
> On Mon, 17 Jun 2024 at 12:16, David Carlisle <d.p.carlisle at gmail.com>
> wrote:
>
>> I get no missing character warning with lualatex but xelatex is using
>> latin modern in show hyphens so warns all the characters are missing
>>
>> On Mon, 17 Jun 2024 at 12:01, Zdenek Wagner <zdenek.wagner at gmail.com>
>> wrote:
>>
>>> Hi all,
>>>
>>> TeX Live contains Armenian hyphenation patterns in hyph-hy (Armenian in
>>> Armenian is hayeren) but they are not used in polyglossia. Is there any
>>> reason? In addition, \showhyphens report missing characters although my
>>> default font contains them. MWE is below
>>>
>>> \documentclass[12pt]{article}
>>> \usepackage{polyglossia}
>>> \setdefaultlanguage{armenian}
>>> \setmainfont{FreeSans}
>>> \begin{document}
>>> Բարև՛ Ձեզ
>>>
>>> \showhyphens{ինչու ինչպես որտեղ հիվանդանոց հիվանդանոցում Երևան Երևանում
>>> Նամակ Երևանիս ԵՐԵՎԱՆ
>>> ԵՐԵՎԱՆՈՒՄ ԵՐԵՎԱՆԻՍ շնորհակալություն անպայման այրվել անգին անձրևանոց
>>> ԱՆՁՐԵՎԱՆՈՑ հիվանդանոցու՞մ}
>>>
>>> ինչու ինչպես որտեղ հիվանդանոց հիվանդանոցում Երևան Երևանում Նամակ Երևանիս
>>> ԵՐԵՎԱՆ
>>> ԵՐԵՎԱՆՈՒՄ ԵՐԵՎԱՆԻՍ շնորհակալություն անպայման այրվել անգին անձրևանոց
>>> ԱՆՁՐԵՎԱՆՈՑ հիվանդանոցու՞մ
>>> \end{document}
>>>
>>> Zdeněk Wagner
>>> https://www.zdenek-wagner.eu/
>>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://tug.org/pipermail/tex-live/attachments/20240617/adc4b39b/attachment-0001.htm>


More information about the tex-live mailing list.