diff options
author | 2023-10-27 17:36:54 +0200 | |
---|---|---|
committer | 2023-10-27 17:36:54 +0200 | |
commit | d731996342118dccfd50df8db9607741d162a639 (patch) | |
tree | 9f7db10dea8e6faf25041b19d0fe595acb995e9c /winit/src | |
parent | 3ec5ad42251d4f35861f3bed621223e383742b12 (diff) | |
parent | c8eca4e6bfae82013e6bb08e9d8bf66560b36564 (diff) | |
download | iced-d731996342118dccfd50df8db9607741d162a639.tar.gz iced-d731996342118dccfd50df8db9607741d162a639.tar.bz2 iced-d731996342118dccfd50df8db9607741d162a639.zip |
Merge pull request #2123 from iced-rs/text-editor
`TextEditor` widget (or multi-line text input)
Diffstat (limited to 'winit/src')
-rw-r--r-- | winit/src/application.rs | 9 | ||||
-rw-r--r-- | winit/src/settings.rs | 4 |
2 files changed, 12 insertions, 1 deletions
diff --git a/winit/src/application.rs b/winit/src/application.rs index 8105f8d9..315e34d9 100644 --- a/winit/src/application.rs +++ b/winit/src/application.rs @@ -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(); diff --git a/winit/src/settings.rs b/winit/src/settings.rs index 867dad0f..9d2bfbbc 100644 --- a/winit/src/settings.rs +++ b/winit/src/settings.rs @@ -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). /// |