Anurag Thakur pushed to branch gsoc-anurag-docs-2023 at FreeType / FreeType
Commits:
-
a7cdb194
by Anurag Thakur at 2023-07-01T13:53:41+05:30
-
c89a9c82
by Anurag Thakur at 2023-07-01T13:54:00+05:30
3 changed files:
Changes:
... | ... | @@ -12,6 +12,8 @@ reference/ |
12 | 12 | !INSTALL_MAC.md
|
13 | 13 | !INSTALL_UNIX.md
|
14 | 14 | !INSTALL_VMS.md
|
15 | +!INSTALL_ANDROID.md
|
|
16 | +!MODIFYING.md
|
|
15 | 17 | |
16 | 18 | # MkDocs Config file
|
17 | 19 | mkdocs.yml
|
1 | + TODO: Add details on how to compile freetype on android using termux |
1 | +# Modifying FreeType
|
|
2 | + |
|
3 | +FreeType follows a modular architecture, i.e. all the features are
|
|
4 | +implemented as separate modules. There are separate modules for
|
|
5 | +rasterizers, font parsers, hinting etc. located under the `src/` directory.
|
|
6 | + |
|
7 | +(See https://freetype.org/freetype2/docs/design/design-5.html)
|
|
8 | + |
|
9 | +To add new features you have to either modify the existing modules or
|
|
10 | +add a new module to FreeType.
|
|
11 | + |
|
12 | +## Adding a new module to FreeType
|
|
13 | + |
|
14 | +Suppose we want to add a new module "example" to FreeType:
|
|
15 | + |
|
16 | +1. Create a directory under `src/` having the same name as the module.
|
|
17 | + i.e. `src/example/`
|
|
18 | + |
|
19 | +2. Add source files under src/example having `#define FT_MAKE_OPTION_SINGLE_OBJECT`
|
|
20 | + which includes the other files to create the module.
|
|
21 | + |
|
22 | + (See `src/sdf/sdf.c` for reference)
|
|
23 | + |
|
24 | +3. Add the module to `include/freetype/config/ftmodule.h` according to whether
|
|
25 | + it is a renderer, font driver or another module like:
|
|
26 | + |
|
27 | + ```C
|
|
28 | + FT_USE_MODULE( FT_Renderer_Class, ft_example_renderer_class )
|
|
29 | + ```
|
|
30 | + |
|
31 | +4. Add the module to `modules.cfg` in the toplevel directory:
|
|
32 | + ```
|
|
33 | + RASTER_MODULES += example
|
|
34 | + ```
|
|
35 | + |
|
36 | +5. Under `src/example` add `module.mk` and `rules.mk` files to enable compilation
|
|
37 | + with `make`. (See `src/smooth/rules.mk` for reference).
|
|
38 | + |
|
39 | +6. Now you can simply compile by using `make` in the toplevel directory and the module
|
|
40 | + should compile.
|
|
41 | + |
|
42 | + You can check out pre-existing modules for reference under `src/` |