2 Replies Latest reply on Sep 12, 2016 5:13 AM by selvam214

    Typeface related overrides

    selvam214 Level 1

      Hi All,

      I'm trying to collect the font related overrides in application, example: applied manual font style of 'bold, italic, boldItalic ...'. Can you please help to achieve my target.

       

      Method 1 - the en-number of override methods are disturbing, so how to segregate the font overrides from this list?

      Method 2 - how many style-overrides are available? Can we possible to read the style-override's properties? Because, we don't want the tracking, spaceAfter, spaceBefore ... information also.

       

      var mydoc = app.activeDocument;

      var myStoryArray = mydoc.stories.everyItem().getElements();

      var length = myStoryArray.length;

      var myFontArray=[];

      for(var n=0; n<length; n++){

          var allTextStyleRanges = myStoryArray[n].textStyleRanges.everyItem().getElements();

          for(var a=0; a<allTextStyleRanges.length; a++){

              if(allTextStyleRanges[a].styleOverridden==true){

       

      //how to read the style override properties (font related overrides particularly)

                  myFontArray.push(allTextStyleRanges[a].parentTextFrames[0].parentPage.name+'-'+allTextSty leRanges[a].contents+"\r")

                  }

              }

          }

       

      myFontArray = myFontArray.toString().replace(/\r,/g, "\r");

      alert(myFontArray);

       

       

       

      Kindly let me know if not clear my request.

       

      Thanks

      Selva

        • 1. Re: Typeface related overrides
          selvam214 Level 1

          Hi All,

          The below code is correct method?

           

           

           

          var mydoc = app.activeDocument;

          var myStoryArray = mydoc.stories.everyItem().getElements();

          var length = myStoryArray.length;

          var myFontArray=[];

          for(var n=0; n<length; n++){

              var allTextStyleRanges = myStoryArray[n].textStyleRanges.everyItem().getElements();

              for(var a=0; a<allTextStyleRanges.length; a++){

                  if(allTextStyleRanges[a].styleOverridden==true){

                      if (allTextStyleRanges[a].parentTextFrames[0].parent instanceof MasterSpread || allTextStyleRanges[a].parentTextFrames[0].parent.parent instanceof MasterSpread) {continue}

                      if((allTextStyleRanges[a].tracking>0)||(allTextStyleRanges[a].tracking<0)){continue}

                      if((allTextStyleRanges[a].spaceAfter>0)||(allTextStyleRanges[a].spaceAfter<0)){continue}

                      if((allTextStyleRanges[a].spaceBefore>0)||(allTextStyleRanges[a].spaceBefore<0)){continue }

                      if((allTextStyleRanges[a].noBreak==true)){continue}

                      var spaceafter = allTextStyleRanges[a].spaceAfter;

                      var spacebefore = allTextStyleRanges[a].spaceBefore;

                      if((allTextStyleRanges[a].appliedParagraphStyle.spaceAfter!=spaceafter)||(allTextStyleRan ges[a].appliedParagraphStyle.spaceBefore!=spacebefore)){continue}

                      if((allTextStyleRanges[a].leftIndent>0)||(allTextStyleRanges[a].leftIndent<0)){continue}

                      if((allTextStyleRanges[a].rightIndent>0)||(allTextStyleRanges[a].rightIndent<0)){continue }

                      var rightindent = allTextStyleRanges[a].rightIndent;

                      var leftindent = allTextStyleRanges[a].leftIndent;

                      if((allTextStyleRanges[a].appliedParagraphStyle.rightIndent!=rightindent)||(allTextStyleR anges[a].appliedParagraphStyle.leftIndent!=leftindent)){continue}

                      if((allTextStyleRanges[a].firstLineIndent>0)||(allTextStyleRanges[a].firstLineIndent<0)){ continue}

                      var firstindent = allTextStyleRanges[a].firstLineIndent;

                      if(allTextStyleRanges[a].appliedParagraphStyle.firstLineIndent!=firstindent){continue}

                      if(allTextStyleRanges[a].contents=="\r"){continue}

                      if(allTextStyleRanges[a].contents==" "){continue}

                      if(allTextStyleRanges[a].fontSize){continue}

                      myFontArray.push(allTextStyleRanges[a].parentTextFrames[0].parentPage.name+'-'+allTextSty leRanges[a].contents+"\r")

                      }

                  }

              }

           

          myFontArray = myFontArray.toString().replace(/\r,/g, "\r");

          alert('Font\r'+myFontArray);

           

           

           

           

           

           

           

           

          Thanks,

          Selva

          • 2. Re: Typeface related overrides
            selvam214 Level 1

            Hi All,

            Goes to the negative result for one-by-one attack (above code). I can't move to the next level, can anyone help on this topic.

             

             

             

             

            Selva