From 0492eb3c11705602e34980861a5ef85c5a9ad827 Mon Sep 17 00:00:00 2001 From: Nico Burns Date: Mon, 22 Jul 2024 18:03:34 +1200 Subject: [PATCH] Add text_brush method --- parley/src/editor/layout.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/parley/src/editor/layout.rs b/parley/src/editor/layout.rs index 600c18c..06a88a8 100644 --- a/parley/src/editor/layout.rs +++ b/parley/src/editor/layout.rs @@ -70,6 +70,15 @@ pub enum TextBrush { }, } +impl TextBrush { + pub fn text_brush(&self) -> &peniko::Brush { + match self { + TextBrush::Normal(brush) => brush, + TextBrush::Highlight { text, .. } => text, + } + } +} + impl From for TextBrush { fn from(value: peniko::Brush) -> Self { Self::Normal(value)