Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

Is it possible to define the parameters of auto-sized text?

Avatar

Level 1

Hello,

I'm working on creating a form that will create small signs with variable text sizes. The font value is currently set to "0" but I'm concerned that my end user will add so much text that the sign becomes unreadable.

Is there a way to create limits on font size within a text field? Can I put a range in the value field to achieve what I am looking for? Or is there a better way?

Thank you,

Erin

4 Replies

Avatar

Level 10

Hi Erin,

I don't think there is a way directly find the font size being used, maybe you can achieve a similar thing by checking the length of the field, so something like this in the change event;


if (xfa.event.newText.length > 800)


{


xfa.event.change = "";


}


Regards

Bruce

Avatar

Level 1

Hello Bruce,

Thank you for responding!

My apologies for leaving out a critical piece of information - this issue is occurring on a multi-line text field.

After making a text field with a size 24 font, and changing the value to "0", any time I test it in the PDF preview,  the font size automatically changes to the default. My beautiful size 24 font is reduced to 10 and even if I change the font size in the toolbar, it doesn't fix it.

So I think my question needs to change. Is there a script for this, if not, do you happen to know how to change the default text size in livecycle?

Avatar

Level 10

Hi,

Do you have this problem with other fonts, like Myriad Pro, maybe it is something to do with the particular font you are using.

Are you able to post a link to your form, I haven't come across this problem before.

Regards

Bruce

Avatar

Level 1

My apologies for not coming back to you.

After a 3 hour phone call and several weeks of emails, I received the following helpful information:

"I took a look at your form and quickly noticed a few things. To start, the form you were working on was using PDF artwork since it was imported from an existing AcroForm, this limits the objects and functions you can use, and for that reason I have to recreate the form into a Static XFA form. Once that was done I tackled the font size 0 issue. By setting the font size to 0, you let Acrobat/Reader decide what actual font size should be used, but the only problem you face by enabling multiple lines is that Acrobat/Reader doesn't know when it should stop shrinking the font and start writing to a new line. This is a limitation of the feature, and not a whole lot can be done.

What you can do on the other hand is to script your own logic. In the attached form I created a new formFunction container with a bit of logic. The function stored inside of this container gets called by all of the fields on the form when the document is opened, and every time the field is exited. This logic allows the fields to use font size 0 which auto sizes the font up to a certain point, but after 30 characters (when the font starts being to small), we set the font to a default 10pt and enable multi lines. Using this logic, you should be able to implement this on your forms."