88 lines
4.6 KiB
XML
Executable File
88 lines
4.6 KiB
XML
Executable File
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
<xml>
|
|
<include src="settings/generic.xml"/>
|
|
<synopsis
|
|
name="RKerning"
|
|
description="part of a Font, contains all kerning data"
|
|
keywords="objects, metrics, kerning"/>
|
|
<title>RoboFab Objects: RKerning</title>
|
|
|
|
|
|
<div id="titlepic">
|
|
<img src="img/offdrawmodel_11.gif" alt="" border="0"/>
|
|
</div>
|
|
|
|
|
|
<div class="content">
|
|
<h1>RoboFab RKerning</h1>
|
|
|
|
<h3>Usage</h3>
|
|
|
|
<pythonsource src="examples/usageKerning.py"/>
|
|
|
|
<python type="output"><![CDATA[
|
|
< RKerning for Mailer-Regular >
|
|
-123
|
|
None
|
|
[('X', 'emdash'),
|
|
('K', 'v'),
|
|
('two', 'perthousand'),
|
|
('guilsinglleft', 'a'),
|
|
... etc.]
|
|
]]></python>
|
|
|
|
|
|
<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:
|
|
<python type="output"><![CDATA[
|
|
swapTable = {'BeforeName':'AfterName', }
|
|
]]></python>
|
|
</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>
|
|
</xml> |