Graphics

 View Only
  • 1.  Centering Text Object on Y-Axis

    Posted 30 days ago
    Here's a problem I've been trying to solve for the past year with no luck.  I have a text object that I need to keep centered vertically in a fixed-size box in a single specific location on the screen.  The text scales in size depending on the amount of text.  It could be as few as two words in one line or as many as 4 lines.  What we have been doing is to just position and scale the text manually.  I was hoping for a more elegant (automated) method of sizing the text to fit in the box using auto-squeeze height and width. I can't figure out the math to keep the text centered on the y-axis, however.  I've tried dividing the box object height by 2 and making that the y pivot of the text.  I've tried offsets. I've tried halving the height scaled value of the text object bounding box. I've tried setting Y value offsets based on greater than or less than the value of the bounding box height, and I just haven't gotten a consistent result.  Is there a way to auto-scale the size of the text box object based on the size of the box the text sits in?
    I've attached a couple of samples of the graphic I'm working with so you can see the different variations I'm dealing with.
    Thank you for any help at all.


    ------------------------------
    Greg Petronzio
    Graphics Op/Integrator
    Freelance
    ------------------------------


  • 2.  RE: Centering Text Object on Y-Axis

    Posted 30 days ago
      |   view attached

    Hi Greg.
    Try the scene in the attachment. 
    It makes with Visual Logic.



    ------------------------------
    Roman Yaroshenko
    chief specialist
    RBC-TV
    Moscow Russian Federation
    ------------------------------

    Attachment(s)

    xpf
    Test_02.xpf   25 KB 1 version


  • 3.  RE: Centering Text Object on Y-Axis

    Posted 27 days ago
      |   view attached
    Hi,
    Roma's example scene does not work optimally with different font sizes. But if you do not change the y position of Text1 in the VL and set it to 0 and use it's Pivot.Y point as center with this kind of Visual Logic, then it should work with any size fonts:
    I will attach a modified xpf-file.

    ------------------------------
    Juha Koivisto
    Tampere
    Finland
    ------------------------------

    Attachment(s)