public final class RubySpan extends ReplacementSpan


A span used to specify ruby text for a portion of the text.

Ruby text cannot be nested (i.e., ruby text cannot contain further ruby text). Ruby spans also cannot overlap each other.

This span is designed for use with VerticalTextLayout.

Summary

Nested types

public final class RubySpan.Builder

Builder class for creating RubySpan instances.

Public methods

void
draw(
    @NonNull Canvas canvas,
    CharSequence text,
    int start,
    int end,
    float x,
    int top,
    int y,
    int bottom,
    @NonNull Paint paint
)
final int

The text orientation of the ruby text.

int
getSize(
    @NonNull Paint paint,
    CharSequence text,
    int start,
    int end,
    Paint.FontMetricsInt fm
)
final @NonNull CharSequence

The ruby text to be displayed adjacent to the base text.

final float

The text scale ratio of the ruby text relative to the base text.

Public methods

draw

Added in 1.0.0-alpha03
public void draw(
    @NonNull Canvas canvas,
    CharSequence text,
    int start,
    int end,
    float x,
    int top,
    int y,
    int bottom,
    @NonNull Paint paint
)

getOrientation

Added in 1.0.0-alpha03
public final int getOrientation()

The text orientation of the ruby text. Defaults to TextOrientation.MIXED.

getSize

Added in 1.0.0-alpha03
public int getSize(
    @NonNull Paint paint,
    CharSequence text,
    int start,
    int end,
    Paint.FontMetricsInt fm
)

getText

Added in 1.0.0-alpha03
public final @NonNull CharSequence getText()

The ruby text to be displayed adjacent to the base text.

getTextScale

Added in 1.0.0-alpha03
public final float getTextScale()

The text scale ratio of the ruby text relative to the base text. Defaults to 0.5f.