more fixes

This commit is contained in:
Laurenz Stampfl 2025-03-13 15:23:27 +01:00
parent 03a395a69c
commit eed3c0dfea
6 changed files with 24 additions and 11 deletions

20
Cargo.lock generated
View File

@ -1345,14 +1345,11 @@ dependencies = [
[[package]]
name = "krilla"
version = "0.3.0"
source = "git+https://github.com/LaurenzV/krilla?rev=5978f97#5978f97aaacc9233d564b76773400218a7cdc21d"
dependencies = [
"base64",
"bumpalo",
"comemo",
"flate2",
"float-cmp 0.10.0",
"fontdb",
"gif",
"image-webp",
"imagesize",
@ -1360,20 +1357,30 @@ dependencies = [
"once_cell",
"pdf-writer",
"rayon",
"resvg",
"rustybuzz",
"siphasher",
"skrifa",
"subsetter",
"tiny-skia",
"tiny-skia-path",
"usvg",
"xmp-writer",
"yoke 0.8.0",
"zune-jpeg",
"zune-png",
]
[[package]]
name = "krilla-svg"
version = "0.3.0"
dependencies = [
"flate2",
"fontdb",
"krilla",
"resvg",
"tiny-skia",
"usvg",
"zune-png",
]
[[package]]
name = "kurbo"
version = "0.11.1"
@ -3084,6 +3091,7 @@ dependencies = [
"ecow",
"image",
"krilla",
"krilla-svg",
"typst-assets",
"typst-library",
"typst-macros",

View File

@ -70,7 +70,8 @@ if_chain = "1"
image = { version = "0.25.5", default-features = false, features = ["png", "jpeg", "gif"] }
indexmap = { version = "2", features = ["serde"] }
kamadak-exif = "0.6"
krilla = { git = "https://github.com/LaurenzV/krilla", rev = "5978f97", features = ["svg", "raster-images", "comemo", "rayon"] }
krilla = { path = "../krilla/crates/krilla", features = ["raster-images", "comemo", "rayon"] }
krilla-svg = { path = "../krilla/crates/krilla-svg" }
kurbo = "0.11"
libfuzzer-sys = "0.4"
lipsum = "0.9"

View File

@ -24,6 +24,7 @@ comemo = { workspace = true }
ecow = { workspace = true }
image = { workspace = true }
krilla = { workspace = true }
krilla-svg = { workspace = true }
[lints]
workspace = true

View File

@ -10,6 +10,7 @@ use krilla::page::PageLabel;
use krilla::path::PathBuilder;
use krilla::surface::Surface;
use krilla::{Configuration, Document, PageSettings, SerializeSettings, ValidationError};
use krilla_svg::render_svg_glyph;
use typst_library::diag::{bail, error, SourceResult};
use typst_library::foundations::NativeElement;
use typst_library::introspection::Location;
@ -46,6 +47,7 @@ pub fn convert(
cmyk_profile: None,
configuration,
enable_tagging: false,
render_svg_glyph_fn: render_svg_glyph
};
let mut document = Document::new_with(settings);
@ -302,6 +304,7 @@ pub(crate) fn handle_group(
.clip
.as_ref()
.and_then(|p| {
let mut builder = PathBuilder::new();
convert_path(p, &mut builder);
builder.finish()

View File

@ -4,7 +4,7 @@ use std::sync::{Arc, OnceLock};
use image::{DynamicImage, EncodableLayout, GenericImageView, Rgba};
use krilla::image::{BitsPerComponent, CustomImage, ImageColorspace};
use krilla::surface::Surface;
use krilla::SvgSettings;
use krilla_svg::{SurfaceExt, SvgSettings};
use typst_library::diag::{bail, SourceResult};
use typst_library::foundations::Smart;
use typst_library::layout::Size;

View File

@ -190,9 +190,9 @@ fn convert_gradient(
cx: radial.center.x.get() as f32,
cy: radial.center.y.get() as f32,
cr: radial.radius.get() as f32,
transform: base_transform.to_krilla().pre_concat(
krilla::geom::Transform::from_scale(size.x.to_f32(), size.y.to_f32()),
),
transform: base_transform.pre_concat(
Transform::scale(Ratio::new(size.x.to_f32() as f64), Ratio::new(size.y.to_f32() as f64)),
).to_krilla(),
spread_method: SpreadMethod::Pad,
stops: stops.into(),
anti_alias: gradient.anti_alias(),