# [NTG-context] Mixing math and text font

Joshua Krämer joshua.kraemer at gmail.com
Thu Jan 9 22:30:49 CET 2014

Am Thu, 9 Jan 2014 20:41:15 +0100
schrieb Wolfgang Schuster <schuster.wolfgang at gmail.com>:

> > (3) I have a typeface that uses unusual style names: "roman1",
> > "roman2", "italic1", "italic2";  1 is regular, 2 is bold weight.
> > The following works:
> >
> > \definefontfamily[xxxface][serif][xxx][regularfont=xxxroman1,
> > italicfont=xxxitalic1, boldfont=xxxroman2]
> > \setupbodyfont[xxxface]
> > \starttext
> > abc {\it abc} {\bf abc}
> > \stoptext
> >
> > This works for roman1 only:
> >
> > \definefontfamily[xxxface][serif][xxx][regularfont=spec:roman1,
> > italicfont=spec:italic1, boldfont=spec:roman2]
> >
> > Even this works for roman1 only:
> >
> > \definefontfamily[xxxface][serif][xxx][regularfont=spec:roman1,
> > italicfont=xxxitalic1, boldfont=xxxroman2]
>
> The name of the font files has nothing to do with way how
> \definefontfamily collects the individual files for each style, to do
> this it uses internal names and values from the font.

I've got the values from the output of "mtxrun --script fonts --list
--all --pattern=xxx" (and compared with the name/style values in
Fontforge), so I don't understand why "spec:roman1" works, but
"spec:italic1" doesn't.

Additionally, what I think must be a bug is that
"italicfont=file:xxxitalic1, boldfont=file:xxxroman2" works but stops

\definefontfamily[xxxface][serif][xxx][regularfont=spec:roman1,
italicfont=file:xxxitalic1, boldfont=file:xxxroman2]

Maybe if one of the values uses the "spec:" selector, all the values
are treated as spec values despite the "file:" selector given?

> When you use a opentype math font the upright, italic, bold etc.
> characters are all in the same file which uses only the regular style
> (a few math fonts provide also a bold style which can be useful in
>
> Because there is only a upright math font you have to set a fallbacks
> also for the upright style even when the font you’re using is italic,
> e.g.
>
> \definefallbackfamily[xxxface][math][xxx][tf=file:xxxitalic1,preset=math:lowercaseitalic]

Thanks, this works.  For some reason, "tf=" works, but "regularfont="
doesn't.

And by the way, this works:
\definefontfamily[leitura][serif][Leitura News][regularfont=spec:roman2]

and this doesn't work:
\definefontfamily[leitura][serif][Leitura News][tf=spec:roman2]

So in some cases only "regularfont" seems to work, and in some cases
only "tf".

Kind regards,
Joshua