<HTML> <HEAD> <!-- Created with AOLpress/2.0 --> <!-- AP: Created on: 26-Oct-2005 --> <!-- AP: Last modified: 8-Dec-2008 --> <TITLE>Building FontForge from source</TITLE> <LINK REL="icon" href="ffanvil16.png"> <LINK REL="stylesheet" TYPE="text/css" HREF="FontForge.css"> </HEAD> <BODY> <DIV id="in"> <H1 ALIGN=Center> FontForge build procedures </H1> <UL> <LI> <A HREF="nix-install.html#Installing">Installing from a pre-built unix package</A> <LI> <A HREF="mac-install.html#Installing">Installing on a Mac</A> <LI> <A HREF="ms-install.html#Installing">Installing on MS/Windows</A> <LI> <A HREF="#src-mac">Before you build (on a mac)</A> <LI> <A HREF="#src-MS">Before you build (on MS/Windows)</A> <LI> <A HREF="#src-source">Building and installing from source</A> <UL> <LI> <A HREF="#src-distribution">Obtaining a source distribution</A> <UL> <LI> <A HREF="#src-tarball">tarball</A> <LI> <A HREF="#src-cvs">from the cvs tree</A> </UL> <LI> <A HREF="#src-Building">Building & installing it</A> <LI> <A HREF="#src-installs">More complicated installs</A> (some configuration options) <LI> <A HREF="plugins.html">Building Plugins</A> <LI> <A HREF="uitranslationnotes.html">Creating user interface translations</A> </UL> <LI> <A HREF="#patch">Applying a patch</A> <LI> <A HREF="#Dependencies">Dependencies (external libraries/helper programs)</A> <LI> <A HREF="#suggested-fonts">Suggested fonts</A> <LI> <A HREF="#Documentation">Installing documentation</A> <UL> <LI> <A HREF="#doc-tar">Installing a documentation tarball</A> </UL> <LI> <A HREF="running.html">Running FontForge</A> <LI> <A HREF="uninstall.html">Uninstalling</A> </UL> <H2> Before you build (on a <A NAME="src-mac">mac</A>) </H2> <P> You must insure that you have the both the X11 server and the Xcode toolchain installed on your system. This process is slightly different on OS/X 10.3 & 10.4 <DL> <DT> 10.4 <DD> <UL> <LI> Open the Install DVD that came with your system. <LI> Scroll down to "Optional Installs" and open it. <LI> Keep clicking <CODE>Continue</CODE> until you get to the pane "Custom Install on "Macintosh HD"" <LI> Press the arrow beside "Applications" so you get a list of them. <LI> Select X11 <LI> Keep pressing <CODE>Continue</CODE> <HR> <LI> The Xcode toolchain is optional software on the install DVD. Simply insert the disk and click on the XCode install icon. </UL> <DT> 10.3 <DD> <UL> <LI> The X server lives in a package called X11User on the third install CD. <LI> You must also install the X11SDK package on the XCode CD <LI> And you must install the XCode tools themselves. </UL> </DL> <P> You may also want to install the <A HREF="http://fink.sourceforge.net/">fink</A> package which includes many useful libraries (see the <A HREF="#Dependencies">dependencies</A> section below for more info on this) <P> You must then start up a Terminal window (the Terminal Application also lives in the Utilities sub-folder of the Applications folder) and be prepared to type commands in that window (I know, it's very un-mac-like). <H3> Special note for building prior to 10.3 </H3> <P> OS/X has evolved over time. Certain system calls have changed. The current source distribution should work on any 10.3+ system. <P> If you wish to build on a 10.2 system you must say <BLOCKQUOTE id="shell"> <PRE><FONT COLOR="Gray">$ </FONT>./configure --with-regular-link </PRE> </BLOCKQUOTE> <P> (Rather than just saying <CODE>./configure</CODE>) <H2> Before you build (on <A NAME="src-MS">MS/Windows)</A> </H2> <P> You must download the <A HREF="http://www.cygwin.com/">cygwin</A> environment. You will need <UL> <LI> the basic cygwin packages <LI> the X11 package <LI> the xterm package <LI> binutils <LI> the package containing gcc, make (probably called c compiler development or something) <LI> You may want to download some additional optional packages to provide support for various image formats (See the <A HREF="#Dependencies">Dependencies</A> section below). </UL> <P> <FONT COLOR="Red"><STRONG>Caveat: </STRONG></FONT>cygwin has a different approach to the file system than Windows. A filename like <CODE>C:\windows\fonts\arial.ttf </CODE>will be called <CODE>/cygdrive/c/windows/fonts/arial.ttf </CODE>under cygwin (backslashes are replaced by slashes, and the initial drive "<CODE>C:</CODE>" becomes "<CODE>/cygdrive/c</CODE>" <P> Having done that you should now be ready to build. Open a cygwin terminal window and be prepared to type commands in it. <H2> Building and installing from <A NAME="src-source">source</A> </H2> <H3> Obtaining a source <A NAME="src-distribution">distribution</A> </H3> <P> There are two basic ways to obtain a source distribution. One is by downloading an entire source tree from the web, and the other is by using the cvs utility to maintain a source tree on your machine which will be as up to date as possible. The former solution provides more stability, the latter provides access to cutting edge bugs. <H4> <A NAME="src-tarball">tarball</A> </H4> <P> <A HREF="http://sourceforge.net/project/showfiles.php?group_id=103338&package_id=114328">Sourceforge's file release system </A>will contain a tarball (a file with the extension for .tar.bz2). <P> After you have downloaded one of these packages, either copy the tarball to where you are, or move to the directory containing the tarball (I can't provide explicit instructions here, because I don't know where your browser put the file) and type (do not type "$"): <BLOCKQUOTE id="shell"> <PRE><FONT COLOR="Gray">$ </FONT>bunzip2 fontforge*.tar.bz2 <FONT COLOR="Gray">$ </FONT>tar xf fontforge*.tar <FONT COLOR="Gray">$ </FONT>cd fontforge-* </PRE> </BLOCKQUOTE> <H4> from the <A NAME="src-cvs">cvs</A> tree </H4> <P> cvs is a nifty set of utilities which allows concurrent access to a source tree by many users. To set up your own (local) copy of the cvs tree (including documentation), create a new directory, cd into it and type the following (do not type "$", when it asks for a password, just hit return): <BLOCKQUOTE id="shell"> <PRE><FONT COLOR="Gray">$ </FONT>cvs -d:pserver:anonymous@fontforge.cvs.sourceforge.net:/cvsroot/fontforge login CVS password: <FONT COLOR="Gray">$ </FONT>cvs -d:pserver:anonymous@fontforge.cvs.sourceforge.net:/cvsroot/fontforge checkout fontforge <FONT COLOR="Gray">$ </FONT>cd fontforge </PRE> </BLOCKQUOTE> <P> Once you have established a directory you may update it to obtain the most recent version of the source by typing: <BLOCKQUOTE id="shell"> <PRE><FONT COLOR="Gray">$ </FONT>cd fontforge <FONT COLOR="Gray">$ </FONT>cvs -d:pserver:anonymous@fontforge.cvs.sourceforge.net:/cvsroot/fontforge login CVS password: <FONT COLOR="Gray">$ </FONT>cvs -d:pserver:anonymous@fontforge.cvs.sourceforge.net:/cvsroot/fontforge update </PRE> </BLOCKQUOTE> <P> You can also <A HREF="http://fontforge.cvs.sourceforge.net/fontforge/fontforge/">browse the CVS tree</A> online. Or see <A HREF="http://sourceforge.net/cvs/?group_id=103338">sourceforge's description </A>for more information, or read the <A HREF="http://www.cvshome.org/docs/manual/">CVS manual</A>. <H3> <A NAME="src-Building">Building</A> & installing it </H3> <P> Now you have the source installed on your system and you should be positioned at the top directory of that tree. You need to configure your package (this is a little program that figures out how to use your system), and then build it (do not type the "$"): <BLOCKQUOTE id="shell"> <PRE><FONT COLOR="Gray">$ </FONT>./configure <FONT COLOR="Gray">$ </FONT>make </PRE> </BLOCKQUOTE> <P> <A NAME="su">Having</A> done this you will probably want to install what you have built. This should be done as root: <BLOCKQUOTE id="shell"> <PRE><FONT COLOR="Gray">$ </FONT>su <FONT COLOR="Gray">password:</FONT> ****** <FONT COLOR="Gray"># </FONT>make install </PRE> </BLOCKQUOTE> <P> On the mac the process is slightly different: <BLOCKQUOTE id="shell"> <PRE><FONT COLOR="Gray">$ </FONT>sudo make install <FONT COLOR="Gray">password:</FONT> ****** </PRE> </BLOCKQUOTE> <P> While on cygwin, where there is no root, you just say: <BLOCKQUOTE id="shell"> <PRE><FONT COLOR="Gray">$ </FONT>make install </PRE> </BLOCKQUOTE> <H3> More complicated <A NAME="src-installs">installs</A> </H3> <P> The configure script allows you to turn off and on various features of fontforge that might not be appropriate for your system. Type <BLOCKQUOTE id="shell"> <PRE><FONT COLOR="Gray">$ </FONT>./configure --help </PRE> </BLOCKQUOTE> <P> for a complete list of options. Some of the most useful are described below. <H4> Building fontforge without X </H4> <P> If you don't want to install X11 on your system, you can use fontforge as a command line tool which can execute scripts to manipulate fonts. FontForge's scripting language is described in detail <A HREF="scripting.html">in the section on scripting</A>, or the <A HREF="python.html">section on python scripting</A>. <BLOCKQUOTE id="shell"> <PRE><FONT COLOR="Gray">$ </FONT>./configure --without-x </PRE> </BLOCKQUOTE> <H4> Building fontforge to edit type3 fonts </H4> <P> If you do want to edit PostScript type3 fonts, you can configure fontforge to give you access to more drawing modes than are generally available in fonts. <BLOCKQUOTE id="shell"> <PRE><FONT COLOR="Gray">$ </FONT>./configure --enable-type3 </PRE> </BLOCKQUOTE> <H4> Building fontforge to edit device tables </H4> <P> If you do want to create device tables (which allow you to fix up kerning data at a specific pixel size) in OpenType fonts <BLOCKQUOTE id="shell"> <PRE><FONT COLOR="Gray">$ </FONT>./configure --enable-devicetables </PRE> </BLOCKQUOTE> <H4> Building fontforge to use higher precision internally </H4> <P> FontForge generally uses floats to represent coordinates. If you need greater accuracy... <BLOCKQUOTE id="shell"> <PRE><FONT COLOR="Gray">$ </FONT>./configure --enable-double </PRE> </BLOCKQUOTE> <H4> Building fontforge with the tile path command available </H4> <P> FontForge has a command which lets you tile a pattern along a path. Generally this is disabled as it isn't what most fonts will use, but for some decorative fonts it can be useful. <BLOCKQUOTE id="shell"> <PRE><FONT COLOR="Gray">$ </FONT>./configure --enable-tilepath </PRE> </BLOCKQUOTE> <H4> Building fontforge (also) as a python extension </H4> <P> If you want to write python scripts in normal python (as opposed to within the python embedded in fontforge) <BLOCKQUOTE id="shell"> <PRE><FONT COLOR="Gray">$ </FONT>./configure --enable-pyextension </PRE> </BLOCKQUOTE> <H4> Installing FontForge somewhere other than <CODE>/usr/local</CODE> </H4> <P> If you want to install fontforge in a different directory (say in /usr/bin) <BLOCKQUOTE id="shell"> <PRE><FONT COLOR="Gray">$ </FONT>./configure --prefix=/usr </PRE> </BLOCKQUOTE> <H4> Installing <A NAME="installing-documentation-cvs">documentation</A> from the cvs tree </H4> <P> If you have a copy of the cvs tree on your system then you should be able to type <BLOCKQUOTE id="shell"> <PRE><FONT COLOR="Gray"># </FONT>make install_docs </PRE> </BLOCKQUOTE> <P> Again you will probably need to be root to do this install too. Use either "su" or "sudo" as appropriate for your system (<A HREF="#su">see above</A>). <H2> Applying a <A NAME="patch">patch</A> </H2> <P> From time to time someone will report a bug or request a feature and I will reply by sending a patch which purports to fix the bug or implement the feature. But how do you use the patch file I sent? <P> patch is a standard unix utility (Try typing $ man patch, for more info) which will make changes to text files. I use it to modify the source files of FontForge. <P> So before you can apply the patch you must <A HREF="source-build.html#src-distribution">have the source code </A>available to you. If you choose to download from the cvs tree, then, in all probability, the patch will already have been applied (so you don't need to do anything with it). But if you download one of my tarballs then you will need to apply the patch: <BLOCKQUOTE id="shell"> <PRE><FONT COLOR="Gray">$ </FONT>bunzip2 fontforge*.tar.bz2 <FONT COLOR="Gray">$ </FONT>tar xf fontforge*.tar <FONT COLOR="Gray">$ </FONT>cd fontforge-*/fontforge <FONT COLOR="Gray">$ </FONT>patch <foobar.patch <FONT COLOR="Gray">$ </FONT>cd .. <FONT COLOR="Gray">$ </FONT>./configure <FONT COLOR="Gray">$ </FONT>make <FONT COLOR="Gray">$ </FONT>make install </PRE> </BLOCKQUOTE> <H2> <A NAME="Dependencies">Dependencies</A> (external libraries/helper programs) </H2> <P> FontForge tries to avoid hard dependencies. If a library is missing then fontforge will (in most cases, but not on cygwin) be able to continue to run, it will just lack whatever functionality the library provides. So if you don't need to import tiff images, you don't need libtiff. If you don't need to handle SVG fonts you don't need libxml2, etc. <H3> Executables </H3> <P> If you want to do autotracing around character images you should also download either <UL> <LI> Peter Selinger's <A HREF="http://potrace.sf.net/">potrace</A> <LI> Martin Weber's <A HREF="http://sourceforge.net/projects/autotrace/">autotrace program.</A> </UL> <H3> Libraries </H3> <P> None is required for the proper compilation/execution of FontForge, if the libraries are not present they will not be used. (If the machine on which your executable was build didn't have them, then you must not only install the libraries, but <A HREF="#source">rebuild fontforge from source</A>) If your machine doesn't have them and you want them they are available from: <UL> <LI> Image Libraries (to allow FontForge to import images in those formats generally used as backgrounds for autotracing) <UL> <LI> <A HREF="http://www.libpng.org/pub/png/libpng.html">libpng</A> (and required helper <A HREF="http://www.gzip.org/zlib/">zlib</A>) <LI> <A HREF="http://www.libtiff.org/">libtiff</A> <LI> <A HREF="http://gnuwin32.sourceforge.net/packages/libungif.htm">libungif</A> <LI> <A HREF="http://www.ijg.org/">libjpeg</A> </UL> <LI> <A HREF="http://xmlsoft.org/">libxml2</A><BR> To parse SVG files and fonts <LI> <A HREF="http://libspiro.sf.net/">libspiro</A><BR> Raph Levien's clothoid to bezier spline conversion routines. If this is available fontforge will allow you to edit with clothoid splines (spiro). <LI> <A HREF="http://libuninameslist.sf.net">libuninameslist</A><BR> To display unicode names and annotations. <LI> <A HREF="http://www.gnu.org/software/libiconv/">libiconv</A><BR> Only important for systems with no built-in iconv(). If not present FontForge contains a minimal version of the library which allows it to work. But if you want to use libiconv you must configure it with <CODE>--enable-extra-encodings</CODE>, as FontForge requires Shift-JIS. <LI> <A HREF="http://freetype.sf.net/">freetype</A><BR> To do a better job rasterizing bitmaps, and to enable the truetype debugger <TABLE BORDER CELLPADDING="6" WIDTH="50%" ALIGN=CENTER> <TR> <TD BGCOLOR="#ffff00">Some of FontForge's commands depend on your compiling freetype with the byte code interpreter enabled. This is disabled by default because it infringes on certain <A HREF="http://freetype.sourceforge.net/patents.html">patents granted to Apple</A>. If you have a license from Apple (or live in a country where these patents do not apply) then you may enable the interpreter by setting the appropriate macro in .../include/freetype/config/ftoption.h before you build the library (see the README.UNX file on the top level of the freetype distribution). <P> To enable the truetype debugger, FontForge needs to have the freetype source directories available when it is built (there are some include files there which it depends on)</TD> </TR> </TABLE> <LI> <A HREF="http://www.cygwin.com/">cygwin</A><BR> To build or run on a MS Windows system you need the cygwin environment and libraries. <LI> libintl<BR> Is standard on most unixes. It is part of the fink package on the mac. Handles UI localization. <LI> <A HREF="http://www.python.org/">libpython</A><BR> If present when FontForge is compiled, allows the user to execute python scripts within fontforge (and you can configure fontforge so that fontforge's functionality can be imported into python -- that is fontforge both <I>extends</I> and <I>embeds</I> python) <LI> <A HREF="http://x.org/">libX</A><BR> Normally FontForge depends on the X11 windowing system, but if you are just interested in the scripting engines (with no user interface), it may be built on systems without X (the configure script should figure this out). <LI> <A HREF="http://www.cairographics.org/">libcairo</A><BR> Cairo handles drawing anti-aliased splines in the outline glyph view. It is dependent on libfontconfig, libXft and perhaps other libraries. <LI> <A HREF="http://www.pango.org/">libpango</A><BR> Pango draws text for complex scripts. It depends on glib-2.0, libfontconfig, libfreetype, libXft, and perhaps other libraries. <LI> Under Mac OS/X these libraries are available from the <A HREF="http://fink.sourceforge.net/">fink project</A> and from <A HREF="http://www.macports.org/">macports</A>. <HR> <STRONG>Sadly one important library is hard to find in fink's distributions for Mac X.5. I have bundled up all the (fink) libraries used by fontforge and provide them in a <A href="http://sourceforge.net/project/showfiles.php?group_id=103338&package_id=302003&release_id=645772"> package of my own</A>.</STRONG> </UL> <H3> Extra Files </H3> <P> If you want to edit <A NAME="cidmaps">CID keyed </A>fonts you need these <A HREF="cidmaps.tgz">character set descriptions</A>. (These were last updated 22-Dec-2004) <P> <A NAME="suggested-fonts">Once</A> upon a time, fontforge only used X11 bitmap fonts, on most systems in now uses fontconfig. <P> There seem plenty of good unicode outline fonts, so I shan't provide any suggestions. To install them you simply create a subdirectory called .fonts in your home directory, and then copy the font file into that subdirectory. <P> <FONT COLOR="RED"><STRONG>Warning for mac users:</STRONG> pango uses opentype to layout complex scripts. Most fonts on the macintosh are in a different format -- glyphs from them will display fine (so they work for latin, greek cyrillic, japanese, chinese, etc.) but more complex features will probably not work (so Arabic and Indic scripts may not be displayed properly).</FONT> <P> In the old days there weren't many bitmap fonts with good unicode coverage so I provided a list of suggested fonts. That's not nearly as important now. But if fontconfig isn't available for you, you might want to pull down some old unicode bitmap fonts. <UL> <LI> <A HREF="http://khdd.net/kanou/fonts/ff/fontviewfont-en.html">Kanou's fontview fonts</A> <A HREF="http://khdd.net/kanou/fonts/ff/fontviewfont.html"><IMG SRC="flags/Nisshoki-Japan.png" WIDTH="39" HEIGHT="26" ALIGN="Middle"></A> <LI> <A HREF="http://czyborra.com/unifont/">The unifont</A> <LI> <A HREF="http://clr.nmsu.edu/~mleisher/cu.html">ClearlyU's font</A> <LI> <A HREF="http://www.nongnu.org/freefont/">The FreeFont project</A> <LI> <A HREF="http://www.cl.cam.ac.uk/~mgk25/ucs-fonts.html">X fixed</A> <LI> <A HREF="http://canopus.iacp.dvo.ru/~panov/cm-unicode/">Computer Modern Unicode fonts</A> <LI> <A HREF="http://eyegene.ophthy.med.umich.edu/unicode/fontguide/">Unicode Font Guide for Free/Libre Open Source Operating Systems</A> <HR> <LI> <A HREF="nonBMP/index.html">FontForge's conventions for non-BMP unicode bitmap fonts</A> </UL> <P> To install these, put them in a directory, and in that directory type: <BLOCKQUOTE id="shell"> <PRE> <FONT COLOR="Gray">$ </FONT>mkfontdir <FONT COLOR="Gray">$ </FONT>xset fp+ `pwd` </PRE> </BLOCKQUOTE> <P> You should make sure that the xset line happens whenever X is started on your machine (put it in your .xsession file). <H2> <A NAME="Documentation">Documentation</A> </H2> <P> <A HREF="overview.html">The complete fontforge manual is available online.</A> <UL> <LI> A documentation tarball can be retrieved from the <A HREF="http://sourceforge.net/project/showfiles.php?group_id=103338&package_id=114329">file release system</A> <LI> A Japanese<IMG SRC="flags/Nisshoki-Japan.png" WIDTH="39" HEIGHT="26" ALIGN="Middle"> <A HREF="fontforge_ja_htdocs-20060822.tar.bz2">tarball</A> (Version 22-Aug-2006) <STRONG>Out of Date!</STRONG> <LI> There is a shorter tutorial which <UL> <LI> <A HREF="editexample.html">Is available online</A> <LI> <A HREF="ja/editexample.html"><SPAN class="jatutorial"><SPAN> </SPAN></SPAN></A><IMG SRC="spacer1x20.png" HEIGHT=20 WIDTH=1 ALIGN="Top"><STRONG>Out of Date!</STRONG> <LI> <A HREF="http://edt1023.sayya.org/fontforge/editexample.html"><SPAN class="zhtutorial"><SPAN> </SPAN></SPAN> </A><IMG SRC="spacer1x20.png" HEIGHT=20 WIDTH=1 ALIGN="Top"><STRONG>Out of Date!</STRONG> <LI> <A HREF="de/editexample.html"><IMG SRC="flags/GermanFlag.png" WIDTH="39" HEIGHT="26" BORDER="0"></A><STRONG>Out of Date!</STRONG> <LI> <A HREF="fontforge-tutorial.pdf">Can be downloaded as pdf</A> <LI> <A HREF="tutorial.tgz">example files </A>(to work through the tutorial yourself) </UL> <LI> The cvs tree contains a sub-directory called htdocs containing the manual <UL> <LI> The cvs tree contains a sub-sub-directory called htdocs/ja containing the Japanese translation of the manual </UL> <P> See the general comments on the <A HREF="#src-cvs">cvs tree </A>to see how to access this.<BR> See the section on <A HREF="#installing-documentation-cvs">installing cvs documentation </A>to see how to install the docs from the cvs tree </UL> <H3> <A NAME="doc-tar">Installing a documentation tarball</A> </H3> <P> Once you have downloaded the documentation tarball as described above, you should move to the directory containing it, and type: <BLOCKQUOTE id="shell"> <PRE><FONT COLOR="Gray">$ </FONT>su password: ****** <FONT COLOR="Gray"># </FONT>mkdir -p /usr/local/share/doc/fontforge <FONT COLOR="Gray"># </FONT>mv fontforge_htdocs*.tar.bz2 /usr/local/share/doc/fontforge <FONT COLOR="Gray"># </FONT>cd /usr/local/share/doc/fontforge <FONT COLOR="Gray"># </FONT>tar xfj fontforge_htdocs*.tar.bz2 <FONT COLOR="Gray"># </FONT>rm fontforge_htdocs*.tar.bz2 </PRE> </BLOCKQUOTE> <P> After doing this fontforge will be able to find the docs on your system when you press the [F1] (or [Help]) key. If you don't do this fontforge will attempt to find documentation online. <P> (on some strict unix systems you may need to do the following instead) <BLOCKQUOTE id="shell"> <PRE><FONT COLOR="Gray">$ </FONT>su password: ****** <FONT COLOR="Gray"># </FONT>mkdir -p /usr/local/share/doc/fontforge <FONT COLOR="Gray"># </FONT>mv fontforge_htdocs*.tar.bz2 /usr/local/share/doc/fontforge <FONT COLOR="Gray"># </FONT>cd /usr/local/share/doc/fontforge <FONT COLOR="Gray"># </FONT>bunzip2 fontforge_htdocs*.tar.bz2 <FONT COLOR="Gray"># </FONT>tar xf fontforge_htdocs*.tar <FONT COLOR="Gray"># </FONT>rm fontforge_htdocs*.tar </PRE> </BLOCKQUOTE> <P> <HR> <UL> <LI> <A HREF="running.html">Running FontForge</A> </UL> </DIV> </BODY></HTML>