xbgao / angle

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

AngleString and space #5

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. multiple word in a string (with space between or '\t')
2. constructor used :

AngleString(AngleFont font, String string, int x,int y,int aligment)

What is the expected output? What do you see instead?
Expected : print multiple word in screen with space between
See : multiple word with no space between

What version of the product are you using? On what operating system?
revision 69, milestone 2.1, hero 1.5

not really a bug, but i don't anderstand why space are 'erase'

Original issue reported on code.google.com by cilheo on 13 Apr 2010 at 12:36

GoogleCodeExporter commented 8 years ago
This problem was because in some fonts the width of ' ' (space) is 0.

I added this 'fix' to the creation of the font:

paint.getTextBounds(" ", 0, 1, rect);
mFont.mSpaceWidth = (short) (rect.right - rect.left + mFont.mBorder);
if (mFont.mSpaceWidth==0)
{
  paint.getTextBounds("x", 0, 1, rect);
  mFont.mSpaceWidth = (short) (rect.right - rect.left + mFont.mBorder);
}

So. If the width of ' ' is 0 use the width of 'x'

Thank you for your testing.

Original comment by ipaju...@gmail.com on 13 Apr 2010 at 3:47