Script to handle anchors in FLS

Igor Freiberger's picture

[Using Windows Vista 64-bit, FontLab Studio 5.0.4]

FLS runs very slowly when I try to edit diacritics with _top and _bottom anchors. This seems to be caused by the huge number of base glyphs included in my font project. These glyphs have the pairing top and bottom anchors and FLS seems to calculate something related to these pairings (but it runs normally when editing other glyphs).

I believe there is a simple way to get around this: a Python script to change anchor names for selected glyphs. Something to, for example, turn _top into _t and later restore it back.

The problem is I do not know to write a single line in Python. Anyone could show how to do this? It also may be a good starting point to learn how to write codes.

eigi's picture

something like this:

for glyph in fl.font.glyphs:
  for anchor in glyph.anchors:
    if anchor.name == '_top':
      anchor.name = '_t'
    elif anchor.name == '_bottom':
      anchor.name = '_b'
fl.UpdateFont(fl.ifont)


Eigi

Igor Freiberger's picture

Andreas, THANK YOU very much. It works perfectly.
You saved me many hours of work.

Syndicate content Syndicate content