14
$\begingroup$

I'm having trouble finding a complete list of the FontFamily strings that Mathematica supports.

$\endgroup$
4
  • 1
    $\begingroup$ does this How to find out available fonts from within Mathematica? answer your question? $\endgroup$
    – kglr
    Feb 2, 2013 at 3:21
  • 3
    $\begingroup$ @kguler. The answer you link to reports all the fonts available to Mathematica on a particular system. That is has many more entries than the list of font families. A font family can contain many fonts. $\endgroup$
    – m_goldberg
    Feb 2, 2013 at 5:14
  • 1
    $\begingroup$ @m_goldberg, the image in that answer definitely supports your observation. That image is posted by Szabolcs, and, most likely, it is what you get on a Mac system.) On Windows (Vista) I get a list that has only the font family (not family/slant/weight tuples). $\endgroup$
    – kglr
    Feb 2, 2013 at 5:42
  • $\begingroup$ FontFamily help: "Mathematica will combine settings for FontFamily, FontWeight, FontSlant, FontTracking, and sometimes FontSize to construct a complete name for the font you want. It will then use this name, together with any settings you have specified for FontPostScriptName and FontNativeName to try to locate an appropriate font on your particular computer system." And then there's FontSubstitutions... $\endgroup$
    – cormullion
    Feb 2, 2013 at 9:29

2 Answers 2

7
$\begingroup$

On a Windows system, the solution suggested in this answer

fontlist = FE`Evaluate[FEPrivate`GetPopupList["MenuListFonts"]]

gives the FontFamilys in the form of rules:

fontlist[[;; 5]]

{"Agency FB" -> "Agency FB", "Aharoni" -> "Aharoni", "Algerian" -> "Algerian", "Amienne" -> "Amienne", "Andalus" -> "Andalus"}

and the list of font families can be obtained by taking the first Parts of the elements in fontlist:

fontlist[[;; 5]][[All,1]]

{"Agency FB", "Aharoni", "Algerian", "Amienne", "Andalus"}

As noted by @m_goldberg in the comments above, one gets tuples of FontFamily, FontWeight and FontSlant on a Mac system. The output is similar to what one gets on a Windows system from the following code:

fontlistMac = Thread[# -> #] &[Join @@ ({#, StringJoin[{#, " ", "Bold"}],
    StringJoin[{#, " ", "Italic"}],
    StringJoin[{#, " ", "Bold", " ", "Italic"}]} & /@ 
fontlist[[;; 5]][[All, 1]])];
Panel[%]

enter image description here

So, to get the list of FontFamilys without duplication, one needs to filter the result using something like

DeleteDuplicates[StringTrim@StringReplace[#, "Bold" | "Italic" :> ""] & /@ 
  macFntLst[[All, 1]]]

{"Agency FB", "Aharoni", "Algerian", "Amienne", "Andalus"}

$\endgroup$
3
  • $\begingroup$ Interesting, but aren't there lots of duplicates in there? $\endgroup$
    – cormullion
    Feb 3, 2013 at 8:23
  • $\begingroup$ @cormullion, thank you.. updated with corrections. $\endgroup$
    – kglr
    Feb 3, 2013 at 10:01
  • $\begingroup$ It's a good first pass for Mac users, so +1, but it would need many more tweaks and additions to do the job 100% accurately. I can see things like Light, Oblique, Black, Heavy, ExtraBlack, Semibold, Condensed, Regular, Demi, Narrow, Ultra - plus abbreviations of these... A mess... :) $\endgroup$
    – cormullion
    Feb 3, 2013 at 10:17
8
$\begingroup$

As of version 10.1 you can use $FontFamilies.

From the documentation:

$FontFamilies gives the list of the font families available to the Wolfram System.

For me $FontFamilies yields an accurate representations on the fonts I have installed on my system (v10.3.1 on Win10).

$\endgroup$
1
  • $\begingroup$ Only if there is a Front-End available, $FontFamilies returns and empty list on Wolfram Engine. $\endgroup$
    – rhermans
    Nov 15, 2021 at 16:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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