Playing card symbols

Deploying to Mac OS? Ask Mac OS specific questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
dsquance
Posts: 40
Joined: Mon Jan 18, 2010 2:47 am

Playing card symbols

Post by dsquance » Mon May 27, 2013 7:22 pm

I've been using Symbol,Unicode font for playing card symbols while developing on a Mac, and when this is viewed on a Windows machine, the symbols don't appear. What should be used instead so that they appear in either platform?

Dave
OS 10.6.8
LC 4.5.3

dsquance
Posts: 40
Joined: Mon Jan 18, 2010 2:47 am

Re: Playing card symbols

Post by dsquance » Mon May 27, 2013 8:42 pm

I should add that I'd like the symbols to appear both as button labels and in fields. The button labels could be dealt with as icons from image files, but if there's a font substitution which would work, that would be simpler.

Dave

icouto
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 92
Joined: Wed May 29, 2013 1:54 am
Location: Sydney, Australia

Re: Playing card symbols

Post by icouto » Wed May 29, 2013 2:35 am

Does LiveCode 4.5.3 have the htmlText property?

In HTML there are entity references that you can use to display the playing card symbols. These are:

Code: Select all

- Hearts Symbol: ♥
- Diamonds Symbol: ♦
- Spades Symbol: ♠
- Clubs Symbol: ♣
You can display these by setting the htmlText property of the control where you want the symbol to appear - like this:

Code: Select all

set the htmlText of field "testField" to "♣"
This will put the 'clubs' symbol inside field "testField". There is no need to set the field's font, either: LiveCode knows that it needs to display the 'clubs' symbol, and it will pick an appropriate font from the user's system that can display it.

I hope this helps!

dsquance
Posts: 40
Joined: Mon Jan 18, 2010 2:47 am

Re: Playing card symbols

Post by dsquance » Wed May 29, 2013 7:06 am

Thank you for the reply. I will try that out.

Dave

dsquance
Posts: 40
Joined: Mon Jan 18, 2010 2:47 am

Re: Playing card symbols

Post by dsquance » Wed May 29, 2013 6:37 pm

I tried the suggestion, but it did not work for me. I just get the expression in the field, eg. ♣, etc.

Thanks, anyhow.
Dave

dsquance
Posts: 40
Joined: Mon Jan 18, 2010 2:47 am

Re: Playing card symbols

Post by dsquance » Wed May 29, 2013 7:08 pm

Further to this, I found that working backwards with the symbols in fields using the Symbol font, the htmlText of the fields were: <p>&#153;</p><p>&copy;</p><p>&reg;</p><p>&szlig;</p>. These are, in order, spades, hearts, diamonds and clubs. If the font is not specified in the field, the proper symbol does not appear. I can get the symbols to appear by using numtochar with one of 167 to 170, and this works on a friend's PC, also. But when he opened the little test app the first time, the symbols which were already in the fields appeared as squares. I'm wondering if some code in an openstack handler could preset the font for the fields where needed.

Dave

icouto
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 92
Joined: Wed May 29, 2013 1:54 am
Location: Sydney, Australia

Re: Playing card symbols

Post by icouto » Thu May 30, 2013 1:40 am

Sorry to hear that the html entities are not working for you! :(

Incidentally: &copy; is the html entity for the copyright symbol (©). Also, &reg; is the html entity for the registered trademark symbol (®), and &szlig; is the entity for the german "ß".

I wonder if this is a problem with your (older) version of LiveCode. Are you not able to use version 6 in this project? - it works with that. At my end, with version 6.0.1 of LiveCode:

1) create a new mainstack
2) add a new field, and name it "output"
3) add a new button, with the following script:

Code: Select all

on mouseUp
   set the htmlText of field "output" to "&spades; &clubs; &hearts; &diams;"
end mouseUp
4) click the button

The field displays: ♠ ♣ ♥ ♦

dsquance
Posts: 40
Joined: Mon Jan 18, 2010 2:47 am

Re: Playing card symbols

Post by dsquance » Thu May 30, 2013 2:38 am

Perhaps there is a difference with this older version. However, as a hobbyist pensioner, I'm not about to spend the money to upgrade. It does what I want at this point (usually).

With your code and no font specified for the field, I just get the same thing over: &spades; &hearts; etc. If I specify the font to be Symbol, I get the same thing in Greek letters.

However, if I use: set the htmlText of field "output" to "&copy; &reg; &szlig; &#153;"
and specify the font as Symbol, then I get the suit symbols.

Using the ASCII codes 167 to 170 I think will work, but I haven't heard back from my tester yet. I need a Windows machine here, too.

Thanks, anyhow.
Dave

icouto
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 92
Joined: Wed May 29, 2013 1:54 am
Location: Sydney, Australia

Re: Playing card symbols

Post by icouto » Thu May 30, 2013 6:36 am

Perhaps there is a difference with this older version. However, as a hobbyist pensioner, I'm not about to spend the money to upgrade. It does what I want at this point (usually).
As you probably already know, the latest version of LiveCode has been released as Open Source. That means that you can download it, and use it, for free. You can even develop commercial software with it, if you want - provided your software is not closed-source.

You would only need to spend money if you needed to purchase a commercial license for LiveCode. The commercial license would enable you to sell your apps on the Apple App Store, and release your software commercially as closed-source.

But for every other use - specially for "hobbyist pensioners" - the free, Community edition is the way to go! No need to spend any money! :)

Post Reply

Return to “Mac OS”