Skip to content

Commit

Permalink
fix: cannot load font
Browse files Browse the repository at this point in the history
  • Loading branch information
Decodetalkers committed Nov 17, 2024
1 parent 119b078 commit 700d122
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 4 deletions.
8 changes: 7 additions & 1 deletion iced_layershell/src/application.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
mod state;

use std::{mem::ManuallyDrop, os::fd::AsFd, sync::Arc, time::Duration};
use std::{borrow::Cow, mem::ManuallyDrop, os::fd::AsFd, sync::Arc, time::Duration};

use crate::{
actions::{
Expand Down Expand Up @@ -195,6 +195,7 @@ where
control_sender,
state,
window,
settings.fonts,
));

let mut context = task::Context::from_waker(task::noop_waker_ref());
Expand Down Expand Up @@ -331,6 +332,7 @@ async fn run_instance<A, E, C>(
mut control_sender: mpsc::UnboundedSender<LayerShellActionVec<()>>,
mut state: State<A>,
window: Arc<WindowWrapper>,
fonts: Vec<Cow<'static, [u8]>>,
) where
A: Application + 'static,
E: Executor + 'static,
Expand All @@ -344,6 +346,10 @@ async fn run_instance<A, E, C>(
let mut compositor = C::new(compositor_settings, window.clone())
.await
.expect("Cannot create compositor");
for font in fonts {
compositor.load_font(font);
}

let mut renderer = compositor.create_renderer();

let cache = user_interface::Cache::default();
Expand Down
10 changes: 9 additions & 1 deletion iced_layershell/src/multi_window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ use crate::{
settings::VirtualKeyboardSettings,
DefaultStyle,
};
use std::{collections::HashMap, f64, mem::ManuallyDrop, os::fd::AsFd, sync::Arc, time::Duration};
use std::{
borrow::Cow, collections::HashMap, f64, mem::ManuallyDrop, os::fd::AsFd, sync::Arc,
time::Duration,
};

use crate::{
actions::{LayerShellAction, LayershellCustomActionsWithInfo},
Expand Down Expand Up @@ -214,6 +217,7 @@ where
event_receiver,
control_sender,
window,
settings.fonts,
is_background_mode,
));

Expand Down Expand Up @@ -470,6 +474,7 @@ async fn run_instance<A, E, C>(
>,
mut control_sender: mpsc::UnboundedSender<LayerShellActionVec<A::WindowInfo>>,
window: Arc<WindowWrapper>,
fonts: Vec<Cow<'static, [u8]>>,
is_background_mode: bool,
) where
A: Application + 'static,
Expand All @@ -485,6 +490,9 @@ async fn run_instance<A, E, C>(
let mut compositor = C::new(compositor_settings, window.clone())
.await
.expect("Cannot create compositer");
for font in fonts {
compositor.load_font(font);
}

let mut window_manager = WindowManager::new();

Expand Down
8 changes: 6 additions & 2 deletions iced_sessionlock/src/multi_window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use crate::{
actions::{SessionShellActionVec, UnLockAction},
multi_window::window_manager::WindowManager,
};
use std::{collections::HashMap, f64, mem::ManuallyDrop, sync::Arc};
use std::{borrow::Cow, collections::HashMap, f64, mem::ManuallyDrop, sync::Arc};

use crate::{
actions::SessionShellAction, clipboard::SessionLockClipboard, conversion, error::Error,
Expand Down Expand Up @@ -177,6 +177,7 @@ where
control_sender,
//state,
window,
settings.fonts,
));

let mut context = task::Context::from_waker(task::noop_waker_ref());
Expand Down Expand Up @@ -288,6 +289,7 @@ async fn run_instance<A, E, C>(
>,
mut control_sender: mpsc::UnboundedSender<SessionShellActionVec>,
window: Arc<WindowWrapper>,
fonts: Vec<Cow<'static, [u8]>>,
) where
A: Application + 'static,
E: Executor + 'static,
Expand All @@ -300,7 +302,9 @@ async fn run_instance<A, E, C>(
let mut compositor = C::new(compositor_settings, window.clone())
.await
.expect("Cannot create compositer");

for font in fonts {
compositor.load_font(font);
}
let mut window_manager = WindowManager::new();

let mut clipboard = SessionLockClipboard::connect(&window);
Expand Down

0 comments on commit 700d122

Please sign in to comment.