<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xml:base="http://typophile.com" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
 <title>Typophile - RoboFab Kerning - Add Pair ? - Comments</title>
 <link>http://typophile.com/node/46310</link>
 <description>Comments for &quot;RoboFab Kerning - Add Pair ?&quot;</description>
 <language>en</language>
<item>
 <title>andy Thanks for the reply -</title>
 <link>http://typophile.com/node/46310#comment-283425</link>
 <description>&lt;p&gt;andy Thanks for the reply - I just worked out how to do.&lt;/p&gt;
&lt;p&gt;I did it slightly differently from the way you said to make it easier to read.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;&lt;br /&gt;
#Kerning---------------&lt;br /&gt;
#&lt;br /&gt;
from robofab.world import CurrentFont&lt;br /&gt;
f = CurrentFont()&lt;br /&gt;
kerning = f.kerning&lt;br /&gt;
#&lt;br /&gt;
OA = kerning[(&#039;O&#039;,&#039;A&#039;)]&lt;br /&gt;
AO = kerning[(&#039;A&#039;,&#039;O&#039;)]&lt;br /&gt;
OV = kerning[(&#039;O&#039;,&#039;V&#039;)]&lt;br /&gt;
VO = kerning[(&#039;V&#039;,&#039;O&#039;)]&lt;br /&gt;
OW = kerning[(&#039;O&#039;,&#039;W&#039;)]&lt;br /&gt;
WO = kerning[(&#039;W&#039;,&#039;O&#039;)]&lt;br /&gt;
OY = kerning[(&#039;O&#039;,&#039;Y&#039;)]&lt;br /&gt;
YO = kerning[(&#039;Y&#039;,&#039;O&#039;)]&lt;br /&gt;
OX = kerning[(&#039;O&#039;,&#039;X&#039;)]&lt;br /&gt;
XO = kerning[(&#039;X&#039;,&#039;O&#039;)]&lt;br /&gt;
OT = kerning[(&#039;O&#039;,&#039;T&#039;)]&lt;br /&gt;
TO = kerning[(&#039;T&#039;,&#039;O&#039;)]&lt;br /&gt;
KO = kerning[(&#039;K&#039;,&#039;O&#039;)]&lt;br /&gt;
#&lt;br /&gt;
#&lt;br /&gt;
kerning[(&#039;A&#039;,&#039;C&#039;)] = kerning[(&#039;A&#039;,&#039;G&#039;)] = kerning[(&#039;A&#039;,&#039;Q&#039;)] = kerning[(&#039;A&#039;,&#039;OE&#039;)] = AO&lt;br /&gt;
kerning[(&#039;D&#039;,&#039;A&#039;)] = kerning[(&#039;Q&#039;,&#039;A&#039;)] = OA&lt;br /&gt;
#&lt;br /&gt;
kerning[(&#039;V&#039;,&#039;C&#039;)] = kerning[(&#039;V&#039;,&#039;G&#039;)] = kerning[(&#039;V&#039;,&#039;Q&#039;)] = kerning[(&#039;V&#039;,&#039;OE&#039;)] = VO&lt;br /&gt;
kerning[(&#039;D&#039;,&#039;V&#039;)] = kerning[(&#039;Q&#039;,&#039;V&#039;)] = OV&lt;br /&gt;
#&lt;br /&gt;
kerning[(&#039;W&#039;,&#039;C&#039;)] = kerning[(&#039;W&#039;,&#039;G&#039;)] = kerning[(&#039;W&#039;,&#039;Q&#039;)] = kerning[(&#039;W&#039;,&#039;OE&#039;)] = WO&lt;br /&gt;
kerning[(&#039;D&#039;,&#039;W&#039;)] = kerning[(&#039;Q&#039;,&#039;W&#039;)] = OW&lt;br /&gt;
#&lt;br /&gt;
kerning[(&#039;Y&#039;,&#039;C&#039;)] = kerning[(&#039;Y&#039;,&#039;G&#039;)] = kerning[(&#039;Y&#039;,&#039;Q&#039;)] = kerning[(&#039;Y&#039;,&#039;OE&#039;)] = YO&lt;br /&gt;
kerning[(&#039;D&#039;,&#039;Y&#039;)] = kerning[(&#039;Q&#039;,&#039;Y&#039;)] = OY&lt;br /&gt;
#&lt;br /&gt;
kerning[(&#039;X&#039;,&#039;C&#039;)] = kerning[(&#039;X&#039;,&#039;G&#039;)] = kerning[(&#039;X&#039;,&#039;Q&#039;)] = kerning[(&#039;X&#039;,&#039;OE&#039;)] = XO&lt;br /&gt;
kerning[(&#039;D&#039;,&#039;X&#039;)] = kerning[(&#039;Q&#039;,&#039;X&#039;)] = OX&lt;br /&gt;
#&lt;br /&gt;
kerning[(&#039;T&#039;,&#039;C&#039;)] = kerning[(&#039;T&#039;,&#039;G&#039;)] = kerning[(&#039;T&#039;,&#039;Q&#039;)] = kerning[(&#039;T&#039;,&#039;OE&#039;)] = TO&lt;br /&gt;
kerning[(&#039;D&#039;,&#039;T&#039;)] = kerning[(&#039;Q&#039;,&#039;T&#039;)] = OT&lt;br /&gt;
#&lt;br /&gt;
kerning[(&#039;K&#039;,&#039;C&#039;)] = kerning[(&#039;K&#039;,&#039;K&#039;)] = kerning[(&#039;K&#039;,&#039;Q&#039;)] = kerning[(&#039;K&#039;,&#039;OE&#039;)] = KO&lt;br /&gt;
#√ç&lt;br /&gt;
#&lt;br /&gt;
f.update()&lt;br /&gt;
&lt;/code&gt;&lt;/p&gt;
</description>
 <pubDate>Wed, 11 Jun 2008 09:06:17 -0700</pubDate>
 <dc:creator>ReginaldV</dc:creator>
 <guid isPermaLink="false">comment 283425 at http://typophile.com</guid>
</item>
<item>
 <title>Since the kerning object</title>
 <link>http://typophile.com/node/46310#comment-283422</link>
 <description>&lt;p&gt;Since the kerning object works like a standard Python dictionary you don&amp;#8217;t have to use get(), you can call a value out like this:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;AO = kerning[(&#039;A&#039;, &#039;O&#039;)]&lt;br /&gt;
&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;...or even better, combine that with making a new dictionary entry:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;kerning[(&#039;A&#039;, &#039;C&#039;)] = kerning[(&#039;A&#039;, &#039;O&#039;)]&lt;br /&gt;
&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;If an entry already existed for &lt;code&gt;(&#039;A&#039;, &#039;C&#039;)&lt;/code&gt; then it would now be replaced, or if there wasn&amp;#8217;t an entry yet a new one would have been created. Then, check your work to see if it did what you wanted:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;print kerning[(&#039;A&#039;, &#039;C&#039;)]&lt;br /&gt;
print kerning[(&#039;A&#039;, &#039;O&#039;)]&lt;br /&gt;
&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;...the two of those should now be the same. &lt;/p&gt;
&lt;p&gt;Hope that helps,&lt;br /&gt;
Andy&lt;/p&gt;
</description>
 <pubDate>Wed, 11 Jun 2008 08:51:26 -0700</pubDate>
 <dc:creator>andyclymer</dc:creator>
 <guid isPermaLink="false">comment 283422 at http://typophile.com</guid>
</item>
<item>
 <title>k.l.
Thanks for your reply</title>
 <link>http://typophile.com/node/46310#comment-283406</link>
 <description>&lt;p&gt;k.l.&lt;/p&gt;
&lt;p&gt;Thanks for your reply  - Yes I&amp;#8217;ve been to the Robofab site and got all the documentation. I got the code working to create a new pair but I still need to work out how capture a value that already exists.&lt;/p&gt;
&lt;p&gt;In my example here I&amp;#8217;m trying to use the kerning value for &amp;#8217;AO&amp;#8217; and create a new pair for &amp;#8217;AC&amp;#8217; with the same value.&lt;/p&gt;
&lt;p&gt;The Robofab documentation says that get(aPair) is used to get a value for a pair, I don&amp;#8217;t know if my syntax is wrong or this is the wrong way to do it.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;&lt;br /&gt;
#Kerning---------------&lt;br /&gt;
#&lt;br /&gt;
from robofab.world import CurrentFont&lt;br /&gt;
f = CurrentFont()&lt;br /&gt;
kerning = f.kerning&lt;br /&gt;
#&lt;br /&gt;
AO = kerning.get(&#039;A&#039;,&#039;O&#039;)&lt;/p&gt;
&lt;p&gt;kerning[(&#039;A&#039;,&#039;C&#039;)] = AO &lt;/p&gt;
&lt;p&gt;f.update()&lt;br /&gt;
&lt;/code&gt;&lt;/p&gt;
</description>
 <pubDate>Wed, 11 Jun 2008 08:11:07 -0700</pubDate>
 <dc:creator>ReginaldV</dc:creator>
 <guid isPermaLink="false">comment 283406 at http://typophile.com</guid>
</item>
<item>
 <title>Have you checked the RoboFab</title>
 <link>http://typophile.com/node/46310#comment-283359</link>
 <description>&lt;p&gt;Have you checked the RoboFab site? The RoboFab documentation at &lt;a href=&quot;http://www.robofab.com/objects/index.html&quot; title=&quot;http://www.robofab.com/objects/index.html&quot;&gt;http://www.robofab.com/objects/index.html&lt;/a&gt; is pretty good.&lt;br /&gt;
As regards kerning, see especially &lt;a href=&quot;http://www.robofab.com/objects/font.html&quot; title=&quot;http://www.robofab.com/objects/font.html&quot;&gt;http://www.robofab.com/objects/font.html&lt;/a&gt; and &lt;a href=&quot;http://robofab.com/objects/kerning.html&quot; title=&quot;http://robofab.com/objects/kerning.html&quot;&gt;http://robofab.com/objects/kerning.html&lt;/a&gt;&lt;br /&gt;
I haven&amp;#8217;t used it for some time now, but in a RoboFab font object, kerning is a dictionary which you access like this&lt;/p&gt;
&lt;p&gt;&lt;code&gt;# import the font class:&lt;br /&gt;
from robofab import CurrentFont&lt;br /&gt;
# turn the current FLS font into a RoboFab font object:&lt;br /&gt;
f = CurrentFont()&lt;br /&gt;
# get at kerning in the current font:&lt;br /&gt;
kerning = f.kerning&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;and then you should be able to either directly add kerning to this kerning object/dict like&lt;/p&gt;
&lt;p&gt;&lt;code&gt;# note that the key is a tuple:&lt;br /&gt;
kerning[ (&#039;glyphA&#039;,&#039;glyphB&#039;) ] = 10&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;or, alternatively, create a new temporary kerning dictionary which you feed with additional kerning pairs, and finally update the font&amp;#8217;s kerning dictionary with the new one&lt;/p&gt;
&lt;p&gt;&lt;code&gt;newKerning = {}&lt;br /&gt;
newKerning[ (&#039;glyphA&#039;,&#039;glyphB&#039;) ] = 10&lt;br /&gt;
kerning.update(newKerning)&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;and don&amp;#8217;t forget to update the font&lt;/p&gt;
&lt;p&gt;&lt;code&gt;f.update()&lt;/code&gt;&lt;/p&gt;
</description>
 <pubDate>Wed, 11 Jun 2008 04:26:58 -0700</pubDate>
 <dc:creator>k.l.</dc:creator>
 <guid isPermaLink="false">comment 283359 at http://typophile.com</guid>
</item>
<item>
 <title>RoboFab Kerning - Add Pair ?</title>
 <link>http://typophile.com/node/46310</link>
 <description>&lt;p&gt;Is it possible to add a kerning pair using RoboFab ?&lt;/p&gt;
&lt;p&gt;I&amp;#8217;m using class kerning but I quickly wanted to add kerning for pairs like AC, DA, AG, AQ, QA once I have kerned OAO&lt;/p&gt;
&lt;p&gt;I was thinking something like &lt;/p&gt;
&lt;p&gt;&amp;#8217;pseudocode&amp;#8217;&lt;br /&gt;
&lt;code&gt;&lt;/p&gt;
&lt;p&gt;addpair(&#039;A&#039;,&#039;C&#039;) = AO&lt;/p&gt;
&lt;p&gt;&lt;/code&gt;&lt;/p&gt;
</description>
 <comments>http://typophile.com/node/46310#comments</comments>
 <category domain="http://typophile.com/taxonomy/term/6">Build</category>
 <pubDate>Wed, 11 Jun 2008 00:49:36 -0700</pubDate>
 <dc:creator>ReginaldV</dc:creator>
 <guid isPermaLink="false">46310 at http://typophile.com</guid>
</item>
</channel>
</rss>
