Using Ryman Eco fonts in XeTeX

I'd like to use the Ryman Eco font for my XeTeX documents. The cause is that my students mostly prints them so I try to spare with ink (and try to be ec-friendly of course). But the font directly doesn't have italic, bold or math styles. It's strange because in LibreOffice those appear.

A little example:

\documentclass[11pt,a4paper]{article}
\usepackage{fontspec}
\usepackage[magyar]{babel}

\setmainfont{Ryman Eco}

\begin{document}

This is normal text - it's okay. Ez a normális szöveg, és ez rendben van.

\textit{This text may appear italic, but it doesn't do it. Ennek a szövegnek dőlt betűsnek kellene lennie, de nem lesz az.}

\textbf{This text must be bold. Most vastagnak kellene lennie.}

And some math text. Végül némi matematikai szöveg. $\sqrt{2}\nin\mathbb{Q}$
$$e^{i\pi}-1=0$$

\end{document}


I read the fontspec docs, and tried the IVth chapters recommendations, but they didn't work, so I came here for some help.

• Applications like libreoffice often fake fonts (you can fake bold and slanted with fontspec too, see the docu) and get glyphs from fall back fonts. – Ulrike Fischer Oct 28 '19 at 10:03

The font you selected has no bold, italic, math or Hungarian double-acute characters. However, it is possible to fake them.

This example is a little more verbose than it needs to be, in order to suppress all warning messages.

\documentclass[11pt,a4paper]{article}
\usepackage{newunicodechar}
\usepackage{unicode-math}
\usepackage{babel}

\babelprovide[import, main]{hungarian}

\defaultfontfeatures{Scale = MatchLowercase}

\setmainfont{RymanEco}[
Scale = 1.0 ,
Ligatures = {Common, TeX} ,
Numbers = OldStyle ,
UprightFont = *-Regular ,
BoldFont = *-Regular , % Faking it.
BoldFeatures = {FakeBold = 1.25} ,
ItalicFont = *-Regular , % Faking it.
ItalicFeatures = {FakeSlant = .15} ,
BoldItalicFont = *-Regular , % Faking it.
BoldItalicFeatures = { FakeBold = 1.25, FakeSlant = .15 } ,
Extension = .otf ]

\setmathfont{STIX Two Math}
\setmathfont{RymanEco-Regular.otf}[
range={"00-"FF, up/{Latin, latin, Digits}},
Script = Default ,
script-features={},
sscript-features={} ]
\setmathfont{RymanEco-Regular.otf}[
range=it/{Latin, latin},
Script = Default,
script-features={},
sscript-features={},
FakeSlant = .15 ]
\setmathfont{RymanEco-Regular.otf}[
range=bfup/{Latin, latin},
Script = Default,
script-features={},
sscript-features={},
FakeBold = 1.25 ]
\setmathfont{RymanEco-Regular.otf}[
range=bfit/{Latin, latin},
Script = Default,
script-features={},
sscript-features={},
FakeSlant = .15 ,
FakeBold = 1.25 ]

\renewcommand\H[1]{{\accent"02DD #1}}

\newunicodechar{Ő}{\H{O}}
\newunicodechar{ő}{\H{o}}
\newunicodechar{Ű}{\H{U}}
\newunicodechar{ű}{\H{u}}

\begin{document}

This is normal text---it's okay. Ez a normális szöveg, és ez rendben van.

\textit{This text may appear italic, but it doesn't do it. Ennek a szövegnek dőlt betűsnek kellene lennie, de nem lesz az.}

\textbf{This text must be bold. Most vastagnak kellene lennie. \textit{Bold Slanted.}}

And some math text. Végül némi matematikai szöveg. $\sqrt{2} \notin \mathbb{Q}$
$$e^{i\pi}-1=0$$

\end{document}


I copied your MWE with a few minor changes, such as \notin for \nin.

This fakes italic (more pedantically, slanted) with the FakeSlant command of fontspec, and bold with FakeBold. Note that using bold will defeat the purpose of saving ink! But you can reduce the factor I gave and feel virtuous. (ETA: If so, you might add a bit of FakeStretch to make the emphasized text stand out more without using so much more ink.)

The Ryman Eco font does not have precomposed ő, or the combining accent ◌̋ (U+030B), but it does have ˝ (U+02DD). You can use that glyph as a combining accent with the \accent command. The above would not quite work with source code that uses combining accents, only with the four precomposed characters it sets up.

If you don’t like the fake italics, you can call \usepackage[math-style=upright]{unicode-math} to use upright letters in math mode. In ISO style, constants such as i, e and π should be upright anyway!

Text that mixes English and other languages this way also really ought to use language tags, although you were keeping this simple as a MWE.

• Oh, I use the latinext version of Ryman Eco, so the hun fonts didn't make problem. The others are cool, thank you! – Thomas Benko Oct 29 '19 at 21:15
• One little question: I miss the vectors arrow. I don't have the STIX fonts, so I chenged it to Linux Libertine. Does it make sense? – Thomas Benko Oct 30 '19 at 16:02
• @ThomasBenko I’m not sure I understand, but you can get the vector arrow with \vec. – Davislor Oct 30 '19 at 16:25
• @ThomasBenko Libertinus Math should work too, and use whatever fallback you prefer. However, you should have STIX Two installed with TeX. I don’t know what distribution you’re using, but install whatever package contains STIX2Math.otf. – Davislor Oct 30 '19 at 16:28
• Arch. I found the font. The \vec didn't show the vectors arrow, but now it does. – Thomas Benko Nov 26 '19 at 16:13