Skip to main content

TextStyle

A style describing how to format and paint text.

Properties

Methods

  • copy - Returns a copy of this object with the specified properties overridden.

Properties

baselineclass-attributeinstance-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.

bgcolorclass-attributeinstance-attribute

bgcolor: Optional[ColorValue] = None

Text background https://flet.dev/docs/types/colors.

colorclass-attributeinstance-attribute

color: Optional[ColorValue] = None

Text foreground https://flet.dev/docs/types/colors.

decorationclass-attributeinstance-attribute

decoration: Optional[TextDecoration] = None

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

decoration_colorclass-attributeinstance-attribute

decoration_color: Optional[ColorValue] = None

The color in which to paint the text decorations.

decoration_styleclass-attributeinstance-attribute

decoration_style: Optional[TextDecorationStyle] = None

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

Defaults to TextDecorationStyle.SOLID.

decoration_thicknessclass-attributeinstance-attribute

decoration_thickness: Optional[Number] = None

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

font_familyclass-attributeinstance-attribute

font_family: Optional[str] = None

See https://flet.dev/docs/controls/text#font_family.

font_family_fallbackclass-attributeinstance-attribute

font_family_fallback: Optional[list[str]] = None

Ordered fallback font families to use when glyphs are not available in font_family.

foregroundclass-attributeinstance-attribute

foreground: Optional[Paint] = None

The paint drawn as a foreground for the text.

heightclass-attributeinstance-attribute

height: Optional[Number] = None

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

See detailed explanation here.

italicclass-attributeinstance-attribute

italic: bool = False

Whether to use italic typeface.

letter_spacingclass-attributeinstance-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.

overflowclass-attributeinstance-attribute

overflow: Optional[TextOverflow] = None

How visual text overflow should be handled.

shadowclass-attributeinstance-attribute

shadow: Optional[BoxShadowValue] = None

TBD

sizeclass-attributeinstance-attribute

size: Optional[Number] = None

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

Defaults to 14.

weightclass-attributeinstance-attribute

weight: Optional[FontWeight] = None

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

Defaults to flet.FontWeight.NORMAL.

word_spacingclass-attributeinstance-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, font_family_fallback: Optional[list[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)

Returns a copy of this object with the specified properties overridden.