use crate::Renderer;
pub use iced::widget::Text;
use iced_core::text::LineHeight;
use std::borrow::Cow;
pub fn text<'a>(text: impl Into<Cow<'a, str>> + 'a) -> Text<'a, crate::Theme, Renderer> {
Text::new(text.into()).font(crate::font::default())
}
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
pub enum Typography {
Body,
Caption,
CaptionHeading,
Heading,
Monotext,
Title1,
Title2,
Title3,
Title4,
}
pub fn title1<'a>(text: impl Into<Cow<'a, str>> + 'a) -> Text<'a, crate::Theme, Renderer> {
Text::new(text.into())
.size(32.0)
.line_height(LineHeight::Absolute(44.0.into()))
.font(crate::font::semibold())
}
pub fn title2<'a>(text: impl Into<Cow<'a, str>> + 'a) -> Text<'a, crate::Theme, Renderer> {
Text::new(text.into())
.size(28.0)
.line_height(LineHeight::Absolute(36.0.into()))
.font(crate::font::default())
}
pub fn title3<'a>(text: impl Into<Cow<'a, str>> + 'a) -> Text<'a, crate::Theme, Renderer> {
Text::new(text.into())
.size(24.0)
.line_height(LineHeight::Absolute(32.0.into()))
.font(crate::font::default())
}
pub fn title4<'a>(text: impl Into<Cow<'a, str>> + 'a) -> Text<'a, crate::Theme, Renderer> {
Text::new(text.into())
.size(20.0)
.line_height(LineHeight::Absolute(28.0.into()))
.font(crate::font::default())
}
pub fn heading<'a>(text: impl Into<Cow<'a, str>> + 'a) -> Text<'a, crate::Theme, Renderer> {
Text::new(text.into())
.size(14.0)
.line_height(LineHeight::Absolute(iced::Pixels(20.0)))
.font(crate::font::semibold())
}
pub fn caption_heading<'a>(text: impl Into<Cow<'a, str>> + 'a) -> Text<'a, crate::Theme, Renderer> {
Text::new(text.into())
.size(10.0)
.line_height(LineHeight::Absolute(iced::Pixels(14.0)))
.font(crate::font::semibold())
}
pub fn body<'a>(text: impl Into<Cow<'a, str>> + 'a) -> Text<'a, crate::Theme, Renderer> {
Text::new(text.into())
.size(14.0)
.line_height(LineHeight::Absolute(20.0.into()))
.font(crate::font::default())
}
pub fn caption<'a>(text: impl Into<Cow<'a, str>> + 'a) -> Text<'a, crate::Theme, Renderer> {
Text::new(text.into())
.size(10.0)
.line_height(LineHeight::Absolute(14.0.into()))
.font(crate::font::default())
}
pub fn monotext<'a>(text: impl Into<Cow<'a, str>> + 'a) -> Text<'a, crate::Theme, Renderer> {
Text::new(text.into())
.size(14.0)
.line_height(LineHeight::Absolute(20.0.into()))
.font(crate::font::mono())
}