opentype.js
Advanced tools
Comparing version 0.7.0 to 0.7.1
{ | ||
"name": "opentype.js", | ||
"version": "0.7.0", | ||
"version": "0.7.1", | ||
"main": "dist/opentype.js", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
{ | ||
"name": "opentype.js", | ||
"description": "OpenType font parser", | ||
"version": "0.7.0", | ||
"version": "0.7.1", | ||
"author": { | ||
@@ -6,0 +6,0 @@ "name": "Frederik De Bleser", |
@@ -0,1 +1,7 @@ | ||
0.7.1 (Apr 25, 2017) | ||
==================== | ||
* Auto-generated glyph IDs (CID-keyed fonts) are now prefixed with "gid", e.g. "gid42". | ||
* Fix ligature substitution for fonts with coverage table format 2. | ||
* Better error messages when no valid cmap is found. | ||
0.7.0 (Apr 25, 2017) | ||
@@ -2,0 +8,0 @@ ==================== |
@@ -267,3 +267,3 @@ // Glyph encoding | ||
if (font.isCIDFont) { | ||
glyph.name = 'cid' + i; | ||
glyph.name = 'gid' + i; | ||
} else { | ||
@@ -270,0 +270,0 @@ glyph.name = font.cffEncoding.charset[i]; |
@@ -268,3 +268,3 @@ // The Layout object is the prototype of Substition objects, and provides utility methods to manipulate | ||
var ranges = coverageTable.ranges; | ||
for (var i = 0; i < ranges; i++) { | ||
for (var i = 0; i < ranges.length; i++) { | ||
var range = ranges[i]; | ||
@@ -271,0 +271,0 @@ var start = range.start; |
@@ -110,5 +110,4 @@ // The `cmap` table stores the mappings from characters to glyphs. | ||
if (offset === -1) { | ||
// There is no cmap table in the font that we support, so return null. | ||
// This font will be marked as unsupported. | ||
return null; | ||
// There is no cmap table in the font that we support. | ||
throw new Error('No valid cmap sub-tables found.'); | ||
} | ||
@@ -124,3 +123,3 @@ | ||
} else { | ||
throw new Error('Only format 4 and 12 cmap tables are supported.'); | ||
throw new Error('Only format 4 and 12 cmap tables are supported (found format ' + cmap.format + ').'); | ||
} | ||
@@ -127,0 +126,0 @@ |
@@ -45,4 +45,12 @@ /* jshint mocha: true */ | ||
}); | ||
it('works on fonts with coverage table format 2', function() { | ||
var vibur = opentype.loadSync('./fonts/Vibur.woff'); | ||
var glyphs = vibur.stringToGlyphs('er'); | ||
assert.equal(glyphs.length, 1); | ||
assert.equal(glyphs[0].name, 'er'); | ||
}); | ||
}); | ||
}); |
@@ -43,3 +43,3 @@ 'use strict'; | ||
var aGlyph = font.glyphs.get(2); | ||
assert.equal(aGlyph.name, 'cid2'); | ||
assert.equal(aGlyph.name, 'gid2'); | ||
assert.equal(aGlyph.unicode, 1); | ||
@@ -46,0 +46,0 @@ assert.equal(aGlyph.path.commands.length, 24); |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
1146329
83
14
24828