summaryrefslogtreecommitdiffstats
path: root/graphics/src
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón <hector0193@gmail.com>2020-06-19 19:24:52 +0200
committerLibravatar GitHub <noreply@github.com>2020-06-19 19:24:52 +0200
commit1432c82bdf43c6febd6a9153a71302e37347e524 (patch)
treeaebde6403c3a6cef9566cca64e185272fcbbfcbd /graphics/src
parentd19c02035ff5e4a895868023bd67f3df1f5d7007 (diff)
parentb3c192a2e478e9f2a101aecb417e316ed6900a80 (diff)
downloadiced-1432c82bdf43c6febd6a9153a71302e37347e524.tar.gz
iced-1432c82bdf43c6febd6a9153a71302e37347e524.tar.bz2
iced-1432c82bdf43c6febd6a9153a71302e37347e524.zip
Merge pull request #413 from hecrj/feature/configurable-default-text-size
Make default text size configurable in `Settings`
Diffstat (limited to 'graphics/src')
-rw-r--r--graphics/src/backend.rs3
-rw-r--r--graphics/src/widget/text.rs4
2 files changed, 6 insertions, 1 deletions
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,