ftoption.h 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983
  1. /****************************************************************************
  2. *
  3. * ftoption.h (for development)
  4. *
  5. * User-selectable configuration macros (specification only).
  6. *
  7. * Copyright (C) 1996-2019 by
  8. * David Turner, Robert Wilhelm, and Werner Lemberg.
  9. *
  10. * This file is part of the FreeType project, and may only be used,
  11. * modified, and distributed under the terms of the FreeType project
  12. * license, LICENSE.TXT. By continuing to use, modify, or distribute
  13. * this file you indicate that you have read the license and
  14. * understand and accept it fully.
  15. *
  16. */
  17. #ifndef FTOPTION_H_
  18. #define FTOPTION_H_
  19. #include <ft2build.h>
  20. FT_BEGIN_HEADER
  21. /**************************************************************************
  22. *
  23. * USER-SELECTABLE CONFIGURATION MACROS
  24. *
  25. * This file contains the default configuration macro definitions for a
  26. * standard build of the FreeType library. There are three ways to use
  27. * this file to build project-specific versions of the library:
  28. *
  29. * - You can modify this file by hand, but this is not recommended in
  30. * cases where you would like to build several versions of the library
  31. * from a single source directory.
  32. *
  33. * - You can put a copy of this file in your build directory, more
  34. * precisely in `$BUILD/freetype/config/ftoption.h`, where `$BUILD` is
  35. * the name of a directory that is included _before_ the FreeType include
  36. * path during compilation.
  37. *
  38. * The default FreeType Makefiles and Jamfiles use the build directory
  39. * `builds/<system>` by default, but you can easily change that for your
  40. * own projects.
  41. *
  42. * - Copy the file <ft2build.h> to `$BUILD/ft2build.h` and modify it
  43. * slightly to pre-define the macro `FT_CONFIG_OPTIONS_H` used to locate
  44. * this file during the build. For example,
  45. *
  46. * ```
  47. * #define FT_CONFIG_OPTIONS_H <myftoptions.h>
  48. * #include <freetype/config/ftheader.h>
  49. * ```
  50. *
  51. * will use `$BUILD/myftoptions.h` instead of this file for macro
  52. * definitions.
  53. *
  54. * Note also that you can similarly pre-define the macro
  55. * `FT_CONFIG_MODULES_H` used to locate the file listing of the modules
  56. * that are statically linked to the library at compile time. By
  57. * default, this file is `<freetype/config/ftmodule.h>`.
  58. *
  59. * We highly recommend using the third method whenever possible.
  60. *
  61. */
  62. /*************************************************************************/
  63. /*************************************************************************/
  64. /**** ****/
  65. /**** G E N E R A L F R E E T Y P E 2 C O N F I G U R A T I O N ****/
  66. /**** ****/
  67. /*************************************************************************/
  68. /*************************************************************************/
  69. /*#************************************************************************
  70. *
  71. * If you enable this configuration option, FreeType recognizes an
  72. * environment variable called `FREETYPE_PROPERTIES`, which can be used to
  73. * control the various font drivers and modules. The controllable
  74. * properties are listed in the section @properties.
  75. *
  76. * You have to undefine this configuration option on platforms that lack
  77. * the concept of environment variables (and thus don't have the `getenv`
  78. * function), for example Windows CE.
  79. *
  80. * `FREETYPE_PROPERTIES` has the following syntax form (broken here into
  81. * multiple lines for better readability).
  82. *
  83. * ```
  84. * <optional whitespace>
  85. * <module-name1> ':'
  86. * <property-name1> '=' <property-value1>
  87. * <whitespace>
  88. * <module-name2> ':'
  89. * <property-name2> '=' <property-value2>
  90. * ...
  91. * ```
  92. *
  93. * Example:
  94. *
  95. * ```
  96. * FREETYPE_PROPERTIES=truetype:interpreter-version=35 \
  97. * cff:no-stem-darkening=1 \
  98. * autofitter:warping=1
  99. * ```
  100. *
  101. */
  102. #define FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES
  103. /**************************************************************************
  104. *
  105. * Uncomment the line below if you want to activate LCD rendering
  106. * technology similar to ClearType in this build of the library. This
  107. * technology triples the resolution in the direction color subpixels. To
  108. * mitigate color fringes inherent to this technology, you also need to
  109. * explicitly set up LCD filtering.
  110. *
  111. * Note that this feature is covered by several Microsoft patents and
  112. * should not be activated in any default build of the library. When this
  113. * macro is not defined, FreeType offers alternative LCD rendering
  114. * technology that produces excellent output without LCD filtering.
  115. */
  116. /* #define FT_CONFIG_OPTION_SUBPIXEL_RENDERING */
  117. /**************************************************************************
  118. *
  119. * Many compilers provide a non-ANSI 64-bit data type that can be used by
  120. * FreeType to speed up some computations. However, this will create some
  121. * problems when compiling the library in strict ANSI mode.
  122. *
  123. * For this reason, the use of 64-bit integers is normally disabled when
  124. * the `__STDC__` macro is defined. You can however disable this by
  125. * defining the macro `FT_CONFIG_OPTION_FORCE_INT64` here.
  126. *
  127. * For most compilers, this will only create compilation warnings when
  128. * building the library.
  129. *
  130. * ObNote: The compiler-specific 64-bit integers are detected in the
  131. * file `ftconfig.h` either statically or through the `configure`
  132. * script on supported platforms.
  133. */
  134. #undef FT_CONFIG_OPTION_FORCE_INT64
  135. /**************************************************************************
  136. *
  137. * If this macro is defined, do not try to use an assembler version of
  138. * performance-critical functions (e.g., @FT_MulFix). You should only do
  139. * that to verify that the assembler function works properly, or to execute
  140. * benchmark tests of the various implementations.
  141. */
  142. /* #define FT_CONFIG_OPTION_NO_ASSEMBLER */
  143. /**************************************************************************
  144. *
  145. * If this macro is defined, try to use an inlined assembler version of the
  146. * @FT_MulFix function, which is a 'hotspot' when loading and hinting
  147. * glyphs, and which should be executed as fast as possible.
  148. *
  149. * Note that if your compiler or CPU is not supported, this will default to
  150. * the standard and portable implementation found in `ftcalc.c`.
  151. */
  152. #define FT_CONFIG_OPTION_INLINE_MULFIX
  153. /**************************************************************************
  154. *
  155. * LZW-compressed file support.
  156. *
  157. * FreeType now handles font files that have been compressed with the
  158. * `compress` program. This is mostly used to parse many of the PCF
  159. * files that come with various X11 distributions. The implementation
  160. * uses NetBSD's `zopen` to partially uncompress the file on the fly (see
  161. * `src/lzw/ftgzip.c`).
  162. *
  163. * Define this macro if you want to enable this 'feature'.
  164. */
  165. /*#define FT_CONFIG_OPTION_USE_LZW*/
  166. /**************************************************************************
  167. *
  168. * Gzip-compressed file support.
  169. *
  170. * FreeType now handles font files that have been compressed with the
  171. * `gzip` program. This is mostly used to parse many of the PCF files
  172. * that come with XFree86. The implementation uses 'zlib' to partially
  173. * uncompress the file on the fly (see `src/gzip/ftgzip.c`).
  174. *
  175. * Define this macro if you want to enable this 'feature'. See also the
  176. * macro `FT_CONFIG_OPTION_SYSTEM_ZLIB` below.
  177. */
  178. /*#define FT_CONFIG_OPTION_USE_ZLIB*/
  179. /**************************************************************************
  180. *
  181. * ZLib library selection
  182. *
  183. * This macro is only used when `FT_CONFIG_OPTION_USE_ZLIB` is defined.
  184. * It allows FreeType's 'ftgzip' component to link to the system's
  185. * installation of the ZLib library. This is useful on systems like
  186. * Unix or VMS where it generally is already available.
  187. *
  188. * If you let it undefined, the component will use its own copy of the
  189. * zlib sources instead. These have been modified to be included
  190. * directly within the component and **not** export external function
  191. * names. This allows you to link any program with FreeType _and_ ZLib
  192. * without linking conflicts.
  193. *
  194. * Do not `#undef` this macro here since the build system might define
  195. * it for certain configurations only.
  196. *
  197. * If you use a build system like cmake or the `configure` script,
  198. * options set by those programs have precedence, overwriting the value
  199. * here with the configured one.
  200. */
  201. /* #define FT_CONFIG_OPTION_SYSTEM_ZLIB */
  202. /**************************************************************************
  203. *
  204. * Bzip2-compressed file support.
  205. *
  206. * FreeType now handles font files that have been compressed with the
  207. * `bzip2` program. This is mostly used to parse many of the PCF files
  208. * that come with XFree86. The implementation uses `libbz2` to partially
  209. * uncompress the file on the fly (see `src/bzip2/ftbzip2.c`). Contrary
  210. * to gzip, bzip2 currently is not included and need to use the system
  211. * available bzip2 implementation.
  212. *
  213. * Define this macro if you want to enable this 'feature'.
  214. *
  215. * If you use a build system like cmake or the `configure` script,
  216. * options set by those programs have precedence, overwriting the value
  217. * here with the configured one.
  218. */
  219. #define FT_CONFIG_OPTION_USE_BZIP2
  220. /**************************************************************************
  221. *
  222. * Define to disable the use of file stream functions and types, `FILE`,
  223. * `fopen`, etc. Enables the use of smaller system libraries on embedded
  224. * systems that have multiple system libraries, some with or without file
  225. * stream support, in the cases where file stream support is not necessary
  226. * such as memory loading of font files.
  227. */
  228. /* #define FT_CONFIG_OPTION_DISABLE_STREAM_SUPPORT */
  229. /**************************************************************************
  230. *
  231. * PNG bitmap support.
  232. *
  233. * FreeType now handles loading color bitmap glyphs in the PNG format.
  234. * This requires help from the external libpng library. Uncompressed
  235. * color bitmaps do not need any external libraries and will be supported
  236. * regardless of this configuration.
  237. *
  238. * Define this macro if you want to enable this 'feature'.
  239. *
  240. * If you use a build system like cmake or the `configure` script,
  241. * options set by those programs have precedence, overwriting the value
  242. * here with the configured one.
  243. */
  244. #define FT_CONFIG_OPTION_USE_PNG
  245. /**************************************************************************
  246. *
  247. * HarfBuzz support.
  248. *
  249. * FreeType uses the HarfBuzz library to improve auto-hinting of OpenType
  250. * fonts. If available, many glyphs not directly addressable by a font's
  251. * character map will be hinted also.
  252. *
  253. * Define this macro if you want to enable this 'feature'.
  254. *
  255. * If you use a build system like cmake or the `configure` script,
  256. * options set by those programs have precedence, overwriting the value
  257. * here with the configured one.
  258. */
  259. #define FT_CONFIG_OPTION_USE_HARFBUZZ
  260. /**************************************************************************
  261. *
  262. * Glyph Postscript Names handling
  263. *
  264. * By default, FreeType 2 is compiled with the 'psnames' module. This
  265. * module is in charge of converting a glyph name string into a Unicode
  266. * value, or return a Macintosh standard glyph name for the use with the
  267. * TrueType 'post' table.
  268. *
  269. * Undefine this macro if you do not want 'psnames' compiled in your
  270. * build of FreeType. This has the following effects:
  271. *
  272. * - The TrueType driver will provide its own set of glyph names, if you
  273. * build it to support postscript names in the TrueType 'post' table,
  274. * but will not synthesize a missing Unicode charmap.
  275. *
  276. * - The Type~1 driver will not be able to synthesize a Unicode charmap
  277. * out of the glyphs found in the fonts.
  278. *
  279. * You would normally undefine this configuration macro when building a
  280. * version of FreeType that doesn't contain a Type~1 or CFF driver.
  281. */
  282. #define FT_CONFIG_OPTION_POSTSCRIPT_NAMES
  283. /**************************************************************************
  284. *
  285. * Postscript Names to Unicode Values support
  286. *
  287. * By default, FreeType~2 is built with the 'psnames' module compiled in.
  288. * Among other things, the module is used to convert a glyph name into a
  289. * Unicode value. This is especially useful in order to synthesize on
  290. * the fly a Unicode charmap from the CFF/Type~1 driver through a big
  291. * table named the 'Adobe Glyph List' (AGL).
  292. *
  293. * Undefine this macro if you do not want the Adobe Glyph List compiled
  294. * in your 'psnames' module. The Type~1 driver will not be able to
  295. * synthesize a Unicode charmap out of the glyphs found in the fonts.
  296. */
  297. #define FT_CONFIG_OPTION_ADOBE_GLYPH_LIST
  298. /**************************************************************************
  299. *
  300. * Support for Mac fonts
  301. *
  302. * Define this macro if you want support for outline fonts in Mac format
  303. * (mac dfont, mac resource, macbinary containing a mac resource) on
  304. * non-Mac platforms.
  305. *
  306. * Note that the 'FOND' resource isn't checked.
  307. */
  308. #define FT_CONFIG_OPTION_MAC_FONTS
  309. /**************************************************************************
  310. *
  311. * Guessing methods to access embedded resource forks
  312. *
  313. * Enable extra Mac fonts support on non-Mac platforms (e.g., GNU/Linux).
  314. *
  315. * Resource forks which include fonts data are stored sometimes in
  316. * locations which users or developers don't expected. In some cases,
  317. * resource forks start with some offset from the head of a file. In
  318. * other cases, the actual resource fork is stored in file different from
  319. * what the user specifies. If this option is activated, FreeType tries
  320. * to guess whether such offsets or different file names must be used.
  321. *
  322. * Note that normal, direct access of resource forks is controlled via
  323. * the `FT_CONFIG_OPTION_MAC_FONTS` option.
  324. */
  325. #ifdef FT_CONFIG_OPTION_MAC_FONTS
  326. #define FT_CONFIG_OPTION_GUESSING_EMBEDDED_RFORK
  327. #endif
  328. /**************************************************************************
  329. *
  330. * Allow the use of `FT_Incremental_Interface` to load typefaces that
  331. * contain no glyph data, but supply it via a callback function. This is
  332. * required by clients supporting document formats which supply font data
  333. * incrementally as the document is parsed, such as the Ghostscript
  334. * interpreter for the PostScript language.
  335. */
  336. #define FT_CONFIG_OPTION_INCREMENTAL
  337. /**************************************************************************
  338. *
  339. * The size in bytes of the render pool used by the scan-line converter to
  340. * do all of its work.
  341. */
  342. #define FT_RENDER_POOL_SIZE 16384L
  343. /**************************************************************************
  344. *
  345. * FT_MAX_MODULES
  346. *
  347. * The maximum number of modules that can be registered in a single
  348. * FreeType library object. 32~is the default.
  349. */
  350. #define FT_MAX_MODULES 32
  351. /**************************************************************************
  352. *
  353. * Debug level
  354. *
  355. * FreeType can be compiled in debug or trace mode. In debug mode,
  356. * errors are reported through the 'ftdebug' component. In trace mode,
  357. * additional messages are sent to the standard output during execution.
  358. *
  359. * Define `FT_DEBUG_LEVEL_ERROR` to build the library in debug mode.
  360. * Define `FT_DEBUG_LEVEL_TRACE` to build it in trace mode.
  361. *
  362. * Don't define any of these macros to compile in 'release' mode!
  363. *
  364. * Do not `#undef` these macros here since the build system might define
  365. * them for certain configurations only.
  366. */
  367. #define FT_DEBUG_LEVEL_ERROR
  368. #define FT_DEBUG_LEVEL_TRACE
  369. /**************************************************************************
  370. *
  371. * Autofitter debugging
  372. *
  373. * If `FT_DEBUG_AUTOFIT` is defined, FreeType provides some means to
  374. * control the autofitter behaviour for debugging purposes with global
  375. * boolean variables (consequently, you should **never** enable this
  376. * while compiling in 'release' mode):
  377. *
  378. * ```
  379. * _af_debug_disable_horz_hints
  380. * _af_debug_disable_vert_hints
  381. * _af_debug_disable_blue_hints
  382. * ```
  383. *
  384. * Additionally, the following functions provide dumps of various
  385. * internal autofit structures to stdout (using `printf`):
  386. *
  387. * ```
  388. * af_glyph_hints_dump_points
  389. * af_glyph_hints_dump_segments
  390. * af_glyph_hints_dump_edges
  391. * af_glyph_hints_get_num_segments
  392. * af_glyph_hints_get_segment_offset
  393. * ```
  394. *
  395. * As an argument, they use another global variable:
  396. *
  397. * ```
  398. * _af_debug_hints
  399. * ```
  400. *
  401. * Please have a look at the `ftgrid` demo program to see how those
  402. * variables and macros should be used.
  403. *
  404. * Do not `#undef` these macros here since the build system might define
  405. * them for certain configurations only.
  406. */
  407. #define FT_DEBUG_AUTOFIT
  408. /**************************************************************************
  409. *
  410. * Memory Debugging
  411. *
  412. * FreeType now comes with an integrated memory debugger that is capable
  413. * of detecting simple errors like memory leaks or double deletes. To
  414. * compile it within your build of the library, you should define
  415. * `FT_DEBUG_MEMORY` here.
  416. *
  417. * Note that the memory debugger is only activated at runtime when when
  418. * the _environment_ variable `FT2_DEBUG_MEMORY` is defined also!
  419. *
  420. * Do not `#undef` this macro here since the build system might define it
  421. * for certain configurations only.
  422. */
  423. #define FT_DEBUG_MEMORY
  424. /**************************************************************************
  425. *
  426. * Module errors
  427. *
  428. * If this macro is set (which is _not_ the default), the higher byte of
  429. * an error code gives the module in which the error has occurred, while
  430. * the lower byte is the real error code.
  431. *
  432. * Setting this macro makes sense for debugging purposes only, since it
  433. * would break source compatibility of certain programs that use
  434. * FreeType~2.
  435. *
  436. * More details can be found in the files `ftmoderr.h` and `fterrors.h`.
  437. */
  438. #undef FT_CONFIG_OPTION_USE_MODULE_ERRORS
  439. /**************************************************************************
  440. *
  441. * Error Strings
  442. *
  443. * If this macro is set, `FT_Error_String` will return meaningful
  444. * descriptions. This is not enabled by default to reduce the overall
  445. * size of FreeType.
  446. *
  447. * More details can be found in the file `fterrors.h`.
  448. */
  449. /* #define FT_CONFIG_OPTION_ERROR_STRINGS */
  450. /*************************************************************************/
  451. /*************************************************************************/
  452. /**** ****/
  453. /**** S F N T D R I V E R C O N F I G U R A T I O N ****/
  454. /**** ****/
  455. /*************************************************************************/
  456. /*************************************************************************/
  457. /**************************************************************************
  458. *
  459. * Define `TT_CONFIG_OPTION_EMBEDDED_BITMAPS` if you want to support
  460. * embedded bitmaps in all formats using the 'sfnt' module (namely
  461. * TrueType~& OpenType).
  462. */
  463. #define TT_CONFIG_OPTION_EMBEDDED_BITMAPS
  464. /**************************************************************************
  465. *
  466. * Define `TT_CONFIG_OPTION_COLOR_LAYERS` if you want to support coloured
  467. * outlines (from the 'COLR'/'CPAL' tables) in all formats using the 'sfnt'
  468. * module (namely TrueType~& OpenType).
  469. */
  470. #define TT_CONFIG_OPTION_COLOR_LAYERS
  471. /**************************************************************************
  472. *
  473. * Define `TT_CONFIG_OPTION_POSTSCRIPT_NAMES` if you want to be able to
  474. * load and enumerate the glyph Postscript names in a TrueType or OpenType
  475. * file.
  476. *
  477. * Note that when you do not compile the 'psnames' module by undefining the
  478. * above `FT_CONFIG_OPTION_POSTSCRIPT_NAMES`, the 'sfnt' module will
  479. * contain additional code used to read the PS Names table from a font.
  480. *
  481. * (By default, the module uses 'psnames' to extract glyph names.)
  482. */
  483. #define TT_CONFIG_OPTION_POSTSCRIPT_NAMES
  484. /**************************************************************************
  485. *
  486. * Define `TT_CONFIG_OPTION_SFNT_NAMES` if your applications need to access
  487. * the internal name table in a SFNT-based format like TrueType or
  488. * OpenType. The name table contains various strings used to describe the
  489. * font, like family name, copyright, version, etc. It does not contain
  490. * any glyph name though.
  491. *
  492. * Accessing SFNT names is done through the functions declared in
  493. * `ftsnames.h`.
  494. */
  495. #define TT_CONFIG_OPTION_SFNT_NAMES
  496. /**************************************************************************
  497. *
  498. * TrueType CMap support
  499. *
  500. * Here you can fine-tune which TrueType CMap table format shall be
  501. * supported.
  502. */
  503. #define TT_CONFIG_CMAP_FORMAT_0
  504. #define TT_CONFIG_CMAP_FORMAT_2
  505. #define TT_CONFIG_CMAP_FORMAT_4
  506. #define TT_CONFIG_CMAP_FORMAT_6
  507. #define TT_CONFIG_CMAP_FORMAT_8
  508. #define TT_CONFIG_CMAP_FORMAT_10
  509. #define TT_CONFIG_CMAP_FORMAT_12
  510. #define TT_CONFIG_CMAP_FORMAT_13
  511. #define TT_CONFIG_CMAP_FORMAT_14
  512. /*************************************************************************/
  513. /*************************************************************************/
  514. /**** ****/
  515. /**** T R U E T Y P E D R I V E R C O N F I G U R A T I O N ****/
  516. /**** ****/
  517. /*************************************************************************/
  518. /*************************************************************************/
  519. /**************************************************************************
  520. *
  521. * Define `TT_CONFIG_OPTION_BYTECODE_INTERPRETER` if you want to compile a
  522. * bytecode interpreter in the TrueType driver.
  523. *
  524. * By undefining this, you will only compile the code necessary to load
  525. * TrueType glyphs without hinting.
  526. *
  527. * Do not `#undef` this macro here, since the build system might define it
  528. * for certain configurations only.
  529. */
  530. #define TT_CONFIG_OPTION_BYTECODE_INTERPRETER
  531. /**************************************************************************
  532. *
  533. * Define `TT_CONFIG_OPTION_SUBPIXEL_HINTING` if you want to compile
  534. * subpixel hinting support into the TrueType driver. This modifies the
  535. * TrueType hinting mechanism when anything but `FT_RENDER_MODE_MONO` is
  536. * requested.
  537. *
  538. * In particular, it modifies the bytecode interpreter to interpret (or
  539. * not) instructions in a certain way so that all TrueType fonts look like
  540. * they do in a Windows ClearType (DirectWrite) environment. See [1] for a
  541. * technical overview on what this means. See `ttinterp.h` for more
  542. * details on the LEAN option.
  543. *
  544. * There are three possible values.
  545. *
  546. * Value 1:
  547. * This value is associated with the 'Infinality' moniker, contributed by
  548. * an individual nicknamed Infinality with the goal of making TrueType
  549. * fonts render better than on Windows. A high amount of configurability
  550. * and flexibility, down to rules for single glyphs in fonts, but also
  551. * very slow. Its experimental and slow nature and the original
  552. * developer losing interest meant that this option was never enabled in
  553. * default builds.
  554. *
  555. * The corresponding interpreter version is v38.
  556. *
  557. * Value 2:
  558. * The new default mode for the TrueType driver. The Infinality code
  559. * base was stripped to the bare minimum and all configurability removed
  560. * in the name of speed and simplicity. The configurability was mainly
  561. * aimed at legacy fonts like 'Arial', 'Times New Roman', or 'Courier'.
  562. * Legacy fonts are fonts that modify vertical stems to achieve clean
  563. * black-and-white bitmaps. The new mode focuses on applying a minimal
  564. * set of rules to all fonts indiscriminately so that modern and web
  565. * fonts render well while legacy fonts render okay.
  566. *
  567. * The corresponding interpreter version is v40.
  568. *
  569. * Value 3:
  570. * Compile both, making both v38 and v40 available (the latter is the
  571. * default).
  572. *
  573. * By undefining these, you get rendering behavior like on Windows without
  574. * ClearType, i.e., Windows XP without ClearType enabled and Win9x
  575. * (interpreter version v35). Or not, depending on how much hinting blood
  576. * and testing tears the font designer put into a given font. If you
  577. * define one or both subpixel hinting options, you can switch between
  578. * between v35 and the ones you define (using `FT_Property_Set`).
  579. *
  580. * This option requires `TT_CONFIG_OPTION_BYTECODE_INTERPRETER` to be
  581. * defined.
  582. *
  583. * [1]
  584. * https://www.microsoft.com/typography/cleartype/truetypecleartype.aspx
  585. */
  586. /* #define TT_CONFIG_OPTION_SUBPIXEL_HINTING 1 */
  587. /* #define TT_CONFIG_OPTION_SUBPIXEL_HINTING 2 */
  588. #define TT_CONFIG_OPTION_SUBPIXEL_HINTING ( 1 | 2 )
  589. /**************************************************************************
  590. *
  591. * Define `TT_CONFIG_OPTION_COMPONENT_OFFSET_SCALED` to compile the
  592. * TrueType glyph loader to use Apple's definition of how to handle
  593. * component offsets in composite glyphs.
  594. *
  595. * Apple and MS disagree on the default behavior of component offsets in
  596. * composites. Apple says that they should be scaled by the scaling
  597. * factors in the transformation matrix (roughly, it's more complex) while
  598. * MS says they should not. OpenType defines two bits in the composite
  599. * flags array which can be used to disambiguate, but old fonts will not
  600. * have them.
  601. *
  602. * https://www.microsoft.com/typography/otspec/glyf.htm
  603. * https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6glyf.html
  604. */
  605. #undef TT_CONFIG_OPTION_COMPONENT_OFFSET_SCALED
  606. /**************************************************************************
  607. *
  608. * Define `TT_CONFIG_OPTION_GX_VAR_SUPPORT` if you want to include support
  609. * for Apple's distortable font technology ('fvar', 'gvar', 'cvar', and
  610. * 'avar' tables). Tagged 'Font Variations', this is now part of OpenType
  611. * also. This has many similarities to Type~1 Multiple Masters support.
  612. */
  613. #define TT_CONFIG_OPTION_GX_VAR_SUPPORT
  614. /**************************************************************************
  615. *
  616. * Define `TT_CONFIG_OPTION_BDF` if you want to include support for an
  617. * embedded 'BDF~' table within SFNT-based bitmap formats.
  618. */
  619. #define TT_CONFIG_OPTION_BDF
  620. /**************************************************************************
  621. *
  622. * Option `TT_CONFIG_OPTION_MAX_RUNNABLE_OPCODES` controls the maximum
  623. * number of bytecode instructions executed for a single run of the
  624. * bytecode interpreter, needed to prevent infinite loops. You don't want
  625. * to change this except for very special situations (e.g., making a
  626. * library fuzzer spend less time to handle broken fonts).
  627. *
  628. * It is not expected that this value is ever modified by a configuring
  629. * script; instead, it gets surrounded with `#ifndef ... #endif` so that
  630. * the value can be set as a preprocessor option on the compiler's command
  631. * line.
  632. */
  633. #ifndef TT_CONFIG_OPTION_MAX_RUNNABLE_OPCODES
  634. #define TT_CONFIG_OPTION_MAX_RUNNABLE_OPCODES 1000000L
  635. #endif
  636. /*************************************************************************/
  637. /*************************************************************************/
  638. /**** ****/
  639. /**** T Y P E 1 D R I V E R C O N F I G U R A T I O N ****/
  640. /**** ****/
  641. /*************************************************************************/
  642. /*************************************************************************/
  643. /**************************************************************************
  644. *
  645. * `T1_MAX_DICT_DEPTH` is the maximum depth of nest dictionaries and arrays
  646. * in the Type~1 stream (see `t1load.c`). A minimum of~4 is required.
  647. */
  648. #define T1_MAX_DICT_DEPTH 5
  649. /**************************************************************************
  650. *
  651. * `T1_MAX_SUBRS_CALLS` details the maximum number of nested sub-routine
  652. * calls during glyph loading.
  653. */
  654. #define T1_MAX_SUBRS_CALLS 16
  655. /**************************************************************************
  656. *
  657. * `T1_MAX_CHARSTRING_OPERANDS` is the charstring stack's capacity. A
  658. * minimum of~16 is required.
  659. *
  660. * The Chinese font 'MingTiEG-Medium' (covering the CNS 11643 character
  661. * set) needs 256.
  662. */
  663. #define T1_MAX_CHARSTRINGS_OPERANDS 256
  664. /**************************************************************************
  665. *
  666. * Define this configuration macro if you want to prevent the compilation
  667. * of the 't1afm' module, which is in charge of reading Type~1 AFM files
  668. * into an existing face. Note that if set, the Type~1 driver will be
  669. * unable to produce kerning distances.
  670. */
  671. #undef T1_CONFIG_OPTION_NO_AFM
  672. /**************************************************************************
  673. *
  674. * Define this configuration macro if you want to prevent the compilation
  675. * of the Multiple Masters font support in the Type~1 driver.
  676. */
  677. #undef T1_CONFIG_OPTION_NO_MM_SUPPORT
  678. /**************************************************************************
  679. *
  680. * `T1_CONFIG_OPTION_OLD_ENGINE` controls whether the pre-Adobe Type~1
  681. * engine gets compiled into FreeType. If defined, it is possible to
  682. * switch between the two engines using the `hinting-engine` property of
  683. * the 'type1' driver module.
  684. */
  685. #define T1_CONFIG_OPTION_OLD_ENGINE
  686. /*************************************************************************/
  687. /*************************************************************************/
  688. /**** ****/
  689. /**** C F F D R I V E R C O N F I G U R A T I O N ****/
  690. /**** ****/
  691. /*************************************************************************/
  692. /*************************************************************************/
  693. /**************************************************************************
  694. *
  695. * Using `CFF_CONFIG_OPTION_DARKENING_PARAMETER_{X,Y}{1,2,3,4}` it is
  696. * possible to set up the default values of the four control points that
  697. * define the stem darkening behaviour of the (new) CFF engine. For more
  698. * details please read the documentation of the `darkening-parameters`
  699. * property (file `ftdriver.h`), which allows the control at run-time.
  700. *
  701. * Do **not** undefine these macros!
  702. */
  703. #define CFF_CONFIG_OPTION_DARKENING_PARAMETER_X1 500
  704. #define CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y1 400
  705. #define CFF_CONFIG_OPTION_DARKENING_PARAMETER_X2 1000
  706. #define CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y2 275
  707. #define CFF_CONFIG_OPTION_DARKENING_PARAMETER_X3 1667
  708. #define CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y3 275
  709. #define CFF_CONFIG_OPTION_DARKENING_PARAMETER_X4 2333
  710. #define CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y4 0
  711. /**************************************************************************
  712. *
  713. * `CFF_CONFIG_OPTION_OLD_ENGINE` controls whether the pre-Adobe CFF engine
  714. * gets compiled into FreeType. If defined, it is possible to switch
  715. * between the two engines using the `hinting-engine` property of the 'cff'
  716. * driver module.
  717. */
  718. #define CFF_CONFIG_OPTION_OLD_ENGINE
  719. /*************************************************************************/
  720. /*************************************************************************/
  721. /**** ****/
  722. /**** P C F D R I V E R C O N F I G U R A T I O N ****/
  723. /**** ****/
  724. /*************************************************************************/
  725. /*************************************************************************/
  726. /**************************************************************************
  727. *
  728. * There are many PCF fonts just called 'Fixed' which look completely
  729. * different, and which have nothing to do with each other. When selecting
  730. * 'Fixed' in KDE or Gnome one gets results that appear rather random, the
  731. * style changes often if one changes the size and one cannot select some
  732. * fonts at all. This option makes the 'pcf' module prepend the foundry
  733. * name (plus a space) to the family name.
  734. *
  735. * We also check whether we have 'wide' characters; all put together, we
  736. * get family names like 'Sony Fixed' or 'Misc Fixed Wide'.
  737. *
  738. * If this option is activated, it can be controlled with the
  739. * `no-long-family-names` property of the 'pcf' driver module.
  740. */
  741. #define PCF_CONFIG_OPTION_LONG_FAMILY_NAMES
  742. /*************************************************************************/
  743. /*************************************************************************/
  744. /**** ****/
  745. /**** A U T O F I T M O D U L E C O N F I G U R A T I O N ****/
  746. /**** ****/
  747. /*************************************************************************/
  748. /*************************************************************************/
  749. /**************************************************************************
  750. *
  751. * Compile 'autofit' module with CJK (Chinese, Japanese, Korean) script
  752. * support.
  753. */
  754. #define AF_CONFIG_OPTION_CJK
  755. /**************************************************************************
  756. *
  757. * Compile 'autofit' module with fallback Indic script support, covering
  758. * some scripts that the 'latin' submodule of the 'autofit' module doesn't
  759. * (yet) handle.
  760. */
  761. #define AF_CONFIG_OPTION_INDIC
  762. /**************************************************************************
  763. *
  764. * Compile 'autofit' module with warp hinting. The idea of the warping
  765. * code is to slightly scale and shift a glyph within a single dimension so
  766. * that as much of its segments are aligned (more or less) on the grid. To
  767. * find out the optimal scaling and shifting value, various parameter
  768. * combinations are tried and scored.
  769. *
  770. * You can switch warping on and off with the `warping` property of the
  771. * auto-hinter (see file `ftdriver.h` for more information; by default it
  772. * is switched off).
  773. *
  774. * This experimental option is not active if the rendering mode is
  775. * `FT_RENDER_MODE_LIGHT`.
  776. */
  777. #define AF_CONFIG_OPTION_USE_WARPER
  778. /**************************************************************************
  779. *
  780. * Use TrueType-like size metrics for 'light' auto-hinting.
  781. *
  782. * It is strongly recommended to avoid this option, which exists only to
  783. * help some legacy applications retain its appearance and behaviour with
  784. * respect to auto-hinted TrueType fonts.
  785. *
  786. * The very reason this option exists at all are GNU/Linux distributions
  787. * like Fedora that did not un-patch the following change (which was
  788. * present in FreeType between versions 2.4.6 and 2.7.1, inclusive).
  789. *
  790. * ```
  791. * 2011-07-16 Steven Chu <steven.f.chu@gmail.com>
  792. *
  793. * [truetype] Fix metrics on size request for scalable fonts.
  794. * ```
  795. *
  796. * This problematic commit is now reverted (more or less).
  797. */
  798. /* #define AF_CONFIG_OPTION_TT_SIZE_METRICS */
  799. /* */
  800. /*
  801. * This macro is obsolete. Support has been removed in FreeType version
  802. * 2.5.
  803. */
  804. /* #define FT_CONFIG_OPTION_OLD_INTERNALS */
  805. /*
  806. * The next three macros are defined if native TrueType hinting is
  807. * requested by the definitions above. Don't change this.
  808. */
  809. #ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
  810. #define TT_USE_BYTECODE_INTERPRETER
  811. #ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING
  812. #if TT_CONFIG_OPTION_SUBPIXEL_HINTING & 1
  813. #define TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
  814. #endif
  815. #if TT_CONFIG_OPTION_SUBPIXEL_HINTING & 2
  816. #define TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
  817. #endif
  818. #endif
  819. #endif
  820. /*
  821. * Check CFF darkening parameters. The checks are the same as in function
  822. * `cff_property_set` in file `cffdrivr.c`.
  823. */
  824. #if CFF_CONFIG_OPTION_DARKENING_PARAMETER_X1 < 0 || \
  825. CFF_CONFIG_OPTION_DARKENING_PARAMETER_X2 < 0 || \
  826. CFF_CONFIG_OPTION_DARKENING_PARAMETER_X3 < 0 || \
  827. CFF_CONFIG_OPTION_DARKENING_PARAMETER_X4 < 0 || \
  828. \
  829. CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y1 < 0 || \
  830. CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y2 < 0 || \
  831. CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y3 < 0 || \
  832. CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y4 < 0 || \
  833. \
  834. CFF_CONFIG_OPTION_DARKENING_PARAMETER_X1 > \
  835. CFF_CONFIG_OPTION_DARKENING_PARAMETER_X2 || \
  836. CFF_CONFIG_OPTION_DARKENING_PARAMETER_X2 > \
  837. CFF_CONFIG_OPTION_DARKENING_PARAMETER_X3 || \
  838. CFF_CONFIG_OPTION_DARKENING_PARAMETER_X3 > \
  839. CFF_CONFIG_OPTION_DARKENING_PARAMETER_X4 || \
  840. \
  841. CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y1 > 500 || \
  842. CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y2 > 500 || \
  843. CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y3 > 500 || \
  844. CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y4 > 500
  845. #error "Invalid CFF darkening parameters!"
  846. #endif
  847. FT_END_HEADER
  848. #endif /* FTOPTION_H_ */
  849. /* END */