Honor e-TeX split shrink masks on native vertical lists
This commit is contained in:
1 parent
69efe0b895
commit
34325317d2
11 files changed
+187
-28
No files matched your search
@@ -3,6 +3,19 @@ use super::*;
|
||||
|
||||
const AWFUL: i64 = 1_073_741_823;
|
||||
|
||||
pub(super) fn log_ignored_shrink(
|
||||
files: &mut impl SourceProvider,
|
||||
diagnostic_bytes: &mut usize,
|
||||
limit: usize,
|
||||
) -> Result<(), String> {
|
||||
const TEXT: &str = "\nignored: Infinite glue shrinkage found in box being split";
|
||||
*diagnostic_bytes = diagnostic_bytes.saturating_add(TEXT.len());
|
||||
if *diagnostic_bytes > limit {
|
||||
return Err("native diagnostic output limit exceeded".into());
|
||||
}
|
||||
files.observe_diagnostic(WriteDestination::Log, TEXT)
|
||||
}
|
||||
|
||||
fn step(steps: &mut usize, limit: usize) -> Result<(), String> {
|
||||
*steps = steps.saturating_add(1);
|
||||
if *steps > limit {
|
||||
@@ -17,11 +30,14 @@ pub(super) struct VerticalBreak {
|
||||
}
|
||||
|
||||
pub(super) fn find_break(
|
||||
nodes: &[NativeVerticalNode],
|
||||
nodes: &mut [NativeVerticalNode],
|
||||
height: i64,
|
||||
max_depth: i32,
|
||||
state: &State,
|
||||
reads: &mut BTreeSet<Dependency>,
|
||||
steps: &mut usize,
|
||||
limit: usize,
|
||||
mut ignored_shrink: impl FnMut() -> Result<(), String>,
|
||||
) -> Result<VerticalBreak, String> {
|
||||
let (mut total, mut depth) = (0i64, 0i64);
|
||||
let (mut stretch, mut shrink) = ([0i64; 4], 0i64);
|
||||
@@ -105,14 +121,19 @@ pub(super) fn find_break(
|
||||
return Ok(best);
|
||||
}
|
||||
}
|
||||
match node {
|
||||
match nodes.get_mut(i) {
|
||||
Some(
|
||||
NativeVerticalNode::Glue(g)
|
||||
| NativeVerticalNode::NamedGlue(g, _)
|
||||
| NativeVerticalNode::Leaders(LeaderGlue { glue: g, .. }),
|
||||
) => {
|
||||
if g.shrink.order != 0 && g.shrink.amount != 0 {
|
||||
return Err("infinite glue shrinkage found in native box being split".into());
|
||||
reads.insert(Dependency::Parameter(Parameter::Ignoreprimitiveerror));
|
||||
if state.parameter(Parameter::Ignoreprimitiveerror).width() & 1 == 0 {
|
||||
return Err("infinite glue shrinkage found in native box being split".into());
|
||||
}
|
||||
ignored_shrink()?;
|
||||
g.shrink.order = 0;
|
||||
}
|
||||
stretch[g.stretch.order as usize] += i64::from(g.stretch.amount);
|
||||
shrink += i64::from(g.shrink.amount);
|
||||
|
||||
Reference in new issue
Block a user