From 2d77969c7719e72237ec365c3db9e35c3e178631 Mon Sep 17 00:00:00 2001 From: MaxVerevkin Date: Tue, 9 Aug 2022 22:19:56 +0300 Subject: refactoring --- src/tags.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/tags.rs') diff --git a/src/tags.rs b/src/tags.rs index 8114a74..0c63570 100644 --- a/src/tags.rs +++ b/src/tags.rs @@ -1,4 +1,4 @@ -use crate::text::{Attributes, ComputedText, Text}; +use crate::text::{Attributes, ComputedText}; use cairo::Context; use pango::FontDescription; use pangocairo::{cairo, pango}; @@ -28,9 +28,10 @@ impl TagsInfo { } } -pub fn compute_tag_label(label: String, font: FontDescription, context: &Context) -> ComputedText { - let text = Text { - attr: Attributes { +pub fn compute_tag_label(label: &str, font: FontDescription, context: &Context) -> ComputedText { + ComputedText::new( + label, + Attributes { font, padding_left: 25.0, padding_right: 25.0, @@ -38,7 +39,6 @@ pub fn compute_tag_label(label: String, font: FontDescription, context: &Context align: Default::default(), markup: false, }, - text: label, - }; - text.compute(context) + context, + ) } -- cgit v1.3.1