Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is here any shell command for getting the list of activated fonts? Mean something like:

 some_font_util -activated -format 'file: name'

for getting a list of activated fonts in a form:

/Library/Fonts/CourNI.ttf: Courier New Italic

or anything like...

Ps: for lion. If you know something from macports, or applescript (for run with osascript command) is welcomed too...

share|improve this question
    
Our of my own morbid curiosity, can I ask why you need it (1) programmatically, and (2) in such a specific format? – Jason Salaz Jan 8 '12 at 5:29
    
simple want print fontdemo (some text with all my fonts) with textutil command, so really need only "fontname" but the file helps filter out the correct font-directory (as you do it in your example). :) like: echo 'demo text' | textutil -stdin -convert rtf -font $FONTNAME ... etc – jm666 Jan 8 '12 at 13:14
up vote 2 down vote accepted

I know that this is quite an old post, but I just stumbled upon it from Google while searching for something similar (mostly just wanting to list active fonts via Terminal.) I ended up remembering that activated fonts are listed in System Information which can be pulled from the system_profiler command. That being said here's the command to pull font information from system_profiler:

system_profiler SPFontsDataType

That's it. It should return a huge list of font data in the format of:

Fonts:

Arial Narrow.ttf:

  Kind: TrueType
  Valid: Yes
  Enabled: Yes
  Location: /Library/Fonts/Arial Narrow.ttf
  Typefaces:
    ArialNarrow:
      Full Name: Arial Narrow
      Family: Arial Narrow
      Style: Regular
      Version: Version 2.38.1x
      Vendor: The Monotype Corporation
      Unique Name: Arial Narrow Regular : 2007
      Designer: Robin Nicholas, Patricia Saunders
      Copyright: © 2007 The Monotype Corporation. All Rights Reserved.
      Trademark: Arial is a trademark of The Monotype Corporation in the United States and/or other countries.
      Description: Monotype Drawing Office 1982. A contemporary sans serif design, Arial contains more humanist characteristics than many of its predecessors and as such is more in tune with the mood of the last decades of the twentieth century. The overall treatment of curves is softer and fuller than in most industrial-style sans serif faces. Terminal strokes are cut on the diagonal which helps to give the face a less mechanical appearance. Arial is an extremely versatile family of typefaces which can be used with equal success for text setting in reports, presentations, magazines etc, and for display use in newspapers, advertising and promotions.
      Outline: Yes
      Valid: Yes
      Enabled: Yes
      Duplicate: No
      Copy Protected: No
      Embeddable: Yes

which you should be able to grep and manipulate as you'd like.

share|improve this answer
    
YES! This is the correct way. Changed the accepted answer. Moreover, using it as system_profiler -xml SPFontsDataType produces an XML output which is precisely parseable using some XML tool. Thank you. – jm666 Jun 25 at 8:06

$ fc-list : file family |grep \/Library

grepping /Library filters out a bunch of fonts in /usr/X11*, which are only used by X11. Considering your example, I assume you would prefer the OS X specific ones. If I'm incorrect in this assumption, simply take out everything after family.

That command returns many many lines on it's own, here is a handful of interesting ones I saw in the list:

/System/Library/Fonts/AppleGothic.ttf: AppleGothic
/Library/Fonts/Apple LiGothic Medium.ttf: Apple LiGothic
/System/Library/Fonts/Apple Braille Pinpoint 8 Dot.ttf: Apple Braille
/System/Library/Fonts/Apple Braille Outline 6 Dot.ttf: Apple Braille
/System/Library/Fonts/Apple Symbols.ttf: Apple Symbols
/System/Library/Fonts/Apple Braille Pinpoint 6 Dot.ttf: Apple Braille
/System/Library/Fonts/Apple Braille.ttf: Apple Braille
/Library/Fonts/AppleMyungjo.ttf: AppleMyungjo
/System/Library/Fonts/Apple Braille Outline 8 Dot.ttf: Apple Braille
/Library/Fonts/Apple LiSung Light.ttf: Apple LiSung
/Library/Fonts/Apple Chancery.ttf: Apple Chancery
/System/Library/Fonts/Apple Color Emoji.ttf: Apple Color Emoji,Apple 彩色表情> 符號,Apple farve-emoji,Apple Farben-Emoji,Applen väri-emoji,Apple Emoji couleur,Colore Emoji Apple,Apple カラー絵文字,Apple 컬러 이모티콘,Apple Kleur-Emoji,Apple farge-emoji,Apple Emoji em Cores,Цветные эмодзи Apple,Apple färg-emoji,Apple 彩色表情符号,لون,Apple Emoji color
/Library/Fonts/Comic Sans MS.ttf: Comic Sans MS
/Library/Fonts/Microsoft/MS Gothic.ttf: MS Gothic,MS ゴシック
/Library/Fonts/Microsoft/Stencil: Stencil
/Library/Fonts/Microsoft/Verdana: Verdana
/Library/Fonts/Microsoft/Georgia: Georgia
/Library/Fonts/Microsoft/Onyx: Onyx

share|improve this answer
    
Need install fonconfig macport. Excellent! Thanx. – jm666 Jan 8 '12 at 12:54
    
Since OS X 10.8 Mountain Lion, X11 is no longer included in the OS, and even if the fc-list binary is still available in /usr/X11/bin/fc-list, it wont run without a proper X11 install. – Guillaume Algis May 4 '13 at 13:18
    
X11 has never been included, it's always been an optional install. – Jason Salaz May 4 '13 at 22:42
    

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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