<?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[Find out what part of a glyph is selected]]></title><description><![CDATA[<p dir="auto">Hi, can someone suggest a better way of finding out what part of a glyph is selected, besides iterating through its parts?</p>
<p dir="auto">Right now, to find selected segments, I'm doing something like:</p>
<pre><code>selectedSegments = []

for contour in glyph.contours:
   for segment in contour:
      if segment.selected:
         selectedSegments.append(segment)
</code></pre>
<p dir="auto">I've seen that the <code>BaseEventTool</code> object can return a <code>selection</code> object, but I haven't figured out a way to test if the object is a segment or not</p>
<p dir="auto">On a similar note, I'm not sure if some of the attributes/methods on <a href="http://robofont.com/documentation/building-tools/api/fontParts/rglyph/#RGlyph.selectedPoints" rel="nofollow">this page</a> just need to be updated, but <code>RGlyph.selectedPoints</code> gives me an <code>AttributeError: 'RGlyph' object has no attribute 'selectedPoints'</code>.</p>
<p dir="auto">Thanks!</p>
]]></description><link>https://forum.robofont.com/topic/529/find-out-what-part-of-a-glyph-is-selected</link><generator>RSS for Node</generator><lastBuildDate>Wed, 22 Apr 2026 12:14:11 GMT</lastBuildDate><atom:link href="https://forum.robofont.com/topic/529.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 02 Nov 2018 16:26:56 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Find out what part of a glyph is selected on Sat, 03 Nov 2018 09:58:55 GMT]]></title><description><![CDATA[<p dir="auto">Hi, can someone suggest a better way of finding out what part of a glyph is selected, besides iterating through its parts?</p>
<p dir="auto">Right now, to find selected segments, I'm doing something like:</p>
<pre><code>selectedSegments = []

for contour in glyph.contours:
   for segment in contour:
      if segment.selected:
         selectedSegments.append(segment)
</code></pre>
<p dir="auto">I've seen that the <code>BaseEventTool</code> object can return a <code>selection</code> object, but I haven't figured out a way to test if the object is a segment or not</p>
<p dir="auto">On a similar note, I'm not sure if some of the attributes/methods on <a href="http://robofont.com/documentation/building-tools/api/fontParts/rglyph/#RGlyph.selectedPoints" rel="nofollow">this page</a> just need to be updated, but <code>RGlyph.selectedPoints</code> gives me an <code>AttributeError: 'RGlyph' object has no attribute 'selectedPoints'</code>.</p>
<p dir="auto">Thanks!</p>
]]></description><link>https://forum.robofont.com/post/1805</link><guid isPermaLink="true">https://forum.robofont.com/post/1805</guid><dc:creator><![CDATA[jesentanadi]]></dc:creator><pubDate>Sat, 03 Nov 2018 09:58:55 GMT</pubDate></item><item><title><![CDATA[Reply to Find out what part of a glyph is selected on Fri, 02 Nov 2018 18:53:45 GMT]]></title><description><![CDATA[<p dir="auto">to find the selection points:</p>
<pre><code class="language-python">glyph = CurrentGlyph()

print(glyph.selectedPoints)
# on older RF
# print(glyph.selection) # this is deprecated in favour of selectionPoints
</code></pre>
<p dir="auto">If you need a segment selection you will need to loop through all the contours and all the segments.</p>
<pre><code class="language-python">glyph = CurrentGlyph()

for contour in glyph:
    for segment in contour:
        print(segment.selected)
</code></pre>
<p dir="auto">hope this helps</p>
]]></description><link>https://forum.robofont.com/post/1806</link><guid isPermaLink="true">https://forum.robofont.com/post/1806</guid><dc:creator><![CDATA[frederik]]></dc:creator><pubDate>Fri, 02 Nov 2018 18:53:45 GMT</pubDate></item><item><title><![CDATA[Reply to Find out what part of a glyph is selected on Sat, 03 Nov 2018 09:37:24 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://forum.robofont.com/uid/1">@frederik</a> hi, thanks for confirming.</p>
<p dir="auto">I'm still getting an <code>AttributeError: 'RGlyph' object has no attribute 'selectedPoints'​</code> when I use <code>glyph.selectedPoints</code>:</p>
<p dir="auto"><img src="/assets/uploads/files/1541186330158-screen-shot-2018-11-02-at-3.17.45-pm-resized.png" alt="0_1541186326170_Screen Shot 2018-11-02 at 3.17.45 PM.png" class="img-responsive img-markdown" /></p>
]]></description><link>https://forum.robofont.com/post/1808</link><guid isPermaLink="true">https://forum.robofont.com/post/1808</guid><dc:creator><![CDATA[jesentanadi]]></dc:creator><pubDate>Sat, 03 Nov 2018 09:37:24 GMT</pubDate></item><item><title><![CDATA[Reply to Find out what part of a glyph is selected on Sat, 03 Nov 2018 08:34:15 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://forum.robofont.com/uid/202">@jesentanadi</a> the <a href="http://robofont.com/documentation/building-tools/toolkit/robofab-fontparts/#object-selection-api" rel="nofollow">FontParts object selection API</a> was introduced in RF 3.2 (currently in beta). I think you are running RF 3.1?</p>
]]></description><link>https://forum.robofont.com/post/1809</link><guid isPermaLink="true">https://forum.robofont.com/post/1809</guid><dc:creator><![CDATA[gferreira]]></dc:creator><pubDate>Sat, 03 Nov 2018 08:34:15 GMT</pubDate></item><item><title><![CDATA[Reply to Find out what part of a glyph is selected on Sat, 03 Nov 2018 09:58:24 GMT]]></title><description><![CDATA[<p dir="auto">maybe worth adding: <a href="http://docs.python.org/3/tutorial/datastructures.html#list-comprehensions" rel="nofollow">list comprehensions</a> are handy for creating this kind of lists:</p>
<pre><code class="language-python">g = CurrentGlyph()

selectedSegments = [s for c in g for s in c if s.selected]
selectedPoints   = [p for c in g for p in c.points if p.selected]

print(selectedSegments)
print(selectedPoints)
</code></pre>
]]></description><link>https://forum.robofont.com/post/1810</link><guid isPermaLink="true">https://forum.robofont.com/post/1810</guid><dc:creator><![CDATA[gferreira]]></dc:creator><pubDate>Sat, 03 Nov 2018 09:58:24 GMT</pubDate></item><item><title><![CDATA[Reply to Find out what part of a glyph is selected on Sat, 03 Nov 2018 14:51:56 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://forum.robofont.com/uid/22">@gferreira</a> ah, good to know that the selection API isn't fully implemented in 3.1. And yes—thanks for reminding me of comprehensions!</p>
]]></description><link>https://forum.robofont.com/post/1811</link><guid isPermaLink="true">https://forum.robofont.com/post/1811</guid><dc:creator><![CDATA[jesentanadi]]></dc:creator><pubDate>Sat, 03 Nov 2018 14:51:56 GMT</pubDate></item><item><title><![CDATA[Reply to Find out what part of a glyph is selected on Sun, 04 Nov 2018 20:24:26 GMT]]></title><description><![CDATA[<p dir="auto">fontParts was fully implemented when 3.1 was released, only this api was added afterwards. This is present in the beta and in the upcoming release.</p>
]]></description><link>https://forum.robofont.com/post/1812</link><guid isPermaLink="true">https://forum.robofont.com/post/1812</guid><dc:creator><![CDATA[frederik]]></dc:creator><pubDate>Sun, 04 Nov 2018 20:24:26 GMT</pubDate></item><item><title><![CDATA[Reply to Find out what part of a glyph is selected on Mon, 05 Nov 2018 12:45:58 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://forum.robofont.com/uid/1">@frederik</a> sorry, didn't realize it's new to FontParts too. I'll give 3.2b a try.</p>
]]></description><link>https://forum.robofont.com/post/1813</link><guid isPermaLink="true">https://forum.robofont.com/post/1813</guid><dc:creator><![CDATA[jesentanadi]]></dc:creator><pubDate>Mon, 05 Nov 2018 12:45:58 GMT</pubDate></item></channel></rss>