using icons in Livecode

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

glenn9
Posts: 234
Joined: Wed Jan 15, 2020 10:45 pm

using icons in Livecode

Post by glenn9 » Thu Apr 16, 2020 9:22 pm

Hi Everyone,

I guess this is a long shot as its fairly niche, but I was wondering if anyone had any experience in making use of Segoe MDL2 icons in Livecode that they could share? https://docs.microsoft.com/en-us/window ... d-articles

I've been trying to figure out how to use them in livecode as icons but no success so far, even though Segoe MDL2 is listed as a font in Livecode.

i've tried pasting individual icons into the 'content' of a button but this doesn't work as expected or very well.

I can't see a way of entering the icons via the keyboard, even though they have been designed as a font.

Grateful for any hints or tips!

Kind regards,

Glenn

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10099
Joined: Fri Feb 19, 2010 10:17 am

Re: using icons in Livecode

Post by richmond62 » Thu Apr 16, 2020 9:28 pm

You could do this in a very simple way.

Use the font to make JPG or PNG images of individual glyphs and then put them through an icon-making app.

glenn9
Posts: 234
Joined: Wed Jan 15, 2020 10:45 pm

Re: using icons in Livecode

Post by glenn9 » Thu Apr 16, 2020 10:01 pm

Thanks for the tip, I'll give this a try.

I'm assuming that its not going to be possible to use the font as an 'icon' but this may be a good workaround.

Kind regards,

Glenn

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

Re: using icons in Livecode

Post by bogs » Thu Apr 16, 2020 10:06 pm

Heya Glenn,

I don't have that font installed on any of my machines, however hopefully this will match what you want to do closely enough.
aPic_segoeMe.png
Me-segoe you-segoe...
So, if you haven't already guessed how I did this :wink:
Open the windows Character Map utility (type Chara... into the search box)
Find the font you need the character from
Select / copy it in the char map util.
Go to the button (or whatevers) label property in the inspector
Use either the edit menu on the menubar, or ctrl + v to paste what you copied into the label
....?....
PROFIT!!
Image

glenn9
Posts: 234
Joined: Wed Jan 15, 2020 10:45 pm

Re: using icons in Livecode

Post by glenn9 » Thu Apr 16, 2020 10:36 pm

Thank you so much, that worked brilliantly!

I hadn't appreciated that the character map worked outside of MS word or to use 'label' instead of 'content'!

Thank you again,

Kind regards,

Glenn

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

Re: using icons in Livecode

Post by bogs » Thu Apr 16, 2020 10:54 pm

I'm glad it helped, I should add there are a few other ways to do this. For instance, set the buttons 'font' to (whatever), and (in code) set the label of button xyz to numToChar(number of the character).

All roads lead to Rome after all ;)
Image

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10099
Joined: Fri Feb 19, 2010 10:17 am

Re: using icons in Livecode

Post by richmond62 » Fri Apr 17, 2020 8:51 am

bogs wrote:
Thu Apr 16, 2020 10:54 pm
I'm glad it helped, I should add there are a few other ways to do this. For instance, set the buttons 'font' to (whatever), and (in code) set the label of button xyz to numToChar(number of the character).

All roads lead to Rome after all ;)
A word of warning . . .

. . . if you set the label of your button to a glyph reference be careful to use numToCodePoint and NOT numToChar (deprecated some way back),

and, also, be aware that to get that effect if you run off a standalone you must make sure end-users have the font installed on their systems.

To get round this problem . . .

position your glyph from your font slap-bag-central in a field, import a snapshot of the field and use that as your button:
-
Screenshot 2020-04-17 at 10.49.45.png
Screenshot 2020-04-17 at 10.49.45.png (9 KiB) Viewed 8247 times

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: using icons in Livecode

Post by jmburnod » Fri Apr 17, 2020 10:01 am

Hi,
You may import a snapshot from a group.
I use this to create/modify icons collection.
One group for icon, one group for iconhilte (or others) with relevant names (grOpen,grOpenHi etc...)
It is easy to modify whole collection with onlyone script
Best regards
Jean-Marc
https://alternatic.ch

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

Re: using icons in Livecode

Post by bogs » Fri Apr 17, 2020 10:23 am

richmond62 wrote:
Fri Apr 17, 2020 8:51 am
A word of warning . . .
. . . if you set the label of your button to a glyph reference be careful to use numToCodePoint and NOT numToChar (deprecated some way back),
Glenn, please forgive my ignorance hee hee :P
Image

glenn9
Posts: 234
Joined: Wed Jan 15, 2020 10:45 pm

Re: using icons in Livecode

Post by glenn9 » Sat Apr 18, 2020 3:41 pm

richmond62 wrote:
Fri Apr 17, 2020 8:51 am
bogs wrote:
Thu Apr 16, 2020 10:54 pm
I'm glad it helped, I should add there are a few other ways to do this. For instance, set the buttons 'font' to (whatever), and (in code) set the label of button xyz to numToChar(number of the character).

All roads lead to Rome after all ;)
A word of warning . . .

. . . if you set the label of your button to a glyph reference be careful to use numToCodePoint and NOT numToChar (deprecated some way back),

and, also, be aware that to get that effect if you run off a standalone you must make sure end-users have the font installed on their systems.

To get round this problem . . .

position your glyph from your font slap-bag-central in a field, import a snapshot of the field and use that as your button:
-
Screenshot 2020-04-17 at 10.49.45.png
Thank you, that's really helpful to know.

Indeed, before I'd read your post I tried the icons on mobile, where the font is not installed of course, and I got unexpected looking icons!!!

Kind regards,

Glenn

glenn9
Posts: 234
Joined: Wed Jan 15, 2020 10:45 pm

Re: using icons in Livecode

Post by glenn9 » Sat Apr 18, 2020 3:42 pm

bogs wrote:
Fri Apr 17, 2020 10:23 am
richmond62 wrote:
Fri Apr 17, 2020 8:51 am
A word of warning . . .
. . . if you set the label of your button to a glyph reference be careful to use numToCodePoint and NOT numToChar (deprecated some way back),
Glenn, please forgive my ignorance hee hee :P
My ignorance is much greater though - as I'm finding out!!

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10099
Joined: Fri Feb 19, 2010 10:17 am

Re: using icons in Livecode

Post by richmond62 » Sun Apr 19, 2020 11:12 am

By the way: having "had a poke" at Microsoft's "Segoe MDL2" font
I found that the glyphs are contained in the Unicode Private Use Area
so if you are planning to use it as a font inwith something you are intending to
distribute you are going to be seriously "in the sh*t" if you do not distribute the font
along with your work.

Glyphs in the Unicode Private Use Area can be any old thing anyone wants, so there
is no standardisation, nothing; and if you fail to provide the font along with a stack/standalone that
leverages a font that contains glyphs in the Unicode Private Use Area you cannot expect
anything like adequate substitution.

Also be aware of the weasel licence re the Segoe MDL2 font:

"You may use the Segoe MDL2 Assets and Segoe UI fonts or glyphs included in this file (“Software”) solely to design,
develop and test your programs that run on a Microsoft Platform"

emphasis mine.

Having said that, you can download the fonts onto any old computer running any old system . . . your morality may vary. 8)

Personally I'd just use one of the vast number of Open Source and/or free symbol fonts available on the interweb: anything to avoid
crawling into bed with something involving restrictions.
Last edited by richmond62 on Sun Apr 19, 2020 12:31 pm, edited 1 time in total.

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10099
Joined: Fri Feb 19, 2010 10:17 am

Re: using icons in Livecode

Post by richmond62 » Sun Apr 19, 2020 12:06 pm

Screenshot 2020-04-19 at 14.05.03.png
-
Stack removed as better version uploaded.
Last edited by richmond62 on Mon Apr 20, 2020 9:54 am, edited 1 time in total.

glenn9
Posts: 234
Joined: Wed Jan 15, 2020 10:45 pm

Re: using icons in Livecode

Post by glenn9 » Mon Apr 20, 2020 7:47 am

richmond62 wrote:
Sun Apr 19, 2020 12:06 pm
Screenshot 2020-04-19 at 14.05.03.png
Thanks for this advice Richmond62, have now abandoned the concept of using Segoe MDL2 fonts for icons!

Have just downloaded 'Pimp My Button' - not sure exactly what it does at the moment but I'll experiment...!

Thanks again,

Kind regards,

Glenn

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10099
Joined: Fri Feb 19, 2010 10:17 am

Re: using icons in Livecode

Post by richmond62 » Mon Apr 20, 2020 8:17 am

Enter the Unicode address of the glyph that you want via either the DECIMAL or the HEXADECIMAL button,
then set the colours of the border, the background and the character for your new button and click
EXPORT BUTTON and you will end up with an image you can use as a button that is NOT font dependent.

Post Reply