[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[freetype2] gsoc-anurag-docs-2023 2534761e1 3/6: [docs] Add documentatio
From: |
Werner Lemberg |
Subject: |
[freetype2] gsoc-anurag-docs-2023 2534761e1 3/6: [docs] Add documentation on adding new modules to FreeType |
Date: |
Tue, 1 Aug 2023 10:51:42 -0400 (EDT) |
branch: gsoc-anurag-docs-2023
commit 2534761e1543cd4602ba83a15a248ac86fd796af
Author: Anurag Thakur <anurag105csec21@bpitindia.edu.in>
Commit: Anurag Thakur <anurag105csec21@bpitindia.edu.in>
[docs] Add documentation on adding new modules to FreeType
---
docs/.gitignore | 1 +
docs/MODIFYING.md | 42 ++++++++++++++++++++++++++++++++++++++++++
2 files changed, 43 insertions(+)
diff --git a/docs/.gitignore b/docs/.gitignore
index d7777e70c..85e163820 100644
--- a/docs/.gitignore
+++ b/docs/.gitignore
@@ -12,6 +12,7 @@ reference/
!INSTALL_MAC.md
!INSTALL_UNIX.md
!INSTALL_VMS.md
+!MODIFYING.md
# MkDocs Config file
mkdocs.yml
diff --git a/docs/MODIFYING.md b/docs/MODIFYING.md
new file mode 100644
index 000000000..22ef38997
--- /dev/null
+++ b/docs/MODIFYING.md
@@ -0,0 +1,42 @@
+# Modifying FreeType
+
+FreeType follows a modular architecture, i.e. all the features are
+implemented as separate modules. There are separate modules for
+rasterizers, font parsers, hinting etc. located under the `src/` directory.
+
+(See https://freetype.org/freetype2/docs/design/design-5.html)
+
+To add new features you have to either modify the existing modules or
+add a new module to FreeType.
+
+## Adding a new module to FreeType
+
+Suppose we want to add a new module "example" to FreeType:
+
+1. Create a directory under `src/` having the same name as the module.
+ i.e. `src/example/`
+
+2. Add source files under src/example having `#define
FT_MAKE_OPTION_SINGLE_OBJECT`
+ which includes the other files to create the module.
+
+ (See `src/sdf/sdf.c` for reference)
+
+3. Add the module to `include/freetype/config/ftmodule.h` according to whether
+ it is a renderer, font driver or another module like:
+
+ ```C
+ FT_USE_MODULE( FT_Renderer_Class, ft_example_renderer_class )
+ ```
+
+4. Add the module to `modules.cfg` in the toplevel directory:
+ ```
+ RASTER_MODULES += example
+ ```
+
+5. Under `src/example` add `module.mk` and `rules.mk` files to enable
compilation
+ with `make`. (See `src/smooth/rules.mk` for reference).
+
+6. Now you can simply compile by using `make` in the toplevel directory and
the module
+ should compile.
+
+ You can check out pre-existing modules for reference under `src/`
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [freetype2] gsoc-anurag-docs-2023 2534761e1 3/6: [docs] Add documentation on adding new modules to FreeType,
Werner Lemberg <=