East Asia input/output challenges

Blitz3D Forums/Blitz3D Userlibs/East Asia input/output challenges

tumi(Posted 2005) [#1]
I posted a couple of threads in the Blitz3D beginner and programming forum and so far I have yet found a solution for this. Anyway, I am looking for any advice from you bright folks who can write user lib with ease to help me figure out a way to add the following functionality to Blitz3D, so I can settle it as my upcoming project platform.

1. A text box gadget for user to input East Asia characters (Korean, Japanese and Chinese etc). This gadget should not stop Blitz3D from rendering/updating.
2. An output text box to show East Asia character strings.
3. A new data type or using Bank memory so I can store these East Asia characters/strings and able to display them with the Blitz3D 2D coordinates (like putting up a billboard on top of a NPC to show its name).
4. A new data type or using Bank memory so I can store these East Asia characters/strings and able to reference them so I can send them in the TCP output stream.

There is a way in VB6 to accept 2 byte characters in a text box, I was wondering if the DC of the form containing that text box can be passed back to Blitz, and the graphical area of that text box stored in the DC can then be retrieved and poke into the Memory bank or something….this is just a thought, there might be other ways that I don’t know about.

Blitz support told me these are not high in their working priority. If you think you might be able to help me on these but would like to be compensated, please contact me through my yahoo email with your work estimate, we can work something out if your estimate is within my budget. Thanks in advance.

P.S I will be out of town from 11/3 to 11/28. Please expect some delay if you were to write me email during that period, since I have limited access to the Internet before I am back in the office, thanks again.


jfk EO-11110(Posted 2005) [#2]
NOt sure about the input and output code, but probably you should try to get unicode working. BlitzMax seems to support it AFAIK, at least to some degree. Read here:
http://www.blitzbasic.com/Community/posts.php?topic=46978

Not sure how to implement unicode for BLitz3D with userlibs.

You still could create your howgrown system that would act as a input vector and use Bitmap fonts. All you need to know is the ASCII definition of the language set.

So you only have to read the input, store it in plain ascii in a bank, but whenever it comes to screen output, you'd use the bitmaps of the active language font bitmaps set. Like

Dim ascimg(255)
;read in the 255 chinese characters
...
k=getkey()
if k<>0
inp$=inp$+chr$(k)
endif

and to "write" a string you'd do something like:
x=0
for i=0 to len(inp$)-1
k=asc(mid$(inp$,i+1,1))
drawimage ascimg(k),x,y
x=x+imagewidth(ascimg(k))
next

Of course, a complete Textarea gadget may be abit more complicated, with all exceptional input handling (del, backspace, return...), but it isn't much more compilcated than when you do this ith the TEXT command.

You even may simplyfy the whole process by creating a pseudo Text function that replaces the BLitz TEXT command with full compatibility, but uses chinese (or whatever) bitmaps internally. In this case all you'd have to do was to implement this new TEXT function in an existing Gui Library, taken from the code archives etc.

It's a lot of work, more than clicking a gui together in VB, but at least there's nothing that can stop you to complete it.


jfk EO-11110(Posted 2005) [#3]
Sidenote: I just realized chinese script is using single characters for entire words AFAIK, so I have no idea how you would emulate som ekind of alphabet. But after all it doesn't matter since the chinese keyboard has keys too and all you have to do is redirect the keys to the right bitmaps.


tumi(Posted 2005) [#4]
Thank you jfk. I will try to learn how to construct/use the bitmapped fonts as you suggested. I was browsing the irrlicht forum this past weekend and saw some folks there using FreeType project (www.freetype.org) as their base to construct unicode input and output methods. It took 2 bytes to construct a Chinese/Korean/Japanese character so I am not sure one ascii table will do or the size needs to be tweaked. If you find anything that may help me in this endavour, please let me know. thanks again!!

P.S I turely wish BMax will support uni-coded I/O but BMax can only do 2D so it is not going to help my project.

Your CSP FPS scenes are sooo nice, btw.


jfk EO-11110(Posted 2005) [#5]
Thanks

Well unicode follows a diffrent philosophy, since it allows 65535 characters, it covers a lot of languages/scripts in one "font". Then again all keyboards (that I know) use one byte codes for their keypresses, although there may be combinations, eg. shift, ctrl etc. After all it's only keypresses and when you know the eg. chinese keyboard layout, it should be easy to redirect the keypresses to a bitmapbased text system. I think the hardest part is to determine the users keyboard language, maybe that's a job for a userlib.


tumi(Posted 2005) [#6]
In fact CJK uses unicode to support Chinese, Japanese and Korean. Per reading on the freetype org. If I can pass a string to it's library (a wide char string) then it will generate a mono bitmap based on the designated font as a return. So I wonder if it is possible to pass a wide character string to an outside DLL and receive a pointer to the generated bitmap and display it in Blitz3D somehow...

"I think the hardest part is to determine the users keyboard language, maybe that's a job for a userlib" well if I use straight unicode then this shouldn't be an issue, isn't it?


jfk EO-11110(Posted 2005) [#7]
You still need to be able to read the keyboard in a way that will tell you what unicode key was pressed. I have no idea how this should work.

But I'm pretty sure it's easy to get some system information about the active language settings. like the dos command "keyb"
So calling "command keyb >lng_info.txt"
would write the country code of the keyboard to the file c:\lng_info.txt

Tho this is a very primitive way to do this.

If you once got the unicode of the pressed key, it should be possible to ise the DLL as you described it. Passing a string to a DLL is possible, and moving some bitmap data from a physical adress to a blitz bank is also possible.
Nevertheless, interpreting the bitmaps may be a fair amount of work.