component transformation

RoboFont Forums Help / General component transformation

This topic contains 1 reply, has 2 voices, and was last updated by  frederik 6 years, 1 month ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #5967

    luke
    Member

    hi,
    anyone knows if it is possible to mirror components?

    rotation worked:

    component.rotate(180, 100)

    but couldn’t find mirror or flip etc:
    component.mirror()

    thanks in advance!

    #5968

    frederik
    Keymaster

    he

    mirror is a combination of translate, scale, translate:)

    simple example:

    g = CurrentGlyph()
    
    g.prepareUndo()
    
    bounds = g.box
    
    for c in g.components:
        if bounds:
            minx, miny, maxx, maxy = bounds
            w = maxx - minx
            h = maxy - miny
            c.scaleTransformation((1, -1), center=(minx, miny))
            c.translate((0, h))
    
    
    g.performUndo()
    

    good luck!

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.