<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[GlyphPreview performance]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">I'm trying to make a little extension that takes two open fonts and gives you a live preview of the interpolated result from each font of the current glyph. It's working fine except every time it updates it seems to slow RoboFont down significantly (to the point where the app is so slow it's unusable).</p>
<p dir="auto">Here's what I have so far:</p>
]]></description><link>https://forum.robofont.com/topic/157/glyphpreview-performance</link><generator>RSS for Node</generator><lastBuildDate>Sat, 11 Apr 2026 04:53:18 GMT</lastBuildDate><atom:link href="https://forum.robofont.com/topic/157.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 12 Jul 2012 18:36:22 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to GlyphPreview performance on Tue, 02 Jan 2018 15:52:33 GMT]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">I'm trying to make a little extension that takes two open fonts and gives you a live preview of the interpolated result from each font of the current glyph. It's working fine except every time it updates it seems to slow RoboFont down significantly (to the point where the app is so slow it's unusable).</p>
<p dir="auto">Here's what I have so far:</p>
]]></description><link>https://forum.robofont.com/post/157</link><guid isPermaLink="true">https://forum.robofont.com/post/157</guid><dc:creator><![CDATA[tom]]></dc:creator><pubDate>Tue, 02 Jan 2018 15:52:33 GMT</pubDate></item><item><title><![CDATA[Reply to GlyphPreview performance on Tue, 02 Jan 2018 15:51:35 GMT]]></title><description><![CDATA[<pre><code class="language-python">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) &amp;gt; 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)
</code></pre>
]]></description><link>https://forum.robofont.com/post/785</link><guid isPermaLink="true">https://forum.robofont.com/post/785</guid><dc:creator><![CDATA[tom]]></dc:creator><pubDate>Tue, 02 Jan 2018 15:51:35 GMT</pubDate></item><item><title><![CDATA[Reply to GlyphPreview performance on Tue, 02 Jan 2018 15:52:07 GMT]]></title><description><![CDATA[<p dir="auto">mmm, each time you open this window an observer is been added. If you don't remove the observer when the window closes it will keep getting notifications on current glyph changes and after a while this will idd slow down RoboFont</p>
<pre><code class="language-python">from defconAppKit.windows.baseWindow import BaseWindowController
from mojo.events import addObserver, removeObserver

class InterpTool(BaseWindowController):

    def __init__(self):

        addObserver(self, "_currentGlyphChanged", "currentGlyphChanged")

        # do you stuff
        # ...

        self.setUpBaseWindowBehavior()
        self.w.open()

    def windowCloseCallback(self, sender):
        # remove the observer to stop getting notifications
        removeObserver(self, "currentGlyphChanged")
        super(InterpTool, self).windowCloseCallback(sender)
     
</code></pre>
]]></description><link>https://forum.robofont.com/post/786</link><guid isPermaLink="true">https://forum.robofont.com/post/786</guid><dc:creator><![CDATA[frederik]]></dc:creator><pubDate>Tue, 02 Jan 2018 15:52:07 GMT</pubDate></item><item><title><![CDATA[Reply to GlyphPreview performance on Fri, 13 Jul 2012 21:26:29 GMT]]></title><description><![CDATA[<p dir="auto">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?</p>
<p dir="auto">Cheers!</p>
]]></description><link>https://forum.robofont.com/post/787</link><guid isPermaLink="true">https://forum.robofont.com/post/787</guid><dc:creator><![CDATA[tom]]></dc:creator><pubDate>Fri, 13 Jul 2012 21:26:29 GMT</pubDate></item></channel></rss>