20
$\begingroup$

How to find out available fonts on the system from within Mathematica? When I do

Style["foobar", FontFamily -> "Foobar"]

how do I know which font the displayed output is using/falling back to use?

$\endgroup$
4
  • 6
    $\begingroup$ Is this relevant? stackoverflow.com/questions/8859424 $\endgroup$ Aug 29, 2012 at 22:57
  • 1
    $\begingroup$ If you want to know what font the output is, you can highlight the text and open the text window (Ctrl + T or Cmd + T). For my system, your command leads to text in 'Lucida Grand'. $\endgroup$ Aug 29, 2012 at 23:00
  • $\begingroup$ I think kguler's answer in vitaliy's link is exactly what you're looking for... He's active on this site, so he'll be around soon to answer it himself $\endgroup$
    – rm -rf
    Aug 29, 2012 at 23:16
  • 3
    $\begingroup$ yep FE`Evaluate[FEPrivate`GetPopupList["MenuListFonts"]][[All, 2]] $\endgroup$ Aug 30, 2012 at 0:33

1 Answer 1

24
$\begingroup$

The relevant line from this SO post:

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

Update: The content of the "MenuListFonts" list is system-dependent. In Windows Vista, I get a list that contains only FontFamily:

 Panel@Row[fontlist[[;; 60]] /.
 Rule[x_, y_] :> Style[ToString@x, 14, FontFamily -> y],  " \[FilledSquare] "]

enter image description here

On a Mac system, it appears that the list contains tuples of FontFamily, FontWeight and FontSlant. That is,

fontlist /. Rule[x_, y_] :> Style[x, 20, FontFamily -> y] 

gives

enter image description here

$\endgroup$
2
  • $\begingroup$ FWIW even though i did not accept your answer at the time back when I asked the question linked by Vitaly (I chose a different one) your answer is actually the one I am regularly now using. $\endgroup$ Aug 31, 2012 at 9:06
  • $\begingroup$ Thank you @Mike. The problem in your question still waits for a more direct solution -- everytime I come accross a new CurrentValue argument I wonder if it can be used for that problem. $\endgroup$
    – kglr
    Aug 31, 2012 at 10:25

Your Answer

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

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