# Correcting wrong choice of character variant from a stylistic set

I'm typesetting a document in German blackletter with XeLaTeX and ran across a peculiar — for want of a better word — error:

The hyphenation in itself is okay at that position. However, German blackletter typesetting rules would require a long ſ before the hyphen.

The font I'm using offers a stylistic set that does a good job of identifying which s should stay s and which should turn into ſ. Apparantly, though, this stylistic set isn't applied until after TeX has finished hypenating the word in question because if the word shown there is not hyphenated, it is rendered correctly as flüſſige.

I had the following thoughts on how to circumvent that:

• Adding a ZWJ between the ses (\char"200D)
• Adding a ZWNJ before the ses (\char"200C)
• Adding "| (ligature breaker as defined by polyglossia) or \/

In the first two cases, hyphenation is suppressed altogether (but checking a different mischosen s variant I seem to be able to confirm that nothing happened at all). The third case, of course, adds an additional break point and thus induces incorrect hyphenation.

Are there any options to force TeX to render the correct s glyph without entering it in plain text? Something like:

• modifying the hypenation char to read a two-character sequence including something that induces the correct s? (unlikely from the answers to this question and the missing answers to this question
• Adding some additional glyph choosing mechanism designed to only capture special cases not properly rendered by the font's stylistic set?

The font is UnifrakturMaguntia and all information about it including downloads can be found on its Sourceforge page.

On a side note: The documentation (page 31; in German) implies that an s after an other character and preceeding another s be rendered as ſ. Now I'm not sure if TeX somehow suppresses the undisplayable characters or if that is an error of the font's side. If the former, is there any zero-width character that won't be gobbled?

The important part of the code:

\documentclass[12pt,a4paper,twoside]{scrreport}
\usepackage{amsmath}
\usepackage{mathspec}
\usepackage{polyglossia}
\setmainlanguage[babelshorthands=true,spelling=new,script=fraktur]{german}

\setmainfont[Mapping=tex-text,StylisticSet=11]{UnifrakturMaguntia}

\makeatletter
\begingroup\lccode~="
\lowercase{\endgroup
\everymath{\let~\eu@active@quote}
\everydisplay{\let~\eu@active@quote}
}
\makeatother % This code is included to keep German TeX ligatures such as
%            % "~ active, despite amsmath package.

\newcommand\zwj{\char"200D} % defines \zwj as zero-width joiner
\newcommand\zwnj{\char"200C} % defines \zwnj as zero-width non-joiner

\begin{document}
Einfüllung mit dem Laufmittelgemisch aufgeschlämmt und unter Stickstoffüberdruck gepackt. Flüssige
und ölige Proben wurden in wenig Laufmittelgemisch angelöst und mit einer Pasteurpipette vorsichtig auf die
Silicaschicht aufgetragen. Feststoffe, die sich nicht in wenig Laufmittelgemisch lösen ließen, wurden mit einem
passenden Lösungsmittel gelöst, mit Kieselgel versetzt, das Lösungsmittel am Rotationsverdampfer entfernt und

\noindent (Think of the same text repeating) Flüs\zwj sige (etc.)

\noindent (Think of the same text repeating) Flü\zwnj ssige (etc.)

\noindent (Think of the same text repeating) Flü"|ssige (etc.)

\end{document}

There is more in my actual document. I just realised the incorrect s before the hyphen at that position, so I experimented and found I could reproduce it by adding at least those lines of text that I wrote down here. I have no idea how to make columns smaller to force hyphenation (that would help testing a lot, though).

• Please provide some code we can reproduce with and the details of the font if it is not standard. Note that, in general, with TeX/pdfTeX you have complete control but also complete responsibility via TeX. With Xe/LuaTeX much of the responsibility is passed to the font. That can be great. But you cede a certain amount of control. You are at the mercy of the font designer to a much greater extent. [Of course, the 'you' here is typically the person who packages the fonts in the former case - not the end user. But that is a TeX-based responsibility, rather than a font foundry one.]
– cfr
Apr 27, 2015 at 23:58
• @cfr I added some code and the details of the font including a link. From your comment it sounds as if I lost the critical part of control to the font by using XeLaTeX … If the amount of code is too much, feel free to edit away.
– Jan
Apr 28, 2015 at 20:25
• I don’t think the problem is that the stylistic set isn’t applied until after TeX has finished hypenating the word, because the same error appears if I type “Flüs-sige” on a line by itself. The designer probably needs to add a contextual alternate. You should perhaps raise this issue at unifraktur.sourceforge.net/unifraktur-forum Jun 12, 2015 at 17:25
• @Thérèse Thanks for that insight, I didn't think of trying that. But in my opinion that supports my notion, because the hyphen that is typeset there makes the font believe that it's the end of the word.
– Jan
Jun 12, 2015 at 17:37
• @Jan For those of us not savvy, can the desired rule be summarized concisely? please cover the issue for both hyphenated and non-hyphenated forms, if they are different. Feb 7, 2021 at 2:03