Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/johanholmerin/localfontaccess-shim
Shim for the Local Font Access API, https://goo.gl/nJuKro, using Google Fonts
https://github.com/johanholmerin/localfontaccess-shim
Last synced: about 1 month ago
JSON representation
Shim for the Local Font Access API, https://goo.gl/nJuKro, using Google Fonts
- Host: GitHub
- URL: https://github.com/johanholmerin/localfontaccess-shim
- Owner: johanholmerin
- Created: 2016-02-07T19:31:55.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2016-02-07T19:59:57.000Z (almost 9 years ago)
- Last Synced: 2024-10-19T11:53:34.681Z (3 months ago)
- Language: JavaScript
- Homepage:
- Size: 1.95 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Local Font Access shim
Uses Google Fonts to shim the Local Font Access API, https://goo.gl/nJuKro
## Usage
Because this shim uses the Google Fonts Developer API, you need to
acquire an API key from Google. Instructions are available at
https://developers.google.com/fonts/docs/developer_api#APIKey.After you have loaded the shim you need to set the key:
FontAccess.key = ;
## Example
FontAccess.getFonts().then(function (fontDescriptionArray) {
fontDescriptionArray.forEach(function (fontDescription) {
console.log(fontDescription.family, fontDescription.style);
});
}, function (err) {
console.error(err);
});FontAccess.getFontBlob('Roboto', 'regular').then(function (file) {
var reader = new FileReader();
reader.onload = function (event) {
console.log(reader.result.byteLength);
};
reader.readAsArrayBuffer(file);
}, function (err) {
console.error(err);
});## Notes
The shim uses fetch and promises.