use super::*;
fn cell_para_face(fonts: &Fonts, para: &CellPara) -> (f32, FaceRef) {
cell_runs_face(fonts, ¶.runs)
}
fn cell_runs_face(fonts: &Fonts, runs: &[TextRun]) -> (f32, FaceRef) {
let size = runs.iter().map(|r| r.style.size).fold(0.0_f32, f32::max);
let size = if size > 0.0 { size } else { 11.0 };
let largest = |inked: bool| {
runs.iter()
.filter(|r| {
if inked {
!r.text.trim().is_empty()
} else {
!r.text.is_empty()
}
})
.reduce(|a, b| if b.style.size > a.style.size { b } else { a })
};
let face_id = largest(true)
.or_else(|| largest(false))
.map(|r| {
fonts.resolve(
paint_family(&r.style, &r.text),
r.style.bold,
r.style.italic,
)
})
.unwrap_or_else(|| FaceId::CarlitoRegular.into());
(size, face_id)
}
pub(super) fn cell_para_line_box(fonts: &Fonts, para: &CellPara) -> (f32, f32) {
cell_runs_line_box(fonts, ¶.runs, ¶.style)
}
pub(super) fn cell_line_metrics(
fonts: &Fonts,
para: &CellPara,
line: &[TextRun],
) -> (f32, FaceRef, f32) {
let inked: Vec<TextRun> = line
.iter()
.filter(|r| !r.text.trim().is_empty())
.cloned()
.collect();
let runs = if line.iter().any(|r| !r.text.trim().is_empty()) {
&inked[..]
} else {
¶.runs
};
let (size, face_id) = cell_runs_face(fonts, runs);
(
size,
face_id,
cell_runs_line_box(fonts, runs, ¶.style).1,
)
}
pub(super) fn cell_runs_line_box(fonts: &Fonts, runs: &[TextRun], style: &ParaStyle) -> (f32, f32) {
let (size, box_h) = cell_font_line_box(fonts, runs, style);
let box_h = line_box_for_math(fonts, runs, size, box_h, style);
let pic_h = runs
.iter()
.filter_map(|r| r.pic.as_ref().map(|p| p.h))
.fold(0.0_f32, f32::max);
let drop = runs
.iter()
.filter_map(|r| r.math.as_ref().map(|m| m.ascent))
.fold(
fonts.get(cell_runs_face(fonts, runs).1).ascent_pt(size),
f32::max,
);
let extra = if style.line_exact.is_some() {
0.0
} else {
(pic_h - drop).max(0.0)
};
(size, box_h + extra)
}
fn line_box_for_math(
fonts: &Fonts,
runs: &[TextRun],
size: f32,
box_h: f32,
style: &ParaStyle,
) -> f32 {
let mut up = 0.0_f32;
let mut down = 0.0_f32;
let mut any = false;
for run in runs {
if let Some(math) = &run.math {
any = true;
up = up.max(math.ascent);
down = down.max(math.descent);
}
}
if !any {
return box_h;
}
let face = fonts.get(cell_runs_face(fonts, runs).1);
let em = size.max(1.0);
let natural = (face.ascent_pt(em).max(up) + face.line_descent_pt(em).max(down))
.max(face.single_line_pt(em));
box_h.max(line_box_from_natural(natural, style))
}
pub(super) fn cell_baseline_drop(
face: &Face,
size: f32,
line: &[TextRun],
line_box: f32,
exact: bool,
grid_pad: f32,
) -> f32 {
if exact {
return exact_baseline(line_box);
}
let math_up = line
.iter()
.filter_map(|run| {
run.math
.as_ref()
.map(|math| math.ascent)
.or_else(|| run.pic.as_ref().map(|p| p.h))
})
.fold(0.0_f32, f32::max);
if math_up > 0.0 {
face.ascent_pt(size).max(math_up)
} else {
face.ascent_pt(size) + grid_pad
}
}
fn cell_font_line_box(fonts: &Fonts, runs: &[TextRun], style: &ParaStyle) -> (f32, f32) {
let (size, face_id) = cell_runs_face(fonts, runs);
let grid = para_grid_pitch(style, style.cell_grid);
if grid > 0.5 {
let natural = fonts.get(face_id).single_line_pt(size.max(1.0));
return (size, grid_line_box(natural, style, grid));
}
let marker = runs.first().filter(|r| r.list_marker);
let text = runs
.iter()
.filter(|r| !r.list_marker && !r.text.trim().is_empty())
.reduce(|a, b| if b.style.size > a.style.size { b } else { a });
if let (Some(m), Some(t)) = (marker, text) {
let face_of =
|r: &TextRun| fonts.get(fonts.resolve(&r.style.family, r.style.bold, r.style.italic));
let (mf, tf) = (face_of(m), face_of(t));
let (ms, ts) = (m.style.size.max(1.0), t.style.size.max(1.0));
let up = mf.single_line_pt(ms) - mf.line_descent_pt(ms);
let own = tf.single_line_pt(ts);
let natural = own.max(up + tf.line_descent_pt(ts));
let st = style;
if st.line_exact.is_none() && st.line_at_least.is_none() && st.line_mult > 1.0 {
return (size, line_box_from_natural(own, st) + (natural - own));
}
return (size, line_box_from_natural(natural, st));
}
(size, para_line_box(fonts.get(face_id), size, style))
}
pub(super) fn cell_para_height(fonts: &Fonts, para: &CellPara, wrap_w: f32) -> f32 {
let text_h = cell_para_text_h(fonts, para, wrap_w);
let lead = cell_lead_picture(para);
let side = cell_side_float(fonts, para, wrap_w);
let mut images_h = 0.0_f32;
let mut below = 0.0_f32;
for img in para
.images
.iter()
.filter(|img| !lead.is_some_and(|l| std::ptr::eq(l, *img)))
{
let (_, _, drop, room) = cell_image_place(img, para.style.align);
if !room {
continue;
}
let h = cell_image_wh(img).1;
if side.is_some() || cell_float_below(para, img, drop, text_h) {
below = below.max(drop + h);
} else {
images_h += h + drop;
}
}
para.style.before + (images_h + text_h).max(below) + para.style.after
}
pub(super) fn cell_para_text_h(fonts: &Fonts, para: &CellPara, wrap_w: f32) -> f32 {
if cell_para_is_image_only(para) {
return picture_line_leading(fonts, para);
}
let line_box = cell_para_line_box(fonts, para).1;
let ((lines, _), _) = cell_para_wrap(fonts, para, wrap_w);
let lines_h: f32 = lines
.iter()
.map(|line| cell_line_h(fonts, para, line))
.sum();
lines_h.max(line_box) + cell_lead_rise(fonts, para)
}
fn cell_line_h(fonts: &Fonts, para: &CellPara, line: &[TextRun]) -> f32 {
cell_line_metrics(fonts, para, line).2
}
pub(super) fn cell_para_wrap(
fonts: &Fonts,
para: &CellPara,
wrap_w: f32,
) -> (LaidCellPara, (usize, f32)) {
let (first_w, rest_w) = cell_para_widths(fonts, para, wrap_w);
let Some((shift, bottom)) = cell_side_float(fonts, para, wrap_w) else {
return (
wrap_cell_runs(fonts, para, first_w, rest_w, (0, 0.0)),
(0, 0.0),
);
};
let mut narrow = usize::MAX;
let mut laid = wrap_cell_runs(fonts, para, first_w, rest_w, (narrow, shift));
for _ in 0..3 {
let mut top = cell_lead_rise(fonts, para);
let beside = laid
.0
.iter()
.take_while(|line| {
let open = top < bottom - 0.01;
top += cell_line_h(fonts, para, line);
open
})
.count();
if beside == narrow.min(laid.0.len()) {
break;
}
narrow = beside;
laid = wrap_cell_runs(fonts, para, first_w, rest_w, (narrow, shift));
}
let beside = narrow.min(laid.0.len());
(laid, (beside, shift))
}
pub(super) fn cell_side_float(fonts: &Fonts, para: &CellPara, wrap_w: f32) -> Option<(f32, f32)> {
if cell_para_is_image_only(para) || cell_lead_picture(para).is_some() {
return None;
}
let [img] = para.images.as_slice() else {
return None;
};
let ImageSlot::Float {
align: Align::Left,
col_x,
para_y,
wrap_square: true,
dist_r,
dist_b,
..
} = img.slot
else {
return None;
};
if img.behind || !cell_holds_image(img) {
return None;
}
let (dw, dh) = cell_image_wh(img);
let drop = para_y.unwrap_or(0.0).max(0.0);
let shift = (col_x.unwrap_or(0.0) + dw + dist_r).max(0.0);
(wrap_w - shift >= MIN_SIDE_FLOAT_ROOM_PT && drop < cell_para_line_box(fonts, para).1)
.then_some((shift, drop + dh + dist_b))
}
pub(super) fn cell_float_below(para: &CellPara, img: &LaidImage, drop: f32, text_h: f32) -> bool {
matches!(img.slot, ImageSlot::Float { .. })
&& !cell_para_is_image_only(para)
&& drop >= text_h - 0.5
}
pub(super) fn cell_lead_rise(fonts: &Fonts, para: &CellPara) -> f32 {
cell_lead_picture(para).map_or(0.0, |img| {
let (size, face_id) = cell_para_face(fonts, para);
(cell_image_wh(img).1 - fonts.get(face_id).ascent_pt(size)).max(0.0)
})
}
pub(super) fn picture_line_leading(fonts: &Fonts, para: &CellPara) -> f32 {
let style = ¶.style;
if style.line_exact.is_some() || style.line_at_least.is_some() || style.line_mult <= 1.0 {
return 0.0;
}
let mark = style
.mark_run
.as_deref()
.or_else(|| para.runs.first().map(|r| &r.style));
let (family, bold, italic, size) = mark.map_or(("Calibri", false, false, 11.0), |m| {
(m.family.as_str(), m.bold, m.italic, m.size)
});
let face = fonts.get(fonts.resolve(family, bold, italic));
(style.line_mult - 1.0) * face.single_line_pt(size)
}
pub(super) fn cell_holds_image(img: &LaidImage) -> bool {
match img.slot {
ImageSlot::Flow => true,
ImageSlot::Float {
page_x,
page_y,
pct_x,
pct_y,
..
} => page_x.is_none() && page_y.is_none() && pct_x.is_none() && pct_y.is_none(),
}
}
pub(super) fn cell_image_place(
img: &LaidImage,
para_align: Align,
) -> (Align, Option<f32>, f32, bool) {
match img.slot {
ImageSlot::Flow => (para_align, None, 0.0, true),
ImageSlot::Float {
align,
col_x,
para_y,
wrap_square,
wrap_top_bottom,
..
} => (
align,
col_x,
para_y.unwrap_or(0.0).max(0.0),
!img.behind && (wrap_square || wrap_top_bottom),
),
}
}
pub(super) fn cell_lead_picture(para: &CellPara) -> Option<&LaidImage> {
if para.runs.iter().all(|r| r.text.trim().is_empty())
|| matches!(para.style.align, Align::Center | Align::Right)
{
return None;
}
let size = para
.runs
.iter()
.map(|r| r.style.size)
.fold(0.0_f32, f32::max)
.max(1.0);
para.images.first().filter(|img| {
let (w, h) = cell_image_wh(img);
matches!(img.slot, ImageSlot::Flow)
&& img.lead_chars == 0
&& h <= 2.0 * size
&& w <= 4.0 * size
})
}
pub(super) fn cell_para_is_image_only(para: &CellPara) -> bool {
para.images
.iter()
.any(|img| cell_image_place(img, para.style.align).3)
&& para.runs.iter().all(|r| r.text.trim().is_empty())
}
pub(super) fn cell_image_wh(img: &LaidImage) -> (f32, f32) {
(img.w.max(1.0), img.h.max(1.0))
}
pub(super) fn drop_trailing_break(para: &mut CellPara) {
let Some(ri) = para.runs.iter().rposition(|r| !r.text.is_empty()) else {
return;
};
let run = &mut para.runs[ri];
if !run.text.ends_with('\n') {
return;
}
run.text.pop();
if run.text.is_empty() {
para.runs.remove(ri);
}
para.style.after = 0.0;
}
pub(super) fn cell_content_height(fonts: &Fonts, cell: &TableCell, col_w: &[f32]) -> f32 {
let empty = cell.nested.is_empty()
&& cell
.paras
.iter()
.all(|p| p.images.is_empty() && p.runs.iter().all(|r| r.text.trim().is_empty()));
if cell.hide_mark && empty {
return cell.pad_t + cell.pad_b;
}
let cw: f32 = (0..cell.colspan)
.map(|i| col_w.get(cell.col + i).copied().unwrap_or(80.0))
.sum();
let wrap_w = cell_wrap_width(cell, cw);
let paras_h: f32 = if cell.paras.is_empty() && cell.nested.is_empty() {
let mut style = Defaults::word().para;
style.before = 0.0;
style.after = 0.0;
cell_para_height(
fonts,
&CellPara {
runs: Vec::new(),
images: Vec::new(),
boxes: Vec::new(),
style,
bookmarks: Vec::new(),
blank_bookmarks: Vec::new(),
continued: false,
vertical: false,
squeeze: Squeeze::NONE,
hang_spaces: false,
},
wrap_w,
)
} else {
let closing = cell
.nested_at
.last()
.is_some_and(|&at| at + 1 == cell.paras.len())
&& cell.paras.last().is_some_and(|p| {
p.images.is_empty() && p.runs.iter().all(|r| r.text.trim().is_empty())
});
let counted = cell.paras.len() - usize::from(closing);
cell.paras[..counted]
.iter()
.map(|p| cell_para_height(fonts, p, wrap_w))
.sum()
};
let closing = cell.paras.len()
- usize::from(
cell.nested_at
.last()
.is_some_and(|&at| at + 1 == cell.paras.len())
&& cell.paras.last().is_some_and(|p| {
p.images.is_empty() && p.runs.iter().all(|r| r.text.trim().is_empty())
}),
);
let mut hung: Vec<(usize, f32)> = Vec::new();
let mut nested_h: f32 = 0.0;
for (k, b) in cell.nested.iter().enumerate() {
let h = nested_table_height(fonts, b, wrap_w);
let Some((dy, ..)) = nested_float_beside(cell, k) else {
nested_h += h;
continue;
};
let after = match b.as_ref() {
Block::Table { style, .. } => style.after,
_ => 0.0,
};
let at = cell.nested_at[k];
let beside: f32 = cell.paras[at..closing.max(at)]
.iter()
.map(|p| cell_para_height(fonts, p, wrap_w))
.sum();
let over = (dy + h - after - beside).max(0.0);
match hung.iter_mut().find(|(a, _)| *a == at) {
Some((_, o)) => *o = o.max(over),
None => hung.push((at, over)),
}
}
let nested_h = nested_h + hung.iter().map(|(_, o)| o).sum::<f32>();
cell.pad_t + paras_h + nested_h + cell.pad_b
}
pub(super) fn nested_float_beside(
cell: &TableCell,
k: usize,
) -> Option<(f32, Option<f32>, Option<f32>)> {
let at = *cell.nested_at.get(k)?;
let text_float = |k: usize| {
let Block::Table { geom, .. } = &**cell.nested.get(k)? else {
return None;
};
let slot @ ImageSlot::Float {
para_y,
page_x,
col_x,
..
} = geom.float?
else {
return None;
};
float_is_text_anchored(slot).then_some((para_y, page_x, col_x))
};
let (para_y, page_x, col_x) = text_float(k)?;
let run = (0..cell.nested.len())
.filter(|&j| cell.nested_at[j] == at)
.all(|j| text_float(j).is_some());
let siblings = cell.nested_at.iter().filter(|&&a| a == at).count();
let dy = if run && siblings > 1 && cell.nested_at.last() == Some(&at) {
para_y.unwrap_or(0.0)
} else if k + 1 == cell.nested.len() && at + 1 < cell.paras.len() {
para_y?
} else {
return None;
};
let empty = cell.paras[at..].iter().all(|p| {
p.images.is_empty() && p.boxes.is_empty() && p.runs.iter().all(|r| r.text.trim().is_empty())
});
empty.then_some((dy, page_x, col_x))
}
fn nested_table_height(fonts: &Fonts, block: &Block, avail: f32) -> f32 {
let Block::Table {
cols,
rows,
style,
geom,
..
} = block
else {
return 0.0;
};
let col_w = resolved_col_widths(fonts, cols, rows, geom, avail);
let rows_h: f32 = table_row_heights(fonts, rows, &col_w, geom).iter().sum();
rows_h + style.after
}
pub(super) fn split_nested_rows(
block: &Block,
m: usize,
mid: Option<(Vec<TableCell>, Vec<TableCell>)>,
) -> Option<(Block, Block)> {
let Block::Table {
cols,
rows,
style,
borders,
geom,
} = block
else {
return None;
};
if m >= rows.len() || (m == 0 && mid.is_none()) {
return None;
}
let part =
|range: std::ops::Range<usize>, after: f32, split: Option<(usize, Vec<TableCell>)>| {
let mut g = (**geom).clone();
let cut = |v: &Vec<f32>| {
v.get(range.clone())
.map(<[f32]>::to_vec)
.unwrap_or_default()
};
g.row_min = cut(&geom.row_min);
g.bottom_above = cut(&geom.bottom_above);
g.row_exact = geom
.row_exact
.get(range.clone())
.map(<[bool]>::to_vec)
.unwrap_or_default();
g.row_cant_split = geom
.row_cant_split
.get(range.clone())
.map(<[bool]>::to_vec)
.unwrap_or_default();
if range.start > 0 || (split.is_some() && range.start == m) {
g.header_rows = 0;
}
let mut part_rows = rows[range].to_vec();
if let Some((at, cells)) = split {
part_rows[at] = cells;
if let Some(v) = g.row_min.get_mut(at) {
*v = 0.0;
}
if let Some(v) = g.row_exact.get_mut(at) {
*v = false;
}
}
let mut st = style.clone();
st.after = after;
Block::Table {
cols: cols.clone(),
rows: part_rows,
style: st,
borders: *borders,
geom: Box::new(g),
}
};
Some(match mid {
None => (
part(0..m, 0.0, None),
part(m..rows.len(), style.after, None),
),
Some((head, tail)) => (
part(0..m + 1, 0.0, Some((m, head))),
part(m..rows.len(), style.after, Some((0, tail))),
),
})
}
pub(super) fn table_row_heights(
fonts: &Fonts,
rows: &[Vec<TableCell>],
col_w: &[f32],
geom: &TableGeom,
) -> Vec<f32> {
let mut h: Vec<f32> = rows
.iter()
.enumerate()
.map(|(ri, row)| table_row_height_pt(fonts, row, col_w, geom, ri))
.collect();
for (ri, row) in rows.iter().enumerate() {
for cell in row.iter().filter(|c| c.rowspan > 1) {
let last = (ri + cell.rowspan).min(rows.len()) - 1;
let need = cell_content_height(fonts, cell, col_w)
+ row_top_rule(row, geom, ri)
+ row_bottom_rule(&rows[last], geom, last);
let have: f32 = h[ri..=last].iter().sum();
if need > have {
h[last] += need - have;
}
}
}
h
}
pub(super) fn table_row_height_pt(
fonts: &Fonts,
row: &[TableCell],
col_w: &[f32],
geom: &TableGeom,
ri: usize,
) -> f32 {
let spec = geom.row_min.get(ri).copied().unwrap_or(0.0);
let exact = geom.row_exact.get(ri).copied().unwrap_or(false);
let _ = (geom.pad_v, geom.unstyled, geom.table_grid);
if exact && spec > 0.0 {
return spec;
}
let content = row
.iter()
.filter(|cell| cell.rowspan <= 1)
.map(|cell| cell_content_height(fonts, cell, col_w))
.fold(0.0_f32, f32::max);
let pads = row
.iter()
.map(|c| c.pad_t + c.pad_b)
.fold(0.0_f32, f32::max);
content.max(spec + pads) + row_top_rule(row, geom, ri) + row_bottom_rule(row, geom, ri)
}
fn row_bottom_rule(row: &[TableCell], geom: &TableGeom, ri: usize) -> f32 {
if ri + 1 < geom.row_min.len() {
return 0.0;
}
split_bottom_rule(row, geom)
}
pub(super) fn split_bottom_rule(row: &[TableCell], geom: &TableGeom) -> f32 {
row.iter()
.map(|cell| {
cell.borders
.map_or(geom.rules[2], |cb| cb.bottom.map_or(0.0, |(_, w)| w))
})
.fold(0.0_f32, f32::max)
}
pub(super) fn row_top_rule(row: &[TableCell], geom: &TableGeom, ri: usize) -> f32 {
let table_rule = geom.rules[usize::from(ri > 0)];
row.iter()
.map(|cell| {
cell.borders
.map_or(table_rule, |cb| cb.top.map_or(0.0, |(_, w)| w))
})
.fold(geom.bottom_above.get(ri).copied().unwrap_or(0.0), f32::max)
}
pub(super) fn runs_size(runs: &[TextRun]) -> f32 {
let size = runs.iter().map(|r| r.style.size).fold(0.0_f32, f32::max);
if size > 0.0 { size } else { 11.0 }
}
pub(super) fn para_single_line_pt(fonts: &Fonts, runs: &[TextRun]) -> f32 {
let face = runs.first().map_or(FaceId::CarlitoRegular.into(), |r| {
fonts.resolve(&r.style.family, r.style.bold, r.style.italic)
});
fonts.get(face).single_line_pt(runs_size(runs))
}
pub(super) fn para_first_line_pt(
fonts: &Fonts,
runs: &[TextRun],
style: &ParaStyle,
grid_pitch: f32,
) -> f32 {
let size = runs_size(runs);
let face = runs.first().map_or(FaceId::CarlitoRegular.into(), |r| {
fonts.resolve(&r.style.family, r.style.bold, r.style.italic)
});
grid_line_box(
fonts.get(face).single_line_pt(size),
style,
para_grid_pitch(style, grid_pitch),
)
}
pub(super) fn keep_lines_need_pt(
fonts: &Fonts,
runs: &[TextRun],
style: &ParaStyle,
width: f32,
grid_pitch: f32,
) -> f32 {
if !style.keep_lines {
return 0.0;
}
let lines = wrap_runs(fonts, runs, width, width, false);
if lines.len() <= 1 {
return 0.0;
}
para_first_line_pt(fonts, runs, style, grid_pitch) * lines.len() as f32
}
pub(super) fn keep_next_follow_pt(
fonts: &Fonts,
avail: f32,
block: &Block,
grid_pitch: f32,
para_lines: usize,
) -> f32 {
match block {
Block::Table {
cols, rows, geom, ..
} => {
let col_w = resolved_col_widths(fonts, cols, rows, geom, avail);
rows.first()
.map(|row| table_row_height_pt(fonts, row, &col_w, geom, 0))
.unwrap_or(0.0)
}
Block::Paragraph {
runs,
style,
images,
boxes,
..
} => {
let lines = if style.keep_lines {
para_lines.max(1)
} else if style.widow_control {
match para_lines {
n @ 2..=3 => n,
n if n > 3 => 2,
_ => 1,
}
} else {
1
};
let inline_h = images
.iter()
.filter(|img| matches!(img.slot, ImageSlot::Flow))
.map(|img| img.h)
.chain(
runs.iter()
.filter_map(|r| r.pic.as_deref().map(|img| img.h)),
)
.chain(
boxes
.iter()
.filter(|b| matches!(b.slot, ImageSlot::Flow))
.map(|b| b.h),
)
.fold(0.0_f32, f32::max);
let line = para_first_line_pt(fonts, runs, style, grid_pitch).max(inline_h);
let size = runs_size(runs);
let face = runs.first().map_or(FaceId::CarlitoRegular.into(), |r| {
fonts.resolve(&r.style.family, r.style.bold, r.style.italic)
});
let face = fonts.get(face);
let last = line_fit_need(face.single_line_pt(size), 0.0, style, line).max(inline_h);
style.before + line * (lines - 1) as f32 + last
}
Block::PageBreak { .. } | Block::ColumnBreak | Block::SectionCols { .. } => 0.0,
}
}
pub(super) fn block_is_blank(block: &Block) -> bool {
match block {
Block::Paragraph {
runs,
images,
boxes,
..
} => images.is_empty() && boxes.is_empty() && runs.iter().all(|r| r.text.trim().is_empty()),
Block::Table { rows, .. } => rows.is_empty(),
Block::PageBreak { .. } | Block::ColumnBreak | Block::SectionCols { .. } => true,
}
}
pub(super) fn keep_table_spacing_unset_by_style(
pstyle: &mut ParaStyle,
table: &TableParaSpacing,
style_sets: [bool; 3],
) {
let [sets_after, sets_before, sets_line] = style_sets;
let [table_space, table_line] = table.sets;
let table = table.para;
if table_space && !sets_after {
pstyle.after = table.after;
}
if table_space && !sets_before {
pstyle.before = table.before;
}
if table_line && !sets_line {
pstyle.line_mult = table.line_mult;
pstyle.line_exact = table.line_exact;
pstyle.line_at_least = table.line_at_least;
}
}
pub(super) fn take_table_ind_jc(
pstyle: &mut ParaStyle,
table: &TableParaSpacing,
style_sets: (bool, bool),
) {
let (table_ind, table_jc) = table.sets_ind_jc;
if table_ind && !style_sets.0 {
pstyle.indent_left = table.para.indent_left;
}
if table_jc && !style_sets.1 {
pstyle.align = table.para.align;
}
}
pub(super) struct TableParaSpacing<'a> {
pub(super) para: &'a ParaStyle,
pub(super) sets: [bool; 2],
pub(super) sets_ind_jc: (bool, bool),
}