fix(cli): icon should render explicit svg text node fonts (fix: #10022) (#10039)

* fix(cli): icon should render explicit svg text node fonts (fix: #10022)

* fix(cli): icon should render explicit svg text node fonts (fix: #10022)

added a .change file for the fix
This commit is contained in:
Roy Laurie 2024-06-11 18:25:11 -07:00 committed by GitHub
parent f56cdc9e39
commit 79542f4d45
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 56 additions and 52 deletions

View File

@ -0,0 +1,7 @@
---
"tauri-cli": "patch:bug"
"@tauri-apps/cli": "patch:bug"
---
Fixed an issue that prevented `tauri icon` from rendering `<text>` nodes in SVG files.

92
tooling/cli/Cargo.lock generated
View File

@ -1474,14 +1474,14 @@ version = "0.5.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6a595cb550439a117696039dfc69830492058211b771a2a165379f2a1a53d84d"
dependencies = [
"roxmltree",
"roxmltree 0.19.0",
]
[[package]]
name = "fontdb"
version = "0.16.2"
version = "0.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b0299020c3ef3f60f526a4f64ab4a3d4ce116b1acbf24cdd22da0068e5d81dc3"
checksum = "e32eac81c1135c1df01d4e6d4233c47ba11f6a6d07f33e0bba09d18797077770"
dependencies = [
"fontconfig-parser",
"log",
@ -1691,16 +1691,6 @@ dependencies = [
"polyval",
]
[[package]]
name = "gif"
version = "0.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "80792593675e051cf94a4b111980da2ba60d4a83e43e0048c5693baab3977045"
dependencies = [
"color_quant",
"weezl",
]
[[package]]
name = "gif"
version = "0.13.1"
@ -2094,7 +2084,7 @@ dependencies = [
"byteorder",
"color_quant",
"exr",
"gif 0.13.1",
"gif",
"jpeg-decoder",
"num-traits",
"png",
@ -2495,18 +2485,9 @@ dependencies = [
[[package]]
name = "kurbo"
version = "0.9.5"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bd85a5776cd9500c2e2059c8c76c3b01528566b7fcbaf8098b55a33fc298849b"
dependencies = [
"arrayvec",
]
[[package]]
name = "kurbo"
version = "0.10.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1618d4ebd923e97d67e7cd363d80aef35fe961005cbbbb3d2dad8bdd1bc63440"
checksum = "6e5aa9f0f96a938266bdb12928a67169e8d22c6a786fda8ed984b85e6ba93c3c"
dependencies = [
"arrayvec",
"smallvec",
@ -3477,7 +3458,7 @@ version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c00cf8b9eafe68dde5e9eaa2cef8ee84a9336a47d566ec55ca16589633b65af7"
dependencies = [
"siphasher",
"siphasher 0.3.11",
]
[[package]]
@ -3486,7 +3467,7 @@ version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b6796ad771acdc0123d2a88dc428b5e38ef24456743ddb1744ed628f9815c096"
dependencies = [
"siphasher",
"siphasher 0.3.11",
]
[[package]]
@ -3495,7 +3476,7 @@ version = "0.11.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "90fcb95eef784c2ac79119d1dd819e162b5da872ce6f3c3abe1e8ca1c082f72b"
dependencies = [
"siphasher",
"siphasher 0.3.11",
]
[[package]]
@ -3874,15 +3855,14 @@ dependencies = [
[[package]]
name = "resvg"
version = "0.40.0"
version = "0.42.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "024e40e1ba7313fc315b1720298988c0cd6f8bfe3754b52838aafecebd11355a"
checksum = "944d052815156ac8fa77eaac055220e95ba0b01fa8887108ca710c03805d9051"
dependencies = [
"gif 0.12.0",
"gif",
"jpeg-decoder",
"log",
"pico-args",
"png",
"rgb",
"svgtypes",
"tiny-skia",
@ -3944,6 +3924,12 @@ version = "0.19.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3cd14fd5e3b777a7422cca79358c57a8f6e3a703d9ac187448d0daf220c2407f"
[[package]]
name = "roxmltree"
version = "0.20.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6c20b6793b5c2fa6553b250154b78d6d0db37e72700ae35fad9387a46f487c97"
[[package]]
name = "rpassword"
version = "7.3.1"
@ -4102,9 +4088,9 @@ checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4"
[[package]]
name = "rustybuzz"
version = "0.12.1"
version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f0ae5692c5beaad6a9e22830deeed7874eae8a4e3ba4076fb48e12c56856222c"
checksum = "7730060ad401b0d1807c904ea56735288af101430aa0d2ab8358b789f5f37002"
dependencies = [
"bitflags 2.4.2",
"bytemuck",
@ -4513,6 +4499,12 @@ version = "0.3.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d"
[[package]]
name = "siphasher"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "56199f7ddabf13fe5074ce809e7d3f42b42ae711800501b5b16ea82ad029c39d"
[[package]]
name = "slab"
version = "0.4.9"
@ -4762,12 +4754,12 @@ dependencies = [
[[package]]
name = "svgtypes"
version = "0.14.0"
version = "0.15.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "59d7618f12b51be8171a7cfdda1e7a93f79cbc57c4e7adf89a749cf671125241"
checksum = "fae3064df9b89391c9a76a0425a69d124aee9c5c28455204709e72c39868a43c"
dependencies = [
"kurbo 0.10.4",
"siphasher",
"kurbo",
"siphasher 1.0.1",
]
[[package]]
@ -5399,9 +5391,9 @@ checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b"
[[package]]
name = "ttf-parser"
version = "0.20.0"
version = "0.21.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "17f77d76d837a7830fe1d4f12b7b4ba4192c1888001c7164257e4bc6d21d96b4"
checksum = "2c591d83f69777866b9126b24c6dd9a18351f177e49d625920d19f989fd31cf8"
[[package]]
name = "tungstenite"
@ -5501,15 +5493,15 @@ checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75"
[[package]]
name = "unicode-bidi-mirroring"
version = "0.1.0"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "56d12260fb92d52f9008be7e4bca09f584780eb2266dc8fecc6a192bec561694"
checksum = "23cb788ffebc92c5948d0e997106233eeb1d8b9512f93f41651f52b6c5f5af86"
[[package]]
name = "unicode-ccc"
version = "0.1.2"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cc2520efa644f8268dce4dcd3050eaa7fc044fca03961e9998ac7e2e92b77cf1"
checksum = "1df77b101bcc4ea3d78dafc5ad7e4f58ceffe0b2b16bf446aeb50b6cb4157656"
[[package]]
name = "unicode-ident"
@ -5624,22 +5616,22 @@ dependencies = [
[[package]]
name = "usvg"
version = "0.40.0"
version = "0.42.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c04150a94f0bfc3b2c15d4e151524d14cd06765fc6641d8b1c59a248360d4474"
checksum = "b84ea542ae85c715f07b082438a4231c3760539d902e11d093847a0b22963032"
dependencies = [
"base64 0.21.7",
"base64 0.22.0",
"data-url",
"flate2",
"fontdb",
"imagesize",
"kurbo 0.9.5",
"kurbo",
"log",
"pico-args",
"roxmltree",
"roxmltree 0.20.0",
"rustybuzz",
"simplecss",
"siphasher",
"siphasher 1.0.1",
"strict-num",
"svgtypes",
"tiny-skia-path",

View File

@ -89,7 +89,7 @@ serde-value = "0.7.0"
itertools = "0.12"
local-ip-address = "0.6"
css-color = "0.2"
resvg = "0.40.0"
resvg = "0.42.0"
dunce = "1"
glob = "0.3"

View File

@ -10,6 +10,7 @@ use std::{
io::{BufWriter, Write},
path::{Path, PathBuf},
str::FromStr,
sync::Arc,
};
use anyhow::Context;
@ -117,16 +118,20 @@ pub fn command(options: Options) -> Result<()> {
let source = if let Some(extension) = input.extension() {
if extension == "svg" {
let rtree = {
let mut fontdb = usvg::fontdb::Database::new();
fontdb.load_system_fonts();
let opt = usvg::Options {
// Get file's absolute directory.
resources_dir: std::fs::canonicalize(&input)
.ok()
.and_then(|p| p.parent().map(|p| p.to_path_buf())),
fontdb: Arc::new(fontdb),
..Default::default()
};
let svg_data = std::fs::read(&input).unwrap();
usvg::Tree::from_data(&svg_data, &opt, &Default::default()).unwrap()
usvg::Tree::from_data(&svg_data, &opt).unwrap()
};
Source::Svg(rtree)