Skip to main content

Posts

Showing posts from August, 2020

First Trying of Python Scripting on FontLab 7 (6)

I just updated my FontLab from 5 to 7. In the last weekend (Aug. 1. 2020), I'd tried to move my old python codes for FontLab 5 to FontLab 7 (6). Although, there is the online documentation, as usual, I needed to guess and try to work out the code for correct result. Here I listed my first attempt to add empty glyph to a font. First Two Lines: import fontlab as fl7 import fontgate as fgt We need two modules, "fontlab" to work with the application FontLab, and "fontgate" to handle the opened font(s) and the glyphs of the font(s) in FontLab. To Count the Opened Font(s) openedFontCounts = fl7.CountFonts() # it's type of "integer". To Get the Font From the Opened Fonts allFonts = fl7.AllFonts() # type of "fgPackages" font1 = allFonts[0] # if there is at least a font opened. it's of the type "fgFont". font2 = allFonts[1] # if there are at least two fonts opened. it's of the type "fgFont". ... We may also get t...