text is not showing all characters

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

Re: text is not showing all characters

Postby cschua » Mon Oct 25, 2010 11:26 pm

even if you use the maximum size of font, text are still sometimes missing (less frequent, but still happens). it's really random so it's hard to determine the issue. how can the letter "a" be missing and not the letter "A" if the size of font is the issue here?
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 trostik » Sat Nov 06, 2010 2:02 am

I had a similar problem with numbers not with chars. Found a problem to be in my value.
Some pseudo code
Syntax: [ Download ] [ Hide ]
Using javascript Syntax Highlighting
  1. changableText.setText(String.valueOf(intValue)); //this one got me only the first letter
  2. //i have changed it to
  3. cangableText.setText(Math.round(String.valueOf(floatValue))); // this one worked like a charm
  4.  
Parsed in 0.002 seconds, using GeSHi 1.0.8.4


On top of that im using custom font from DaFont.

Hope it helps.

Alex.
Blog
Ads :)
SprayCan | ShortestStraw | StackEmUp| Negatives
If you're good at something, never do it for free. - The Joker
trostik
 
Posts: 82
Joined: Wed Aug 04, 2010 9:56 pm
Location: Israel

Re: text is not showing all characters

Postby whalabi » Wed Dec 22, 2010 12:28 am

Hiya, pretty sure I know the cause and fix of this issue (even though it's an old thread.) Someone touched on it before.

Your font texture needs to be big enough to fit all the characters required.

For example, in the code below, if the texture size is 256x256, it's too small for the font size (48) so characters will be missing. if the font size is 32, it's fine. But to accomodate the bigger font characters, I had to up the texture size.

Hope that helps

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. dialogMenuFontTexture = new Texture(512, 512, TextureOptions.BILINEAR_PREMULTIPLYALPHA);
  2. dialogMenuFont = new Font(dialogMenuFontTexture, Typeface.create(Typeface.DEFAULT, Typeface.BOLD), 48, true, Color.WHITE);
Parsed in 0.029 seconds, using GeSHi 1.0.8.4
Image
whalabi
 
Posts: 51
Joined: Fri Oct 22, 2010 8:59 pm

Re: text is not showing all characters

Postby crinkledink » Mon Oct 10, 2011 12:11 pm

Make Sure the Texture in which the font is loaded with appropriate size

some characters are missing because they didnt loadon the texture sheet properly, silly me

i tried loading size 50 font on a 256x256, i changed it to 512x1024 and voalia, took me a few hours but i grinded it out, not sure if anyone else had this issue


-------------------------SOLVED-----------------------


do we have an answer to this?

there's something really funny going on, this has got to be a joke, i stumbled on something that's got to be a bug.

im running the changeable text and this is the check statement im using to see what texts are to be loaded next into the changeable text.

if i run only 1 if statement as in the sample code below, the commend BI-WInning will appear normally, however when I take out the comments, half the characters will be missing from "bi winning", ive been stuck here for the past 3 hours, im fed up with this. ive tried everything, runningonupdatethread, uithread, and most importantly

engineOptions.getRenderOptions().disableExtensionVertexBufferObjects();

when i separate the if checks into other methods, same thing occurs, i dont understand why. anyhow im moving on and getting back to this .... hopefully


Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.         if (gPillComboCounter>=10) {
  2.                                                 SpriteSheet.pointsText[scoreCounter] = String.format("   BI-WINNING! + %d",SpriteSheet.pointsNumber[scoreCounter]);
  3.                                         }/*else if (gPillComboCounter%5==0) {
  4.                                                 SpriteSheet.pointsText[scoreCounter] = String.format("  SPACE CADET! + %d",SpriteSheet.pointsNumber[scoreCounter]);
  5.                                         }else if (gPillComboCounter%3==0) {
  6.                                                 SpriteSheet.pointsText[scoreCounter] = String.format("     HOOKED! +%d   ",SpriteSheet.pointsNumber[scoreCounter]);
  7.                                         }*/
  8.                                        
  9.                                         ((ChangeableText) SpriteSheet.displayScoreText[scoreCounter]).setText(SpriteSheet.pointsText[scoreCounter]);
  10.                                         ((ChangeableText) SpriteSheet.displayScoreText2[scoreCounter]).setText(SpriteSheet.pointsText[scoreCounter]);
  11.  
  12.                                         BackgroundModifiers.comboSuperPillFloatModifiers(context, SpriteSheet.displayScoreText[scoreCounter]);
  13.                                         BackgroundModifiers.comboSuperPillFloatModifiers(context, SpriteSheet.displayScoreText2[scoreCounter]);
  14.  
  15.                                         SpriteSheet.displayScoreText[scoreCounter].setVisible(true);
  16.                                         SpriteSheet.displayScoreText2[scoreCounter].setVisible(true);  
  17.                                        
Parsed in 0.033 seconds, using GeSHi 1.0.8.4
crinkledink
 
Posts: 129
Joined: Sun May 15, 2011 6:26 pm

Re: text is not showing all characters

Postby Nicolas Gramlich » Sat Oct 22, 2011 1:13 pm

Hi,

Doudou wrote: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


There isn't really a way to do that yet.
There are lots (!) of characters that could possibly be displayed and therefore the minimum size to show them all would be very big :)

I could throw an Exception if there are too many letters though. :)

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 MYWIFENOWDAVE1 » Thu May 17, 2012 4:21 pm

Hi,

I had a similar issue with ChangeableText where the text only showed the first character. I managed to resolve the issue by increasing the size of my initial String from 1 character to 3. i.e. changed it from "0" to "0 ". The spaces were left as I know the text length will increase later in the game...

playerNumOfDaysText = new ChangeableText(playerSpriteForHUD.getX(), playerSpriteForHUD.getY(), mFont, "0 ");

works okay now...

Tried the Texture trick and I'm sure that is also true however I needed the above to fix my issue.
MYWIFENOWDAVE1
 
Posts: 2
Joined: Fri Apr 29, 2011 6:24 am

Re: text is not showing all characters

Postby barbu.victor » Wed Jun 13, 2012 10:28 pm

Thanks man. After one hour of frustration, your answer was perfect.
Thanks again :)
barbu.victor
 
Posts: 2
Joined: Wed Jun 13, 2012 5:48 pm

Previous

Return to Bugs

Who is online

Users browsing this forum: No registered users and 2 guests