mirror of
https://github.com/typst/typst
synced 2025-08-15 15:38:33 +08:00
more
This commit is contained in:
parent
644996302a
commit
385061256b
1
Cargo.lock
generated
1
Cargo.lock
generated
@ -1345,6 +1345,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "krilla"
|
name = "krilla"
|
||||||
version = "0.3.0"
|
version = "0.3.0"
|
||||||
|
source = "git+https://github.com/LaurenzV/krilla?rev=5978f97#5978f97aaacc9233d564b76773400218a7cdc21d"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"base64",
|
"base64",
|
||||||
"bumpalo",
|
"bumpalo",
|
||||||
|
@ -70,7 +70,7 @@ if_chain = "1"
|
|||||||
image = { version = "0.25.5", default-features = false, features = ["png", "jpeg", "gif"] }
|
image = { version = "0.25.5", default-features = false, features = ["png", "jpeg", "gif"] }
|
||||||
indexmap = { version = "2", features = ["serde"] }
|
indexmap = { version = "2", features = ["serde"] }
|
||||||
kamadak-exif = "0.6"
|
kamadak-exif = "0.6"
|
||||||
krilla = { path = "../krilla/crates/krilla", features = ["svg", "raster-images", "comemo", "rayon"] }
|
krilla = { git = "https://github.com/LaurenzV/krilla", rev = "5978f97", features = ["svg", "raster-images", "comemo", "rayon"] }
|
||||||
kurbo = "0.11"
|
kurbo = "0.11"
|
||||||
libfuzzer-sys = "0.4"
|
libfuzzer-sys = "0.4"
|
||||||
lipsum = "0.9"
|
lipsum = "0.9"
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
use ecow::EcoVec;
|
use ecow::EcoVec;
|
||||||
use krilla::annotation::Annotation;
|
use krilla::annotation::Annotation;
|
||||||
use krilla::destination::{NamedDestination, XyzDestination};
|
use krilla::destination::{NamedDestination, XyzDestination};
|
||||||
|
use krilla::embed::EmbedError;
|
||||||
use krilla::error::KrillaError;
|
use krilla::error::KrillaError;
|
||||||
use krilla::page::PageLabel;
|
use krilla::page::PageLabel;
|
||||||
use krilla::path::PathBuilder;
|
use krilla::path::PathBuilder;
|
||||||
@ -421,55 +422,77 @@ fn finish(document: Document, gc: GlobalContext) -> SourceResult<Vec<u8>> {
|
|||||||
}
|
}
|
||||||
ValidationError::Transparency(loc) => {
|
ValidationError::Transparency(loc) => {
|
||||||
error!(get_span(*loc), "{prefix} document contains transparency";
|
error!(get_span(*loc), "{prefix} document contains transparency";
|
||||||
hint: "remove any transparency from your \
|
hint: "remove any transparency from your \
|
||||||
document (e.g. fills with opacity)";
|
document (e.g. fills with opacity)";
|
||||||
hint: "you might have to convert certain SVGs into a bitmap image if \
|
hint: "you might have to convert certain SVGs into a bitmap image if \
|
||||||
they contain transparency";
|
they contain transparency";
|
||||||
hint: "export using a different standard that supports transparency"
|
hint: "export using a different standard that supports transparency"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
ValidationError::ImageInterpolation(loc) => {
|
ValidationError::ImageInterpolation(loc) => {
|
||||||
error!(get_span(*loc), "{prefix} the image has smooth interpolation";
|
error!(get_span(*loc), "{prefix} the image has smooth interpolation";
|
||||||
hint: "such images are not supported in this export mode"
|
hint: "such images are not supported in this export mode"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
ValidationError::EmbeddedFile(_) => {
|
ValidationError::EmbeddedFile(e, s) => {
|
||||||
error!(Span::detached(), "{prefix} document contains an embedded file";
|
let span = get_span(*s);
|
||||||
hint: "embedded files are not supported in this export mode"
|
match e {
|
||||||
)
|
EmbedError::Existence => {
|
||||||
|
error!(span, "{prefix} document contains an embedded file";
|
||||||
|
hint: "embedded files are not supported in this export mode"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
EmbedError::MissingDate => {
|
||||||
|
error!(span, "{prefix} document date is missing";
|
||||||
|
hint: "the document date needs to be set when embedding files"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
EmbedError::MissingDescription => {
|
||||||
|
error!(span, "{prefix} file description is missing")
|
||||||
|
}
|
||||||
|
EmbedError::MissingMimeType => {
|
||||||
|
error!(span, "{prefix} file mime type is missing")
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// The below errors cannot occur yet, only once Typst supports full PDF/A
|
// The below errors cannot occur yet, only once Typst supports full PDF/A
|
||||||
// and PDF/UA.
|
// and PDF/UA.
|
||||||
// But let's still add a message just to be on the safe side.
|
// But let's still add a message just to be on the safe side.
|
||||||
ValidationError::MissingAnnotationAltText => {
|
ValidationError::MissingAnnotationAltText => {
|
||||||
error!(Span::detached(), "{prefix} missing annotation alt text";
|
error!(Span::detached(), "{prefix} missing annotation alt text";
|
||||||
hint: "please report this as a bug")
|
hint: "please report this as a bug"
|
||||||
|
)
|
||||||
}
|
}
|
||||||
ValidationError::MissingAltText => {
|
ValidationError::MissingAltText => {
|
||||||
error!(Span::detached(), "{prefix} missing alt text";
|
error!(Span::detached(), "{prefix} missing alt text";
|
||||||
hint: "make sure your images and formulas have alt text")
|
hint: "make sure your images and formulas have alt text"
|
||||||
|
)
|
||||||
}
|
}
|
||||||
ValidationError::NoDocumentLanguage => {
|
ValidationError::NoDocumentLanguage => {
|
||||||
error!(Span::detached(), "{prefix} missing document language";
|
error!(Span::detached(), "{prefix} missing document language";
|
||||||
hint: "set the language of the document")
|
hint: "set the language of the document"
|
||||||
|
)
|
||||||
}
|
}
|
||||||
// Needs to be set by typst-pdf.
|
// Needs to be set by typst-pdf.
|
||||||
ValidationError::MissingHeadingTitle => {
|
ValidationError::MissingHeadingTitle => {
|
||||||
error!(Span::detached(), "{prefix} missing heading title";
|
error!(Span::detached(), "{prefix} missing heading title";
|
||||||
hint: "please report this as a bug")
|
hint: "please report this as a bug"
|
||||||
|
)
|
||||||
}
|
}
|
||||||
ValidationError::MissingDocumentOutline => {
|
ValidationError::MissingDocumentOutline => {
|
||||||
error!(Span::detached(), "{prefix} missing document outline";
|
error!(Span::detached(), "{prefix} missing document outline";
|
||||||
hint: "please report this as a bug")
|
hint: "please report this as a bug"
|
||||||
|
)
|
||||||
}
|
}
|
||||||
ValidationError::MissingTagging => {
|
ValidationError::MissingTagging => {
|
||||||
error!(Span::detached(), "{prefix} missing document tags";
|
error!(Span::detached(), "{prefix} missing document tags";
|
||||||
hint: "please report this as a bug")
|
hint: "please report this as a bug"
|
||||||
|
)
|
||||||
}
|
}
|
||||||
ValidationError::NoDocumentTitle => {
|
ValidationError::NoDocumentTitle => {
|
||||||
error!(Span::detached(), "{prefix} missing document title";
|
error!(Span::detached(), "{prefix} missing document title";
|
||||||
hint: "set the title of the document")
|
hint: "set the title of the document"
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -42,6 +42,7 @@ pub(crate) fn embed_files(
|
|||||||
association_kind,
|
association_kind,
|
||||||
data: data.into(),
|
data: data.into(),
|
||||||
compress: true,
|
compress: true,
|
||||||
|
location: Some(embed.span().into_raw().get()),
|
||||||
};
|
};
|
||||||
|
|
||||||
if document.embed_file(file).is_none() {
|
if document.embed_file(file).is_none() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user