diff --git a/Cargo.lock b/Cargo.lock index d4937b8e..5ae0a7fd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2661,7 +2661,6 @@ dependencies = [ "paste", "regex", "resvg", - "rust-embed", "rust-i18n", "serde", "serde_json", diff --git a/Cargo.toml b/Cargo.toml index 514ad097..dd380650 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,13 +5,12 @@ default-members = ["crates/story"] resolver = "2" [workspace.dependencies] +gpui = { git = "https://github.com/huacnlee/zed.git", branch = "webview" } gpui-component = { path = "crates/ui" } story = { path = "crates/story" } -gpui = { git = "https://github.com/huacnlee/zed.git", branch = "webview" } anyhow = "1" log = "0.4" -rust-embed = "8.5.0" serde = "1.0.203" serde_json = "1" smallvec = "1" diff --git a/crates/story/Cargo.toml b/crates/story/Cargo.toml index b67d2ef1..edc481ef 100644 --- a/crates/story/Cargo.toml +++ b/crates/story/Cargo.toml @@ -11,14 +11,14 @@ chrono = "0.4" fake = { version = "2.10.0", features = ["dummy"] } gpui.workspace = true gpui-component = { workspace = true, features = ["webview"] } -reqwest_client = { git = "https://github.com/huacnlee/zed.git", branch = "webview" } rand = "0.8" +raw-window-handle = { version = "0.6", features = ["std"] } regex = "1" -rust-embed.workspace = true +reqwest_client = { git = "https://github.com/huacnlee/zed.git", branch = "webview" } +rust-embed = "8.5.0" serde = "1" serde_json = "1" unindent = "0.2.3" -raw-window-handle = { version = "0.6", features = ["std"] } [lints] workspace = true diff --git a/crates/story/src/assets.rs b/crates/story/src/assets.rs index 25b09d9a..8375203f 100644 --- a/crates/story/src/assets.rs +++ b/crates/story/src/assets.rs @@ -5,7 +5,6 @@ use rust_embed::RustEmbed; #[derive(RustEmbed)] #[folder = "../../assets"] -#[include = "fonts/**/*"] #[include = "icons/**/*"] #[exclude = "*.DS_Store"] pub struct Assets; diff --git a/crates/story/src/fixtures/pie.json b/crates/story/src/fixtures/pie.json index 28f87412..8d40ba42 100644 --- a/crates/story/src/fixtures/pie.json +++ b/crates/story/src/fixtures/pie.json @@ -1,6 +1,6 @@ { "border_radius": 8, - "font_family": "Noto Sans", + "font_family": "PingFang SC", "height": 400, "inner_radius": 30, "legend_margin": { @@ -17,7 +17,7 @@ ] }, { - "name": "rose 2", + "name": "玫", "data": [ 38 ] @@ -35,7 +35,7 @@ ] }, { - "name": "rose 5", + "name": "瑰", "data": [ 28 ] @@ -59,7 +59,7 @@ ] } ], - "sub_title_text": "Sub Title", + "sub_title_text": "副標題", "theme": "light", "title_text": "Nightingale Chart", "type": "pie", diff --git a/crates/ui/Cargo.toml b/crates/ui/Cargo.toml index 0dd990e9..4ed1e6e0 100644 --- a/crates/ui/Cargo.toml +++ b/crates/ui/Cargo.toml @@ -23,7 +23,6 @@ once_cell = "1.19.0" paste = "1" regex = "1" resvg = { version = "0.45.0", default-features = false, features = ["text"] } -rust-embed.workspace = true rust-i18n = "3" serde = "1.0.203" serde_json = "1" diff --git a/crates/ui/assets/fonts/NotoSans-Regular.ttf b/crates/ui/assets/fonts/NotoSans-Regular.ttf deleted file mode 100644 index 9b4f9dbb..00000000 Binary files a/crates/ui/assets/fonts/NotoSans-Regular.ttf and /dev/null differ diff --git a/crates/ui/src/lib.rs b/crates/ui/src/lib.rs index 0674bf8e..8100b921 100644 --- a/crates/ui/src/lib.rs +++ b/crates/ui/src/lib.rs @@ -78,16 +78,8 @@ pub use theme::*; use std::ops::Deref; -use rust_embed::RustEmbed; - rust_i18n::i18n!("locales", fallback = "en"); -#[derive(RustEmbed)] -#[folder = "./assets"] -#[include = "fonts/**/*"] -#[exclude = "*.DS_Store"] -pub struct Assets; - /// Initialize the UI module. /// /// This must be called before using any of the UI components. diff --git a/crates/ui/src/svg_img.rs b/crates/ui/src/svg_img.rs index 7f5e2e2e..7fc77a55 100644 --- a/crates/ui/src/svg_img.rs +++ b/crates/ui/src/svg_img.rs @@ -14,15 +14,10 @@ use smallvec::SmallVec; use image::ImageBuffer; -use crate::Assets; - const SCALE: f32 = 2.; -const FONT_PATH: &str = "fonts/NotoSans-Regular.ttf"; static OPTIONS: LazyLock = LazyLock::new(|| { let mut options = usvg::Options::default(); - if let Some(font_data) = Assets::get(FONT_PATH).map(|f| f.data) { - options.fontdb_mut().load_font_data(font_data.into()); - } + options.fontdb_mut().load_system_fonts(); options });