|
register_uformat() |
dawei chen
Member #2,985
December 2002
|
hello, i am using chinese. thank you. |
miran
Member #2,407
June 2002
|
Personally I never used this but as far as I can understand the documentation it's not easy. What you have to do is this: 1. implement all the character handling functions like u_getc(), u_setc(), u_width(), etc.:
You can choose whatever names for your functions of course. Look at the Unicode handlers in Allegro to see what exactly these functions do and how they work. 2. register your character handling functions with the register_uformat() function before initializing Allegro: #define U_CHINESE AL_ID('C','H','N','S') register_uformat(U_CHINESE, chinese_getc, chinese_getx, chinese_setc, chinese_width, chinese_cwidth, chinese_isok); Again you can choose whatever ID you want, as long as it's not being used by something else (in this example I use CHNS for the ID and U_CHINESE for the define). 3. make Allegro use you character handlers by calling the set_uformat() function before initializing Allegro itself: set_uformat(U_CHINESE); 4. use the Allegro Unicode text functions for manipulating strings, converting all ASCII strings to your format with the uconvert() function passing it U_CHINESE as the type parameter. EDIT: -- |
dawei chen
Member #2,985
December 2002
|
thank you,i will try. but if i want to display characters with WINAPI i am using the following code,but can not get #include <allegro.h> BITMAP *bmp01; int main() bmp01=create_bitmap(640,480); blit(bmp01,screen,0,0,0,0,640,480); while(! key[KEY_ESC]) END_OF_MAIN(); |
miran
Member #2,407
June 2002
|
I don't know much about WINAPI but I'm quite certain that TextOut() from WINAPI and textout() from Allegro (and the entire text API in Allegro for that matter) have absolutely nothing in common. So adding a driver for your character encoding scheme like I suggested in my first post won't help you with outputting text in WINAPI one bit. To do what you're trying to do you will have to look into WINAPI itself. I'm sure there are extensions/libraries that do exactly what you want... -- |
dawei chen
Member #2,985
December 2002
|
thank you very much.:) |
|