|
13 | 13 |
|
14 | 14 | ## About
|
15 | 15 |
|
16 |
| -`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 | +`fdiff` is a Python command line comparison tool for 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. |
17 | 17 |
|
18 | 18 | ## What it does
|
19 | 19 |
|
20 | 20 | - Takes two font file path arguments for comparison
|
21 | 21 | - Dumps OpenType table data in the fontTools library TTX format (XML)
|
22 |
| -- Compares the OpenType table data across the two files using the unified diff format supported in the Python standard library |
23 |
| -- Supports optional color coding of the diff lines in the terminal |
| 22 | +- Compares the OpenType table data across the two files using the unified diff format with 3 lines of context by default |
| 23 | + |
| 24 | +## Optional Features |
| 25 | + |
| 26 | +- Filter OpenType tables with the `--include` or `--exclude` options |
| 27 | +- Modify the number of context lines displayed in the diff with the `-l` or `--lines` option |
| 28 | +- View colored diffs in the terminal with the `-c` or `--color` flag |
| 29 | + |
| 30 | +Run `fdiff --help` to view all available options. |
24 | 31 |
|
25 | 32 | ## Installation
|
26 | 33 |
|
27 | 34 | `fdiff` requires a Python 3.6+ interpreter.
|
28 | 35 |
|
29 |
| -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. |
| 36 | +Installation in a [Python3 virtual environment](https://docs.python.org/3/library/venv.html) is recommended. |
30 | 37 |
|
31 | 38 | Use any of the following installation approaches:
|
32 | 39 |
|
@@ -60,14 +67,40 @@ $ pip3 install --ignore-installed -r requirements.txt -e ".[dev]"
|
60 | 67 | $ fdiff [OPTIONS] [PRE-FONT FILE PATH] [POST-FONT FILE PATH]
|
61 | 68 | ```
|
62 | 69 |
|
63 |
| -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: |
| 70 | +By default, an uncolored unified diff is performed on the two files defined with the local file paths in the above command. |
64 | 71 |
|
65 |
| -##### Color diffs |
| 72 | +#### Color diffs |
| 73 | + |
| 74 | +To view a colored diff in your terminal, include either the `-c` or `--color` option in your command: |
66 | 75 |
|
67 | 76 | ```
|
68 | 77 | $ fdiff --color [PRE-FONT FILE PATH] [POST-FONT FILE PATH]
|
69 | 78 | ```
|
70 | 79 |
|
| 80 | +#### Filter OpenType tables |
| 81 | + |
| 82 | +To include only specified tables in your diff, use the `--include` option with a comma separated list of table names: |
| 83 | + |
| 84 | +``` |
| 85 | +$ fdiff --include head,post [PRE-FONT FILE PATH] [POST-FONT FILE PATH] |
| 86 | +``` |
| 87 | + |
| 88 | +To exclude specified tables in your diff, use the `--exclude` option with a comma separated list of table names: |
| 89 | + |
| 90 | +``` |
| 91 | +$ fdiff --exclude glyf,OS/2 [PRE-FONT FILE PATH] [POST-FONT FILE PATH] |
| 92 | +``` |
| 93 | + |
| 94 | +**Do not include spaces** between the comma separated table name values! |
| 95 | + |
| 96 | +#### Change Number of Context Lines |
| 97 | + |
| 98 | +To change the number of lines of context above/below lines that have differences, use the `-l` or `--lines` option with an integer value for the desired number of lines. The following command reduces the contextual information to a single line above and below lines with differences: |
| 99 | + |
| 100 | +``` |
| 101 | +$ fdiff -l 1 [PRE-FONT FILE PATH] [POST-FONT FILE PATH] |
| 102 | +``` |
| 103 | + |
71 | 104 | ### Other Options
|
72 | 105 |
|
73 | 106 | Use `fdiff -h` to view all available options.
|
@@ -108,11 +141,11 @@ Unit test coverage is executed with the `coverage` tool. See the Makefile `test
|
108 | 141 |
|
109 | 142 | ## Acknowledgments
|
110 | 143 |
|
111 |
| -`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` standard library source. The modifications address performance issues with large text files like those encountered with the ttx dumps of font binary data used in this project. |
| 144 | +`fdiff` is built with the fantastic [fontTools free software library](https://github.com/fonttools/fonttools) and performs text diffs of binary font files using dumps of the TTX OpenType table data serialization format as defined in the fontTools library. The implementation of unified text file diffs is based on a (slightly) modified version of the Python `difflib` standard library source. The modifications address diff performance issues with the lengthy text output from TTX dumps of font OpenType data. |
112 | 145 |
|
113 | 146 | ## Licenses
|
114 | 147 |
|
115 |
| -### fdiff Project |
| 148 | +### fdiff |
116 | 149 |
|
117 | 150 | Copyright 2019 Source Foundry Authors and Contributors
|
118 | 151 |
|
|
0 commit comments