ftoption.h 39 KB

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