opentype.js
Advanced tools
Comparing version 0.9.0 to 0.10.0
{ | ||
"name": "opentype.js", | ||
"version": "0.9.0", | ||
"version": "0.10.0", | ||
"main": "dist/opentype.js", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
{ | ||
"name": "opentype.js", | ||
"description": "OpenType font parser", | ||
"version": "0.9.0", | ||
"version": "0.10.0", | ||
"author": { | ||
@@ -6,0 +6,0 @@ "name": "Frederik De Bleser", |
opentype.js | ||
=========== | ||
[![Gitter](https://badges.gitter.im/nodebox/opentype.js.svg)](https://gitter.im/nodebox/opentype.js) | ||
[![npm](https://img.shields.io/npm/v/opentype.js.svg)](https://www.npmjs.com/package/opentype.js) | ||
[![david-dm](https://david-dm.org/nodebox/opentype.js.svg)](https://david-dm.org/nodebox/opentype.js) | ||
[![npm](https://img.shields.io/npm/v/opentype.js.svg)](https://www.npmjs.com/package/opentype.js) | ||
[![Build Status](https://travis-ci.org/nodebox/opentype.js.svg?branch=master)](https://travis-ci.org/nodebox/opentype.js) | ||
[![david-dm](https://david-dm.org/nodebox/opentype.js.svg)](https://david-dm.org/nodebox/opentype.js) | ||
[![Gitter](https://badges.gitter.im/nodebox/opentype.js.svg)](https://gitter.im/nodebox/opentype.js) | ||
@@ -7,0 +8,0 @@ opentype.js is a JavaScript parser and writer for TrueType and OpenType fonts. |
@@ -0,1 +1,5 @@ | ||
0.10.0 (August 14, 2018) | ||
===================== | ||
* font.download(): use window.URL instead of window.requestFileSystem, which works on a larger set of browsers : Chrome (32+), Opera (19+), Firefox (26+), Safari (7.1+), and all of Edge. | ||
0.9.0 (June 21, 2018) | ||
@@ -2,0 +6,0 @@ ===================== |
@@ -505,20 +505,18 @@ // The Font object | ||
if (isBrowser()) { | ||
window.requestFileSystem = window.requestFileSystem || window.webkitRequestFileSystem; | ||
window.requestFileSystem(window.TEMPORARY, arrayBuffer.byteLength, function(fs) { | ||
fs.root.getFile(fileName, {create: true}, function(fileEntry) { | ||
fileEntry.createWriter(function(writer) { | ||
const dataView = new DataView(arrayBuffer); | ||
const blob = new Blob([dataView], {type: 'font/opentype'}); | ||
writer.write(blob); | ||
window.URL = window.URL || window.webkitURL; | ||
writer.addEventListener('writeend', function() { | ||
// Navigating to the file will download it. | ||
location.href = fileEntry.toURL(); | ||
}, false); | ||
}); | ||
}); | ||
}, | ||
function(err) { | ||
throw new Error(err.name + ': ' + err.message); | ||
}); | ||
if (window.URL) { | ||
const dataView = new DataView(arrayBuffer); | ||
const blob = new Blob([dataView], {type: 'font/opentype'}); | ||
let link = document.createElement('a'); | ||
link.href = window.URL.createObjectURL(blob); | ||
link.download = fileName; | ||
let event = document.createEvent('MouseEvents'); | ||
event.initEvent('click', true, false); | ||
link.dispatchEvent(event); | ||
} else { | ||
console.warn('Font file could not be downloaded. Try using a different browser.'); | ||
} | ||
} else { | ||
@@ -525,0 +523,0 @@ const fs = require('fs'); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
296
2153829
85
25242
2