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

163 lines
4.5 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>Using the lib</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="index.html">
How to's
</a>
<br />
<a href="../objects/index.html">
Fab Objects
</a>
<br />
<a href="../objects/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 How To</a></p>
<br />
<br />
<p class="menu">
<a href="../objects/lib.html">RLib</a><br />
<a href="buildingaccents.html">Building accents</a><br />
<a href="fontlabremote.html">FontLab Remote</a><br />
<a href="generatefonts.html">Generate Fonts</a><br />
<a href="index.html">How To</a><br />
<a href="lowlevel.html">How to get to FontLab stuff</a><br />
<a href="scripting.html">Scripting</a><br />
<a href="understandcontours.html">Understanding Contours</a><br />
<a href="usepens.html">Using Pens</a><br />
<a href="world.html">The world module</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 class="content">
<h1>Using the lib</h1>
<p>
The lib is very much like a plain dictionary: you use keys to store stuff in it. The nice thing about them is that they save their contents in the font and are available (after the font is saved) to scripts the next time you open the file again. In FontLab the libs (because there are several) are stored in the .vfb source. In UFO based fonts the font.libs end up in their own, XML based .plist files, inside th UFO package. The Glyph.libs end up in the .glif files.
</p>
<h2>Which lib?</h2>
<p>
Sometimes it is handy to store values directly in the font that needs them. Rather than saving something in a seperate file (which could easily get lost), you can store data like this in the lib. A RFont has a lib and each single RGlyph has a lib as well.
RoboFog users might remember the various applications. It is likely that stuff will collect in the font and glyph libs, so it is wise to pay some attention to naming the entries. If you use undescriptive or generic names like 'a' or 'mydata', there's a chance that another script will overwrite the data. So the RoboFab developers propose to use the 'reverse domain name scheme' which works out something like this:
</p>
<pre>
# storing something that belongs to a letterror script
aFont.lib['com.letterror.develop.markers']
# storing something that belongs to a aFoundry script
aFont.lib['com.aFoundry.bud.notes']
</pre>
<p>
The lib is a flat dictionary. For RoboFog users: the RoboFog lib nested and tried to be very clever. Unfortunately it meant that sometimes data would get lots in confusing situations. A flat dictionary solves that.
</p>
<h2>Note</h2>
<p>
In FontLab version 4.5 and 4.6 there's a nasty bug which causes FontLab to crash after something has been added to the font.customdata or glyph.customdata fields. Unfortunately these fields were used to store the robofab.font.lib and robofab.glyph.lib data. We hope future versions of FontLab will address this. In UFO files the libs for font and glyphs work fine.
</p>
<h3>aFont.lib</h3>
<pre>
</pre>
<h3>anyGlyph.lib</h3>
<pre>
</pre>
</div>
</body>
</html>