TextStyle
A style describing how to format and paint text.
Properties
baseline- 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- Text background https://flet.dev/docs/types/colors.color- Text foreground https://flet.dev/docs/types/colors.decoration- The decorations to paint near the text (e.g., an underline).decoration_color- The color in which to paint the text decorations.decoration_style- The style in which to paint the text decorations (e.g., dashed).decoration_thickness- The thickness of the decoration stroke as a multiplier of the thickness defined by the font.font_family- See https://flet.dev/docs/controls/text#font_family.font_family_fallback- Ordered fallback font families to use when glyphs are not available in font_family.foreground- The paint drawn as a foreground for the text.height- The height of this text span, as a multiple of the font size.italic- Whether to use italic typeface.letter_spacing- The amount of space (in logical pixels) to add between each letter.overflow- How visual text overflow should be handled.shadow- TBDsize- The size of glyphs (in logical pixels) to use when painting the text.weight- The typeface thickness to use when painting the text (e.g., bold).word_spacing- The amount of space (in logical pixels) to add at each sequence of white-space (i.e.
Methods
copy- Returns a copy of this object with the specified properties overridden.
Properties
baselineclass-attributeinstance-attribute
baseline: Optional[TextBaseline] = NoneThe 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] = NoneText background https://flet.dev/docs/types/colors.
colorclass-attributeinstance-attribute
color: Optional[ColorValue] = NoneText foreground https://flet.dev/docs/types/colors.
decorationclass-attributeinstance-attribute
decoration: Optional[TextDecoration] = NoneThe decorations to paint near the text (e.g., an underline).
decoration_colorclass-attributeinstance-attribute
decoration_color: Optional[ColorValue] = NoneThe color in which to paint the text decorations.
decoration_styleclass-attributeinstance-attribute
decoration_style: Optional[TextDecorationStyle] = NoneThe style in which to paint the text decorations (e.g., dashed).
Defaults to TextDecorationStyle.SOLID.
decoration_thicknessclass-attributeinstance-attribute
decoration_thickness: Optional[Number] = NoneThe thickness of the decoration stroke as a multiplier of the thickness defined by the font.
font_familyclass-attributeinstance-attribute
font_family: Optional[str] = Nonefont_family_fallbackclass-attributeinstance-attribute
font_family_fallback: Optional[list[str]] = NoneOrdered fallback font families to use when glyphs are not available in font_family.
foregroundclass-attributeinstance-attribute
foreground: Optional[Paint] = NoneThe paint drawn as a foreground for the text.
heightclass-attributeinstance-attribute
height: Optional[Number] = NoneThe height of this text span, as a multiple of the font size.
See detailed explanation here.
letter_spacingclass-attributeinstance-attribute
letter_spacing: Optional[Number] = NoneThe 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] = NoneHow visual text overflow should be handled.
sizeclass-attributeinstance-attribute
size: Optional[Number] = NoneThe size of glyphs (in logical pixels) to use when painting the text.
Defaults to 14.
weightclass-attributeinstance-attribute
weight: Optional[FontWeight] = NoneThe typeface thickness to use when painting the text (e.g., bold).
Defaults to flet.FontWeight.NORMAL.
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.