Closed Pomax closed 3 years ago
In the browser test, testing an .otf font with the extension .ttf gives an accurate "Version is OTTO is false: 65536 is not 1330926671". But it also gives a console error:
test-SFNT.js:271 TypeError: Cannot read property 'platformID' of undefined
at testSFNT (test-SFNT.js:31)
at Font.font.onload (test.otf.js:58)
at Font.fromDataBuffer (Font.js:81)
Is this caught as you wanted?
hm, I don't recall adding a "wrong file extension" test so it's entirely likely unexpected things will happen - that said, that sounds like it's worth adding some explicit "wrong file extension" tests =)
if I'm using the wrong file extension, I get this:
> font-js@1.0.2 test:puppeteer C:\Users\Mike\Documents\Git\released\font.js
> node ./testing/browser/puppeteer.js
7 browser tests failed.
Version is OTTO is false: 65536 is not 1330926671
There are 15 tables in this font is false: 20 is not 15
tables: "BASE", "CFF ", "DSIG", "GDEF", "GPOS", "GSUB", "OS/2", "SVG ", "cmap", "head", "hhea", "hmtx", "maxp", "name", "post" is false: BASE,DSIG,GDEF,GPOS,GSUB,OS/2,SVG ,cmap,cvt ,fpgm,gasp,glyf,head,hhea,hmtx,loca,maxp,name,post,prep is not BASE,CFF ,DSIG,GDEF,GPOS,GSUB,OS/2,SVG ,cmap,head,hhea,hmtx,maxp,name,post
Correct searchRange is false: 256 is not 128
Correct entrySelector is false: 4 is not 3
Correct rangeShift is false: 64 is not 112
Version 1 is false: 1 is not 0.5
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! font-js@1.0.2 test:puppeteer: `node ./testing/browser/puppeteer.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the font-js@1.0.2 test:puppeteer script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
Which seems correct. The test assumes it's going to get an otf, and was written to verify that a know font has the correct known values.
We'll need to write new tests for "doing the right thing with the wrong-named font". I'll file that as followup, rather than putting that in this PR (I'd like to land this one =D)
Sounds good. Let's merge!
closes https://github.com/Pomax/Font.js/issues/96