<?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[Can I apply a &quot;smart sort&quot; for Glyph Order via script?]]></title><description><![CDATA[<p dir="auto">I appreciate the "Smart Sort" feature of robofont ... is it possible to trigger this from a script? For instance, when I insert a new glyph via script, I would likely to immediate smart-sort the UFO, rather than having to do it manually.</p>
<p dir="auto"><img src="/assets/uploads/files/1526045123987-098bcbb1-6c03-4032-a5fd-bcc5c8fa44e2-image-resized.png" alt="0_1526045122779_098bcbb1-6c03-4032-a5fd-bcc5c8fa44e2-image.png" class="img-responsive img-markdown" /></p>
<p dir="auto">Short of accessing the actual smart sort feature from script, is the only alternative using something like the following?</p>
<pre><code>font.glyphOrder = ["a", "agrave", "b", "c"]  # etc
</code></pre>
<p dir="auto">..and if so, is there a good default order I could import, so a user doesn't have to manage their list manually?</p>
<p dir="auto">Thanks for any pointers!</p>
]]></description><link>https://forum.robofont.com/topic/474/can-i-apply-a-smart-sort-for-glyph-order-via-script</link><generator>RSS for Node</generator><lastBuildDate>Thu, 23 Apr 2026 02:50:49 GMT</lastBuildDate><atom:link href="https://forum.robofont.com/topic/474.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 11 May 2018 13:28:32 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Can I apply a &quot;smart sort&quot; for Glyph Order via script? on Thu, 01 Aug 2019 00:07:36 GMT]]></title><description><![CDATA[<p dir="auto">I appreciate the "Smart Sort" feature of robofont ... is it possible to trigger this from a script? For instance, when I insert a new glyph via script, I would likely to immediate smart-sort the UFO, rather than having to do it manually.</p>
<p dir="auto"><img src="/assets/uploads/files/1526045123987-098bcbb1-6c03-4032-a5fd-bcc5c8fa44e2-image-resized.png" alt="0_1526045122779_098bcbb1-6c03-4032-a5fd-bcc5c8fa44e2-image.png" class="img-responsive img-markdown" /></p>
<p dir="auto">Short of accessing the actual smart sort feature from script, is the only alternative using something like the following?</p>
<pre><code>font.glyphOrder = ["a", "agrave", "b", "c"]  # etc
</code></pre>
<p dir="auto">..and if so, is there a good default order I could import, so a user doesn't have to manage their list manually?</p>
<p dir="auto">Thanks for any pointers!</p>
]]></description><link>https://forum.robofont.com/post/1592</link><guid isPermaLink="true">https://forum.robofont.com/post/1592</guid><dc:creator><![CDATA[StephenNixon]]></dc:creator><pubDate>Thu, 01 Aug 2019 00:07:36 GMT</pubDate></item><item><title><![CDATA[Reply to Can I apply a &quot;smart sort&quot; for Glyph Order via script? on Thu, 01 Aug 2019 00:08:18 GMT]]></title><description><![CDATA[<p dir="auto">hello <a class="plugin-mentions-user plugin-mentions-a" href="https://forum.robofont.com/uid/230">@StephenNixon</a>,</p>
<p dir="auto">I don’t know exactly how <em>Smart Sort</em> works internally. but the options under the <em>Custom</em> sorting mode are available from defcon’s <a href="http://ts-defcon.readthedocs.io/en/latest/objects/unicodedata.html#defcon.UnicodeData.sortGlyphNames" rel="nofollow">UnicodeData</a> object, which you can access with <code>font.naked()</code>. here’s an example:</p>
<pre><code class="language-python">font = CurrentFont()
newGlyphOrder = font.naked().unicodeData.sortGlyphNames(font.glyphOrder, sortDescriptors=[dict(type="unicode", ascending=True, allowPseudoUnicode=True)])
font.glyphOrder = newGlyphOrder
</code></pre>
<p dir="auto">have a look at the different sorting options in the <code>UnicodeData.sortGlyphNames</code> documentation linked above, see if you can get the results you are looking for.</p>
<p dir="auto">hope this helps. maybe <a class="plugin-mentions-user plugin-mentions-a" href="https://forum.robofont.com/uid/1">@frederik</a> has a better answer…</p>
]]></description><link>https://forum.robofont.com/post/1593</link><guid isPermaLink="true">https://forum.robofont.com/post/1593</guid><dc:creator><![CDATA[gferreira]]></dc:creator><pubDate>Thu, 01 Aug 2019 00:08:18 GMT</pubDate></item><item><title><![CDATA[Reply to Can I apply a &quot;smart sort&quot; for Glyph Order via script? on Thu, 01 Aug 2019 00:08:56 GMT]]></title><description><![CDATA[<p dir="auto">Thanks, <a class="plugin-mentions-user plugin-mentions-a" href="https://forum.robofont.com/uid/22">@gferreira</a>!</p>
<p dir="auto">That was a super helpful suggestion, including the link to the defcon docs.</p>
<p dir="auto">I find that for me, the <code>cannedDesign</code> sort type is seemingly identical to the "Smart Sort" option in Robofont, aside from deleting template glyphs.</p>
<p dir="auto">Still, those are easy enough to re-add manually, and something I don't need to do every time (Add Glyphs -&gt; Import from my "Latin 1" character set... -&gt; then select to "add as template glyphs").</p>
<p dir="auto">So, the script I'll use is very close to your suggestion, but I prefer this sort type:</p>
<pre><code class="language-python">font = CurrentFont()
newGlyphOrder = font.naked().unicodeData.sortGlyphNames(font.glyphOrder, sortDescriptors=[dict(type="cannedDesign", ascending=True, allowPseudoUnicode=True)])
font.glyphOrder = newGlyphOrder
</code></pre>
]]></description><link>https://forum.robofont.com/post/1594</link><guid isPermaLink="true">https://forum.robofont.com/post/1594</guid><dc:creator><![CDATA[StephenNixon]]></dc:creator><pubDate>Thu, 01 Aug 2019 00:08:56 GMT</pubDate></item></channel></rss>