opentype.js
Advanced tools
Comparing version 1.1.0 to 1.2.0
{ | ||
"name": "opentype.js", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"main": "dist/opentype.js", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
{ | ||
"name": "opentype.js", | ||
"description": "OpenType font parser", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"author": { | ||
@@ -24,3 +24,3 @@ "name": "Frederik De Bleser", | ||
"main": "dist/opentype.js", | ||
"module": "src/opentype.js", | ||
"module": "dist/opentype.module.js", | ||
"bin": { | ||
@@ -32,3 +32,3 @@ "ot": "./bin/ot" | ||
"watch": "rollup -c -w", | ||
"test": "mocha --require reify --compilers js:buble/register --recursive && jshint . && jscs .", | ||
"test": "mocha --require reify --recursive && jshint . && jscs .", | ||
"build": "rollup -c", | ||
@@ -39,15 +39,15 @@ "minify": "uglifyjs --source-map \"url='opentype.min.js.map'\" --compress --mangle --output ./dist/opentype.min.js -- ./dist/opentype.js", | ||
"devDependencies": { | ||
"@babel/preset-env": "^7.1.0", | ||
"buble": "^0.19.4", | ||
"cross-env": "^5.2.0", | ||
"@babel/preset-env": "^7.9.5", | ||
"buble": "^0.20.0", | ||
"cross-env": "^7.0.2", | ||
"jscs": "^3.0.7", | ||
"jshint": "^2.9.6", | ||
"mocha": "^5.2.0", | ||
"reify": "^0.18.1", | ||
"rollup": "^0.66.6", | ||
"rollup-plugin-buble": "^0.19.4", | ||
"rollup-plugin-commonjs": "^9.2.0", | ||
"rollup-plugin-license": "^0.7.0", | ||
"rollup-plugin-node-resolve": "^3.4.0", | ||
"uglify-js": "^3.4.9" | ||
"jshint": "^2.11.0", | ||
"mocha": "^7.1.1", | ||
"reify": "^0.20.12", | ||
"rollup": "^1.32.1", | ||
"rollup-plugin-buble": "^0.19.8", | ||
"rollup-plugin-commonjs": "^10.1.0", | ||
"rollup-plugin-license": "^0.9.0", | ||
"rollup-plugin-node-resolve": "^5.2.0", | ||
"uglify-js": "^3.8.1" | ||
}, | ||
@@ -59,4 +59,4 @@ "browser": { | ||
"string.prototype.codepointat": "^0.2.1", | ||
"tiny-inflate": "^1.0.2" | ||
"tiny-inflate": "^1.0.3" | ||
} | ||
} |
@@ -80,2 +80,12 @@ | ||
You can also use `es6 async/await` syntax to load your fonts | ||
```javascript | ||
async function make(){ | ||
const font = await opentype.load('fonts/Roboto-Black.ttf'); | ||
const path = font.getPath('Hello, World!', 0, 150, 72); | ||
console.log(path); | ||
} | ||
``` | ||
If you already have an `ArrayBuffer`, you can use `opentype.parse(buffer)` to parse the buffer. This method always | ||
@@ -82,0 +92,0 @@ returns a Font, but check `font.supported` to see if the font is in a supported format. (Fonts can be marked unsupported |
@@ -0,1 +1,10 @@ | ||
1.2.0 (April 13, 2020) | ||
===================== | ||
* Fix issue #385, merge default options with user options (#386) | ||
* Adds support for browser Async/Await for .load() (#389) | ||
* Introduce ES6 module build (#391) | ||
* Fix test in featureQuery | ||
* Remove Node 4 from Travis (#392) | ||
* Update dependencies & build dist files | ||
1.1.0 (May 1, 2019) | ||
@@ -2,0 +11,0 @@ ===================== |
@@ -8,13 +8,18 @@ var buble = require('rollup-plugin-buble'); | ||
input: 'src/opentype.js', | ||
output: { | ||
file: 'dist/opentype.js', | ||
format: 'umd', | ||
name: 'opentype', | ||
sourcemap: true | ||
}, | ||
output: [ | ||
{ | ||
file: 'dist/opentype.js', | ||
format: 'umd', | ||
name: 'opentype', | ||
sourcemap: true | ||
}, | ||
{ | ||
file: 'dist/opentype.module.js', | ||
format: 'es', | ||
sourcemap: true | ||
} | ||
], | ||
plugins: [ | ||
resolve({ | ||
jsnext: true, | ||
main: true, | ||
browser: true, | ||
mainFields: ['module', 'main', 'jsnext', 'browser'], | ||
}), | ||
@@ -21,0 +26,0 @@ commonjs(), |
@@ -298,3 +298,3 @@ // The Font object | ||
fontSize = fontSize !== undefined ? fontSize : 72; | ||
options = options || this.defaultRenderOptions; | ||
options = Object.assign({}, this.defaultRenderOptions, options); | ||
const fontScale = 1 / this.unitsPerEm * fontSize; | ||
@@ -301,0 +301,0 @@ const glyphs = this.stringToGlyphs(text, options); |
@@ -377,13 +377,20 @@ // opentype.js | ||
const loadFn = isNode ? loadFromFile : loadFromUrl; | ||
loadFn(url, function(err, arrayBuffer) { | ||
if (err) { | ||
return callback(err); | ||
} | ||
let font; | ||
try { | ||
font = parseBuffer(arrayBuffer, opt); | ||
} catch (e) { | ||
return callback(e, null); | ||
} | ||
return callback(null, font); | ||
return new Promise((resolve) => { | ||
loadFn(url, function(err, arrayBuffer) { | ||
if (err) { | ||
return callback(err); | ||
} | ||
let font; | ||
try { | ||
font = parseBuffer(arrayBuffer, opt); | ||
} catch (e) { | ||
return callback(e, null); | ||
} | ||
if (callback) { | ||
return callback(null, font); | ||
} else { | ||
resolve(font); | ||
} | ||
}); | ||
}); | ||
@@ -390,0 +397,0 @@ } |
@@ -88,3 +88,3 @@ import assert from 'assert'; | ||
}); | ||
it.only('should find a substitute - single substitution format 1 (11)', function () { | ||
it('should find a substitute - single substitution format 1 (11)', function () { | ||
const feature = query.arabicChanga.getFeature({tag: 'init', script: 'arab'}); | ||
@@ -91,0 +91,0 @@ const featureLookups = query.arabicChanga.getFeatureLookups(feature); |
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
Sorry, the diff of this file is not supported yet
3913638
101
41712
307
13
Updatedtiny-inflate@^1.0.3