added a script to generate .fontcustom-manifest.json from icons.yml automatically

This commit is contained in:
Lyuwen Fu 2022-02-13 12:12:37 +08:00
parent ac3f4a518f
commit ec94724b1e
4 changed files with 78 additions and 8 deletions

View File

@ -1,7 +1,7 @@
{ {
"checksum": { "checksum": {
"previous": "77be5ba395262597be8705aeb118a44ec323eab3250929fbe080c1082b8423d5", "previous": "0a5cfbcc5436ea854eb765f3a613bd2bfa7e06ec419c31ef81c337987d577e9f",
"current": "77be5ba395262597be8705aeb118a44ec323eab3250929fbe080c1082b8423d5" "current": "0a5cfbcc5436ea854eb765f3a613bd2bfa7e06ec419c31ef81c337987d577e9f"
}, },
"fonts": [ "fonts": [
"forkawesome/forkawesome.ttf", "forkawesome/forkawesome.ttf",
@ -296,11 +296,11 @@
"source": "svg/behance-square.svg" "source": "svg/behance-square.svg"
}, },
"bell": { "bell": {
"codepoint": 61683, "codepoint": 61602,
"source": "svg/bell.svg" "source": "svg/bell.svg"
}, },
"bell-o": { "bell-o": {
"codepoint": 61602, "codepoint": 61683,
"source": "svg/bell-o.svg" "source": "svg/bell-o.svg"
}, },
"bell-ringing": { "bell-ringing": {
@ -308,7 +308,7 @@
"source": "svg/bell-ringing.svg" "source": "svg/bell-ringing.svg"
}, },
"bell-ringing-o": { "bell-ringing-o": {
"codepoint": 62304, "codepoint": 62256,
"source": "svg/bell-ringing-o.svg" "source": "svg/bell-ringing-o.svg"
}, },
"bell-slash": { "bell-slash": {
@ -3019,9 +3019,9 @@
"codepoint": 61758, "codepoint": 61758,
"source": "svg/unlock-alt.svg" "source": "svg/unlock-alt.svg"
}, },
"unslpash": { "unsplash": {
"codepoint": 62245, "codepoint": 62245,
"source": "svg/unslpash.svg" "source": "svg/unsplash.svg"
}, },
"upload": { "upload": {
"codepoint": 61587, "codepoint": 61587,
@ -3294,4 +3294,4 @@
"forkawesome/forkawesome.css", "forkawesome/forkawesome.css",
"forkawesome/forkawesome-preview.html" "forkawesome/forkawesome-preview.html"
] ]
} }

View File

@ -0,0 +1,49 @@
{
"checksum": {
"previous": "",
"current": ""
},
"fonts": [
"forkawesome/forkawesome.ttf",
"forkawesome/forkawesome.svg",
"forkawesome/forkawesome.woff",
"forkawesome/forkawesome.eot",
"forkawesome/forkawesome.woff2"
],
"glyphs": {
},
"options": {
"autowidth": true,
"config": "fontcustom.yml",
"copyright": "The Fork Awesome font is licensed under the SIL OFL 1.1 (http://scripts.sil.org/OFL). Fork Awesome is a fork based of off Font Awesome 4.7.0 by Dave Gandy. More info on licenses at https://forkawesome.github.io",
"css3": false,
"css_selector": ".fa-{{glyph}}",
"debug": false,
"font_ascent": 1536,
"font_descent": 256,
"font_design_size": 16,
"font_em": 1792,
"font_name": "forkawesome",
"force": false,
"input": {
"templates": "svg",
"vectors": "svg"
},
"no_hash": true,
"output": {
"css": "forkawesome",
"fonts": "forkawesome",
"preview": "forkawesome"
},
"preprocessor_path": "",
"quiet": false,
"templates": [
"css",
"preview"
]
},
"templates": [
"forkawesome/forkawesome.css",
"forkawesome/forkawesome-preview.html"
]
}

View File

@ -0,0 +1,21 @@
import json
import yaml
import operator
def main():
manifest = json.load(open("fontcustom-manifest-template.json", "r"))
icons = yaml.safe_load(open("icons.yml", "r"))
for icon in sorted(icons["icons"], key=operator.itemgetter("id")):
manifest["glyphs"][icon["id"]] ={
"codepoint": int(icon["unicode"], base=16),
"source": "svg/{}.svg".format(icon["id"])
}
json.dump(manifest, open(".fontcustom-manifest.json","w"), indent=2)
if __name__ == "__main__":
main()

View File

Before

Width:  |  Height:  |  Size: 240 B

After

Width:  |  Height:  |  Size: 240 B