Python Forum
fontforge Emoji encoding and colored glyphs
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
fontforge Emoji encoding and colored glyphs
#1
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?
buran write Dec-22-2020, 11:03 AM:
Please, use proper tags when post code, traceback, output, etc.
See BBcode help for more info.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How do I classify colored images into 3 classes max22 0 655 Dec-04-2023, 10:33 PM
Last Post: max22
  Emoji Dictionary Help rewainy 5 2,353 May-08-2022, 04:56 AM
Last Post: rewainy
Question Colored text Alivegamer 3 2,044 Feb-28-2022, 02:43 AM
Last Post: BashBedlam
  Error printing colored text julio2000 0 1,463 Feb-02-2020, 07:04 PM
Last Post: julio2000
  Because the emoji appears black and white at the exit ? nerd 3 5,527 Jan-28-2019, 11:34 PM
Last Post: nerd
  I can not install the emoji module nerd 1 4,250 Jan-27-2019, 05:53 AM
Last Post: nerd
  colored input() Trianne 6 18,422 Oct-15-2018, 07:50 PM
Last Post: wavic

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020