Author Topic: Change composite margins in MM Layers scripting  (Read 1412 times)

Joancarles Casasin

  • Beta: FontLab Studio Mac
  • Full Member
  • ***
  • Posts: 3
    • Casasin website
    • Email
Change composite margins in MM Layers scripting
« on: 2013-07-31, 10:23:45 »
Hi you all,
I'd like to shift composite glyphs in MM layers, with specific values for each layer. Set the marging in glyphs with components with are in a FontLab MM.
I've been trying and couldn't get it working.
glyph.Shift doesn't work with composites, I couldn't find a way with components.deltas either.
Can't do it (I think) using robofab as I can't access to MM layers from there, can I?
(probably I'm doing something wrong, FontLab API is a bit cryptic to me, I guess it can't be that hard set sidebearings : )
Thanks!
  -- jca

Adam Twardoch (FontLab)

  • Product and marketing manager, Fontlab Ltd.
  • Administrator
  • Hero Member
  • *****
  • Posts: 574
  • FontLab Studio 5.1.2, Mac OS X 10.6.8
    • FontLab
Re: Change composite margins in MM Layers scripting
« Reply #1 on: 2013-08-01, 15:44:03 »
I'm attaching a MM-aware macro "Copy composite positions SL", which copies composite positions from one font (and master) to another font (and master), using glyph names to match the glyphs.

In short, here's how you'd set component positions in an MM font:

component = fl.glyph.components[componentindex]
component.deltas[masterindex].x = DesiredXPos
component.deltas[masterindex].y = DesiredYPos

Best,
Adam
Regards,
Adam Twardoch
Fontlab Ltd.

Joancarles Casasin

  • Beta: FontLab Studio Mac
  • Full Member
  • ***
  • Posts: 3
    • Casasin website
    • Email
Re: Change composite margins in MM Layers scripting
« Reply #2 on: 2013-08-05, 03:50:14 »
Thanks Adam, it worked.
best,
-- jca