2 Replies Latest reply on Jan 5, 2010 3:50 PM by Steven..

    List of fonts

    Kasyan Servetsky Level 5

      Somebody posted a question about how to write a script listing all fonts with details.

      But while I was writing the script the post has gone. (How could this happen? )

       

      Here is the script — it writes a list of all fonts available to InDesign and their details: name, full path to the font, type and version.

       

      Kasyan

       

      //-----------------------------------------

      var myFonts = app.fonts.everyItem().getElements();
      var myList = [];

       

      for (i = 0; i < myFonts.length; i++) {
          var  myFont = myFonts[i];
          myList.push("Name - " + myFont.fullName);
          myList.push("Path - " + myFont.location);
          myList.push("Type - " + GetFontType(myFont));
          myList.push("Version - " + myFont.version);
          myList.push("-----------------------");
      }

       

      WriteToFile(myList.join("\r"));
      alert("Done");

       

      function GetFontType(myFont) {
          switch(myFont.fontType) {
              case FontTypes.TYPE_1:
                  return  "Type 1";
              case FontTypes.TRUETYPE:
                  return  "TrueType";
              case FontTypes.CID:
                  return  "CID";
              case FontTypes.ATC:
                  return  "ATC";
              case FontTypes.BITMAP:
                  return  "Bitmap";
              case FontTypes.OCF:
                  return  "OCF";
              case FontTypes.OPENTYPE_CFF:
                  return  "OpenType CFF";
              case FontTypes.OPENTYPE_CID:
                  return  "OpenType CID";
              case FontTypes.BITMAP:
                  return  "Bitmap";
              case FontTypes.OPENTYPE_TT:
                  return  "OpenType TT";
              case FontTypes.UNKNOWN:
                  return  "The font type is unknown";
              default:
              return  "The font type is unknown";
          }
      }

       

      function WriteToFile(myText){
          myFile = new File("~/Desktop/List of fonts.txt");
          myFile.open("w");
          myFile.write(myText);
          myFile.close();
      }

        • 1. Re: List of fonts
          Harbs. Level 6

          Kasyan Servetsky wrote:

           

          (How could this happen? )

           

           

          I don't know, but some strange stuff has been going on with the forum. I just noticed that I got no emails today!

           

          Harbs

          • 2. Re: List of fonts
            Steven.. Level 3

            Kasyan Servetsky wrote:

             

            Somebody posted a question about how to write a script listing all fonts with details.

            But while I was writing the script the post has gone. (How could this happen?

             

             

            Here is the missing question from my email

             

            asked by: daskirrow67

             

             

            I'm trying to create a .vbs that will list all fonts and styles as listed in the Fonts Menu. I'm just about there with that part.

             

            What I'd like to do next, is obtain the actual font path and pysical filename of the font that this relates to. Something simular to the details displayed when using the 'Find Fonts' - Info panel. Font type and Version would be a bonus, but for now a filename would surfice.

             

            Is this at all possible?