SVG Icon - Quick hack
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Re: SVG Icon - Quick hack
thanks James, I haven't started playing with 8.0.1, I'll give it a try later
I am wondering if the svg will fail if it does not end in a "z", just speculating on what might be wrong in the new version
I am wondering if the svg will fail if it does not end in a "z", just speculating on what might be wrong in the new version
Greg (pink) Miller
MadPink, LLC
I'm Mad, Pink and Dangerous to Know
MadPink, LLC
I'm Mad, Pink and Dangerous to Know
Re: SVG Icon - Quick hack
I'm going to do some more testing... I'm changing the end of the import script to this:
Code: Select all
repeat until tStop is true
put char -1 of tNewPath into tChar
switch tChar
case space
case cr
delete char -1 of tNewPath
break
default
put true into tStop
break
end switch
end repeat
Greg (pink) Miller
MadPink, LLC
I'm Mad, Pink and Dangerous to Know
MadPink, LLC
I'm Mad, Pink and Dangerous to Know
-
- VIP Livecode Opensource Backer
- Posts: 474
- Joined: Thu Sep 04, 2008 6:23 am
- Location: Melbourne Australia
Re: SVG Icon - Quick hack
I am pretty sure I have tried paths that simply end in a number so no, do not think 'z' is mandatory.am wondering if the svg will fail if it does not end in a "z"
Re: SVG Icon - Quick hack
added another card in which you can create a button bar (or rather a group of SVG icons)
- Attachments
-
- SVG Library a6.livecode.zip
- (126.03 KiB) Downloaded 355 times
Greg (pink) Miller
MadPink, LLC
I'm Mad, Pink and Dangerous to Know
MadPink, LLC
I'm Mad, Pink and Dangerous to Know
-
- VIP Livecode Opensource Backer
- Posts: 3997
- Joined: Sun Jan 07, 2007 9:12 pm
- Location: Bochum, Germany
Re: SVG Icon - Quick hack
Hi James, Greg,
this seems to work quite well for me for the import of path data from .svg files. Of course it fails with quite some of the more elaborate SVGs.
For some SVGs it shows at least something...
Kind regards
Bernd
this seems to work quite well for me for the import of path data from .svg files. Of course it fails with quite some of the more elaborate SVGs.
Code: Select all
on mouseUp
answer file "choose SVG-File"
if it is empty then exit mouseUp
put url ("file:" & it) into tData
set the lineDelimiter to " d=" & quote -- begin of path
set the itemDelimiter to quote -- end of path
repeat with i = 2 to the number of lines of tData
put word 1 to - 1 of item 1 of line i of tData after tCollect -- no problem with trailing spaces or returns
end repeat
replace "m" with cr & cr &"M" in tCollect -- for some svgs it helps to make "M" absolute = capital M
replace comma with space in tCollect -- so it fits into a field in case it is comma delimited
put word 1 to - 1 of tCollect into tCollect -- no problem with returns
put tCollect into field "fSVGData"
end mouseUp
Kind regards
Bernd
-
- VIP Livecode Opensource Backer
- Posts: 931
- Joined: Thu Nov 13, 2008 6:48 am
- Location: London, UK
Re: SVG Icon - Quick hack
Hi, I noticed LC now has an AddIcon handler that requires a name, SVG path and codepoint to import an SVG Icon. I've downloaded a couple of SVG Icon files that have names and paths but none had a codepoint identified in them. Where do I find the information to fill in the codepoint?
Thanks
Mark
Thanks
Mark
macOS 12.6.5 (Monterey), Xcode 14.2, LC 10.0.0, iOS 15.6.1
Targets: Mac, iOS
Targets: Mac, iOS
-
- VIP Livecode Opensource Backer
- Posts: 3997
- Joined: Sun Jan 07, 2007 9:12 pm
- Location: Bochum, Germany
Re: SVG Icon - Quick hack
Hi Mark,
there are a couple of utilities out on Livecodeshare by Brian Milby and Devin Asay.
http://livecodeshare.runrev.com/stack/872/SVG-Icon-Tool
http://livecodeshare.runrev.com/stack/8 ... mily-Maker
http://livecodeshare.runrev.com/stack/8 ... con-Picker
Check those out how to add a SVG-font and manage it.
Kind regards
Bernd
there are a couple of utilities out on Livecodeshare by Brian Milby and Devin Asay.
http://livecodeshare.runrev.com/stack/872/SVG-Icon-Tool
http://livecodeshare.runrev.com/stack/8 ... mily-Maker
http://livecodeshare.runrev.com/stack/8 ... con-Picker
Check those out how to add a SVG-font and manage it.
Kind regards
Bernd
-
- VIP Livecode Opensource Backer
- Posts: 931
- Joined: Thu Nov 13, 2008 6:48 am
- Location: London, UK
Re: SVG Icon - Quick hack
Thanks Bernd. Nice set of programs. They will come in handy. I am having a bit of a problem using an imported SVG Icon description and I wonder if anyone here would have time to take a look. I was looking for a +/- icon and found one on the net. Downloaded the file (maybe I should just upload it?) and noticed right away it rendered on my Mac (as the image over the download folder), in an email message when I sent it to myself from one machine to another (poor mans network ) ,,, in the email which was just sending the SVG file it actually rendered it in the message body. Lets see, in LC when I used the code in the http://lessons.livecode.com/m/4071/l/10 ... -in-my-app lesson. Yup that worked perfectly and in fact I will upload that stack and the customIconData.json file I created for it. There were a few things at the beginning and end of the description I had to take out because it was packaged in html. But that worked fine.
The problem that occurs happens when I compile the code and test. I get nothing on either macOS or iOS and I'm not sure why. Any ideas?
Thanks
Mark
- Attachments
-
- Archive.zip
- (5.09 KiB) Downloaded 189 times
macOS 12.6.5 (Monterey), Xcode 14.2, LC 10.0.0, iOS 15.6.1
Targets: Mac, iOS
Targets: Mac, iOS
-
- VIP Livecode Opensource Backer
- Posts: 931
- Joined: Thu Nov 13, 2008 6:48 am
- Location: London, UK
Re: SVG Icon - Quick hack
Can anyone see why the following code would work in development, but not when compiled to Mac or iOS devices?
Thanks
(attached archive contains code and json file for SVG)
Code: Select all
on mouseUp
## Load custom icons
put specialFolderPath("resources") & "/customIconData.json" into tSVGDataFile
put jsonToArray(url ("file:" & tSVGDataFile)) into tSVGDataArray
repeat with x = 1 to the number of elements in tSVGDataArray
addIcon tSVGDataArray[x]["name"],tSVGDataArray[x]["path"],tSVGDataArray[x]["codepoint"]
end repeat
end mouseUp
(attached archive contains code and json file for SVG)
- Attachments
-
- Archive.zip
- (5.06 KiB) Downloaded 161 times
macOS 12.6.5 (Monterey), Xcode 14.2, LC 10.0.0, iOS 15.6.1
Targets: Mac, iOS
Targets: Mac, iOS
-
- VIP Livecode Opensource Backer
- Posts: 931
- Joined: Thu Nov 13, 2008 6:48 am
- Location: London, UK
Re: SVG Icon - Quick hack
Hi Jacque,
Any experience with "lock size and position" and resizing for different devices? I've added a few groups to a card consisting of a graphic line, label and widget and to keep them from moving around decided to lock the size and position. Now I'm wondering if they will resize properly. I tried testing on the simulator but I've found the sim to be very finicky (so I avoid it). Today I got the message: Unable to start simulator: 634,0,0,unknown C++ exception 573,263,1,revIPhoneSetSimulartorSDK
Mark
Any experience with "lock size and position" and resizing for different devices? I've added a few groups to a card consisting of a graphic line, label and widget and to keep them from moving around decided to lock the size and position. Now I'm wondering if they will resize properly. I tried testing on the simulator but I've found the sim to be very finicky (so I avoid it). Today I got the message: Unable to start simulator: 634,0,0,unknown C++ exception 573,263,1,revIPhoneSetSimulartorSDK
Mark
macOS 12.6.5 (Monterey), Xcode 14.2, LC 10.0.0, iOS 15.6.1
Targets: Mac, iOS
Targets: Mac, iOS
-
- VIP Livecode Opensource Backer
- Posts: 7227
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: SVG Icon - Quick hack
I did it the easy (or easier) way. I used SVG Icon Tool to create an icon family and exported it as a file. Then I embedded the file in a custom property of the stack, and after the stack launches I do this:marksmithhfx wrote: ↑Sun Nov 01, 2020 6:21 pmCan anyone see why the following code would work in development, but not when compiled to Mac or iOS devices?
Code: Select all
addIconFamily "FPIcons",the cFPIcons of this stack
setCurrentIconFamily "FPIcons"
Last edited by jacque on Mon Nov 02, 2020 9:09 pm, edited 1 time in total.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
-
- VIP Livecode Opensource Backer
- Posts: 7227
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: SVG Icon - Quick hack
LockLoc only applies to manual resizing, it prevents changes using the mouse. (It also prevents auto-resizing when an image is redrawn on opencard, but that's something different.) It does not interfere at all with resizing by script, so it's safe to use for scripted changes.marksmithhfx wrote: ↑Mon Nov 02, 2020 11:37 amAny experience with "lock size and position" and resizing for different devices? I've added a few groups to a card consisting of a graphic line, label and widget and to keep them from moving around decided to lock the size and position. Now I'm wondering if they will resize properly. I tried testing on the simulator but I've found the sim to be very finicky (so I avoid it). Today I got the message: Unable to start simulator: 634,0,0,unknown C++ exception 573,263,1,revIPhoneSetSimulartorSDK
I'm not sure why you'd get a build error. It's important to have the chosen simulator fully launched and ready before trying to test though.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
-
- VIP Livecode Opensource Backer
- Posts: 931
- Joined: Thu Nov 13, 2008 6:48 am
- Location: London, UK
Re: SVG Icon - Quick hack
Check, I did that. I'll send this to the mothership and see if they can provide any insight.
Mark
macOS 12.6.5 (Monterey), Xcode 14.2, LC 10.0.0, iOS 15.6.1
Targets: Mac, iOS
Targets: Mac, iOS
-
- VIP Livecode Opensource Backer
- Posts: 931
- Joined: Thu Nov 13, 2008 6:48 am
- Location: London, UK
Re: SVG Icon - Quick hack
What about resizing due to fullscreenmode? Would that be affected?jacque wrote: ↑Mon Nov 02, 2020 9:06 pmLockLoc only applies to manual resizing, it prevents changes using the mouse. (It also prevents auto-resizing when an image is redrawn on opencard, but that's something different.) It does not interfere at all with resizing by script, so it's safe to use for scripted changes.
macOS 12.6.5 (Monterey), Xcode 14.2, LC 10.0.0, iOS 15.6.1
Targets: Mac, iOS
Targets: Mac, iOS
-
- VIP Livecode Opensource Backer
- Posts: 7227
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: SVG Icon - Quick hack
Nope, the limitation is strictly related to user mouse events. Everything else works normally.marksmithhfx wrote: ↑Wed Nov 04, 2020 11:19 amWhat about resizing due to fullscreenmode? Would that be affected?
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com