Set font dynamically to fit text

Sannyasin Brahmanathaswami brahma at hindu.org
Mon Oct 14 15:21:28 EDT 2019


Dan: Thanks for the handler!

Ralph: Actually that last solution offered was fromr Dan Friedman not mine. 
Can you put your two handlers on the list?  " I also have an option to fit either by height or width." 

Doc Hawk:  I give in 😊, " Font scaling itself is nonlinear enough, but the way margins scale with font size is downright psychotic " that's two unknowns in the equation. So iterationis required


============
Ralph wrote
I use the same technique as BR with a couple of diffs. I originally went down by 1's like BR but changed it for increased performance. I set the textsize to a large number(I like BR's initial size option) I then go down by 8s, add 7, down by 4s, add 3, down by 2s, add 1 finally down by ones until it fits. Each of the 4 loops has a check for min size so it down not go down below 2. I guess 2 is too low but it's been working.
I also have an option to fit either by height or width. 




More information about the use-livecode mailing list