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

<p>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.</p>

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

<ul>
<li>Some Photoshop javascript</li>
<li>A Python function</li>
<li>An OSX API that I can call from python</li>
</ul>

[{'answer_id': 497, 'author': 'helloandre', 'author_id': 50, 'author_profile': 'https://Stackoverflow.com/users/50', 'pm_score': 3, 'selected': False, 'text': '<p>open up a terminal (Applications->Utilities->Terminal) and type this in:</p>\n\n<pre><code>locate InsertFontHere\n</code></pre>\n\n<p>This will spit out every file that has the name you want.</p>\n\n<p>Warning: there may be alot to wade through.</p>\n'}, {'answer_id': 518, 'author': 'jaredg', 'author_id': 153, 'author_profile': 'https://Stackoverflow.com/users/153', 'pm_score': 3, 'selected': False, 'text': "<p>I haven't been able to find anything that does this directly.  I think you'll have to iterate through the various font folders on the system: <code>/System/Library/Fonts</code>, <code>/Library/Fonts</code>, and there can probably be a user-level directory as well <code>~/Library/Fonts</code>.</p>\n"}, {'answer_id': 3040, 'author': 'Ecton', 'author_id': 457, 'author_profile': 'https://Stackoverflow.com/users/457', 'pm_score': 6, 'selected': True, 'text': "<p>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.</p>\n\n<p>Cocoa doesn't have any native support, at least as of 10.5, for getting the location of a font.</p>\n"}, {'answer_id': 195170, 'author': 'dbr', 'author_id': 745, 'author_profile': 'https://Stackoverflow.com/users/745', 'pm_score': 3, 'selected': False, 'text': '<p>There must be a method in Cocoa to get a list of fonts, then you would have to use the PyObjC bindings to call it..</p>\n\n<p>Depending on what you need them for, you could probably just use something like the following..</p>\n\n<pre><code>import os\ndef get_font_list():\n    fonts = []\n    for font_path in ["/Library/Fonts", os.path.expanduser("~/Library/Fonts")]:\n        if os.path.isdir(font_path):\n            fonts.extend(\n                [os.path.join(font_path, cur_font) \n                 for cur_font in os.listdir(font_path)\n                ]\n            )\n    return fonts\n</code></pre>\n'}]
['https://Stackoverflow.com/questions/469', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/147/']