summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2023-05-08 15:37:29 +0200
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2023-05-08 15:37:29 +0200
commit16bf8fc7622fbe67a7d81cbe6daad329385cc44c (patch)
tree822bac1c6e2063be88f3d935270a329f22c24849 /core
parentb8c2cca3847e852eb78e7daf5487c8a26f38f2bf (diff)
downloadiced-16bf8fc7622fbe67a7d81cbe6daad329385cc44c.tar.gz
iced-16bf8fc7622fbe67a7d81cbe6daad329385cc44c.tar.bz2
iced-16bf8fc7622fbe67a7d81cbe6daad329385cc44c.zip
Export `Shaping` and `LineHeight` in `widget::text`
Diffstat (limited to 'core')
-rw-r--r--core/src/widget/text.rs23
1 files changed, 11 insertions, 12 deletions
diff --git a/core/src/widget/text.rs b/core/src/widget/text.rs
index 2d86e735..90af88b7 100644
--- a/core/src/widget/text.rs
+++ b/core/src/widget/text.rs
@@ -10,6 +10,8 @@ use crate::{
use std::borrow::Cow;
+pub use text::{LineHeight, Shaping};
+
/// A paragraph of text.
#[allow(missing_debug_implementations)]
pub struct Text<'a, Renderer>
@@ -19,13 +21,13 @@ where
{
content: Cow<'a, str>,
size: Option<f32>,
- line_height: text::LineHeight,
+ line_height: LineHeight,
width: Length,
height: Length,
horizontal_alignment: alignment::Horizontal,
vertical_alignment: alignment::Vertical,
font: Option<Renderer::Font>,
- shaping: text::Shaping,
+ shaping: Shaping,
style: <Renderer::Theme as StyleSheet>::Style,
}
@@ -39,13 +41,13 @@ where
Text {
content: content.into(),
size: None,
- line_height: text::LineHeight::default(),
+ line_height: LineHeight::default(),
font: None,
width: Length::Shrink,
height: Length::Shrink,
horizontal_alignment: alignment::Horizontal::Left,
vertical_alignment: alignment::Vertical::Top,
- shaping: text::Shaping::Basic,
+ shaping: Shaping::Basic,
style: Default::default(),
}
}
@@ -57,10 +59,7 @@ where
}
/// Sets the [`LineHeight`] of the [`Text`].
- pub fn line_height(
- mut self,
- line_height: impl Into<text::LineHeight>,
- ) -> Self {
+ pub fn line_height(mut self, line_height: impl Into<LineHeight>) -> Self {
self.line_height = line_height.into();
self
}
@@ -112,8 +111,8 @@ where
self
}
- /// Sets the [`text::Shaping`] strategy of the [`Text`].
- pub fn shaping(mut self, shaping: text::Shaping) -> Self {
+ /// Sets the [`Shaping`] strategy of the [`Text`].
+ pub fn shaping(mut self, shaping: Shaping) -> Self {
self.shaping = shaping;
self
}
@@ -199,12 +198,12 @@ pub fn draw<Renderer>(
layout: Layout<'_>,
content: &str,
size: Option<f32>,
- line_height: text::LineHeight,
+ line_height: LineHeight,
font: Option<Renderer::Font>,
appearance: Appearance,
horizontal_alignment: alignment::Horizontal,
vertical_alignment: alignment::Vertical,
- shaping: text::Shaping,
+ shaping: Shaping,
) where
Renderer: text::Renderer,
{