208 lines
6.8 KiB
HTML
208 lines
6.8 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>
|
||
|
|
||
|
|
||
|
|
||
|
<div id="modellogo">
|
||
|
<img src="../img/drawmodel_header.jpg" width="595" height="112" />
|
||
|
</div>
|
||
|
<div class="leftcontent">
|
||
|
<h2 class="crb-seealso">
|
||
|
RoboFab
|
||
|
</h2>
|
||
|
<p class="menu">
|
||
|
<a href="../index.html">
|
||
|
Home
|
||
|
</a>
|
||
|
<br />
|
||
|
<a href="../download/license.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="index.html">
|
||
|
Fab Objects
|
||
|
</a>
|
||
|
<br />
|
||
|
<a href="model.html">
|
||
|
Fab Map
|
||
|
</a>
|
||
|
<br />
|
||
|
<a href="../tools/index.html">
|
||
|
Fab Tools
|
||
|
</a>
|
||
|
<br />
|
||
|
<a href="../ufo/index.html">
|
||
|
UFO Overview
|
||
|
</a>
|
||
|
<br />
|
||
|
<a href="../limitations.html">
|
||
|
Fab Limitations
|
||
|
</a>
|
||
|
</p>
|
||
|
<p class="menu">
|
||
|
<a href="../links/index.html">
|
||
|
Links
|
||
|
</a>
|
||
|
<br />
|
||
|
<a href="../glossary/index.html">
|
||
|
Glossary
|
||
|
</a>
|
||
|
<br />
|
||
|
<a href="../credits.html">
|
||
|
Credits
|
||
|
</a>
|
||
|
</p>
|
||
|
<br />
|
||
|
<br />
|
||
|
<p class="crb-uplink"><a href="index.html">Back to Objects</a></p>
|
||
|
|
||
|
<br />
|
||
|
<br />
|
||
|
<p class="menu">
|
||
|
<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="model.html">Object model</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-2005 RoboFab
|
||
|
<br />
|
||
|
version 1.1.1
|
||
|
</div>
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
<div id="titlepic">
|
||
|
<img src="../img/offdrawmodel_11.gif" alt="" border="0" />
|
||
|
</div>
|
||
|
|
||
|
|
||
|
<div class="content">
|
||
|
<h1>RoboFab RKerning</h1>
|
||
|
|
||
|
<h3>Usage</h3>
|
||
|
<pre>f = CurrentFont()
|
||
|
print f.kerning
|
||
|
>>> < RKerning for Mailer-Regular >
|
||
|
|
||
|
# getting a value from the kerning dictionary
|
||
|
print f.kerning[('V', 'A')]
|
||
|
>>> -123
|
||
|
|
||
|
print f.kerning[('T', 'X')]
|
||
|
>>> None
|
||
|
|
||
|
print f.kerning.keys()
|
||
|
>>> [('X', 'emdash'),
|
||
|
('K', 'v'),
|
||
|
('two', 'perthousand'),
|
||
|
('guilsinglleft', 'a'),
|
||
|
... etc.
|
||
|
</pre>
|
||
|
<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:<pre> swapTable = {'BeforeName':'AfterName', }</pre></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>
|