From dba5b87689ba013f93f55be49a69b7a8542b75eb Mon Sep 17 00:00:00 2001 From: MaxVerevkin Date: Fri, 7 Apr 2023 09:45:20 +0300 Subject: render newlines as ⏎ MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/text.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/text.rs b/src/text.rs index 9b27a11..255005a 100644 --- a/src/text.rs +++ b/src/text.rs @@ -49,12 +49,14 @@ pub struct ComputedText { impl ComputedText { pub fn new(text: &str, mut attr: Attributes, context: &cairo::Context) -> Self { + let text = text.replace('\n', "\u{23CE}"); + let layout = pangocairo::create_layout(context); layout.set_font_description(Some(attr.font)); if attr.markup { - layout.set_markup(text); + layout.set_markup(&text); } else { - layout.set_text(text); + layout.set_text(&text); } let (text_width, text_height) = layout.pixel_size(); -- cgit v1.3.1