Merge native paragraph break candidates at the TeX line boundary
This commit is contained in:
1 parent
509f229a52
commit
a864c6c5ca
3 files changed
+66
-9
No files matched your search
@@ -925,15 +925,20 @@ fn break_lines(
|
||||
cost: 0,
|
||||
path: Vec::new(),
|
||||
}];
|
||||
let special = if get(Parameter::Looseness) != 0 {
|
||||
usize::MAX
|
||||
} else if !shape.is_empty() {
|
||||
(shape.len() - 1).saturating_sub(previous_lines)
|
||||
let last_special_line = if !shape.is_empty() {
|
||||
shape.len() - 1
|
||||
} else if get(Parameter::Hangindent) == 0 {
|
||||
0
|
||||
} else {
|
||||
get(Parameter::Hangafter).unsigned_abs() as usize
|
||||
};
|
||||
let merged_class = if get(Parameter::Looseness) == 0 {
|
||||
// TeX defers flushing easy_line's minima until after all later lines.
|
||||
// Its active line numbers start at prev_graf + 1, unlike Active::line.
|
||||
last_special_line.saturating_sub(previous_lines.saturating_add(1))
|
||||
} else {
|
||||
usize::MAX
|
||||
};
|
||||
let threshold = if pass == 0 {
|
||||
get(Parameter::Pretolerance)
|
||||
} else {
|
||||
@@ -1098,7 +1103,7 @@ fn break_lines(
|
||||
cost: a.cost.saturating_add(demerits),
|
||||
path,
|
||||
};
|
||||
let key = (a.line.min(special), 3 - fitness, b.hyphen);
|
||||
let key = (a.line.min(merged_class), 3 - fitness, b.hyphen);
|
||||
// TeX initializes each minimum to awful_bad (2^30-1).
|
||||
// Costs beyond that bound are not feasible active nodes; this
|
||||
// matters when the final pass must force an overfull line.
|
||||
@@ -1148,7 +1153,7 @@ fn break_lines(
|
||||
groups.entry(key.0).or_default().push(a);
|
||||
}
|
||||
for (class, group) in groups {
|
||||
if class < special {
|
||||
if class < merged_class {
|
||||
let at = next
|
||||
.iter()
|
||||
.position(|a| a.line >= group[0].line)
|
||||
|
||||
Reference in new issue
Block a user