6

I’m typesetting some documents with XeLaTeX, using in the OS X distribution of Hoefler Text. Unfortunately, said font has had a nasty bug since forever: its default hyphen character is formatted for capital letters, not minuscule. The font has a proper hyphen glyph (glyph 16, accurately named “hyphen”).

It seems1 this glyph is not “linked”2 to any Unicode point, preventing me from using the suggested solution from Ornamental hyphenation character with Xe(La)TeX.

How can I use this glyph for hyphenation? Automatic, manual, or both?


  1. In Font Book.app, no Unicode point appears in the tooltip for this character.
  2. In case there was still any doubt, I have no idea of what a font file looks like.
Édouard
  • 435
  • Perhaps something at http://tex.stackexchange.com/questions/150186/it-doesnt-hyphenate-words-ending-with will help? It explains how to use alternate hyphenation characters in XeLaTeX. (It is much easier with regular LaTeX!) – cfr Apr 29 '14 at 02:02
  • 2
    Instead of using the anonymous glyph 16, you could choose the "minus" sign, which actually looks the same and has a proper Unicode point; so try HyphenChar="2212. – Robert Apr 29 '14 at 02:42
  • @Robert So simple… Now is there a way to substitute the ‘-’ characters I actually with glyph 16 or the minus sign, or should I just us a macro for these? – Édouard Apr 29 '14 at 09:38
  • It's probably easiest to use a macro as there is no way of substituting the hyphen character other than modifying the font itself (eg., with Apple Font Tools). – Robert Apr 30 '14 at 01:23
  • See http://tex.stackexchange.com/questions/154613/raise-lower-a-single-character-of-a-font-hyphen/168603#168603. Here, one has the option of turning the hyphen active (and alternately restoring it to its original form, if active hyphen breaks things). In the cited answer, the active is used to invoke a \raisebox, though you could make it so the active hyphen invokes glyph 16. – Steven B. Segletes May 02 '14 at 02:04

1 Answers1

1

This should really be fixed in the font, of course. But if you use XeTeX or LuaTeX it is possible to access so-called unencoded glyphs in the font if you know their glyph ID.

In XeTeX the notation is \XeTeXglyph16. For LuaTeX, you will need some lines of code as seen in this answer by @1010011010.

Example using xelatex:

\documentclass{article}
\usepackage{fontspec}
\setmainfont{Hoefler Text}

\newcommand{\lowhyphen}{\XeTeXglyph16}

\begin{document}

H-H

a-a

a\lowhyphen a

\end{document}

Result:

enter image description here

This will work for manual use only. I don't have a solution for replacing automatic hyphens with this unencoded glyph. I tried this solution by @Steven B. Segletes but it does not work for me for automatic hyphens, only for manually typed ones.

lvcivs
  • 894
  • I do not have the Hoefler font, so I can't say this with 100% certainty, but I was able to get my referenced solution to "work". 1st, replace the fontenc load with \usepackage{fontspec}. Then, use this definition: \def\newhyphen{\XeTeXglyph16}. Compile with Xelatex. – Steven B. Segletes Jan 05 '21 at 16:59
  • @Steven B. Segletes That is exactly what I tried and it does work for me for words with manually typed hyphens (as in h-y-p-h-e-n in your example), but not for normal text produced e.g. with \lipsum{} that will be hyphenated automatically. – lvcivs Jan 05 '21 at 17:14
  • Thank you. I now understand what you mean...discretionary hyphens. – Steven B. Segletes Jan 05 '21 at 17:28