Postscript Font Name Generator
 
            
                
                    Stuart Sandler                
                
                    Posts: 394                
            
                        
            
                    I'm looking for a way to select a folder of .otf and .ttf font files, run a script (I'd assume in Mac Terminal) that will grab the following information and generate a .csv file with the following columns: File Name, Font Name, Postscript Name, Vendor ID
Any guidance is deeply appreciated and I'm happy to compensate via payment or donate on behalf of any helpful folks who wish to assist.
Many thanks,
Stuart
                Any guidance is deeply appreciated and I'm happy to compensate via payment or donate on behalf of any helpful folks who wish to assist.
Many thanks,
Stuart
0          
            Comments
- 
            That can be done with fonttools. This page can get you started: https://github.com/fonttools/fonttools/wiki/How-do-I...?2
- 
            Thanks @Georg Seifert - Since your post I've successfully installed fonttools but respectfully have zero idea where to even start on 1) importing the fonts within a specific folder and 2) knowing which tables to look at to grab data and 3) exporting this data in a csv file
 Kindly advise and many thanks for the start.0
- 
            import os import argparse import csv from fontTools.ttLib import TTFont parser = argparse.ArgumentParser() parser.add_argument("dir_path") options = parser.parse_args() dir_path = options.dir_path fonts_info = [] for filename in os.listdir(dir_path): if filename.split(".")[-1].lower() in "ttf otf".split(): font = TTFont(os.path.join(dir_path, filename)) fonts_info.append( { "FileName": filename, "FontName": font["name"].getName(4, 1, 0, 0).toUnicode(), "PSName": font["name"].getName(6, 1, 0, 0).toUnicode(), "VendorID": font["OS/2"].achVendID, } ) with open("data.csv", "w", newline="", encoding="utf-8") as csvfile: fieldnames = "FileName FontName PSName VendorID".split() writer = csv.DictWriter(csvfile, fieldnames=fieldnames) writer.writeheader() for font_info in fonts_info: writer.writerow(font_info)
 3
- 
            Aha! Thank you Viktor! Please let me know if you'd like me to send you a payment or donate one on your behalf - Feel free to message me directly.
 Cheers!0
- 
            @Viktor Rubenko I'm attempting to run the script but am getting this error, kindly advise - Perhaps I'm doing it incorrectly:error: too few arguments 0
- 
            Disregard, all good now!0
Categories
- All Categories
- 46 Introductions
- 3.9K Typeface Design
- 485 Type Design Critiques
- 560 Type Design Software
- 1.1K Type Design Technique & Theory
- 654 Type Business
- 853 Font Technology
- 29 Punchcutting
- 519 Typography
- 119 Type Education
- 323 Type History
- 77 Type Resources
- 112 Lettering and Calligraphy
- 33 Lettering Critiques
- 79 Lettering Technique & Theory
- 550 Announcements
- 91 Events
- 114 Job Postings
- 170 Type Releases
- 174 Miscellaneous News
- 276 About TypeDrawers
- 54 TypeDrawers Announcements
- 120 Suggestions and Bug Reports

