| 1 |
# fontTools Documentation |
| 2 |
|
| 3 |
The fontTools project documentation updates continuously on Read the Docs as the project source changes. |
| 4 |
|
| 5 |
The documentation is hosted at https://fonttools.readthedocs.io/. |
| 6 |
|
| 7 |
## Contents |
| 8 |
|
| 9 |
- [How to Build Local Documentation](#how-to-build-local-documentation) |
| 10 |
- [Contributing to the fontTools Documentation](#contributing-to-the-documentation) |
| 11 |
- [Documentation License](#documentation-license) |
| 12 |
|
| 13 |
## How to Build Local Documentation |
| 14 |
|
| 15 |
You must have a Python 3 interpreter and the `tox` command runner installed on your system to build the fontTools documentation. |
| 16 |
|
| 17 |
Execute the following command in the root of the repository: |
| 18 |
|
| 19 |
``` |
| 20 |
$ tox -e docs |
| 21 |
``` |
| 22 |
|
| 23 |
Open the `Doc/build/index.html` file in your browser to view the documentation home page. |
| 24 |
|
| 25 |
## Contributing to the Documentation |
| 26 |
|
| 27 |
We highly encourage contributions! Please follow the instructions below to improve the documentation. |
| 28 |
|
| 29 |
### Python Docstring Style |
| 30 |
|
| 31 |
We recommend the use of Python docstrings that follow [the Google Style Guide](https://github.com/google/styleguide/blob/gh-pages/pyguide.md#381-docstrings). Our documentation build approach parses appropriately formatted docstrings into formatted documentation files. |
| 32 |
|
| 33 |
#### Function Documentation Example |
| 34 |
|
| 35 |
```python |
| 36 |
def fetch_bigtable_rows(big_table, keys, other_silly_variable=None): |
| 37 |
"""Fetches rows from a Bigtable. |
| 38 |
|
| 39 |
Retrieves rows pertaining to the given keys from the Table instance |
| 40 |
represented by big_table. Silly things may happen if |
| 41 |
other_silly_variable is not None. |
| 42 |
|
| 43 |
Args: |
| 44 |
big_table: An open Bigtable Table instance. |
| 45 |
keys: A sequence of strings representing the key of each table row |
| 46 |
to fetch. |
| 47 |
other_silly_variable: Another optional variable, that has a much |
| 48 |
longer name than the other args, and which does nothing. |
| 49 |
|
| 50 |
Returns: |
| 51 |
A dict mapping keys to the corresponding table row data |
| 52 |
fetched. Each row is represented as a tuple of strings. For |
| 53 |
example: |
| 54 |
|
| 55 |
{'Serak': ('Rigel VII', 'Preparer'), |
| 56 |
'Zim': ('Irk', 'Invader'), |
| 57 |
'Lrrr': ('Omicron Persei 8', 'Emperor')} |
| 58 |
|
| 59 |
If a key from the keys argument is missing from the dictionary, |
| 60 |
then that row was not found in the table. |
| 61 |
|
| 62 |
Raises: |
| 63 |
IOError: An error occurred accessing the bigtable.Table object. |
| 64 |
""" |
| 65 |
``` |
| 66 |
*Source: [Google Style Guide](https://github.com/google/styleguide/blob/gh-pages/pyguide.md) (CC BY-SA 3.0)* |
| 67 |
|
| 68 |
#### Class Documentation Example |
| 69 |
|
| 70 |
```python |
| 71 |
class SampleClass(object): |
| 72 |
"""Summary of class here. |
| 73 |
|
| 74 |
Longer class information.... |
| 75 |
Longer class information.... |
| 76 |
|
| 77 |
Attributes: |
| 78 |
likes_spam: A boolean indicating if we like SPAM or not. |
| 79 |
eggs: An integer count of the eggs we have laid. |
| 80 |
""" |
| 81 |
|
| 82 |
def __init__(self, likes_spam=False): |
| 83 |
"""Inits SampleClass with blah.""" |
| 84 |
self.likes_spam = likes_spam |
| 85 |
self.eggs = 0 |
| 86 |
|
| 87 |
def public_method(self): |
| 88 |
"""Performs operation blah.""" |
| 89 |
``` |
| 90 |
*Source: [Google Style Guide](https://github.com/google/styleguide/blob/gh-pages/pyguide.md) (CC BY-SA 3.0)* |
| 91 |
|
| 92 |
### Build Local Documentation and Review Your Changes |
| 93 |
|
| 94 |
Build a local set of HTML documentation files with the instructions above and review your changes. |
| 95 |
|
| 96 |
### Submit a Pull Request |
| 97 |
|
| 98 |
Submit a Github pull request with your proposed improvements to the documentation. |
| 99 |
|
| 100 |
Thanks for your contribution! |
| 101 |
|
| 102 |
## Documentation License |
| 103 |
|
| 104 |
The fontTools documentation is released under a [CC BY-SA 4.0 International License](https://creativecommons.org/licenses/by-sa/4.0/). |