diff options
author | 2019-11-04 02:10:39 +0100 | |
---|---|---|
committer | 2019-11-06 02:43:38 +0100 | |
commit | 1e021fd034cc2b7df850c867371a81a4765582ba (patch) | |
tree | b6e82ca2bccd981f4781190ff10b4b0d2b642560 /wgpu | |
parent | 7b4fe6b7cc77ef3bf028411b62408b86bcbe78b1 (diff) | |
download | iced-1e021fd034cc2b7df850c867371a81a4765582ba.tar.gz iced-1e021fd034cc2b7df850c867371a81a4765582ba.tar.bz2 iced-1e021fd034cc2b7df850c867371a81a4765582ba.zip |
Fix Tour for HiDPI (stub)
Diffstat (limited to 'wgpu')
-rw-r--r-- | wgpu/src/renderer/widget/text.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/wgpu/src/renderer/widget/text.rs b/wgpu/src/renderer/widget/text.rs index 82f75f09..082ce640 100644 --- a/wgpu/src/renderer/widget/text.rs +++ b/wgpu/src/renderer/widget/text.rs @@ -6,6 +6,8 @@ use wgpu_glyph::{GlyphCruncher, Section}; use std::cell::RefCell; use std::f32; +pub const DEFAULT_TEXT_SIZE : f32 = 20.0*3.0; + impl text::Renderer for Renderer { fn node(&self, text: &Text) -> Node { let glyph_brush = self.glyph_brush.clone(); @@ -18,7 +20,7 @@ impl text::Renderer for Renderer { // I noticed that the first measure is the one that matters in // practice. Here, we use a RefCell to store the cached measurement. let measure = RefCell::new(None); - let size = text.size.map(f32::from).unwrap_or(20.0); + let size = text.size.map(f32::from).unwrap_or(DEFAULT_TEXT_SIZE); let style = Style::default().width(text.width); @@ -71,7 +73,7 @@ impl text::Renderer for Renderer { ( Primitive::Text { content: text.content.clone(), - size: f32::from(text.size.unwrap_or(20)), + size: text.size.map(f32::from).unwrap_or(DEFAULT_TEXT_SIZE), bounds: layout.bounds(), color: text.color.unwrap_or(Color::BLACK), horizontal_alignment: text.horizontal_alignment, |