Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Contributor
Posts: 12
Registered: ‎07-31-2012
My Device: OS 5.0 and 8520
My Carrier: Airtel

Re: Display hindi characters in blackberry os 5.0 application

This reference is already been checked. I think font is installed. When I display english characters, font converts them to hindi, but it is not able to display hindi/unicode characters in hindi.

 

Regards,

Raghav

Developer
Posts: 434
Registered: ‎07-23-2012
My Device: Blackberry 10
My Carrier: Orange

Re: Display hindi characters in blackberry os 5.0 application

ok 

Thanks
-------------------------------------------------------------------------------------
Press the Accept as solution Button when u got the Solution
Press Kudo to say thank to developer.
-------------------------------------------------------------------------------------.
Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: Display hindi characters in blackberry os 5.0 application

Contributor
Posts: 12
Registered: ‎07-31-2012
My Device: OS 5.0 and 8520
My Carrier: Airtel

Re: Display hindi characters in blackberry os 5.0 application

no conclusion yet, even above mentioned thread is not solved.

 

Thanks and Regards,

Raghav

Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: Display Hindi characters in blackberry os 5.0 application

I know, but it does document how I would expect this to work.  Thought it might help.

 

The trick here is that a text string must be a Unicode representation of Hindi and the font must convert the associated Hindi Unicode characters to glyphs.  of course it also has to be a TrueType Font and it has to match the Blackberry size requirements. 

 

In my experience, the font only needs to cover the Hindi characters, and the BlackBerry will use it if it doesn't find a match for the characters in any other font.  You could have the Font cover the Hindi and the other characters your application wants to use, but I don't think it has too. 

 

There is a potentially related problem if you are using SQL for the data.  In some earlier OS levels, the SQL Unicode characters get converted to Latin-1 when you ask for the String.  So it looks like the characters are not being displayed correctly.  In fact the characters are not correct from SQL. 

 

Anyway, this is an area that I think should work, happy to try to help get it working.

 

Do you have a Hindi TTF font?

Contributor
Posts: 12
Registered: ‎07-31-2012
My Device: OS 5.0 and 8520
My Carrier: Airtel

Re: Display Hindi characters in blackberry os 5.0 application

First of all thanks for the details.

 

I have used many hindi font files subject to size of 60 kb but none of them worked yet.

Data is coming from server, we are not using sql. Server is sending unicode representation of hindi characters, and we have to print these unicode characters in hindi in our fields.

 

The font files are printing english text to hindi, but they are not printing unicode characters to their respective hindi characters.

 

Thanks and Regards,

Raghav 

Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: Display Hindi characters in blackberry os 5.0 application

"Data is coming from server"

 

Data sent from the Server and not converted correctly is another surce of errors that look like font errors.  The data should be sent as UTF-8 and you must convert the bytes corrrectly,.  If you do

 

String textString = new String(<bytes>);

 

This will not work correctly, you need to include the "UITF-8" encoding as follows:

 

String textString = new String(<bytes>, "UTF-8");

 

Can you check your code to make sure you are doing this correctly?

 

If this all looks OK, then I would like to take a look.  .

 

Can you please attach a Hindi TTF font and some Unicode Hindi characters - which you want to display.  If you could give me these characters as Java code like the following

 

String hindiText = "\u....\u....";

where the \u is the Undocde fro the hindo characters. 

Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: Display Hindi characters in blackberry os 5.0 application

[ Edited ]

OP has supplied me with a test string and a set of fonts to try.  Here is the answer.

 

I have not actually tried any of the fonts supplied becuase I beleive they will all fail. 

 

I downloaded FontForge from here:

http://fontforge.sourceforge.net/

and used it to display the mapping used by the Fonts.

 

All the fonts supplied do not use the Unicode character set.  Instead they replace the standard Latin characters with other glyphs.  The could be used to display Hindi, but woud require tranlation of the Hindi character to the Latin character that is then displayed corectly using the Fonts.  I would not recommend this approach.

 

You need to have a real TrueType Font that includes the Hindi characters in the corerct place.  As an example, there is one avialable for download here:

http://www.bharatdarshan.co.nz/hindi_font_downloads.html

 

The font above is too big to be used in BlackBerry, but perhaps you can edit it use FontForge (I would remove the non Hindi characters). 

 

In short, the problem here is the Font.  If you have a correct Font you should be able to display Hindi characters in OS 5.0. 

 

Edit:

 

Looking at this link:

http://bbindia.net/blog/2011/09/07/how-to-install-hindi-fonts-on-blackberry/

 

I see there is reference to fonts available here:

http://kde-look.org/content/download.php?content=17720&id=1&tan=57685087

 

I have attached the file downloaded, repackaged in a zip file since this forum does not seem to like tar files.  It seems to contain 4 valid TTF fonts with the correct Unicode mappings which are small enough to be used on BlackBerry.  I believe this is available under the GPL license, but please confirm this and make sure you are approriately licensed before using these fonts.  At the very least, these might be useful for testing. 

 

Contributor
Posts: 12
Registered: ‎07-31-2012
My Device: OS 5.0 and 8520
My Carrier: Airtel

Re: Display Hindi characters in blackberry os 5.0 application

Excellent Work.

 

Thanks and Regards,

Raghav Simlote

Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: Display Hindi characters in blackberry os 5.0 application

I presume that you are going to test what I have said.

 

I have NOT tested Hindi, I have just demonstrated to my satisfaction why the fonts you have tried previously do not work. 

 

I would try the fonts supplied and see if, using them, you can get something working.  Please come back to us on this Thread with the answer. 

 

Thanks