any plans to using 16bits character ? - General Discussion and Assistance - CHDK Forum

any plans to using 16bits character ?

  • 4 Replies
any plans to using 16bits character ?
« on: 22 / April / 2009, 03:41:00 »
so it can support CJK ?

use UTF-8 in lang file and use 16bits unicode for draw_char(), like ucgui.
fonts will be loaded only when necessary(with cache in RAM?) as there's no enough memory to store all the fonts.

Re: any plans to using 16bits character ?
« Reply #1 on: 23 / April / 2009, 21:07:02 »
UTF-8 uses up to three bytes per char, depending on the subset.
For ascii codes < 0x7F it uses one byte, so for english only, the language file won't increase a lot.
The problem is fonts will increase in size a lot and depending on implementation may use a lot of memory,

Re: any plans to using 16bits character ?
« Reply #2 on: 24 / April / 2009, 12:52:05 »
I have done it.

i removed the old rbf font support, and add a private format.
in the font file, there's an index area and data area.
the index area will be in RAM when font file loaded, and the data will be load from SD card when used.
I also added the font data cache in RAM.

the speed is the same as built-in font, i cannot find any delay.

the lng file is UTF-8 encoding. the font file is 16bits unicode.

i'll share it after I clean the codes.


Offline PhyrePhoX

  • *****
  • 2254
  • make RAW not WAR
    • PhyreWorX
Re: any plans to using 16bits character ?
« Reply #3 on: 25 / April / 2009, 14:51:04 »
interesting. if it works like you say, this would make a nice addition to chdk, so chdk can be translated to more languages.

Re: any plans to using 16bits character ?
« Reply #4 on: 27 / April / 2009, 10:53:27 »
I'm so happy that you have interest in it.

I have put the codes at
and also a simple document is available at

I deleted the rbf font file support, and use utf-8 encoding lng file.(but still use the "menu RBF font..." to load the new font file)
so, it can support multi-language well if the font file have the font data in lng file.

you can download the binary from
and also, you can use simsun.DAT as font file for test. it contain about 22K characters. not only english and chinese.

now menu/mbox/text reader used the external font, but games and other modules still use draw_string() which used built-in fonts only. I'll clean it these days.

I really appreciate for anyone's feedback and suggestions.


Related Topics