FontShearSpan
public final class FontShearSpan extends MetricAffectingSpan
| java.lang.Object | |||
| ↳ | android.text.style.CharacterStyle | ||
| ↳ | android.text.style.MetricAffectingSpan | ||
| ↳ | androidx.text.vertical.FontShearSpan |
A span that applies a shear (skew) transformation to vertical writing text.
This span inherits from MetricAffectingSpan, but it is specifically designed for use within a VerticalTextLayout and will not have an effect in other contexts.
It is used to achieve an italic-like effect for vertical text layout, where traditional italic fonts may not render correctly.
The shear value represents the horizontal skew factor for rotated or tate-chu-yoko text. For upright text, this value is used as the vertical skew factor.
NOTE: This span only works with VerticalTextLayout.
Summary
Constants |
|
|---|---|
static final float |
DEFAULT_FONT_SHEAR = 0.2679492fDefault constant for fontShear. |
Public constructors |
|---|
FontShearSpan(float fontShear) |
Public methods |
|
|---|---|
final float |
The shear factor to apply to the text. |
void |
updateDrawState(TextPaint textPaint) |
void |
updateMeasureState(@NonNull TextPaint textPaint) |
Inherited methods |
|---|
Constants
DEFAULT_FONT_SHEAR
public static final float DEFAULT_FONT_SHEAR = 0.2679492f
Default constant for fontShear.
This value represents a shear angle of 15 degrees (tan(15 deg)).
Public constructors
Public methods
getFontShear
public final float getFontShear()
The shear factor to apply to the text. This is the tangent of the shear angle.
updateMeasureState
public void updateMeasureState(@NonNull TextPaint textPaint)