Remove rust-embed as a dependency

This is a rather heavy dependency that's easily replaceable using only
the standard library. This brings the number of dependencies down from
368 to 362 (on Linux).
macos-click-through
mforsb 3 years ago committed by Keith Simmons
parent e3911e63d4
commit 768a589576

@ -23,7 +23,6 @@ euclid = "0.20.7"
lru = "0.4.3"
derive-new = "0.5"
rmpv = "0.4.4"
rust-embed = { version = "5.2.0", features = ["debug-embed"] }
image = { version = "0.22.3", default-features = false, features = ["ico"] }
nvim-rs = { git = "https://github.com/KillTheMule/nvim-rs", branch = "master", features = ["use_tokio"] }
tokio = { version = "1.1.1", features = ["full"] }

@ -27,8 +27,6 @@ pub mod windows_utils;
#[macro_use]
extern crate derive_new;
#[macro_use]
extern crate rust_embed;
#[macro_use]
extern crate lazy_static;
use std::sync::{atomic::AtomicBool, mpsc::channel, Arc};

@ -6,12 +6,8 @@ use skia_safe::{font::Edging, Data, Font, FontHinting, FontMgr, FontStyle, Typef
use super::font_options::FontOptions;
use super::swash_font::SwashFont;
#[derive(RustEmbed)]
#[folder = "assets/fonts/"]
pub struct Asset;
const DEFAULT_FONT: &str = "FiraCode-Regular.ttf";
const LAST_RESORT_FONT: &str = "LastResort-Regular.ttf";
static DEFAULT_FONT: &[u8] = include_bytes!("../../../assets/fonts/FiraCode-Regular.ttf");
static LAST_RESORT_FONT: &[u8] = include_bytes!("../../../assets/fonts/LastResort-Regular.ttf");
pub struct FontPair {
pub skia_font: Font,
@ -141,14 +137,12 @@ impl FontLoader {
FontPair::new(Font::from_typeface(typeface, self.font_size))
}
FontSelection::Default => {
let default_font_data = Asset::get(DEFAULT_FONT).unwrap();
let data = Data::new_copy(&default_font_data);
let data = Data::new_copy(DEFAULT_FONT);
let typeface = Typeface::from_data(data, 0).unwrap();
FontPair::new(Font::from_typeface(typeface, self.font_size))
}
FontSelection::LastResort => {
let default_font_data = Asset::get(LAST_RESORT_FONT).unwrap();
let data = Data::new_copy(&default_font_data);
let data = Data::new_copy(LAST_RESORT_FONT);
let typeface = Typeface::from_data(data, 0).unwrap();
FontPair::new(Font::from_typeface(typeface, self.font_size))
}

@ -41,9 +41,7 @@ use keyboard_manager::KeyboardManager;
use mouse_manager::MouseManager;
use renderer::SkiaRenderer;
#[derive(RustEmbed)]
#[folder = "assets/"]
struct Asset;
static ICON: &[u8] = include_bytes!("../../../assets/neovide.ico");
pub struct GlutinWindowWrapper {
windowed_context: WindowedContext<glutin::PossiblyCurrent>,
@ -221,8 +219,7 @@ pub fn create_window(
running: Arc<AtomicBool>,
) {
let icon = {
let icon_data = Asset::get("neovide.ico").expect("Failed to read icon data");
let icon = load_from_memory(&icon_data).expect("Failed to parse icon data");
let icon = load_from_memory(ICON).expect("Failed to parse icon data");
let (width, height) = icon.dimensions();
let mut rgba = Vec::with_capacity((width * height) as usize * 4);
for (_, _, pixel) in icon.pixels() {

Loading…
Cancel
Save