summaryrefslogtreecommitdiffstats
path: root/wgpu/src/text.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón <hector0193@gmail.com>2019-11-14 06:48:32 +0100
committerLibravatar GitHub <noreply@github.com>2019-11-14 06:48:32 +0100
commitc8d4774704f970bb26eb5d9903b7a741b1c225e3 (patch)
tree1ceabb28d98c4f4cc9a556d2a5328ce8b7163130 /wgpu/src/text.rs
parentaf5ec4941270c832557994d9b4cc70ce5feac911 (diff)
parent2c8ba652a7929ac6c2af28ac60a8bd4b8e8e2f10 (diff)
downloadiced-c8d4774704f970bb26eb5d9903b7a741b1c225e3.tar.gz
iced-c8d4774704f970bb26eb5d9903b7a741b1c225e3.tar.bz2
iced-c8d4774704f970bb26eb5d9903b7a741b1c225e3.zip
Merge pull request #56 from hecrj/example/filter-todos
Draw checkmark icon and filter todos
Diffstat (limited to 'wgpu/src/text.rs')
-rw-r--r--wgpu/src/text.rs13
1 files changed, 10 insertions, 3 deletions
diff --git a/wgpu/src/text.rs b/wgpu/src/text.rs
index 3205fe55..da070f5c 100644
--- a/wgpu/src/text.rs
+++ b/wgpu/src/text.rs
@@ -5,6 +5,13 @@ use crate::Transformation;
use std::cell::RefCell;
use std::collections::HashMap;
+pub const BUILTIN_ICONS: iced_native::Font = iced_native::Font::External {
+ name: "iced_wgpu icons",
+ bytes: include_bytes!("text/icons.ttf"),
+};
+
+pub const CHECKMARK_ICON: char = '\u{F00C}';
+
pub struct Pipeline {
draw_brush: RefCell<wgpu_glyph::GlyphBrush<'static, ()>>,
draw_font_map: RefCell<HashMap<String, wgpu_glyph::FontId>>,
@@ -91,10 +98,10 @@ impl Pipeline {
// 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 font.
+ // contain this, hence we subtract 1.
//
- // This should go away once we improve the debug view and integrate
- // it as just another UI app.
+ // This should go away once we unify `draw_brush` and
+ // `measure_brush`.
font_id: wgpu_glyph::FontId(font_id - 1),
..Default::default()
};