Page 1 of 1

How to display these characters?

Posted: Sat Aug 07, 2010 12:56 am
by Caffeine
Hello, I'm trying to display the characters that can be seen on the website below within a string gadget.

http://www.alanwood.net/unicode/runic.html

Now, I've tried using Chr(5792) etc but nothing is showing up.

I've not coded for years, so forgive my stupidity on this. Can it be done? I know the actual string gadget is capable of displaying the characters because I can copy and paste them into it, I just can't write them in from my code.

I'm on Windows 7 by the way (Pure basic 4.*)

Any help would be greatly appreciated on this, thanks.

Re: How to display these characters?

Posted: Sat Aug 07, 2010 1:41 am
by IdeasVacuum
Hello Caffeine

Firstly, ensure you have fonts that support the specific Unicode characters you wish to use.

http://www.purebasic.fr/english/viewtop ... 13&t=42552

http://www.xs4all.nl/~bluez/purebasic/p ... #2_unicode

Re: How to display these characters?

Posted: Sat Aug 07, 2010 2:25 am
by Caffeine
Thanks for the quick reply. So if the user doesn't have a font capable of displaying these characters, they simply won't show up?

My intention is to have some words written in those runic characters (this would be within a String Gadget) that can then be copied to the clipboard to be pasted elsewhere, e.g a text editor.

I was hoping it would have been a simple solution, but I'm now starting to think that isn't going to be the case :roll:

Re: How to display these characters?

Posted: Sat Aug 07, 2010 3:49 am
by IdeasVacuum
Without the font, the string will look something like this: ????????

If a User is to copy and paste into another app, that app must of course be designed to support Unicode too.

Re: How to display these characters?

Posted: Sat Aug 07, 2010 1:22 pm
by Caffeine
Hi and thanks again for the input. Ok having slept on it I have now gone back to the very basics.

I have installed a font that uses the runic character set. I have set up a window with a String Gadget that uses the installed font. Now if I copy this character ᚠ from the site in the link in the first post, and paste it into my string gadget, it displays. So I know all that works. So it has to be something to do with the way I am trying to generate the character from within my code?

Even if I try SetClipboardText (Chr(5792)) it simply displays a "space" with no character when I paste. Or if I set my gadget text like the following, it displays a space rather than the character.

Global Runetxt$ = Chr(5792)

SetGadgetText(#string_1, Runetxt$)

Any further ideas on this? am I on the right track?

Thanks again for all your help.

Re: How to display these characters?

Posted: Sat Aug 07, 2010 1:56 pm
by freak
> Global Runetxt$ = Chr(5792)

If you select "File -> File format -> Encoding: Utf8", this should work.

This is a limitation of the compiler. It can only handle literal unicode characters if the file is UTF8. The expression "Chr(<fixed number>)" is treated as a literal character too, this is why it is affected as well.

Re: How to display these characters?

Posted: Sat Aug 07, 2010 4:48 pm
by Caffeine
Thank you so much, it works ᚠ

You're a star, thanks! :D

Re: How to display these characters?

Posted: Sat Aug 07, 2010 4:53 pm
by Caffeine
One last question. Will I need "Create unicode executable" checked when I create the exe?

Re: How to display these characters?

Posted: Sat Aug 07, 2010 4:59 pm
by Trond
Yes.