Skip to content

Commit

Permalink
Update to resvg 0.43.0
Browse files Browse the repository at this point in the history
  • Loading branch information
dhardy committed Aug 27, 2024
1 parent 74648fb commit be7e108
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions crates/kas-resvg/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ svg = ["dep:resvg", "dep:usvg"]

[dependencies]
tiny-skia = { version = "0.11.0" }
resvg = { version = "0.41.0", optional = true }
usvg = { version = "0.41.0", optional = true }
resvg = { version = "0.43.0", optional = true }
usvg = { version = "0.43.0", optional = true }
once_cell = "1.17.0"
thiserror = "1.0.23"

Expand Down
6 changes: 4 additions & 2 deletions crates/kas-resvg/src/svg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ fn load(data: &[u8], resources_dir: Option<&Path>) -> Result<Tree, usvg::Error>
// - default_size: affected by screen scale factor later
// - dpi: according to css-values-3, 1in = 96px
// - font_size: units are (logical) px per em; 16px = 12pt
// - TODO: add option to clone fontdb from kas::text?
let opts = usvg::Options {
resources_dir: resources_dir.map(|path| path.to_owned()),
dpi: 96.0,
Expand All @@ -47,10 +48,11 @@ fn load(data: &[u8], resources_dir: Option<&Path>) -> Result<Tree, usvg::Error>
image_rendering: usvg::ImageRendering::default(),
default_size: usvg::Size::from_wh(100.0, 100.0).unwrap(),
image_href_resolver: Default::default(),
font_resolver: Default::default(),
fontdb: Default::default(),
};

let fonts_db = kas::text::fonts::library().read_db();
let tree = Tree::from_data(data, &opts, fonts_db.db())?;
let tree = Tree::from_data(data, &opts)?;

Ok(tree)
}
Expand Down

0 comments on commit be7e108

Please sign in to comment.