Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I find the full path to a font from its display name on a Mac?

I am using the Photoshop's javascript API to find the fonts in a given PSD.

Given a font name returned by the API, I want to find the actual physical font file that font name corresponds to on the disc.

This is all happening in a python program running on OSX so I guess I'm looking for one of:

  • Some Photoshop javascript
  • A Python function
  • An OSX API that I can call from python
like image 217
Gareth Simpson Avatar asked Aug 02 '08 15:08

Gareth Simpson


People also ask

How do you find the full file path on a Mac?

Show the path to a file or folder On your Mac, click the Finder icon in the Dock to open a Finder window. Choose View > Show Path Bar, or press the Option key to show the path bar momentarily. The location and nested folders that contain your file or folder are displayed near the bottom of the Finder window.

Where are fonts stored on Macos?

User: Fonts installed in the Fonts folder in your home Library (~/Library/Fonts/). To show your home Library folder, press and hold the Option key, then in the Finder choose Go > Library.

How do I locate a font file?

Step 1 - Find your search prompt in the bottom left hand corner of your desktop, and find the Control Panel at the top of this menu. Step 2 - In the Control Panel, navigate to “Appearance and Personalization” and scroll down until you find a folder called “Fonts”.


2 Answers

Unfortunately the only API that isn't deprecated is located in the ApplicationServices framework, which doesn't have a bridge support file, and thus isn't available in the bridge. If you're wanting to use ctypes, you can use ATSFontGetFileReference after looking up the ATSFontRef.

Cocoa doesn't have any native support, at least as of 10.5, for getting the location of a font.

like image 99
Ecton Avatar answered Sep 24 '22 13:09

Ecton


open up a terminal (Applications->Utilities->Terminal) and type this in:

locate InsertFontHere 

This will spit out every file that has the name you want.

Warning: there may be alot to wade through.

like image 42
helloandre Avatar answered Sep 22 '22 13:09

helloandre