4 Replies Latest reply on Oct 27, 2016 4:26 AM by Trevorׅ

    Get font styles for particular font family

    Level 1

      Is this possible get the font style (bold, 65 Bold, italic, etc) for a particular font family via script.


      Eg: font family : Frutiger LT Std.

        • 2. Re: Get font styles for particular font family
          S Hopkins Adobe Community Professional

          If you are working on a Macintosh, you might want to check out the blog that I will be posting this coming Saturday (yourscriptdoctor.com/blogs). The blog discusses some of the things that you can do with Font Book, one of which is to get a list of all of the font members of a specific font family. (It is written in AppleScript, of course)

          • 3. Re: Get font styles for particular font family
            Trevorׅ Adobe Community Professional

            Lots of ways to kill this bird.

            One can read the font files and apply a regex to them but a simple method for a static list would be.

            By static I mean that if fonts are uninstalled after the scripts is run then it won't be updated until the scripts rerun on a main session or reset on  a persistent one.


            function fontFamlilyStyles(font, reset) {
                var family, appFonts, fontFam, i;
                // if font is a string check if it's a valid font, if so get it's fontFamily if not the pesume it's the fontFamily
                fontFamlilyStyles.styles = fontFamlilyStyles.styles || function(family) {
                    var n, fontStyles = [];
                    if (!fontFamlilyStyles.fontMap[family]) {
                        return 'Font not found'
                    for (n in fontFamlilyStyles.fontMap[family]) {
                    return fontStyles;
                if (font.constructor === String) {
                    if (app.fonts.itemByName(font).isValid) {
                        family = app.fonts.itemByName(font).fontFamily;
                    } else {
                        family = font;
                } else if (font instanceof Font) {
                    if (font.isValid) {
                        family = font.fontFamily;
                    } else {
                        return 'Invalid Font';
                if (reset || !fontFamlilyStyles.fontMap) {
                    fontFamlilyStyles.fontMap = {};
                if (fontFamlilyStyles.fontMap[family]) {
                    return fontFamlilyStyles.styles(family);
                appFonts = app.fonts.everyItem().getElements().slice();
                i = appFonts.length;
                fontFamlilyStyles.fontMap = {}; // To deal will some uninstalled fonts
                while (i--) {
                    fontFam = appFonts[i].fontFamily;
                    if (!fontFamlilyStyles.fontMap[fontFam]) fontFamlilyStyles.fontMap[fontFam] = {};
                    fontFamlilyStyles.fontMap[fontFam][appFonts[i].fontStyleName] = true;
                return fontFamlilyStyles.styles(family);
            alert('Prestige Elite Std\tBold' + '\n' + fontFamlilyStyles('Prestige Elite Std\tBold')); // Font sting example
            alert('Arial' + '\n' + fontFamlilyStyles('Arial')); // fontFamily example
            alert(app.fonts[20].name + '\n' + fontFamlilyStyles(app.fonts[20])); // font example





            Edited typo and added more examples

            1 person found this helpful
            • 4. Re: Get font styles for particular font family
              Trevorׅ Adobe Community Professional

              Something not answered here?