Support configurable LineHeight in text widgets
This commit is contained in:
parent
8e8808f0e1
commit
9499a8f9e6
24 changed files with 337 additions and 42 deletions
|
|
@ -46,6 +46,7 @@ where
|
|||
size: f32,
|
||||
spacing: f32,
|
||||
text_size: Option<f32>,
|
||||
text_line_height: text::LineHeight,
|
||||
text_shaping: text::Shaping,
|
||||
font: Option<Renderer::Font>,
|
||||
icon: Icon<Renderer::Font>,
|
||||
|
|
@ -83,6 +84,7 @@ where
|
|||
size: Self::DEFAULT_SIZE,
|
||||
spacing: Self::DEFAULT_SPACING,
|
||||
text_size: None,
|
||||
text_line_height: text::LineHeight::default(),
|
||||
text_shaping: text::Shaping::Basic,
|
||||
font: None,
|
||||
icon: Icon {
|
||||
|
|
@ -119,6 +121,15 @@ where
|
|||
self
|
||||
}
|
||||
|
||||
/// Sets the text [`LineHeight`] of the [`Checkbox`].
|
||||
pub fn text_line_height(
|
||||
mut self,
|
||||
line_height: impl Into<text::LineHeight>,
|
||||
) -> Self {
|
||||
self.text_line_height = line_height.into();
|
||||
self
|
||||
}
|
||||
|
||||
/// Sets the [`text::Shaping`] strategy of the [`Checkbox`].
|
||||
pub fn text_shaping(mut self, shaping: text::Shaping) -> Self {
|
||||
self.text_shaping = shaping;
|
||||
|
|
@ -181,6 +192,7 @@ where
|
|||
self.text_size
|
||||
.unwrap_or_else(|| renderer.default_size()),
|
||||
)
|
||||
.line_height(self.text_line_height)
|
||||
.shaping(self.text_shaping),
|
||||
)
|
||||
.layout(renderer, limits)
|
||||
|
|
@ -276,6 +288,7 @@ where
|
|||
content: &code_point.to_string(),
|
||||
font: *font,
|
||||
size,
|
||||
line_height: text::LineHeight::default(),
|
||||
bounds: Rectangle {
|
||||
x: bounds.center_x(),
|
||||
y: bounds.center_y(),
|
||||
|
|
@ -298,6 +311,7 @@ where
|
|||
label_layout,
|
||||
&self.label,
|
||||
self.text_size,
|
||||
self.text_line_height,
|
||||
self.font,
|
||||
crate::text::Appearance {
|
||||
color: custom_style.text_color,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue