pub enum DrawStyle {
Fill,
Stroke {
width: f32,
cap: StrokeCap,
join: StrokeJoin,
miter: f32,
path_effect: Option<PathEffect>,
},
FillAndStroke {
width: f32,
cap: StrokeCap,
join: StrokeJoin,
miter: f32,
path_effect: Option<PathEffect>,
outline_color: Option<Color>,
},
}Expand description
Draw style for text (fill or stroke).
Variants§
Fill
Stroke
Fields
join: StrokeJoinLine join style for stroke segment joins.
path_effect: Option<PathEffect>Optional path effect (dash, corner rounding, etc.).
FillAndStroke
Fill plus an outline in the same color. Renders the fill first, then the stroke on top (same layout; stroke width in em-units). Faux-bold for fonts without a bold face: single layout pass, no extra view needed.
Fields
join: StrokeJoinLine join style for stroke segment joins.
path_effect: Option<PathEffect>Optional path effect (dash, corner rounding, etc.).
Implementations§
Source§impl DrawStyle
impl DrawStyle
Sourcepub const fn stroke(width: f32) -> Self
pub const fn stroke(width: f32) -> Self
Create a Stroke variant with default cap, join, miter, and no path effect.
Sourcepub const fn fill_and_stroke(width: f32) -> Self
pub const fn fill_and_stroke(width: f32) -> Self
Create a FillAndStroke variant with default cap, join, miter,
and no path effect, stroking in the text’s own color.
Sourcepub const fn fill_and_stroke_with_outline(
width: f32,
outline_color: Color,
) -> Self
pub const fn fill_and_stroke_with_outline( width: f32, outline_color: Color, ) -> Self
fill_and_stroke with a contrasting stroke,
drawn beneath the fill. width is em-units and the stroke is
centred on the glyph outline, so pass 2 * outline_px / font_px to
grow outline_px outward like Godot’s font_outline_size.
Sourcepub const fn stroke_params(
&self,
) -> Option<(f32, StrokeCap, StrokeJoin, f32, &Option<PathEffect>)>
pub const fn stroke_params( &self, ) -> Option<(f32, StrokeCap, StrokeJoin, f32, &Option<PathEffect>)>
Outline parameters when this style draws a stroke, else None.
Sourcepub const fn draws_fill(&self) -> bool
pub const fn draws_fill(&self) -> bool
Whether this style draws the glyph fill.