nfroidure/gulp-iconfont

Icons not generated properly

Closed this issue · 8 comments

I'm taking icons from materials website of 42dp.
My gulp task is below:


// Gulp task to generate font icons from svg (run: gulp iconfont)
const fontName = 'icons';
gulp.task('iconfont', function() {
  gulp
    .src(['some_path/svgs/*.svg'])
    .pipe(
      iconfontCss({
        fontName: fontName,
        targetPath: 'style.css',
        fontPath: './',
        cssClass: 'icon',
      })
    )
    .pipe(
      iconfont({
        fontName: fontName,
        formats: ['svg', 'ttf', 'eot', 'woff', 'woff2'], // default, 'woff2' and 'svg' are available
        normalize: true,
        prependUnicode: true, // recommended option
        fontHeight: 1001, // Tried lot of values, <1000 and also 10000, and 100000 :P but no success
        centerHorizontally: true,
      })
    )
    .pipe(gulp.dest('some_path/styles/fonts/'));
});


As the documentation says,
image
image

But the fonts generated aren't proper. font
image

Cannot help with so little details. Tell us what you got and what you expect. You should publish to stack overflow too since it looks like misconfiguration.

Hey @nfroidure

This is what I got.

And my expecting fonts should look like obviously not with extra space because I'm giving normalize: true and fontHeight: 1001
This below I got from iconmoon website and this is how I am expecting
image

Also, it's probably not misconfiguration. Check following issues which are still unanswered. #136 (comment) And #143

Guys in that issue suggested to use normalize: true and fontHeight: 1001 but 1st post in that issue already has those options and that issue got deferred from original bug

Anyways, I've also raised question here

Hey @nfroidure did you get a chance to look at it? I've given pretty much all resources to reproduce issue as you asked.

@aseem2625 would suggest to simplify your icons SVG, there may be some transformations unsupported by svgicons2svgfont.

Also, can you provide the SVG for the icon you showed us ?

Hey @nfroidure Simplifying icons SVG means? "Changing svg to Path is already done AFAIK through materials website" if that you mean by simplifying icons

This is the icon I used. Uploading here as well. Please unzip below file.
ic_search_black_48px.svg.zip

<svg fill="#000000" height="48" viewBox="0 0 24 24" width="48"

I guess it comes from the viewbox that is not/miss interpreted. You should report the issue to the svgicons2svgfont project and PR it if you are in a hurry.

Thank you @nfroidure 😄