summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--examples/tour.rs2
-rw-r--r--wgpu/src/renderer/widget/text.rs6
2 files changed, 5 insertions, 3 deletions
diff --git a/examples/tour.rs b/examples/tour.rs
index c5daa2c5..238b04f1 100644
--- a/examples/tour.rs
+++ b/examples/tour.rs
@@ -76,7 +76,7 @@ impl Application for Tour {
}
let element: Element<_> = Column::new()
- .max_width(Length::Units(540))
+ .max_width(Length::Units((540.0*3.0) as u16))
.spacing(20)
.padding(20)
.push(steps.view(self.debug).map(Message::StepMessage))
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,