3 Replies Latest reply on Jul 20, 2017 12:14 AM by Sudha K

    Find Glyph using Unicode

    Sudha K Level 1

      Hi,

       

           I need to find and change the glyphs using unicode.  When i searching the forum i got the below code.

       

           Here what is glyphID?  I need to find the glyphs using unicode.  How can i say unicode in the below code?

       

      Code:

       

      app.findGlyphPreferences = null;

      app.changeGlyphPreferences = null;

      app.findGlyphPreferences.glyphID = 0;

      app.findGlyphPreferences.appliedFont = "Font family Name"

      app.findGlyphPreferences.fontStyle = "Font Style Name"

      found = app.activeDocument.findGlyph();

      if (found.length > 0)

      {

      }

       

       

      - Sudha K

        • 1. Re: Find Glyph using Unicode
          Ananth@desgin Level 3

          Hi,

          Try this,

           

          var myDoc = app.activeDocument;
          app.findGlyphPreferences = app.changeGlyphPreferences = null;
          
          //This is example, so please change the fonts and glyphID
          
          app.findGlyphPreferences.appliedFont = "Minion Pro"
          app.findGlyphPreferences.fontStyle = "Regular"
          //Provide the glyph ID, not the glyph Unicode value. 
          app.findGlyphPreferences.glyphID = 366;
          app.changeGlyphPreferences.appliedFont = "Minion Pro"
          app.changeGlyphPreferences.fontStyle = "Regular"
          //Provide the glyph ID, not the glyph Unicode value. 
          app.changeGlyphPreferences.glyphID = 240;
          myDoc.changeGlyph(false);
          app.findGlyphPreferences = app.changeGlyphPreferences = null;
          

           

          Thanks,

          Prabu G

          • 2. Re: Find Glyph using Unicode
            [Jongware] Most Valuable Participant

            That does not use the Unicode value, it's the glyph index: InDesign ExtendScript API (12.0) . That is not the same thing.

             

             

            The option to look for or replace with a Unicode is missing from the scripting engine (since CS3, I might add¹). Report it to Adobe.

             

            Before someone says: "well it's not a problem because you can always use the regular text find/change or the GREP find/change to search for Unicode characters, like this (piece of code)". Wrong. With these you cannot (1) search for any glyph and replace it with a certain Unicode character, and (2) the other way around, search for a Unicode character and replace it with any glyph. The Glyph Find/Change dialog allows both.

             

            ¹ Which, if I remember correctly, was the first version in which this dialog appeared. So it's safe to guess "it was never there, and it was never missed in the 7 major versions since then."

            • 3. Re: Find Glyph using Unicode
              Sudha K Level 1

              Hi,

               

                   Thank you....

               

                   I have used GID to find and replace glyphs.

               

               

              - Sudha K