![require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages](https://cdn.sanity.io/images/cgdhsj6q/production/be8ab80c8efa5907bc341c6fefe9aa20d239d890-1600x1097.png?w=400&fit=max&auto=format)
Security News
require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
@assetpack/plugin-webfont
Advanced tools
AssetPack plugin for generating woff2 fonts from ttf, otf, woff, and svg files.
AssetPack plugin for generating woff2 fonts from ttf, otf, woff, and svg files.
npm install --save-dev @assetpack/plugin-webfont
import { webfont } from "@assetpack/plugin-webfont";
export default {
...
plugins: {
...
webfont: webfont(),
sdfFont: sdfFont(),
msdfFont: msdfFont(),
},
};
This plugin requires the {wf}
tag to be placed on a folder or file:
raw-assets
├── game{wf}
│ ├── svgFont.svg
│ └── ttfFont.ttf
└── other
└── otfFont{wf}.otf
tags
- An object containing the tags to use for the plugin. Defaults to { font: "wf" }
.These plugins requires the {sdf}
or {msdf}
tag to be placed on a folder or file:
raw-assets
├── game{sdf}
│ └── sdfFont.ttf
└── other
└── msdfFont{msdf}.tff
These plugins only work with ttf
files.
tags
- An object containing the tags to use for the plugin. Defaults to { font: "wf" }
.font
- An object containing options to customise the font generation.
filename
(String): filename of both font file and font atlas. If omited, font face name is used. Required if font is provided as a Buffer.charset
(String|Array): the characters to include in the bitmap font. Defaults to all ASCII printable characters.fontSize
(Number): the font size at which to generate the distance field. Defaults to 42
textureSize
(Array[2]): the dimensions of an output texture sheet, normally power-of-2 for GPU usage. Both dimensions default to [512, 512]
texturePadding
(Number): pixels between each glyph in the texture. Defaults to 2
border
(Number): space between glyphs textures & edge. Defaults to 0
distanceRange
(Number): the width of the range around the shape between the minimum and maximum representable signed distance in pixels, defaults to 3
roundDecimal
(Number): rounded digits of the output font metics. For xml
output, roundDecimal: 0
recommended.vector
(Boolean): output a SVG Vector file for debugging. Defauts to false
smart-size
(Boolean): shrink atlas to the smallest possible square. Default: false
pot
(Boolean): output atlas size shall be power of 2. Default: false
square
(Boolean): output atlas size shall be square. Default: false
rot
(Boolean): allow 90-degree rotation while packing. Default: false
rtl
(Boolean): use RTL(Arabic/Persian) characters fix. Default: false
FAQs
AssetPack plugin for generating woff2 fonts from ttf, otf, woff, and svg files.
We found that @assetpack/plugin-webfont demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.