3 Replies Latest reply on Jul 12, 2016 10:28 PM by Mylenium

    Center text anchor point through expression

    VIZOR

      Hello! This is my first post, so im sorry if I caused a lot of facepalm.

       

      I wanted to center the anchor point of the text through an expression. What I did was:

       

      X = this.sourceRectAtTime().width/2;

      Y = this.sourceRectAtTime().height/2;

      [X,Y]

       

      This almost does the job... However, there is a small offset. I tried to figure it out, and it seems that the (0,0) of the anchor point does not match the lower left corner, but instead has a small offset, usually below 5. Also, this offset seems to change depending on the font and text.

       

      How can I make an expression that combats this problem, and place the anchor point in the dead center of the text?

        • 1. Re: Center text anchor point through expression
          Mylenium Most Valuable Participant

          You can't since you have no way of gathering the actual dimensions of the em box (that's what it's called) and the kerning pairs of a font. You can only eyeball it and tweak it for every font, hence attemting to center the anchor point this way is mostly a futile exercise.

           

          Mylenium

          • 2. Re: Center text anchor point through expression
            VIZOR Level 1

            What if I used a self-made font and knew the em size & kerning? How can I then use that information to center the anchor point?

             

            P.S. is there a plugin to help with this situation?

            • 3. Re: Center text anchor point through expression
              Mylenium Most Valuable Participant

              Of course you can use monospaced fonts or design your own and simply add and subtract values, but quite generall you will always have situations where the visual cenrter has nothing at all to do with the actual calculated center. Other than that you can find endless info on how the various parameters of typefaces relate to one another nad how to calculate them, but it's far from trivial, so I'd advise against it. In over 15 years of using AE I've never had the need nor desire to get into this stuff. It's much more important to find good typefaces to begin with, both in an aesthetical and technical sense.

               

              Mylenium