diff options
author | 2019-11-05 03:57:13 +0100 | |
---|---|---|
committer | 2019-11-05 03:57:13 +0100 | |
commit | 0157121038987feb6c2ea3066a21ce25e689888e (patch) | |
tree | 9545408530437eb780ac73c600f7d40968803786 /wgpu/src/renderer.rs | |
parent | 40e9a2f6ae8a9d8576531c79fb57bc53fe5a0acf (diff) | |
download | iced-0157121038987feb6c2ea3066a21ce25e689888e.tar.gz iced-0157121038987feb6c2ea3066a21ce25e689888e.tar.bz2 iced-0157121038987feb6c2ea3066a21ce25e689888e.zip |
Improve default font loading
Diffstat (limited to '')
-rw-r--r-- | wgpu/src/renderer.rs | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/wgpu/src/renderer.rs b/wgpu/src/renderer.rs index c167f2bf..060f07a3 100644 --- a/wgpu/src/renderer.rs +++ b/wgpu/src/renderer.rs @@ -64,14 +64,17 @@ impl Renderer { // TODO: Font customization let font_source = font::Source::new(); - let sans_serif_font = font_source.load(&[font::Family::SansSerif]); - let mono_font = font_source.load(&[font::Family::Monospace]); - - let glyph_brush = GlyphBrushBuilder::using_fonts_bytes(vec![ - sans_serif_font, - mono_font, - ]) - .build(&mut device, TextureFormat::Bgra8UnormSrgb); + let default_font = font_source + .load(&[font::Family::SansSerif, font::Family::Serif]) + .expect("Find sans-serif or serif font"); + + let mono_font = font_source + .load(&[font::Family::Monospace]) + .expect("Find monospace font"); + + let glyph_brush = + GlyphBrushBuilder::using_fonts_bytes(vec![default_font, mono_font]) + .build(&mut device, TextureFormat::Bgra8UnormSrgb); let quad_pipeline = quad::Pipeline::new(&mut device); let image_pipeline = crate::image::Pipeline::new(&mut device); |