Dec-22-2020, 10:05 AM
Hey,
I want to create a .ttf font with python and fontforge which also contains emojis.
my glyphs are .svg files which have a resolution of 512x512 pixels.
I already tried the Following:
import fontforge
blank = fontforge.font()
blank.save("blank.sfd")
font = fontforge.open("blank.sfd")
glyph = font.createMappedChar("\U0000263A")
glyph.importOutlines("263A.svg")
font.generate("font.ttf")
However, I get the following error:
Traceback (most recent call last):
File "/home/adrian/dev/font/glyphs/test.py", line 5, in <module>
glyph = font.createMappedChar("\U0000263A")
ValueError: Glyph name, ☺️, not in current encoding
I looked into the blank.sfd and there is a line: "Encoding: ISO8859-1".
I tried to replace the " ISO8859-1" with "UTF-8" or "Univode" but then I get the following error:
Internal Error: SFD file specifies too few slots for its encoding.
How can I solve that?
I tried to use the emoji glyph for letter "A" for first. then font get created and it works.
However, it is just a black circle and face, eyes, smile, blush,... aren't recognizable because it is black instead of Yellow, orange, white, pink,...
In the blank.sfd file is something written about layers:
Layer: 0 0 "Back" 1
Layer: 1 0 "Fore" 0
I guess that I have to change something with the layers to make the colors to take effect but I am not sure and if that's the case I don't know how and how I can assign the layers with elements in the. svg glyph.
I use the program Inkscape to create the glyps, by the way.
How can I solve these 2 things?
I want to create a .ttf font with python and fontforge which also contains emojis.
my glyphs are .svg files which have a resolution of 512x512 pixels.
I already tried the Following:
import fontforge
blank = fontforge.font()
blank.save("blank.sfd")
font = fontforge.open("blank.sfd")
glyph = font.createMappedChar("\U0000263A")
glyph.importOutlines("263A.svg")
font.generate("font.ttf")
However, I get the following error:
Traceback (most recent call last):
File "/home/adrian/dev/font/glyphs/test.py", line 5, in <module>
glyph = font.createMappedChar("\U0000263A")
ValueError: Glyph name, ☺️, not in current encoding
I looked into the blank.sfd and there is a line: "Encoding: ISO8859-1".
I tried to replace the " ISO8859-1" with "UTF-8" or "Univode" but then I get the following error:
Internal Error: SFD file specifies too few slots for its encoding.
How can I solve that?
I tried to use the emoji glyph for letter "A" for first. then font get created and it works.
However, it is just a black circle and face, eyes, smile, blush,... aren't recognizable because it is black instead of Yellow, orange, white, pink,...
In the blank.sfd file is something written about layers:
Layer: 0 0 "Back" 1
Layer: 1 0 "Fore" 0
I guess that I have to change something with the layers to make the colors to take effect but I am not sure and if that's the case I don't know how and how I can assign the layers with elements in the. svg glyph.
I use the program Inkscape to create the glyps, by the way.
How can I solve these 2 things?