diff --git a/Cargo.lock b/Cargo.lock index be0c37ff9..7295c6d04 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1373,7 +1373,7 @@ dependencies = [ [[package]] name = "krilla" version = "0.4.0" -source = "git+https://github.com/saecki/krilla?branch=tag-attributes#5ae27ecab2f74d7a5e58b962f04c85bc2662602e" +source = "git+https://github.com/LaurenzV/krilla?branch=main#c0a456829bb63212470a6fa29d604dd9e051a9bd" dependencies = [ "base64", "bumpalo", @@ -1402,7 +1402,7 @@ dependencies = [ [[package]] name = "krilla-svg" version = "0.1.0" -source = "git+https://github.com/saecki/krilla?branch=tag-attributes#5ae27ecab2f74d7a5e58b962f04c85bc2662602e" +source = "git+https://github.com/LaurenzV/krilla?branch=main#c0a456829bb63212470a6fa29d604dd9e051a9bd" dependencies = [ "flate2", "fontdb", diff --git a/Cargo.toml b/Cargo.toml index f59b74e97..1e2bd70de 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -73,8 +73,8 @@ image = { version = "0.25.5", default-features = false, features = ["png", "jpeg indexmap = { version = "2", features = ["serde"] } infer = { version = "0.19.0", default-features = false } kamadak-exif = "0.6" -krilla = { git = "https://github.com/saecki/krilla", branch = "tag-attributes", default-features = false, features = ["raster-images", "comemo", "rayon"] } -krilla-svg = { git = "https://github.com/saecki/krilla", branch = "tag-attributes" } +krilla = { git = "https://github.com/LaurenzV/krilla", branch = "main", default-features = false, features = ["raster-images", "comemo", "rayon"] } +krilla-svg = { git = "https://github.com/LaurenzV/krilla", branch = "main" } kurbo = "0.11" libfuzzer-sys = "0.4" lipsum = "0.9" diff --git a/crates/typst-pdf/src/tags/table.rs b/crates/typst-pdf/src/tags/table.rs index a4346460a..969440f2f 100644 --- a/crates/typst-pdf/src/tags/table.rs +++ b/crates/typst-pdf/src/tags/table.rs @@ -3,7 +3,7 @@ use std::num::NonZeroU32; use az::SaturatingAs; use krilla::tagging::{ - TableCellSpan, TableDataCell, TableHeaderCell, TagBuilder, TagId, TagIdRefs, TagKind, + TableCellSpan, TableDataCell, TableHeaderCell, TagBuilder, TagId, TagKind, }; use smallvec::SmallVec; use typst_library::foundations::{Packed, Smart, StyleChain}; @@ -90,7 +90,7 @@ impl TableCtx { rowspan: rowspan.try_into().unwrap_or(NonZeroU32::MAX), colspan: colspan.try_into().unwrap_or(NonZeroU32::MAX), kind, - headers: TagIdRefs::NONE, + headers: SmallVec::new(), nodes, }); } @@ -244,8 +244,8 @@ impl TableCtx { } if let Some((_, cell_id)) = current_header.last() { - if !cell.headers.ids.contains(&cell_id) { - cell.headers.ids.push(cell_id.clone()); + if !cell.headers.contains(&cell_id) { + cell.headers.push(cell_id.clone()); } } @@ -294,7 +294,7 @@ struct TableCtxCell { rowspan: NonZeroU32, colspan: NonZeroU32, kind: Smart, - headers: TagIdRefs, + headers: SmallVec<[TagId; 1]>, nodes: Vec, } @@ -314,9 +314,9 @@ fn should_group_rows(a: TableCellKind, b: TableCellKind) -> bool { } fn table_cell_id(table_id: TableId, x: u32, y: u32) -> TagId { - let mut buf = SmallVec::new(); + let mut buf = SmallVec::<[u8; 32]>::new(); _ = write!(&mut buf, "{}x{x}y{y}", table_id.0); - TagId::from_smallvec(buf) + TagId::from(buf) } fn table_header_scope(scope: TableHeaderScope) -> krilla::tagging::TableHeaderScope { @@ -414,24 +414,17 @@ mod tests { ) -> TagNode { let scope = table_header_scope(scope); let id = table_cell_id(TableId(324), x, y); - let ids = headers - .map(|(x, y)| table_cell_id(TableId(324), x, y)) - .into_iter() - .collect(); + let ids = headers.map(|(x, y)| table_cell_id(TableId(324), x, y)); TagNode::Group( - TagKind::TH(TableHeaderCell::new(scope).with_headers(TagIdRefs { ids })) - .with_id(Some(id)), + TagKind::TH(TableHeaderCell::new(scope).with_headers(ids)).with_id(Some(id)), Vec::new(), ) } fn td(headers: [(u32, u32); SIZE]) -> TagNode { - let ids = headers - .map(|(x, y)| table_cell_id(TableId(324), x, y)) - .into_iter() - .collect(); + let ids = headers.map(|(x, y)| table_cell_id(TableId(324), x, y)); TagNode::Group( - TagKind::TD(TableDataCell::new().with_headers(TagIdRefs { ids })).into(), + TagKind::TD(TableDataCell::new().with_headers(ids)).into(), Vec::new(), ) }