Created
December 12, 2017 01:11
-
-
Save stakira/e21585edeaab4c751dc87a7e6ced24b3 to your computer and use it in GitHub Desktop.
Use fontmin to create compact merged font from KaiGenGothic font
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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