use crate::css::ComputedStyle;
use crate::units::SemanticLengthExt;
mod controls;
mod lines;
mod normalization;
mod styled;
mod tabs;
#[derive(Clone, Copy)]
pub(crate) enum ShapingLetterSpacing {
Computed,
Suppressed,
}
#[derive(Clone, Copy)]
pub(crate) struct TextShapingRequest<'a> {
text: &'a str,
style: &'a ComputedStyle,
line_height: f32,
}
impl<'a> TextShapingRequest<'a> {
pub(crate) const fn new(text: &'a str, style: &'a ComputedStyle, line_height: f32) -> Self {
Self {
text,
style,
line_height,
}
}
pub(crate) const fn from_html_computed_style(
text: &'a str,
style: &'a ComputedStyle,
line_height: f32,
) -> Self {
Self::new(text, style, line_height)
}
}
impl ShapingLetterSpacing {
pub(in crate::text) fn requested_for(self, style: &ComputedStyle) -> f32 {
match self {
Self::Computed => style.used_letter_spacing().points(),
Self::Suppressed => 0.0,
}
}
}
pub(crate) use controls::*;
pub(in crate::text) use normalization::*;
pub(in crate::text) use tabs::*;