public class TextSpacing extends Object
letter-spacing and
word-spacing CSS properties.
Letter spacing is added after every character (including the last one, as browsers do), word spacing only after word separator characters such as the space character.
Instances are immutable, so NONE can be shared by the (very
common) case of a style using neither property.
| Modifier and Type | Field and Description |
|---|---|
static TextSpacing |
NONE |
| Modifier and Type | Method and Description |
|---|---|
float |
extra(String text)
The extra width this spacing adds to the entire string.
|
float |
extra(String text,
int start,
int end)
The extra width this spacing adds to
text between the
start (inclusive) and end (exclusive) char indexes. |
float |
extraForSeparator()
The extra width contributed by a single word separator character.
|
static TextSpacing |
from(CalculatedStyle style,
CssContext c) |
float |
getLetterSpacing() |
float |
getWordSpacing() |
boolean |
isNone() |
static TextSpacing |
of(float letterSpacing,
float wordSpacing) |
String |
toString() |
public static final TextSpacing NONE
public static TextSpacing of(float letterSpacing, float wordSpacing)
public static TextSpacing from(CalculatedStyle style, CssContext c)
public boolean isNone()
public float getLetterSpacing()
public float getWordSpacing()
public float extra(String text)
public float extra(String text, int start, int end)
text between the
start (inclusive) and end (exclusive) char indexes.public float extraForSeparator()
Copyright © 2004–2026. All rights reserved.