private LabelStyle style;\r
private final TextBounds bounds = new TextBounds();\r
private final StringBuilder text = new StringBuilder();\r
+ private StringBuilder tempText;\r
private BitmapFontCache cache;\r
private int labelAlign = Align.left;\r
private HAlignment lineAlign = HAlignment.LEFT;\r
float oldScaleY = font.getScaleY();\r
if (fontScaleX != 1 || fontScaleY != 1) font.setScale(fontScaleX, fontScaleY);\r
\r
- Drawable background = style.background;\r
float width = getWidth(), height = getHeight();\r
+ StringBuilder text;\r
+ if (width < bounds.width) {\r
+ float ellipseWidth = font.getBounds("...").width;\r
+ text = tempText != null ? tempText : (tempText = new StringBuilder());\r
+ text.setLength(0);\r
+ if (width > ellipseWidth) {\r
+ text.append(this.text, 0, font.computeVisibleGlyphs(this.text, 0, this.text.length, width - ellipseWidth));\r
+ text.append("...");\r
+ }\r
+ } else\r
+ text = this.text;\r
+\r
+ Drawable background = style.background;\r
float x = 0, y = 0;\r
if (background != null) {\r
x = background.getLeftWidth();\r