<?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[Getting the glyph and its font]]></title><description><![CDATA[<p dir="auto">Hi,<br />
In a class derived from BaseEventTool, I use</p>
<pre><code class="language-python">g = self.getGlyph()
f = g.getParent()
</code></pre>
<p dir="auto">in order to obtain the font containing the glyph g.<br />
However, when I have two opened fonts F1 and F2 and two GlyphWindows opened (one from each font : g1 from F1 and g2 from F2), and when I go from one glyph window to the other, the following code :</p>
<pre><code class="language-python">print g.name, g.getParent.fileName
</code></pre>
<p dir="auto">gives me : g1 F2   or g2 F1<br />
and after some more clicking, I finally get correct values (g1 F1 or g2 F2)</p>
<p dir="auto">There seem to be only partially updated information when switching windows.<br />
Regards,<br />
Samuel</p>
]]></description><link>https://forum.robofont.com/topic/376/getting-the-glyph-and-its-font</link><generator>RSS for Node</generator><lastBuildDate>Sat, 11 Apr 2026 04:33:00 GMT</lastBuildDate><atom:link href="https://forum.robofont.com/topic/376.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 26 Apr 2015 16:37:42 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Getting the glyph and its font on Mon, 01 Jan 2018 14:13:10 GMT]]></title><description><![CDATA[<p dir="auto">Hi,<br />
In a class derived from BaseEventTool, I use</p>
<pre><code class="language-python">g = self.getGlyph()
f = g.getParent()
</code></pre>
<p dir="auto">in order to obtain the font containing the glyph g.<br />
However, when I have two opened fonts F1 and F2 and two GlyphWindows opened (one from each font : g1 from F1 and g2 from F2), and when I go from one glyph window to the other, the following code :</p>
<pre><code class="language-python">print g.name, g.getParent.fileName
</code></pre>
<p dir="auto">gives me : g1 F2   or g2 F1<br />
and after some more clicking, I finally get correct values (g1 F1 or g2 F2)</p>
<p dir="auto">There seem to be only partially updated information when switching windows.<br />
Regards,<br />
Samuel</p>
]]></description><link>https://forum.robofont.com/post/375</link><guid isPermaLink="true">https://forum.robofont.com/post/375</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Mon, 01 Jan 2018 14:13:10 GMT</pubDate></item><item><title><![CDATA[Reply to Getting the glyph and its font on Mon, 27 Apr 2015 11:25:46 GMT]]></title><description><![CDATA[<p dir="auto">hi</p>
<p dir="auto">could you make an small example?</p>
<p dir="auto">I cannot reproduce this issue, with a quick test...</p>
<p dir="auto">thanks</p>
<p dir="auto">&lt;pre&gt;<br />
from mojo.events import BaseEventTool, installTool</p>
<p dir="auto">class TestTool(BaseEventTool):</p>
<pre><code>def currentGlyphChanged(self):
    g = self.getGlyph()
    f = g.getParent()
    print g.name, f
</code></pre>
<p dir="auto">installTool(TestTool())<br />
&lt;/pre&gt;</p>
]]></description><link>https://forum.robofont.com/post/1355</link><guid isPermaLink="true">https://forum.robofont.com/post/1355</guid><dc:creator><![CDATA[frederik]]></dc:creator><pubDate>Mon, 27 Apr 2015 11:25:46 GMT</pubDate></item><item><title><![CDATA[Reply to Getting the glyph and its font on Mon, 27 Apr 2015 16:56:23 GMT]]></title><description><![CDATA[<p dir="auto">[ With Version 1.6 (built 1410152315) ]<br />
Using your example TestTool :</p>
<ul>
<li>Open two fonts F1 and F2</li>
<li>Open glyph g1 from font F1<br />
(now there are three windows opened, plus the output window)</li>
<li>Bring the window for the font F2 to the front</li>
<li>click on the glyphs grid, on a glyph g2 (with a name different from g1)<br />
Now you should observe "g1 &lt;F2&gt;" in the output window</li>
</ul>
<p dir="auto">[Another weirdness: the callbacks "viewDidChangeGlyph" and "currentGlyphChanged" are called before "becomeActive"]<br />
Best regards,<br />
Samuel</p>
]]></description><link>https://forum.robofont.com/post/1356</link><guid isPermaLink="true">https://forum.robofont.com/post/1356</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Mon, 27 Apr 2015 16:56:23 GMT</pubDate></item><item><title><![CDATA[Reply to Getting the glyph and its font on Mon, 04 May 2015 06:13:37 GMT]]></title><description><![CDATA[<p dir="auto">Hi</p>
<p dir="auto">the mixed parents will be fixed in the next update, thanks for reporting</p>
<p dir="auto">one thing: a &lt;code&gt;tool.getGlyph()&lt;/code&gt; method will always return a glyph from a glyph view, if you select a font window, it will send you a &lt;code&gt;currentGlyphChanged&lt;/code&gt; notification, but the glyph will not actually change when using the &lt;code&gt;tool.getGlyph()&lt;/code&gt;. To get the global current glyph use &lt;code&gt;CurrentGlyph()&lt;/code&gt;</p>
<p dir="auto">the other weirdness: see <a href="https://github.com/typemytype/RoboFontExamples/blob/master/observers/eventObserver.py" rel="nofollow">https://github.com/typemytype/RoboFontExamples/blob/master/observers/eventObserver.py</a></p>
<p dir="auto">a tool can become active separately from a &lt;code&gt;currentGlyphChanged&lt;/code&gt; or &lt;code&gt;viewDidChangeGlyph&lt;/code&gt;</p>
]]></description><link>https://forum.robofont.com/post/1361</link><guid isPermaLink="true">https://forum.robofont.com/post/1361</guid><dc:creator><![CDATA[frederik]]></dc:creator><pubDate>Mon, 04 May 2015 06:13:37 GMT</pubDate></item><item><title><![CDATA[Reply to Getting the glyph and its font on Tue, 05 May 2015 09:33:12 GMT]]></title><description><![CDATA[<p dir="auto">Thank you for fixing this.!<br />
I'll use your eventObserver example to get a better understanding of when each event is triggered.<br />
Regards,<br />
Samuel</p>
]]></description><link>https://forum.robofont.com/post/1364</link><guid isPermaLink="true">https://forum.robofont.com/post/1364</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Tue, 05 May 2015 09:33:12 GMT</pubDate></item></channel></rss>