Compare two lists (comparing fontName before/after)

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

thatkeith
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 346
Joined: Mon Mar 01, 2010 7:13 pm
Location: London, UK
Contact:

Re: Compare two lists (comparing fontName before/after)

Post by thatkeith » Tue Mar 27, 2018 6:55 pm

It’s quite simple - I first saw ‘start using font’ from a mailing list thread, so I started with that. Then when I saw revFontLoad it seemed to be exactly the same except for two factors: it's older (minor), and it’s less flexible. :)
Technical Writer, Meta
University Lecturer
Technical Editor, MacUser (1996-2015)
360 VR media specialist

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9361
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Compare two lists (comparing fontName before/after)

Post by richmond62 » Tue Mar 27, 2018 7:00 pm

fontComp.png
adding Fonts.livecode.zip
Here's the stack.
(1.46 KiB) Downloaded 176 times
Button "BONGA-BONGA" contains this:

Code: Select all

on mouseUp
   put empty into fld "fDIFFS"
   put empty into fld "fBEFORE"
   put empty into fld "fAFTER"
   put the fontNames into fld "fBEFORE"
   revFontLoad "/Volumes/STORAGE_2/Free Fonts/Happy Clean/TTF/Happy Party.ttf"
   put the fontNames into fld "fAFTER"
end mouseUp
Button "BEFORE & AFTER" contains this script:

Code: Select all

on mouseUp
   put 1 into KOUNT
   put 1 into QOUNT
   put fld "fBEFORE" into CHKLIST
   repeat until line KOUNT of fld "fAFTER" is empty
      put line KOUNT of fld "fAFTER" into TOCHECK
      if CHKLIST contains TOCHECK THEN
         -- DO NIX
      else
         put TOCHECK into line QOUNT of fld "fDIFFS"
         add 1 to QOUNT
         end if
      add 1 to KOUNT
   end repeat
end mouseUp
Works like a charm.

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7227
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Compare two lists (comparing fontName before/after)

Post by jacque » Tue Mar 27, 2018 7:15 pm

Code: Select all

split pList1 by cr and null
split pList2 by cr and null
Interesting, I never thought to do that. I usually do "split as set" but I suppose there are times when empty elements might be preferable.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

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

Re: Compare two lists (comparing fontName before/after)

Post by FourthWorld » Tue Mar 27, 2018 7:55 pm

jacque wrote:
Tue Mar 27, 2018 7:15 pm

Code: Select all

split pList1 by cr and null
split pList2 by cr and null
Interesting, I never thought to do that. I usually do "split as set" but I suppose there are times when empty elements might be preferable.
I'm on Linux where we haven't had a working Dictionary for several versions, so I'm operating at a disadvantage here until that gets fixed: what is the "as set" option, and when was it introduced?

EDIT: Never mind - I was able to turn this up with a web search:
http://livecode.wikia.com/wiki/Split

I guess either could be used here. The two-delim method might be slightly leaner on memory, but not enough to care about.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: Compare two lists (comparing fontName before/after)

Post by bogs » Tue Mar 27, 2018 8:54 pm

FourthWorld wrote:
Tue Mar 27, 2018 7:55 pm
I'm on Linux where we haven't had a working Dictionary for several versions, so I'm operating at a disadvantage here until that gets fixed: what is the "as set" option, and when was it introduced?
Keep in mind there is also Brian's excellently quick web based version of the dictionary here.
Image

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9655
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Compare two lists (comparing fontName before/after)

Post by dunbarx » Tue Mar 27, 2018 9:53 pm

Keep in mind there is also Brian's excellently quick web based version of the dictionary here.
Yep, and it was Bogs who turned me on to it. I NEVER use the built-in dictionary any longer.

I just don't have the time. Silly, I think.

Craig

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: Compare two lists (comparing fontName before/after)

Post by bogs » Tue Mar 27, 2018 10:24 pm

For me, whenever I am in 8 or higher (rarely), *if* I am not using the stacks I pulled out of Mc (also rarely), then I rely on 3 sources the most heavily. In order they are -
  • The excellently quick and very resizeable Tiny Dictionary from Bernd and friends (set to start when the IDE does).
  • Max's wiki, which often goes in to more depth than the regular dictionary.
  • Brian's web version of the dictionary, which is the fastest web dictionary I ever used.
Image

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7227
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Compare two lists (comparing fontName before/after)

Post by jacque » Tue Mar 27, 2018 10:39 pm

Keep in mind there is also Brian's excellently quick web based version of the dictionary here.
Too bad it doesn't work on mobile. (Try it on Android Chrome.) When I'm in the IDE I use the native dictionary because I rely on the script integration. I read the forums on my tablet and that's where I usually need to look up a reference.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

thatkeith
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 346
Joined: Mon Mar 01, 2010 7:13 pm
Location: London, UK
Contact:

Re: Compare two lists (comparing fontName before/after)

Post by thatkeith » Tue Mar 27, 2018 10:56 pm

That's a shame! It's exactly the kind of thing that would be superb to have on a 'second screen' device. It works fine on my iPad, but smaller screens seem to break the div setup.
Technical Writer, Meta
University Lecturer
Technical Editor, MacUser (1996-2015)
360 VR media specialist

jameshale
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 474
Joined: Thu Sep 04, 2008 6:23 am
Location: Melbourne Australia

Re: Compare two lists (comparing fontName before/after)

Post by jameshale » Tue Mar 27, 2018 11:42 pm

Intrigued by mention of RevFonLoad not being in the dictionary i thought i would check Brian’s online version. nope, no mention.
So i checked my Dash version (I am on my iPad away from my iMac).
Nope, no mention.
Went to github and searched the codebase.
Found this snippet from a release note.
RevFont has been removed

The revFont external library has been removed as it is no longer required.

The two commands provided by the revFont library have been superceded by commands that are built into the LiveCode engine. The replacements are:

revFontLoad -> start using font
revFontUnload -> stop using font
The note was dated Nov 2016.

As for accessing the dictionary on linux, you can use Zeal and read the Dash docset created for LiveCode. It is bsed on the current lc9rc1 release. Zeal details can be found at https://zealdocs.org

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

Re: Compare two lists (comparing fontName before/after)

Post by FourthWorld » Wed Mar 28, 2018 1:10 am

For me not having the Dictionary is the small part. The root cause is a problem when SQLite init, so I don't get the suggested handlers in the Script Editor either, not anything else that needs SQLite. :(
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: Compare two lists (comparing fontName before/after)

Post by bogs » Wed Mar 28, 2018 1:18 am

jacque wrote:
Tue Mar 27, 2018 10:39 pm
Keep in mind there is also Brian's excellently quick web based version of the dictionary here.
Too bad it doesn't work on mobile. (Try it on Android Chrome.) When I'm in the IDE I use the native dictionary because I rely on the script integration. I read the forums on my tablet and that's where I usually need to look up a reference.
Well, I guess I'll go take a look, surprising it wouldn't work on a tablet though. Maybe Brian will fix it :D I have a lot of confidence in that guy.
Image

bwmilby
Posts: 438
Joined: Wed Jun 07, 2017 5:37 am
Location: Henrico, VA
Contact:

Re: Compare two lists (comparing fontName before/after)

Post by bwmilby » Wed Mar 28, 2018 11:35 pm

bogs wrote:
Wed Mar 28, 2018 1:18 am
Well, I guess I'll go take a look, surprising it wouldn't work on a tablet though. Maybe Brian will fix it :D I have a lot of confidence in that guy.
Thanks! It is on my wish list. I’m actually using the same code as in the LC dictionary. Part of the speed is that it downloads the whole dictionary when loaded so everything is just filtered locally. I would like to fix the css so it works on phones. I do use it on my iPhone, but it is cumbersome (no access to filters, have to resize to see the hamburger icon, etc.). For me it works pretty good in landscape orientation on my iPad 3. I’m a few versions behind, so I need to get an update posted to align with RC1.

When I do get the css fixed, I’ll put in a PR to include with LC so the dictionary can be made narrower than today.
Brian Milby

Script Tracker https://github.com/bwmilby/scriptTracker

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7227
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Compare two lists (comparing fontName before/after)

Post by jacque » Thu Mar 29, 2018 12:02 am

Thanks Brian, that'd be terrific. Right now it's pretty messed up on Android but I'd love to use it.

I don't know where you get your energy but ours is not to question why. ;)
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: Compare two lists (comparing fontName before/after)

Post by bogs » Fri Mar 30, 2018 7:38 pm

bogs wrote:
Wed Mar 28, 2018 1:18 am
Well, I guess I'll go take a look, surprising it wouldn't work on a tablet though. Maybe Brian will fix it :D I have a lot of confidence in that guy.
Hmm, I borrowed a tablet and went to look at the site. It is a bit slower on the tablet (least the one I used), but it seemed functional for the most part, not some wretched mess like I was thinking you meant. Unfortunately, I don't think I could take browsing on a tablet very well.

Jacque (and anyone else that uses them), you must have the patience of a saint and the eyes of a hawk, or at least the corrective lenses that get you close enough.

I'll stick to my larger less portable devices.
Image

Post Reply

Return to “Talking LiveCode”