/* Unless both text and icon are non-null, we effectively ignore
* the value of textIconGap.
*/
int gap;
View v;
if (textIsEmpty) {
textR.width = textR.height = 0;
text = "";
gap = 0;
}
else {
int availTextWidth;
gap = (icon == null) ? 0 : textIconGap;
if (horizontalTextPosition == CENTER) {
availTextWidth = viewR.width;
}
else {
availTextWidth = viewR.width - (iconR.width + gap);
}
v = (c != null) ? (View) c.getClientProperty("html") : null;
if (v != null) {
textR.width = Math.min(availTextWidth, (int) v.getPreferredSpan(View.X_AXIS));
textR.height = (int) v.getPreferredSpan(View.Y_AXIS);
}
else {
// this is only place that is changed for StyledLabel
// textR.width = SwingUtilities2.stringWidth(c, fm, text);
// lsb = SwingUtilities2.getLeftSideBearing(c, fm, text);