diff options
Diffstat (limited to 'src/shaping.rs')
| -rw-r--r-- | src/shaping.rs | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/shaping.rs b/src/shaping.rs index d9e6e9fd..092f5e6e 100644 --- a/src/shaping.rs +++ b/src/shaping.rs @@ -7,20 +7,20 @@ use fontdock::{FaceId, FaceQuery, FallbackTree, FontStyle, FontVariant}; use ttf_parser::GlyphId; +use crate::eval::TextState; use crate::font::FontLoader; use crate::geom::{Point, Size}; use crate::layout::{BoxLayout, Dir, LayoutAlign, LayoutElement, LayoutElements, Shaped}; -use crate::style::TextStyle; /// Shape text into a box. pub async fn shape( text: &str, dir: Dir, align: LayoutAlign, - style: &TextStyle, + state: &TextState, loader: &mut FontLoader, ) -> BoxLayout { - Shaper::new(text, dir, align, style, loader).shape().await + Shaper::new(text, dir, align, state, loader).shape().await } /// Performs super-basic text shaping. @@ -40,16 +40,16 @@ impl<'a> Shaper<'a> { text: &'a str, dir: Dir, align: LayoutAlign, - style: &'a TextStyle, + state: &'a TextState, loader: &'a mut FontLoader, ) -> Self { - let mut variant = style.variant; + let mut variant = state.variant; - if style.strong { + if state.strong { variant.weight = variant.weight.thicken(300); } - if style.emph { + if state.emph { variant.style = match variant.style { FontStyle::Normal => FontStyle::Italic, FontStyle::Italic => FontStyle::Normal, @@ -61,11 +61,11 @@ impl<'a> Shaper<'a> { text, dir, variant, - fallback: &style.fallback, + fallback: &state.fallback, loader, - shaped: Shaped::new(FaceId::MAX, style.font_size()), + shaped: Shaped::new(FaceId::MAX, state.font_size()), layout: BoxLayout { - size: Size::new(0.0, style.font_size()), + size: Size::new(0.0, state.font_size()), align, elements: LayoutElements::new(), }, |
