271 lines
20 KiB
HTML
271 lines
20 KiB
HTML
|
|
||
|
<!doctype html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||
|
<html><head><title>Python: module robofab.features.position</title>
|
||
|
</head><body bgcolor="#f0f0f8">
|
||
|
|
||
|
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">
|
||
|
<tr bgcolor="#7799ee">
|
||
|
<td valign=bottom> <br>
|
||
|
<font color="#ffffff" face="helvetica, arial"> <br><big><big><strong><a href="robofab.html"><font color="#ffffff">robofab</font></a>.<a href="robofab.features.html"><font color="#ffffff">features</font></a>.position</strong></big></big></font></td
|
||
|
><td align=right valign=bottom
|
||
|
><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:/code/projects/robofab/Lib/robofab/features/position.py">/code/projects/robofab/Lib/robofab/features/position.py</a></font></td></tr></table>
|
||
|
<p><tt>Set of objects (well, one for now) that process positioning values.<br>
|
||
|
<br>
|
||
|
Things that need to be supported:<br>
|
||
|
- contextual positioning lookup (for UC spacing, etc.)</tt></p>
|
||
|
<p>
|
||
|
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
|
||
|
<tr bgcolor="#ee77aa">
|
||
|
<td colspan=3 valign=bottom> <br>
|
||
|
<font color="#ffffff" face="helvetica, arial"><big><strong>Classes</strong></big></font></td></tr>
|
||
|
|
||
|
<tr><td bgcolor="#ee77aa"><tt> </tt></td><td> </td>
|
||
|
<td width="100%"><dl>
|
||
|
<dt><font face="helvetica, arial"><a href="robofab.features.featureTools.html#SortedDict">robofab.features.featureTools.SortedDict</a>(<a href="__builtin__.html#object">__builtin__.object</a>)
|
||
|
</font></dt><dd>
|
||
|
<dl>
|
||
|
<dt><font face="helvetica, arial"><a href="robofab.features.position.html#Position">Position</a>
|
||
|
</font></dt></dl>
|
||
|
</dd>
|
||
|
<dt><font face="helvetica, arial"><a href="__builtin__.html#dict">__builtin__.dict</a>(<a href="__builtin__.html#object">__builtin__.object</a>)
|
||
|
</font></dt><dd>
|
||
|
<dl>
|
||
|
<dt><font face="helvetica, arial"><a href="robofab.features.position.html#SingleOffset">SingleOffset</a>
|
||
|
</font></dt></dl>
|
||
|
</dd>
|
||
|
<dt><font face="helvetica, arial"><a href="__builtin__.html#object">__builtin__.object</a>
|
||
|
</font></dt><dd>
|
||
|
<dl>
|
||
|
<dt><font face="helvetica, arial"><a href="robofab.features.position.html#PairOffset">PairOffset</a>
|
||
|
</font></dt></dl>
|
||
|
</dd>
|
||
|
</dl>
|
||
|
<p>
|
||
|
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
|
||
|
<tr bgcolor="#ffc8d8">
|
||
|
<td colspan=3 valign=bottom> <br>
|
||
|
<font color="#000000" face="helvetica, arial"><a name="PairOffset">class <strong>PairOffset</strong></a>(<a href="__builtin__.html#object">__builtin__.object</a>)</font></td></tr>
|
||
|
|
||
|
<tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td>
|
||
|
<td colspan=2><tt>Return data based on a given pair.<br>
|
||
|
<br>
|
||
|
This requires a dictionary with pairs as keys<br>
|
||
|
and the data to be returned as values.<br>
|
||
|
<br>
|
||
|
{<br>
|
||
|
('A', 'A') : 100,<br>
|
||
|
('X', 'Y') : -50,<br>
|
||
|
}<br>
|
||
|
<br>
|
||
|
To enable group based lookups, supply a group <a href="__builtin__.html#dict">dict</a>:<br>
|
||
|
<br>
|
||
|
{<br>
|
||
|
# group name # glyph list<br>
|
||
|
'@A Group' : ['A', 'Aacute'],<br>
|
||
|
'@E Group' : ['E', 'Eacute'],<br>
|
||
|
}<br>
|
||
|
<br>
|
||
|
This grouping data will be flattened durning __init__ <br>
|
||
|
based on the group contents.<br>
|
||
|
<br>
|
||
|
{<br>
|
||
|
# glyph name # all groups that contain the glyph<br>
|
||
|
'A' : ['@A Group'],<br>
|
||
|
'Aacute' : ['@A Group'],<br>
|
||
|
'E' : ['@E Group'],<br>
|
||
|
'Eacute' : ['@E Group'],<br>
|
||
|
}<br>
|
||
|
<br>
|
||
|
If speed is a primary concern, a flattened <a href="__builtin__.html#dict">dict</a> can be passed<br>
|
||
|
to __init__ instead of the regular group <a href="__builtin__.html#dict">dict</a>.<br> </tt></td></tr>
|
||
|
<tr><td> </td>
|
||
|
<td width="100%">Methods defined here:<br>
|
||
|
<dl><dt><a name="PairOffset-__getitem__"><strong>__getitem__</strong></a>(self, pair)</dt></dl>
|
||
|
|
||
|
<dl><dt><a name="PairOffset-__init__"><strong>__init__</strong></a>(self, pairDict, groupDict<font color="#909090">=0</font>, flatGroupDict<font color="#909090">=0</font>)</dt></dl>
|
||
|
|
||
|
<dl><dt><a name="PairOffset-processGlyphList"><strong>processGlyphList</strong></a>(self, glyphList)</dt></dl>
|
||
|
|
||
|
<hr>
|
||
|
Data and other attributes defined here:<br>
|
||
|
<dl><dt><strong>__dict__</strong> = <dictproxy object at 0x10bb590><dd><tt>dictionary for instance variables (if defined)</tt></dl>
|
||
|
|
||
|
<dl><dt><strong>__weakref__</strong> = <attribute '__weakref__' of 'PairOffset' objects><dd><tt>list of weak references to the <a href="__builtin__.html#object">object</a> (if defined)</tt></dl>
|
||
|
|
||
|
</td></tr></table> <p>
|
||
|
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
|
||
|
<tr bgcolor="#ffc8d8">
|
||
|
<td colspan=3 valign=bottom> <br>
|
||
|
<font color="#000000" face="helvetica, arial"><a name="Position">class <strong>Position</strong></a>(<a href="robofab.features.featureTools.html#SortedDict">robofab.features.featureTools.SortedDict</a>)</font></td></tr>
|
||
|
|
||
|
<tr><td bgcolor="#ffc8d8"><tt> </tt></td><td> </td>
|
||
|
<td width="100%"><dl><dt>Method resolution order:</dt>
|
||
|
<dd><a href="robofab.features.position.html#Position">Position</a></dd>
|
||
|
<dd><a href="robofab.features.featureTools.html#SortedDict">robofab.features.featureTools.SortedDict</a></dd>
|
||
|
<dd><a href="__builtin__.html#object">__builtin__.object</a></dd>
|
||
|
</dl>
|
||
|
<hr>
|
||
|
Methods defined here:<br>
|
||
|
<dl><dt><a name="Position-processGlyphList"><strong>processGlyphList</strong></a>(self, glyphList)</dt></dl>
|
||
|
|
||
|
<dl><dt><a name="Position-registerFeature"><strong>registerFeature</strong></a>(self, name, typeOfFeature, positioning, positionsX<font color="#909090">=False</font>, positionsY<font color="#909090">=False</font>)</dt></dl>
|
||
|
|
||
|
<hr>
|
||
|
Methods inherited from <a href="robofab.features.featureTools.html#SortedDict">robofab.features.featureTools.SortedDict</a>:<br>
|
||
|
<dl><dt><a name="Position-__getitem__"><strong>__getitem__</strong></a>(self, key)</dt></dl>
|
||
|
|
||
|
<dl><dt><a name="Position-__init__"><strong>__init__</strong></a>(self)</dt></dl>
|
||
|
|
||
|
<dl><dt><a name="Position-__len__"><strong>__len__</strong></a>(self)</dt></dl>
|
||
|
|
||
|
<dl><dt><a name="Position-__setitem__"><strong>__setitem__</strong></a>(self, key, value)</dt></dl>
|
||
|
|
||
|
<dl><dt><a name="Position-clear"><strong>clear</strong></a>(self)</dt></dl>
|
||
|
|
||
|
<dl><dt><a name="Position-copy"><strong>copy</strong></a>(self)</dt></dl>
|
||
|
|
||
|
<dl><dt><a name="Position-get"><strong>get</strong></a>(self, key, default<font color="#909090">=None</font>)</dt></dl>
|
||
|
|
||
|
<dl><dt><a name="Position-has_key"><strong>has_key</strong></a>(self, key)</dt></dl>
|
||
|
|
||
|
<dl><dt><a name="Position-items"><strong>items</strong></a>(self)</dt></dl>
|
||
|
|
||
|
<dl><dt><a name="Position-keys"><strong>keys</strong></a>(self)</dt></dl>
|
||
|
|
||
|
<dl><dt><a name="Position-update"><strong>update</strong></a>(self, other)</dt></dl>
|
||
|
|
||
|
<dl><dt><a name="Position-values"><strong>values</strong></a>(self)</dt></dl>
|
||
|
|
||
|
<hr>
|
||
|
Data and other attributes inherited from <a href="robofab.features.featureTools.html#SortedDict">robofab.features.featureTools.SortedDict</a>:<br>
|
||
|
<dl><dt><strong>__dict__</strong> = <dictproxy object at 0x10bb3f0><dd><tt>dictionary for instance variables (if defined)</tt></dl>
|
||
|
|
||
|
<dl><dt><strong>__weakref__</strong> = <attribute '__weakref__' of 'SortedDict' objects><dd><tt>list of weak references to the <a href="__builtin__.html#object">object</a> (if defined)</tt></dl>
|
||
|
|
||
|
</td></tr></table> <p>
|
||
|
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
|
||
|
<tr bgcolor="#ffc8d8">
|
||
|
<td colspan=3 valign=bottom> <br>
|
||
|
<font color="#000000" face="helvetica, arial"><a name="SingleOffset">class <strong>SingleOffset</strong></a>(<a href="__builtin__.html#dict">__builtin__.dict</a>)</font></td></tr>
|
||
|
|
||
|
<tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td>
|
||
|
<td colspan=2><tt>Return data based on a given glyph.<br>
|
||
|
<br>
|
||
|
This requires a dictionary with glyph names as the keys<br>
|
||
|
and offset values as the values.<br>
|
||
|
<br>
|
||
|
{<br>
|
||
|
'A' : 50,<br>
|
||
|
'B' : 100,<br>
|
||
|
}<br>
|
||
|
<br>
|
||
|
Perhaps it should support groups...<br> </tt></td></tr>
|
||
|
<tr><td> </td>
|
||
|
<td width="100%"><dl><dt>Method resolution order:</dt>
|
||
|
<dd><a href="robofab.features.position.html#SingleOffset">SingleOffset</a></dd>
|
||
|
<dd><a href="__builtin__.html#dict">__builtin__.dict</a></dd>
|
||
|
<dd><a href="__builtin__.html#object">__builtin__.object</a></dd>
|
||
|
</dl>
|
||
|
<hr>
|
||
|
Methods defined here:<br>
|
||
|
<dl><dt><a name="SingleOffset-__init__"><strong>__init__</strong></a>(self, glyphDict)</dt></dl>
|
||
|
|
||
|
<dl><dt><a name="SingleOffset-processGlyphList"><strong>processGlyphList</strong></a>(self, glyphList)</dt></dl>
|
||
|
|
||
|
<hr>
|
||
|
Data and other attributes defined here:<br>
|
||
|
<dl><dt><strong>__dict__</strong> = <dictproxy object at 0x10bb370><dd><tt>dictionary for instance variables (if defined)</tt></dl>
|
||
|
|
||
|
<dl><dt><strong>__weakref__</strong> = <attribute '__weakref__' of 'SingleOffset' objects><dd><tt>list of weak references to the <a href="__builtin__.html#object">object</a> (if defined)</tt></dl>
|
||
|
|
||
|
<hr>
|
||
|
Methods inherited from <a href="__builtin__.html#dict">__builtin__.dict</a>:<br>
|
||
|
<dl><dt><a name="SingleOffset-__cmp__"><strong>__cmp__</strong></a>(...)</dt><dd><tt>x.<a href="#SingleOffset-__cmp__">__cmp__</a>(y) <==> cmp(x,y)</tt></dd></dl>
|
||
|
|
||
|
<dl><dt><a name="SingleOffset-__contains__"><strong>__contains__</strong></a>(...)</dt><dd><tt>x.<a href="#SingleOffset-__contains__">__contains__</a>(y) <==> y in x</tt></dd></dl>
|
||
|
|
||
|
<dl><dt><a name="SingleOffset-__delitem__"><strong>__delitem__</strong></a>(...)</dt><dd><tt>x.<a href="#SingleOffset-__delitem__">__delitem__</a>(y) <==> del x[y]</tt></dd></dl>
|
||
|
|
||
|
<dl><dt><a name="SingleOffset-__eq__"><strong>__eq__</strong></a>(...)</dt><dd><tt>x.<a href="#SingleOffset-__eq__">__eq__</a>(y) <==> x==y</tt></dd></dl>
|
||
|
|
||
|
<dl><dt><a name="SingleOffset-__ge__"><strong>__ge__</strong></a>(...)</dt><dd><tt>x.<a href="#SingleOffset-__ge__">__ge__</a>(y) <==> x>=y</tt></dd></dl>
|
||
|
|
||
|
<dl><dt><a name="SingleOffset-__getattribute__"><strong>__getattribute__</strong></a>(...)</dt><dd><tt>x.<a href="#SingleOffset-__getattribute__">__getattribute__</a>('name') <==> x.name</tt></dd></dl>
|
||
|
|
||
|
<dl><dt><a name="SingleOffset-__getitem__"><strong>__getitem__</strong></a>(...)</dt><dd><tt>x.<a href="#SingleOffset-__getitem__">__getitem__</a>(y) <==> x[y]</tt></dd></dl>
|
||
|
|
||
|
<dl><dt><a name="SingleOffset-__gt__"><strong>__gt__</strong></a>(...)</dt><dd><tt>x.<a href="#SingleOffset-__gt__">__gt__</a>(y) <==> x>y</tt></dd></dl>
|
||
|
|
||
|
<dl><dt><a name="SingleOffset-__hash__"><strong>__hash__</strong></a>(...)</dt><dd><tt>x.<a href="#SingleOffset-__hash__">__hash__</a>() <==> hash(x)</tt></dd></dl>
|
||
|
|
||
|
<dl><dt><a name="SingleOffset-__iter__"><strong>__iter__</strong></a>(...)</dt><dd><tt>x.<a href="#SingleOffset-__iter__">__iter__</a>() <==> iter(x)</tt></dd></dl>
|
||
|
|
||
|
<dl><dt><a name="SingleOffset-__le__"><strong>__le__</strong></a>(...)</dt><dd><tt>x.<a href="#SingleOffset-__le__">__le__</a>(y) <==> x<=y</tt></dd></dl>
|
||
|
|
||
|
<dl><dt><a name="SingleOffset-__len__"><strong>__len__</strong></a>(...)</dt><dd><tt>x.<a href="#SingleOffset-__len__">__len__</a>() <==> len(x)</tt></dd></dl>
|
||
|
|
||
|
<dl><dt><a name="SingleOffset-__lt__"><strong>__lt__</strong></a>(...)</dt><dd><tt>x.<a href="#SingleOffset-__lt__">__lt__</a>(y) <==> x<y</tt></dd></dl>
|
||
|
|
||
|
<dl><dt><a name="SingleOffset-__ne__"><strong>__ne__</strong></a>(...)</dt><dd><tt>x.<a href="#SingleOffset-__ne__">__ne__</a>(y) <==> x!=y</tt></dd></dl>
|
||
|
|
||
|
<dl><dt><a name="SingleOffset-__repr__"><strong>__repr__</strong></a>(...)</dt><dd><tt>x.<a href="#SingleOffset-__repr__">__repr__</a>() <==> repr(x)</tt></dd></dl>
|
||
|
|
||
|
<dl><dt><a name="SingleOffset-__setitem__"><strong>__setitem__</strong></a>(...)</dt><dd><tt>x.<a href="#SingleOffset-__setitem__">__setitem__</a>(i, y) <==> x[i]=y</tt></dd></dl>
|
||
|
|
||
|
<dl><dt><a name="SingleOffset-clear"><strong>clear</strong></a>(...)</dt><dd><tt>D.<a href="#SingleOffset-clear">clear</a>() -> None. Remove all items from D.</tt></dd></dl>
|
||
|
|
||
|
<dl><dt><a name="SingleOffset-copy"><strong>copy</strong></a>(...)</dt><dd><tt>D.<a href="#SingleOffset-copy">copy</a>() -> a shallow copy of D</tt></dd></dl>
|
||
|
|
||
|
<dl><dt><a name="SingleOffset-get"><strong>get</strong></a>(...)</dt><dd><tt>D.<a href="#SingleOffset-get">get</a>(k[,d]) -> D[k] if k in D, else d. d defaults to None.</tt></dd></dl>
|
||
|
|
||
|
<dl><dt><a name="SingleOffset-has_key"><strong>has_key</strong></a>(...)</dt><dd><tt>D.<a href="#SingleOffset-has_key">has_key</a>(k) -> True if D has a key k, else False</tt></dd></dl>
|
||
|
|
||
|
<dl><dt><a name="SingleOffset-items"><strong>items</strong></a>(...)</dt><dd><tt>D.<a href="#SingleOffset-items">items</a>() -> list of D's (key, value) pairs, as 2-tuples</tt></dd></dl>
|
||
|
|
||
|
<dl><dt><a name="SingleOffset-iteritems"><strong>iteritems</strong></a>(...)</dt><dd><tt>D.<a href="#SingleOffset-iteritems">iteritems</a>() -> an iterator over the (key, value) items of D</tt></dd></dl>
|
||
|
|
||
|
<dl><dt><a name="SingleOffset-iterkeys"><strong>iterkeys</strong></a>(...)</dt><dd><tt>D.<a href="#SingleOffset-iterkeys">iterkeys</a>() -> an iterator over the keys of D</tt></dd></dl>
|
||
|
|
||
|
<dl><dt><a name="SingleOffset-itervalues"><strong>itervalues</strong></a>(...)</dt><dd><tt>D.<a href="#SingleOffset-itervalues">itervalues</a>() -> an iterator over the values of D</tt></dd></dl>
|
||
|
|
||
|
<dl><dt><a name="SingleOffset-keys"><strong>keys</strong></a>(...)</dt><dd><tt>D.<a href="#SingleOffset-keys">keys</a>() -> list of D's keys</tt></dd></dl>
|
||
|
|
||
|
<dl><dt><a name="SingleOffset-pop"><strong>pop</strong></a>(...)</dt><dd><tt>D.<a href="#SingleOffset-pop">pop</a>(k[,d]) -> v, remove specified key and return the corresponding value<br>
|
||
|
If key is not found, d is returned if given, otherwise KeyError is raised</tt></dd></dl>
|
||
|
|
||
|
<dl><dt><a name="SingleOffset-popitem"><strong>popitem</strong></a>(...)</dt><dd><tt>D.<a href="#SingleOffset-popitem">popitem</a>() -> (k, v), remove and return some (key, value) pair as a<br>
|
||
|
2-tuple; but raise KeyError if D is empty</tt></dd></dl>
|
||
|
|
||
|
<dl><dt><a name="SingleOffset-setdefault"><strong>setdefault</strong></a>(...)</dt><dd><tt>D.<a href="#SingleOffset-setdefault">setdefault</a>(k[,d]) -> D.<a href="#SingleOffset-get">get</a>(k,d), also set D[k]=d if k not in D</tt></dd></dl>
|
||
|
|
||
|
<dl><dt><a name="SingleOffset-update"><strong>update</strong></a>(...)</dt><dd><tt>D.<a href="#SingleOffset-update">update</a>(E) -> None. Update D from E: for k in E.<a href="#SingleOffset-keys">keys</a>(): D[k] = E[k]</tt></dd></dl>
|
||
|
|
||
|
<dl><dt><a name="SingleOffset-values"><strong>values</strong></a>(...)</dt><dd><tt>D.<a href="#SingleOffset-values">values</a>() -> list of D's values</tt></dd></dl>
|
||
|
|
||
|
<hr>
|
||
|
Data and other attributes inherited from <a href="__builtin__.html#dict">__builtin__.dict</a>:<br>
|
||
|
<dl><dt><strong>__new__</strong> = <built-in method __new__ of type object at 0xa866d054><dd><tt>T.<a href="#SingleOffset-__new__">__new__</a>(S, ...) -> a new <a href="__builtin__.html#object">object</a> with type S, a subtype of T</tt></dl>
|
||
|
|
||
|
<dl><dt><strong>fromkeys</strong> = <built-in method fromkeys of type object at 0x1150820><dd><tt><a href="__builtin__.html#dict">dict</a>.<a href="#SingleOffset-fromkeys">fromkeys</a>(S[,v]) -> New <a href="__builtin__.html#dict">dict</a> with keys from S and values equal to v.<br>
|
||
|
v defaults to None.</tt></dl>
|
||
|
|
||
|
</td></tr></table></td></tr></table><p>
|
||
|
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
|
||
|
<tr bgcolor="#eeaa77">
|
||
|
<td colspan=3 valign=bottom> <br>
|
||
|
<font color="#ffffff" face="helvetica, arial"><big><strong>Functions</strong></big></font></td></tr>
|
||
|
|
||
|
<tr><td bgcolor="#eeaa77"><tt> </tt></td><td> </td>
|
||
|
<td width="100%"><dl><dt><a name="-sumOffsets"><strong>sumOffsets</strong></a>(offsets1, offsets2)</dt></dl>
|
||
|
</td></tr></table><p>
|
||
|
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
|
||
|
<tr bgcolor="#55aa55">
|
||
|
<td colspan=3 valign=bottom> <br>
|
||
|
<font color="#ffffff" face="helvetica, arial"><big><strong>Data</strong></big></font></td></tr>
|
||
|
|
||
|
<tr><td bgcolor="#55aa55"><tt> </tt></td><td> </td>
|
||
|
<td width="100%"><strong>GROUP_MARK</strong> = '@'<br>
|
||
|
<strong>PAIR_OFFSET</strong> = 'pair_offset'<br>
|
||
|
<strong>SAFE_NONE</strong> = <robofab.features.featureTools.SafeNone object at 0x52a810><br>
|
||
|
<strong>SINGLE_OFFSET</strong> = 'single_offset'</td></tr></table>
|
||
|
</body></html>
|