OLD | NEW |
1 /***************************************************************************/ | 1 /***************************************************************************/ |
2 /* */ | 2 /* */ |
3 /* ftoption.h */ | 3 /* ftoption.h */ |
4 /* */ | 4 /* */ |
5 /* User-selectable configuration macros (specification only). */ | 5 /* User-selectable configuration macros (specification only). */ |
6 /* */ | 6 /* */ |
7 /* Copyright 1996-2015 by */ | 7 /* Copyright 1996-2016 by */ |
8 /* David Turner, Robert Wilhelm, and Werner Lemberg. */ | 8 /* David Turner, Robert Wilhelm, and Werner Lemberg. */ |
9 /* */ | 9 /* */ |
10 /* This file is part of the FreeType project, and may only be used, */ | 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 */ | 11 /* modified, and distributed under the terms of the FreeType project */ |
12 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ | 12 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ |
13 /* this file you indicate that you have read the license and */ | 13 /* this file you indicate that you have read the license and */ |
14 /* understand and accept it fully. */ | 14 /* understand and accept it fully. */ |
15 /* */ | 15 /* */ |
16 /***************************************************************************/ | 16 /***************************************************************************/ |
17 | 17 |
18 | 18 |
19 #ifndef __FTOPTION_H__ | 19 #ifndef FTOPTION_H_ |
20 #define __FTOPTION_H__ | 20 #define FTOPTION_H_ |
21 | 21 |
22 | 22 |
23 #include <ft2build.h> | 23 #include <ft2build.h> |
24 | 24 |
25 | 25 |
26 FT_BEGIN_HEADER | 26 FT_BEGIN_HEADER |
27 | 27 |
28 /*************************************************************************/ | 28 /*************************************************************************/ |
29 /* */ | 29 /* */ |
30 /* USER-SELECTABLE CONFIGURATION MACROS */ | 30 /* USER-SELECTABLE CONFIGURATION MACROS */ |
(...skipping 23 matching lines...) Expand all Loading... |
54 /* #include <freetype/config/ftheader.h> */ | 54 /* #include <freetype/config/ftheader.h> */ |
55 /* */ | 55 /* */ |
56 /* will use `$BUILD/myftoptions.h' instead of this file for macro */ | 56 /* will use `$BUILD/myftoptions.h' instead of this file for macro */ |
57 /* definitions. */ | 57 /* definitions. */ |
58 /* */ | 58 /* */ |
59 /* Note also that you can similarly pre-define the macro */ | 59 /* Note also that you can similarly pre-define the macro */ |
60 /* FT_CONFIG_MODULES_H used to locate the file listing of the modules */ | 60 /* FT_CONFIG_MODULES_H used to locate the file listing of the modules */ |
61 /* that are statically linked to the library at compile time. By */ | 61 /* that are statically linked to the library at compile time. By */ |
62 /* default, this file is <freetype/config/ftmodule.h>. */ | 62 /* default, this file is <freetype/config/ftmodule.h>. */ |
63 /* */ | 63 /* */ |
64 /* We highly recommend using the third method whenever possible. */ | 64 /* We highly recommend using the third method whenever possible. */ |
65 /* */ | 65 /* */ |
66 /*************************************************************************/ | 66 /*************************************************************************/ |
67 | 67 |
68 | 68 |
69 /*************************************************************************/ | 69 /*************************************************************************/ |
70 /*************************************************************************/ | 70 /*************************************************************************/ |
71 /**** ****/ | 71 /**** ****/ |
72 /**** 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 ****/ | 72 /**** 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 ****/ |
73 /**** ****/ | 73 /**** ****/ |
74 /*************************************************************************/ | 74 /*************************************************************************/ |
75 /*************************************************************************/ | 75 /*************************************************************************/ |
76 | 76 |
77 | 77 |
78 /*************************************************************************/ | 78 /*************************************************************************/ |
79 /* */ | 79 /* */ |
| 80 /* If you enable this configuration option, FreeType recognizes an */ |
| 81 /* environment variable called `FREETYPE_PROPERTIES', which can be used */ |
| 82 /* to control the various font drivers and modules. The controllable */ |
| 83 /* properties are listed in the section `Controlling FreeType Modules' */ |
| 84 /* in the reference's table of contents; currently there are properties */ |
| 85 /* for the auto-hinter (file `ftautoh.h'), CFF (file `ftcffdrv.h'), and */ |
| 86 /* TrueType (file `ftttdrv.h'). */ |
| 87 /* */ |
| 88 /* `FREETYPE_PROPERTIES' has the following syntax form (broken here into */ |
| 89 /* multiple lines for better readability). */ |
| 90 /* */ |
| 91 /* <optional whitespace> */ |
| 92 /* <module-name1> ':' */ |
| 93 /* <property-name1> '=' <property-value1> */ |
| 94 /* <whitespace> */ |
| 95 /* <module-name2> ':' */ |
| 96 /* <property-name2> '=' <property-value2> */ |
| 97 /* ... */ |
| 98 /* */ |
| 99 /* Example: */ |
| 100 /* */ |
| 101 /* FREETYPE_PROPERTIES=truetype:interpreter-version=35 \ */ |
| 102 /* cff:no-stem-darkening=1 \ */ |
| 103 /* autofitter:warping=1 */ |
| 104 /* */ |
| 105 #define FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES |
| 106 |
| 107 |
| 108 /*************************************************************************/ |
| 109 /* */ |
80 /* Uncomment the line below if you want to activate sub-pixel rendering */ | 110 /* Uncomment the line below if you want to activate sub-pixel rendering */ |
81 /* (a.k.a. LCD rendering, or ClearType) in this build of the library. */ | 111 /* (a.k.a. LCD rendering, or ClearType) in this build of the library. */ |
82 /* */ | 112 /* */ |
83 /* Note that this feature is covered by several Microsoft patents */ | 113 /* Note that this feature is covered by several Microsoft patents */ |
84 /* and should not be activated in any default build of the library. */ | 114 /* and should not be activated in any default build of the library. */ |
85 /* */ | 115 /* */ |
86 /* This macro has no impact on the FreeType API, only on its */ | 116 /* This macro has no impact on the FreeType API, only on its */ |
87 /* _implementation_. For example, using FT_RENDER_MODE_LCD when calling */ | 117 /* _implementation_. For example, using FT_RENDER_MODE_LCD when calling */ |
88 /* FT_Render_Glyph still generates a bitmap that is 3 times wider than */ | 118 /* FT_Render_Glyph still generates a bitmap that is 3 times wider than */ |
89 /* the original size in case this macro isn't defined; however, each */ | 119 /* the original size in case this macro isn't defined; however, each */ |
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
579 /* */ | 609 /* */ |
580 /* Do not #undef this macro here, since the build system might */ | 610 /* Do not #undef this macro here, since the build system might */ |
581 /* define it for certain configurations only. */ | 611 /* define it for certain configurations only. */ |
582 /* */ | 612 /* */ |
583 #define TT_CONFIG_OPTION_BYTECODE_INTERPRETER | 613 #define TT_CONFIG_OPTION_BYTECODE_INTERPRETER |
584 | 614 |
585 | 615 |
586 /*************************************************************************/ | 616 /*************************************************************************/ |
587 /* */ | 617 /* */ |
588 /* Define TT_CONFIG_OPTION_SUBPIXEL_HINTING if you want to compile */ | 618 /* Define TT_CONFIG_OPTION_SUBPIXEL_HINTING if you want to compile */ |
589 /* EXPERIMENTAL subpixel hinting support into the TrueType driver. This */ | 619 /* subpixel hinting support into the TrueType driver. This modifies the */ |
590 /* replaces the native TrueType hinting mechanism when anything but */ | 620 /* TrueType hinting mechanism when anything but FT_RENDER_MODE_MONO is */ |
591 /* FT_RENDER_MODE_MONO is requested. */ | 621 /* requested. */ |
592 /* */ | 622 /* */ |
593 /* Enabling this causes the TrueType driver to ignore instructions under */ | 623 /* In particular, it modifies the bytecode interpreter to interpret (or */ |
594 /* certain conditions. This is done in accordance with the guide here, */ | 624 /* not) instructions in a certain way so that all TrueType fonts look */ |
595 /* with some minor differences: */ | 625 /* like they do in a Windows ClearType (DirectWrite) environment. See */ |
| 626 /* [1] for a technical overview on what this means. See `ttinterp.h' */ |
| 627 /* for more details on the LEAN option. */ |
596 /* */ | 628 /* */ |
597 /* http://www.microsoft.com/typography/cleartype/truetypecleartype.aspx */ | 629 /* There are three options. */ |
598 /* */ | 630 /* */ |
599 /* By undefining this, you only compile the code necessary to hint */ | 631 /* 1. This option is associated with the `Infinality' moniker. */ |
600 /* TrueType glyphs with native TT hinting. */ | 632 /* Contributed by an individual nicknamed Infinality with the goal of */ |
| 633 /* making TrueType fonts render better than on Windows. A high */ |
| 634 /* amount of configurability and flexibility, down to rules for */ |
| 635 /* single glyphs in fonts, but also very slow. Its experimental and */ |
| 636 /* slow nature and the original developer losing interest meant that */ |
| 637 /* this option was never enabled in default builds. */ |
601 /* */ | 638 /* */ |
602 /* This option requires TT_CONFIG_OPTION_BYTECODE_INTERPRETER to be */ | 639 /* 2. The new default mode for the TrueType driver. The Infinality code */ |
603 /* defined. */ | 640 /* base was stripped to the bare minimum and all configurability */ |
| 641 /* removed in the name of speed and simplicity. The configurability */ |
| 642 /* was mainly aimed at legacy fonts like Arial, Times New Roman, or */ |
| 643 /* Courier. Legacy fonts are fonts that modify vertical stems to */ |
| 644 /* achieve clean black-and-white bitmaps. The new mode focuses on */ |
| 645 /* applying a minimal set of rules to all fonts indiscriminately so */ |
| 646 /* that modern and web fonts render well while legacy fonts render */ |
| 647 /* okay. */ |
604 /* */ | 648 /* */ |
605 /* #define TT_CONFIG_OPTION_SUBPIXEL_HINTING */ | 649 /* 3. Compile both. */ |
| 650 /* */ |
| 651 /* By undefining these, you get rendering behavior like on Windows */ |
| 652 /* without ClearType, i.e., Windows XP without ClearType enabled and */ |
| 653 /* Win9x (interpreter version v35). Or not, depending on how much */ |
| 654 /* hinting blood and testing tears the font designer put into a given */ |
| 655 /* font. If you define one or both subpixel hinting options, you can */ |
| 656 /* switch between between v35 and the ones you define. */ |
| 657 /* */ |
| 658 /* This option requires TT_CONFIG_OPTION_BYTECODE_INTERPRETER to be */ |
| 659 /* defined. */ |
| 660 /* */ |
| 661 /* [1] http://www.microsoft.com/typography/cleartype/truetypecleartype.aspx */ |
| 662 /* */ |
| 663 /* #define TT_CONFIG_OPTION_SUBPIXEL_HINTING 1 */ |
| 664 #define TT_CONFIG_OPTION_SUBPIXEL_HINTING 2 |
| 665 /* #define TT_CONFIG_OPTION_SUBPIXEL_HINTING ( 1 | 2 ) */ |
606 | 666 |
607 | 667 |
608 /*************************************************************************/ | 668 /*************************************************************************/ |
609 /* */ | |
610 /* If you define TT_CONFIG_OPTION_UNPATENTED_HINTING, a special version */ | |
611 /* of the TrueType bytecode interpreter is used that doesn't implement */ | |
612 /* any of the patented opcodes and algorithms. The patents related to */ | |
613 /* TrueType hinting have expired worldwide since May 2010; this option */ | |
614 /* is now deprecated. */ | |
615 /* */ | |
616 /* Note that the TT_CONFIG_OPTION_UNPATENTED_HINTING macro is *ignored* */ | |
617 /* if you define TT_CONFIG_OPTION_BYTECODE_INTERPRETER; in other words, */ | |
618 /* either define TT_CONFIG_OPTION_BYTECODE_INTERPRETER or */ | |
619 /* TT_CONFIG_OPTION_UNPATENTED_HINTING but not both at the same time. */ | |
620 /* */ | |
621 /* This macro is only useful for a small number of font files (mostly */ | |
622 /* for Asian scripts) that require bytecode interpretation to properly */ | |
623 /* load glyphs. For all other fonts, this produces unpleasant results, */ | |
624 /* thus the unpatented interpreter is never used to load glyphs from */ | |
625 /* TrueType fonts unless one of the following two options is used. */ | |
626 /* */ | |
627 /* - The unpatented interpreter is explicitly activated by the user */ | |
628 /* through the FT_PARAM_TAG_UNPATENTED_HINTING parameter tag */ | |
629 /* when opening the FT_Face. */ | |
630 /* */ | |
631 /* - FreeType detects that the FT_Face corresponds to one of the */ | |
632 /* `trick' fonts (e.g., `Mingliu') it knows about. The font engine */ | |
633 /* contains a hard-coded list of font names and other matching */ | |
634 /* parameters (see function `tt_face_init' in file */ | |
635 /* `src/truetype/ttobjs.c'). */ | |
636 /* */ | |
637 /* Here a sample code snippet for using FT_PARAM_TAG_UNPATENTED_HINTING. */ | |
638 /* */ | |
639 /* { */ | |
640 /* FT_Parameter parameter; */ | |
641 /* FT_Open_Args open_args; */ | |
642 /* */ | |
643 /* */ | |
644 /* parameter.tag = FT_PARAM_TAG_UNPATENTED_HINTING; */ | |
645 /* */ | |
646 /* open_args.flags = FT_OPEN_PATHNAME | FT_OPEN_PARAMS; */ | |
647 /* open_args.pathname = my_font_pathname; */ | |
648 /* open_args.num_params = 1; */ | |
649 /* open_args.params = ¶meter; */ | |
650 /* */ | |
651 /* error = FT_Open_Face( library, &open_args, index, &face ); */ | |
652 /* ... */ | |
653 /* } */ | |
654 /* */ | |
655 /* #define TT_CONFIG_OPTION_UNPATENTED_HINTING */ | |
656 | |
657 | |
658 /*************************************************************************/ | |
659 /* */ | 669 /* */ |
660 /* Define TT_CONFIG_OPTION_COMPONENT_OFFSET_SCALED to compile the */ | 670 /* Define TT_CONFIG_OPTION_COMPONENT_OFFSET_SCALED to compile the */ |
661 /* TrueType glyph loader to use Apple's definition of how to handle */ | 671 /* TrueType glyph loader to use Apple's definition of how to handle */ |
662 /* component offsets in composite glyphs. */ | 672 /* component offsets in composite glyphs. */ |
663 /* */ | 673 /* */ |
664 /* Apple and MS disagree on the default behavior of component offsets */ | 674 /* Apple and MS disagree on the default behavior of component offsets */ |
665 /* in composites. Apple says that they should be scaled by the scaling */ | 675 /* in composites. Apple says that they should be scaled by the scaling */ |
666 /* factors in the transformation matrix (roughly, it's more complex) */ | 676 /* factors in the transformation matrix (roughly, it's more complex) */ |
667 /* while MS says they should not. OpenType defines two bits in the */ | 677 /* while MS says they should not. OpenType defines two bits in the */ |
668 /* composite flags array which can be used to disambiguate, but old */ | 678 /* composite flags array which can be used to disambiguate, but old */ |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
849 | 859 |
850 | 860 |
851 /* | 861 /* |
852 * This macro is obsolete. Support has been removed in FreeType | 862 * This macro is obsolete. Support has been removed in FreeType |
853 * version 2.5. | 863 * version 2.5. |
854 */ | 864 */ |
855 /* #define FT_CONFIG_OPTION_OLD_INTERNALS */ | 865 /* #define FT_CONFIG_OPTION_OLD_INTERNALS */ |
856 | 866 |
857 | 867 |
858 /* | 868 /* |
859 * This macro is defined if either unpatented or native TrueType | 869 * This macro is defined if native TrueType hinting is requested by the |
860 * hinting is requested by the definitions above. | 870 * definitions above. |
861 */ | 871 */ |
862 #ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER | 872 #ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER |
863 #define TT_USE_BYTECODE_INTERPRETER | 873 #define TT_USE_BYTECODE_INTERPRETER |
864 #undef TT_CONFIG_OPTION_UNPATENTED_HINTING | 874 |
865 #elif defined TT_CONFIG_OPTION_UNPATENTED_HINTING | 875 #if TT_CONFIG_OPTION_SUBPIXEL_HINTING & 1 |
866 #define TT_USE_BYTECODE_INTERPRETER | 876 #define TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY |
| 877 #endif |
| 878 |
| 879 #if TT_CONFIG_OPTION_SUBPIXEL_HINTING & 2 |
| 880 #define TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL |
| 881 #endif |
867 #endif | 882 #endif |
868 | 883 |
869 | 884 |
870 /* | 885 /* |
871 * Check CFF darkening parameters. The checks are the same as in function | 886 * Check CFF darkening parameters. The checks are the same as in function |
872 * `cff_property_set' in file `cffdrivr.c'. | 887 * `cff_property_set' in file `cffdrivr.c'. |
873 */ | 888 */ |
874 #if CFF_CONFIG_OPTION_DARKENING_PARAMETER_X1 < 0 || \ | 889 #if CFF_CONFIG_OPTION_DARKENING_PARAMETER_X1 < 0 || \ |
875 CFF_CONFIG_OPTION_DARKENING_PARAMETER_X2 < 0 || \ | 890 CFF_CONFIG_OPTION_DARKENING_PARAMETER_X2 < 0 || \ |
876 CFF_CONFIG_OPTION_DARKENING_PARAMETER_X3 < 0 || \ | 891 CFF_CONFIG_OPTION_DARKENING_PARAMETER_X3 < 0 || \ |
(...skipping 14 matching lines...) Expand all Loading... |
891 CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y1 > 500 || \ | 906 CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y1 > 500 || \ |
892 CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y2 > 500 || \ | 907 CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y2 > 500 || \ |
893 CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y3 > 500 || \ | 908 CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y3 > 500 || \ |
894 CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y4 > 500 | 909 CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y4 > 500 |
895 #error "Invalid CFF darkening parameters!" | 910 #error "Invalid CFF darkening parameters!" |
896 #endif | 911 #endif |
897 | 912 |
898 FT_END_HEADER | 913 FT_END_HEADER |
899 | 914 |
900 | 915 |
901 #endif /* __FTOPTION_H__ */ | 916 #endif /* FTOPTION_H_ */ |
902 | 917 |
903 | 918 |
904 /* END */ | 919 /* END */ |
OLD | NEW |