text is not showing all characters

  ... in the unlikely case you discovered a bug, post it here.

text is not showing all characters

Postby cschua » Thu Oct 14, 2010 2:14 am

Hello,

Even with the recent updates on the engine I'm still having issues when showing text on screen. It's frequent that some letters are not showing up on screen. I'm reusing 2 font resources with 6 text objects. I believe when I use the resource more than once, the letters do not show up for the other text objects.

My code...

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2. @Override
  3. public void onLoadResources() {
  4.         // ...
  5.                 // text        
  6.         FontFactory.setAssetBasePath("font/");
  7.         this.mFontTexture = new Texture(256, 128, TextureOptions.BILINEAR);
  8.         this.mFontScore = FontFactory.createFromAsset(this.mFontTexture, this, "UnrealTournament.ttf", textSize1, true, Color.WHITE);
  9.         this.mEngine.getTextureManager().loadTexture(this.mFontTexture);
  10.         this.mEngine.getFontManager().loadFont(this.mFontScore);
  11.         //
  12.         this.mFontTexture = new Texture(256, 128, TextureOptions.BILINEAR);
  13.         this.mFontMenu = FontFactory.createFromAsset(this.mFontTexture, this, "UnrealTournament.ttf", textSize2, true, Color.WHITE);
  14.         this.mEngine.getTextureManager().loadTexture(this.mFontTexture);
  15.         this.mEngine.getFontManager().loadFont(this.mFontMenu);
  16.         // ...
  17. }
  18.  
Parsed in 0.034 seconds, using GeSHi 1.0.8.4


then at different location of the code I use the resource...

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. // ...
  2. textIns1 = new Text(x, y, this.mFontScore, "Capture:", HorizontalAlign.LEFT);      
  3. // ...
  4. textIns2 = new Text(x, y, this.mFontScore, "Avoid this:", HorizontalAlign.LEFT);
  5. // ...
  6. textIns2 = new Text(x, y, this.mFontScore, "Avoid these:", HorizontalAlign.LEFT);
  7.  
  8.  
Parsed in 0.032 seconds, using GeSHi 1.0.8.4
Published: Another Strobe Light, Nitey Night Light, Live Wallpaper ASL, Score Keeper, etc.

Future: Happy Halloween Game (using AndEngine)
Castle Game (using AndEngine)
Another Live Wallpaper (using AndEngine)
Etc.
cschua
 
Posts: 48
Joined: Sat Sep 11, 2010 11:47 pm

Re: text is not showing all characters

Postby cschua » Thu Oct 14, 2010 2:27 am

when I replaced

FontFactory.createFromAsset(this.mFontTexture, this, "UnrealTournament.ttf", textSize1, true, Color.WHITE);

with this

new Font(this.mFontTexture, Typeface.create(Typeface.DEFAULT, Typeface.BOLD), textSize1, true, Color.WHITE);

the bug went away and so far I can see all the leters.

So, I'm guessing FontFactory.createFromAsset has a bug when multiple text objects are using the resource.

Anyone experiencing the same?
Published: Another Strobe Light, Nitey Night Light, Live Wallpaper ASL, Score Keeper, etc.

Future: Happy Halloween Game (using AndEngine)
Castle Game (using AndEngine)
Another Live Wallpaper (using AndEngine)
Etc.
cschua
 
Posts: 48
Joined: Sat Sep 11, 2010 11:47 pm

Re: text is not showing all characters

Postby rubycell » Sun Oct 17, 2010 6:29 am

Hi, you should re-test this bug again and again.
This kind of bug is a randomize-bug.
rubycell
 
Posts: 30
Joined: Wed Jul 21, 2010 4:44 am
Location: Hanoi, Vietnam

Re: text is not showing all characters

Postby cschua » Mon Oct 18, 2010 10:00 am

yeah it is still happening with Typeface font.

i'm going to look at other options.
Published: Another Strobe Light, Nitey Night Light, Live Wallpaper ASL, Score Keeper, etc.

Future: Happy Halloween Game (using AndEngine)
Castle Game (using AndEngine)
Another Live Wallpaper (using AndEngine)
Etc.
cschua
 
Posts: 48
Joined: Sat Sep 11, 2010 11:47 pm

Re: text is not showing all characters

Postby Nicolas Gramlich » Mon Oct 18, 2010 1:37 pm

Had I asked what device you are using :?:

Can you make a minimal example (zipped project) you are still experiencing this issue :?:

Best Regards,
Nicolas
Nicolas Gramlich
Site Admin
 
Posts: 1734
Joined: Mon Jun 07, 2010 6:20 pm
Location: Schriesheim, Germany

Re: text is not showing all characters

Postby cschua » Tue Oct 19, 2010 4:27 am

my device is droid 1 and 2.

but i dont think it's the device since the emulator on my pc / laptop does the same thing. it's rare in the emulator with Typeface, but on the phone it happens 80% of the time.

I will write a smaller example and post it here tomorrow.
Published: Another Strobe Light, Nitey Night Light, Live Wallpaper ASL, Score Keeper, etc.

Future: Happy Halloween Game (using AndEngine)
Castle Game (using AndEngine)
Another Live Wallpaper (using AndEngine)
Etc.
cschua
 
Posts: 48
Joined: Sat Sep 11, 2010 11:47 pm

Re: text is not showing all characters

Postby cschua » Tue Oct 19, 2010 8:53 pm

hey Nicolas,

I sent you a message. I sent you a megaupload link to dl part of my code where the text is missing characters.
Published: Another Strobe Light, Nitey Night Light, Live Wallpaper ASL, Score Keeper, etc.

Future: Happy Halloween Game (using AndEngine)
Castle Game (using AndEngine)
Another Live Wallpaper (using AndEngine)
Etc.
cschua
 
Posts: 48
Joined: Sat Sep 11, 2010 11:47 pm

Re: text is not showing all characters

Postby Doudou » Fri Oct 22, 2010 8:59 pm

I'm facing the exact same problem. Some of my text characters are not showing. I reuse the same Font instance for those Texts.

Did you find the reason for that unexpected behavior, please?

Do you think that it may be linked to the size of the underlying Texture instance used to create the Font object? I did not find any material which explains what size the Texture used to create a Font instance should be? Should it be dependent on the font size?

Thank you for your help. Regards,
Édouard
Doudou
 
Posts: 6
Joined: Wed Sep 22, 2010 9:49 pm

Re: text is not showing all characters

Postby oldskool73 » Sun Oct 24, 2010 5:05 pm

To anyone having this issue, it's just because your font texture is too small so some letters or numbers are not being created properly, just make the texture bigger and it will fix it.
oldskool73
 
Posts: 128
Joined: Tue Oct 12, 2010 4:04 pm

Re: text is not showing all characters

Postby Doudou » Mon Oct 25, 2010 8:18 pm

Thank you very much for this answer.

This leads to the following question: how big should be the Texture used to create a Font? Sorry to be that dump in Open GL.

Thank you for your time and support. Regards,
Édouard
Doudou
 
Posts: 6
Joined: Wed Sep 22, 2010 9:49 pm

Next

Return to Bugs

Who is online

Users browsing this forum: No registered users and 4 guests