diff --git a/graphics/src/geometry/frame.rs b/graphics/src/geometry/frame.rs index 3dee7e75..29b534f8 100644 --- a/graphics/src/geometry/frame.rs +++ b/graphics/src/geometry/frame.rs @@ -217,6 +217,11 @@ pub trait Backend: Sized { size: Size, stroke: impl Into>, ); + fn stroke_text<'a>( + &mut self, + text: impl Into, + stroke: impl Into>, + ); fn fill(&mut self, path: &Path, fill: impl Into); fn fill_text(&mut self, text: impl Into); @@ -272,6 +277,12 @@ impl Backend for () { _stroke: impl Into>, ) { } + fn stroke_text<'a>( + &mut self, + _text: impl Into, + _stroke: impl Into>, + ) { + } fn fill(&mut self, _path: &Path, _fill: impl Into) {} fn fill_text(&mut self, _text: impl Into) {} diff --git a/renderer/src/fallback.rs b/renderer/src/fallback.rs index 7223f06f..79e22c77 100644 --- a/renderer/src/fallback.rs +++ b/renderer/src/fallback.rs @@ -537,6 +537,14 @@ mod geometry { ); } + fn stroke_text<'a>( + &mut self, + text: impl Into, + stroke: impl Into>, + ) { + delegate!(self, frame, frame.stroke_text(text, stroke)); + } + fn fill_text(&mut self, text: impl Into) { delegate!(self, frame, frame.fill_text(text)); } diff --git a/tiny_skia/src/geometry.rs b/tiny_skia/src/geometry.rs index 11367b7c..af55f2a5 100644 --- a/tiny_skia/src/geometry.rs +++ b/tiny_skia/src/geometry.rs @@ -245,6 +245,17 @@ impl geometry::frame::Backend for Frame { } } + fn stroke_text<'a>( + &mut self, + text: impl Into, + stroke: impl Into>, + ) { + let text = text.into(); + let stroke = stroke.into(); + + text.draw_with(|path, _color| self.stroke(&path, stroke)); + } + fn push_transform(&mut self) { self.stack.push(self.transform); } diff --git a/wgpu/src/geometry.rs b/wgpu/src/geometry.rs index da98e479..c3c66464 100644 --- a/wgpu/src/geometry.rs +++ b/wgpu/src/geometry.rs @@ -291,6 +291,17 @@ impl geometry::frame::Backend for Frame { .expect("Stroke rectangle"); } + fn stroke_text<'a>( + &mut self, + text: impl Into, + stroke: impl Into>, + ) { + let text = text.into(); + let stroke = stroke.into(); + + text.draw_with(|glyph, _color| self.stroke(&glyph, stroke)); + } + fn fill_text(&mut self, text: impl Into) { let text = text.into();