I am a student who is studying Chinese font.
I use GAN learn on handwritten font.
And generate handwritten Chinese characters based on someone’s handwritings
These have traditional Chinese common 4808 words and total sizes is 137.2MB
Then I use the Glyphs Python Scripting API to write a script to import images into Glyphs.
Also adjust image position and image size.
like the following image.
There was a problem converting the PostScript source font. (Regular)
I have already disable Remove overlap and Autohint
also disable Subroutinization
I don’t know how to solve this problem.
Or Glyphs can’t insert images to make font?
another problem is that Glyphs provide Chinese encode is GB2312 can i change to CJK Unified Ideographs?
You want outlines or bitmaps to show up when you type the letters?
The entries in the sidebar are not the encoding of the font. It is just a list of glyphs you can add to your font. You can add any number of glyphs. See this tutorial (in Chinese): 向字体中添加字符形 | Glyphs
import os
path="/Users/tzu-heng/Library/Application Support/Glyphs/common/"
dirs=os.listdir(path)
dirs.sort()
for fn in dirs:
if fn.endswith('.png'):
#print fn
try:
myGlyph = GSGlyph()
myGlyph.name = "uni"+fn[3:][:-4]
print (myGlyph.name)
print fn[3:][:-4]
myGlyph.unicode = fn[3:][:-4]
Glyphs.font.glyphs.append(myGlyph)
print "Generate" , fn[:-4]
except:
print "There is a glyph with the name "+'"'+fn[3:][:-4]+'"'+" already in the font."
It works!
But I have problems with efficiency.
I added 4808 glyphs.
It will spend a long time
Glyphs application Will also happen “No respond”
How can I improve this problem?
I wouldn’t put the image files in the application support folder. Put it in a folder where you store your font project.
import os
path="~/Documents/font Project/"
dirs=os.listdir(path)
dirs.sort()
glyphs = []
for fn in dirs:
if fn.endswith('.png'):
try:
print "Generate", fn[:-4]
uniHex = fn[3:7]
myGlyph = GSGlyph()
myGlyph.name = "uni"+ uniHex
myGlyph.unicode = uniHex
glyphs.append(myGlyph)
except:
print "There is a glyph with the name "+'"'+ uniHex +'"'+" already in the font."
if len(glyphs) > 0
Glyphs.font.glyphs.extend(glyphs)