From b3c192a2e478e9f2a101aecb417e316ed6900a80 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Fri, 19 Jun 2020 00:08:28 +0200 Subject: Make default text size configurable in `Settings` --- graphics/src/backend.rs | 3 +++ graphics/src/widget/text.rs | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'graphics') diff --git a/graphics/src/backend.rs b/graphics/src/backend.rs index 83510311..b73c636e 100644 --- a/graphics/src/backend.rs +++ b/graphics/src/backend.rs @@ -25,6 +25,9 @@ pub trait Text { /// [`ICON_FONT`]: #associatedconst.ICON_FONt const CHECKMARK_ICON: char; + /// Returns the default size of text. + fn default_size(&self) -> u16; + /// Measures the text contents with the given size and font, /// returning the size of a laid out paragraph that fits in the provided /// bounds. diff --git a/graphics/src/widget/text.rs b/graphics/src/widget/text.rs index 327f8e29..7e22e680 100644 --- a/graphics/src/widget/text.rs +++ b/graphics/src/widget/text.rs @@ -20,7 +20,9 @@ where { type Font = Font; - const DEFAULT_SIZE: u16 = 20; + fn default_size(&self) -> u16 { + self.backend().default_size() + } fn measure( &self, -- cgit