ecomfe / fontmin

Minify font seamlessly
http://ecomfe.github.io/fontmin
MIT License
5.82k stars 318 forks source link

TypeError: Cannot read property 'contours' of undefined #17

Closed Wildhoney closed 9 years ago

Wildhoney commented 9 years ago

See issue raised on: https://github.com/ecomfe/gulp-fontmin/issues/2 :+1:

Wildhoney commented 9 years ago

Just updating the ticket:

Wildhoney commented 9 years ago

For others who encounter this issue with read property 'contours' of undefined:

TypeError: Cannot read property 'contours' of undefined at /Users/atimberlake/Webroot/Mobile/node_modules/gulp-fontmin/node_modules/fontmin/node_modules/fonteditor-ttf/lib/ttf/table/OS2.js:175:59

I didn't solve it, but I did have a workaround. I converted my TTF files into SVG format and stored those in the repository — as opposed to the TTF files — and then used gulp-svg2ttf to convert the SVG files to TTF and then use fontmin:

gulp.task('font', function() {

    var upperCase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
    var lowerCase = upperCase.toLowerCase();
    var numbers   = '0123456789';
    var special   = '£()+,.-@';

    return gulp.src('public/fonts/PTSansWeb/*.svg')
               .pipe(svg2ttf())
               .pipe(fontmin({ text: [].concat(upperCase, lowerCase, numbers, special).join('') }))
               .pipe(flatten())
               .pipe(gulp.dest('public/fonts'));

});
Wildhoney commented 9 years ago

Fixed with 0.9.0-alpha-3.

sweatyc commented 4 years ago

I encountered this in Fontmin-app 0.2.0.

Screenshot: https://monosnap.com/file/qNnwIt9ZI0d9e6t6pMPVf3tWqpcZ6w