Report diagnostics and lay out cases environments
This commit is contained in:
1 parent
a28e8926c7
commit
971190df26
6 files changed
+281
-10
No files matched your search
@@ -1026,6 +1026,33 @@ impl Page {
|
||||
});
|
||||
}
|
||||
}
|
||||
MathAtom::Cases { rows } => {
|
||||
let layout = math::cases_layout(rows, font);
|
||||
let base_extent = font.height('{') + font.depth('{');
|
||||
let scale = if base_extent > 0 {
|
||||
(layout.brace.1 + layout.brace.2) as f64 / base_extent as f64
|
||||
} else {
|
||||
1.0
|
||||
};
|
||||
let glyph_size = (size as f64 * scale) as i64;
|
||||
let shift = ((glyph_size - size) as f64 * 0.35) as i64;
|
||||
list.push(DisplayItem::Text {
|
||||
font: FontFace::Roman,
|
||||
x,
|
||||
y: baseline + shift,
|
||||
size: glyph_size,
|
||||
text: "{".to_string(),
|
||||
});
|
||||
let start_x = x + layout.brace.0 + 3 * 65_536;
|
||||
let first_baseline = baseline - layout.height + layout.first_height;
|
||||
for (row_index, cells) in rows.iter().enumerate() {
|
||||
let row_baseline = first_baseline + layout.baselines[row_index];
|
||||
for (column, cell) in cells.iter().enumerate() {
|
||||
let cell_x = start_x + layout.column_starts[column];
|
||||
Self::paint_math(cell, font, cell_x, row_baseline, size, list);
|
||||
}
|
||||
}
|
||||
}
|
||||
MathAtom::Accent { accent, base } => {
|
||||
let base_box = math::layout_math(base, font);
|
||||
Self::paint_math(base, font, x, baseline, size, list);
|
||||
|
||||
Reference in new issue
Block a user