Leave feedback
  • Question

    How can I retrieve the x-positon for the end of a text field in PageOut?

Enter a new topic
  • Anna Svensson Anna Svensson
    0 likes 2866 views

    I would like to align a new variable next to the text field but use another fontsize.


    textfield1 <space> index 

    where textfield1 would have font modena and size 10 and index would have modena and size 8.

    $xpos = getcurrx() will give me the startpoint of textfield1 but I need to know the x-pos at the end to set the position for the index.

    Is there a built-in function for this or do I have to calculate the lenght of textfield1?

    textfield1 and index can have the same characters in them (i.e. numbers since index will be a footnote counter and textfield is a product name ) and one cannot therefore search for a substring and then dynamically change the font size.

    Kind regards,


    Wednesday 10 February, 2010
  • Stefan Cohen Stefan Cohen StreamServe Employee Administrator

    May I suggest a much easier alternative? Use the advanced text tool instead. It gives you the possibility to place two variables with different font and size  next to each other separated by a whitespace as one object. I think that will give you what you want without any scripting.

    I have attached a screenshot to illustrate how it can be done.

    Wednesday 10 February, 2010

    Attached files

    ex.png 42 KB
  • Anna Svensson Anna Svensson


    Thanks - I will try your solution which looks simple and neat. Is there any difference in performance using advanced text rather than normal text or something else that I shall consider? The textboxes will be used within recurring data.

    Kind regards,



    Thursday 11 February, 2010
  • Rens Duijsens Rens Duijsens Partner

    For me, part of the question is still valid. :-)

    In some senario's it is really helpful to be able to determine the physical length of a string or object in points, milimeters or inches. Sometimes it would be nice to know the end X-position of a string or for instance a picture or something like that.

    Will there be such a function in future releases?

    Friendly greetings
    Rens Duijsens

    Friday 19 March, 2010
  • David Bares David Bares OpenText Employee Administrator StreamServe Employee
    Hi, there is a script function GetTextFormattingInfo that is able to format the LXF fragment and return the dimensions. But it may be difficult to build a LXF fragmetn in some cases. And it has a performance const to build, parse and format the fragment and then through it away. Also, the function uses LXF text formatting that is not compatible with StoryTeller formatting. In StoryTeller it is possible to ask the actual object size in the script after the object. Best regards, David Tuesday 23 March, 2010