15
$\begingroup$

Most professional fonts come with at least two figure styles: old style (or text) figures and lining figures. In plots and most other figures I prefer to use lining figures. This is no problem with those fonts that use lining fiures as the default style (which is the majority of fonts). Some fonts, however, use old style figures as the default (even some sans serif fonts, such as Aller). Can one access the other figure styles (in this case lining figures) from within Mathematica?

Conversely, can one access old style figures of fonts that use lining as default (such as Minion Pro)?

Style["A0123456789B", 75, FontFamily -> "Aller"]

Blockquote

Style["A0123456789B", 75, FontFamily -> "Minion Pro"]

Blockquote

Of course, one workaround would be to make a new font without the respective figure style using a tool like FontForge, but obviously I would prefer to control the settings from within Mathematica.

$\endgroup$
  • $\begingroup$ I strongly doubt that it is possible to access advanced font features like this. $\endgroup$ – Szabolcs Jul 28 '15 at 8:06
  • $\begingroup$ That's too bad. Then I probably have to resort to creating my own font files. $\endgroup$ – einbandi Jul 28 '15 at 8:18
  • $\begingroup$ Where do you want to use these? Figures only or are you producing complete documents using Mathematica? Unfortunately, I don't think Mathematica is suitable for producing documents where high quality typesetting is required. This is based on my experience trying to create figures with strict and beautiful typesetting. There are just too many issues and export bugs ... So, for documents, I wouldn't use it if typesetting is paramount. For figures, I do use it, and I suggest you try MaTeX and SciDraw. $\endgroup$ – Szabolcs Jul 28 '15 at 8:34
  • $\begingroup$ SciDraw is here. MaTeX should support XeLaTeX, if it doesn't, that's a bug and you should let me know. $\endgroup$ – Szabolcs Jul 28 '15 at 8:35
  • $\begingroup$ I want to use it for figures only. I will have a closer look at MaTeX, which at first glance looks very promising. Thanks! $\endgroup$ – einbandi Jul 28 '15 at 8:42
10
+50
$\begingroup$

These issues are unfortunately OS- and font family-dependent, so I will preface that I am working on Windows 7 - 64 bit using MMA 10.2.

I currently don't have the Aller font installed on my machine, so I won't yet be able to comment on that one, but I do have Minion Pro.

As you mentioned Minion Pro uses lining figure by default. The version installed on my system does contain old style figures as well; I was able to locate their position by inspection of the font table. Here they are (top) compared with the default lining versions:

Style[
 FromCharacterCode[Range[63043, 63052], "Unicode"], 
 FontFamily -> "Minion Pro", FontSize -> 24
]

Style["0123456789", FontFamily -> "Minion Pro", FontSize -> 24]

Mathematica graphics

That's the good news. The bad news is the fact that "Text figures are not encoded separately in Unicode, because they are not considered separate characters from lining figures, only a different way of writing the same characters" (from Wikipedia). For instance, Adobe's "Pro" version of their fonts use codepoints U+F643 (63,043) to U+F64C (63,052) in the private-use Unicode space to encode text figures. Unfortunately, that means that the existence and position of these glyphs is font-dependent (i.e. the same Unicode code will encode different glyphs depending on the font selected).

For instance in Minion Pro I could locate the old-style font faces; the solution below works for this and other Adobe "Pro" fonts, but not necessarily for others.

With that caveat, below is a quick helper function to obtain those old-style numeral glyphs for the Minion Pro font. The function returns a string corresponding to the integer value in its input. It is convenient to make this function Listable as well.

Clear[osfMinion]

osfMinion[digit_Integer /; 0 <= digit <= 9, size_Integer] :=
 Style[
  FromCharacterCode[63043 + digit, "Unicode"],
  FontFamily -> "Minion Pro", FontSize -> size
]
SetAttributes[osfMinion, Listable]

Testing it out:

osfMinion[Range[0, 9], 34]

Mathematica graphics

$\endgroup$
  • 1
    $\begingroup$ Yeah- I have a bad feeling this might end badly with other fonts / foundries. For example, trying to do the Unicode-dance with Mac OS & Adobe Text Pro results in a bunch of Unicode X boxes. Still- a good start. You'd think that FontVariations should support all the typography options in OT and TT fonts. But, also note that, when I try to -use- the OS supplied typography options on Mac OS X (eg- select text and try to apply ligatures, small caps, etc) the front-end crashes. $\endgroup$ – flip Jul 28 '15 at 18:13
  • $\begingroup$ !boom $\endgroup$ – flip Jul 28 '15 at 18:20
  • $\begingroup$ @flip I am not familiar with MacOS, so what exactly are you showing in your screenshot? $\endgroup$ – MarcoB Jul 28 '15 at 22:29
  • 1
    $\begingroup$ @MarcoB That's very nice! I was able to reproduce your result with Minion, but for Aller I could only find small caps figures in the private use Unicode range. Another problem with this approach: I don't know how to automatically replace the default numbers with the respective Unicode characters in e.g. Ticks, where the character strings are not directly accessible straight away. Note: AbsoluteOptions is known to be buggy and does not wuite work as expected to extract the Ticks labels. $\endgroup$ – einbandi Jul 29 '15 at 7:55
  • $\begingroup$ @marcoB Clicking on either of the typographic modifications (those are OS supplied and depend on the features available in the font) causes Mathematica to crash. E.g. MMa isn't playing nice with the OS typography. Over the years WRI has tended to 'do it themselves' rather than rely on OS support for some things. Cross-platform needs were probably a pragmatic reason driving this. Unfortunately, typography is, at one level, cross-platform (OT, TT, PS) but the implementations at the OS level are still pretty platform specific. I'm not sure if Andre Kuzniarek is on SE but he could enlighten. $\endgroup$ – flip Jul 29 '15 at 14:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.