Page 1 of 1

Full justification for LiveCode fields

Posted: Fri May 23, 2014 5:40 pm
by splash21
Thanks to Dave Kilroy for sharing the work around and the generosity of Mark Stephens of Simulytics for donating the code back to the LiveCode community, a new function is available to fully justify LiveCode text fields. LiveCode version >= 6.5 is required as it uses the measureText function which was introduced in 6.5. It doesn't work with the LC7 DP releases as the charIndex property seems to be missing - I assume it's down to the unicode changes that are underway. I've been testing on Mac / Linux and Windows - everything looks good so far !...

The code is in the public domain and completely free to use for any purpose :)

FullJustification.zip
(5.13 KiB) Downloaded 370 times

P.S. I'll ask at the jam if the unicode changes will mean losing any properties, etc. (I suspect not). It's not a big deal to alter the code slightly if charIndex did disappear.
Kevin confirmed that no text properties will be dropped in v7, so a bug report has been filed.

Re: Full justification for LiveCode fields

Posted: Fri May 23, 2014 6:32 pm
by dave.kilroy
Thanks John - very nice work!

Kind regards

Dave

Re: Full justification for LiveCode fields

Posted: Fri May 23, 2014 6:34 pm
by FourthWorld
Wonderful work - thank you!

Re: Full justification for LiveCode fields

Posted: Sun May 25, 2014 2:13 pm
by splash21
Thanks for the feedback. I've made a small performance tweak (v1.01) which may save a few cycles on really large text - every little helps! :)
I've also uploaded a tweaked version that will work with the LC7 DP releases that don't have the charIndex property. I've not timed the LC7 version (which uses offset instead of charIndex) - it may actuallt be faster.
FullJustificationV1-01.zip
(5.03 KiB) Downloaded 311 times
FullJustificationLC7.zip
(5.39 KiB) Downloaded 321 times