fonttools/Documentation/robofabDocs/robofab.glifLib.html
Erik van Blokland 3646055ea2 initial import
git-svn-id: http://svn.robofab.com/trunk@1 b5fa9d6c-a76f-4ffd-b3cb-f825fc41095c
2008-01-07 17:40:34 +00:00

277 lines
23 KiB
HTML

<!doctype html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><title>Python: module robofab.glifLib</title>
</head><body bgcolor="#f0f0f8">
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">
<tr bgcolor="#7799ee">
<td valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial">&nbsp;<br><big><big><strong><a href="robofab.html"><font color="#ffffff">robofab</font></a>.glifLib</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/glifLib.py">/code/projects/robofab/Lib/robofab/glifLib.py</a></font></td></tr></table>
<p><tt>glifLib.py&nbsp;--&nbsp;Generic&nbsp;module&nbsp;for&nbsp;reading&nbsp;and&nbsp;writing&nbsp;the&nbsp;.glif&nbsp;format.<br>
&nbsp;<br>
More&nbsp;info&nbsp;about&nbsp;the&nbsp;.glif&nbsp;format&nbsp;(GLyphInterchangeFormat)&nbsp;can&nbsp;be&nbsp;found&nbsp;here:<br>
&nbsp;<br>
&nbsp;&nbsp;<a href="http://just.letterror.com/ltrwiki/GlyphInterchangeFormat">http://just.letterror.com/ltrwiki/GlyphInterchangeFormat</a><br>
&nbsp;<br>
The&nbsp;main&nbsp;class&nbsp;in&nbsp;this&nbsp;module&nbsp;is&nbsp;<a href="#GlyphSet">GlyphSet</a>.&nbsp;It&nbsp;manages&nbsp;a&nbsp;set&nbsp;of&nbsp;.glif&nbsp;files<br>
in&nbsp;a&nbsp;folder.&nbsp;It&nbsp;offers&nbsp;two&nbsp;ways&nbsp;to&nbsp;read&nbsp;glyph&nbsp;data,&nbsp;and&nbsp;one&nbsp;way&nbsp;to&nbsp;write<br>
glyph&nbsp;data.&nbsp;See&nbsp;the&nbsp;class&nbsp;doc&nbsp;string&nbsp;for&nbsp;details.</tt></p>
<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#aa55cc">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#fffff" face="helvetica, arial"><big><strong>Modules</strong></big></font></td></tr>
<tr><td bgcolor="#aa55cc"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><table width="100%" summary="list"><tr><td width="25%" valign=top><a href="os.html">os</a><br>
</td><td width="25%" valign=top></td><td width="25%" valign=top></td><td width="25%" valign=top></td></tr></table></td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ee77aa">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Classes</strong></big></font></td></tr>
<tr><td bgcolor="#ee77aa"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><dl>
<dt><font face="helvetica, arial"><a href="robofab.pens.pointPen.html#AbstractPointPen">robofab.pens.pointPen.AbstractPointPen</a>
</font></dt><dd>
<dl>
<dt><font face="helvetica, arial"><a href="robofab.glifLib.html#GLIFPointPen">GLIFPointPen</a>
</font></dt></dl>
</dd>
<dt><font face="helvetica, arial"><a href="exceptions.html#Exception">exceptions.Exception</a>
</font></dt><dd>
<dl>
<dt><font face="helvetica, arial"><a href="robofab.glifLib.html#GlifLibError">GlifLibError</a>
</font></dt></dl>
</dd>
<dt><font face="helvetica, arial"><a href="robofab.glifLib.html#Glyph">Glyph</a>
</font></dt><dt><font face="helvetica, arial"><a href="robofab.glifLib.html#GlyphSet">GlyphSet</a>
</font></dt></dl>
<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#000000" face="helvetica, arial"><a name="GLIFPointPen">class <strong>GLIFPointPen</strong></a>(<a href="robofab.pens.pointPen.html#AbstractPointPen">robofab.pens.pointPen.AbstractPointPen</a>)</font></td></tr>
<tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td>
<td colspan=2><tt>Helper&nbsp;class&nbsp;using&nbsp;the&nbsp;PointPen&nbsp;protocol&nbsp;to&nbsp;write&nbsp;the&nbsp;&lt;outline&gt;<br>
part&nbsp;of&nbsp;.glif&nbsp;files.<br>&nbsp;</tt></td></tr>
<tr><td>&nbsp;</td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="GLIFPointPen-__init__"><strong>__init__</strong></a>(self, xmlWriter)</dt></dl>
<dl><dt><a name="GLIFPointPen-addComponent"><strong>addComponent</strong></a>(self, glyphName, transformation)</dt></dl>
<dl><dt><a name="GLIFPointPen-addPoint"><strong>addPoint</strong></a>(self, pt, segmentType<font color="#909090">=None</font>, smooth<font color="#909090">=None</font>, name<font color="#909090">=None</font>, **kwargs)</dt></dl>
<dl><dt><a name="GLIFPointPen-beginPath"><strong>beginPath</strong></a>(self)</dt></dl>
<dl><dt><a name="GLIFPointPen-endPath"><strong>endPath</strong></a>(self)</dt></dl>
</td></tr></table> <p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#000000" face="helvetica, arial"><a name="GlifLibError">class <strong>GlifLibError</strong></a>(<a href="exceptions.html#Exception">exceptions.Exception</a>)</font></td></tr>
<tr><td bgcolor="#ffc8d8"><tt>&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%">Methods inherited from <a href="exceptions.html#Exception">exceptions.Exception</a>:<br>
<dl><dt><a name="GlifLibError-__getitem__"><strong>__getitem__</strong></a>(...)</dt></dl>
<dl><dt><a name="GlifLibError-__init__"><strong>__init__</strong></a>(...)</dt></dl>
<dl><dt><a name="GlifLibError-__str__"><strong>__str__</strong></a>(...)</dt></dl>
</td></tr></table> <p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#000000" face="helvetica, arial"><a name="Glyph">class <strong>Glyph</strong></a></font></td></tr>
<tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td>
<td colspan=2><tt>Minimal&nbsp;glyph&nbsp;object.&nbsp;It&nbsp;has&nbsp;no&nbsp;glyph&nbsp;attributes&nbsp;until&nbsp;either<br>
the&nbsp;<a href="#Glyph-draw">draw</a>()&nbsp;or&nbsp;the&nbsp;drawPoint()&nbsp;method&nbsp;has&nbsp;been&nbsp;called.<br>&nbsp;</tt></td></tr>
<tr><td>&nbsp;</td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="Glyph-__init__"><strong>__init__</strong></a>(self, glyphName, glyphSet)</dt></dl>
<dl><dt><a name="Glyph-draw"><strong>draw</strong></a>(self, pen)</dt><dd><tt>Draw&nbsp;this&nbsp;glyph&nbsp;onto&nbsp;a&nbsp;*FontTools*&nbsp;Pen.</tt></dd></dl>
<dl><dt><a name="Glyph-drawPoints"><strong>drawPoints</strong></a>(self, pointPen)</dt><dd><tt>Draw&nbsp;this&nbsp;glyph&nbsp;onto&nbsp;a&nbsp;PointPen.</tt></dd></dl>
</td></tr></table> <p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#000000" face="helvetica, arial"><a name="GlyphSet">class <strong>GlyphSet</strong></a></font></td></tr>
<tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td>
<td colspan=2><tt><a href="#GlyphSet">GlyphSet</a>&nbsp;manages&nbsp;a&nbsp;set&nbsp;of&nbsp;.glif&nbsp;files&nbsp;inside&nbsp;one&nbsp;directory.<br>
&nbsp;<br>
<a href="#GlyphSet">GlyphSet</a>'s&nbsp;constructor&nbsp;takes&nbsp;a&nbsp;path&nbsp;to&nbsp;an&nbsp;existing&nbsp;directory&nbsp;as&nbsp;it's<br>
first&nbsp;argument.&nbsp;Reading&nbsp;glyph&nbsp;data&nbsp;can&nbsp;either&nbsp;be&nbsp;done&nbsp;through&nbsp;the<br>
<a href="#GlyphSet-readGlyph">readGlyph</a>()&nbsp;method,&nbsp;or&nbsp;by&nbsp;using&nbsp;<a href="#GlyphSet">GlyphSet</a>'s&nbsp;dictionary&nbsp;interface,&nbsp;where<br>
the&nbsp;keys&nbsp;are&nbsp;glyph&nbsp;names&nbsp;and&nbsp;the&nbsp;values&nbsp;are&nbsp;(very)&nbsp;simple&nbsp;glyph&nbsp;objects.<br>
&nbsp;<br>
To&nbsp;write&nbsp;a&nbsp;glyph&nbsp;to&nbsp;the&nbsp;glyph&nbsp;set,&nbsp;you&nbsp;use&nbsp;the&nbsp;<a href="#GlyphSet-writeGlyph">writeGlyph</a>()&nbsp;method.<br>
The&nbsp;simple&nbsp;glyph&nbsp;objects&nbsp;returned&nbsp;through&nbsp;the&nbsp;dict&nbsp;interface&nbsp;do&nbsp;not<br>
support&nbsp;writing,&nbsp;they&nbsp;are&nbsp;just&nbsp;means&nbsp;as&nbsp;a&nbsp;convenient&nbsp;way&nbsp;to&nbsp;get&nbsp;at<br>
the&nbsp;glyph&nbsp;data.<br>&nbsp;</tt></td></tr>
<tr><td>&nbsp;</td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="GlyphSet-__contains__"><strong>__contains__</strong></a> = <a href="#GlyphSet-has_key">has_key</a>(self, glyphName)</dt></dl>
<dl><dt><a name="GlyphSet-__getitem__"><strong>__getitem__</strong></a>(self, glyphName)</dt></dl>
<dl><dt><a name="GlyphSet-__init__"><strong>__init__</strong></a>(self, dirName, glyphNameToFileNameFunc<font color="#909090">=None</font>)</dt><dd><tt>'dirName'&nbsp;should&nbsp;be&nbsp;a&nbsp;path&nbsp;to&nbsp;an&nbsp;existing&nbsp;directory.<br>
&nbsp;<br>
The&nbsp;optional&nbsp;'glyphNameToFileNameFunc'&nbsp;argument&nbsp;must&nbsp;be&nbsp;a&nbsp;callback<br>
function&nbsp;that&nbsp;takes&nbsp;two&nbsp;arguments:&nbsp;a&nbsp;glyph&nbsp;name&nbsp;and&nbsp;the&nbsp;<a href="#GlyphSet">GlyphSet</a><br>
instance.&nbsp;It&nbsp;should&nbsp;return&nbsp;a&nbsp;file&nbsp;name&nbsp;(including&nbsp;the&nbsp;.glif<br>
extension).&nbsp;The&nbsp;glyphNameToFileName&nbsp;function&nbsp;is&nbsp;called&nbsp;whenever<br>
a&nbsp;file&nbsp;name&nbsp;is&nbsp;created&nbsp;for&nbsp;a&nbsp;given&nbsp;glyph&nbsp;name.</tt></dd></dl>
<dl><dt><a name="GlyphSet-__len__"><strong>__len__</strong></a>(self)</dt></dl>
<dl><dt><a name="GlyphSet-deleteGlyph"><strong>deleteGlyph</strong></a>(self, glyphName)</dt><dd><tt>Permanently&nbsp;delete&nbsp;the&nbsp;glyph&nbsp;from&nbsp;the&nbsp;glyph&nbsp;set&nbsp;on&nbsp;disk.&nbsp;Will<br>
raise&nbsp;KeyError&nbsp;if&nbsp;the&nbsp;glyph&nbsp;is&nbsp;not&nbsp;present&nbsp;in&nbsp;the&nbsp;glyph&nbsp;set.</tt></dd></dl>
<dl><dt><a name="GlyphSet-getReverseContents"><strong>getReverseContents</strong></a>(self)</dt><dd><tt>Return&nbsp;a&nbsp;reversed&nbsp;dict&nbsp;of&nbsp;self.<strong>contents</strong>,&nbsp;mapping&nbsp;file&nbsp;names&nbsp;to<br>
glyph&nbsp;names.&nbsp;This&nbsp;is&nbsp;primarily&nbsp;an&nbsp;aid&nbsp;for&nbsp;custom&nbsp;glyph&nbsp;name&nbsp;to&nbsp;file<br>
name&nbsp;schemes&nbsp;that&nbsp;want&nbsp;to&nbsp;make&nbsp;sure&nbsp;they&nbsp;don't&nbsp;generate&nbsp;duplicate<br>
file&nbsp;names.&nbsp;The&nbsp;file&nbsp;names&nbsp;are&nbsp;converted&nbsp;to&nbsp;lowercase&nbsp;so&nbsp;we&nbsp;can<br>
reliably&nbsp;check&nbsp;for&nbsp;duplicates&nbsp;that&nbsp;only&nbsp;differ&nbsp;in&nbsp;case,&nbsp;which&nbsp;is<br>
important&nbsp;for&nbsp;case-insensitive&nbsp;file&nbsp;systems.</tt></dd></dl>
<dl><dt><a name="GlyphSet-getUnicodes"><strong>getUnicodes</strong></a>(self)</dt><dd><tt>Return&nbsp;a&nbsp;dictionary&nbsp;that&nbsp;maps&nbsp;all&nbsp;glyph&nbsp;names&nbsp;to&nbsp;lists&nbsp;containing<br>
the&nbsp;unicode&nbsp;value[s]&nbsp;for&nbsp;that&nbsp;glyph,&nbsp;if&nbsp;any.&nbsp;This&nbsp;parses&nbsp;the&nbsp;.glif<br>
files&nbsp;partially,&nbsp;so&nbsp;is&nbsp;a&nbsp;lot&nbsp;faster&nbsp;than&nbsp;parsing&nbsp;all&nbsp;files&nbsp;completely.</tt></dd></dl>
<dl><dt><a name="GlyphSet-has_key"><strong>has_key</strong></a>(self, glyphName)</dt></dl>
<dl><dt><a name="GlyphSet-keys"><strong>keys</strong></a>(self)</dt></dl>
<dl><dt><a name="GlyphSet-readGlyph"><strong>readGlyph</strong></a>(self, glyphName, glyphObject<font color="#909090">=None</font>, pointPen<font color="#909090">=None</font>)</dt><dd><tt>Read&nbsp;a&nbsp;.glif&nbsp;file&nbsp;for&nbsp;'glyphName'&nbsp;from&nbsp;the&nbsp;glyph&nbsp;set.&nbsp;The<br>
'glyphObject'&nbsp;argument&nbsp;can&nbsp;be&nbsp;any&nbsp;kind&nbsp;of&nbsp;object&nbsp;(even&nbsp;None);<br>
the&nbsp;<a href="#GlyphSet-readGlyph">readGlyph</a>()&nbsp;method&nbsp;will&nbsp;attempt&nbsp;to&nbsp;set&nbsp;the&nbsp;following<br>
attributes&nbsp;on&nbsp;it:<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"width"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;the&nbsp;advance&nbsp;with&nbsp;of&nbsp;the&nbsp;glyph<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"unicodes"&nbsp;&nbsp;a&nbsp;list&nbsp;of&nbsp;unicode&nbsp;values&nbsp;for&nbsp;this&nbsp;glyph<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"note"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;a&nbsp;string<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"lib"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;a&nbsp;dictionary&nbsp;containing&nbsp;custom&nbsp;data<br>
&nbsp;<br>
All&nbsp;attributes&nbsp;are&nbsp;optional,&nbsp;in&nbsp;two&nbsp;ways:<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1)&nbsp;An&nbsp;attribute&nbsp;*won't*&nbsp;be&nbsp;set&nbsp;if&nbsp;the&nbsp;.glif&nbsp;file&nbsp;doesn't<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;contain&nbsp;data&nbsp;for&nbsp;it.&nbsp;'glyphObject'&nbsp;will&nbsp;have&nbsp;to&nbsp;deal<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;with&nbsp;default&nbsp;values&nbsp;itself.<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2)&nbsp;If&nbsp;setting&nbsp;the&nbsp;attribute&nbsp;fails&nbsp;with&nbsp;an&nbsp;AttributeError<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(for&nbsp;example&nbsp;if&nbsp;the&nbsp;'glyphObject'&nbsp;attribute&nbsp;is&nbsp;read-<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;only),&nbsp;<a href="#GlyphSet-readGlyph">readGlyph</a>()&nbsp;will&nbsp;not&nbsp;propagate&nbsp;that&nbsp;exception,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;but&nbsp;ignore&nbsp;that&nbsp;attribute.<br>
&nbsp;<br>
To&nbsp;retrieve&nbsp;outline&nbsp;information,&nbsp;you&nbsp;need&nbsp;to&nbsp;pass&nbsp;an&nbsp;object<br>
conforming&nbsp;to&nbsp;the&nbsp;PointPen&nbsp;protocol&nbsp;as&nbsp;the&nbsp;'pointPen'&nbsp;argument.<br>
This&nbsp;argument&nbsp;may&nbsp;be&nbsp;None&nbsp;if&nbsp;you&nbsp;don't&nbsp;need&nbsp;the&nbsp;outline&nbsp;data.<br>
&nbsp;<br>
<a href="#GlyphSet-readGlyph">readGlyph</a>()&nbsp;will&nbsp;raise&nbsp;KeyError&nbsp;if&nbsp;the&nbsp;glyph&nbsp;is&nbsp;not&nbsp;present&nbsp;in<br>
the&nbsp;glyph&nbsp;set.</tt></dd></dl>
<dl><dt><a name="GlyphSet-rebuildContents"><strong>rebuildContents</strong></a>(self)</dt><dd><tt>Rebuild&nbsp;the&nbsp;contents&nbsp;dict&nbsp;by&nbsp;checking&nbsp;what&nbsp;glyphs&nbsp;are&nbsp;available<br>
on&nbsp;disk.</tt></dd></dl>
<dl><dt><a name="GlyphSet-writeContents"><strong>writeContents</strong></a>(self)</dt><dd><tt>Write&nbsp;the&nbsp;contents.plist&nbsp;file&nbsp;out&nbsp;to&nbsp;disk.&nbsp;Call&nbsp;this&nbsp;method&nbsp;when<br>
you're&nbsp;done&nbsp;writing&nbsp;glyphs.</tt></dd></dl>
<dl><dt><a name="GlyphSet-writeGlyph"><strong>writeGlyph</strong></a>(self, glyphName, glyphObject<font color="#909090">=None</font>, drawPointsFunc<font color="#909090">=None</font>)</dt><dd><tt>Write&nbsp;a&nbsp;.glif&nbsp;file&nbsp;for&nbsp;'glyphName'&nbsp;to&nbsp;the&nbsp;glyph&nbsp;set.&nbsp;The<br>
'glyphObject'&nbsp;argument&nbsp;can&nbsp;be&nbsp;any&nbsp;kind&nbsp;of&nbsp;object&nbsp;(even&nbsp;None);<br>
the&nbsp;<a href="#GlyphSet-writeGlyph">writeGlyph</a>()&nbsp;method&nbsp;will&nbsp;attempt&nbsp;to&nbsp;get&nbsp;the&nbsp;following<br>
attributes&nbsp;from&nbsp;it:<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"width"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;the&nbsp;advance&nbsp;with&nbsp;of&nbsp;the&nbsp;glyph<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"unicodes"&nbsp;&nbsp;a&nbsp;list&nbsp;of&nbsp;unicode&nbsp;values&nbsp;for&nbsp;this&nbsp;glyph<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"note"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;a&nbsp;string<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"lib"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;a&nbsp;dictionary&nbsp;containing&nbsp;custom&nbsp;data<br>
&nbsp;<br>
All&nbsp;attributes&nbsp;are&nbsp;optional:&nbsp;if&nbsp;'glyphObject'&nbsp;doesn't<br>
have&nbsp;the&nbsp;attribute,&nbsp;it&nbsp;will&nbsp;simply&nbsp;be&nbsp;skipped.<br>
&nbsp;<br>
To&nbsp;write&nbsp;outline&nbsp;data&nbsp;to&nbsp;the&nbsp;.glif&nbsp;file,&nbsp;<a href="#GlyphSet-writeGlyph">writeGlyph</a>()&nbsp;needs<br>
a&nbsp;function&nbsp;(any&nbsp;callable&nbsp;object&nbsp;actually)&nbsp;that&nbsp;will&nbsp;take&nbsp;one<br>
argument:&nbsp;an&nbsp;object&nbsp;that&nbsp;conforms&nbsp;to&nbsp;the&nbsp;PointPen&nbsp;protocol.<br>
The&nbsp;function&nbsp;will&nbsp;be&nbsp;called&nbsp;by&nbsp;<a href="#GlyphSet-writeGlyph">writeGlyph</a>();&nbsp;it&nbsp;has&nbsp;to&nbsp;call&nbsp;the<br>
proper&nbsp;PointPen&nbsp;methods&nbsp;to&nbsp;transfer&nbsp;the&nbsp;outline&nbsp;to&nbsp;the&nbsp;.glif&nbsp;file.</tt></dd></dl>
<hr>
Data and other attributes defined here:<br>
<dl><dt><strong>glyphClass</strong> = &lt;class robofab.glifLib.Glyph at 0x549120&gt;<dd><tt>Minimal&nbsp;glyph&nbsp;object.&nbsp;It&nbsp;has&nbsp;no&nbsp;glyph&nbsp;attributes&nbsp;until&nbsp;either<br>
the&nbsp;draw()&nbsp;or&nbsp;the&nbsp;drawPoint()&nbsp;method&nbsp;has&nbsp;been&nbsp;called.</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>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Functions</strong></big></font></td></tr>
<tr><td bgcolor="#eeaa77"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><dl><dt><a name="-StringIO"><strong>StringIO</strong></a>(...)</dt><dd><tt><a href="#-StringIO">StringIO</a>([s])&nbsp;--&nbsp;Return&nbsp;a&nbsp;StringIO-like&nbsp;stream&nbsp;for&nbsp;reading&nbsp;or&nbsp;writing</tt></dd></dl>
<dl><dt><a name="-buildOutline_Format0"><strong>buildOutline_Format0</strong></a>(pen, xmlNodes)</dt></dl>
<dl><dt><a name="-buildOutline_Format1"><strong>buildOutline_Format1</strong></a>(pen, xmlNodes)</dt></dl>
<dl><dt><a name="-glyphNameToFileName"><strong>glyphNameToFileName</strong></a>(glyphName, glyphSet)</dt><dd><tt>Default&nbsp;algorithm&nbsp;for&nbsp;making&nbsp;a&nbsp;file&nbsp;name&nbsp;out&nbsp;of&nbsp;a&nbsp;glyph&nbsp;name.<br>
This&nbsp;one&nbsp;has&nbsp;limited&nbsp;support&nbsp;for&nbsp;case&nbsp;insensitive&nbsp;file&nbsp;systems:<br>
it&nbsp;assumes&nbsp;glyph&nbsp;names&nbsp;are&nbsp;not&nbsp;case&nbsp;sensitive&nbsp;apart&nbsp;from&nbsp;the&nbsp;first<br>
character:<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'a'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&gt;&nbsp;'a.glif'<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'A'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&gt;&nbsp;'A_.glif'<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'A.alt'&nbsp;-&gt;&nbsp;'A_.alt.glif'<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'A.Alt'&nbsp;-&gt;&nbsp;'A_.Alt.glif'&nbsp;&nbsp;#&nbsp;this&nbsp;one&nbsp;would&nbsp;cause&nbsp;problems</tt></dd></dl>
<dl><dt><a name="-readGlyphFromString"><strong>readGlyphFromString</strong></a>(aString, glyphObject<font color="#909090">=None</font>, pointPen<font color="#909090">=None</font>)</dt><dd><tt>Read&nbsp;.glif&nbsp;data&nbsp;from&nbsp;a&nbsp;string&nbsp;into&nbsp;a&nbsp;glyph&nbsp;object.<br>
&nbsp;<br>
The&nbsp;'glyphObject'&nbsp;argument&nbsp;can&nbsp;be&nbsp;any&nbsp;kind&nbsp;of&nbsp;object&nbsp;(even&nbsp;None);<br>
the&nbsp;<a href="#-readGlyphFromString">readGlyphFromString</a>()&nbsp;method&nbsp;will&nbsp;attempt&nbsp;to&nbsp;set&nbsp;the&nbsp;following<br>
attributes&nbsp;on&nbsp;it:<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"width"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;the&nbsp;advance&nbsp;with&nbsp;of&nbsp;the&nbsp;glyph<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"unicodes"&nbsp;&nbsp;a&nbsp;list&nbsp;of&nbsp;unicode&nbsp;values&nbsp;for&nbsp;this&nbsp;glyph<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"note"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;a&nbsp;string<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"lib"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;a&nbsp;dictionary&nbsp;containing&nbsp;custom&nbsp;data<br>
&nbsp;<br>
All&nbsp;attributes&nbsp;are&nbsp;optional,&nbsp;in&nbsp;two&nbsp;ways:<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1)&nbsp;An&nbsp;attribute&nbsp;*won't*&nbsp;be&nbsp;set&nbsp;if&nbsp;the&nbsp;.glif&nbsp;file&nbsp;doesn't<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;contain&nbsp;data&nbsp;for&nbsp;it.&nbsp;'glyphObject'&nbsp;will&nbsp;have&nbsp;to&nbsp;deal<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;with&nbsp;default&nbsp;values&nbsp;itself.<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2)&nbsp;If&nbsp;setting&nbsp;the&nbsp;attribute&nbsp;fails&nbsp;with&nbsp;an&nbsp;AttributeError<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(for&nbsp;example&nbsp;if&nbsp;the&nbsp;'glyphObject'&nbsp;attribute&nbsp;is&nbsp;read-<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;only),&nbsp;<a href="#-readGlyphFromString">readGlyphFromString</a>()&nbsp;will&nbsp;not&nbsp;propagate&nbsp;that<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;exception,&nbsp;but&nbsp;ignore&nbsp;that&nbsp;attribute.<br>
&nbsp;<br>
To&nbsp;retrieve&nbsp;outline&nbsp;information,&nbsp;you&nbsp;need&nbsp;to&nbsp;pass&nbsp;an&nbsp;object<br>
conforming&nbsp;to&nbsp;the&nbsp;PointPen&nbsp;protocol&nbsp;as&nbsp;the&nbsp;'pointPen'&nbsp;argument.<br>
This&nbsp;argument&nbsp;may&nbsp;be&nbsp;None&nbsp;if&nbsp;you&nbsp;don't&nbsp;need&nbsp;the&nbsp;outline&nbsp;data.</tt></dd></dl>
<dl><dt><a name="-writeGlyphToString"><strong>writeGlyphToString</strong></a>(glyphName, glyphObject<font color="#909090">=None</font>, drawPointsFunc<font color="#909090">=None</font>, writer<font color="#909090">=None</font>)</dt><dd><tt>Return&nbsp;.glif&nbsp;data&nbsp;for&nbsp;a&nbsp;glyph&nbsp;as&nbsp;a&nbsp;UTF-8&nbsp;encoded&nbsp;string.<br>
The&nbsp;'glyphObject'&nbsp;argument&nbsp;can&nbsp;be&nbsp;any&nbsp;kind&nbsp;of&nbsp;object&nbsp;(even&nbsp;None);<br>
the&nbsp;<a href="#-writeGlyphToString">writeGlyphToString</a>()&nbsp;method&nbsp;will&nbsp;attempt&nbsp;to&nbsp;get&nbsp;the&nbsp;following<br>
attributes&nbsp;from&nbsp;it:<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"width"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;the&nbsp;advance&nbsp;with&nbsp;of&nbsp;the&nbsp;glyph<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"unicodes"&nbsp;&nbsp;a&nbsp;list&nbsp;of&nbsp;unicode&nbsp;values&nbsp;for&nbsp;this&nbsp;glyph<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"note"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;a&nbsp;string<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"lib"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;a&nbsp;dictionary&nbsp;containing&nbsp;custom&nbsp;data<br>
&nbsp;<br>
All&nbsp;attributes&nbsp;are&nbsp;optional:&nbsp;if&nbsp;'glyphObject'&nbsp;doesn't<br>
have&nbsp;the&nbsp;attribute,&nbsp;it&nbsp;will&nbsp;simply&nbsp;be&nbsp;skipped.<br>
&nbsp;<br>
To&nbsp;write&nbsp;outline&nbsp;data&nbsp;to&nbsp;the&nbsp;.glif&nbsp;file,&nbsp;<a href="#-writeGlyphToString">writeGlyphToString</a>()&nbsp;needs<br>
a&nbsp;function&nbsp;(any&nbsp;callable&nbsp;object&nbsp;actually)&nbsp;that&nbsp;will&nbsp;take&nbsp;one<br>
argument:&nbsp;an&nbsp;object&nbsp;that&nbsp;conforms&nbsp;to&nbsp;the&nbsp;PointPen&nbsp;protocol.<br>
The&nbsp;function&nbsp;will&nbsp;be&nbsp;called&nbsp;by&nbsp;<a href="#-writeGlyphToString">writeGlyphToString</a>();&nbsp;it&nbsp;has&nbsp;to&nbsp;call&nbsp;the<br>
proper&nbsp;PointPen&nbsp;methods&nbsp;to&nbsp;transfer&nbsp;the&nbsp;outline&nbsp;to&nbsp;the&nbsp;.glif&nbsp;file.</tt></dd></dl>
</td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#55aa55">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Data</strong></big></font></td></tr>
<tr><td bgcolor="#55aa55"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><strong>READ_MODE</strong> = 'r'<br>
<strong>WRITE_MODE</strong> = 'w'<br>
<strong>__all__</strong> = ['GlyphSet', 'GlifLibError', 'readGlyphFromString', 'writeGlyphToString', 'glyphNameToFileName']</td></tr></table>
</body></html>