Set font dynamically to fit text
Dan Friedman
dan at clearvisiontech.com
Sun Oct 13 13:13:06 EDT 2019
Sannyasin,
I've been doing this for years. Works well...
on doShrinkToFit lFldID,startingSize,minSize
set the textSize of lFldID to startingSize
repeat until the formattedHeight of lFldID <= the height of lFldID
set the textSize of lFldID to (the textSize of lFldID - 1)
if the textSize of lFldID < minSize then
exit repeat
end if
end repeat
end doShrinkToFit
Of course, the moment you start with this type of work, you'll immediately wish LiveCode would support fractional font sizes!
Hope that helps...
-Dan
On 10/12/19, 5:21 PM, "use-livecode on behalf of Sannyasin Brahmanathaswami via use-livecode" <use-livecode-bounces at lists.runrev.com on behalf of use-livecode at lists.runrev.com> wrote:
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
Satchiai Iru - Be a Witness
_______________________________________________
use-livecode mailing list
use-livecode at lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
More information about the use-livecode
mailing list