This does not answer your question, Rick, sorry.
The GetAsCSS is showing 'px' and the font sizes are 'pt'. While you are passing the size (as number for use in the function), this should not matter.
It just shows how limited the GetAsCSS function is. It would certainly be most beneficial if we had FUNCTIONs that would get the values like we can set with these possible functions:
Of course, keep in mind that a field can have many styles or combo of styles within it. There is "layout" field styling and user-level field styling, so we'd need to take those into account. I would hope the suggested functions could read a "selection" (in browse mode) as well as a field.
Post your request here:
Also, have you tried GetAsSVG()?
On Jul 27, 2015, at 5:23 AM, RickWells-Cole wrote in whole or in part
This little bit of script used to work fine in v13 to allow text to auto resize to fit a field. It does not work in v14, it just goes to the smallest size. Has anyone any idea what has changed and why it no longer works?
css = GetAsCSS ( Get ( ActiveFieldContents ) ) ;
pStart = Position ( css ; "font-size" ; 1 ; 1 ) + 10;
pEnd = Position ( css ; "px;" ; pStart ; 1 ) ;
size = Middle ( css ; pStart ; pEnd - pStart )
GetAsNumber ( If ( IsEmpty ( size ) ; 14 ; size ) )
I think the problem is with $$Height. I imagine you're sending it as a script parameter which I think is the best approach. In any event I should check the value assigned to this variable.
GetLayoutObjectAttribute can return different values for the height of the same object depending on whether you're using FM13 or FM14. Eg if a field has an outer shadow when its state is 'In Focus', GetLayoutObjectAttribute will return a higher value - taking into account the shadow - in FM14 than in FM13.
I would hard-code the height parameter sent from the object, making sure you send the In Focus value - because that's what it will be compared to within the script. If you send the 'Normal' state height, the second condition of your If statement will never be true, and the script will continue until the first condition is met (and the minimum font size is applied).