summaryrefslogtreecommitdiffstats
path: root/wgpu/src/text.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2019-11-26 15:33:38 +0100
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2019-11-26 15:33:38 +0100
commit80a8a574712f1652c7311554ad358c5bc15d5515 (patch)
tree4858ad7a2f5566c1f9f54c9a9c57ec01cf45fb32 /wgpu/src/text.rs
parenta99aa1dd61e15e28d93c0719037b6683f32e310e (diff)
downloadiced-80a8a574712f1652c7311554ad358c5bc15d5515.tar.gz
iced-80a8a574712f1652c7311554ad358c5bc15d5515.tar.bz2
iced-80a8a574712f1652c7311554ad358c5bc15d5515.zip
Stop loading a mono font just for the debug view
Diffstat (limited to 'wgpu/src/text.rs')
-rw-r--r--wgpu/src/text.rs18
1 files changed, 3 insertions, 15 deletions
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<u8>| {
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;