mirror of
https://github.com/typst/typst
synced 2025-08-20 17:58:32 +08:00
Compare commits
2 Commits
7b629fc45a
...
ff1d4ded4a
Author | SHA1 | Date | |
---|---|---|---|
|
ff1d4ded4a | ||
|
5543400ff1 |
@ -817,6 +817,10 @@ pub struct TableCell {
|
|||||||
// TODO: feature gate
|
// TODO: feature gate
|
||||||
pub header_scope: Smart<TableHeaderScope>,
|
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.
|
/// Whether rows spanned by this cell can be placed in different pages.
|
||||||
/// When equal to `{auto}`, a cell spanning only fixed-size rows is
|
/// When equal to `{auto}`, a cell spanning only fixed-size rows is
|
||||||
/// unbreakable, while a cell spanning at least one `{auto}`-sized row is
|
/// unbreakable, while a cell spanning at least one `{auto}`-sized row is
|
||||||
|
@ -230,7 +230,7 @@ impl TableCtx {
|
|||||||
}
|
}
|
||||||
a
|
a
|
||||||
})
|
})
|
||||||
.expect("tables must have at least one column")
|
.unwrap_or(TableCellKind::Data)
|
||||||
})
|
})
|
||||||
.collect::<Vec<_>>();
|
.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())));
|
push_stack(gc, loc, StackEntryKind::Table(TableCtx::new(table.clone())));
|
||||||
return;
|
return;
|
||||||
} else if let Some(cell) = elem.to_packed::<TableCell>() {
|
} 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;
|
return;
|
||||||
} else if let Some(link) = elem.to_packed::<LinkMarker>() {
|
} else if let Some(link) = elem.to_packed::<LinkMarker>() {
|
||||||
let link_id = gc.tags.next_link_id();
|
let link_id = gc.tags.next_link_id();
|
||||||
|
@ -3,6 +3,7 @@ use std::sync::Arc;
|
|||||||
|
|
||||||
use bytemuck::TransparentWrapper;
|
use bytemuck::TransparentWrapper;
|
||||||
use krilla::surface::{Location, Surface};
|
use krilla::surface::{Location, Surface};
|
||||||
|
use krilla::tagging::SpanTag;
|
||||||
use krilla::text::GlyphId;
|
use krilla::text::GlyphId;
|
||||||
use typst_library::diag::{bail, SourceResult};
|
use typst_library::diag::{bail, SourceResult};
|
||||||
use typst_library::layout::Size;
|
use typst_library::layout::Size;
|
||||||
@ -23,7 +24,8 @@ pub(crate) fn handle_text(
|
|||||||
) -> SourceResult<()> {
|
) -> SourceResult<()> {
|
||||||
*gc.languages.entry(t.lang).or_insert(0) += t.glyphs.len();
|
*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 surface = handle.surface();
|
||||||
|
|
||||||
let font = convert_font(gc, t.font.clone())?;
|
let font = convert_font(gc, t.font.clone())?;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user