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

Native Development

Reply
Rok
Contributor
Rok
Posts: 11
Registered: ‎01-25-2013
My Device: Developer
My Carrier: Developer

Writing from the Chinese system font to a texture

I'm adding localisation code to my current project and need to implement more complex fonts such as Chinese and Japanese.  The code extracts standard font characters from a png sheet to display with OpenGL.  If the characters do not exist in the sheet it needs to fall back to using system fonts.

 

I have the localised text stored in Utf8 format but need pointing in the right direction as to how to write characters from the Chinese system font (for example) to an OpenGL texture.

 

Any help would be much appreciated.

Please use plain text.
Developer
BGmot
Posts: 1,068
Registered: ‎11-24-2011
My Device: PlayBook
My Carrier: x

Re: Writing from the Chinese system font to a texture

>I have the localised text stored in Utf8 format

Can you clarify please? Do you have bitmaps stored for these complex fonts?

Please use plain text.
Rok
Contributor
Rok
Posts: 11
Registered: ‎01-25-2013
My Device: Developer
My Carrier: Developer

Re: Writing from the Chinese system font to a texture

All European characters are stored in a PNG file.  It is the Chinese/Korean/Japanese characters that aren't stored - I have the Uincode or Utf8 for the localised Asian strings and want to render the system fonts that are already available in the BB10 device to OpenGL textures.

 

I guess what I need to know are the names of the system fonts used to display those languages and also a method of writing characters from those fonts onto textures.

 

Looking in bbutil, bbutil_load_font loads the first 128 characters from fonts which clearly doesn't cater for unicode fonts.  I'm wondering if my best solution would be to adapt bbutil_load_font so that I can pass in a unicode string and it will use a map, rather than an array, to add characters that are needed and haven't already been loaded (and, likewise, adapt bbutil_render_text so that it receives a unicode string and uses the map to render the correct loaded characters).

 

So, I *think* what I need to know are the names of the system fonts used to display Chinese, Japanese and Korean, and also whether the method I've proposed is the easiest/best way of writing characters from those fonts to OpenGL textures.

Please use plain text.
Developer
BGmot
Posts: 1,068
Registered: ‎11-24-2011
My Device: PlayBook
My Carrier: x

Re: Writing from the Chinese system font to a texture

Yes, I understand that. What I am trying to say is I doubt System Fonts (i.e. Fonts used by BB10 OS) are available to us thus fonts you see int the folder are for users and I doubt any of them contain Chinese characters. So if you have your own fonts (bitmaps) then they can be easily loaded/used if you don't then I don't think we have access to fonts used by BB10 OS -(

I do hope that I am wrong but... -(

Please use plain text.
Rok
Contributor
Rok
Posts: 11
Registered: ‎01-25-2013
My Device: Developer
My Carrier: Developer

Re: Writing from the Chinese system font to a texture

Ah, I see.  It's the way the project has worked on iOS and Android so I (optimistically) assumed a similar method would be possible with BB10 devices.  As nobody else has interjected to say otherwise then it looks like I'll have to provide my own Chinese/Japanese/Korean fonts.  Definitely not something I really want to do.  Ah well, such is life - thanks for your replies

Please use plain text.