Can FontLab Scripts Manipulate Metrics/Kerning Classes?

amv's picture

I'm actually a little afraid to ask this question because there's so much riding on it, but I've been planning [read: counting] on using scripts to automate the process of creating classes for metrics and kerning.

Part of the reason is that I find the process painfully gruntwork-ish and would like to automate it for all future font projects, and second, because I've had bad experiences with FontLab thus far and on more than one occasion, have seen my metrics classes magically vanish without explanation and would like the ability to rebuild all classes the next time this happens.

Unfortunately, between the Unofficial FontLab Python API and the admittedly shallow official documentation, I can't find any real mention of metrics or kerning classes.

So, dare I ask? Is there any way to create/modify classes from a Python script in FontLab, or is the workflow I'm building doomed?

eigi's picture


This may help:

Font Attribute:


list of glyph classes in Classes panel

Font Methods:

SetClassFlags(int class_index, bool left, bool right)

allows to set 'left' and 'right' properties of the kerning class

SetClassFlags(int class_index, bool lsb, bool rsb, bool width)

allows to set 'lsb', 'rsb' and 'width' properties of the metrics class

GetClassLeft(int class_index)

returns the 'left' property of the class

GetClassRight(int class_index)

returns the 'right' property of the class

GetClassMetricsFlags(int class_index)

returns the tuple containing LSB, RSB and Width flags of the metrics class


amv's picture

Oh thank god, this looks like something I can work with. Where did this come from? Do you have a larger reference of which this is part?

Thanks so much!

eigi's picture


print Font().__doc__


Syndicate content Syndicate content