Full justification for LiveCode fields

Find out what's going on with LiveCode (the company), product releases, announcements, and events.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
splash21
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 369
Joined: Sun Dec 19, 2010 1:10 am
Location: UK
Contact:

Full justification for LiveCode fields

Post by splash21 » Fri May 23, 2014 5:40 pm

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 367 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.
Last edited by splash21 on Fri May 23, 2014 9:05 pm, edited 1 time in total.
LiveCode Development & Training : http://splash21.com

dave.kilroy
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 858
Joined: Wed Jun 24, 2009 1:17 pm
Location: Plymouth, UK
Contact:

Re: Full justification for LiveCode fields

Post by dave.kilroy » Fri May 23, 2014 6:32 pm

Thanks John - very nice work!

Kind regards

Dave
"...this is not the code you are looking for..."

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9837
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Full justification for LiveCode fields

Post by FourthWorld » Fri May 23, 2014 6:34 pm

Wonderful work - thank you!
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

splash21
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 369
Joined: Sun Dec 19, 2010 1:10 am
Location: UK
Contact:

Re: Full justification for LiveCode fields

Post by splash21 » Sun May 25, 2014 2:13 pm

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 309 times
FullJustificationLC7.zip
(5.39 KiB) Downloaded 319 times
LiveCode Development & Training : http://splash21.com

Post Reply

Return to “Announcements”