All Projects → adapt-it → cordova-fonts

adapt-it / cordova-fonts

Licence: Apache-2.0 license
Cordova plugin for enumerating fonts on a mobile device

Programming Languages

java
68154 projects - #9 most used programming language
C#
18002 projects
javascript
184084 projects - #8 most used programming language
objective c
16641 projects - #2 most used programming language

Projects that are alternatives of or similar to cordova-fonts

Blinkid Cordova
ID scanning for cross-platform apps built with Cordova and Phonegap.
Stars: ✭ 44 (+214.29%)
Mutual labels:  cordova, cordova-plugin
Google Analytics Plugin
Cordova Google Analytics Plugin for Android & iOS
Stars: ✭ 90 (+542.86%)
Mutual labels:  cordova, cordova-plugin
Cordova Plugin Wechat
A cordova plugin, a JS version of Wechat SDK
Stars: ✭ 1,198 (+8457.14%)
Mutual labels:  cordova, cordova-plugin
Cordova Plugin Fingerprint Aio
👆 📱 Cordova Plugin for fingerprint sensors (and FaceID) with Android and iOS support
Stars: ✭ 236 (+1585.71%)
Mutual labels:  cordova, cordova-plugin
Cordova Plugin Add Swift Support
🔨 Swiftify your Cordova app !
Stars: ✭ 108 (+671.43%)
Mutual labels:  cordova, cordova-plugin
Cl.kunder.webview
This cordova plugin enables you to open a second webview
Stars: ✭ 36 (+157.14%)
Mutual labels:  cordova, cordova-plugin
Cordova Plugin Remote Injection
DEPRECATED: Cordova plugin to allow a remote site to interact with cordova's javascript APIs when loaded within a cordova app.
Stars: ✭ 90 (+542.86%)
Mutual labels:  cordova, cordova-plugin
Cordova Plugin Linkedin
Cordova plugin for LinkedIn
Stars: ✭ 17 (+21.43%)
Mutual labels:  cordova, cordova-plugin
Wifiwizard2
A Cordova plugin for managing Wifi networks (new version of WiFiWizard) - Latest is version 3+
Stars: ✭ 106 (+657.14%)
Mutual labels:  cordova, cordova-plugin
Cordova Broadcaster
Cordova Plugin to allow message exchange between javascript and native (and viceversa)
Stars: ✭ 104 (+642.86%)
Mutual labels:  cordova, cordova-plugin
Awesome Cordova Plugins
A curated list of awesome Cordova Apache Plugins https://cordova.apache.org/plugins/
Stars: ✭ 33 (+135.71%)
Mutual labels:  cordova, cordova-plugin
Cordova Plugin Touch Id
💅 👱‍♂️ Forget passwords, use a fingerprint scanner!
Stars: ✭ 209 (+1392.86%)
Mutual labels:  cordova, cordova-plugin
Cordova Plugin Permissionscope
🔓 Cordova plugin to handle iOS permissions
Stars: ✭ 27 (+92.86%)
Mutual labels:  cordova, cordova-plugin
Ionic4
This repo contains example code for ionic4. Get Step by Step tutorial of this repo examples using https://ampersandacademy.com/tutorials/ionic-framework-4
Stars: ✭ 37 (+164.29%)
Mutual labels:  cordova, cordova-plugin
Cordova Plugin Disable Bitcode
Cordova plugin to disable bitcode in iOS build settings
Stars: ✭ 19 (+35.71%)
Mutual labels:  cordova, cordova-plugin
Cordova Plugin Stripe
A Cordova plugin that lets you use Stripe's Native SDKs for Android and iOS.
Stars: ✭ 90 (+542.86%)
Mutual labels:  cordova, cordova-plugin
Cordova Plugin Camera Preview
Cordova plugin that allows camera interaction from HTML code
Stars: ✭ 528 (+3671.43%)
Mutual labels:  cordova, cordova-plugin
Cordova Admob Pro
🔥 Cordova Plugin for Google AdMob, DFP, ADX. Easy monetization using mobile Ad, with single line of JavaScript. Compatible with Cordova CLI, Inoic, PhoneGap Build, etc.
Stars: ✭ 690 (+4828.57%)
Mutual labels:  cordova, cordova-plugin
Unityionicintegration
A guide to integrating Unity 3D content into an Ionic app and sending messages between them (for Android & iOS)(tested with Vuforia plugin)
Stars: ✭ 94 (+571.43%)
Mutual labels:  cordova, cordova-plugin
Cordova Plugin Wkwebview File Xhr
Cordova Plugin for WebView File XHR
Stars: ✭ 116 (+728.57%)
Mutual labels:  cordova, cordova-plugin

cordova-plugin-fonts

Download Activity Travis CI Snyk
npm Build Status Known Vulnerabilities

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
  • Amazon Fire OS (untested / just using Android code)
  • Firefox OS
  • iOS

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.

Firefox OS quirks

Firefox OS does not provide an API to access the fonts on the device. The Fonts plugin currently returns a list corresponding to the fonts.mk file found in the mozilla-b2g project (https://github.com/mozilla-b2g/moztt/blob/master/fonts.mk), but it is a hard-coded list and not guaranteed to be correct on any particular version or distro of Firefox OS.

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.

Firefox OS quirks

Firefox OS does not provide an API to access the fonts on the device. The Fonts plugin currently returns a hard-coded string for the default font "Fira Sans Regular". See https://www.mozilla.org/en-US/styleguide/products/firefox-os/typeface/ for more information.

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. You can also use the test project that has already been set up for this over at https://github.com/eb1/test-fonts (just use the instructions listed there instead of the ones below).

  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 https://github.com/apache/cordova-plugin-test-framework.git
    
  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.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].