tom

Forum Replies Created

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • in reply to: GlyphPreview performance #4275

    tom
    Participant

    This seems to fix my problem, thanks so much! One more thing, what would be the name of the observer for if a glyph is modified?—so that I can update the preview as you make changes. Is there a list somewhere of all the built in observers?

    Cheers!

    in reply to: GlyphPreview performance #4270

    tom
    Participant
    from vanilla import *
    from mojo.glyphPreview import GlyphPreview
    from mojo.events import addObserver
    from mojo.roboFont import OpenWindow
    
    class InterpTool:
    
        def __init__(self):
            self.w = Window((440, 400), "Interpolator Tool", minSize=(100, 100))
            self.w.preview = GlyphPreview((0, 30, -0, -0))
            
            self.w.t = TextBox((10,50,100,20))
    
            self.factor = 2.0
    
            addObserver(self, "_currentGlyphChanged", "currentGlyphChanged")
            
            
            self.w.slider = Slider((10,10,-10,23), 
                                   tickMarkCount=4,
                                   callback=self.setFactor,
                                   minValue=-1,
                                   maxValue=2,
                                   value=self.factor,
                                   continuous=False)
    
            
            self.fs = AllFonts()
            
            self.setGlyph()
            self.w.open()
    
        def _currentGlyphChanged(self, glyph, info):
            self.setGlyph()
    
        def setGlyph(self):
            if not CurrentGlyph():
                return
                
            glyphname = CurrentGlyph().name
            
            if len(self.fs) > 0:
                if self.fs[0][glyphname].isCompatible(self.fs[1][glyphname])[0]:
                    newGlyph = RGlyph()
                    newGlyph.interpolate(self.factor, self.fs[0][glyphname], self.fs[1][glyphname])
                    self.w.t.set("Compatible")
                    self.w.preview.setGlyph(newGlyph)
                else:
                    self.w.t.set("Incompatible")
                    self.w.preview.setGlyph(CurrentGlyph())
    
        def setFactor(self, sender):
            self.factor = sender.get()
            print self.factor
            self.setGlyph()
            
    OpenWindow(InterpTool)
    
    in reply to: Tilde + Arrow shortcut nudges selection #4265

    tom
    Participant

    Thanks!

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