VerticalTextScope
@VerticalTextDsl
interface VerticalTextScope
Receiver for the buildVerticalText DSL. Provides operations for appending plain and styled text, wrapping regions in ruby or orientation spans, and applying style modifications while constructing a vertical-text Spanned.
Instances are not intended to be implemented by library consumers.
Summary
Public functions |
|
|---|---|
Unit |
combineUpright(text: CharSequence)Appends |
Unit |
sideways(text: CharSequence)Appends |
Unit |
text(text: CharSequence, rubyMap: Map<String, String>)Appends |
Unit |
upright(text: CharSequence)Appends |
R |
<R : Any> withEmphasis(Runs |
R |
<R : Any> withRuby(Runs |
R |
<R : Any> withStyle(Runs |
Public functions
combineUpright
fun combineUpright(text: CharSequence): Unit
Appends text and wraps it in a TextOrientationSpan.CombineUpright span: all of the appended characters are combined horizontally and laid out within a single vertical slot (tate-chu-yoko).
sideways
fun sideways(text: CharSequence): Unit
Appends text and wraps it in a TextOrientationSpan.Sideways span: every glyph is rotated 90° clockwise regardless of its script.
text
fun text(text: CharSequence, rubyMap: Map<String, String> = emptyMap()): Unit
Appends text. For each (key, reading) in rubyMap, every occurrence of key inside the just-appended text is annotated with a RubySpan carrying reading.
upright
fun upright(text: CharSequence): Unit
Appends text and wraps it in a TextOrientationSpan.Upright span: every glyph is drawn upright regardless of its script.
withEmphasis
fun <R : Any> withEmphasis(
style: EmphasisStyle = EmphasisStyle.Dot,
filled: Boolean = true,
scale: Float = 0.5f,
block: VerticalTextScope.() -> R
): R
Runs block and wraps the range it appends with an EmphasisSpan that renders emphasis marks (傍点) alongside each character.
| Returns | |
|---|---|
R |
the value returned by |
withRuby
fun <R : Any> withRuby(
ruby: CharSequence,
position: AnnotationPosition = RubySpan.DEFAULT_POSITION,
orientation: TextOrientation = RubySpan.DEFAULT_ORIENTATION,
textScale: Float = RubySpan.DEFAULT_TEXT_SCALE,
block: VerticalTextScope.() -> R
): R
Runs block and wraps the range it appends with a RubySpan annotating it with withRuby, with the given position, orientation and textScale.
Ruby text is small annotation text (such as furigana) placed alongside the base text, commonly used to indicate pronunciation or provide a brief description.
| Returns | |
|---|---|
R |
the value returned by |
withStyle
fun <R : Any> withStyle(
fontSize: TextUnit = TextUnit.Unspecified,
textColor: Color = Color.Unspecified,
backgroundColor: Color = Color.Unspecified,
fontShear: Float = Float.NaN,
block: VerticalTextScope.() -> R
): R
Runs block and wraps the range it appends with a MetricAffectingSpan applying the given fontSize, textColor, and/or backgroundColor to the paint used for that range. If fontShear is provided, it also wraps the range in a FontShearSpan.
Sp values in fontSize are resolved using Density; em values scale the inherited paint size.
| Returns | |
|---|---|
R |
the value returned by |