Skip to content

Commit

Permalink
Add tests for CID-keyed fonts.
Browse files Browse the repository at this point in the history
This test uses the special-purpose FDArray test fonts (https://github.com/adobe-fonts/fdarray-test), that includes 256 FDArray elements.
  • Loading branch information
fdb committed Apr 25, 2017
1 parent 106039d commit 005b870
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
Binary file added fonts/FDArrayTest257.otf
Binary file not shown.
16 changes: 16 additions & 0 deletions test/opentypeSpec.js
Expand Up @@ -29,6 +29,22 @@ describe('OpenType.js', function() {
assert.equal(aGlyph.path.commands.length, 14);
});

it('can load a CID-keyed font', function() {
var font = opentype.loadSync('./fonts/FDArrayTest257.otf');
assert.deepEqual(font.names.fontFamily, {en: 'FDArray Test 257'});
assert.deepEqual(font.tables.cff.topDict.ros, ['Adobe', 'Identity', 0]);
assert.equal(font.tables.cff.topDict._fdArray.length, 256);
assert.equal(font.tables.cff.topDict._fdSelect[0], 0);
assert.equal(font.tables.cff.topDict._fdSelect[42], 41);
assert.equal(font.tables.cff.topDict._fdSelect[256], 255);
assert.equal(font.unitsPerEm, 1000);
assert.equal(font.glyphs.length, 257);
var aGlyph = font.glyphs.get(2);
assert.equal(aGlyph.name, 'exclam');
assert.equal(aGlyph.unicode, 1);
assert.equal(aGlyph.path.commands.length, 24);
});

it('can load a WOFF/CFF font', function() {
var font = opentype.loadSync('./fonts/FiraSansMedium.woff');
assert.deepEqual(font.names.fontFamily, {en: 'Fira Sans OT'});
Expand Down

0 comments on commit 005b870

Please sign in to comment.