nfroidure / ttf2woff2

Convert ttf files to woff2.
MIT License
297 stars 39 forks source link

Woff2 format option kills my gulp build process randomly #22

Closed bm2u closed 1 month ago

bm2u commented 8 years ago

After updating npm from 0.12.7 to 4.2.2 and gulp-iconfont from 5.0.0 to 5.0.1. Woff2 format option kills my build process randomly with Process finished with exit code -1073740940 (0xC0000374). Unfortunately there is no deeper logging oder details to provide, but leaving the woff2 format option solves the problem. Maybe be a clue to follow. Has anybody got an idea about how to convert ttf to woff2 in the meantime, except downgrading? Im running on windows 8.1.

The responsible gulp tasks:

gulp.task('iconfont:clean', function() {
    return del(config.dest);
});

gulp.task('iconfont:make', ['iconfont:clean'], function() {
    return gulp.src(config.src)
        .pipe(svgmin())
        .pipe(gulp.dest(config.tmp))
        .pipe(iconfont(config.options))
        .on('glyphs', makestyles)
        .pipe(gulp.dest(config.dest));
});

The 'makestyles' as follows.

module.exports = function(glyphs) {

    var options = {
        glyphs: glyphs,
        fontName: config.options.fontName,
        fontPath: config.fontDest,
        className: config.className,
        longName: config.name,
        projectName: project.name,
        projectVersion: project.version,
        pseudo: config.pseudo
    };

    // Generates scss file
    gulp.src(config.templateScss)
        .pipe(consolidate('lodash', options))
        .on('error', console.error.bind(console))
        .pipe(rename(config.scssOutputName))
        .pipe(gulp.dest(config.scssDest));
};

Options for running gulp-iconfont

options: {
    fontName: 'MyIconFont',
    appendUnicode: true,
    normalize: true,
    descent: 70,
    ascent: 420,
    formats: ['ttf', 'eot', 'woff', 'woff2', 'svg'],
    timestamp: runTimestamp,
    fontHeight: 512
}
nfroidure commented 8 years ago

Thank you but you forgotten to provide the SVG/TTF fonts in order to reproduce the problem.

nfroidure commented 8 years ago

@bm2u also, can you tell me if the font is generated with the emscripten fallback or the C++ add-on and on which platform (os, node version).

bm2u commented 8 years ago

When the build process crashs - unfortunately no font file were generated. To get the result of a successful build, please refer to myfont.zip (ttf/svg & woff2). How can I verify the way of converting I am using (emscript fallback or C++). I guess I'm running the emscripten fallback. Operating system is windows 8.1 and currently running with node.js 5.1.1.

nfroidure commented 8 years ago

@bm2u in fact you can force one or another by simply deleting the native build files in node_modules/ttf2woff2/build or by modifying those lines https://github.com/nfroidure/ttf2woff2/blob/master/src/index.js#L3-L5

I don't need the woff2 output but simply the ttf font inputted. To get it you just have to remove the woff2 format from the options and give me the ttf font generated that way.

bm2u commented 8 years ago

ok - I'm gonna force both ways separately and will come back later. The (myfont.zip) contains the requested ttf-file as well.

bm2u commented 8 years ago

@nfroidure I've tried both ways and figured out that the jssrc-way is more reliable (no failure at all). The addon.node-way kills my entire workflow several times. Please refer to myBothWaysFont.zip for the results.

Is there an opportunity to force the jssrc-way via config attribute? Otherwise local changes @ttf2woff2 will be gone after the next update.

nfroidure commented 8 years ago

It is certainly possible but would need some code refactoring though. I'll consider it for the next release, fell free to PR in the meantime.