Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Mathamatical Pi 1 font to Symbol Font conversion

Community Beginner ,
Aug 23, 2012 Aug 23, 2012

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.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

TOPICS
Scripting
1.2K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 23, 2012 Aug 23, 2012

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Aug 24, 2012 Aug 24, 2012

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;

app.changeTextPreferences.changeTo = My_Symbol_alphabets;

app.changeTextPreferences.appliedCharacterStyle = "symbols";

app.activeDocument.changeText();

          }

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 24, 2012 Aug 24, 2012
LATEST

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;

    app.changeTextPreferences.changeTo = My_Symbol_alphabets;

    app.activeDocument.changeText();

    }

Same result, but more efficient.

Peter

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines