Add text stroke properties to Text element

This commit is contained in:
Noah Sweilem 2024-04-02 11:43:34 -07:00 committed by Simon Hausmann
parent 2357d64e8f
commit 6ede27a364
3 changed files with 15 additions and 1 deletions

View file

@ -56,6 +56,14 @@ macro_rules! for_each_enums {
Elide,
}
/// This enum describes the positioning of a text stroke relative to the border of the glyphs in a [`Text`](elements.md#text).
enum TextStrokeStyle {
/// The inside edge of the stroke is at the outer edge of the text.
Outside,
/// The center line of the stroke is at the outer edge of the text, like in Adobe Illustrator.
Center,
}
/// This enum describes whether an event was rejected or accepted by an event handler.
enum EventResult {
/// The event is rejected by this event handler and may then be handled by the parent item

View file

@ -102,6 +102,9 @@ export component Text inherits Empty {
in property <TextOverflow> overflow;
in property <TextWrap> wrap;
in property <length> letter-spacing;
in property <brush> stroke;
in property <length> stroke-width;
in property <TextStrokeStyle> stroke-style;
//-default_size_binding:implicit_size
}

View file

@ -10,7 +10,7 @@ Lookup the [`crate::items`] module documentation.
use super::{
InputType, Item, ItemConsts, ItemRc, KeyEventResult, KeyEventType, PointArg,
PointerEventButton, RenderingResult, TextHorizontalAlignment, TextOverflow,
TextVerticalAlignment, TextWrap, VoidArg,
TextStrokeStyle, TextVerticalAlignment, TextWrap, VoidArg,
};
use crate::graphics::{Brush, Color, FontRequest};
use crate::input::{
@ -51,6 +51,9 @@ pub struct Text {
pub wrap: Property<TextWrap>,
pub overflow: Property<TextOverflow>,
pub letter_spacing: Property<LogicalLength>,
pub stroke: Property<Brush>,
pub stroke_width: Property<LogicalLength>,
pub stroke_style: Property<TextStrokeStyle>,
pub width: Property<LogicalLength>,
pub height: Property<LogicalLength>,
pub cached_rendering_data: CachedRenderingData,