|
1 | 1 | # fontmake-mp [](https://semaphoreci.com/sourcefoundry/fontmake-mp)
|
2 | 2 |
|
3 |
| -Concurrent font compilation from UFO source files with fontmake |
| 3 | + |
| 4 | +## About |
| 5 | + |
| 6 | +fontmake-mp is a Python script (`fmp.py`) that adds parallel UFO source compilation support to the [fontmake](https://github.com/googlei18n/fontmake) font compiler. It supports automation of parallel UFO compilation up to the number of available cores on your system. |
| 7 | + |
| 8 | +And it makes a difference. |
| 9 | + |
| 10 | + |
| 11 | + |
| 12 | +<img src="https://github.com/source-foundry/fontmake-mp/raw/master/img/benchmarks-crunch.png" alt="fontmake-mp benchmarks" /> |
| 13 | + |
| 14 | + |
| 15 | + |
| 16 | +## Install |
| 17 | + |
| 18 | +### Install fontmake |
| 19 | +fontmake must be installed on your system to use this script. You can install fontmake with the command: |
| 20 | + |
| 21 | +``` |
| 22 | +$ pip install fontmake |
| 23 | +``` |
| 24 | + |
| 25 | +### Download the fmp.py script |
| 26 | + |
| 27 | +Download the executable Python script with either of the following approaches: |
| 28 | + |
| 29 | +##### 1. cURL approach |
| 30 | + |
| 31 | +Use cURL to pull `fmp.py` to the location where you would like to execute the file: |
| 32 | + |
| 33 | +``` |
| 34 | +$ curl -L -O https://raw.githubusercontent.com/source-foundry/fontmake-mp/master/fmp.py |
| 35 | +``` |
| 36 | + |
| 37 | +##### 2. Download and unpack .zip archive |
| 38 | + |
| 39 | +[Download the .zip archive of the source repository](https://github.com/source-foundry/fontmake-mp/archive/master.zip), unpack it, and move the `fmp.py` script to the location of your choice on your system. You can discard all other repository files and the unpacked repository directory. |
| 40 | + |
| 41 | +## Usage |
| 42 | + |
| 43 | +By default, `fmp.py` build both `.ttf` and `.otf` fonts during the compilation process. This can be modified as necessary to one or the other of these file types (see Manual modifications section below). |
| 44 | + |
| 45 | +The format for command line usage is the following: |
| 46 | + |
| 47 | +``` |
| 48 | +$ python fmp.py [UFO path 1] [UFO path 2] ... [UFO path n] |
| 49 | +``` |
| 50 | + |
| 51 | +Faster compiles can be achieved for some users with the use of the PyPy interpreter rather than the cPython interpreter. Install [PyPy](http://pypy.org/) on your system and execute the script with the following command: |
| 52 | + |
| 53 | +``` |
| 54 | +$ pypy fmp.py [UFO path 1] [UFO path 2] ... [UFO path n] |
| 55 | +``` |
| 56 | + |
| 57 | +`fmp.py` will spawn a new process for each UFO source directory of multi-font builds up to the number of available cores on your system as determined by the Python `multiprocessing.cpu_count()` method. |
| 58 | + |
| 59 | +### Manual modifications |
| 60 | + |
| 61 | +#### Change spawned process number |
| 62 | + |
| 63 | +To manually set the spawned process number, modify the `PROCESSES` constant integer at the top of the `fmp.py` file to the desired number of processes. |
| 64 | + |
| 65 | + |
| 66 | +#### Change build file type |
| 67 | + |
| 68 | +The build file type can be modified in the `BUILD_FILE_TYPE` constant at the top of the `fmp.py` file. This should be formatted as a Python tuple. Use the following settings to modify your build: |
| 69 | + |
| 70 | +##### ttf files only |
| 71 | + |
| 72 | +```python |
| 73 | +BUILD_FILE_TYPE = ('ttf') |
| 74 | +``` |
| 75 | + |
| 76 | +##### otf files only |
| 77 | + |
| 78 | +```python |
| 79 | +BUILD_FILE_TYPE = ('otf') |
| 80 | +``` |
| 81 | + |
| 82 | +## Acknowledgments |
| 83 | + |
| 84 | +fontmake-mp is a script built on the excellent [fontmake](https://github.com/googlei18n/fontmake) project where all of the hard work happens. |
| 85 | + |
| 86 | +## License |
| 87 | + |
| 88 | +[MIT license](https://github.com/source-foundry/fontmake-mp/blob/master/LICENSE.md) |
0 commit comments