1

I am using Minion Pro (with fontspec under LuaLaTeX), and the character ϱ(= \varrho, but in text mode) doesn't show.

input: ϱυϑμὸν
output: �υϑμὸν

Is there a way to globally remap only this character to a different font? I can, of course, use a different font for every instance (or all Greek text, for that matter) but would rather not.

Ingmar
  • 6,690
  • 5
  • 26
  • 47
  • you can setup a fallback font, see e.g. https://tex.stackexchange.com/a/572220/2388 – Ulrike Fischer Nov 27 '20 at 14:48
  • Thanks. I'm not having trouble with emojis, but the principle should be the same. I'll give it a shot tonight. – Ingmar Nov 27 '20 at 14:55
  • 2
    I do know that emoiji and greek symbols are something different ;-). But yes the principle is the same. – Ulrike Fischer Nov 27 '20 at 15:02
  • 2
    Probably you want to substitute it with a standard rho, don't you? – egreg Nov 27 '20 at 15:05
  • @egreg: Not necessarily. If there is ϱ in the original text, I'd like to find a font that can display it. For a single character (and a rare one at that), pretty much any humanist font will do in a pinch. – Ingmar Nov 27 '20 at 16:47
  • 1
    @Ingmar The original text has a rho, the graphical realization of which depends on the printer/typographer or copyist. – egreg Nov 27 '20 at 17:22
  • @UlrikeFischer: Thank you for pointing me to the fallback font option. Even though I ended up using newunicodechar in this case, this is a valuable option to have. – Ingmar Nov 27 '20 at 17:23
  • @egreg: I know, but not exactly being a Greek scholar myself this is a copy & paste & it should work kind of deal. The original used ϱ, so who am I to go change it to ρ instead? I saw your answer (since deleted) and incorporated it into mine, so thanks for your effort. – Ingmar Nov 28 '20 at 07:17

2 Answers2

2

I am answering my own question, as it allows me more formatting than a simple comment, and to sum up the various answers and comments I have received. I have since discovered that my font is missing another character, ɔ, so my solution deals with both of them:

\documentclass{scrartcl}
\usepackage{newunicodechar}
\usepackage{fontspec}

\setmainfont{MinionPro.otf} % Any defective font will do. Font files kept in the % current directory to eliminate all path issues etc. % The fallback font: \newfontfamily{\gentium}[Scale=MatchLowercase]{GentiumPlus-Regular.ttf}

% (Only) if character is not found in current font, fall back to Gentium: \newunicodechar{ϱ}{\iffontchar\fontϱ ϱ\else{{\gentium ϱ}}\fi} \newunicodechar{ɔ}{\iffontchar\fontɔ ɔ\else{{\gentium ɔ}}\fi}

\begin{document} {\huge Hellɔ woϱld!} \end{document}

Ingmar
  • 6,690
  • 5
  • 26
  • 47
  • 1
    Might be worthwhile to load gentium with Scale=MatchLowercase so the glyphs are the same size. An \ifmmode would additionally let you use the symbols in math mode. – Davislor Nov 28 '20 at 08:08
  • Duly noted. That said, I do quite a bit more than that, actually (loading font variants, providing for small caps features, ligatures and the like) but didn't consider it necessary for a minimal example. And I never need math mode: but since these answers seemingly live on forever, this is definitely an important point to consider for some. – Ingmar Nov 28 '20 at 09:19
  • Fair enough! Good self-answer. – Davislor Nov 28 '20 at 23:39
1

I don’t have Minion Pro to test this, but you can set the character active with newunicodechar, look up whether the current font contains ϱ with \iffontchar, and return the character if so, e.g.

\iffontchar\font`ϱ\symbol"03F1\else\symbol"03C1\fi

In practice, you might want to wrap this further in \ifmmode to use \varrho in math mode, e.g.

\ifmmode%
  \varrho%
\else%
  \iffontchar\font`ϱ%
    \symbol"03F1%
  \else\symbol"03C1%
  \fi%
\fi

You hit on using Gentium as a fallback font, instead of ρ as a fallback glyph, which is a great idea. You might want to load the supplemental font with Scale=MatchLowercase so the letters come out the same size. Also be sure to enclose the font change in a group, so it does not bleed through to the following text.

\newfontfamily\gentium{Gentium}[Scale=MatchLowercase]

\newunicodechar{^^^^03f1}{% \ifmmode% \varrho% \else% \iffontchar\font`ϱ% \symbol"03F1% \else{{\gentium\symbol"03F1}}% \fi% \fi}

Davislor
  • 44,045
  • Thank you for pointing me in the right direction. Ultimately it was much easier:

    \newfontfamily{\gentium}{Gentium} \newunicodechar{ϱ}{\gentium ϱ}

    is all it took.

    – Ingmar Nov 27 '20 at 17:19
  • 1
    @Ingmar You at least want an extra pair of braces, \newunicodechar{ϱ}{{\gentium ϱ}}, or the font will stay switched to Gentium afterward. – Davislor Nov 27 '20 at 19:04
  • Thanks for pointing that out! – Ingmar Nov 28 '20 at 07:21