There's no such thing as cheating in type design: automated python anchors in Fontlab

As much as it would be great to meticulously arrange every little thing by hand, sometimes you just have to automate. Here's a FontLab script that I use a lot for adding anchors to the tops/bottoms of common letters. As soon as all the anchors are automatically inserted, you might want to move them around a little, depending on the font. Then simply select the diacritics you want to create, chose "Glyph > Create Glyphs" from the menu, and voila, instant diacritics.

Add Anchors

tString = "caron acute dieresis circumflex tilde ring grave hungarumlaut dotaccent breve macron hungarumlaut"
diacriticList = tString.split(" ")

tString = "a e dotlessi o u y n s z l t r c w g j"
lcList = tString.split(" ")

tString = "A E I O U Y N S Z L T R C W G J"
ucList = tString.split(" ")

def findCenter(g,topBottom):
	if g != None:
		r = g.GetBoundingRect()
		center = Point()
		center.x = r.width/2 + r.x
		if topBottom == "top":
			center.y = r.y + r.height
		else:
			center.y = r.y
		return center
	
def addAnchors(anchorName,glyphList,yOffset):
	for i in glyphList:
		g = fl.font[fl.font.FindGlyph(i)]
		center = findCenter(g,anchorName)
		g.anchors.clean()
		a = Anchor(anchorName,center.x,center.y+yOffset)
		g.anchors.append(a)
		
addAnchors("top",ucList,40)
addAnchors("top",lcList,60)
addAnchors("_top",diacriticList)
fl.UpdateFont()

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options

Image CAPTCHA
Copy the characters (respecting upper/lower case) from the image.