Rotated content in the table cell align with `center + bottom` not aligned correct
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 56.1k
- Forks
- 1.7k
- Avg merge
- 3d 10h
- Merged PRs (30d)
- 22
Description
Description
I hope that after rotating the content in a table cell by -90 degrees, it will be centered and aligned downwards. However, I have found that using the rotate function does not center and align the selected content downwards as intended, but instead aligns it to the left. In contrast, using the rotatex function (from https://github.com/typst/typst/issues/528#issuecomment-1494318510) to rotate does not present this issue.
#let rotatex(body,angle) = style(styles => {
let size = measure(body,styles)
box(inset:(x: -size.width/2+(size.width*calc.abs(calc.cos(angle))+size.height*calc.abs(calc.sin(angle)))/2,
y: -size.height/2+(size.height*calc.abs(calc.cos(angle))+size.width*calc.abs(calc.sin(angle)))/2),
rotate(body,angle))
})
#table(
columns: (1fr,) * 32,
align: center + horizon,
table.cell(colspan: 31)[],
table.cell(align: center + bottom, rotatex([ABC], -90deg))
)
#table(
columns: (1fr,) * 32,
align: center + horizon,
table.cell(colspan: 31)[],
table.cell(align: center + bottom, rotate(-90deg, reflow: true, [ABC]))
)
Reproduction URL
No response
Operating system
Windows
Typst version
- I am using the latest version of Typst
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the provided table reproduction and compare rotate(-90deg, reflow: true, [ABC]) with the custom rotatex helper. Trace how rotated content is sized and aligned inside table.cell(align: center + bottom, ...); done means the built-in rotation centers the content and aligns it downward like the helper.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100