Skip to content

Commit

Permalink
feat: support woff/woff2 fonts
Browse files Browse the repository at this point in the history
  • Loading branch information
Brooooooklyn committed Jul 27, 2021
1 parent a051192 commit 70b7aa2
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 0 deletions.
Binary file added __test__/fonts/Cascadia.woff2
Binary file not shown.
Binary file added __test__/fonts/Virgil.woff2
Binary file not shown.
3 changes: 3 additions & 0 deletions example/draw-text.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@ const { createCanvas, GlobalFonts } = require('../index.js')
const fontPath = join(__dirname, '..', '__test__', 'fonts', 'iosevka-slab-regular.ttf')
const fontData = readFileSync(fontPath)

const WoffFontPath = join(__dirname, '..', '__test__', 'fonts', 'Virgil.woff2')

console.info(GlobalFonts.families)

GlobalFonts.register(fontData)
GlobalFonts.registerFromPath(WoffFontPath)

console.info(GlobalFonts.families)

Expand Down
1 change: 1 addition & 0 deletions scripts/build-skia.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ const GN_ARGS = [
`skia_use_libwebp_decode=true`,
`skia_use_libwebp_encode=true`,
`skia_use_freetype=true`,
`skia_use_freetype_woff2=true`,
`skia_use_fontconfig=false`,
`skia_use_system_freetype2=false`,
`skia_use_system_libjpeg_turbo=false`,
Expand Down

0 comments on commit 70b7aa2

Please sign in to comment.