From 7dc74b7281105110e0ff8933e9ce264248f3d367 Mon Sep 17 00:00:00 2001 From: Laurenz Date: Wed, 4 Oct 2023 14:38:48 +0200 Subject: [PATCH] Bump pdf-writer and svg2pdf --- Cargo.lock | 9 +++++---- crates/typst/Cargo.toml | 4 ++-- crates/typst/src/export/pdf/color.rs | 5 ++--- crates/typst/src/export/pdf/extg.rs | 2 +- crates/typst/src/export/pdf/font.rs | 2 +- crates/typst/src/export/pdf/gradient.rs | 2 +- crates/typst/src/export/pdf/image.rs | 2 +- crates/typst/src/export/pdf/mod.rs | 6 +++--- crates/typst/src/export/pdf/outline.rs | 2 +- crates/typst/src/export/pdf/page.rs | 2 +- 10 files changed, 18 insertions(+), 18 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1217f7ee3..24cd50352 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1670,12 +1670,13 @@ dependencies = [ [[package]] name = "pdf-writer" -version = "0.8.1" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d77bc47c8968aa63f86a7e6693e270a6cbd1e3b784c364f1711a0ddecc71447" +checksum = "4b651409cd03bf702052d7491f08d27fbd6b25f96dc8b9b873ada7d0b3342b8d" dependencies = [ "bitflags 1.3.2", "itoa", + "memchr", "ryu", ] @@ -2367,9 +2368,9 @@ checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" [[package]] name = "svg2pdf" -version = "0.7.1" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2adc7de163bd53f323850e65269280b2a66ffceee291cb8eca34f2eabc3acad" +checksum = "a4283ae77d25dbee75aa1bce6b5bc8e7d802960135d6de306eaec0a5241d80c8" dependencies = [ "image", "miniz_oxide", diff --git a/crates/typst/Cargo.toml b/crates/typst/Cargo.toml index f1fea97de..33f3fada9 100644 --- a/crates/typst/Cargo.toml +++ b/crates/typst/Cargo.toml @@ -31,7 +31,7 @@ kurbo = "0.9" log = "0.4" miniz_oxide = "0.7" once_cell = "1" -pdf-writer = "0.8.1" +pdf-writer = "0.9" pixglyph = "0.2" palette = { version = "0.7.3", default-features = false, features = ["approx", "libm"] } regex = "1" @@ -41,7 +41,7 @@ rustybuzz = "0.7" serde = { version = "1.0.184", features = ["derive"] } siphasher = "0.3" subsetter = "0.1.1" -svg2pdf = "0.7.1" +svg2pdf = "0.8" tiny-skia = "0.10.0" toml = { version = "0.8", default-features = false, features = ["parse"] } tracing = "0.1.37" diff --git a/crates/typst/src/export/pdf/color.rs b/crates/typst/src/export/pdf/color.rs index b6c671eac..eb27f9693 100644 --- a/crates/typst/src/export/pdf/color.rs +++ b/crates/typst/src/export/pdf/color.rs @@ -1,10 +1,9 @@ use std::sync::Arc; use pdf_writer::types::DeviceNSubtype; -use pdf_writer::{writers, Dict, Filter, Name, PdfWriter, Ref}; +use pdf_writer::{writers, Chunk, Dict, Filter, Name, Ref}; use super::page::{PageContext, Transforms}; -use super::RefExt; use crate::export::pdf::deflate; use crate::geom::{Color, ColorSpace, Paint}; @@ -162,7 +161,7 @@ impl ColorSpaces { /// Write the necessary color spaces functions and ICC profiles to the /// PDF file. - pub fn write_functions(&self, writer: &mut PdfWriter) { + pub fn write_functions(&self, writer: &mut Chunk) { // Write the Oklab function & color space if let Some(oklab) = self.oklab { let code = oklab_function(); diff --git a/crates/typst/src/export/pdf/extg.rs b/crates/typst/src/export/pdf/extg.rs index f62bec6a7..47393b54b 100644 --- a/crates/typst/src/export/pdf/extg.rs +++ b/crates/typst/src/export/pdf/extg.rs @@ -1,6 +1,6 @@ use pdf_writer::Finish; -use crate::export::pdf::{PdfContext, RefExt}; +use crate::export::pdf::PdfContext; /// A PDF external graphics state. #[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)] diff --git a/crates/typst/src/export/pdf/font.rs b/crates/typst/src/export/pdf/font.rs index 13c691183..e1faf1b19 100644 --- a/crates/typst/src/export/pdf/font.rs +++ b/crates/typst/src/export/pdf/font.rs @@ -6,7 +6,7 @@ use pdf_writer::{Filter, Finish, Name, Rect, Str}; use ttf_parser::{name_id, GlyphId, Tag}; use unicode_properties::{GeneralCategory, UnicodeGeneralCategory}; -use super::{deflate, EmExt, PdfContext, RefExt}; +use super::{deflate, EmExt, PdfContext}; use crate::eval::Bytes; use crate::font::Font; use crate::util::SliceExt; diff --git a/crates/typst/src/export/pdf/gradient.rs b/crates/typst/src/export/pdf/gradient.rs index c6693ef3d..23ab687cf 100644 --- a/crates/typst/src/export/pdf/gradient.rs +++ b/crates/typst/src/export/pdf/gradient.rs @@ -5,7 +5,7 @@ use pdf_writer::{Finish, Ref}; use super::color::{ColorSpaceExt, PaintEncode}; use super::page::{PageContext, Transforms}; -use super::{AbsExt, PdfContext, RefExt}; +use super::{AbsExt, PdfContext}; use crate::geom::{ Abs, Color, ColorSpace, Gradient, Numeric, Quadrant, Ratio, Relative, Transform, }; diff --git a/crates/typst/src/export/pdf/image.rs b/crates/typst/src/export/pdf/image.rs index 5205c6f63..12c5fb34c 100644 --- a/crates/typst/src/export/pdf/image.rs +++ b/crates/typst/src/export/pdf/image.rs @@ -4,7 +4,7 @@ use std::sync::Arc; use image::{DynamicImage, GenericImageView, Rgba}; use pdf_writer::{Filter, Finish}; -use super::{deflate, PdfContext, RefExt}; +use super::{deflate, PdfContext}; use crate::{ geom::ColorSpace, image::{ImageKind, RasterFormat, RasterImage}, diff --git a/crates/typst/src/export/pdf/mod.rs b/crates/typst/src/export/pdf/mod.rs index 8a39a57fc..587c53617 100644 --- a/crates/typst/src/export/pdf/mod.rs +++ b/crates/typst/src/export/pdf/mod.rs @@ -19,7 +19,7 @@ use std::num::NonZeroUsize; use ecow::{eco_format, EcoString}; use pdf_writer::types::Direction; use pdf_writer::writers::PageLabel; -use pdf_writer::{Finish, Name, PdfWriter, Ref, TextStr}; +use pdf_writer::{Finish, Name, Pdf, Ref, TextStr}; use xmp_writer::{LangId, RenditionClass, XmpWriter}; use self::gradient::PdfGradient; @@ -52,7 +52,7 @@ pub fn pdf(document: &Document) -> Vec { pub struct PdfContext<'a> { document: &'a Document, introspector: Introspector, - writer: PdfWriter, + writer: Pdf, colors: ColorSpaces, pages: Vec, page_heights: Vec, @@ -84,7 +84,7 @@ impl<'a> PdfContext<'a> { Self { document, introspector: Introspector::new(&document.pages), - writer: PdfWriter::new(), + writer: Pdf::new(), colors: ColorSpaces::default(), pages: vec![], page_heights: vec![], diff --git a/crates/typst/src/export/pdf/outline.rs b/crates/typst/src/export/pdf/outline.rs index 855d9f4f0..58db7a935 100644 --- a/crates/typst/src/export/pdf/outline.rs +++ b/crates/typst/src/export/pdf/outline.rs @@ -2,7 +2,7 @@ use std::num::NonZeroUsize; use pdf_writer::{Finish, Ref, TextStr}; -use super::{AbsExt, PdfContext, RefExt}; +use super::{AbsExt, PdfContext}; use crate::geom::{Abs, Smart}; use crate::model::Content; diff --git a/crates/typst/src/export/pdf/page.rs b/crates/typst/src/export/pdf/page.rs index ec247b259..ef023f229 100644 --- a/crates/typst/src/export/pdf/page.rs +++ b/crates/typst/src/export/pdf/page.rs @@ -9,7 +9,7 @@ use pdf_writer::{Content, Filter, Finish, Name, Rect, Ref, Str}; use super::color::PaintEncode; use super::extg::ExternalGraphicsState; -use super::{deflate, AbsExt, EmExt, PdfContext, RefExt}; +use super::{deflate, AbsExt, EmExt, PdfContext}; use crate::doc::{Destination, Frame, FrameItem, GroupItem, Meta, TextItem}; use crate::eval::Repr; use crate::font::Font;