Use Pixels for Text::size

This commit is contained in:
Héctor Ramón Jiménez 2023-02-04 16:41:18 +01:00
parent 7b8b01f560
commit 570600ce51
No known key found for this signature in database
GPG key ID: 140CC052C94F138E
16 changed files with 79 additions and 78 deletions

View file

@ -22,7 +22,7 @@ pub struct Backend {
quad_pipeline: quad::Pipeline,
text_pipeline: text::Pipeline,
triangle_pipeline: triangle::Pipeline,
default_text_size: u16,
default_text_size: f32,
}
impl Backend {
@ -228,7 +228,7 @@ impl backend::Text for Backend {
const CHECKMARK_ICON: char = font::CHECKMARK_ICON;
const ARROW_DOWN_ICON: char = font::ARROW_DOWN_ICON;
fn default_size(&self) -> u16 {
fn default_size(&self) -> f32 {
self.default_text_size
}

View file

@ -4,7 +4,7 @@ pub use iced_graphics::Antialiasing;
/// The settings of a [`Backend`].
///
/// [`Backend`]: crate::Backend
#[derive(Clone, Copy, PartialEq, Eq)]
#[derive(Clone, Copy, PartialEq)]
pub struct Settings {
/// The bytes of the font that will be used by default.
///
@ -13,8 +13,8 @@ pub struct Settings {
/// The default size of text.
///
/// By default, it will be set to 20.
pub default_text_size: u16,
/// By default, it will be set to `20.0`.
pub default_text_size: f32,
/// If enabled, spread text workload in multiple threads when multiple cores
/// are available.
@ -32,7 +32,7 @@ impl Default for Settings {
fn default() -> Settings {
Settings {
default_font: None,
default_text_size: 20,
default_text_size: 20.0,
text_multithreading: false,
antialiasing: None,
}