@ -53,7 +53,7 @@ class StringBlock implements Cloneable {
private int lineCount ;
private LineWrapMode wrapType = LineWrapMode . Word ;
private float [ ] tabPos ;
private float tabWidth = 50 ;
private float tabWidth = BitmapFont . DEFAULT_TAB_WIDTH ;
private char ellipsisChar = 0x2026 ;
/ * *
@ -91,6 +91,7 @@ class StringBlock implements Cloneable {
clone . color = color . clone ( ) ;
if ( textBox ! = null )
clone . textBox = textBox . clone ( ) ;
// tabPos is read-only and replaced on write.
return clone ;
} catch ( CloneNotSupportedException ex ) {
throw new AssertionError ( ) ;
@ -172,28 +173,38 @@ class StringBlock implements Cloneable {
void setLineWrapMode ( LineWrapMode wrap ) {
this . wrapType = wrap ;
}
void setEllipsisChar ( char c ) {
this . ellipsisChar = c ;
}
int getEllipsisChar ( ) {
return ellipsisChar ;
}
void setTabWidth ( float tabWidth ) {
this . tabWidth = tabWidth ;
}
void setTabPosition ( float [ ] tabs ) {
this . tabPos = tabs ;
}
float getTabWidth ( ) {
return tabWidth ;
}
float [ ] getTabPosition ( ) {
return tabPos ;
if ( tabs ! = null & & tabs . length > 0 ) {
this . tabPos = tabs . clone ( ) ;
} else {
this . tabPos = null ;
}
}
void setEllipsisChar ( char c ) {
this . ellipsisChar = c ;
}
float calcNextTabPosition ( float posX ) {
// If there is an upcoming user-set tab stop, use that one.
if ( tabPos ! = null & & posX < tabPos [ tabPos . length - 1 ] ) {
for ( int i = 0 ; i < tabPos . length ; i + + ) {
if ( posX < tabPos [ i ] ) {
return tabPos [ i ] ;
}
}
}
int getEllipsisChar ( ) {
return ellipsisChar ;
// No upcoming tab stops available, use default tab width.
return ( float ) Math . floor ( posX / tabWidth ) * tabWidth + tabWidth ;
}
}