Announcement

Collapse
No announcement yet.

Paragraph object size and Font size relation?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Paragraph object size and Font size relation?

    How to calculate the size of the Paragraph object in which is placed the entire text with the specified font size?
    Like behavior of the Label object when resizing it.
    Thanks in advance.

  • #2
    The Paragraph object does not change its size when you alter the contents or the font, in the way as the Label does. Text will wrap, or scroll bars may be shown if you enabled them. There is no action available to return the size of a Paragraph rectangle in which a certain text would fit without showing a scrollbar.

    Ulrich

    Comment


    • #3
      And what about tricks?

      Comment


      • #4
        I don't think that there are any tricks. What are you trying to achieve?

        Ulrich

        Comment


        • #5
          I want to change the size of the Paragraph object, and then set the desired font size. Only necessary that all the text must be visible.
          It looks like the real way to use Label object...
          Only in this case I have to change a lot in my script.

          Comment


          • #6
            Have a look at the attached sample and see if this helps...

            Ulrich
            Attached Files

            Comment


            • #7
              Very useful. All ingenious is simple...
              Thank you!

              Comment


              • #8
                Also try this slightly modified On Size script, it might work better depending on the situation:

                Code:
                if bReady then
                	local tProps = Paragraph.GetProperties("Paragraph1");
                	local nScaleX = tProps.Width/nInitialWidth;
                	local nScaleY = tProps.Height/nInitialHeight;
                
                	tProps.FontSize = nInitialFontSize * Math.Sqrt(nScaleX * nScaleY);
                	Paragraph.SetProperties("Paragraph1", tProps);
                end
                Ulrich
                Attached Files

                Comment

                Working...
                X