0 Replies Latest reply on May 13, 2015 4:30 AM by mats_zix

    strange behavior for font.name, anyone knows why or what to do?

    mats_zix

      I recently noted one of our scripts has stopped working in versions above InDesign CS5. It is a script that replaces fonts, using their font.name property. When putting the font name property into an alert box, we see something strange: the font name seems to contain two instances of the fontStyle.

      So for instance, if I have a document with two Frutiger fonts, one bold and one light, and the first font in the document font list is "Frutiger 45 Light", and I then show it's name in an alert with the command

      alert(app.activeDocument.fonts[0].name);

      instead of:

      "Frutiger     45 Light"

      I get:

      "Frutiger     45Light45Light"

       

      Even stranger: when I try

      alert(app.activeDocument.fonts.everyItem().name);

      I get

      "Frutiger     45 Light, Frutiger     65 Bold"

      No extra fontStyle here.

       

      Does someone here know what is going on? Are you getting the same results?

       

      I have some memory of the script working on CS6 and CC about half a year ago, but I may of course be wrong. We don't use the script very often, but when we do use it we really need it!

      If you want to know, the reason we use font.name instead of font.fullName or font.fontFamily is that the "name" property works with both installed and uninstalled (missing) fonts.

       

      With kind regards

      /Mats