diff options
-rw-r--r-- | core/src/text.rs | 2 | ||||
-rw-r--r-- | tiny_skia/src/backend.rs | 2 | ||||
-rw-r--r-- | widget/src/pick_list.rs | 25 |
3 files changed, 21 insertions, 8 deletions
diff --git a/core/src/text.rs b/core/src/text.rs index 1a867be3..c154cc27 100644 --- a/core/src/text.rs +++ b/core/src/text.rs @@ -82,7 +82,7 @@ impl LineHeight { impl Default for LineHeight { fn default() -> Self { - Self::Relative(1.2) + Self::Relative(1.3) } } diff --git a/tiny_skia/src/backend.rs b/tiny_skia/src/backend.rs index b6adb8ce..d481bacd 100644 --- a/tiny_skia/src/backend.rs +++ b/tiny_skia/src/backend.rs @@ -527,7 +527,7 @@ fn rounded_rectangle( bounds.y + bounds.height, ); - if bottom_right > 0.0 { + if bottom_left > 0.0 { arc_to( &mut builder, bounds.x + bottom_left, diff --git a/widget/src/pick_list.rs b/widget/src/pick_list.rs index bc2c9066..8c445dda 100644 --- a/widget/src/pick_list.rs +++ b/widget/src/pick_list.rs @@ -360,6 +360,8 @@ pub struct Icon<Font> { pub code_point: char, /// Font size of the content. pub size: Option<f32>, + /// Line height of the content. + pub line_height: text::LineHeight, /// The shaping strategy of the icon. pub shaping: text::Shaping, } @@ -632,22 +634,31 @@ pub fn draw<'a, T, Renderer>( Renderer::ICON_FONT, Renderer::ARROW_DOWN_ICON, *size, + text::LineHeight::default(), text::Shaping::Basic, )), Handle::Static(Icon { font, code_point, size, + line_height, shaping, - }) => Some((*font, *code_point, *size, *shaping)), + }) => Some((*font, *code_point, *size, *line_height, *shaping)), Handle::Dynamic { open, closed } => { if state().is_open { - Some((open.font, open.code_point, open.size, open.shaping)) + Some(( + open.font, + open.code_point, + open.size, + open.line_height, + open.shaping, + )) } else { Some(( closed.font, closed.code_point, closed.size, + closed.line_height, closed.shaping, )) } @@ -655,19 +666,19 @@ pub fn draw<'a, T, Renderer>( Handle::None => None, }; - if let Some((font, code_point, size, shaping)) = handle { + if let Some((font, code_point, size, line_height, shaping)) = handle { let size = size.unwrap_or_else(|| renderer.default_size()); renderer.fill_text(Text { content: &code_point.to_string(), size, - line_height: text::LineHeight::default(), + line_height, font, color: style.handle_color, bounds: Rectangle { x: bounds.x + bounds.width - padding.horizontal(), y: bounds.center_y(), - height: size * 1.2, + height: f32::from(line_height.to_absolute(Pixels(size))), ..bounds }, horizontal_alignment: alignment::Horizontal::Right, @@ -695,7 +706,9 @@ pub fn draw<'a, T, Renderer>( x: bounds.x + padding.left, y: bounds.center_y(), width: bounds.width - padding.horizontal(), - height: text_size * 1.2, + height: f32::from( + text_line_height.to_absolute(Pixels(text_size)), + ), }, horizontal_alignment: alignment::Horizontal::Left, vertical_alignment: alignment::Vertical::Center, |