diff options
author | 2023-02-24 20:52:10 +0100 | |
---|---|---|
committer | 2023-02-24 20:52:10 +0100 | |
commit | 368cadd25a8b57ee5c41e45d1abe8d1dfb194c69 (patch) | |
tree | 191cb7cc7807a5fe513b3d485b2fda21d3bf0bde /src | |
parent | 573d27eb52bbfacf1b06983b4282f00eb5265bdc (diff) | |
parent | 8059c40142d601588e01c152ce1bb72a1295dde8 (diff) | |
download | iced-368cadd25a8b57ee5c41e45d1abe8d1dfb194c69.tar.gz iced-368cadd25a8b57ee5c41e45d1abe8d1dfb194c69.tar.bz2 iced-368cadd25a8b57ee5c41e45d1abe8d1dfb194c69.zip |
Merge pull request #1697 from iced-rs/text-glyphon
Text shaping, font fallback, and `iced_wgpu` overhaul
Diffstat (limited to '')
-rw-r--r-- | src/application.rs | 1 | ||||
-rw-r--r-- | src/lib.rs | 17 | ||||
-rw-r--r-- | src/settings.rs | 34 |
3 files changed, 12 insertions, 40 deletions
diff --git a/src/application.rs b/src/application.rs index 1db5c93f..9a1c1855 100644 --- a/src/application.rs +++ b/src/application.rs @@ -197,7 +197,6 @@ pub trait Application: Sized { let renderer_settings = crate::renderer::Settings { default_font: settings.default_font, default_text_size: settings.default_text_size, - text_multithreading: settings.text_multithreading, antialiasing: if settings.antialiasing { Some(crate::renderer::settings::Antialiasing::MSAAx4) } else { @@ -182,20 +182,12 @@ pub mod touch; pub mod widget; pub mod window; -#[cfg(all(not(feature = "glow"), feature = "wgpu"))] -use iced_winit as runtime; - -#[cfg(feature = "glow")] -use iced_glutin as runtime; - -#[cfg(all(not(feature = "glow"), feature = "wgpu"))] use iced_wgpu as renderer; - -#[cfg(feature = "glow")] -use iced_glow as renderer; +use iced_winit as runtime; pub use iced_native::theme; pub use runtime::event; +pub use runtime::font; pub use runtime::subscription; pub use application::Application; @@ -203,6 +195,7 @@ pub use element::Element; pub use error::Error; pub use event::Event; pub use executor::Executor; +pub use font::Font; pub use renderer::Renderer; pub use result::Result; pub use sandbox::Sandbox; @@ -213,8 +206,8 @@ pub use theme::Theme; pub use runtime::alignment; pub use runtime::futures; pub use runtime::{ - color, Alignment, Background, Color, Command, ContentFit, Font, Length, - Padding, Point, Rectangle, Size, Vector, + color, Alignment, Background, Color, Command, ContentFit, Length, Padding, + Point, Rectangle, Size, Vector, }; #[cfg(feature = "system")] diff --git a/src/settings.rs b/src/settings.rs index 0eb3e62d..13b3af7c 100644 --- a/src/settings.rs +++ b/src/settings.rs @@ -1,5 +1,6 @@ //! Configure your application. use crate::window; +use crate::Font; /// The settings of an application. #[derive(Debug, Clone)] @@ -20,23 +21,16 @@ pub struct Settings<Flags> { /// [`Application`]: crate::Application pub flags: Flags, - /// The bytes of the font that will be used by default. + /// The default [`Font`] to be used. /// - /// If `None` is provided, a default system font will be chosen. - // TODO: Add `name` for web compatibility - pub default_font: Option<&'static [u8]>, + /// By default, it uses [`Font::SansSerif`]. + pub default_font: Font, /// The text size that will be used by default. /// - /// The default value is `20.0`. + /// The default value is `16.0`. pub default_text_size: f32, - /// If enabled, spread text workload in multiple threads when multiple cores - /// are available. - /// - /// By default, it is disabled. - pub text_multithreading: bool, - /// If set to true, the renderer will try to perform antialiasing for some /// primitives. /// @@ -55,15 +49,6 @@ pub struct Settings<Flags> { /// /// [`Application`]: crate::Application pub exit_on_close_request: bool, - - /// Whether the [`Application`] should try to build the context - /// using OpenGL ES first then OpenGL. - /// - /// By default, it is disabled. - /// **Note:** Only works for the `glow` backend. - /// - /// [`Application`]: crate::Application - pub try_opengles_first: bool, } impl<Flags> Settings<Flags> { @@ -79,10 +64,8 @@ impl<Flags> Settings<Flags> { window: default_settings.window, default_font: default_settings.default_font, default_text_size: default_settings.default_text_size, - text_multithreading: default_settings.text_multithreading, antialiasing: default_settings.antialiasing, exit_on_close_request: default_settings.exit_on_close_request, - try_opengles_first: default_settings.try_opengles_first, } } } @@ -96,12 +79,10 @@ where id: None, window: Default::default(), flags: Default::default(), - default_font: Default::default(), - default_text_size: 20.0, - text_multithreading: false, + default_font: Font::SansSerif, + default_text_size: 16.0, antialiasing: false, exit_on_close_request: true, - try_opengles_first: false, } } } @@ -113,7 +94,6 @@ impl<Flags> From<Settings<Flags>> for iced_winit::Settings<Flags> { window: settings.window.into(), flags: settings.flags, exit_on_close_request: settings.exit_on_close_request, - try_opengles_first: settings.try_opengles_first, } } } |