From 80a8a574712f1652c7311554ad358c5bc15d5515 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Tue, 26 Nov 2019 15:33:38 +0100 Subject: Stop loading a mono font just for the debug view --- wgpu/src/text.rs | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) (limited to 'wgpu/src/text.rs') diff --git a/wgpu/src/text.rs b/wgpu/src/text.rs index f29440c7..e9a1602f 100644 --- a/wgpu/src/text.rs +++ b/wgpu/src/text.rs @@ -30,15 +30,10 @@ impl Pipeline { .load(&[font::Family::SansSerif, font::Family::Serif]) .unwrap_or_else(|_| FALLBACK_FONT.to_vec()); - let mono_font = font_source - .load(&[font::Family::Monospace]) - .unwrap_or_else(|_| FALLBACK_FONT.to_vec()); - let load_glyph_brush = |font: Vec| { let builder = wgpu_glyph::GlyphBrushBuilder::using_fonts_bytes(vec![ - mono_font.clone(), - font.clone(), + font.clone() ])?; Ok(( @@ -109,14 +104,7 @@ impl Pipeline { text: content, scale: wgpu_glyph::Scale { x: size, y: size }, bounds: (bounds.width, bounds.height), - - // TODO: This is a bit hacky. We are loading the debug font as the - // first font in the `draw_brush`. The `measure_brush` does not - // contain this, hence we subtract 1. - // - // This should go away once we unify `draw_brush` and - // `measure_brush`. - font_id: wgpu_glyph::FontId(font_id - 1), + font_id: wgpu_glyph::FontId(font_id), ..Default::default() }; @@ -157,7 +145,7 @@ impl Pipeline { pub fn find_font(&self, font: iced_native::Font) -> wgpu_glyph::FontId { match font { - iced_native::Font::Default => wgpu_glyph::FontId(1), + iced_native::Font::Default => wgpu_glyph::FontId(0), iced_native::Font::External { name, bytes } => { if let Some(font_id) = self.draw_font_map.borrow().get(name) { return *font_id; -- cgit