Move text logic in iced_wgpu to a text module

This commit is contained in:
Héctor Ramón Jiménez 2019-11-13 03:54:36 +01:00
parent 73f3c90007
commit f0b1e65ba4
6 changed files with 131 additions and 82 deletions

View file

@ -1,7 +1,7 @@
use crate::{Primitive, Renderer};
use iced_native::{layout, text, Color, Layout, MouseCursor, Size, Text};
use wgpu_glyph::{GlyphCruncher, Section};
use wgpu_glyph::Section;
use std::f32;
@ -21,13 +21,7 @@ impl text::Renderer for Renderer {
..Default::default()
};
let (width, height) = if let Some(bounds) =
self.text_measurements.borrow_mut().glyph_bounds(&section)
{
(bounds.width().ceil(), bounds.height().ceil())
} else {
(0.0, 0.0)
};
let (width, height) = self.text_pipeline.measure(&section);
let size = limits.resolve(Size::new(width, height));