1

Can't seem to find an answer online.

I am using the Linux Libertine font with LuaLaTeX, but I'm having a problem with two characters: ɭ and ɳ. The problem is that Linux Libertine does not support these characters in its bold series. My work-around has been to tell LaTeX to use the very similar Minion 3 font in these cases:

\documentclass{article}

\usepackage{fontspec}
\usepackage{newunicodechar}

\setmainfont{Linux Libertine}

\newunicodechar{ɭ}{{\fontspec{Minion3} ɭ}}
\newunicodechar{ɳ}{{\fontspec{Minion3} ɳ}}

\begin{document}

The bold Minion 3 characters \textbf{ɭ, ɳ} look perfect, but I want the regular ɭ, ɳ characters to be in Linux Libertine.

\end{document}

I am wondering if it is at all possible to have this substitution occurring only in bold environments? Perhaps this is achievable either by a conditional saying (something to the effect of) whenever text is in bold face, then \newunicodechar{...}, or by some other method of substituting Linux Libertine bold ɭ, ɳ for Minion 3's bold equivalents? Or maybe there is a solution using Lua code.

Any help or ideas would be greatly appreciated, thanks!

1 Answer 1

3

You should never use \fontspec in the document. It's much more efficient to define a new font family.

Add a conditional that's true when \bfseries has been issued.

\documentclass{article}

\usepackage{fontspec}
\usepackage{newunicodechar}

\setmainfont{Linux Libertine O}
\newfontfamily{\boldsub}{Noto Sans}

\makeatletter
\newif\if@boldface
\AddToHook{cmd/bfseries/after}{\@boldfacetrue}
\newcommand{\maybe@boldsub}[1]{%
  \if@boldface
    {\boldsub#1}%
  \else
    #1%
  \fi
}
\newunicodechar{ɭ}{\maybe@boldsub{ɭ}}
\newunicodechar{ɳ}{\maybe@boldsub{ɳ}}
\makeatother

\begin{document}

The bold Minion 3 characters \textbf{ɭ, ɳ} look perfect, 
but I want the regular ɭ, ɳ characters to be in Linux Libertine.

\end{document}

Sorry for Noto Sans, but I don't have Minion 3, so I used a very distinctive font to see that the substitution has indeed been performed.

enter image description here

3
  • Thank you egreg, excellent solution as always! I'm just curious, why should \fontspec be avoided in the document? Feb 23 at 3:33
  • @geordiekidd You’d be recalculating the whole font family at every call.
    – egreg
    Feb 23 at 8:42
  • Right, I see. Thanks! Feb 24 at 3:53

You must log in to answer this question.

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