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

fontsampler-js

v0.1.4

Published

Render configurable webfont testers for woff / woff2 / variable fonts

Downloads

18

Readme

Fontsampler.js

A configurable standalone webfont type tester for displaying and manipulating sample text in the browser.

Fontsampler library ~13kb minified & gzipped Fontsampler skin js & css ~15kb minified & gzipped

Support for:

  • woff / woff2 / woff2 variable fonts
  • available and configurable UI for:
    • tester input
    • font picker
    • font size
    • line height
    • letter spacing
    • alignment
    • direction (ltr/rtl)
    • language (html lang attr, triggering OT locl features)
    • variable axes (configurable, not detected)
    • opentype (configurable, not detected)
  • API for manipulating the instances
  • optional skin to enhance bare browser input UI
  • configurable UI, options, font settings
  • initialization on empty DOM node
  • initialization on existing DOM structure (to use custom layout and UI)

Installation

Via npm:

$ npm install fontsampler-js

Use

See underscoretype.github.io/fontsampler-js/ for detailed examples.

A minimal example:

<script src="assets/fontsampler.js"></script>
<script src="assets/fontsampler-skin.js"></script>
<link rel="stylesheet" href="assets/fontsampler-skin.css">
…
<div id="demo"></div>
…
<script>
var fonts = [
    "name": "My Font",
    "files": ["path/to/file.woff", "path/to/file.woff2"]
]
var options = {
    order: [["fontsize", "lineheight", "letterspacing"], "tester"]
}
var demo = new Fontsampler(document.getElementById("demo"), fonts, options)
FontsamplerSkin(demo)
demo.init()
</script>

Status

Currently work in progress and pre-release. API not stable and likely to change.

Development

PRs, issue reports and feature requests welcome.

Development requirements:

$ npm install

If you use VSCode src compiling tasks should automatically be started, else see the package.json scripts.

For testing:

$ npm install -g protractor jasmine
$ webdriver-manager start
$ npm run test

Changelog

See CHANGELOG.md

TODO / Roadmap

  • Implement public event interface (change, click, init, loading, loaded) mostly done
  • Implement API on main object (set/get, set/get option, destroy, reset) mostly done
  • Implement per-font options (e.g. one font ltr other rtl etc) partially done
  • Add Unit and End-to-End tests started

License

Licensed under MIT License

Licenses for fonts included in the demo