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 🙏

© 2026 – Pkg Stats / Ryan Hefner

cordova-plugin-fonts

v1.1.0

Published

Cordova Fonts plugin

Readme

cordova-plugin-fonts

| Download Activity | Travis CI | |:-:|:-:| | npm | Build Status |

A Cordova plugin that enumerates the fonts installed on the local device, and also provides the name of the default font.

This plugin defines a global Fonts object, which provides access to the fonts installed on the device. The Fonts object is available from the navigator object after the deviceready event fires.

document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() {
    console.log(navigator.Fonts);
}

Installation

From the Command line:

cordova plugin add cordova-plugin-fonts

Config.xml for PhoneGap Build:

<gap:plugin name="cordova-plugin-fonts" source="npm" />

These commands will install the plugin from npm. You can find this plugin up on npm here, or by searching for ecosystem:cordova in the npm registry like this.

Supported Platforms

  • Android
  • iOS
  • Browser
  • Electron (using Browser code)

Fonts

The Fonts object provides a way to enumerate through the list of fonts installed on the device.

Methods

Currently this plugin provides two methods, getFontList and getDefaultFont.

getFontList

Parameters:

  • successCallback: Callback that returns the list of fonts as an array of string values.
  • errorCallback: Callback that executes if an error occurs while retrieving the list of fonts on the local device.

Notes

  • The Browser and Electron Platforms test for the local font access API. If the underlying browser supports the API, it will return a string array of the font data's font family for each supported font. If the underlying browser does not support the API, the plugin iterates through known browser-safe fonts and tries to detect their presence on the device.

Example

if (navigator.Fonts) {
    console.log("Fonts object in navigator");
    navigator.Fonts.getFontList(
        function (fontList) {
            if (fontList) {
                for (var i = 0; i < fontList.length; i++) {
                    console.log("Font: " + fontList[i]);
                }
            }
        },
        function (error) {
            console.log("FontList error: " + error);
        }
    );
} else {
    console.log("Plugin error: Fonts plugin not found (is it installed?)");
}

getDefaultFont

Parameters:

  • successCallback: Callback that returns the string name of the default font on the device.
  • errorCallback: Callback that executes if an error occurs during the call.

Notes

  • The Browser and Electron platforms test for the local font access API, which has limited support (Chrome and Edge browsers). If the underlying browser supports this API, it will return the family name of the first font in the supported list as the default font. If the underlying browser does not support this API, it will return "serif" as the default font.

Example

if (navigator.Fonts) {
    console.log("Fonts object in navigator");
    navigator.Fonts.getDefaultFont(
        function (defaultFont) {
            if (defaultFont) {
                console.log("Default Font: " + defaultFont);
            }
        },
        function (error) {
            console.log("DefaultFont error: " + error);
        }
    );
} else {
    console.log("Plugin error: Fonts plugin not found (is it installed?)");
}

Internal Development / Unit Testing

(This is only for devs who are developing / debugging the plugin itself)

The cordova-fonts plugin uses the cordova-plugin-test-framework to run unit tests. Complete the following to run through the plugin unit tests:

  1. Use your existing cordova app, or create a new one.

  2. Add the cordova-fonts plugin and test / test framework plugins:

     cordova plugin add https://github.com/adapt-it/cordova-fonts.git
     cordova plugin add https://github.com/adapt-it/cordova-fonts.git#:/tests
     cordova plugin add cordova-plugin-test-framework
  3. Change the start page in your cordova app's config.xml with <content src="cdvtests/index.html" /> or navigate to cdvtests/index.html from within your app.

  4. Build and run the application in an emulator or on the device.