Support for pro font families?

While researching this question, I encountered an issue with Mathematica’s font selection mechanism when rich families of pro fonts are used.

I can plot text in a given font with:

Graphics[Style[Text["iPhone"], FontFamily -> "Myriad Pro", 50]]


However, while I can use FontFamily to select various weight ("Light", "Semibold", "Bold" and "Black"), I cannot use it to select condensed fonts: for example, while Myriad Pro Semibold Semicondensed is a valid combination, Mathematica refuses to use it and simply fall back to its default font.

1. Is this a known limitation? Is it OS-specific? (I'm on Mac OS 10.7)
2. Also, how can I get Mathematica to issue an error when it cannot pick up the font requested, instead of falling back to a default font?
-
How are you setting the font? Are you setting it programmatically or are you using the font selection menu? –  Heike Apr 16 '12 at 12:02
@Heike programmatically: I gave the code in the question –  F'x Apr 16 '12 at 12:29
Are you sure you're using the right string for selecting the typeface? To get a list of all possible typefaces of "Myriad Pro" you could do something like Cases[FEEvaluate[FEPrivateGetPopupList["MenuListFonts"]], PatternSequence[a_String -> b_] /; StringMatchQ[a, "Myriad Pro*"]:> a] –  Heike Apr 16 '12 at 12:53
@Heike thanks for the list, it turns out that one has to specify Cond, SemiCond, SemiExt or Ext for the condensed, semi-condensed, semi-extended and extended fonts. This is borderline buggy, because the full name reported by otfinfo is, e.g. “Myriad Pro Condensed” for the condensed variant… –  F'x Apr 16 '12 at 13:05
@Heike please expand a bit one your comment into an answer, so I can accept it! –  F'x Apr 16 '12 at 13:06

Getting the names of the fonts is pretty easy. I like Heike's solution, but I can remember the following procedure better.

Just format the text in some text cell with any font style you like and then enter the menu command Cell > Show Expression (ctrlshiftE on a PC) revealing the formatting instructions.

Cell[TextData[StyleBox["aaaaa",
FontWeight->"Demi",
FontSlant->"Italic"]], "Text",
CellChangeTimes->{{3.543584575138007*^9, 3.5435845788282185*^9}}]


Using this information:

Column[{
FontSlant -> "Italic", 80],
FontSlant -> "Plain", FontWeight -> "Bold", 80],
FontFamily -> "Myriad Pro Cond", FontSlant -> "Italic",
FontWeight -> "Bold", 80],
FontWeight -> "Demi", 80],
FontWeight -> "Demi", FontSlant -> "Italic", 80]
}
]


By the way: Although it is often quite possible to specify slant and weight in the font name, there is a good reason to specify them separately. Compare the parenthesis in the following:

Style["Text (x) Text", FontFamily -> "Myriad Pro-Bold-Italic", 80]


and

Style["Text (x) Text", FontFamily -> "Myriad Pro", FontWeight -> Bold,
FontSlant -> Italic , 80]


For a lot of symbols, Mathematica substitutes the Mathematica font version for the one in the specified font. If you have specified slant and weight in the font name MMA doesn't pick up those font specifications, ending up with symbols that are unmatched in style to the rest of the text.

-
thanks but no thanks: using FontWeight, you can't choose semibold or light, for example. The doc says you can, but it won't work… –  F'x Apr 16 '12 at 19:54
@F'x Did you see my code? I do select Light and SemiBold. You have to mix FontFamily and FontWeight correctly. –  Sjoerd C. de Vries Apr 16 '12 at 20:14
I just disagree with your statement that “there is a good reason to specify them [slant and weight] separately”: specifying them separately doesn't work in all cases, sometimes you have to specify them in the FontFamily. PS: your example in "Cond Semibold" is not what it claims to be… –  F'x Apr 16 '12 at 20:33
@F'x I just lazily copied the first part of the example text. The last two lines shouldn't have "Cond" in the name, that's what you mean? The fonts themselves are what you get when you select Semibold in the font selector. –  Sjoerd C. de Vries Apr 16 '12 at 21:25
@F'x I still hold that in most cases you should separate font family and weight specifications although it may not work in some esoteric cases. I used to type FontFamily->"Times-Bold" in Plot font specifications but was always annoyed about the ugliness of some symbols (like the parenthesis). In the end I discovered that you really should use FontFamily->"Times",FontWeight->Bold` instead. –  Sjoerd C. de Vries Apr 16 '12 at 21:29

I found this page while trying to solve the same problem in Mathematica 10, and it seems like they've (re)moved this functionality. I had v9 code that specified a FontFamily of "Futura Condensed", which stopped working (changed to default) in v10.

My first attempted fix was to set the FontFamily to "Futura" and the FontWeight to "Condensed". Mathematica crashed. (This is on OSX, 10.9.4.)

After some other digging, I ended up here. When I do "Show Expression" on styles text with any of these less common modifiers, it seems that Mathematica just wipes them away and reverts to the basic font face. I tried a few fonts, and that seems consistent.

-