{"id":20915868,"url":"https://github.com/adapt-it/cordova-fonts","last_synced_at":"2025-05-13T10:33:45.854Z","repository":{"id":23252054,"uuid":"26610071","full_name":"adapt-it/cordova-fonts","owner":"adapt-it","description":"Cordova plugin for enumerating fonts on a mobile device","archived":false,"fork":false,"pushed_at":"2018-05-21T22:00:32.000Z","size":55,"stargazers_count":13,"open_issues_count":2,"forks_count":6,"subscribers_count":10,"default_branch":"master","last_synced_at":"2024-04-23T15:01:50.070Z","etag":null,"topics":["cordova","cordova-plugin","font"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/adapt-it.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-11-13T22:00:30.000Z","updated_at":"2023-08-31T08:54:51.000Z","dependencies_parsed_at":"2022-09-17T11:24:38.532Z","dependency_job_id":null,"html_url":"https://github.com/adapt-it/cordova-fonts","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adapt-it%2Fcordova-fonts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adapt-it%2Fcordova-fonts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adapt-it%2Fcordova-fonts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adapt-it%2Fcordova-fonts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/adapt-it","download_url":"https://codeload.github.com/adapt-it/cordova-fonts/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224833228,"owners_count":17377488,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cordova","cordova-plugin","font"],"created_at":"2024-11-18T16:18:44.486Z","updated_at":"2025-05-13T10:33:45.844Z","avatar_url":"https://github.com/adapt-it.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003c!---\n    Licensed to the Apache Software Foundation (ASF) under one\n    or more contributor license agreements.  See the NOTICE file\n    distributed with this work for additional information\n    regarding copyright ownership.  The ASF licenses this file\n    to you under the Apache License, Version 2.0 (the\n    \"License\"); you may not use this file except in compliance\n    with the License.  You may obtain a copy of the License at\n\n      http://www.apache.org/licenses/LICENSE-2.0\n\n    Unless required by applicable law or agreed to in writing,\n    software distributed under the License is distributed on an\n    \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n    KIND, either express or implied.  See the License for the\n    specific language governing permissions and limitations\n    under the License.\n--\u003e\n\n# cordova-plugin-fonts\n\n| Download Activity | Travis CI |\n|:-:|:-:|\n| [![npm](https://img.shields.io/npm/dm/cordova-plugin-fonts.svg)](https://www.npmjs.com/package/cordova-plugin-fonts) | [![Build Status](https://travis-ci.org/adapt-it/cordova-fonts.svg?branch=master)](https://travis-ci.org/adapt-it/cordova-fonts) |\n\nA Cordova plugin that enumerates the fonts installed on the local device, and also provides the name of the default font.\n\nThis 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.\n\n    document.addEventListener(\"deviceready\", onDeviceReady, false);\n    function onDeviceReady() {\n        console.log(navigator.Fonts);\n    }\n\n## Installation\n\nFrom the Command line:\n\n    cordova plugin add cordova-plugin-fonts\n\nConfig.xml for PhoneGap Build:\n\n    \u003cgap:plugin name=\"cordova-plugin-fonts\" source=\"npm\" /\u003e\n    \nThese commands will install the plugin from npm. You can find this plugin up on npm [here](https://www.npmjs.com/package/cordova-plugin-fonts), or by searching for `ecosystem:cordova` in the npm registry like [this](https://www.npmjs.com/search?q=ecosystem%3Acordova).\n\n## Supported Platforms\n\n- Android\n- iOS\n- Browser\n- Electron (using Browser code)\n\n# Fonts\n\nThe `Fonts` object provides a way to enumerate through the list of fonts installed on the device.\n\n## Methods\n\nCurrently this plugin provides two methods, **getFontList** and **getDefaultFont**.\n\n### getFontList\n\n**Parameters:**\n\n- **successCallback**: Callback that returns the list of fonts as an array of string values.\n- **errorCallback:** Callback that executes if an error occurs while retrieving the list of fonts on the local device.\n\n**Notes**\n\n- The Browser and Electron Platforms test for the [local font access API](https://developer.mozilla.org/en-US/docs/Web/API/Local_Font_Access_API). If the underlying browser supports the API, it will return a string array of the font data's [font family](https://developer.mozilla.org/en-US/docs/Web/API/FontData/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.\n\n### Example\n\n    if (navigator.Fonts) {\n        console.log(\"Fonts object in navigator\");\n        navigator.Fonts.getFontList(\n            function (fontList) {\n                if (fontList) {\n                    for (var i = 0; i \u003c fontList.length; i++) {\n                        console.log(\"Font: \" + fontList[i]);\n                    }\n                }\n            },\n            function (error) {\n                console.log(\"FontList error: \" + error);\n            }\n        );\n    } else {\n        console.log(\"Plugin error: Fonts plugin not found (is it installed?)\");\n    }\n\n### getDefaultFont\n\n**Parameters:**\n\n- **successCallback**: Callback that returns the string name of the default font on the device.\n- **errorCallback:** Callback that executes if an error occurs during the call.\n\n**Notes**\n\n- The Browser and Electron platforms test for the [local font access API](https://developer.mozilla.org/en-US/docs/Web/API/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.\n\n### Example\n\n    if (navigator.Fonts) {\n        console.log(\"Fonts object in navigator\");\n        navigator.Fonts.getDefaultFont(\n            function (defaultFont) {\n                if (defaultFont) {\n                    console.log(\"Default Font: \" + defaultFont);\n                }\n            },\n            function (error) {\n                console.log(\"DefaultFont error: \" + error);\n            }\n        );\n    } else {\n        console.log(\"Plugin error: Fonts plugin not found (is it installed?)\");\n    }\n\n    \n## Internal Development / Unit Testing\n\n(This is only for devs who are developing / debugging the plugin itself)\n\nThe cordova-fonts plugin uses the cordova-plugin-test-framework to run unit tests. Complete the following to run through the plugin unit tests:\n\n1. Use your existing cordova app, or create a new one.\n2. Add the cordova-fonts plugin and test / test framework plugins:\n\n        cordova plugin add https://github.com/adapt-it/cordova-fonts.git\n        cordova plugin add https://github.com/adapt-it/cordova-fonts.git#:/tests\n        cordova plugin add cordova-plugin-test-framework\n\n3. Change the start page in your cordova app's `config.xml` with `\u003ccontent src=\"cdvtests/index.html\" /\u003e` or navigate to `cdvtests/index.html` from within your app.\n4. Build and run the application in an emulator or on the device.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadapt-it%2Fcordova-fonts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fadapt-it%2Fcordova-fonts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadapt-it%2Fcordova-fonts/lists"}