Debian Codegraph @

CONTRIBUTING.md

raw symbols SCIP
1 # Contributing to FontForge
2
3 ## Reporting An Issue
4
5 See [When Things Go Wrong With FontForge Itself](http://designwithfontforge.com/en-US/When_Things_Go_Wrong_With_Fontforge_Itself.html)
6
7 ## Contributing Code
8
9 Merging into the master branch requires review and approval of the pull request
10 by an active core contributor to the project. The reviewer must fully
11 comprehend the code being modified, and any changes must be strictly
12 non-regressive and non-breaking unless discussed in advance on the mailing
13 list. FontForge is an extremely complex piece of software, and keeping it in
14 top form requires this level of care. Please understand that large pull
15 requests may take a long time to be approved or may be declined, even if well
16 written, due to limited code review resources.
17
18 ### How To Contribute, Step by Step
19
20 Contribute directly to the codebase using GitHub's Pull Requests.
21 See [Github Guides](https://guides.github.com/) to learn more, but the basic process is:
22
23 - Fork the [FontForge repository](https://github.com/fontforge/fontforge) from GitHub.
24 - Commit your changes locally using `git`, and push them to your personal fork.
25 - From the main page of your fork, click on the green “Fork” button in order to submit a Pull
26 Request.
27 - Your pull request will be tested via [GitHub Actions](https://github.com/features/actions) to automatically indicate that your changes do not prevent compilation. FontForge is a big program, so it can easily take over 20 minutes to confirm your changes are buildable. Please be patient. More details about CI are below.
28 - If it reports back that there are problems, you can follow the "Details" link to check the log report for your pull request to see what the problem was.
29
30 FontForge supports Python `>=` 3.3 and is fully compatible with Python 3 through at least version 3.9.
31
32 ### Coding Style
33
34 Some of these guidelines are not followed in the oldest code in the repository, however we want to use them for all new code since 2012 when FontForge transitioned from a lone-genius project to a collaborative community project.
35
36 1. One statement per line, to make semi-automatic processing and reading of diffs much easier.
37 2. Boolean Variables should use `stdbool.h`'s names `true` and `false`, not an integer ([reference](https://github.com/fontforge/fontforge/issues/724)).
38 3. `return` statements should be inline with the indentation level they are being put on; don't put them at the left margin as in much of the existing code ([reference](https://github.com/fontforge/fontforge/issues/1208)).
39
40 Beyond these guidelines, try to follow the style used in the file being modified.
41
42 ### People To Ask
43
44 Various areas of the codebase have been worked on by different people in recent years, so if you are unfamiliar with the general area you're working in, please feel free to chat with people who have experience in that area:
45
46 * Build System: Debian - Frank Trampe (frank-trampe)
47 * Build System: OS X (Application bundle, Homebrew) - Jeremy Tan (jtanx)
48 * Build System: Windows - Jeremy Tan (jtanx)
49 * Feature: UFO import/export - Frank Trampe (frank-trampe)
50 * Feature: Python interface - Skef Iterum (skef)
51 * Crashes: Frank Trampe, Adrien Tetar (adrientetar)
52
53 ### Accessing CI Build Archives
54
55 After each push request `Appveyor` will attempt to build and package
56 a Windows installer. When that build is successful it can be accessed
57 by following the `Appveyor` "Details" link and choosing the "Artifacts"
58 tab.
59
60 Note: `Appveyor` builds with the `FF_PORTABLE` flag, which changes various
61 initialization and configuration search paths.
62
63 CI via Github Actions also builds a Mac OS X bundle and a Linux AppImage.
64 When those builds are successful they can be downloaded as per:
65
66 https://docs.github.com/en/actions/managing-workflow-runs/downloading-workflow-artifacts
67
68 ## Translating FontForge
69 We are trialling the use of Crowdin for handling translations. If you'd like to contribute translations for FontForge, please do so here: https://crowdin.com/project/fontforge
70
71 These will be pulled in for the next release of FontForge.
72
73 ## Building Packages
74
75 For information about building FontForge from source, please refer to [INSTALL.md](INSTALL.md)
76
77 ### Extra Files
78
79 If you want to edit CID keyed fonts you need the character set descriptions in [`/contrib/cidmap`](https://github.com/fontforge/fontforge/tree/master/contrib/cidmap)
80
81 You might want to pull down some old unicode bitmap fonts.
82
83 - [The unifont](http://czyborra.com/unifont/)
84 - [The FreeFont project](http://www.nongnu.org/freefont/)
85 - [X fixed](http://www.cl.cam.ac.uk/~mgk25/ucs-fonts.html)
86 - [Computer Modern Unicode fonts](http://canopus.iacp.dvo.ru/~panov/cm-unicode/) - [Unicode Font Guide for Free/Libre Open Source Operating Systems](http://eyegene.ophthy.med.umich.edu/unicode/fontguide/)
87
88 ### Building a Debian source package
89
90 A Debian source package consists of a source tarball (with specific metadata) and several accompanying files and allows one to build a product in a neutral build environment.
91
92 A source package is specific to the distribution (but not the architecture) that it targets.
93 The most common build target is currently Ubuntu Xenial, a long-term support release with Launchpad build support. A binary package built on and for Xenial (usually) also installs and runs on later versions of Ubuntu.
94
95 The first step is to obtain a dist tarball. To generate this from git sources, change into the source directory and run
96
97 ```bash
98 mkdir build && cd build
99 cmake ..
100 make dist
101 ```
102
103 This will generate an archive with a name similar to `fontforge-20190801.tar.xz`. Move/extract this to a working folder of your choice and run `Packaging/debian/setup-metadata.sh`:
104
105 ```bash
106 tar axf fontforge-20190801.tar.xz
107 cd fontforge-20190801
108 Packaging/debian/setup-metadata.sh
109 ```
110
111 This will copy required metadata into the toplevel `debian` folder. It will also prompt to generate `debian/changelog`, if desired. In this state, the Debian source packages may be created by running:
112
113 ```bash
114 debuild -S -sa
115 ```
116
117 Upon successful completion, building of the source package will leave several files in the parent directory, with names like this:
118
119 fontforge-20190801-0ubuntu1~xenial.dsc
120 fontforge-20190801-0ubuntu1~xenial_source.build
121 fontforge-20190801-0ubuntu1~xenial_source.changes
122 fontforge-20190801-0ubuntu1~xenial.tar.gz
123
124 In order to upload to a Launchpad repository for building, one can then run dput on the `.changes` file with the target repository as the first argument, like this:
125
126 dput ppa:fontforge/fontforge fontforge-20190801-0ubuntu1~xenial_source.changes
127
128 This will, upon success, leave a file named something like `fontforge-20190801-0ubuntu1~xenial_source.ppa.upload` which blocks duplicate uploads.
129
130 Upon validation of the uploaded package, Launchpad will build the package for all supported architectures.
131 One can then copy the binary packages from Xenial to other Ubuntu versions via the Launchpad web interface.
132
133 See [here](https://help.launchpad.net/Packaging/PPA) for more information about Launchpad.
134
135 One can also build a binary package from the source package locally.
136 Simply extract the `tar.gz` file generated from `make deb-src` into a new directory, enter the directory, and run `debuild`.
137
138 ### Building a Red Hat source package (.rpm)
139
140 Run the following to get a spec file:
141
142 ```
143 Packaging/redhat/generate-spec.sh
144 ```
145
146 This will create a `FontForge.spec` file.
147
148 In order to build the binary package locally, copy the dist archive (as per Debian instructions) to `~/rpmbuild/SOURCES` and the spec file to `~/rpmbuild/SPECS`. Then run `rpmbuild -ba ~/rpmbuild/SPECS/FontForge.spec`.
149 For Example:
150
151 ```
152 mkdir -p ~/rpmbuild/SOURCES/
153 cp TARBALL ~/rpmbuild/SOURCES/
154 rpmbuild -ba --nodeps SPECFILE
155 ```
156
157 Upon success, this will leave binary packages in `~/rpmbuild/RPMS` and source packages in `~/rpmbuild/SRPMS`.
158
159 You may need to install dependencies, typically packaged for Fedora-derived systems as:
160
161 rpm-devel rpm-build git ninja-build cmake gcc g++ python3-devel libjpeg-devel libtiff-devel libpng-devel giflib-devel freetype-devel libxml2-devel libspiro-devel pango-devel cairo-devel gtk3-devel woff2-devel
162
163 ### Building a Mac OS X app bundle
164
165 There is a target to build an app bundle:
166
167 ```sh
168 make macbundle
169 ```
170
171 This will create a `FontForge.app` in the `osx` subdirectory of your build directory.
172
173 This relies on [`ffosxbuild.sh`](.github/workflows/scripts/ffosxbuild.sh) to make the bundle. It has been tested to work with Homebrew and the GDK backend.