Skip to content

Instantly share code, notes, and snippets.

@stakira
Created December 12, 2017 01:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stakira/e21585edeaab4c751dc87a7e6ced24b3 to your computer and use it in GitHub Desktop.
Save stakira/e21585edeaab4c751dc87a7e6ced24b3 to your computer and use it in GitHub Desktop.
Use fontmin to create compact merged font from KaiGenGothic font
var Fontmin = require('fontmin');
var concat = require('fontmin-concat');
// var fontmin = new Fontmin()
// .src('otfs/*.otf')
// .use(Fontmin.otf2ttf())
// .dest('ttfs');
// var fontmin = new Fontmin()
// .src('KaiGenGothic/*.ttf')
// .use(concat('merged.ttf'))
// .dest('merged')
var fs = require('fs');
var contents = fs.readFileSync('charsets/3500.txt', 'utf8');
contents += fs.readFileSync('charsets/ksx1001.txt', 'utf8');
contents += fs.readFileSync('charsets/shiftjis.txt', 'utf8');
contents += fs.readFileSync('charsets/tc_zhangyong1979.txt', 'utf8');
var fontmin = new Fontmin()
.src('merged/*.ttf')
.use(Fontmin.glyph({
text: contents
}))
.dest('opt');
fontmin.run(function (err, files, stream) {
if (err) {
console.error(err);
}
console.log('done');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment