Skip to content

TextStyle

A style describing how to format and paint text.

Properties

Methods

Properties#

baseline class-attribute instance-attribute #

baseline: Optional[TextBaseline] = None

The common baseline that should be aligned between this text span and its parent text span, or, for the root text spans, with the line box.

bgcolor class-attribute instance-attribute #

bgcolor: Optional[ColorValue] = None

color class-attribute instance-attribute #

color: Optional[ColorValue] = None

decoration class-attribute instance-attribute #

decoration: Optional[TextDecoration] = None

The decorations to paint near the text (e.g., an underline).

decoration_color class-attribute instance-attribute #

decoration_color: Optional[ColorValue] = None

The color in which to paint the text decorations.

decoration_style class-attribute instance-attribute #

decoration_style: Optional[TextDecorationStyle] = None

The style in which to paint the text decorations (e.g., dashed).

Defaults to TextDecorationStyle.SOLID.

decoration_thickness class-attribute instance-attribute #

decoration_thickness: Optional[Number] = None

The thickness of the decoration stroke as a multiplier of the thickness defined by the font.

font_family class-attribute instance-attribute #

font_family: Optional[str] = None

foreground class-attribute instance-attribute #

foreground: Optional[Paint] = None

The paint drawn as a foreground for the text.

height class-attribute instance-attribute #

height: Optional[Number] = None

The height of this text span, as a multiple of the font size.

See detailed explanation here.

italic class-attribute instance-attribute #

italic: bool = False

Whether to use italic typeface.

letter_spacing class-attribute instance-attribute #

letter_spacing: Optional[Number] = None

The amount of space (in logical pixels) to add between each letter. A negative value can be used to bring the letters closer.

overflow class-attribute instance-attribute #

overflow: Optional[TextOverflow] = None

How visual text overflow should be handled.

shadow class-attribute instance-attribute #

shadow: Optional[BoxShadowValue] = None

TBD

size class-attribute instance-attribute #

size: Optional[Number] = None

The size of glyphs (in logical pixels) to use when painting the text.

Defaults to 14.

weight class-attribute instance-attribute #

weight: Optional[FontWeight] = None

The typeface thickness to use when painting the text (e.g., bold).

Defaults to FontWeight.NORMAL.

word_spacing class-attribute instance-attribute #

word_spacing: Optional[Number] = None

The amount of space (in logical pixels) to add at each sequence of white-space (i.e. between each word). A negative value can be used to bring the words closer.

Methods#

copy #

copy(
    *,
    size: Optional[Number] = None,
    height: Optional[Number] = None,
    weight: Optional[FontWeight] = None,
    italic: Optional[bool] = None,
    decoration: Optional[TextDecoration] = None,
    decoration_color: Optional[ColorValue] = None,
    decoration_thickness: Optional[Number] = None,
    decoration_style: Optional[TextDecorationStyle] = None,
    font_family: Optional[str] = None,
    color: Optional[ColorValue] = None,
    bgcolor: Optional[ColorValue] = None,
    shadow: Optional[BoxShadowValue] = None,
    foreground: Optional[Paint] = None,
    letter_spacing: Optional[Number] = None,
    word_spacing: Optional[Number] = None,
    overflow: Optional[TextOverflow] = None,
    baseline: Optional[TextBaseline] = None,
)