Return to Starling Playback Library

How to use Bitmap font in Multi-Resolution Development

Questions related to Starling playback library should be asked here.

How to use Bitmap font in Multi-Resolution Development

Postby Lê Huy Hùng » December 24th, 2015, 9:46 pm

Like title, i have a bitmap font. I imported png of it into swf and load xml of it by assetManager. After xml is loaded and png is created by GAF, I create bitmap font by code. Example
Code: Select all
         var texture:Texture = gafBundle.getCustomRegion("main, "Arial", 1, Config.SCALE_FACTOR).texture;
         var xml:XML = this.xmlLoaded;
         TextField.registerBitmapFont(new BitmapFont(texture, xml), "Arial40");
         

When Config.SCALE_FACTOR = 2, every thing is nice, but if Config.SCALE_FACTOR = 1, bitmap font can't create because it has not the correct xml. When create asset SD, GAF scale everything to 0.5 but values in xml (loaded by asset manager) no change. Would be great if exist tool export multi scales value suitable with GAF convert.
I know I can load bitmap font without use GAF convert but I will have two atlas if I do it and i don't like this. I tried two tools is bmfont and littera but don't success. Do you have any experience in this case. Thank you

This is my setting of GAFConvert
Image
User avatar
Lê Huy Hùng
 
Posts: 61
Joined: July 3rd, 2015, 8:32 pm

Re: How to use Bitmap font in Multi-Resolution Development

Postby vadym.mitin » December 25th, 2015, 1:46 am

Hi,

There are two ways that you can do this right now:

1) Load the bitmap font texture atlas separately without using GAF (as you mentioned). Yes, the number of draw calls will increased. But if you put all Text Fields on top of the Display List in one range - the number of draw calls will be only 2 (one for all game objects from the bottom of Display List and one for all Text Fields).

2) Keep the bitmap font texture atlas in GAF (as in your example) but somehow you need to generate second XML for CSF 1 and load corresponding XML taking into account CSF of the GAF textures. All values in XML for CSF 1 should be divided by 2.

Hope this information will help you.
User avatar
vadym.mitin
 
Posts: 254
Joined: December 4th, 2013, 8:00 am

Re: How to use Bitmap font in Multi-Resolution Development

Postby Lê Huy Hùng » December 25th, 2015, 3:03 am

Hi
Thank for your reply. I want ask about "somehow" as you mentioned because I can't find any solution to generate second XML for CSF 1 (I tried bmfont and littera). About issue is put all Text Fields on top of the Display List in one range, it is impossible because I use many component of feather in my game :D
User avatar
Lê Huy Hùng
 
Posts: 61
Joined: July 3rd, 2015, 8:32 pm

Return to Starling Playback Library

Who is online

Users browsing this forum: No registered users and 3 guests