Skip to content

Commit

Permalink
feat: upgrade resvg
Browse files Browse the repository at this point in the history
  • Loading branch information
Brooooooklyn committed Feb 19, 2024
1 parent 1c0ff5a commit e426df5
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ jobs:
- uses: actions/checkout@v4
- name: Build
id: build
uses: cross-platform-actions/action@v0.22.0
uses: cross-platform-actions/action@v0.23.0
env:
DEBUG: 'napi:*'
RUSTUP_HOME: /home/runner/rustup
Expand Down Expand Up @@ -460,7 +460,7 @@ jobs:
run: ls -R packages
shell: bash
- name: Run tests
run: yarn test packages/binding/__test__/transformer.spec.mjs -s
run: yarn test -s
env:
NAPI_RS_FORCE_WASI: '1'

Expand Down
2 changes: 1 addition & 1 deletion packages/binding/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ once_cell = "1"
png = "0.17"
rexif = "0.7"
rgb = "0.8"
resvg = "0.39"
resvg = "0.40"
svgtypes = "0.14"

[dependencies.oxipng]
Expand Down
9 changes: 4 additions & 5 deletions packages/binding/src/transformer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -688,13 +688,12 @@ impl Transformer {
) -> Result<Transformer> {
let options = Options::default();

let mut tree = match input {
Either::A(a) => usvg::Tree::from_str(a.as_str(), &options),
Either::B(b) => usvg::Tree::from_data(b.into_value()?.as_ref(), &options),
let tree = match input {
Either::A(a) => usvg::Tree::from_str(a.as_str(), &options, &FONT_DB),
Either::B(b) => usvg::Tree::from_data(b.into_value()?.as_ref(), &options, &FONT_DB),
}
.map_err(|err| Error::from_reason(format!("{err}")))?;
tree.postprocess(Default::default(), &FONT_DB);
let mut size = tree.size.to_int_size();
let mut size = tree.size().to_int_size();
let min_svg_size = 1000;
while size.width() < min_svg_size || size.height() < min_svg_size {
size = resvg::tiny_skia::IntSize::from_wh(size.width() * 2, size.height() * 2).unwrap();
Expand Down

0 comments on commit e426df5

Please sign in to comment.