diff --git a/.github/workflows/CI.yaml b/.github/workflows/CI.yaml
index a8bbbbeb..cf4d33cc 100755
--- a/.github/workflows/CI.yaml
+++ b/.github/workflows/CI.yaml
@@ -199,7 +199,7 @@ jobs:
strategy:
fail-fast: false
matrix:
- node: ['18']
+ node: ['14', '16', '18']
runs-on: ubuntu-latest
steps:
diff --git a/__test__/index.spec.ts b/__test__/index.spec.ts
index 25df3650..6ecba479 100755
--- a/__test__/index.spec.ts
+++ b/__test__/index.spec.ts
@@ -236,7 +236,6 @@ test('should be load custom fontFiles(no defaultFontFamily option)', (t) => {
font: {
fontFiles: ['./example/SourceHanSerifCN-Light-subset.ttf'],
loadSystemFonts: false,
- // defaultFontFamily: 'Source Han Serif CN Light',
},
logLevel: 'debug',
})
@@ -261,7 +260,6 @@ test('should be load custom fontDirs(no defaultFontFamily option)', (t) => {
// loadSystemFonts: false,
// defaultFontFamily: 'Source Han Serif CN Light',
},
- logLevel: 'debug',
})
const pngData = resvg.render()
const originPixels = pngData.pixels.toJSON().data
@@ -282,7 +280,7 @@ test('The defaultFontFamily is not found in the OS and needs to be fallback', (t
font: {
loadSystemFonts: true,
fontDirs: ['/usr/share/fonts/'], // 防止在 CI 的 Docker 环境找不到字体
- defaultFontFamily: 'this-is-a-non-existent-font-family',
+ defaultFontFamily: 'non-existent-font-family',
},
logLevel: 'debug',
})
@@ -325,7 +323,7 @@ test('Async rendering', async (t) => {
font: {
fontFiles: ['./example/SourceHanSerifCN-Light-subset.ttf'], // Load custom fonts.
loadSystemFonts: false, // It will be faster to disable loading system fonts.
- defaultFontFamily: 'Source Han Serif CN Light',
+ defaultFontFamily: ' Source Han Serif CN Light ',
},
}
let syncRenderingResult = new Resvg(svg, params)
diff --git a/__test__/wasm.spec.ts b/__test__/wasm.spec.ts
index 09c35711..7bf08ee4 100755
--- a/__test__/wasm.spec.ts
+++ b/__test__/wasm.spec.ts
@@ -265,6 +265,30 @@ test('should be load custom fontsBuffers(no defaultFontFamily option)', async (t
t.is(originPixels.join(',').match(/0,0,255/g)?.length, 1726)
})
+test('should be load custom multiple fontsBuffers', async (t) => {
+ const svg = `
+
+ `
+ const fontBuffer = await fs.readFile(join(__dirname, '../example/SourceHanSerifCN-Light-subset.ttf'))
+ const pacificoBuffer = await fs.readFile(join(__dirname, './Pacifico-Regular.ttf'))
+ const resvg = new Resvg(svg, {
+ font: {
+ fontsBuffers: [pacificoBuffer, fontBuffer],
+ defaultFontFamily: ' Pacifico ', // Multiple spaces
+ },
+ })
+ 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, 8938)
+})
+
test('should generate a 80x80 png and opaque', async (t) => {
const svg = `