/usr/share/doc/ufolib/html/ufoLib/glifLib.html is in python3-ufolib 2.1.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 | <!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>glifLib — ufoLib 1.3.0a documentation</title>
<link rel="stylesheet" href="../_static/classic.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../',
VERSION: '1.3.0a',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true,
SOURCELINK_SUFFIX: '.txt'
};
</script>
<script type="text/javascript" src="../_static/jquery.js"></script>
<script type="text/javascript" src="../_static/underscore.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script>
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
<link rel="next" title="pointPen" href="pointPen.html" />
<link rel="prev" title="ufoLib" href="ufoLib.html" />
</head>
<body>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="pointPen.html" title="pointPen"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="ufoLib.html" title="ufoLib"
accesskey="P">previous</a> |</li>
<li class="nav-item nav-item-0"><a href="../index.html">ufoLib 1.3.0a documentation</a> »</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<div class="section" id="module-ufoLib.glifLib">
<span id="gliflib"></span><h1>glifLib<a class="headerlink" href="#module-ufoLib.glifLib" title="Permalink to this headline">¶</a></h1>
<p>glifLib.py – Generic module for reading and writing the .glif format.</p>
<p>More info about the .glif format (GLyphInterchangeFormat) can be found here:</p>
<blockquote>
<div><a class="reference external" href="http://unifiedfontobject.org">http://unifiedfontobject.org</a></div></blockquote>
<p>The main class in this module is GlyphSet. It manages a set of .glif files
in a folder. It offers two ways to read glyph data, and one way to write
glyph data. See the class doc string for details.</p>
<dl class="class">
<dt id="ufoLib.glifLib.GlyphSet">
<em class="property">class </em><code class="descclassname">ufoLib.glifLib.</code><code class="descname">GlyphSet</code><span class="sig-paren">(</span><em>dirName</em>, <em>glyphNameToFileNameFunc=None</em>, <em>ufoFormatVersion=3</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/ufoLib/glifLib.html#GlyphSet"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#ufoLib.glifLib.GlyphSet" title="Permalink to this definition">¶</a></dt>
<dd><p>GlyphSet manages a set of .glif files inside one directory.</p>
<p>GlyphSet’s constructor takes a path to an existing directory as it’s
first argument. Reading glyph data can either be done through the
readGlyph() method, or by using GlyphSet’s dictionary interface, where
the keys are glyph names and the values are (very) simple glyph objects.</p>
<p>To write a glyph to the glyph set, you use the writeGlyph() method.
The simple glyph objects returned through the dict interface do not
support writing, they are just a convenient way to get at the glyph data.</p>
<dl class="method">
<dt id="ufoLib.glifLib.GlyphSet.deleteGlyph">
<code class="descname">deleteGlyph</code><span class="sig-paren">(</span><em>glyphName</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/ufoLib/glifLib.html#GlyphSet.deleteGlyph"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#ufoLib.glifLib.GlyphSet.deleteGlyph" title="Permalink to this definition">¶</a></dt>
<dd><p>Permanently delete the glyph from the glyph set on disk. Will
raise KeyError if the glyph is not present in the glyph set.</p>
</dd></dl>
<dl class="method">
<dt id="ufoLib.glifLib.GlyphSet.getComponentReferences">
<code class="descname">getComponentReferences</code><span class="sig-paren">(</span><em>glyphNames=None</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/ufoLib/glifLib.html#GlyphSet.getComponentReferences"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#ufoLib.glifLib.GlyphSet.getComponentReferences" title="Permalink to this definition">¶</a></dt>
<dd><p>Return a dictionary that maps glyph names to lists containing the
base glyph name of components in the glyph. This parses the .glif
files partially, so it is a lot faster than parsing all files completely.
By default this checks all glyphs, but a subset can be passed with glyphNames.</p>
</dd></dl>
<dl class="method">
<dt id="ufoLib.glifLib.GlyphSet.getGLIF">
<code class="descname">getGLIF</code><span class="sig-paren">(</span><em>glyphName</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/ufoLib/glifLib.html#GlyphSet.getGLIF"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#ufoLib.glifLib.GlyphSet.getGLIF" title="Permalink to this definition">¶</a></dt>
<dd><p>Get the raw GLIF text for a given glyph name. This only works
for GLIF files that are already on disk.</p>
<p>This method is useful in situations when the raw XML needs to be
read from a glyph set for a particular glyph before fully parsing
it into an object structure via the readGlyph method.</p>
<p>Internally, this method will load a GLIF the first time it is
called and then cache it. The next time this method is called
the GLIF will be pulled from the cache if the file’s modification
time has not changed since the GLIF was cached. For memory
efficiency, the cached GLIF will be purged by various other methods
such as readGlyph.</p>
</dd></dl>
<dl class="method">
<dt id="ufoLib.glifLib.GlyphSet.getGLIFModificationTime">
<code class="descname">getGLIFModificationTime</code><span class="sig-paren">(</span><em>glyphName</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/ufoLib/glifLib.html#GlyphSet.getGLIFModificationTime"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#ufoLib.glifLib.GlyphSet.getGLIFModificationTime" title="Permalink to this definition">¶</a></dt>
<dd><p>Get the modification time (as reported by os.path.getmtime)
of the GLIF with glyphName.</p>
</dd></dl>
<dl class="method">
<dt id="ufoLib.glifLib.GlyphSet.getImageReferences">
<code class="descname">getImageReferences</code><span class="sig-paren">(</span><em>glyphNames=None</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/ufoLib/glifLib.html#GlyphSet.getImageReferences"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#ufoLib.glifLib.GlyphSet.getImageReferences" title="Permalink to this definition">¶</a></dt>
<dd><p>Return a dictionary that maps glyph names to the file name of the image
referenced by the glyph. This parses the .glif files partially, so it is a
lot faster than parsing all files completely.
By default this checks all glyphs, but a subset can be passed with glyphNames.</p>
</dd></dl>
<dl class="method">
<dt id="ufoLib.glifLib.GlyphSet.getReverseContents">
<code class="descname">getReverseContents</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/ufoLib/glifLib.html#GlyphSet.getReverseContents"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#ufoLib.glifLib.GlyphSet.getReverseContents" title="Permalink to this definition">¶</a></dt>
<dd><p>Return a reversed dict of self.contents, mapping file names to
glyph names. This is primarily an aid for custom glyph name to file
name schemes that want to make sure they don’t generate duplicate
file names. The file names are converted to lowercase so we can
reliably check for duplicates that only differ in case, which is
important for case-insensitive file systems.</p>
</dd></dl>
<dl class="method">
<dt id="ufoLib.glifLib.GlyphSet.getUnicodes">
<code class="descname">getUnicodes</code><span class="sig-paren">(</span><em>glyphNames=None</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/ufoLib/glifLib.html#GlyphSet.getUnicodes"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#ufoLib.glifLib.GlyphSet.getUnicodes" title="Permalink to this definition">¶</a></dt>
<dd><p>Return a dictionary that maps glyph names to lists containing
the unicode value[s] for that glyph, if any. This parses the .glif
files partially, so it is a lot faster than parsing all files completely.
By default this checks all glyphs, but a subset can be passed with glyphNames.</p>
</dd></dl>
<dl class="attribute">
<dt id="ufoLib.glifLib.GlyphSet.glyphClass">
<code class="descname">glyphClass</code><a class="headerlink" href="#ufoLib.glifLib.GlyphSet.glyphClass" title="Permalink to this definition">¶</a></dt>
<dd><p>alias of <code class="xref py py-class docutils literal"><span class="pre">Glyph</span></code></p>
</dd></dl>
<dl class="method">
<dt id="ufoLib.glifLib.GlyphSet.readGlyph">
<code class="descname">readGlyph</code><span class="sig-paren">(</span><em>glyphName</em>, <em>glyphObject=None</em>, <em>pointPen=None</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/ufoLib/glifLib.html#GlyphSet.readGlyph"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#ufoLib.glifLib.GlyphSet.readGlyph" title="Permalink to this definition">¶</a></dt>
<dd><p>Read a .glif file for ‘glyphName’ from the glyph set. The
‘glyphObject’ argument can be any kind of object (even None);
the readGlyph() method will attempt to set the following
attributes on it:</p>
<blockquote>
<div>“width” the advance with of the glyph
“height” the advance height of the glyph
“unicodes” a list of unicode values for this glyph
“note” a string
“lib” a dictionary containing custom data
“image” a dictionary containing image data
“guidelines” a list of guideline data dictionaries
“anchors” a list of anchor data dictionaries</div></blockquote>
<dl class="docutils">
<dt>All attributes are optional, in two ways:</dt>
<dd><ol class="first last arabic simple">
<li>An attribute <em>won’t</em> be set if the .glif file doesn’t
contain data for it. ‘glyphObject’ will have to deal
with default values itself.</li>
<li>If setting the attribute fails with an AttributeError
(for example if the ‘glyphObject’ attribute is read-
only), readGlyph() will not propagate that exception,
but ignore that attribute.</li>
</ol>
</dd>
</dl>
<p>To retrieve outline information, you need to pass an object
conforming to the PointPen protocol as the ‘pointPen’ argument.
This argument may be None if you don’t need the outline data.</p>
<p>readGlyph() will raise KeyError if the glyph is not present in
the glyph set.</p>
</dd></dl>
<dl class="method">
<dt id="ufoLib.glifLib.GlyphSet.rebuildContents">
<code class="descname">rebuildContents</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/ufoLib/glifLib.html#GlyphSet.rebuildContents"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#ufoLib.glifLib.GlyphSet.rebuildContents" title="Permalink to this definition">¶</a></dt>
<dd><p>Rebuild the contents dict by loading contents.plist.</p>
</dd></dl>
<dl class="method">
<dt id="ufoLib.glifLib.GlyphSet.writeContents">
<code class="descname">writeContents</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/ufoLib/glifLib.html#GlyphSet.writeContents"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#ufoLib.glifLib.GlyphSet.writeContents" title="Permalink to this definition">¶</a></dt>
<dd><p>Write the contents.plist file out to disk. Call this method when
you’re done writing glyphs.</p>
</dd></dl>
<dl class="method">
<dt id="ufoLib.glifLib.GlyphSet.writeGlyph">
<code class="descname">writeGlyph</code><span class="sig-paren">(</span><em>glyphName</em>, <em>glyphObject=None</em>, <em>drawPointsFunc=None</em>, <em>formatVersion=None</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/ufoLib/glifLib.html#GlyphSet.writeGlyph"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#ufoLib.glifLib.GlyphSet.writeGlyph" title="Permalink to this definition">¶</a></dt>
<dd><p>Write a .glif file for ‘glyphName’ to the glyph set. The
‘glyphObject’ argument can be any kind of object (even None);
the writeGlyph() method will attempt to get the following
attributes from it:</p>
<blockquote>
<div>“width” the advance with of the glyph
“height” the advance height of the glyph
“unicodes” a list of unicode values for this glyph
“note” a string
“lib” a dictionary containing custom data
“image” a dictionary containing image data
“guidelines” a list of guideline data dictionaries
“anchors” a list of anchor data dictionaries</div></blockquote>
<p>All attributes are optional: if ‘glyphObject’ doesn’t
have the attribute, it will simply be skipped.</p>
<p>To write outline data to the .glif file, writeGlyph() needs
a function (any callable object actually) that will take one
argument: an object that conforms to the PointPen protocol.
The function will be called by writeGlyph(); it has to call the
proper PointPen methods to transfer the outline to the .glif file.</p>
<p>The GLIF format version will be chosen based on the ufoFormatVersion
passed during the creation of this object. If a particular format
version is desired, it can be passed with the formatVersion argument.</p>
</dd></dl>
</dd></dl>
<dl class="function">
<dt id="ufoLib.glifLib.readGlyphFromString">
<code class="descclassname">ufoLib.glifLib.</code><code class="descname">readGlyphFromString</code><span class="sig-paren">(</span><em>aString</em>, <em>glyphObject=None</em>, <em>pointPen=None</em>, <em>formatVersions=(1</em>, <em>2)</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/ufoLib/glifLib.html#readGlyphFromString"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#ufoLib.glifLib.readGlyphFromString" title="Permalink to this definition">¶</a></dt>
<dd><p>Read .glif data from a string into a glyph object.</p>
<p>The ‘glyphObject’ argument can be any kind of object (even None);
the readGlyphFromString() method will attempt to set the following
attributes on it:</p>
<blockquote>
<div>“width” the advance with of the glyph
“height” the advance height of the glyph
“unicodes” a list of unicode values for this glyph
“note” a string
“lib” a dictionary containing custom data
“image” a dictionary containing image data
“guidelines” a list of guideline data dictionaries
“anchors” a list of anchor data dictionaries</div></blockquote>
<dl class="docutils">
<dt>All attributes are optional, in two ways:</dt>
<dd><ol class="first last arabic simple">
<li>An attribute <em>won’t</em> be set if the .glif file doesn’t
contain data for it. ‘glyphObject’ will have to deal
with default values itself.</li>
<li>If setting the attribute fails with an AttributeError
(for example if the ‘glyphObject’ attribute is read-
only), readGlyphFromString() will not propagate that
exception, but ignore that attribute.</li>
</ol>
</dd>
</dl>
<p>To retrieve outline information, you need to pass an object
conforming to the PointPen protocol as the ‘pointPen’ argument.
This argument may be None if you don’t need the outline data.</p>
<p>The formatVersions argument defined the GLIF format versions
that are allowed to be read.</p>
</dd></dl>
<dl class="function">
<dt id="ufoLib.glifLib.writeGlyphToString">
<code class="descclassname">ufoLib.glifLib.</code><code class="descname">writeGlyphToString</code><span class="sig-paren">(</span><em>glyphName</em>, <em>glyphObject=None</em>, <em>drawPointsFunc=None</em>, <em>writer=None</em>, <em>formatVersion=2</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/ufoLib/glifLib.html#writeGlyphToString"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#ufoLib.glifLib.writeGlyphToString" title="Permalink to this definition">¶</a></dt>
<dd><p>Return .glif data for a glyph as a UTF-8 encoded string.
The ‘glyphObject’ argument can be any kind of object (even None);
the writeGlyphToString() method will attempt to get the following
attributes from it:</p>
<blockquote>
<div>“width” the advance width of the glyph
“height” the advance height of the glyph
“unicodes” a list of unicode values for this glyph
“note” a string
“lib” a dictionary containing custom data
“image” a dictionary containing image data
“guidelines” a list of guideline data dictionaries
“anchors” a list of anchor data dictionaries</div></blockquote>
<p>All attributes are optional: if ‘glyphObject’ doesn’t
have the attribute, it will simply be skipped.</p>
<p>To write outline data to the .glif file, writeGlyphToString() needs
a function (any callable object actually) that will take one
argument: an object that conforms to the PointPen protocol.
The function will be called by writeGlyphToString(); it has to call the
proper PointPen methods to transfer the outline to the .glif file.</p>
<p>The GLIF format version can be specified with the formatVersion argument.</p>
</dd></dl>
<dl class="function">
<dt id="ufoLib.glifLib.glyphNameToFileName">
<code class="descclassname">ufoLib.glifLib.</code><code class="descname">glyphNameToFileName</code><span class="sig-paren">(</span><em>glyphName</em>, <em>glyphSet</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/ufoLib/glifLib.html#glyphNameToFileName"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#ufoLib.glifLib.glyphNameToFileName" title="Permalink to this definition">¶</a></dt>
<dd><p>Wrapper around the userNameToFileName function in filenames.py</p>
</dd></dl>
</div>
</div>
</div>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<h4>Previous topic</h4>
<p class="topless"><a href="ufoLib.html"
title="previous chapter">ufoLib</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="pointPen.html"
title="next chapter">pointPen</a></p>
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../_sources/ufoLib/glifLib.rst.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
<h3>Quick search</h3>
<form class="search" action="../search.html" method="get">
<div><input type="text" name="q" /></div>
<div><input type="submit" value="Go" /></div>
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="pointPen.html" title="pointPen"
>next</a> |</li>
<li class="right" >
<a href="ufoLib.html" title="ufoLib"
>previous</a> |</li>
<li class="nav-item nav-item-0"><a href="../index.html">ufoLib 1.3.0a documentation</a> »</li>
</ul>
</div>
<div class="footer" role="contentinfo">
© Copyright 2017, Tal Leming, Erik van Blokland, Just van Rossum.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.6.5.
</div>
</body>
</html>
|