summaryrefslogtreecommitdiffstats
path: root/wgpu
diff options
context:
space:
mode:
Diffstat (limited to 'wgpu')
-rw-r--r--wgpu/Cargo.toml3
-rw-r--r--wgpu/src/text.rs17
2 files changed, 13 insertions, 7 deletions
diff --git a/wgpu/Cargo.toml b/wgpu/Cargo.toml
index 3bbc57a0..db3104c4 100644
--- a/wgpu/Cargo.toml
+++ b/wgpu/Cargo.toml
@@ -10,6 +10,7 @@ repository = "https://github.com/hecrj/iced"
[features]
svg = ["resvg"]
canvas = ["iced_graphics/canvas"]
+default_system_font = ["iced_graphics/font-source"]
[dependencies]
wgpu = "0.5"
@@ -32,7 +33,7 @@ path = "../native"
[dependencies.iced_graphics]
version = "0.1"
path = "../graphics"
-features = ["font-source", "font-fallback", "font-icons"]
+features = ["font-fallback", "font-icons"]
[dependencies.image]
version = "0.23"
diff --git a/wgpu/src/text.rs b/wgpu/src/text.rs
index 5ee7b856..a7123d39 100644
--- a/wgpu/src/text.rs
+++ b/wgpu/src/text.rs
@@ -16,15 +16,20 @@ impl Pipeline {
format: wgpu::TextureFormat,
default_font: Option<&[u8]>,
) -> Self {
+ let default_font = default_font.map(|slice| slice.to_vec());
+
// TODO: Font customization
- let font_source = font::Source::new();
+ #[cfg(feature = "default_system_font")]
+ let default_font = {
+ default_font.or_else(|| {
+ font::Source::new()
+ .load(&[font::Family::SansSerif, font::Family::Serif])
+ .ok()
+ })
+ };
let default_font =
- default_font.map(|slice| slice.to_vec()).unwrap_or_else(|| {
- font_source
- .load(&[font::Family::SansSerif, font::Family::Serif])
- .unwrap_or_else(|_| font::FALLBACK.to_vec())
- });
+ default_font.unwrap_or_else(|| font::FALLBACK.to_vec());
let font = ab_glyph::FontArc::try_from_vec(default_font)
.unwrap_or_else(|_| {