From 08a5f2a976c4c71aad2011a01fff5782fd5e23e7 Mon Sep 17 00:00:00 2001 From: MaxVerevkin Date: Mon, 17 Apr 2023 12:37:22 +0300 Subject: remove unnecessary Lazy --- src/text.rs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'src/text.rs') diff --git a/src/text.rs b/src/text.rs index 617a60e..dcad438 100644 --- a/src/text.rs +++ b/src/text.rs @@ -1,17 +1,16 @@ use crate::color::Color; -use once_cell::sync::Lazy; use pango::FontDescription; use pangocairo::{cairo, pango}; use serde::Deserialize; use std::f64::consts::{FRAC_PI_2, PI, TAU}; thread_local! { - pub static PANGO_CTX: Lazy = Lazy::new(|| { + pub static PANGO_CTX: pango::Context = { let context = pango::Context::new(); let fontmap = pangocairo::FontMap::new(); context.set_font_map(Some(&fontmap)); context - }); + }; } #[derive(Clone, Debug, PartialEq)] @@ -62,8 +61,6 @@ impl ComputedText { let text = text.replace('\n', "\u{23CE}"); let layout = PANGO_CTX.with(|ctx| pango::Layout::new(ctx)); - layout.set_font_description(Some(attr.font)); - layout.set_font_description(Some(attr.font)); if attr.markup { layout.set_markup(&text); -- cgit v1.3.1