|
1 |
| -<img src="https://raw.githubusercontent.com/source-foundry/fdiff/img/img/fdiff_logo-crunch.png" width="200" /> |
| 1 | +<img src="https://raw.githubusercontent.com/source-foundry/fdiff/img/img/fdiff_logo-crunch.png" width="250" /> |
2 | 2 | <br/>
|
3 | 3 |
|
4 | 4 | ## An OpenType table diff tool for fonts
|
|
9 | 9 | [](https://codecov.io/gh/source-foundry/fdiff)
|
10 | 10 | [](https://www.codacy.com/app/SourceFoundry/fdiff)
|
11 | 11 |
|
| 12 | + |
| 13 | +## About |
| 14 | + |
| 15 | +`fdiff` is a Python command line comparison tool that demonstrates differences in the OpenType table data between font files. The tool provides cross-platform support on macOS, Windows, and Linux systems with a Python v3.6+ interpreter. |
| 16 | + |
| 17 | +## What it does |
| 18 | + |
| 19 | +- Takes two font file path arguments for comparison |
| 20 | +- Dumps OpenType table data in the fontTools library TTX format (XML) |
| 21 | +- Compares the OpenType table data across the two files using a unified diff format |
| 22 | +- Supports optional color coding of the diff lines in the terminal |
| 23 | + |
| 24 | +## Installation |
| 25 | + |
| 26 | +`fdiff` requires a Python 3.6+ interpreter. |
| 27 | + |
| 28 | +Installation in a [Python3 virtual environment](https://docs.python.org/3/library/venv.html) is recommended as dependencies are pinned to versions that are confirmed to work with this project. |
| 29 | + |
| 30 | +Use any of the following installation approaches: |
| 31 | + |
| 32 | +### pip install from PyPI |
| 33 | + |
| 34 | +``` |
| 35 | +$ pip3 install fdiff |
| 36 | +``` |
| 37 | + |
| 38 | +### pip install from source |
| 39 | + |
| 40 | +``` |
| 41 | +$ git clone https://github.com/source-foundry/fdiff.git |
| 42 | +$ cd fdiff |
| 43 | +$ pip3 install . |
| 44 | +``` |
| 45 | + |
| 46 | +### Developer install from source |
| 47 | + |
| 48 | +The following approach installs the project and associated optional developer dependencies so that source changes are available without the need for re-installation. |
| 49 | + |
| 50 | +``` |
| 51 | +$ git clone https://github.com/source-foundry/fdiff.git |
| 52 | +$ cd fdiff |
| 53 | +$ pip3 install --ignore-installed -r requirements.txt -e ".[dev]" |
| 54 | +``` |
| 55 | + |
| 56 | +## Usage |
| 57 | + |
| 58 | +``` |
| 59 | +$ fdiff [OPTIONS] [PRE-FONT FILE PATH] [POST-FONT FILE PATH] |
| 60 | +``` |
| 61 | + |
| 62 | +By default, an uncolored unified diff is performed on the two files. To view a colored diff in your terminal, include either the `-c` or `--color` option in your command: |
| 63 | + |
| 64 | +##### Color diffs |
| 65 | + |
| 66 | +``` |
| 67 | +$ fdiff --color [PRE-FONT FILE PATH] [POST-FONT FILE PATH] |
| 68 | +``` |
| 69 | + |
| 70 | +### Other Options |
| 71 | + |
| 72 | +Use `fdiff -h` to view all available options. |
| 73 | + |
| 74 | +## Issues |
| 75 | + |
| 76 | +Please report issues on the [project issue tracker](https://github.com/source-foundry/fdiff/issues). |
| 77 | + |
| 78 | +## Contributing |
| 79 | + |
| 80 | +Contributions are warmly welcomed. A development dependency environment can be installed in editable mode with the developer installation documentation above. |
| 81 | + |
| 82 | +Please use the standard Github pull request approach to propose source changes. |
| 83 | + |
| 84 | +### Source file linting |
| 85 | + |
| 86 | +Python source files are linted with `flake8`. See the Makefile `test-lint` target for details. |
| 87 | + |
| 88 | +### Source file static type checks |
| 89 | + |
| 90 | +Static type checks are performed on Python source files with `pytype`. See the Makefile `test-type-check` target for details. |
| 91 | + |
| 92 | +### Testing |
| 93 | + |
| 94 | +The project runs continuous integration testing on [Travis CI](https://travis-ci.org/source-foundry/fdiff) and [Appveyor CI](https://ci.appveyor.com/project/chrissimpkins/fdiff) with the `pytest` and `tox` testing toolchain. Test modules are located in the `tests` directory of the repository. |
| 95 | + |
| 96 | +Local testing by Python interpreter version can be performed with the following command executed from the root of the repository: |
| 97 | + |
| 98 | +``` |
| 99 | +$ tox -e [PYTHON INTERPRETER VERSION] |
| 100 | +``` |
| 101 | + |
| 102 | +Please see the `tox` documentation for additional details. |
| 103 | + |
| 104 | +### Test coverage |
| 105 | + |
| 106 | +Unit test coverage is executed with the `coverage` tool. See the Makefile `test-coverage` target for details. |
| 107 | + |
| 108 | +## Acknowledgments |
| 109 | + |
| 110 | +`fdiff` is built with the fantastic [fontTools free software library](https://github.com/fonttools/fonttools) and performs text diffs of binary font files using the TTX OpenType table data serialization format defined by that project. The implementation of unified text file diffs is based on a (slightly) modified version of the Python `difflib` library source to address performance issues with large text files that are encountered with ttx dumps of font binary data. |
| 111 | + |
| 112 | +## Licenses |
| 113 | + |
| 114 | +### fdiff Project |
| 115 | + |
| 116 | +Copyright 2019 Source Foundry Authors and Contributors |
| 117 | + |
| 118 | +Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at |
| 119 | + |
| 120 | +[http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0) |
| 121 | + |
| 122 | +Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. |
| 123 | + |
| 124 | +### Third Party Licenses |
| 125 | + |
| 126 | +#### CPython `difflib` library |
| 127 | + |
| 128 | +This project distributes a modified version of third party source code from the [Python programming language library](https://github.com/python/cpython). The `difflib.py` v3.7.4 module is Copyright © 2001-2019 Python Software Foundation; All Rights Reserved. This source is modified and distributed in this project under the [PSF LICENSE AGREEMENT FOR PYTHON 3.7.4](https://github.com/source-foundry/fdiff/blob/master/lib/fdiff/thirdparty/PYTHON_LICENSE). The module is renamed to `fdifflib.py` to distinguish it from the upstream source and modifications made here are documented in comments at the head of the module. |
| 129 | + |
| 130 | + |
0 commit comments