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

205 lines
5.3 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>How to: Generate Fonts</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/font.html">RFont</a><br />
<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="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="usethelib.html">Using the lib</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>Generating Fonts</h1>
<p>
A RFont object in FontLab can call FontLab to generate fonts. Generating fonts can be time consuming, even when all the right parameters are set. So this is a nice candidate for automation. First of all a generator script will give you consistency between generations and versions. But also it means you can set a machine to work to generate batches of fonts and focus on more creative tasks.
</p>
<p>
Note: the generate method only calls on FontLab to generate the fonts in a particular format. It does not prepare the font data for that specific format, i.e. for example when you're generating for PC Truetype, generate() won't select the appropriate encodings or special windows flags. You need to do that.
</p>
<h3>RFont.generate(outputType, path=None)</h3>
<p>
Generate the font. outputType is the type of font to output. An overview of available output Types in FontLab:
</p>
<ul>
<li>
<strong>pctype1</strong>:PC Type 1 font (binary/PFB)
</li>
<li>
<strong>pcmm</strong>: PC MultipleMaster font (PFB)
</li>
<li>
<strong>pctype1ascii</strong>: PC Type 1 font (ASCII/PFA)
</li>
<li>
<strong>pcmmascii</strong>: PC MultipleMaster font (ASCII/PFA)
</li>
<li>
<strong>mactype1</strong>:Mac Type 1 font (generates suitcase and LWFN file)
</li>
<li>
<strong>otfcff</strong>: PS OpenType (CFF-based) font (OTF)
</li>
<li>
<strong>otfttf</strong>: PC TrueType/TT OpenType font (TTF)
</li>
<li>
<strong>macttf</strong>: Mac TrueType font (generates suitcase)
</li>
<li>
<strong>macttdfont</strong>: Mac TrueType font (generates suitcase with resources in data fork)
</li>
<li>
(doc adapted from http://dev.fontlab.net/flpydoc/)
</li>
</ul>
<h3>Notes</h3>
<p>
<strong>path</strong> can be a directory or a directory file name combo:
</p>
<ul>
<li>
path=&quot;DirectoryA/DirectoryB&quot;
</li>
<li>
path=&quot;DirectoryA/DirectoryB/MyFontName&quot;
</li>
<li>
path=&quot;DirectoryA/DirectoryB/ < filename >&quot;
</li>
</ul>
<p>
If no <strong>path</strong> is given, the file will be output in the same directory as the vfb file. If no <strong>filename</strong> is given, the filename will be the vfb file name with the appropriate suffix.
</p>
<h2>Examples</h2>
<p>
FontLab can generate many different formats for different platforms. Please refer to the FontLab manual for specifics. Some formats generate several files, others only one. Some formats are not available in all versions of FontLab.
</p>
<pre>
import os.path
from robofab.world import CurrentFont
font = CurrentFont()
path = font.path
dir, fileName = os.path.split(path)
path = os.sep.join([dir, font.info.fullName])
font.generate('mactype1', path)
</pre>
</div>
</body>
</html>