nfroidure / svgicons2svgfont

Concatenate SVG icons and ouput an SVG font
http://nfroidure.github.io/svgiconfont/
MIT License
340 stars 71 forks source link

appendUnicode option causes error #43

Closed lokywin closed 9 years ago

lokywin commented 9 years ago

Hi @nfroidure would you or someone else please be able to give insights about what I need to achieve below: sketch-to-font After adding, unicode for life-buoy icon is taken over by house icon. What I am hoping to do is that house will be assigned with EA07 instead of EA05 which is already being used.

So I have been trying with appendUnicode: true option in the following gulp task

gulp.task('my-icon', function(){
  gulp.src('my-icon.sketch')
    .pipe(sketch({
      export: 'artboards',
      formats: 'svg'
    }))
    .pipe(iconfont({
      fontName: fontName,
      appendUnicode: true
    }))
   ...

but that gives me the following error:

/Users/.../.../.../.../sketch-to-font/node_modules/gulp-iconfont/node_modules/gulp-ttf2woff2/node_modules/ttf2woff2/jssrc/ttf2woff2.js:1
aughtException",(function(ex){if(!(ex instanceof ExitStatus)){throw ex}}));Mod
                                                                    ^
Error: Could not save codepoint: uEA01 for calendar.svg
    at /Users/.../.../.../.../sketch-to-font/node_modules/gulp-iconfont/node_modules/gulp-svgicons2svgfont/node_modules/svgicons2svgfont/src/metadata.js:59:25
    at FSReqWrap.oncomplete (fs.js:95:15)

startUnicode option works as expected.

I am using node v0.12.7, here is my package.json

{
  "devDependencies": {
    "coffee-script": "^1.9.3",
    "gulp": "^3.9.0",
    "gulp-consolidate": "^0.1.2",
    "gulp-iconfont": "^4.0.0",
    "gulp-livereload": "^3.8.0",
    "gulp-rename": "^1.2.2",
    "gulp-sketch": "^0.0.10",
    "lodash": "^3.9.3"
  }
}

Please let me know if you need more info, or whether this is the right place at all. Thank you very much for your help.

nfroidure commented 9 years ago

It look likes it can't write changes on the src file path. I suppose it is due to unix rights or maybe a bad path (don't know what sketch really do and if the given files path are real.

I think that it has nothing to do with gulp-iconfont since this is strongly tested but if you find a case you can reproduce, please, isolate it in a test near there and PR the project.

Anyway, you still can add the prefixes to files yourself by manually editing them.

jimmyandrade commented 4 years ago

@lokywin

I'm trying to solve this problem by assigning specific codepoints to each icon, but apparently this library doesn't do that. Have you had any success with this problem?

lokywin commented 4 years ago

@jimmyandrade was there a specific reason you need to specify the unicode? I don't think it worked out for me. So I had to come up with a system in Sketch file so we don't rearrange the Sketch boards randomly. That was the only downsize of it. But everything else was ok. I didn't want to specifically manage the unicode for each icon anyway.

I don't have a better solution for you, as it has been awhile. But we also have moved on from icon font. We only use SVG icons.

jimmyandrade commented 4 years ago

@jimmyandrade was there a specific reason you need to specify the unicode?

Yes, two scenarios. When I'm migrating from another solution and I want to keep the former unicodes. And when I want to give support for specific ligatures or even emojis, like flags.