But "line breaks" is another known factor, based on X… which still leaves us on 
variable to find.

Brian wrote:
You probably could get close with math but line breaks would not be uniform and 
will introduce variability.  You could probably get it down to 2 or 3 checks.

BR: Hmm I figured that a repeat loop would do that, but was look for a 
"one-off-equation"

According to the "laws of math" (ha... algebra....it has been such a long time; 
I could be wrong) if you have single unknown variable , X, and all others are 
known factors, you would, in theory, be able to work out X "in one go."
The [number of characters, in a given font size/face, that can fit on one line 
of the field with a given length] is, in theory, among "what can be the known"

These little repeat loops are costly on mobile....

Paul wrote:
your essentially want a repeat loop where you reduce the textSize of
char 1 to -1 of the field until the formattedHeight of the field is less
than or equal to the height of the field

You probably will need a condition in the loop to prevent the textSize
from going below 9

BR question
Assuming one is not putting whole pages into small fields, does any one have an 
efficient run time LC algorithm that will set the font size so that the 
formatted text will all appear in the field without needing to scroll?

BR

_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to