aspose file tools*
The moose likes Java Micro Edition and the fly likes How to have characters which the phone doesn't support Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Mobile » Java Micro Edition
Bookmark "How to have characters which the phone doesn Watch "How to have characters which the phone doesn New topic
Author

How to have characters which the phone doesn't support

Ransika deSilva
Ranch Hand

Joined: Feb 18, 2003
Posts: 524
Hi all,
I have done research on having non-english characters ex:tamil, theligu etc in the MIDlets, and found out one way is to have an image (.png) with all characters and use that image to render the characters on the display. But, figured out that for a language which has 200+ characters, this technique is not very efficient. Hence I am just curisous to know whether there are any more ways of doing it in a more efficient manner. Thanks alot and expecting your views on this.


SCJP 1.4, SCMAD 1.0<br />SCWCD, SCBCD (in progress)
mahmoud zaki
Greenhorn

Joined: Dec 31, 2006
Posts: 2
why you donot try svg tiny fonts
Ransika deSilva
Ranch Hand

Joined: Feb 18, 2003
Posts: 524
Hi,
I went through the site, but I am not able to get the clear picture of it. Could you please explain what SVG fonts are and whether it is possible to have characters like Tamil, Hindi or Theligu with SVG?. If yes, how I can proceed with it? Thanks a lot and anticipating a response. Regards.
Eduardo Marques
Ranch Hand

Joined: Feb 19, 2005
Posts: 231
For SVG tiny fonts look at

http://developers.sun.com/techtopics/mobility/midp/articles/s2dvg/index.html

Two notes though:
- I don't know how it addresses multi-lingual issues;
- The phone must support JSR 226;
[ January 14, 2007: Message edited by: Eduardo Marques ]

Eduardo Marques
Get ready for your SCMAD certification at J2MECertificate.com - See what all the buzz is about ...
HaoZhe Xu
Ranch Hand

Joined: Nov 03, 2003
Posts: 222
Not sure what SVG is, but I have an approach that you can consider.

Many years ago when I was a year 6 student, most games are using DOS, so displaying characters became an issue, especially for those languages have a lot of characters, such like Chinese. The most popular approach at that time, is to use pixel-font. A data file contains all pixel information of 65000+ Chinese characters is around 200KB.

For example, a character like 'F' may have the following pixel data:

0 0 0 0 0 0 0 0
0 1 1 1 1 1 0 0
0 1 0 0 0 0 0 0
0 1 0 0 0 0 0 0
0 1 1 1 1 0 0 0
0 1 0 0 0 0 0 0
0 1 0 0 0 0 0 0
0 1 0 0 0 0 0 0

when you are drawing pixels, only draw 1s, ignore 0s.
convert it to bytes:
0x00
0x7C
0x40
0x40
0x78
0x40
0x40
0x40
that is, 8 bytes for a character, for a language has 1000 characters, it's 8000 bytes(< 8KB) and when it is stored in a jar file, it is compressed to less.

Also, it's not common for a MIDlet to run on a handset that does not support it's characters, many phones have several languages support, I mean, even if the phone cannot input characters in that language, the phone may be able to display characters in the language.

I just finished an MIDlet, it support both English and Chinese, it works nicely on my 6230 phone(ie my phone can display Chinese), although my phone cannot input Chinese.

my midlet: http://www.olnex.net/prj/bluebuddy/bb_en.html


[url]Olnex.net[/url]
[SCJP 1.2, SCJD, SCWCD]
Ransika deSilva
Ranch Hand

Joined: Feb 18, 2003
Posts: 524
Hi,
Many thanks for the reply. Could you tell me what I have in mind is correct or not? ok here we go.. First I have to digitize the characters. Meaning I have to get each character represented in 8*8 grid and use the 1s and 0s and draw only the 1s on the screen? What is the method that I can use to draw the pixels? Will this work to a language which has very curvy characters? Would appreciate if you can confirm the idea that I have. Thanks a lot..
HaoZhe Xu
Ranch Hand

Joined: Nov 03, 2003
Posts: 222
I think your mind is correct, but I wonder how you digitise all those characters and convert them to pixel-data.

Drawing pixel in J2ME is a bit hard without platform-dependent packages, but I guess you can use drawLine in Graphics:


that is, draw a pixel at (2, 3) (if it's not correct, please tell me)

I have a way to get pixel-data, if you are familiar with a language that have graphics functions can retrieve pixel data in a bitmap, you can do the followings:
1. Write a program displays all characters you need in a bitmap(may not display them all at one time).
2. Write this program on a platform that CAN display those characters.
3. Then, retrieve the pixels and store them in a datafile.

sample code may look like:


it's only suitable for small character set, but I guess there are some utilities to perform several operations on font. Not sure if this has those functions: http://members.allegro.cc/miran/fonted.html
Ransika deSilva
Ranch Hand

Joined: Feb 18, 2003
Posts: 524
Hi many thanks ones again for the info, but I guess I have to do a bit more research. It is not very straight forward as it sounds. I will update the progress in the future. Regards...
 
jQuery in Action, 2nd edition
 
subject: How to have characters which the phone doesn't support