TT Instructions — Programmatically?


I’m new to Glyphs, so this may be a question that has an obvious answer, but is there a code representation of TrueType instructions that can be compiled in the instructioning process, just as it is possible in FontLab? Maybe a plugin?

Thank you,
Alex :slight_smile:

I found a plugin called “TT Control Instructions Palette” that seems to provide a way to control the TT autohinter, but this seems to be entirely separate from the set of manual instructioning tools. Would that be correct?

Glyphs doesn’t have that list/code for instructions. But you still can add instructions from a script.

instr = GSHint()
instr.type = TTSTEM
instr.originNode = Layer.shapes[0].nodes[1]
instr.targetNode = Layer.shapes[1].nodes[1]
instr.options = TTDONTROUND
1 Like

Ah, thank you, Georg! That looks nice. I think I will try to come up with a way of translating our existing code into Glyphs’ instructions. :slight_smile:

I’d just have a little follow up question. Is it possible to refer to a node by its name? In my screenshot above, you can see, for instance, that the node which is anchored to the ascender and serves as a reference point for an interpolation has the name “at01”. Using UFO import, I can bring these node names together with my contours to Glyphs.

But what would be the Python code for referring to the point called “at01”? The code snippet you shared, Georg, is index-based, but it would be awesome if I could directly use the node names for identification purposes. :slight_smile:

Oh, I think I would have to loop through all nodes of my contours, retrieve the names, and compare them to the name I’d like to target:

if == “at01”:
    do something

Would there be a more direct way to do it?

That looks about right.

Thank you, Georg! :slight_smile:

One additional question, if you don’t mind. Is it possible to specify in Python code to which alignment zone (to which stem) an anchor (a single link) should refer? I’m aware that Glyphs will find out the zone or stem mostly automatically, but it would be nonetheless great if there was a way to explicitly add the reference.

hint.stem = zoneIndex
# or
hint.stem = -1 # for no stem
# or
hint.stem = -2 # for auto

Thank you. I’ll have a look tomorrow. :slight_smile: