3 Replies Latest reply on Apr 12, 2011 1:20 AM by Harbs.

    Measuring descenders?

    John Hawkinson Level 5

      For some reason, I thought that textframe.lines[-1].decent would actually give me a different answer if the last line of the frame had "qypgj" in it, versus none of those.


      But that seems not to be the case.


      Are there any efficient ways to find the lowest descent of a textFrame? I guess I could see if the last line of the frame matches /[qypgj]/ and if so add in the .descent property. I'm not sure that's sufficient (maybe commas? Other descenders?), but maybe it is close enough?


      In another thread (Re: Hot to get height of the highest symbol in selection), Harbs suggested creating outlines. That's definitely too much overhead for this...


      Any other thoughts?



        • 1. Re: Measuring descenders?
          Harbs. Level 6

          The descender is the line defined in the font. If the font defines it wrong, it's not even accurate for the real descenders.


          If you know how low the descenders go for a specific font, you can just check the contents for those characters and calculate the y value based on the baseline.


          You can probably do the create outline trick once to get those numbers for each font and then reuse that data...




          1 person found this helpful
          • 2. Re: Measuring descenders?
            John Hawkinson Level 5

            Yeah, I realize it's defined by the font. It's not that it's wrong in the font, just that it's only right for real descenders, and I'd like to know whether or not there actually is a descender...Hrmm.

            • 3. Re: Measuring descenders?
              Harbs. Level 6

              You can go through each glyph that has a descender and measure the bottom offset from the baseline (using creat outlines). You can even save tha data in a lookup, so you'll have it on subsequent runs...