13

Is there any shell command for getting a list of activated fonts? Something like:

 some_font_util -activated -format 'file: name'

for getting a list of activated fonts in a form like:

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

…or anything similar?

I'm using Lion. Something from MacPorts, or AppleScript (for run with osascript command) would be welcome too.

  • 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
12

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.

  • 2
    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 '16 at 8:06
9

$ 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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .