You want to set the fontsize so that the text fits in the field without being clipped?
I once gave a user a pair of buttons. They used the TextSize function to change the font size of the field's contents a few points up or down so that he could adjust tomato plant names to fully fit his label fields.
This could be automated in a script using TextSize to adjust the font size and GetLayoutObjectAttribute to check the fit.
You could set up a script to do the following in Browse mode in a loop:
Put the cursor into the field. This can be done with either go to field or go to object (if you give the field an object name).
Use GetLayoutObjectAttribute ( ObjectNameOfField ; "Height" ) to see if the height of the field now is greater than the height of the field when in layout mode. If so, the field has "Popped out" to show the full field contents and you know that text is too large to fit.
SetField [ Yourtable::TextField ; TextSize ( YourTable::Field ; $K ) ]
Is what you might use to adjust text size in a loop.
I've generally used Custom Formatting to reduce text size progressively as the character count increases. Requires a little experimentation and multiple conditions but has always worked for my needs.
Counting characters is simpler, but unless you use a monospaced font, it doesn't adjust to the size of the field as well as you might like for all possible strings. The following two strings have the same number of characters, but not nearly the same width in pixels: