Skip to content

Conversation

PgBiel
Copy link
Contributor

@PgBiel PgBiel commented Dec 19, 2023

Fixes #2616
First task in #3001.
Implements all missing table parameters in grid, namely align, inset, fill and stroke.
Added tests.

Implementation details

  • align and inset are handled by Grid and Table themselves through the apply_align_inset_to_cells function.
  • fill and stroke are handled inside GridLayouter, on .layout() (which calls .render_fills_strokes()).
  • The implementations for those were just taken directly from TableElem's code.
  • The way things are organized might change once table.cell and grid.cell are implemented in a future PR.

Possible improvements

  • Might need to improve the doc examples (most were copied from table's docs).
  • I considered moving all of Grid and Table impl Layout code to a function like layout_grid, since it's the same, but I figured that this is already more or less GridLayouter's job anyway - but I still felt like align and inset, at least for now, could be handled outside of it. So, at the moment, there is a bit of duplication, but maybe it's not that bad? I can make some layout_grid function either way if that's better.

@PgBiel PgBiel mentioned this pull request Dec 19, 2023
18 tasks
@laurmaedje laurmaedje merged commit 111a69f into typst:main Dec 19, 2023
@laurmaedje
Copy link
Member

Looking great, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Align available parameters on grid and table
2 participants