Skip to content
This repository was archived by the owner on Jan 24, 2019. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,30 @@ Icons without codepoints will have codepoints incremented from `startCodepoint`
Options that are passed directly to
[svgicons2svgfont](https://github.com/nfroidure/svgicons2svgfont).

### formatOptions

Type: `object`

Specific per format arbitrary options to pass to the generator

format and matching generator:
- `svg` - [svgicons2svgfont](https://github.com/nfroidure/svgicons2svgfont).
- `ttf` - [svg2ttf](https://github.com/fontello/svg2ttf).
- `woff` - [ttf2woff](https://github.com/fontello/ttf2woff).
- `eot` - [ttf2eot](https://github.com/fontello/ttf2eot).

```js
webfontsGenerator({
// options
formatOptions: {
// options to pass specifically to the ttf generator
ttf: {
ts: 1451512800000
}
}
}, function(error, result) {})
```

### writeFiles

Type: `boolean`
Expand Down
11 changes: 8 additions & 3 deletions src/generateFonts.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ var generators = {
var svgOptions = _.pick(options,
'fontName', 'fontHeight', 'descent', 'normalize', 'round'
)

if (options.formatOptions['svg']) {
svgOptions = _.extend(svgOptions, options.formatOptions['svg'])
}

svgOptions.log = function(){}

var fontStream = svgicons2svgfont(svgOptions)
Expand Down Expand Up @@ -53,7 +58,7 @@ var generators = {
ttf: {
deps: ['svg'],
fn: function(options, svgFont, done) {
var font = svg2ttf(svgFont)
var font = svg2ttf(svgFont, options.formatOptions['ttf'])
font = new Buffer(font.buffer)
done(null, font)
}
Expand All @@ -62,7 +67,7 @@ var generators = {
woff: {
deps: ['ttf'],
fn: function(options, ttfFont, done) {
var font = ttf2woff(new Uint8Array(ttfFont))
var font = ttf2woff(new Uint8Array(ttfFont), options.formatOptions['woff'])
font = new Buffer(font.buffer)
done(null, font)
}
Expand All @@ -71,7 +76,7 @@ var generators = {
eot: {
deps: ['ttf'],
fn: function(options, ttfFont, done) {
var font = ttf2eot(new Uint8Array(ttfFont))
var font = ttf2eot(new Uint8Array(ttfFont), options.formatOptions['eot'])
font = new Buffer(font.buffer)
done(null, font)
}
Expand Down
1 change: 1 addition & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ var DEFAULT_OPTIONS = {
rename: function(file) {
return path.basename(file, path.extname(file))
},
formatOptions: {},
/**
* Unicode Private Use Area start.
* http://en.wikipedia.org/wiki/Private_Use_(Unicode)
Expand Down