TacticalGhost29 / jmonkeyengine

Automatically exported from code.google.com/p/jmonkeyengine
0 stars 0 forks source link

RenderFontJme miscalculates font width for Strings with font color hints #512

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Nifty calculates the width of a String so that is can decide whether to move to 
a new line or to stay on the same line. The Nifty HTML libraries allow a font 
color to be set by adding <font color="#ffffffff"> tags. These are translated 
into \#ffffffff# hints internally. (Example <font 
color="#ff0000ff">Hello</font> is turned into \#ff0000ff#Hello). 
RenderFontJme.getWidth also take the length of this \#[0-9a-f]{8}# along in its 
calculations, resulting in earlier wrapping than expected.

Possible fix: add 'str = str.replaceAll("\\\\#[0-9a-f]{8}#","")' at an 
efficient location before calculating.

Original issue reported on code.google.com by j.warmer...@gmail.com on 20 Jun 2012 at 1:39

GoogleCodeExporter commented 9 years ago
Should be easy to fix based on what the OP said. 

Original comment by ShadowIs...@gmail.com on 10 Nov 2012 at 8:45

GoogleCodeExporter commented 9 years ago
BitmapFont already skips these so I'm not sure what the issue is.

Original comment by PSpee...@gmail.com on 10 Nov 2012 at 9:33

GoogleCodeExporter commented 9 years ago
Not reproducible.

Original comment by ShadowIs...@gmail.com on 13 Nov 2012 at 3:12