fontmin
fontmin copied to clipboard
Subset font by private use codepoints?
Trying to create a subset of the Bootstrap3 glyphicons so I get a font file with only the few glyphs I actually use.
Most of the icons use private use codepoints in UTF-8. I've been able to subset them by copying the character from http://www.fileformat.info/info/unicode/char/e013/browsertest.htm
But it isn't very readable. Any option I've missed that could make this more readable?
From my gulpfile.js:
var Fontmin = require('fontmin');
gulp.task('fontmin', function () {
var characters = [
'+', // plus \002b
'', // ok \e013 http://www.fileformat.info/info/unicode/char/e013/browsertest.htm
'', // remove \e014
'', // cog \e019
'', // trash \e020
'', // lock \e033
'', // stats \e185
];
var fontmin = new Fontmin()
.src('node_modules/bootstrap-sass/assets/fonts/bootstrap/glyphicons-halflings-regular.ttf')
.dest('public/build/fonts/bootstrap/subset')
.use(Fontmin.glyph({
text: characters.join(),
hinting: false // keep ttf hint info (fpgm, prep, cvt). default = true
}))
.use(Fontmin.ttf2eot())
.use(Fontmin.ttf2woff())
.use(Fontmin.ttf2svg());
fontmin.run(function (err, files) {
if (err) {
throw err;
}
console.log(files[0]);
// => { contents: <Buffer 00 01 00 ...> }
});
});
let me try