mirror of
https://github.com/typst/typst
synced 2025-08-15 15:38:33 +08:00
more fixes
This commit is contained in:
parent
03a395a69c
commit
eed3c0dfea
20
Cargo.lock
generated
20
Cargo.lock
generated
@ -1345,14 +1345,11 @@ 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",
|
||||||
"comemo",
|
"comemo",
|
||||||
"flate2",
|
|
||||||
"float-cmp 0.10.0",
|
"float-cmp 0.10.0",
|
||||||
"fontdb",
|
|
||||||
"gif",
|
"gif",
|
||||||
"image-webp",
|
"image-webp",
|
||||||
"imagesize",
|
"imagesize",
|
||||||
@ -1360,20 +1357,30 @@ dependencies = [
|
|||||||
"once_cell",
|
"once_cell",
|
||||||
"pdf-writer",
|
"pdf-writer",
|
||||||
"rayon",
|
"rayon",
|
||||||
"resvg",
|
|
||||||
"rustybuzz",
|
"rustybuzz",
|
||||||
"siphasher",
|
"siphasher",
|
||||||
"skrifa",
|
"skrifa",
|
||||||
"subsetter",
|
"subsetter",
|
||||||
"tiny-skia",
|
|
||||||
"tiny-skia-path",
|
"tiny-skia-path",
|
||||||
"usvg",
|
|
||||||
"xmp-writer",
|
"xmp-writer",
|
||||||
"yoke 0.8.0",
|
"yoke 0.8.0",
|
||||||
"zune-jpeg",
|
"zune-jpeg",
|
||||||
"zune-png",
|
"zune-png",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "krilla-svg"
|
||||||
|
version = "0.3.0"
|
||||||
|
dependencies = [
|
||||||
|
"flate2",
|
||||||
|
"fontdb",
|
||||||
|
"krilla",
|
||||||
|
"resvg",
|
||||||
|
"tiny-skia",
|
||||||
|
"usvg",
|
||||||
|
"zune-png",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "kurbo"
|
name = "kurbo"
|
||||||
version = "0.11.1"
|
version = "0.11.1"
|
||||||
@ -3084,6 +3091,7 @@ dependencies = [
|
|||||||
"ecow",
|
"ecow",
|
||||||
"image",
|
"image",
|
||||||
"krilla",
|
"krilla",
|
||||||
|
"krilla-svg",
|
||||||
"typst-assets",
|
"typst-assets",
|
||||||
"typst-library",
|
"typst-library",
|
||||||
"typst-macros",
|
"typst-macros",
|
||||||
|
@ -70,7 +70,8 @@ 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 = { 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"
|
kurbo = "0.11"
|
||||||
libfuzzer-sys = "0.4"
|
libfuzzer-sys = "0.4"
|
||||||
lipsum = "0.9"
|
lipsum = "0.9"
|
||||||
|
@ -24,6 +24,7 @@ comemo = { workspace = true }
|
|||||||
ecow = { workspace = true }
|
ecow = { workspace = true }
|
||||||
image = { workspace = true }
|
image = { workspace = true }
|
||||||
krilla = { workspace = true }
|
krilla = { workspace = true }
|
||||||
|
krilla-svg = { workspace = true }
|
||||||
|
|
||||||
[lints]
|
[lints]
|
||||||
workspace = true
|
workspace = true
|
||||||
|
@ -10,6 +10,7 @@ use krilla::page::PageLabel;
|
|||||||
use krilla::path::PathBuilder;
|
use krilla::path::PathBuilder;
|
||||||
use krilla::surface::Surface;
|
use krilla::surface::Surface;
|
||||||
use krilla::{Configuration, Document, PageSettings, SerializeSettings, ValidationError};
|
use krilla::{Configuration, Document, PageSettings, SerializeSettings, ValidationError};
|
||||||
|
use krilla_svg::render_svg_glyph;
|
||||||
use typst_library::diag::{bail, error, SourceResult};
|
use typst_library::diag::{bail, error, SourceResult};
|
||||||
use typst_library::foundations::NativeElement;
|
use typst_library::foundations::NativeElement;
|
||||||
use typst_library::introspection::Location;
|
use typst_library::introspection::Location;
|
||||||
@ -46,6 +47,7 @@ pub fn convert(
|
|||||||
cmyk_profile: None,
|
cmyk_profile: None,
|
||||||
configuration,
|
configuration,
|
||||||
enable_tagging: false,
|
enable_tagging: false,
|
||||||
|
render_svg_glyph_fn: render_svg_glyph
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut document = Document::new_with(settings);
|
let mut document = Document::new_with(settings);
|
||||||
@ -302,6 +304,7 @@ pub(crate) fn handle_group(
|
|||||||
.clip
|
.clip
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.and_then(|p| {
|
.and_then(|p| {
|
||||||
|
|
||||||
let mut builder = PathBuilder::new();
|
let mut builder = PathBuilder::new();
|
||||||
convert_path(p, &mut builder);
|
convert_path(p, &mut builder);
|
||||||
builder.finish()
|
builder.finish()
|
||||||
|
@ -4,7 +4,7 @@ use std::sync::{Arc, OnceLock};
|
|||||||
use image::{DynamicImage, EncodableLayout, GenericImageView, Rgba};
|
use image::{DynamicImage, EncodableLayout, GenericImageView, Rgba};
|
||||||
use krilla::image::{BitsPerComponent, CustomImage, ImageColorspace};
|
use krilla::image::{BitsPerComponent, CustomImage, ImageColorspace};
|
||||||
use krilla::surface::Surface;
|
use krilla::surface::Surface;
|
||||||
use krilla::SvgSettings;
|
use krilla_svg::{SurfaceExt, SvgSettings};
|
||||||
use typst_library::diag::{bail, SourceResult};
|
use typst_library::diag::{bail, SourceResult};
|
||||||
use typst_library::foundations::Smart;
|
use typst_library::foundations::Smart;
|
||||||
use typst_library::layout::Size;
|
use typst_library::layout::Size;
|
||||||
|
@ -190,9 +190,9 @@ fn convert_gradient(
|
|||||||
cx: radial.center.x.get() as f32,
|
cx: radial.center.x.get() as f32,
|
||||||
cy: radial.center.y.get() as f32,
|
cy: radial.center.y.get() as f32,
|
||||||
cr: radial.radius.get() as f32,
|
cr: radial.radius.get() as f32,
|
||||||
transform: base_transform.to_krilla().pre_concat(
|
transform: base_transform.pre_concat(
|
||||||
krilla::geom::Transform::from_scale(size.x.to_f32(), size.y.to_f32()),
|
Transform::scale(Ratio::new(size.x.to_f32() as f64), Ratio::new(size.y.to_f32() as f64)),
|
||||||
),
|
).to_krilla(),
|
||||||
spread_method: SpreadMethod::Pad,
|
spread_method: SpreadMethod::Pad,
|
||||||
stops: stops.into(),
|
stops: stops.into(),
|
||||||
anti_alias: gradient.anti_alias(),
|
anti_alias: gradient.anti_alias(),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user