3 Replies Latest reply on Aug 24, 2012 4:40 AM by Peter Kahrel

    Mathamatical Pi 1 font to Symbol Font conversion

    M Karthik

      Hi All,

       

      I am trying to change the Mahtamatical Pi 1 Multiplication sign (×)  to Symbol font. So i have used the below script. but its not workig for me. please help me on this..

       

      app.findTextPreferences = NothingEnum.nothing; 
      app.changeTextPreferences = NothingEnum.nothing;
      app.findTextPreferences.appliedFont = "Mathematical Pi";
      app.findTextPreferences.fontStyle = "1";
      app.findTextPreferences.findWhat = "3";
      app.changeTextPreferences.changeTo = "<00D7>";
      var myResults = app.activeDocument.findText();
      for (i = 0; i <= myResults.length - 1; i++) 
      { 
      myResults[i].appliedCharacterStyle = "symbols"; 
      app.changeText(undefined, false, false, undefined,{},{});
      }
      

       

      Also i am trying to change the entire greek characters (alpha, beta, gamma, etc...) font from mathamatical pi one to symbol font. Is it possible to execute with in the loop??

       

      Thanks

      M. Karthik

        • 1. Re: Mathamatical Pi 1 font to Symbol Font conversion
          Peter Kahrel Adobe Community Professional & MVP

          You're mixing pre-CS3- and CS3+ styles. You don't need a loop to change the multiplication sign:

           

          app.findTextPreferences = NothingEnum.nothing;

          app.changeTextPreferences = NothingEnum.nothing;

           

          app.findTextPreferences.appliedFont = "Mathematical Pi";

          app.findTextPreferences.fontStyle = "1";

          app.findTextPreferences.findWhat = "3";

           

          app.changeTextPreferences.changeTo = "<00D7>";

          app.changeTextPreferences.appliedCharacterStyle = "symbols";

           

          app.activeDocument.findText();

           

          As to changing all Greek characters, how easy that is depends on whether the Greek characters are mapped to the same font positions in the Math Pi and the symbol fonts. For instance, are Math Pi 'a' and Symbol 'a' both alpha?

           

          Peter

          • 2. Re: Mathamatical Pi 1 font to Symbol Font conversion
            M Karthik Level 1

            Yes, Math Pi 'a' and Symbol 'a' both for alpha characters. But some characters has been changed. Just now i have created the below script ...

             

            var My_Math_pi_alphabets = new Array("a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","y","z");
            var My_Symbol_alphabets = new Array("a","b","y","d","e","f","g","h","i","x","k","l","m","n","o","p","r","s","t","q","w","j","c","u","z");
            
            
            for (i=0; i<My_Math_pi_alphabets.length; i++)
            {
            app.findTextPreferences = NothingEnum.nothing;
            app.changeTextPreferences = NothingEnum.nothing;
            
            app.findTextPreferences.appliedFont = "MathPiOne";
            app.findTextPreferences.fontStyle = "Italic";
            app.findTextPreferences.findWhat = My_Math_pi_alphabets[i];
            
            app.changeTextPreferences.changeTo = My_Symbol_alphabets[i];
            app.changeTextPreferences.appliedCharacterStyle = "symbols";
            
            app.activeDocument.changeText();
            
                      }
            
            • 3. Re: Mathamatical Pi 1 font to Symbol Font conversion
              Peter Kahrel Adobe Community Professional & MVP

              In that case you have to do it the way you showed. But there's no need to set the font and the styles at every iteration, you need to do that just once:

               

              app.findTextPreferences = NothingEnum.nothing;

              app.changeTextPreferences = NothingEnum.nothing;

              app.findTextPreferences.appliedFont = "MathPiOne";

              app.findTextPreferences.fontStyle = "Italic";

              app.changeTextPreferences.appliedCharacterStyle = "symbols";

               

              for (i=0; i<My_Math_pi_alphabets.length; i++)

                  {

                  app.findTextPreferences.findWhat = My_Math_pi_alphabets[i];

                  app.changeTextPreferences.changeTo = My_Symbol_alphabets[i];

                  app.activeDocument.changeText();

                  }

               

              Same result, but more efficient.

               

              Peter

              1 person found this helpful