# FontForge install procedures
for cygwin under MS Windows

- Installing from a pre-built cygwin package
  - Before you install
  - Obtaining one of my pre-built packages
  - Installing
  - Notes
- Before you build (on MS/Windows)
- Building and installing from source
  - Obtaining a source distribution
    - tarball
    - from the cvs tree
  - Building & installing it
  - More complicated installs
- Dependencies (external libraries/helper programs)
- Suggested fonts
- Installing documentation
  - Installing a documentation tarball
- Some notes on the PATH variable
- Running FontForge
- Reporting Bugs

## Installing from a pre-built package

### Before you install

You must insure that you have cygwin installed on your system. Cygwin is free. (cygwin makes MS Windows look enough like unix to allow fontforge to run there). Getting all the bits of cygwin seems to be the hardest part of installing fontforge -- probably because it is the least expected part.

- First download the setup.exe program from http://www.cygwin.com/
- Run it. It will ask you what components of cygwin you wish to install
- You will need the default stuff, plus the X window system

  Most of what you need you get by default. But you must explicitly request X11. Scroll down the list of catagories:

  - Near (or at) the bottom, click on the [+] beside X11. Then make sure the following are selected:
    - X-startup-scripts
    - XFree86-lib-compat
    - xorg-x11-base
    - xorg-x11-bin
    - xorg-x11-dlls
    - xorg-x11-lndir
    - xorg-x11-etc
    - xorg-x11-f100
    - xorg-x11-libs-data
    - xorg-x11-xwin
    - xterm
- Once you have cygwin installed, start it. This should give you a terminal window running bash (a unix shell)

### Obtaining one of my pre-built packages

I post a cygwin install package on sourceforge's file release system. There's a certain amount of pother involved in using the file release system, but you get the file eventually.

- If you follow the link above you will end up on a page showing many releases of FontForge for many systems
  in most cases you will want the most recent release.
- Then click on the executable package you want to download:
  - The cygwin release will be called something like "fontforge_cygwin-200xxxxx.tar.bz2
- Then you have the joy of choosing a mirror site (pick one that's on the same continent you are) and click on the little icon in the download column
- Then you wait. After a bit you get another copy of this same page. After an even longer time your browser notices that you've started a download.

### Installing

I have no idea where your browser put the package you have just downloaded. This is unfortunate as I can't tell you exactly what to do next. But find the package (often it's on the desktop) and then move it into C:\cygwin\home\<username>. (where <username> is whatever name cygwin gave you)

- Then open a cygwin window (by clicking on the cygwin icon)
- With luck you will now be in the directory containing the package you downloaded.
- Now type (The "$" or "#" are example prompts from the computer. Do not type them yourself):

  >     $ bunzip2 fontforge_cygwin-*.tar.bz2
  >     $ tar xf fontforge_cygwin-*.tar
  >     $ cd fontforge
  >     $ ./doinstall

- Then edit the file ~/.bashrc by (end this by typing control-D):

- >     $ cat >> ~/.bashrc
  >     PATH=${PATH}:/usr/local/bin ; export PATH
  >     MANPATH=${MANPATH:-}:/usr/local/man ; export MANPATH
  >     ^D

- Then each time you want to run fontforge, type:

  >     $ xinit

- This should bring up X in a large window that covers the screen and within that should be a subwindow, an xterm, running bash.
- From the xterm you should first start a window manager:

  >     $ twm &

- And then you will be able start FontForge.

  >     $ fontforge -new

### Notes

Caveat: cygwin has a different approach to the file system than Windows. A filename like `C:\windows\fonts\arial.ttf` will be called `/cygdrive/c/windows/fonts/arial.ttf` under cygwin (backslashes are replaced by slashes, and the initial drive "`C:`" becomes "`/cygdrive/c`".

Similarly a cygwin filename "`/home/<username>/myfont.ttf`" becomes "`C:\cygwin\home\<username>\myfont.ttf`"

Caveat: Do NOT try to install a font by using fontforge to write the font directly to the Windows\Fonts directory. This doesn't work. Windows needs to do some magic when installing a font that it can't do if fontforge writes directly there. Instead have fontforge create the font somewhere else and then use Windows' own drag & drop technique to move the font from there into Windows\Fonts.

## Before you build (on MS/Windows)

You must download the cygwin environment. You will need

- the basic cygwin packages
- the X11 package
- the xterm package
- the package containing gcc, make (probably called c compiler development or something)
- You may want to download some additional optional packages to provide support for various image formats (See the Dependencies section below).

Caveat: cygwin has a different approach to the file system than Windows. A filename like `C:\windows\fonts\arial.ttf` will be called `/cygdrive/c/windows/fonts/arial.ttf` under cygwin (backslashes are replaced by slashes, and the initial drive "`C:`" becomes "`/cygdrive/c`"

Having done that you should now be ready to build. Open a cygwin terminal window and be prepared to type commands in it.

## Building and installing from source

### Obtaining a source distribution

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.

#### tarball

Sourceforge's file release system will contain a tarball (a file with the extension for .tar.bz2).

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 (The "$" or "#" are example prompts from the computer. Do not type them yourself):

>     $ bunzip2 fontforge*.tar.bz2
>     $ tar xf fontforge*.tar
>     $ cd fontforge-*

#### from the cvs tree

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 (when it asks for a password, just hit return):

>     $ cvs -d:pserver:anonymous@cvs1.sourceforge.net:/cvsroot/fontforge login
>     CVS password:
>     $ cvs -d:pserver:anonymous@cvs1.sourceforge.net:/cvsroot/fontforge checkout fontforge
>     $ cd fontforge

Once you have established a directory you may update it to obtain the most recent version of the source by typing:

>     $ cd fontforge
>     $ cvs -d:pserver:anonymous@cvs1.sourceforge.net:/cvsroot/fontforge login
>     CVS password:
>     $ cvs -d:pserver:anonymous@cvs1.sourceforge.net:/cvsroot/fontforge update

You can also browse the CVS tree online. Or see sourceforge's description for more information (their information is out of date, the correct server is cvs1.sf.net not cvs.sf.net), or read the CVS manual.

### Building & installing it

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:

>     $ ./configure
>     $ make

Having done this you will probably want to install what you have built. This should be done as root:

>     $ su
>     password: ******
>     # make install

On the mac the process is slightly different:

>     $ sudo make install
>     password: ******

### More complicated installs

The configure script allows you to turn off and on various features of fontforge that might not be appropriate for your system. Type

>     $ configure --help

for a complete list of options. Some of the most useful are described below.

#### Building fontforge without X

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 in the section on scripting.

>     $ configure --without-x

#### Building fontforge to edit type3 fonts

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.

>     $ configure --with-multilayer

#### Building fontforge to edit device tables

If you do want to create device tables (which allow you to fix up kerning data at a specific pixel size) in OpenType fonts

>     $ configure --with-devicetables

#### Installing FontForge somewhere other than `/usr/local`

If you want to install fontforge in a different directory (say in /usr/bin)

>     $ configure --prefix=/usr

#### Installing documentation from the cvs tree

If you have a copy of the cvs tree on your system then you should be able to type

>     # make install_docs

Again you will probably need to be root to do this install too. Use either "su" or "sudo" as appropriate for your system (see above).

## Dependencies (external libraries/helper programs)

FontForge tries to avoid hard dependencies. If a library is missing then fontforge will (in most cases) 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 hand SVG fonts you don't need libxml2, etc.

If you want to do autotracing around character images you should also download either

- Peter Selinger's potrace
- Martin Weber's autotrace program.

If you want to edit CID keyed fonts you need these character set descriptions. (These were last updated 22-Dec-2004)

You might want this addition to FontForge's built in character set encodings. Use FontForge's Encoding->Load Encoding command to add these encodings to the Encoding Menu.

With the appropriate libraries, FontForge can import png, tiff, and gif images to act as character backgrounds for tracing purposes (FontForge can import bmp and xbm formats without external libraries). With libxml2 FontForge can read SVG fonts. With the freetype library FontForge will do a better job making bitmap characters for you. libuninameslist provides standard unicode names and annotations for unicode characters (it has been localized into English and French)

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 rebuild fontforge from source) If your machine doesn't have them and you want them they are available from:

- Image Libraries (to allow FontForge to import images in those formats)
  - libpng (and required helper zlib)
  - libtiff
  - libungif
  - libjpeg
- Under Mac OS/X these libraries are available from the fink project.
- libxml2
  To parse SVG files and fonts
- libuninameslist
  To display unicode names and annotations.
- libiconv
  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 `--enable-extra-encodings`, as FontForge requires Shift-JIS.
- freetype
  To do a better job rasterizing bitmaps, and to enable the truetype debugger

  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 patents granted to Apple. 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).

  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)

- cygwin
  To build or run on a MS Windows system you need the cygwin environment and libraries.

Versions of shared libraries in my builds
| libpng | libtiff | libungif | libjpeg | libxml2 | libuninameslist | freetype
i386 linux builds | 3.1.2.2 =1.2.2 | 3.5 =20011128 | 4.1.0 =4 | 62.0.0 =62 (6b) | 2.5.4 =2.5.4 | 0.0.1 | 6.3.3 =2.1.9

solaris builds

2
=1.0.8

3
=19970127

6
=62 (6b)

Mac OS/X builds

(static)

(static)

(static)

2.5.0
=2.5.0

6.3.3
=2.1.4

Normally FontForge depends on the X11 windowing system, but if you are just interested in the scripting engine (with no user interface), it may be built on systems without X (the configure script should figure this out).

You might also want to pull down some unicode bitmap fonts that fontforge uses

- my monospace fonts
- my sans-serif font
- The unifont
- ClearlyU's font
- The FreeFont project
- X fixed
- Computer Modern Unicode fonts
- Unicode Font Guide for Free/Libre Open Source Operating Systems

- FontForge's conventions for non-BMP unicode bitmap fonts

To install these, put them in a directory, and in that directory type:

>         $ mkfontdir
>         $ xset fp+ `pwd`

You should make sure that the xset line happens whenever X is started on your machine (put it in your .xsession file).

## Documentation

The complete fontforge manual is available online.

- There is a shorter tutorial which
  - Is available online
  - Can be downloaded as pdf
  - example files (to work through the tutorial yourself)
- A documentation tarball can be retrieved from the file release system
- The cvs tree contains a sub-directory called htdocs containing the manual
  - The cvs tree contains a sub-sub-directory called htdocs/ja containing the Japanese translation of the manual

  See the general comments on the cvs tree to see how to access this.
  See the section on installing cvs documentation to see how to install the docs from the cvs tree

### Installing a documentation tarball

Once you have downloaded the documentation tarball as described above, you should move to the directory containing it, and type:

>     $ su
>     password: ******
>     # mkdir -p /usr/local/share/doc/fontforge
>     # mv fontforge_htdocs*.tgz /usr/local/share/doc/fontforge
>     # tar xfz fontforge_htdocs*.tgz
>     # rm fontforge_htdocs*.tgz

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.

## Starting FontForge

### Before starting fontforge on cygwin

Before you can start fontforge on cygwin you must start the X11 server.

Open a cygwin window and type

>     $ xinit

This should create a task window that covers your entire screen, inside of which there should be an xterm (sort of like the cygwin window earlier). Be prepared to type commands in this window.

The first command you must type will start a window manager (which allows you to move windows around and gives you title bars)

>     $ twm &

### Notes on the PATH variable

On most systems fontforge will install itself into `/usr/local/bin` (that's the standard place for optional software), and this is not always in the default search path for commands (grrrr). Which means you might have everything properly installed, but nothing actually works. If you see messages like `"fontforge: command not found."` this has (probably) happened to you.

So what do you do?

You need to set the PATH environment variable so that it includes /usr/local/bin. The value of the PATH variable is a set of directories separated by colons.

>     $ echo $PATH
>     /home/gww/bin:/usr/bin:/bin:/usr/X11R6/bin:/sbin

Unfortunately there are two ways of doing this because there are two different conventions used by unix shells. Type:

>     $ echo $SHELL
>     /bin/bash

If the name of your shell is `bash` (as above), `ksh` or `sh` then you want to type

>     $ PATH=/usr/local/bin:$PATH ; export PATH

If the name of your shell is `tcsh` or `csh` then you say

>     $ setenv PATH /usr/local/bin:$PATH

But you'd have to do that every time you logged in. Instead you want this included in the shell's initialization. Again there are two cases, for the `bash` family of shells you want to edit the file `~/.profile` while for the `csh` family you want to edit the file `~/.login`. On a bash system the following command is generally sufficient:

>     $ cat >>~/.profile
>     PATH=/usr/local/bin:$PATH ; export PATH
>     ^D

(where `^D` represents control-D, obtained by holding down the control key while depressing `d`.
And for the csh family you would type:

>     $ cat >>~/.login
>     setenv PATH /usr/local/bin:$PATH
>     ^D

### Starting fontforge from the command line

> `$ fontforge font.pfa font2.sfd font3.ttf font4.otf`

will start fontforge looking at the fonts you specify on the command line. It can read either pfb or pfa fonts, and some ps fonts (type 0 fonts based on a type 1 dictionary) as well as truetype fonts, open type fonts and many other formats.

> `$ fontforge -new`

will cause fontforge to create a new font (in iso-8859-1 encoding)

> `$ fontforge`

will open up a file picker dialog and allow you to browse till you've found a font file (or have created a new one).

> `$ fontforge -script script.pe fonts...`

This will invoke fontforge in a non-interactive mode, and have it run the named script. Any further arguments on the command line will be passed as arguments to the script and processed (or not) by it.

## Reporting Bugs

Please report bugs by sending an e-mail to fontforge-devel@lists.sourceforge.net