I've been trying to use a couple of my Mac system fonts in my document, and I'm finding that ConTeXt is only finding one style for a couple of the fonts I've been using. The ones I've tried are Baskerville and Optima.
\definefontfamily[myfamily][serif][Baskerville]
\definefontfamily[myfamily][sans][Optima]
\setupbodyfont[myfamily]
With this preamble, all of the serif text is typeset as bold, no matter what font switch I use for it, and all the sans text is typeset using the regular style.
Both of these fonts are stored in .ttc TrueType collection files, and it seems like mtxrun --script fonts --list --all --pattern=Optima*
yields:
optima optimaregular /System/Library/Fonts/Optima.ttc index: 4
optimanormal optimaregular /System/Library/Fonts/Optima.ttc index: 4
optimaregular optimaregular /System/Library/Fonts/Optima.ttc index: 4
and mtxrun
for Baskerville shows a similar result. Both runs reference an index number, but it seems like ConTeXt is only finding the one style instead of all of them.
What do I need to do to get ConTeXt to find the other styles?
EDIT: Here's what I've found after further investigation.
The simplefonts
module had lent the impression that things were working correctly for me, but looking at the log file, simplefonts
appears to fallback on the librebaskerville font that came with TeXLive.
\usemodule[simplefonts]
\setmainfont[Baskerville]
Using other system fonts that live .ttc
files seems to produce a similar result with fallbacks from the TeX tree being used if a similar name is found.
The Arial font on my system is separated by style into individual .ttf
files. simplefonts
finds them correctly, and the newer \definefontfamily
method also works as expected.
Additionally, I tried defining my own Baskerville typescript with the following:
\starttypescript [serif] [baskerville]
\definefontsynonym [Baskerville-Roman] [name:Baskerville]
\definefontsynonym [Baskerville-Bold] [name:Baskerville-Bold]
\definefontsynonym [Baskerville-Italic] [name:Baskerville-Italic]
\definefontsynonym [Baskerville-Bold-Italic] [name:Baskerville-BoldItalic]
\stoptypescript
\starttypescript [serif] [baskerville]
\usetypescript[serif][fallback]
\definefontsynonym [Serif] [Baskerville-Roman]
\definefontsynonym [SerifItalic] [Baskerville-Italic]
\definefontsynonym [SerifBold] [Baskerville-Bold]
\definefontsynonym [SerifBoldItalic] [Baskerville-Bold-Italic]
\stoptypescript
\starttypescript [Baskerville]
\definetypeface [Baskerville] [rm] [serif] [baskerville] [default]
\stoptypescript
\usetypescript[Baskerville]
\setupbodyfont[Baskerville]
But that method seems to also find the fallbacks that simplefonts
found instead of using the various styles provided by the system font.
.ttc
s and it is just these particular fonts which are a problem?.ttc
s seem to provide only one style for ConTeXt, unless I'm setting things up incorrectly.lualatex
appears to have some method of indexing into the.ttc
file to get the different styles instead of just one of them (I think the one with the 0 index position)