CUSTOMIZE 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. How to customize the compilation of the library
  2. ===============================================
  3. FreeType is highly customizable to fit various needs, and this
  4. document describes how it is possible to select options and
  5. components at compilation time.
  6. I. Configuration macros
  7. The file found in `include/freetype/config/ftoption.h' contains a
  8. list of commented configuration macros that can be toggled by
  9. developers to indicate which features should be active while
  10. building the library.
  11. These options range from debug level to availability of certain
  12. features, like native TrueType hinting through a bytecode
  13. interpreter.
  14. We invite you to read this file for more information. You can
  15. change the file's content to suit your needs, or override it with
  16. one of the techniques described below.
  17. II. Modules list
  18. If you use GNU make please edit the top-level file `modules.cfg'.
  19. It contains a list of available FreeType modules and extensions to
  20. be compiled. Change it to suit your own preferences. Be aware that
  21. certain modules depend on others, as described in the file. GNU
  22. make uses `modules.cfg' to generate `ftmodule.h' (in the object
  23. directory).
  24. If you don't use GNU make you have to manually edit the file
  25. `include/freetype/config/ftmodule.h' (which is *not* used with if
  26. compiled with GNU make) to add or remove the drivers and components
  27. you want to compile into the library. See `INSTALL.ANY' for more
  28. information.
  29. III. System interface
  30. FreeType's default interface to the system (i.e., the parts that
  31. deal with memory management and i/o streams) is located in
  32. `src/base/ftsystem.c'.
  33. The current implementation uses standard C library calls to manage
  34. memory and to read font files. It is however possible to write
  35. custom implementations to suit specific systems.
  36. To tell the GNU Make-based build system to use a custom system
  37. interface, you have to define the environment variable FTSYS_SRC to
  38. point to the relevant implementation:
  39. on Unix:
  40. ./configure <your options>
  41. export FTSYS_SRC=foo/my_ftsystem.c
  42. make
  43. make install
  44. on Windows:
  45. make setup <compiler>
  46. set FTSYS_SRC=foo/my_ftsystem.c
  47. make
  48. IV. Overriding default configuration and module headers
  49. It is possible to override the default configuration and module
  50. headers without changing the original files. There are three ways
  51. to do that:
  52. 1. With GNU make
  53. [This is actually a combination of method 2 and 3.]
  54. Just put your custom `ftoption.h' file into the objects directory
  55. (normally `<topdir>/objs'), which GNU make prefers over the
  56. standard location. No action is needed for `ftmodule.h' because
  57. it is generated automatically in the objects directory.
  58. 2. Using the C include path
  59. Use the C include path to ensure that your own versions of the
  60. files are used at compile time when the lines
  61. #include FT_CONFIG_OPTIONS_H
  62. #include FT_CONFIG_MODULES_H
  63. are compiled. Their default values being
  64. <freetype/config/ftoption.h> and <freetype/config/ftmodule.h>, you
  65. can do something like:
  66. custom/
  67. freetype/
  68. config/
  69. ftoption.h => custom options header
  70. ftmodule.h => custom modules list
  71. include/ => normal FreeType 2 include
  72. freetype/
  73. ...
  74. then change the C include path to always give the path to `custom'
  75. before the FreeType 2 `include'.
  76. 3. Redefining FT_CONFIG_OPTIONS_H and FT_CONFIG_MODULES_H
  77. Another way to do the same thing is to redefine the macros used to
  78. name the configuration headers. To do so, you need a custom
  79. `ft2build.h' whose content can be as simple as:
  80. #ifndef __FT2_BUILD_MY_PLATFORM_H__
  81. #define __FT2_BUILD_MY_PLATFORM_H__
  82. #define FT_CONFIG_OPTIONS_H <custom/my-ftoption.h>
  83. #define FT_CONFIG_MODULES_H <custom/my-ftmodule.h>
  84. #include <freetype/config/ftheader.h>
  85. #endif /* __FT2_BUILD_MY_PLATFORM_H__ */
  86. Place those files in a separate directory, e.g.,
  87. custom/
  88. ft2build.h => custom version described above
  89. my-ftoption.h => custom options header
  90. my-ftmodule.h => custom modules list header
  91. and change the C include path to ensure that `custom' is always
  92. placed before the FT2 `include' during compilation.
  93. ----------------------------------------------------------------------
  94. Copyright 2003, 2005, 2006 by
  95. David Turner, Robert Wilhelm, and Werner Lemberg.
  96. This file is part of the FreeType project, and may only be used,
  97. modified, and distributed under the terms of the FreeType project
  98. license, LICENSE.TXT. By continuing to use, modify, or distribute
  99. this file you indicate that you have read the license and understand
  100. and accept it fully.
  101. --- end of CUSTOMIZE ---