Authoring SVG format
paigeadelethompson opened this issue · comments
Hey, I was looking at a few options (Inkscape, Fontforge but none of them seem to identify with the way these SVGs are created in images/
How do you produce these?
They are generated by the code here, uses dwtr indirectly.
@be5invis thank you, I'll go ahead and close this since that's all I needed :)
-P
I think I might have misunderstood the answer or I didn't ask the right question, here's what I want to do I want to take a bunch of tiles that I presume Im going to have to edit because I don't know how well they're going to scale and put them into an SVG sheet that resembles that format that you have where theres a unicode address for the row and an address offset for the column:
but if I have to place each one by hand that's going to be a nightmare and I assume the pathes didn't get generated but ideally I don't want to modify any of Iosevka, I just want to add my own glyphs and map them into the unicode PUA range so that way I have the benefit of having the Iosevka monospaced font for standard use and then my own symbols, maybe there's some better way to do this but the thing is I have a ton of these tiles that I have to add let alone whatever edits I need to make to get them to scale properly and I had my heart set on using that format that you use because it would also give me the ability to organize things into much needed categories..
Looks like I might be better off just doing something like this from a script:
create a json file to keep track of the codepoint each svg will be mapped to:
find . -name "*.svg" -type f | python3 -c 'import sys, json; print(json.dumps([{"file": index.strip(), "offset": offset} for index, offset in zip(sys.stdin.readlines(), range(0xe000, 0xf8ff))]))' | jq '' [ { "file": "./misc/ghost_threat_easy.png.inv.pnm.bl_0_point_8.svg", "offset": 57344 }, { "file": "./misc/travel_path_from3.png.inv.pnm.bl_0_point_2.svg", "offset": 57345 },
and then patch maybe patch the font..
python3 -c 'import fontforge, json; font = fontforge.open("Iosevka-Regular.ttf"); [(lambda x, y: x.importOutlines(y))(font.createChar(index.get("offset")), index.get("file")) for index in json.loads(open("map.json").read())]; font.generate("out.ttf")'
I'll have to try this in a sec
@paigeadelethompson you may find useful fonttools, a library for manipulating fonts. It is available on Debian GNU/Linux via apt
. It offers many helpful tools such as :
Font subset
Keep only the unicode ranges you need.
pyftsubset my_font.ttf --unicodes-file=codes.txt --output-file=min_font.min.ttf
Merging fonts
pyftmerge my_font.ttf my_other_font.ttf
Note that the fonts must share the same metrics. If not, there's another tool for you!
Scaling metrics
fonttools ttLib.scaleUpem my_font.ttf 1000
I hope this helps!
@paigeadelethompson So you are planning to add a set of custom pictographs into Iosevka?
If so I'd suggest that you create a separate pictograph font first, then combine Iosevka and it with pyftmerge
.
The SVG images are just SAMPLES. Iosevka font isn't generated from it.
I'll keep all of this in mind as I'll have to come back to it but thank you nevertheless =)