Link to home
Start Free TrialLog in
Avatar of tiger2000
tiger2000

asked on

How to change Character Set in my program

As Everyone know: in ASCII Chr(49) = '1', But now I want to change Character Set in my program. eg: Chr(49) equal a inverse '!'.
How can I do it?

Thanks in advance!

Regards
Tiger
Avatar of scrapdog
scrapdog
Flag of United States of America image

C-64 programmer?

You have to design a new font, that is the only way you can do it...
Avatar of sburck
sburck

Depending on where you want it changed, you have options, some more difficult than others.  If you need it changed overall, scrapdog's answer that building a font will do it is correct, but not the only answer.  If you just want it changed in edit boxes, you can catch the OnKeyDown and swap the keys in a table like this:

    keyswap : array[0..255] of char;

intialize keyswap with whatever inversions you want

Keyswap[0] := 0;
....
Keyswap[49] = '!';
....

and then in the OnKeyDown, take the Key variable and do

Key := KeySwap(Ord(Key));

and the keyboard will be swapped around in your edit box.

Output of strings and labels, etc. can be done in the same way.
 
Avatar of tiger2000

ASKER

thanks scrapdog and sburck.
But how can I make a font?
sburck's suggestion will just remap the keyboard, and I don't think that's what you want (i.e. the actual character set appearance won't be changed)

To make a font, you need to find a font editor.  I've never used a font editor, so I couldn't make any suggestions.

The way a font is stored is quite complex...it is not as easy as finding the ASCII offset and filling that area of memory with a series of bytes.

So using a third party font editor is probably your best choice.

There are two font editors for Windows that I know of, both run around $300-400.  One is Macromedia Fontography, and the other is Pyrus Fontastic.
Yes, as scrapdog said, I want to make a new Character Set. I'm developing SMS(Short Message System) frontend program. U know, There are many strange characters In mobile phone/SIM card.
So, another question: if I make a font, is it only one byte? That is, I don't want to use DBCS.
Could the font deal with it?
BTW, if can give u two the points, I want to give u 50 points both. But now I can give only one person...
Both editors support single and double byte chararcters.  However, if you want these fonts for an LCD display (like a mobile phone), usually the LCD displays have a 5x7 or 7x9 grid on which you can define your own characters, and these are not characters like the Windows Truetype characters, but bitmaps.

To split the points, you can put out two new 'questions',
'Points for scrapdog' and 'Points for sburck', and we can answer them.  After that, either delete this question or lower the points to zero and give one of use the zero points, so that the answers here stay on record.
ASKER CERTIFIED SOLUTION
Avatar of scrapdog
scrapdog
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Aha, scrapdog, now the points is yours!
Thank you!