npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@assetpack/plugin-webfont

v0.8.0

Published

AssetPack plugin for generating woff2 fonts from ttf, otf, woff, and svg files.

Downloads

1,352

Readme

@assetpack/plugin-webfont

AssetPack plugin for generating woff2 fonts from ttf, otf, woff, and svg files.

Installation

npm install --save-dev @assetpack/plugin-webfont

Basic Usage

import { webfont } from "@assetpack/plugin-webfont";

export default {
  ...
  plugins: {
    ...
    webfont: webfont(),
    sdfFont: sdfFont(),
    msdfFont: msdfFont(),
  },
};

webfont

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

Options

  • tags - An object containing the tags to use for the plugin. Defaults to { font: "wf" }.

sdf + msdf

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.

Options

  • 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