diff options
| author | Laurenz <laurmaedje@gmail.com> | 2021-07-25 12:10:44 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2021-07-25 12:10:44 +0200 |
| commit | c97b3078eb39995528302100d4e8b60c032cadd3 (patch) | |
| tree | 2242630b093ab96a04e2b2796ea0fda95147942b /src/layout | |
| parent | ec5384c97f24c3e6d8284926fd3e415f47fe2b04 (diff) | |
Merge font and par state into text state
Diffstat (limited to 'src/layout')
| -rw-r--r-- | src/layout/par.rs | 4 | ||||
| -rw-r--r-- | src/layout/shaping.rs | 10 |
2 files changed, 7 insertions, 7 deletions
diff --git a/src/layout/par.rs b/src/layout/par.rs index 8736452b..56847b9b 100644 --- a/src/layout/par.rs +++ b/src/layout/par.rs @@ -6,7 +6,7 @@ use xi_unicode::LineBreakIterator; use super::*; use crate::eco::EcoString; -use crate::exec::FontState; +use crate::exec::TextState; use crate::util::{RangeExt, SliceExt}; type Range = std::ops::Range<usize>; @@ -30,7 +30,7 @@ pub enum ParChild { /// Spacing between other nodes. Spacing(Length), /// A run of text and how to align it in its line. - Text(EcoString, Align, Rc<FontState>), + Text(EcoString, Align, Rc<TextState>), /// Any child node and how to align it in its line. Any(LayoutNode, Align), } diff --git a/src/layout/shaping.rs b/src/layout/shaping.rs index 3ede5122..0cfb01a8 100644 --- a/src/layout/shaping.rs +++ b/src/layout/shaping.rs @@ -5,7 +5,7 @@ use std::ops::Range; use rustybuzz::UnicodeBuffer; use super::{Element, Frame, Glyph, LayoutContext, Text}; -use crate::exec::{FontState, LineState}; +use crate::exec::{LineState, TextState}; use crate::font::{Face, FaceId, FontVariant, LineMetrics}; use crate::geom::{Dir, Length, Point, Size}; use crate::layout::Geometry; @@ -23,7 +23,7 @@ pub struct ShapedText<'a> { /// The text direction. pub dir: Dir, /// The properties used for font selection. - pub state: &'a FontState, + pub state: &'a TextState, /// The font size. pub size: Size, /// The baseline from the top of the frame. @@ -185,7 +185,7 @@ pub fn shape<'a>( ctx: &mut LayoutContext, text: &'a str, dir: Dir, - state: &'a FontState, + state: &'a TextState, ) -> ShapedText<'a> { let mut glyphs = vec![]; if !text.is_empty() { @@ -346,7 +346,7 @@ fn shape_segment<'a>( fn measure( ctx: &mut LayoutContext, glyphs: &[ShapedGlyph], - state: &FontState, + state: &TextState, ) -> (Size, Length) { let mut width = Length::zero(); let mut top = Length::zero(); @@ -386,7 +386,7 @@ fn decorate( pos: Point, width: Length, face_id: FaceId, - state: &FontState, + state: &TextState, ) { let mut apply = |substate: &LineState, metrics: fn(&Face) -> &LineMetrics| { let metrics = metrics(ctx.fonts.get(face_id)); |
