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

@kennethormandy/variablefont.js

v0.1.0

Published

npm compatible fork of Monotype’s OpenType.js wrapper for using Variable Fonts.

Downloads

277

Readme

variableFont.js

JavaScript library for using variable fonts. Extends the functionality of opentype.js. You must also install opentype.js to use this library.

Demo

The demo folder contains a web page called VariableFontViewer.html. This page shows how to use the features of variableFont.js. You do not have to use it with a server.

Simply save the folder locally then open VariableFontViewer.html in a compatible web browser (for example, Chrome version 62 or higher). Drag and drop a variable font onto the top section. It will change to show the axes and sliders to control the settings for the sample text. You can edit the sample text.

The demo page is also available for viewing at http://monotype.github.io/variableFont.js/demo/.

Getting started with script tags

This project has a hard dependency on opentype.js. Please follow instruction on the opentype.js site to include it in your page. Opentype.js must be included before including variablefont.js in the html page. variableFont.js functions depend on opentype.js.

Getting started with npm

If you are managing your project dependencies with npm, run the following command in your own project:

npm install --save variablefont.js opentype.js

This will install the variablefont.js and the required opentype.js peer dependency, and save those requirements to your package.json file.

API:

A global class VariableFont is made available when variablefont.js is added in a page. This class can be used to extend opentype.js Font object.

var vf = new VariableFont(font); // Where font is the "font" object of opentype.js library
var otFont = vf.openTypeFont; // Get access to original font object.

// Extra functionalities provided by VariableFont are:

vf.getAxes(); // get axes field from fvar table.
vf.getInstances(); // get instances field from fvar table.
vf.getInstancesCount(); // get number of instances entries from fvar table.
vf.getAxesCount(); // get number of axes entries from fvar table.