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: 21
Registered: ‎12-30-2010
My Device: Not Specified
Accepted Solution

Mixing multiple languages in one application

[ Edited ]

Hi,

 

I'm trying to port my application to BlackBerry, but I'm having difficulty with fonts. The application mixes a number of different languages together in the same UI, for example, a list of languages written in the particular language, but only one language per field. A number of languages appear as black filled boxes, which I understand from other posts that this means that the font doesn't exist on the device for those characters.

 

I could supply the fonts (presumably by packaging them with my app, then loading with FontManager.load()), but since I have a large number of languages, they would violate the 60 KB limit described in the API.

 

I apologize for the open ended question, but what is my best approach? Is this even possible? If not, is there a base set of languages that can be displayed on all devices?

 

For now, I'm okay restricting myself to API 6, but ideally, I would like to support devices back to API 5.

 

Thanks,

 

Garret

Highlighted
Developer
Posts: 114
Registered: ‎04-28-2010
My Device: Storm 9530
My Carrier: Telus

Re: Mixing multiple languages in one application

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

Re: Mixing multiple languages in one application

This might help when testing.

 

http://supportforums.blackberry.com/t5/Java-Development/Font-Loader-Manager-Utility/m-p/592647

 

If you have a different font per Field, then each font has the 60 or 90 KB limits.

 

Also, I have found that the Blackberry will do what I think is a clever thing.  If you have loaded a System font, and the character is not defined in the Font that is used for Field, the BB will actually search the System fonts looking for one that contains this character.  So you might find the only characters you have to put in the special font are the characters that are missing from the standard fonts.

Contributor
Posts: 21
Registered: ‎12-30-2010
My Device: Not Specified

Re: Mixing multiple languages in one application

Thanks for the replies.

 

Peter, you have a good point that I can split the fonts into multiple files - my problem was that some fonts were too large. My solution has been to manually edit the font files (using FontForge) to remove characters and get the font file under the 60 KB limit.

 

I've since found font-optimizer which promised to be a more automated way to remove characters. I only hope that I can get logographic scripts such as Japanese and Chinese sufficiently reduced.

 

You mentioned a 90 KB limit. I didn't see mention of a 90 KB limit in the SDK, so I'm wondering if you know when this larger limit might apply?

 

Thanks again.

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

Re: Mixing multiple languages in one application

[ Edited ]

"when this larger limit might apply?"

 

If you look at the doc, there are two methods of loading a Font, by name and as a Stream.  If you load as a Stream the font size is restricted to 90K.  By name - 60 K.  Which surprises me because if you put the font in your Application, you can convert it to a Stream using this:

http://supportforums.blackberry.com/t5/Java-Development/Add-plain-text-or-binary-files-to-an-applica... 

 

 

I missed this originally as well and someone pointed this put to me! See here:

http://supportforums.blackberry.com/t5/Java-Development/Acceptable-ttf-fonts-for-OS-5-0/m-p/537234#M...

 

Edit corrected link.

Contributor
Posts: 21
Registered: ‎12-30-2010
My Device: Not Specified

Re: Mixing multiple languages in one application

Thanks for the tip, although from a programming standpoint, I cannot imagine why the different limits apply. Smiley Happy

Contributor
Posts: 13
Registered: ‎08-11-2010
My Device: Not Specified

Re: Mixing multiple languages in one application

peter_strange,

 

Is the first link you provide for converting to a stream correct?  Looks like you provided the same link twice.  Thanks!

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

Re: Mixing multiple languages in one application

Well spotted - fixed I think