diff --git a/Cargo.toml b/Cargo.toml
index 0402213f..dba519ad 100755
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -22,6 +22,7 @@ pathfinder_content = { version = "0.5.0", default-features = false }
pathfinder_simd = { version = "0.5.1", features = ["pf-no-simd"] }
futures = "0.3.21"
usvg-writer = { git = "https://github.com/zimond/resvg", rev = "6201182c" }
+woff2 = "0.3.0"
[target.'cfg(all(not(all(target_os = "linux", target_arch = "aarch64", target_env = "musl")), not(all(target_os = "windows", target_arch = "aarch64")), not(target_arch = "wasm32")))'.dependencies]
mimalloc-rust = { version = "0.2" }
@@ -57,3 +58,4 @@ codegen-units = 1
[patch.crates-io]
resvg = { git = "https://github.com/zimond/resvg", rev = "6201182c" }
+woff2 = { git="https://github.com/yisibl/woff2-rs", branch="fix-total-compressed-size" }
diff --git a/__test__/wasm.spec.ts b/__test__/wasm.spec.ts
index cdd6c054..d9f0b4a0 100755
--- a/__test__/wasm.spec.ts
+++ b/__test__/wasm.spec.ts
@@ -309,6 +309,27 @@ test('should be load custom multiple fontBuffers', async (t) => {
t.is(originPixels.join(',').match(/0,0,255/g)?.length, 8938)
})
+test('should be load custom WOFF2 font', async (t) => {
+ const svg = `
+
+ `
+ const pacificoBuffer = await fs.readFile(join(__dirname, '../wasm/fonts/', 'Pacifico-Regular.woff2'))
+ const resvg = new Resvg(svg, {
+ font: {
+ fontBuffers: [pacificoBuffer],
+ },
+ })
+ const pngData = resvg.render()
+ const originPixels = Array.from(pngData.pixels)
+
+ // Find the number of blue `rgb(0,255,255)`pixels
+ t.is(originPixels.join(',').match(/0,0,255/g)?.length, 6067)
+})
+
test('should generate a 80x80 png and opaque', async (t) => {
const svg = `