Copy side bearings

H_Afash's picture

Is there any Python script to copy the two side bearings and width from base glyphs to their components?

oldnick's picture

The only Python I'm familiar with is Monty, but you can accomplish the same task, script-free, using the "Paste Special" command.

gargoyle's picture

FontLab's Metrics panel also has a feature to do this— while in Metrics mode, there's a down-arrow underneath the active glyph which reveals a menu with "Copy to composites." If the glyph has composites, a dialog will appear lettering you choose which ones to change. And if you're using metrics classes (or wish to take the time to create them), the Metrics Assistance tool could further automate the process.

For python scripting, you might find some useful ideas in a couple of of Ben Kiel's scripts. Robofab seems to provide more direct access to sidebearings (via the leftMargin and rightMargin attributes of the RGlyph object) than FontLab's native API.

H_Afash's picture

Thanks gargoyle for your comments.
But copy to composites need you to do that manually for each glyph (one after one).
The python script will let you to select all glyphs and then run it to copy to composites automatically. Hope one can write this script.

gargoyle's picture

While "Paste Special" and "Copy to composites" must me done for every individual base glyph, the Metrics Assistance tool does allow for multiple groups to be updated at once (after a bit of tedious box-checking). But you do have to create the metrics classes first.

Some previous discussions about replicating "Copy to composites" with Robofab:
Python/Robofab - Copy to composites
Macro - Copy to Composites

H_Afash's picture

The links aren't help for Arabic glyphs because there are dots and accents nearly above every glyph.

Syndicate content Syndicate content