diff options
| author | Laurenz <laurmaedje@gmail.com> | 2024-04-13 10:39:45 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-04-13 08:39:45 +0000 |
| commit | 020294fca9a7065d4b9cf4e677f606ebaaa29b00 (patch) | |
| tree | c0027ad22046e2726c22298461327823d6b88d53 /crates/typst-pdf | |
| parent | 72dd79210602ecc799726fc096b078afbb47f299 (diff) | |
Better test runner (#3922)
Diffstat (limited to 'crates/typst-pdf')
| -rw-r--r-- | crates/typst-pdf/src/page.rs | 4 | ||||
| -rw-r--r-- | crates/typst-pdf/src/pattern.rs | 4 |
2 files changed, 5 insertions, 3 deletions
diff --git a/crates/typst-pdf/src/page.rs b/crates/typst-pdf/src/page.rs index c31d1204..42358db5 100644 --- a/crates/typst-pdf/src/page.rs +++ b/crates/typst-pdf/src/page.rs @@ -377,7 +377,7 @@ pub struct EncodedPage { } /// Represents a resource being used in a PDF page by its name. -#[derive(Debug, Clone, PartialEq, Eq, Hash)] +#[derive(Debug, Clone, PartialEq, Eq, Hash, Ord, PartialOrd)] pub struct PageResource { kind: ResourceKind, name: EcoString, @@ -390,7 +390,7 @@ impl PageResource { } /// A kind of resource being used in a PDF page. -#[derive(Debug, Clone, PartialEq, Eq, Hash)] +#[derive(Debug, Clone, PartialEq, Eq, Hash, Ord, PartialOrd)] pub enum ResourceKind { XObject, Font, diff --git a/crates/typst-pdf/src/pattern.rs b/crates/typst-pdf/src/pattern.rs index 6dfb0f66..5d5942bc 100644 --- a/crates/typst-pdf/src/pattern.rs +++ b/crates/typst-pdf/src/pattern.rs @@ -118,13 +118,15 @@ fn register_pattern( // Render the body. let (_, content) = construct_page(ctx.parent, pattern.frame()); - let pdf_pattern = PdfPattern { + let mut pdf_pattern = PdfPattern { transform, pattern: pattern.clone(), content: content.content.wait().clone(), resources: content.resources.into_iter().collect(), }; + pdf_pattern.resources.sort(); + ctx.parent.pattern_map.insert(pdf_pattern) } |
