LuaTeX: how to "steal" one glyph of other fonts and add it to the main fonts? "§" is missing!

Easy enough with newunicodechar:

\documentclass[parskip=half]{scrartcl}

\usepackage{fontspec}
\usepackage{polyglossia, microtype}
\usepackage{newunicodechar}

\setdefaultlanguage{german}
\setmainfont[Ligatures=TeX, RawFeature=+pnum]{ErasmusMMXVI}
\newfontfamily{\ErasmSupNum}[VerticalPosition=Superior]{ErasmusMMXVI}


\deffootnotemark{\ErasmSupNum\thefootnotemark}
\newfontfamily{\ErasmUpper}[LetterSpace=6.0]{ErasmusMMXVI}
\newfontfamily{\Biolinum}{Linux Biolinum O}

\addtokomafont{title}{\ErasmUpper}

\newunicodechar{§}{{\Biolinum §}}

\title{ERASMUS MMXVI}
\subtitle{OPEN-TYPE FEATURES}
\date{}

\begin{document}
\maketitle{}

Paragraphenzeichen: § \textit{§}

Ligaturen: fi fl ff fleißig 

Hochzahlen für Fußnoten\footnote{Ha!}

Superior: \textsuperscript{1234567890}

Proportional: 0123456789

\fontspec[RawFeature=+tnum]{ErasmusMMXVI}
Monospaced: 0123456789


\itshape


Ligaturen: fi fl ff ffi ffl fh tr


fleissig\\
{\addfontfeatures{RawFeature=+swsh}
fleissig (Style=Swash)}

Hochzahlen für Fußnoten\footnote{Ha!}

Superior: \textsuperscript{1234567890}

\fontspec[RawFeature=+pnum]{ErasmusMMXVI}
Proportional: 0123456789

\end{document}

enter image description here

What's the difference between this and the direct \def as an active character? Well, the \def is \protected, so no special care is needed in moving arguments, and no trickery with \string is needed.

A possibly better definition, that performs the substitution only if the glyph does not exist in the current font:

\newunicodechar{§}{\iffontchar\font`§ §\else{\Biolinum §}\fi}

In order to cope with scrjura.sty, just add, after the \newunicodechar declaration,

\renewcommand*{\Clauseformat}[1]{§~#1}

This macro is the only place in scrjura.sty where \S is used.


For example

\newfontfamily\LB{Linux Biolinum O}
\catcode`\§=\active
\def§{{\LB\string§}}

Tags:

Fonts

Fontspec