6 Replies Latest reply on Aug 23, 2016 12:26 PM by Silly-V

    Font check script?

    Praxell Design Level 1

      Hi, I have a minimum font requirement of 8pt. In Indesign you can specify the document to report back when any text is less than 8pt font via the Preflight feature. I would love a script like this for Illustrator. Problem is I know next to nothing about scripts. Any good starting point or best advice on how I can accomplish this font check?

       

      Thank you,

      E

        • 1. Re: Font check script?
          o-marat Level 3

          If a script, you have to check every character in every frame... If your document has a lot of text, the check will be delayed for a long time.

          • 2. Re: Font check script?
            Silly-V Adobe Community Professional

            If they have Indesign, it may be possible to do an over-the-top cross-app script to paste over all text frames and run a font-check. Or maybe I'm just full of crazy-talk

            • 3. Re: Font check script?
              Silly-V Adobe Community Professional

              Let's try this test and see how long it takes for your document.

               

              #target illustrator
              function test() {
                  function checkTextFrameChars(textFrame) {
                      var thisChar;
                      for (var i = 0; i < textFrame.characters.length; i++) {
                          thisChar = textFrame.characters[i];
                          if (thisChar.characterAttributes.size < 8) {
                              thisChar.select(true);
                          }
                      };
                  };
                  var doc = app.activeDocument,
                      thisFrame, startTime = new Date().getTime();
                  for (var i = 0; i < doc.textFrames.length; i++) {
                      thisFrame = doc.textFrames[i];
                      checkTextFrameChars(thisFrame);
                  };
                  app.redraw();
                  alert("All characters smaller than 8pt should be selected, process took " + ((new Date().getTime() - startTime) / 1000) + " seconds.");
              };
              test();
              

               

              2016-08-22 14_27_56-Untitled-1_ @ 69% (CMYK_Preview).png

              1 person found this helpful
              • 4. Re: Font check script?
                o-marat Level 3

                Fast enough (but Silly-V is faster )) ). It remains now to find out what to do next.

                • 5. Re: Font check script?
                  subieguy2 Level 1

                  I do something similar to this for my documents. I just force anything lower than my minimum....to my minimum. Just thought I would share although Silly-V is much better solution.

                   

                  #target Illustrator  
                  var doc = app.activeDocument;  
                  for (i = 0; i < doc.textFrames.length; i++)  
                      {  
                          var allText = doc.textFrames[i];  
                          var allTextAttributes = allText.textRange.characterAttributes;  
                          //alert(allTextAttributes.size);  
                          if (allTextAttributes.size < 8)
                    {
                          //alert("less than 5");
                    allTextAttributes.size = (8);
                    }
                     } 
                  
                  • 6. Re: Font check script?
                    Silly-V Adobe Community Professional

                    I wouldn't say 'much better' - only that one goes character-deep to account for variations within a text frame is all