From 30ad72145b8707ef6899450f8367b33c4bad8d43 Mon Sep 17 00:00:00 2001 From: Laurenz Stampfl Date: Mon, 10 Mar 2025 14:11:26 +0100 Subject: [PATCH] Re-order imports --- crates/typst-pdf/src/convert.rs | 40 +++++++++++++++++---------------- crates/typst-pdf/src/embed.rs | 3 ++- crates/typst-pdf/src/shape.rs | 7 +++--- 3 files changed, 27 insertions(+), 23 deletions(-) diff --git a/crates/typst-pdf/src/convert.rs b/crates/typst-pdf/src/convert.rs index ef29a3ccf..0435b650a 100644 --- a/crates/typst-pdf/src/convert.rs +++ b/crates/typst-pdf/src/convert.rs @@ -1,5 +1,23 @@ use std::collections::{BTreeMap, HashMap, HashSet}; +use krilla::annotation::Annotation; +use krilla::destination::{NamedDestination, XyzDestination}; +use krilla::error::KrillaError; +use krilla::page::PageLabel; +use krilla::path::PathBuilder; +use krilla::surface::Surface; +use krilla::{Configuration, Document, PageSettings, SerializeSettings, ValidationError}; +use typst_library::diag::{bail, SourceResult}; +use typst_library::foundations::NativeElement; +use typst_library::introspection::Location; +use typst_library::layout::{ + Abs, Frame, FrameItem, GroupItem, PagedDocument, Size, Transform, +}; +use typst_library::model::HeadingElem; +use typst_library::text::{Font, Lang}; +use typst_library::visualize::{Geometry, Paint}; +use typst_syntax::Span; + use crate::embed::embed_files; use crate::image::handle_image; use crate::link::handle_link; @@ -10,24 +28,6 @@ use crate::shape::handle_shape; use crate::text::handle_text; use crate::util::{convert_path, display_font, AbsExt, TransformExt}; use crate::PdfOptions; -use krilla::annotation::Annotation; -use krilla::configure::{Configuration, PdfVersion, ValidationError}; -use krilla::destination::{NamedDestination, XyzDestination}; -use krilla::error::KrillaError; -use krilla::page::PageLabel; -use krilla::path::PathBuilder; -use krilla::surface::Surface; -use krilla::{Document, PageSettings, SerializeSettings}; -use typst_library::diag::{bail, SourceResult}; -use typst_library::foundations::NativeElement; -use typst_library::introspection::Location; -use typst_library::layout::{ - Abs, Frame, FrameItem, GroupItem, PagedDocument, Size, Transform, -}; -use typst_library::model::HeadingElem; -use typst_library::text::{Font, Lang}; -use typst_library::visualize::{Geometry, Paint}; -use typst_syntax::Span; pub fn convert( typst_document: &PagedDocument, @@ -514,7 +514,9 @@ fn collect_named_destinations( fn get_configuration(options: &PdfOptions) -> SourceResult { let config = match (options.pdf_version, options.validator) { - (None, None) => Configuration::new_with_version(PdfVersion::Pdf17), + (None, None) => { + Configuration::new_with_version(krilla::configure::PdfVersion::Pdf17) + } (Some(pdf), None) => Configuration::new_with_version(pdf.into()), (None, Some(v)) => Configuration::new_with_validator(v.into()), (Some(pdf), Some(v)) => { diff --git a/crates/typst-pdf/src/embed.rs b/crates/typst-pdf/src/embed.rs index b2152d7ae..547d60dd5 100644 --- a/crates/typst-pdf/src/embed.rs +++ b/crates/typst-pdf/src/embed.rs @@ -1,6 +1,7 @@ +use std::sync::Arc; + use krilla::embed::{AssociationKind, EmbeddedFile}; use krilla::Document; -use std::sync::Arc; use typst_library::diag::{bail, SourceResult}; use typst_library::foundations::{NativeElement, StyleChain}; use typst_library::layout::PagedDocument; diff --git a/crates/typst-pdf/src/shape.rs b/crates/typst-pdf/src/shape.rs index e963571c8..99686a313 100644 --- a/crates/typst-pdf/src/shape.rs +++ b/crates/typst-pdf/src/shape.rs @@ -1,12 +1,13 @@ -use crate::convert::{FrameContext, GlobalContext}; -use crate::paint; -use crate::util::{convert_path, AbsExt, TransformExt}; use krilla::geom::Rect; use krilla::path::{Path, PathBuilder}; use krilla::surface::Surface; use typst_library::diag::SourceResult; use typst_library::visualize::{Geometry, Shape}; +use crate::convert::{FrameContext, GlobalContext}; +use crate::paint; +use crate::util::{convert_path, AbsExt, TransformExt}; + pub(crate) fn handle_shape( fc: &mut FrameContext, shape: &Shape,