<?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[Font Collection Custom Tool]]></title><description><![CDATA[<p dir="auto">Is there a safe way of adding tools to the font collection window, or is that not a good idea?</p>
<p dir="auto">For example, if I wanted to add a button (say, next to Edit With…) that displayed the current font's notes in a new window, would that be possible?</p>
]]></description><link>https://forum.robofont.com/topic/238/font-collection-custom-tool</link><generator>RSS for Node</generator><lastBuildDate>Fri, 05 Jun 2026 22:16:29 GMT</lastBuildDate><atom:link href="https://forum.robofont.com/topic/238.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 07 Mar 2013 17:29:40 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Font Collection Custom Tool on Wed, 03 Jan 2018 11:45:50 GMT]]></title><description><![CDATA[<p dir="auto">Is there a safe way of adding tools to the font collection window, or is that not a good idea?</p>
<p dir="auto">For example, if I wanted to add a button (say, next to Edit With…) that displayed the current font's notes in a new window, would that be possible?</p>
]]></description><link>https://forum.robofont.com/post/238</link><guid isPermaLink="true">https://forum.robofont.com/post/238</guid><dc:creator><![CDATA[jack_jennings]]></dc:creator><pubDate>Wed, 03 Jan 2018 11:45:50 GMT</pubDate></item><item><title><![CDATA[Reply to Font Collection Custom Tool on Wed, 03 Jan 2018 11:39:27 GMT]]></title><description><![CDATA[<p dir="auto">he,</p>
<p dir="auto">that is easy</p>
<pre><code class="language-python">from mojo.UI import CurrentFontWindow
from AppKit import NSImageNameAdvanced

class AddToolBarButton(object):
    
    def __init__(self):
        # maybe subscribe to the "fontDidOpen" event
        
        # get the current window
        window = CurrentFontWindow()
        if window is None:
            return
        # get the current toolbar items
        toolbarItems = window.getToolbarItems()
        
        # make a new one, see the vanilla docs for more info
        newItem = dict(itemIdentifier="myNewButton",
                label="Button",
                imageNamed=NSImageNameAdvanced,
                callback=self.myCallback)
        # add the new item to the existing toolbars
        toolbarItems.append(newItem)
        # get the vanilla window object
        vanillaWindow = window.window()
        # set the new toolbaritems in the window
        window.toolbar = vanillaWindow.addToolbar(toolbarIdentifier="myCustomToolbar", toolbarItems=toolbarItems, addStandardItems=False)
        # done
    
    def myCallback(self, sender):
        print "hit, do something!"
        
AddToolBarButton()
</code></pre>
<p dir="auto">good luck!</p>
]]></description><link>https://forum.robofont.com/post/994</link><guid isPermaLink="true">https://forum.robofont.com/post/994</guid><dc:creator><![CDATA[frederik]]></dc:creator><pubDate>Wed, 03 Jan 2018 11:39:27 GMT</pubDate></item><item><title><![CDATA[Reply to Font Collection Custom Tool on Fri, 08 Mar 2013 13:12:29 GMT]]></title><description><![CDATA[<p dir="auto">Haha, it's easy if you say so, frederik.</p>
<p dir="auto">Is there a list of the observable events that RoboFont supports? I assume that I can just read through the source of defcon to find its events...</p>
]]></description><link>https://forum.robofont.com/post/995</link><guid isPermaLink="true">https://forum.robofont.com/post/995</guid><dc:creator><![CDATA[jack_jennings]]></dc:creator><pubDate>Fri, 08 Mar 2013 13:12:29 GMT</pubDate></item><item><title><![CDATA[Reply to Font Collection Custom Tool on Fri, 08 Mar 2013 14:05:59 GMT]]></title><description><![CDATA[<p dir="auto">There are several kinds of notification systems in RoboFont. There is one on font data, the defcon notifications. Another one is on app level, specific build for tools and extension to use and the last one is on cocoa level, UI only.</p>
<p dir="auto">see:<br />
<a href="http://doc.robofont.com/api/custom-observers/" rel="nofollow">http://doc.robofont.com/api/custom-observers/</a><br />
<a href="http://doc.robofont.com/api/custom-tools/" rel="nofollow">http://doc.robofont.com/api/custom-tools/</a></p>
]]></description><link>https://forum.robofont.com/post/996</link><guid isPermaLink="true">https://forum.robofont.com/post/996</guid><dc:creator><![CDATA[frederik]]></dc:creator><pubDate>Fri, 08 Mar 2013 14:05:59 GMT</pubDate></item><item><title><![CDATA[Reply to Font Collection Custom Tool on Wed, 03 Jan 2018 11:43:05 GMT]]></title><description><![CDATA[<p dir="auto">Not to let all of your tricks out of the bag, but is there a shortcut available to set the icons as PDFs like you're doing in other parts of the application?</p>
<p dir="auto">My ObjC abilities are poor, and I'm not sure if this is a job for <code>NSPDFImageRef</code> or…?</p>
]]></description><link>https://forum.robofont.com/post/997</link><guid isPermaLink="true">https://forum.robofont.com/post/997</guid><dc:creator><![CDATA[jack_jennings]]></dc:creator><pubDate>Wed, 03 Jan 2018 11:43:05 GMT</pubDate></item><item><title><![CDATA[Reply to Font Collection Custom Tool on Wed, 03 Jan 2018 11:42:46 GMT]]></title><description><![CDATA[<p dir="auto">Well, I've gotten past that hurdle by reading the the <code>NSImage</code> docs, now I just need to figure out how the "view" option works for the vanilla <code>addToolbar</code> method (as I'm trying to match the style of the Glyph view buttons. I snooped around and found that the toolbar in the Glyph view is using a view called <code>ToolbarGlyphTools</code>, and I think that I'm importing that module from <code>lib.UI.toolbarGlyphTools</code>. Not sure how to get this hooked up because this doesn't seem to work. Maybe I'm barking up the wrong tree…</p>
<pre><code class="language-python">from lib.UI.toolbarGlyphTools import ToolbarGlyphTools

newItem = dict(itemIdentifier="myNewButton",
        label="Button",
        imageObject=NSImage.alloc().initByReferencingFile_(imagePath),
        callback=self.myCallback,
        view = ToolbarGlyphTools.alloc().init()
    )
</code></pre>
<p dir="auto">not sure how to do code tags either…</p>
]]></description><link>https://forum.robofont.com/post/998</link><guid isPermaLink="true">https://forum.robofont.com/post/998</guid><dc:creator><![CDATA[jack_jennings]]></dc:creator><pubDate>Wed, 03 Jan 2018 11:42:46 GMT</pubDate></item><item><title><![CDATA[Reply to Font Collection Custom Tool on Wed, 03 Jan 2018 11:45:01 GMT]]></title><description><![CDATA[<p dir="auto">Hi</p>
<p dir="auto">The <code>ToolbarGlyphTools</code> is an UI object that looks like a button that you can add in a toolbar dict item.</p>
<p dir="auto">usage:</p>
<pre><code class="language-python">from AppKit import NSImage

from lib.UI.toolbarGlyphTools import ToolbarGlyphTools

## create your image, best is that the image is only black and white
## so the image can be inverted when clicked
myToolBarImage = NSImage.alloc().initByReferencingFile_(imagePath)

## a ToolbarGlyphTools is similar like the vanilla.SegmentedButton but has an extra toolbar item attributes
## if you want to add more items to the segmented button the item attributes just contains more dicts 
## the size of the segmented button is atomically multiplied by the number of items.
toolbarView = ToolbarGlyphTools((30, 25), 
        [dict(image=myToolBarImage, toolTip="My ToolTip"], 
        trackingMode="one")

newItem = dict(itemIdentifier="myNewButton",
        label="Button",
        callback=self.myCallback,
        view=ToolbarGlyphTools.alloc().init())
</code></pre>
<p dir="auto">good luck</p>
<p dir="auto">use <code>&lt;pre&gt;</code>your code<code>&lt;/pre&gt;</code> to get the syntax highlighting in a post</p>
]]></description><link>https://forum.robofont.com/post/999</link><guid isPermaLink="true">https://forum.robofont.com/post/999</guid><dc:creator><![CDATA[frederik]]></dc:creator><pubDate>Wed, 03 Jan 2018 11:45:01 GMT</pubDate></item><item><title><![CDATA[Reply to Font Collection Custom Tool on Wed, 03 Jan 2018 11:45:33 GMT]]></title><description><![CDATA[<p dir="auto">He</p>
<p dir="auto">I've written a proper vanilla patch which is already in the vanilla repo. This will be in the next update of RoboFont.</p>
<p dir="auto">It adds <code>addToolBarItem</code> and <code>removeToolbarItem</code> to a vanilla window object, able to manage toolbar items properly.</p>
<p dir="auto">see <a href="https://github.com/typesupply/vanilla/blob/master/Lib/vanilla/vanillaWindows.py#L631" rel="nofollow">https://github.com/typesupply/vanilla/blob/master/Lib/vanilla/vanillaWindows.py#L631</a></p>
]]></description><link>https://forum.robofont.com/post/1194</link><guid isPermaLink="true">https://forum.robofont.com/post/1194</guid><dc:creator><![CDATA[frederik]]></dc:creator><pubDate>Wed, 03 Jan 2018 11:45:33 GMT</pubDate></item></channel></rss>