summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2024-12-12 03:14:40 +0100
committerLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2024-12-12 03:15:32 +0100
commit6572909ab5b004176f6d261b67b4caa99f1f54bb (patch)
tree115e8a7d34df5f2089c2ac2fdbddf3f12381b29c
parent7683bd201f156c6e80309584a9bdc205810b0e2e (diff)
downloadiced-6572909ab5b004176f6d261b67b4caa99f1f54bb.tar.gz
iced-6572909ab5b004176f6d261b67b4caa99f1f54bb.tar.bz2
iced-6572909ab5b004176f6d261b67b4caa99f1f54bb.zip
Embed and use Fira Sans as default font when testing
-rw-r--r--.gitignore1
-rw-r--r--Cargo.toml6
-rw-r--r--examples/counter/Cargo.toml2
-rw-r--r--examples/todos/Cargo.toml2
-rw-r--r--examples/todos/snapshots/creates_a_new_task.sha2561
-rw-r--r--examples/tour/Cargo.toml2
-rw-r--r--graphics/src/text.rs6
-rw-r--r--test/Cargo.toml2
-rw-r--r--test/src/lib.rs2
9 files changed, 12 insertions, 12 deletions
diff --git a/.gitignore b/.gitignore
index 05f89b63..f05ec438 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,4 +4,3 @@ pkg/
Cargo.lock
dist/
traces/
-*.sha256
diff --git a/Cargo.toml b/Cargo.toml
index 51528ce2..60ec304c 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -22,7 +22,7 @@ all-features = true
maintenance = { status = "actively-developed" }
[features]
-default = ["wgpu", "tiny-skia", "fira-sans", "auto-detect-theme"]
+default = ["wgpu", "tiny-skia", "auto-detect-theme"]
# Enables the `wgpu` GPU-accelerated renderer backend
wgpu = ["iced_renderer/wgpu", "iced_widget/wgpu"]
# Enables the `tiny-skia` software renderer backend
@@ -53,13 +53,13 @@ smol = ["iced_futures/smol"]
system = ["iced_winit/system"]
# Enables broken "sRGB linear" blending to reproduce color management of the Web
web-colors = ["iced_renderer/web-colors"]
-# Enables the WebGL backend, replacing WebGPU
+# Enables the WebGL backend
webgl = ["iced_renderer/webgl"]
# Enables syntax highligthing
highlighter = ["iced_highlighter", "iced_widget/highlighter"]
# Enables the advanced module
advanced = ["iced_core/advanced", "iced_widget/advanced"]
-# Embeds Fira Sans as the default font on Wasm builds
+# Embeds Fira Sans into the final application; useful for testing and Wasm builds
fira-sans = ["iced_renderer/fira-sans"]
# Auto-detects light/dark mode for the built-in theme
auto-detect-theme = ["iced_core/auto-detect-theme"]
diff --git a/examples/counter/Cargo.toml b/examples/counter/Cargo.toml
index 22f86064..e916a1a1 100644
--- a/examples/counter/Cargo.toml
+++ b/examples/counter/Cargo.toml
@@ -10,4 +10,4 @@ iced.workspace = true
[target.'cfg(target_arch = "wasm32")'.dependencies]
iced.workspace = true
-iced.features = ["webgl"]
+iced.features = ["webgl", "fira-sans"]
diff --git a/examples/todos/Cargo.toml b/examples/todos/Cargo.toml
index 65c34a8f..16f4fdd2 100644
--- a/examples/todos/Cargo.toml
+++ b/examples/todos/Cargo.toml
@@ -20,7 +20,7 @@ tracing-subscriber = "0.3"
[target.'cfg(target_arch = "wasm32")'.dependencies]
iced.workspace = true
-iced.features = ["debug", "webgl"]
+iced.features = ["debug", "webgl", "fira-sans"]
uuid = { version = "1.0", features = ["js"] }
web-sys = { workspace = true, features = ["Window", "Storage"] }
diff --git a/examples/todos/snapshots/creates_a_new_task.sha256 b/examples/todos/snapshots/creates_a_new_task.sha256
new file mode 100644
index 00000000..75d5f2ce
--- /dev/null
+++ b/examples/todos/snapshots/creates_a_new_task.sha256
@@ -0,0 +1 @@
+b41c73d214894bf5f94f787e5f265cff6500822b2d4a29a4ac0c847a71db7123 \ No newline at end of file
diff --git a/examples/tour/Cargo.toml b/examples/tour/Cargo.toml
index 9e984ad1..719d355f 100644
--- a/examples/tour/Cargo.toml
+++ b/examples/tour/Cargo.toml
@@ -14,7 +14,7 @@ tracing-subscriber = "0.3"
[target.'cfg(target_arch = "wasm32")'.dependencies]
iced.workspace = true
-iced.features = ["image", "debug", "webgl"]
+iced.features = ["image", "debug", "webgl", "fira-sans"]
console_error_panic_hook = "0.1"
console_log = "1.0"
diff --git a/graphics/src/text.rs b/graphics/src/text.rs
index feb9932a..e6f06b61 100644
--- a/graphics/src/text.rs
+++ b/graphics/src/text.rs
@@ -149,8 +149,8 @@ impl Text {
/// It is loaded as part of the default fonts in Wasm builds.
///
/// [Fira Sans]: https://mozilla.github.io/Fira/
-#[cfg(all(target_arch = "wasm32", feature = "fira-sans"))]
-pub const FIRA_SANS_REGULAR: &'static [u8] =
+#[cfg(feature = "fira-sans")]
+pub const FIRA_SANS_REGULAR: &[u8] =
include_bytes!("../fonts/FiraSans-Regular.ttf").as_slice();
/// Returns the global [`FontSystem`].
@@ -163,7 +163,7 @@ pub fn font_system() -> &'static RwLock<FontSystem> {
cosmic_text::fontdb::Source::Binary(Arc::new(
include_bytes!("../fonts/Iced-Icons.ttf").as_slice(),
)),
- #[cfg(all(target_arch = "wasm32", feature = "fira-sans"))]
+ #[cfg(feature = "fira-sans")]
cosmic_text::fontdb::Source::Binary(Arc::new(
include_bytes!("../fonts/FiraSans-Regular.ttf").as_slice(),
)),
diff --git a/test/Cargo.toml b/test/Cargo.toml
index f6f4f45a..c63a9e14 100644
--- a/test/Cargo.toml
+++ b/test/Cargo.toml
@@ -18,7 +18,7 @@ iced_runtime.workspace = true
iced_tiny_skia.workspace = true
iced_renderer.workspace = true
-iced_renderer.features = ["tiny-skia"]
+iced_renderer.features = ["tiny-skia", "fira-sans"]
png.workspace = true
sha2.workspace = true
diff --git a/test/src/lib.rs b/test/src/lib.rs
index c9096211..232b447e 100644
--- a/test/src/lib.rs
+++ b/test/src/lib.rs
@@ -33,7 +33,7 @@ pub fn interface<'a, Message, Theme>(
let size = Size::new(512.0, 512.0);
let mut renderer = Renderer::Secondary(tiny_skia::Renderer::new(
- Font::default(),
+ Font::with_name("Fira Sans"),
Pixels(16.0),
));