Get Font Names

Script for Adobe Illustrator, InDesign, or Photoshop

The script reads the application font collection and saves a CSV file with each font name, PostScript name, and name used in script code.

This script came about when a user wanted help changing the font a script used to label images in Photoshop but couldn't figure out the right name to use in the code for the font they wanted. So I wrote this script to help. More about font identification differences between Adobe apps is explained below.

  • Script works in multiple Adobe apps
  • Identifies font names for ExtendScript
  • Adapt open source to customize or create other scripts
Download
Get Font Names
Help me keep making new scripts by supporting my work. Click the PayPal button to contribute any amount you choose. Thank you. William Campbell

How to use the script

The script has no interface other than a done alert. Run the script and a CSV file named the application name plus “Fonts” is saved to the user desktop. Edit the script code for a different file name and/or location.

Three columns are output: Font name, PostScript name, and Name to use in script code.

When specifying fonts in ExtendScript, Illustrator and Photoshop want the PostScript name. For example “ArialMT”. InDesign wants the font family, a tab character, then the style. For example “Arial\tRegular”. Having the precise font names avoids trial and error.

Any questions contact the author William at any time.

Source code

(download button below)

/*

Get Font Names
Copyright 2022 William Campbell
All Rights Reserved
https://www.marspremedia.com/contact

Permission to use, copy, modify, and/or distribute this software
for any purpose with or without fee is hereby granted.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

*/

(function () {

    var familyNames = [];
    var font;
    var fontNames = [];
    var i;
    var names = [];
    var PSNames = [];
    var styleNames = [];
    if (/Illustrator/.test(app.name)) {
        for (i = 0; i < app.textFonts.length; i++) {
            font = app.textFonts[i];
            names.push([font.family + " " + font.style, font.name, font.name]);
        }
        writeCsv("Illustrator", names);
    } else if (/InDesign/.test(app.name)) {
        familyNames = app.fonts.everyItem().fontFamily;
        styleNames = app.fonts.everyItem().fontStyleName;
        PSNames = app.fonts.everyItem().postscriptName;
        fontNames = app.fonts.everyItem().name;
        for (i = 0; i < fontNames.length; i++) {
            names.push([familyNames[i] + " " + styleNames[i], PSNames[i], fontNames[i].replace("\t", "\\t")]);
        }
        writeCsv("InDesign", names);
    } else if (/Photoshop/.test(app.name)) {
        for (i = 0; i < app.fonts.length; i++) {
            font = app.fonts[i];
            names.push([font.family + " " + font.style, font.postScriptName, font.postScriptName]);
        }
        writeCsv("Photoshop", names);
    }

    function writeCsv(program, names) {
        var file;
        var i;
        file = new File("~/Desktop/" + program + " Fonts.csv");
        file.encoding = "UTF-8";
        file.open("w");
        file.writeln("Font name,PostScript name,Name to use in script code");
        names.sort();
        for (i = 0; i < names.length; i++) {
            file.writeln(names[i].join(",") + "\r");
        }
        file.close();
        alert("Output " + File.decode(file.fsName));
    }

})();
Help me keep making new scripts by supporting my work. Click the PayPal button to contribute any amount you choose. Thank you. William Campbell
Download
Get Font Names

For help installing scripts, see How to Install and Use Scripts in Adobe Creative Cloud Applications.

IMPORTANT: scripts are developed for the latest Adobe Creative Cloud applications. Many scripts work in CC 2018 and later, even some as far back as CS6, but may not perform as expected, or run at all, when used in versions prior to 2018. Photoshop features Select Subject and Preserve Details 2.0 definitely fail prior to CC 2018 (version 19) as the features do not exist in earlier versions. For best results use the latest versions of Adobe Creative Cloud applications.

IMPORTANT: by downloading any of the scripts on this page you agree that the software is provided without any warranty, express or implied. USE AT YOUR OWN RISK. Always make backups of important data.

IMPORTANT: fees paid for software products are the purchase of a non-exclusive license to use the software product and do not grant the purchaser any degree of ownership of the software code. Author of the intellectual property and copyright holder William Campbell retains 100% ownership of all code used in all software products regardless of the inspiration for the software product design or functionality.