diff options
Diffstat (limited to 'library/src/layout')
| -rw-r--r-- | library/src/layout/flow.rs | 4 | ||||
| -rw-r--r-- | library/src/layout/mod.rs | 2 | ||||
| -rw-r--r-- | library/src/layout/par.rs | 15 |
3 files changed, 8 insertions, 13 deletions
diff --git a/library/src/layout/flow.rs b/library/src/layout/flow.rs index 611e9ee1..4a8bed85 100644 --- a/library/src/layout/flow.rs +++ b/library/src/layout/flow.rs @@ -5,7 +5,7 @@ use crate::prelude::*; /// Arrange spacing, paragraphs and block-level nodes into a flow. /// -/// This node is reponsible for layouting both the top-level content flow and +/// This node is responsible for layouting both the top-level content flow and /// the contents of boxes. #[capable(Layout)] #[derive(Hash)] @@ -244,7 +244,7 @@ impl<'a> FlowLayouter<'a> { } } - // Determine the size of the flow in this region dependening on whether + // Determine the size of the flow in this region depending on whether // the region expands. let mut size = self.expand.select(self.full, used); diff --git a/library/src/layout/mod.rs b/library/src/layout/mod.rs index 67b53e1b..91822be8 100644 --- a/library/src/layout/mod.rs +++ b/library/src/layout/mod.rs @@ -227,7 +227,7 @@ impl<'a> Regions<'a> { /// An iterator that returns the sizes of the first and all following /// regions, equivalently to what would be produced by calling /// [`next()`](Self::next) repeatedly until all regions are exhausted. - /// This iterater may be infinite. + /// This iterator may be infinite. pub fn iter(&self) -> impl Iterator<Item = Size> + '_ { let first = std::iter::once(self.first); let backlog = self.backlog.iter(); diff --git a/library/src/layout/par.rs b/library/src/layout/par.rs index 25372bb6..aa4e0fd9 100644 --- a/library/src/layout/par.rs +++ b/library/src/layout/par.rs @@ -198,17 +198,17 @@ impl Resolve for HorizontalAlign { /// How to determine line breaks in a paragraph. #[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] pub enum Linebreaks { - /// Determine the linebreaks in a simple first-fit style. + /// Determine the line breaks in a simple first-fit style. Simple, - /// Optimize the linebreaks for the whole paragraph. + /// Optimize the line breaks for the whole paragraph. Optimized, } castable! { Linebreaks, - /// Determine the linebreaks in a simple first-fit style. + /// Determine the line breaks in a simple first-fit style. "simple" => Self::Simple, - /// Optimize the linebreaks for the whole paragraph. + /// Optimize the line breaks for the whole paragraph. /// /// Typst will try to produce more evenly filled lines of text by /// considering the whole paragraph when calculating line breaks. @@ -861,12 +861,7 @@ fn linebreak_optimized<'a>(vt: &Vt, p: &'a Preparation<'a>, width: Abs) -> Vec<L // has minimum cost. All breakpoints before this one become // inactive since no line can span above the mandatory break. active = k; - MIN_COST - + if attempt.justify { - ratio.powi(3).abs() - } else { - 0.0 - } + MIN_COST + if attempt.justify { ratio.powi(3).abs() } else { 0.0 } } else { // Normal line with cost of |ratio^3|. ratio.powi(3).abs() |
