jaywcjlove / svgtofont

Read a set of SVG icons and ouput a TTF/EOT/WOFF/WOFF2/SVG font.
https://jaywcjlove.github.io/svgtofont
MIT License
555 stars 86 forks source link

Generating JSON like ICOMOON #244

Open rahaaatul opened 1 month ago

rahaaatul commented 1 month ago

Is it possible to generate JSON like icomoon does: icomoon-tabler.json?

I've tried to import .ttf & .json generated by svgtofont (here's the json) in KLWP but it's crashing the app, but it does not crash if it's generated by icomoon.

Here's my workflow file where I'm using svgtofont at line 127.

I'd really appreciate any help. Thank you.

jaywcjlove commented 1 month ago
image

@rahaaatul Did you set your directory incorrectly?

rahaaatul commented 1 month ago

@rahaaatul Did you set your directory incorrectly?

Not actually. Those folders are from upstream. Temp is where I'm renaming and fixing the icons with svg-fixer. See line 98.

rahaaatul commented 1 month ago

@jaywcjlove Is it possible to have this template:

{
  "icons": [
    {
      "icon": {
        "paths": [
          "M0 0h32v32H0z"  // Placeholder path for the blank glyph
        ],
        "attrs": [{}],
        "isMulticolor": false,
        "isMulticolor2": false,
        "grid": 0,
        "tags": ["blank"]  // Tag for the blank icon
      },
      "attrs": [{}],
      "properties": {
        "order": 1,
        "id": 0,           // Unique identifier for the blank glyph
        "name": "blank",   // Name for the blank glyph
        "prevSize": 32,
        "code": 0          // No Unicode, but index is 0
      },
      "setIdx": 0,
      "setId": 0,
      "iconIdx": 0
    },
    {
      "icon": {
        "paths": [
          "M512 256l3.456 0.128..." // SVG path for the second glyph
        ],
        "attrs": [{ "fill": "rgb(198, 192, 184)" }],
        "isMulticolor": false,
        "isMulticolor2": false,
        "grid": 0,
        "tags": ["icon-tag"] // Tag for the second glyph
      },
      "attrs": [{ "fill": "rgb(198, 192, 184)" }],
      "properties": {
        "order": 2,
        "id": 5466,                // Unique identifier for the second glyph
        "name": "icon-name",   // Name for the second glyph
        "prevSize": 32,
        "code": 60161               // EA01 in decimal is 60161
      },
      "setIdx": 0,
      "setId": 0,
      "iconIdx": 1                // Index for the second glyph
    }
  ]
}

instead of:


{
    "glyph": ["M512 256l3.456 0.128..."]
}