Embed and use Fira Sans as default font when testing
This commit is contained in:
parent
7683bd201f
commit
6572909ab5
9 changed files with 12 additions and 12 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -4,4 +4,3 @@ pkg/
|
|||
Cargo.lock
|
||||
dist/
|
||||
traces/
|
||||
*.sha256
|
||||
|
|
|
|||
|
|
@ -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"]
|
||||
|
|
|
|||
|
|
@ -10,4 +10,4 @@ iced.workspace = true
|
|||
|
||||
[target.'cfg(target_arch = "wasm32")'.dependencies]
|
||||
iced.workspace = true
|
||||
iced.features = ["webgl"]
|
||||
iced.features = ["webgl", "fira-sans"]
|
||||
|
|
|
|||
|
|
@ -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"] }
|
||||
|
|
|
|||
1
examples/todos/snapshots/creates_a_new_task.sha256
Normal file
1
examples/todos/snapshots/creates_a_new_task.sha256
Normal file
|
|
@ -0,0 +1 @@
|
|||
b41c73d214894bf5f94f787e5f265cff6500822b2d4a29a4ac0c847a71db7123
|
||||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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(),
|
||||
)),
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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),
|
||||
));
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue