MagicText
The MagicText
represents the base for text element that matches the magic
style.
Properties
style
(inTextStyle
): Used to setcolor
,font_weight
andfont_size
of the text.color
(in brush): The color of the text. (default value: depends on the style)font_family
(in string): The name of the font family selected for rendering the text.font_size
(in length): The font size of the text.font_weight
(in int): The weight of the font. The values range from 100 (lightest) to 900 (thickest). 400 is the normal weight.font_italic
(in bool): Whether or not the font face should be drawn italicized or not. (default value: false)horizontal_alignment
(in enumTextHorizontalAlignment
): The horizontal alignment of the text.letter_spacing
(in length): The letter spacing allows changing the spacing between the glyphs. A positive value increases the spacing and a negative value decreases the distance. (default value: 0)overflow
(in enumTextOverflow
): What happens when the text overflows (default value: clip).text
(in string): The text rendered.vertical_alignment
(in enumTextVerticalAlignment
): The vertical alignment of the text.wrap
(in enumTextWrap
): The way the text wraps (default value:no_wrap
).stroke
(in brush): The brush used for the text outline (default value:transparent
).stroke_width
(in length): The width of the text outline. If the width is zero, then a hairline stroke (1 physical pixel) will be rendered.stroke_style
(in enumTextStrokeStyle
): The style/alignment of the text outline (default value:outside
).
Example
import { MagicText } from "@vivi/magic.slint";
export component Example inherits Window {
width: 200px;
height: 100px;
MagicText {
text: "magic text";
}
}