This is how I fit text into fields and buttons. This the first LC code I wrote back in LC 4.6. I did not follow best practices back then. After looking at it again I see that I optimized it so you don't have to set the textsize to some huge number.
https://tinyurl.com/y2jtt877 Ralph DiMola IT Director Evergreen Information Services [email protected] -----Original Message----- From: use-livecode [mailto:[email protected]] On Behalf Of Sannyasin Brahmanathaswami via use-livecode Sent: Monday, October 14, 2019 3:21 PM To: How to use LiveCode Cc: Sannyasin Brahmanathaswami Subject: Re: Set font dynamically to fit text 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. _______________________________________________ use-livecode mailing list [email protected] Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode _______________________________________________ use-livecode mailing list [email protected] Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
