Skip to content

Instantly share code, notes, and snippets.

@Kennyl
Last active April 22, 2017 03:24
Show Gist options
  • Select an option

  • Save Kennyl/406e70c9be3fd835da8a333d6a747367 to your computer and use it in GitHub Desktop.

Select an option

Save Kennyl/406e70c9be3fd835da8a333d6a747367 to your computer and use it in GitHub Desktop.
fontmin reduce
var fs = require("fs");
var Fontmin = require('fontmin');
var content = fs.readFileSync('a.txt', 'utf8');
var fontmin = new Fontmin()
.src('a.ttf')
.use(Fontmin.glyph({
text: content,
hinting: false // keep ttf hint info (fpgm, prep, cvt). default = true
}))
.dest('b');
fontmin.run(function (err, files) {
if (err) {
throw err;
}
console.log(files[0]);
// => { contents: <Buffer 00 01 00 ...> }
});
mkdir b
cat *.xhtml | grep -oE '\S' | sort | uniq | awk 1 ORS='' > a.txt
ls a.txt
ls a.ttf
ls b
node a.js
ls b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment