GithubHelp home page GithubHelp logo

tpkhuong / variablefont.js Goto Github PK

View Code? Open in Web Editor NEW

This project forked from monotype/variablefont.js

0.0 0.0 0.0 205 KB

JS library for handling variable fonts through use of opentype.js

License: MIT License

JavaScript 51.85% TypeScript 48.15%

variablefont.js's Introduction

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.

variablefont.js's People

Contributors

taylorb-monotype avatar nrip-monotype avatar kennethormandy avatar ramghaju avatar jeffreyrcarey avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.