Expand description
The tabular grid solver: row/column metrics, MultiCell span
bookkeeping, and cell content fitting. A faithful port of v0.0.6’s
src/backend/tabular.ml (main/determine_row_metrics/
determine_column_width/normalize_tabular/transpose_tabular/
solidify_tabular, cited by name below), adapted two ways:
- Depth sign.
tabular.mlthreads negative depths (more negative = deeper) throughLength.min/Length.negate. This port’snatural_metricsreturns a non-negative “how far below the baseline” magnitude (seehbox.rs), so every upstreammin/negatepair becomes a plainmax/+here. - Row/column indexing.
normalize_tabularalways produces a rectangular grid, so a positional transpose (by column index) replaces upstream’s recursivechop_column/transpose_tabular.
Malformed grids degrade, they don’t panic: where upstream asserts
false on a cell that should have been an EmptyCell continuing a pending
span (or a span declared with numrow/numcol < 1), this port drops the
bogus pending state / clamps to 1 and keeps going.
Structs§
- Paddings
paddings(horzBox.ml’spaddingL/R/T/B).- Solved
Tabular.main’s result (tabular.ml:309).xsascends from0(column boundaries);ysdescends fromheight(row tops,handlePdf.ml:214-220) down to0.- Tabular
Box - The solved
PHGFixedTabularpayload (horzBox.ml:279), minusrules(filled in lang-side once the rule callback runs,primitives.rs’sprim_tabular). - Tabular
Cell Box - One placed cell inside a solved
TabularBox: its box-local anchor (x= left edge,baseline_y= content baseline, both y-up from the box’s own baseline-left origin) and its content already fitted to the cell’s (or, for a span, combined) column width.EmptyCells produce no entry at all.
Enums§
- Cell
cell(horzBox.ml:447). Content is already-measured pure boxes, so the solver never threads aContext.
Functions§
- main
Tabular.main(tabular.ml:309): solve the whole grid.