Compare commits

...

2 Commits

Author SHA1 Message Date
Tobias Schmitz
ff1d4ded4a
WIP [no ci] 2025-07-01 17:47:55 +02:00
Tobias Schmitz
5543400ff1
fix: [no ci] WIP repeatable table headers/footers 2025-07-01 17:47:55 +02:00
3 changed files with 14 additions and 3 deletions

View File

@ -817,6 +817,10 @@ pub struct TableCell {
// TODO: feature gate
pub header_scope: Smart<TableHeaderScope>,
// FIXME: this should not be public
#[default(false)]
pub is_repeated: bool,
/// Whether rows spanned by this cell can be placed in different pages.
/// When equal to `{auto}`, a cell spanning only fixed-size rows is
/// unbreakable, while a cell spanning at least one `{auto}`-sized row is

View File

@ -230,7 +230,7 @@ impl TableCtx {
}
a
})
.expect("tables must have at least one column")
.unwrap_or(TableCellKind::Data)
})
.collect::<Vec<_>>();
@ -524,7 +524,12 @@ pub(crate) fn handle_start(gc: &mut GlobalContext, elem: &Content) {
push_stack(gc, loc, StackEntryKind::Table(TableCtx::new(table.clone())));
return;
} else if let Some(cell) = elem.to_packed::<TableCell>() {
push_stack(gc, loc, StackEntryKind::TableCell(cell.clone()));
// TODO: set this in table layout
if cell.is_repeated(StyleChain::default()) {
start_artifact(gc, loc, ArtifactKind::Other);
} else {
push_stack(gc, loc, StackEntryKind::TableCell(cell.clone()));
}
return;
} else if let Some(link) = elem.to_packed::<LinkMarker>() {
let link_id = gc.tags.next_link_id();

View File

@ -3,6 +3,7 @@ use std::sync::Arc;
use bytemuck::TransparentWrapper;
use krilla::surface::{Location, Surface};
use krilla::tagging::SpanTag;
use krilla::text::GlyphId;
use typst_library::diag::{bail, SourceResult};
use typst_library::layout::Size;
@ -23,7 +24,8 @@ pub(crate) fn handle_text(
) -> SourceResult<()> {
*gc.languages.entry(t.lang).or_insert(0) += t.glyphs.len();
let mut handle = tags::start_marked(gc, surface);
let mut handle =
tags::start_span(gc, surface, SpanTag::empty().with_actual_text(Some(&t.text)));
let surface = handle.surface();
let font = convert_font(gc, t.font.clone())?;