fontello / svg2ttf

SVG -> TTF font convertor
MIT License
518 stars 79 forks source link

SVG image doesn't render correctly when run through svg2ttf #109

Closed qfulsher closed 3 years ago

qfulsher commented 3 years ago

I'm trying to create a series of icons backed by SVG images. All of the SVGs work well except for this one. Here's the SVG in question: lftnav-equipment.zip. It may have been generated incorrectly by the tool used to draw it, although chrome seems to render the original SVG just fine.

I'm using the gulp-iconfont library to do the conversion from SVG => .scss / woff file.

here's the gulp task I'm using:

var gulp = require('gulp');
var iconfont = require('gulp-iconfont');
var svgmin = require('gulp-svgmin');
var consolidate = require('gulp-consolidate');

gulp.task('svg2ttf', function() {
    return gulp.src(['src/icons/assets/svg/*.svg'])
      .pipe(svgmin())
      .pipe(iconfont({
        fontName: 'lx',
        prependUnicode: true,
        normalize: true,
        fontHeight: 1000,
        formats: ['ttf']
      })).on('glyphs', function(glyphs, options) {
        gulp.src('src/lx.template')
          .pipe(consolidate('lodash', {
            glyphs: glyphs,
            fontName: options.fontName,
          }))
          .pipe(gulp.dest('./out'));
      })
      .pipe(gulp.dest('./out'));
});

At the end of the process the font turns out showing up as a black box rather than the actual icon. I'm converting ~200 icons via this process, this is the only one that's showing this behavior.

puzrin commented 3 years ago

https://github.com/fontello/fontello/wiki/How-to-use-custom-images

Data should be prepared properly and be simple path, without references. Use fontello for quick-check.