6 Replies Latest reply on Dec 3, 2015 2:42 AM by wsg77257720

    Change glyph script, font error

    wsg77257720

      Hello everyone,

      firstly I'm sorry for my english :-).

      I'm trying to make a scrpit in inDesign cs6 and CC, that change an older not-unicode font's glyph with the Times New Roman Regular's glyph, that contain all the glyph i need and it is unicode.

      I pass to the funcion the glyph id to find and the glyph id to replace

       

       

      function fontRemapping(find, replace){
          var myDocument = app.documents.item(0);
      
      
      
          app.findGlyphPreferences.appliedFont = app.fonts.itemByName("Agora     Roman");
          //Provide the glyph ID, not the glyph Unicode value.
          app.findGlyphPreferences.glyphID = find-0;
        
          app.changeGlyphPreferences.appliedFont = app.fonts.itemByName("Times New Roman     Regular");
          app.changeGlyphPreferences.glyphID = replace-0;
          myDocument.changeGlyph(false);
          //Clear glyph search preferences.
          app.findGlyphPreferences = NothingEnum.nothing;
          app.changeGlyphPreferences = NothingEnum.nothing;
          //app.appliedCharacterStyle('Normale', true);
      }
      
      
      

       

      This is very simple, but i receive ever the error 33801, so i have tried to pass the font name in all the form: "Agora Roman", "Agora     Roman", "Agora\tRoman" and not any of them work.

      Another attempt I made was:

      app.findGlyphPreferences.appliedFont = "Agora";
      app.findGlyphPreferences.fontStyle = "Roman";
      
      


      The ridiculous thing is that yesterday the same script worked, and now has come back to me the error ... this is driving me crazy.

      What I want to know, it is the correct way to get the font name, and then pass it to the app.fonts.itemByName, because app.fonts.itemByName("Agora Roman") is the only one that in these days worked sometimes.


      Thank you at all.

      Antonio