I am trying o typeset a few of the fairy tales my daughter likes so much. Since they aren't copyrighted anymore, I am reproducing a short one here. Suppose I have the following source file:
\documentclass[paper=A5]{scrbook}
\usepackage{fontspec}
\usepackage[german]{babel}
\usepackage{csquotes}
\defaultfontfeatures{Ligatures=TeX}
\setmainfont{UnifrakturMaguntia}
\renewcommand\emshape{\addfontfeature{LetterSpace=20.0,Ligatures=Required,Ligatures=NoCommon}}
\begin{document}
\section*{Der ſüße Brei}
Es war einmal ein armes, frommes Mädchen, das lebte mit ſeiner Mutter
allein, und ſie hatten nichts mehr zu eſſen. Da ging das Kind hinaus
in den Wald, und begegnete ihm da eine alte Frau, die wußte ſeinen
Jammer ſchon und ſchenkte ihm ein Töpfchen, zu dem ſollt es ſagen:
\enquote{Töpfchen, koche}, ſo kochte es guten, ſüßen Hirſenbrei, und
wenn es ſagte: \enquote{Töpfchen, ſteh}, ſo hörte es wieder auf zu
kochen. Das Mädchen brachte den Topf ſeiner Mutter heim, und nun waren
ſie ihrer Armut und ihres Hungers ledig und aßen ſüßen Brei, ſooft
ſie wollten. Auf eine Zeit war das Mädchen ausgegangen, da ſprach die
Mutter \enquote{Töpfchen, koche}, da kocht es, und ſie ißt ſich ſatt;
nun will ſie, daß das Töpfchen wieder aufhören ſoll, aber ſie weiß das
Wort nicht. Alſo kocht es fort, und der Brei ſteigt über den Rand
hinaus und kocht immerzu, die Küche und das ganze Haus voll, und das
zweite Haus und dann die Straße, als wollts die ganze Welt ſatt machen,
und iſt die größte Not, und kein Mensch weiß ſich da zu helfen.
Endlich, wie nur noch ein einziges Haus übrig iſt, da kommt das Kind
heim und ſpricht nur: \enquote{Töpfchen, ſteh}, da ſteht es und hört
auf zu kochen; und wer wieder in die Stadt wollte, der mußte ſich
durcheſſen.
\end{document}
... which currently renders as:
How can I force a version that uses a modern font to render the long ſ as contemporary standard s? The issue is already demonstrated in the above rendering in the heading, but it's very obvious when removing (commenting out) the \setmainfont line of the document:
So is there a way to force the Unicode code point for ſ, which seemingly most editors consider to be identical to s (Vim even got confused), to re-map to the glyph s whenever I build the document in a particular way?
PS: there's one glitch in the rendered version which I removed, so it's not 100% identical to what you would get. I replaced an accidental .; by ; in the above.



s. And awkwardly - in Vim - trying%s/ſ/s/gled to all sorts of blank space between words getting removed and so on. I then tried to search for ſ and noticed that more than merely the ſ got highlighted. But you're right insofar as that's my backup plan. But it feels awkward to use an outside tool when I have such a sophisticated tool in use already. – 0xC0000022L May 03 '20 at 18:06