6 Replies Latest reply on Sep 15, 2012 8:51 AM by Peter Spier

    How to detect/mark automatic hyphens in a text?

    camilo umaña Level 1

      To visually control the quantity of hyphenated words in a page, seems appropriated to mark them ( like using some script, similar to that created by H. Jong, where beautifully all hyphenated words are coloured with a red ink?)

      The markup to identify them, as the tilde ^~ does not capture them?

      Screen Shot 2012-09-15 at 7.53.07 AM.jpg

        • 1. Re: How to detect/mark automatic hyphens in a text?
          Steve Werner Adobe Community Professional & MVP

          Your question is not clear to me. What are you asking for? Please try to give an example.

          • 2. Re: How to detect/mark automatic hyphens in a text?
            Peter Spier Most Valuable Participant (Moderator)

            Automatic hyphens are dynamic and not glyphs that can be selected (unlike hyphens you type). As far as I know there's nothing you can do to highlight them.

             

            Are the hyphenation controls available in the Hyphenation Settings dialog not sufficient to control the number of hyphens on your pages?

            • 3. Re: How to detect/mark automatic hyphens in a text?
              camilo umaña Level 1

              I am [almost] sure Jong's script does that...

              Also Indiscript has a similar one to mark hyphenated words, including location!

              Thank you.

               

              Jong:

              try {

              app.activeDocument.colors.add({name:"Warning", space:ColorSpace.RGB, colorValue:[255,0,0]});

              } catch(_) { }

              warningColor = app.activeDocument.swatches.item("Warning");

              t = app.selection[0].parentStory.textContainers;

              p = 0;

              err = 0;

              while (p < t.length)

              {

              if (t[p].lines.length)

              {

                if (t[p].lines[0].words.length && t[p].lines[0].words[-1].lines.length > 1)

                 t[p].lines[0].fillColor = "Warning", err++;

                if (t[p].lines[-1].words.length && t[p].lines[-1].words[-1].lines.length > 1)

                 t[p].lines[-1].fillColor = "Warning", err++;

              }

              p++;

              }

              alert ("Done, marked "+err+" occurrences");

              • 4. Re: How to detect/mark automatic hyphens in a text?
                Peter Spier Most Valuable Participant (Moderator)

                Let's see what happens when you run that script...

                 

                It changes the color of the entire line in which the hyphen occurs. That's quite different from highlighting just the hyphen itself. You might be able to highlight just the hyphenated words, too, but as I said, I don't think it's possible to isolate the hyphen itself since it isn't a "real" glyph, but I could be wrong.

                 

                Presumably, too, you also want this highlight to be dynamic, and to be non-printing? Again, I don't think that's something that can be done in the current iterations of ID. You might want to file a feature request to add hyphens to the list of things that can be highlighted in the composition section of the prefs.

                • 5. Re: How to detect/mark automatic hyphens in a text?
                  camilo umaña Level 1

                  Peter,

                   

                  in Jong-Indiscript-Marc's  scripts the idea is check the composition.

                  Here, the same. Detect automatic hyphens. (highlight, mark, see...)

                   

                  The scripts already mentioned changes the colour in order to detect them.

                  Later this «warning» colour is converted to black and voilá!

                  But those scripts konw how to detect an automatic hyphen, something not visible for the straight user.

                   

                  How to ?:

                  You might be able to highlight just the hyphenated

                  • 6. Re: How to detect/mark automatic hyphens in a text?
                    Peter Spier Most Valuable Participant (Moderator)

                    I don't claim to understand exactly what that script does, but I don't think it is really detecting hyphens, per se. It looks to me like it's checking word counts and using a discrepency to deduce that there is a word that appears in two different lines at the same time, and thus it must be hyphenated.

                     

                    And of course this is not a dynamic highlight. Once you run the script, that text is highlighted until you remove the highlight, even if you edit and remove the hyphen (which may create a new, un-highlted hyphen elsewhere). This does not strike me as a useful method. A GREP style that could identify an automatic hyphen would be useful, but I don't think that's possible.