bpierre / fontello-svg

Generate SVG icons from a Fontello icon set.
MIT License
66 stars 7 forks source link

'Not Found' in generated files #4

Open mateatslc opened 9 years ago

mateatslc commented 9 years ago

11 out of my 25 SVGs generated by fontello-svg have the string Not Found instead of the actual content. Verbose mode didn't help either. Any clue how to get around this?

mateatslc commented 9 years ago

Just a wild guess: icons with custom names won't work?

mateatslc commented 9 years ago

Confirmed. Works as expected with original icon names. Want a PR with updated readme?

bpierre commented 9 years ago

Yes, it’s because fontello-svg is fetching the data directly from the fontello repository as you can see here: https://github.com/bpierre/fontello-svg/blob/master/index.js#L29-L30

Is there any trace of the original names in your file? Maybe we could add support for custom names if this the case.

mateatslc commented 9 years ago

Not for names, but looks like every glyph comes with a unique uid field that stays the same even if I set custom names. Take this 'config.json':

{
  "name": "meh",
  "css_prefix_text": "icon-",
  "css_use_suffix": false,
  "hinting": true,
  "units_per_em": 1000,
  "ascent": 850,
  "glyphs": [
    {
      "uid": "474656633f79ea2f1dad59ff63f6bf07",
      "css": "star",
      "code": 102,
      "src": "fontawesome"
    },
    {
      "uid": "d17030afaecc1e1c22349b99f3c4992a",
      "css": "star-empty",
      "code": 103,
      "src": "fontawesome"
    },
    {
      "uid": "84cf1fcc3fec556e7eaeb19679ca2dc9",
      "css": "star-half",
      "code": 104,
      "src": "fontawesome"
    }
  ]
}

Looking at some of the fontello font repos out there, it looks like every repo has a config.yml file that defines those uid's. I'm positive that we could do the uid to 'original name' mapping using those files. Here is how that config looks: https://raw.githubusercontent.com/fontello/maki.font/master/config.yml

bpierre commented 9 years ago

That’s great, thanks!

I just found another really interesting file in the main project repository, which could be downloaded and cached by fontello-svg: https://github.com/fontello/fontello/blob/master/lib/embedded_fonts/client_config.js

It contains all the uidname mappings, and the collection nameGitHub URL mapping as well, which could simplify this part, while making fontello-svg always up to date with the Fontello’s collections: https://github.com/bpierre/fontello-svg/blob/master/index.js#L11-L31

Things to do:

I just need to find some time to implement it, but feel free to work on it if you want to. Thanks again!