diff options
| author | Martin Haug <mhaug@live.de> | 2021-06-10 23:08:52 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2021-06-10 23:15:51 +0200 |
| commit | c28708aa196eaca247cdab6b5e8af9751b4f1dad (patch) | |
| tree | e390e84d1a7a1eb2789680a39141c804ff3f85a1 /src/layout/par.rs | |
| parent | 5611c26577c4cf6d52b9b66b7b1a32253aa23ec1 (diff) | |
Text decorations
Diffstat (limited to 'src/layout/par.rs')
| -rw-r--r-- | src/layout/par.rs | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/layout/par.rs b/src/layout/par.rs index f21778de..8b3cbf8b 100644 --- a/src/layout/par.rs +++ b/src/layout/par.rs @@ -190,7 +190,7 @@ impl<'a> ParLayout<'a> { while !stack.regions.current.height.fits(line.size.height) && !stack.regions.in_full_last() { - stack.finish_region(); + stack.finish_region(ctx); } // If the line does not fit horizontally or we have a mandatory @@ -217,7 +217,7 @@ impl<'a> ParLayout<'a> { stack.push(line); } - stack.finish() + stack.finish(ctx) } /// Find the index of the item whose range contains the `text_offset`. @@ -302,7 +302,7 @@ impl<'a> LineStack<'a> { self.lines.push(line); } - fn finish_region(&mut self) { + fn finish_region(&mut self, ctx: &LayoutContext) { if self.regions.fixed.horizontal { self.size.width = self.regions.current.width; } @@ -312,7 +312,7 @@ impl<'a> LineStack<'a> { let mut first = true; for line in std::mem::take(&mut self.lines) { - let frame = line.build(self.size.width); + let frame = line.build(ctx, self.size.width); let pos = Point::new(Length::zero(), offset); if first { @@ -329,8 +329,8 @@ impl<'a> LineStack<'a> { self.size = Size::zero(); } - fn finish(mut self) -> Vec<Frame> { - self.finish_region(); + fn finish(mut self, ctx: &LayoutContext) -> Vec<Frame> { + self.finish_region(ctx); self.finished } } @@ -447,7 +447,7 @@ impl<'a> LineLayout<'a> { } /// Build the line's frame. - fn build(&self, width: Length) -> Frame { + fn build(&self, ctx: &LayoutContext, width: Length) -> Frame { let size = Size::new(self.size.width.max(width), self.size.height); let free = size.width - self.size.width; @@ -463,7 +463,7 @@ impl<'a> LineLayout<'a> { } ParItem::Text(ref shaped, align) => { ruler = ruler.max(align); - shaped.build() + shaped.build(ctx) } ParItem::Frame(ref frame, align) => { ruler = ruler.max(align); |
