Am 09.01.2014 um 22:30 schrieb Joshua Krämer
Am Thu, 9 Jan 2014 20:41:15 +0100 schrieb Wolfgang Schuster
: (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 working if I add "regularfont=spec:roman1":
\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?
What you try can’t work because spec is one of context three methods to load a font, the first two are “file:…” and “name:…”. With the spec method you give context a list of features for the font you want to load, the spec specifier has 5 argument: 1. The family name of the font 2. The weight of the font (light, normal, medium, bold, …) 3. The style of the font (normal, italic, slanted, …) 4. The width of the font (condensed, normal, expanded, …) 5. The variant of the font (normal, old style or smallcaps) When you load a font you separate all arguments by a hyphen, when you leave arguments out they get normal as default values. Below is a example how to load TeX Gyre Pagella Regular and Bold with the spec method: \starttext {\definedfont[spec:texgyrepagella-normal]TeX Gyre Pagella Regular} {\definedfont[spec:texgyrepagella-bold]TeX Gyre Pagella Bold} \stoptext When you want now the bolditalic form of the font you have to set the third argument for the style: \starttext {\definedfont[spec:texgyrepagella-bold-normal]TeX Gyre Pagella Bold} {\definedfont[spec:texgyrepagella-bold-italic]TeX Gyre Pagella Bolditalic} \stoptext When you now use the spec method with \definefontfamily nearly the same thing happens but you set only the argument 2–5 because the name of the font was already set.
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 headings).
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“.
Just avoid the spec method, it depends a lot on the information in the font and is not always reliable, because of this I don’t use it as default method to search for all files in a font family. Wolfgang