3

I’m typesetting a document in Hoefler Text with XeTeX. I am however dissatisfied with the default position hyphens and dashes and much rather use other glyphs instead. I currently achieve this with the \XeTeXglyph macro.

Unfortunately, the last character before I call the \XeTeXglyph macro behaves as it was the last character of the line and is sometimes replaced by a variant glyph, which is often unsuitable.

%!TEX TS-program = xelatex
%!TEX encoding = UTF-8 Unicode

\documentclass{article}
\usepackage{fontspec} 

\setromanfont{Hoefler Text}

% DOCUMENT
\begin{document}

\itshape % italics trigger variants much more readily

n-t % doesn't trigger n variant

n\XeTeXglyph 16 t % does trigger n variant

\end{document}

Is there another (better) way to invoke the right glyph without triggering the variant? Or is there a way to prevent triggering the character variant while using \XeTeXglyph, preferably without replacing the n by another \XeTeXglyph?

2
  • The way \XeTeXglyph is implemented makes it interrupt input stream, so the layout engine sees n alone, then t alone. There might be an AAT feature to access the form you want, check features reported by aat-info.tex and see if any helps. Commented Jun 19, 2013 at 12:36
  • I couldn’t find any way to access the hyphens or dashes I am looking for. But the [ContextLineFinal=NoLineFinal] you helped me discover allows me to avoid the n swash altogether.
    – Édouard
    Commented Jun 19, 2013 at 13:39

1 Answer 1

1

The \fontspec option Contextuals=NoLineFinal provides a way to avoid swashes at the end of the line. As this is (if I understood correctly) basically what happens at the layout engine level whenever I use \XeTeXglyph macro, I just had to ensure the option was set correctly.

\documentclass{article}
\usepackage{fontspec} 

\setromanfont{Hoefler Text}
\newfontfamily \NoSwash [ItalicFeatures={Contextuals=NoLineFinal}]{Hoefler Text}
% Contextual=(No)LineFinal is meaningful only for the italic face of the family

% DOCUMENT
\begin{document}

\itshape

n-t

{\NoSwash n\XeTeXglyph 16 t} % disables it on the whole line

{\NoSwash n}\XeTeXglyph 16 t % disables it around the n only

{\fontspec[ItalicFeatures={Contextuals=NoLineFinal}]{Hoefler Text} n}\XeTeXglyph 16 t
% does the same locally

\end{document}

Not “breaking the input stream” would probably be better, but this works for now.

1
  • Very weirdly, TeXlive 2013 broke this workaround. I’m studying the case whenever I have time and will probably ask another question then.
    – Édouard
    Commented Jun 24, 2013 at 21:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .