275 lines
13 KiB
HTML
275 lines
13 KiB
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>RoboFab Objects: RKerning</title>
|
|
<link href="../default.css" type="text/css" rel="stylesheet" />
|
|
</head><body>
|
|
|
|
|
|
|
|
|
|
|
|
<script type="text/javascript" src="http://www.google-analytics.com/urchin.js"></script>
|
|
<script type="text/javascript">
|
|
_uacct = "UA-2044310-2";
|
|
urchinTracker();
|
|
</script>
|
|
|
|
<div id="modellogo">
|
|
<img src="../img/drawmodel_header.jpg" width="595" height="112" />
|
|
</div>
|
|
<div class="leftcontent">
|
|
<h1 class="crb-seealso">
|
|
RoboFab
|
|
</h1>
|
|
<p class="menu">
|
|
<a href="../index.html">
|
|
Home
|
|
</a>
|
|
<br />
|
|
<a href="../download/index.html">
|
|
Download v1.1.1
|
|
</a>
|
|
<br />
|
|
<a href="../intro.html">
|
|
Intro
|
|
</a>
|
|
<br />
|
|
<a href="../install.html">
|
|
Install Notes
|
|
</a>
|
|
<br />
|
|
<a href="../history.html">
|
|
History
|
|
</a>
|
|
<br />
|
|
<a href="../executive.html">
|
|
Summary
|
|
</a>
|
|
</p>
|
|
|
|
<p class="menu">
|
|
<a href="../howto/index.html">
|
|
How to's
|
|
</a>
|
|
<br />
|
|
<a href="../talks/index.html">
|
|
Step by step
|
|
</a>
|
|
<br />
|
|
<a href="../tools/dialogs.html">
|
|
Fab Dialogs
|
|
</a>
|
|
<br />
|
|
<a href="index.html">
|
|
Object reference
|
|
</a>
|
|
<br />
|
|
<a href="model.html">
|
|
Object map
|
|
</a>
|
|
<br />
|
|
<a href="../tools/index.html">
|
|
Tools
|
|
</a>
|
|
<br />
|
|
<a href="../ufo/index.html">
|
|
UFO Overview
|
|
</a>
|
|
<br />
|
|
<a href="../ufo/specification.html">
|
|
UFO Spec
|
|
</a>
|
|
<br />
|
|
<a href="../limitations.html">
|
|
Fab Limitations
|
|
</a>
|
|
|
|
<a href="../links/index.html">
|
|
Links
|
|
</a>
|
|
<br />
|
|
<a href="../credits.html">
|
|
Credits
|
|
</a>
|
|
</p>
|
|
|
|
<h1 class="crb-seealso">
|
|
Support RoboFab
|
|
</h1>
|
|
|
|
|
|
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
|
|
<input type="hidden" name="cmd" value="_s-xclick">
|
|
<input type="image" src="https://www.paypal.com/en_US/i/btn/x-click-but21.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
|
|
<img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
|
|
<input type="hidden" name="encrypted" value="-----BEGIN PKCS7-----MIIHRwYJKoZIhvcNAQcEoIIHODCCBzQCAQExggEwMIIBLAIBADCBlDCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb20CAQAwDQYJKoZIhvcNAQEBBQAEgYCwSKfv3n+m7gMAQttRdiUdaGxSHt2oKSNvYzSFsBPjNsxmwva6gPCPUFV5sfJY1QJQuzQk8iXLqxb/mKmdoWc8Z2Eq7+rUtgo0149vBg35woLGv8zoMkgbghCcHJjdclAl/KOSqhjCOblpCsXpJwy9fs1wuxSOrbDwO5C26bXOkzELMAkGBSsOAwIaBQAwgcQGCSqGSIb3DQEHATAUBggqhkiG9w0DBwQItAyVpzgCAg2AgaA4Sx/oMTU9S7iN3M25nZ1ebqx2vt1UMGcUGtDmk13jLL1IO4lXmG1Lb/lTKJSg1d2Aj/OQJrOpL7T2yEGFkqK0yojO8+CUXHOihCJ+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hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb22CAQAwDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQUFAAOBgQCBXzpWmoBa5e9fo6ujionW1hUhPkOBakTr3YCDjbYfvJEiv/2P+IobhOGJr85+XHhN0v4gUkEDI8r2/rNk1m0GA8HKddvTjyGw/XqXa+LSTlDYkqI8OwR8GEYj4efEtcRpRYBxV8KxAW93YDWzFGvruKnnLbDAF6VR5w/cCMn5hzGCAZowggGWAgEBMIGUMIGOMQswCQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExFjAUBgNVBAcTDU1vdW50YWluIFZpZXcxFDASBgNVBAoTC1BheVBhbCBJbmMuMRMwEQYDVQQLFApsaXZlX2NlcnRzMREwDwYDVQQDFAhsaXZlX2FwaTEcMBoGCSqGSIb3DQEJARYNcmVAcGF5cGFsLmNvbQIBADAJBgUrDgMCGgUAoF0wGAYJKoZIhvcNAQkDMQsGCSqGSIb3DQEHATAcBgkqhkiG9w0BCQUxDxcNMDYwNTA1MDk0MDI3WjAjBgkqhkiG9w0BCQQxFgQUuGyd1NYqa4RVlKQ48vrRVsRjTXYwDQYJKoZIhvcNAQEBBQAEgYC6ZiJbUzbugBCir8QnRYRas0tJrdMXcUXQnO3HlO5Zj7+F9cGT2NI73VgB5Vhpu+OaMjBcmc8f0LSP6/ns48YZiIki3+nilxKt/sEq3R0B9XeoB21nHxLmlWkFGMGKxPexWEkjJq0v3UNhS6mYDAIdLkrLE6RHRYAVvKET8hkzDw==-----END PKCS7-----
|
|
">
|
|
</form>
|
|
|
|
|
|
|
|
<h2 class="crb-seealso">
|
|
Up
|
|
</h2>
|
|
|
|
<p class="menu">
|
|
<p class="bonbon_uplink"><a href="index.html">Back to Objects</a></p>
|
|
</p>
|
|
|
|
<h2 class="crb-seealso">
|
|
See also
|
|
</h2>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<p class="menu">
|
|
<a href="../talks/robofab_session1.html">Font object, Info object</a><br /><a href="../talks/robofab_session2.html">Glyph object and Pen object</a><br /><a href="../talks/robofab_session3.html">Kerning object and glyph building</a><br /><a href="anchor.html">RAnchor</a><br /><a href="bpoint.html">bPoint</a><br /><a href="component.html">RComponent</a><br /><a href="contour.html">RContour</a><br /><a href="font.html">RFont</a><br /><a href="glyph.html">RGlyph</a><br /><a href="index.html">Objects</a><br /><a href="info.html">RInfo</a><br /><a href="lib.html">RLib</a><br /><a href="pen.html">Pen objects</a><br /><a href="point.html">RPoint</a><br /><a href="segment.html">RSegment</a><br />
|
|
</p>
|
|
</div>
|
|
|
|
<div class="footer">
|
|
<a href="../feedback.html">
|
|
Feedback
|
|
</a>
|
|
<br />
|
|
<a href="../map.html">
|
|
Sitemap
|
|
</a>
|
|
<br />
|
|
Please also refer to the
|
|
<a href="../download/license.html">
|
|
Legal
|
|
</a>
|
|
<br />
|
|
Copyright 2003-2006 RoboFab
|
|
<br />
|
|
version 1.1.1
|
|
</div>
|
|
|
|
<div class="google">
|
|
|
|
|
|
<h2>RoboFab Mailinglist</h2>
|
|
<p>
|
|
Join the RoboFab users community at Google groups.
|
|
</p>
|
|
|
|
|
|
<img src="http://groups.google.com/groups/img/3nb/groups_bar.gif" alt="Google Groups" height="26" width="132" />
|
|
|
|
<p>
|
|
<form action="http://groups.google.com/group/robofab/boxsubscribe">
|
|
Email: <input type="text" name="../email" />
|
|
<input type="submit" name="../sub" value="Subscribe" />
|
|
</form>
|
|
</p>
|
|
<p>
|
|
<a href="http://groups.google.com/group/robofab">Visit this group</a>
|
|
</p>
|
|
|
|
|
|
<h2>RoboFab Sponsors</h2>
|
|
|
|
<script type="text/javascript">
|
|
|
|
|
|
google_ad_client = "pub-3703953449723704";
|
|
google_ad_width = 120;
|
|
google_ad_height = 600;
|
|
google_ad_format = "120x600_as";
|
|
google_ad_type = "text_image";
|
|
google_ad_channel ="";
|
|
google_color_border = "336699";
|
|
google_color_bg = "FFFFFF";
|
|
google_color_link = "0000FF";
|
|
google_color_url = "008000";
|
|
google_color_text = "000000";
|
|
|
|
|
|
|
|
|
|
</script>
|
|
|
|
|
|
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div id="titlepic">
|
|
<img src="../img/offdrawmodel_11.gif" alt="" border="0" />
|
|
</div>
|
|
|
|
|
|
<div class="content">
|
|
<h1>RoboFab RKerning</h1>
|
|
|
|
<h3>Usage</h3>
|
|
|
|
<div class="pythonsource"><pre># robofab manual<br># Kerning object<br># usage examples<br> <br><span class="py_key">f</span> = <span class="py_key">CurrentFont</span>()<br><span class="py_res">print</span> <span class="py_key">f</span>.<span class="py_key">kerning</span><br> <br># getting a value from the kerning dictionary<br><span class="py_res">print</span> <span class="py_key">f</span>.<span class="py_key">kerning</span>[(<span class="py_str">'V'</span>, <span class="py_str">'A'</span>)]<br><span class="py_res">print</span> <span class="py_key">f</span>.<span class="py_key">kerning</span>[(<span class="py_str">'T'</span>, <span class="py_str">'X'</span>)]<br><span class="py_res">print</span> <span class="py_key">f</span>.<span class="py_key">kerning</span>.<span class="py_key">keys</span>()<br> <br></pre></div><div class="pythonsourcetitle"><a href="examples/usageKerning.py" target="new">download examples/usageKerning.py</a></div>
|
|
|
|
<div class="pythonoutput"><pre>< <span class="py_key">RKerning</span> <span class="py_res">for</span> <span class="py_key">Mailer</span>-<span class="py_key">Regular</span> ><br> -<span class="py_num">123</span><br> <span class="py_key">None</span><br> [(<span class="py_str">'X'</span>, <span class="py_str">'emdash'</span>), <br> (<span class="py_str">'K'</span>, <span class="py_str">'v'</span>),<br> (<span class="py_str">'two'</span>, <span class="py_str">'perthousand'</span>),<br> (<span class="py_str">'guilsinglleft'</span>, <span class="py_str">'a'</span>),<br> ... <span class="py_key">etc</span>.]</pre></div>
|
|
|
|
|
|
<h3>Description</h3>
|
|
<p>
|
|
RKerning is a dictionary of kerning values. RFont makes a RKerning object when it is created and makes available as aFont.kerning attribute. The keys are tuples of the glyphs listed by their names: ('T', 'e'), ('V', 'A') etc. <strong>None</strong> is returned if the pair does not exist, rather than raising an IndexError. The parent of a kerning object is usually a Font.
|
|
</p>
|
|
<h3>Methods</h3>
|
|
<p>
|
|
</p>
|
|
<ul>
|
|
<li><strong>add(value)</strong>: add value to all kerning pairs.</li>
|
|
<li><strong>asDict()</strong>: return the object as a plain dictionary.</li>
|
|
<li><strong>clear()</strong>: clear all the kerning (why would you want to do that?)</li>
|
|
<li><strong>combine(kerningDicts, overwriteExisting=True)</strong>: combine two or more kerning dictionaries. Overwrite exsisting duplicate pairs if overwriteExisting=True</li>
|
|
<li><strong>eliminate(leftGlyphsToEliminate=None, rightGlyphsToEliminate=None, analyzeOnly=False)</strong>: eliminate pairs containing a left glyph that is in the leftGlyphsToEliminate list
|
|
or a right glyph that is in the rightGlyphsToELiminate list.
|
|
sideGlyphsToEliminate can be a string: 'a' or list: ['a', 'b'].
|
|
analyzeOnly will not remove pairs. it will return a count
|
|
of all pairs that would be removed.</li>
|
|
<li><strong>explodeClasses(leftClassDict=None, rightClassDict=None, analyzeOnly=False)</strong>: turn class kerns into real kerning pairs. classes should
|
|
be defined in dicts: {'O':['C', 'G', 'Q'], 'H':['B', 'D', 'E', 'F', 'I']}.
|
|
analyzeOnly will not remove pairs. it will return a count of all pairs that would be added</li>
|
|
<li><strong>get(aPair)</strong>: get a value. return None if the pair does not exist.</li>
|
|
<li><strong>getAverage()</strong>: return average of all kerning pairs </li>
|
|
<li><strong>getExtremes()</strong>: return the lowest and highest kerning values.</li>
|
|
<li><strong>getLeft(glyphName)</strong>: Return a list of kerns with glyphName as left character. </li>
|
|
<li><strong>getRight(glyphName)</strong>: Return a list of kerns with glyphName as right character. </li>
|
|
<li><strong>has_key(pair)</strong>: returns True if it has the pair.</li>
|
|
<li><strong>implodeClasses(leftClassDict=None, rightClassDict=None, analyzeOnly=False)</strong>: condense the number of kerning pairs by applying classes. This will eliminate all pairs containg the classed glyphs leaving
|
|
pairs that contain the key glyphs behind. analyzeOnly will not
|
|
remove pairs. it will return a count of all pairs that would be removed.</li>
|
|
<li><strong>importAFM(path, clearExisting=True)</strong>: Import kerning pairs from an AFM file. clearExisting=True will clear all exising kerning</li>
|
|
<li><strong>
|
|
interpolate(sourceDictOne, sourceDictTwo, value, clearExisting=True)</strong>: interpolate the kerning between sourceDictOne and sourceDictTwo. clearExisting will clear existing
|
|
kerning first.</li>
|
|
<li><strong>items()</strong>: return a list of (pair, value) tuples.</li>
|
|
<li><strong>keys()</strong>: returns a lust of available pairs.</li>
|
|
<li><strong>minimize(minimum=10)</strong>: eliminate pairs with value less than minimum</li>
|
|
<li><strong>
|
|
occurrenceCount(glyphsToCount)</strong>: return a dict with glyphs as keys and the number of occurances of that glyph in the kerning pairs as the value
|
|
glyphsToCount can be a string: 'a' or list: ['a', 'b']</li>
|
|
<li><strong>
|
|
remove(pair)</strong>: remove a kerning pair</li>
|
|
<li><strong>round(multiple=10)</strong>: round the kerning pair values to increments of multiple</li>
|
|
<li><strong>scale(value)</strong>: scale all kernng pairs by value</li>
|
|
<li><strong>swapNames(swapTable)</strong>: change glyph names in all kerning pairs based on swapTable:
|
|
<div class="pythonoutput"><pre><span class="py_key">swapTable</span> = {<span class="py_str">'BeforeName'</span>:<span class="py_str">'AfterName'</span>, }</pre></div>
|
|
</li>
|
|
<li><strong>update(kerningDict)</strong>: replace kerning data with the data in the given kerningDict.</li>
|
|
<li><strong>values()</strong>: return a list of kerning values</li>
|
|
</ul>
|
|
|
|
</div>
|
|
</body></html> |