GlyphPreview / interpolate / scale

RoboFont Forums Help / General GlyphPreview / interpolate / scale

This topic contains 3 replies, has 2 voices, and was last updated by  luke 6 years, 4 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #5900

    luke
    Member

    Hi,
    is it somehow possible to scale

    RGlyph()

    when using Interpolation and GlyphPreview?
    I tried this without success, maybe it isn’t that easy?

                            newGlyph = RGlyph()
                            newGlyph.interpolate(factor, glyph1, glyph2)
                            if newGlyph.interpolate(factor, glyph1, glyph2) == True: 
                                newGlyph.scale((120,120))
                                self.d.preview.setGlyph(newGlyph)
    
    thanks in advance!
    #5901

    luke
    Member

    and maybe you know also if the interpolation factor can be somehow divided in x and y?

    thanks in advance!

    #5902

    frederik
    Keymaster

    you can interpolate with a different x, y values:

    newGlyph.interpolate((factorX, factorY), glyph1, glyph2)
    

    also see http://robofab.com/howto/interpolate.html

    The glyphPreview thing is actually a simple thing. It scales the glyph according the size of the view.
    why do you want to scale the glyph? is the glyph to big?

    what could help is to set a unitsperem in the parent of the glyph:

    
    dummyFont = RFont(showUI=False)
    
    newGlyph = dummyFont.newGlyph("testInterpolation")
    
    newGlyph.interpolate(factor, masterGlyph1, masterGlyph2)
    
    box = newGlyph.box()
    
    if box:
        minx, miny, maxx, maxy = box
        dummyFont.info.unitsPerEm = maxy - miny # calculate the height of the glyph
    
    preview.setGlyph(newGlyph)
    
    

    good luck!

    #5904

    luke
    Member

    thank you!
    I would like to scale the glyph, because at first I would like to preview a scaled and interpolated glyph.
    In order to output them later.
    maybe

    RFont(showUI=False)

    helps – need to try that.

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

You must be logged in to reply to this topic.