Flesh out the editor example a bit more

This commit is contained in:
Héctor Ramón Jiménez 2023-09-18 19:07:41 +02:00
parent 8446fe6de5
commit e7326f0af6
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
10 changed files with 311 additions and 27 deletions

View file

@ -193,7 +193,14 @@ where
};
}
let (compositor, renderer) = C::new(compositor_settings, Some(&window))?;
let (compositor, mut renderer) =
C::new(compositor_settings, Some(&window))?;
for font in settings.fonts {
use crate::core::text::Renderer;
renderer.load_font(font);
}
let (mut event_sender, event_receiver) = mpsc::unbounded();
let (control_sender, mut control_receiver) = mpsc::unbounded();

View file

@ -33,6 +33,7 @@ use crate::Position;
use winit::monitor::MonitorHandle;
use winit::window::WindowBuilder;
use std::borrow::Cow;
use std::fmt;
/// The settings of an application.
@ -52,6 +53,9 @@ pub struct Settings<Flags> {
/// [`Application`]: crate::Application
pub flags: Flags,
/// The fonts to load on boot.
pub fonts: Vec<Cow<'static, [u8]>>,
/// Whether the [`Application`] should exit when the user requests the
/// window to close (e.g. the user presses the close button).
///