diff options
author | 2023-02-04 07:33:33 +0100 | |
---|---|---|
committer | 2023-02-24 13:28:24 +0100 | |
commit | b29de28d1f0f608f8029c93d154cfd1b0f8b8cbb (patch) | |
tree | e100af1dd98d23b29046bc951b04b440d2aa5bc2 /wgpu/src/backend.rs | |
parent | a7580e0696a1a0ba76a89db3f78bc99ba3fbb361 (diff) | |
download | iced-b29de28d1f0f608f8029c93d154cfd1b0f8b8cbb.tar.gz iced-b29de28d1f0f608f8029c93d154cfd1b0f8b8cbb.tar.bz2 iced-b29de28d1f0f608f8029c93d154cfd1b0f8b8cbb.zip |
Overhaul `Font` type to allow font family selection
Diffstat (limited to 'wgpu/src/backend.rs')
-rw-r--r-- | wgpu/src/backend.rs | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/wgpu/src/backend.rs b/wgpu/src/backend.rs index 9bf464b3..874edb96 100644 --- a/wgpu/src/backend.rs +++ b/wgpu/src/backend.rs @@ -27,6 +27,7 @@ pub struct Backend { #[cfg(any(feature = "image", feature = "svg"))] image_pipeline: image::Pipeline, + default_font: Font, default_text_size: f32, } @@ -38,14 +39,7 @@ impl Backend { settings: Settings, format: wgpu::TextureFormat, ) -> Self { - let text_pipeline = text::Pipeline::new( - device, - queue, - format, - settings.default_font, - settings.text_multithreading, - ); - + let text_pipeline = text::Pipeline::new(device, queue, format); let quad_pipeline = quad::Pipeline::new(device, format); let triangle_pipeline = triangle::Pipeline::new(device, format, settings.antialiasing); @@ -61,6 +55,7 @@ impl Backend { #[cfg(any(feature = "image", feature = "svg"))] image_pipeline, + default_font: settings.default_font, default_text_size: settings.default_text_size, } } @@ -199,9 +194,13 @@ impl iced_graphics::Backend for Backend { } impl backend::Text for Backend { - const ICON_FONT: Font = Font::Default; // TODO - const CHECKMARK_ICON: char = '✓'; - const ARROW_DOWN_ICON: char = '▼'; + const ICON_FONT: Font = Font::Name("Iced-Icons"); + const CHECKMARK_ICON: char = '\u{e800}'; + const ARROW_DOWN_ICON: char = '\u{f00c}'; + + fn default_font(&self) -> Font { + self.default_font + } fn default_size(&self) -> f32 { self.default_text_size |