1/***************************************************************************/ 2/* */ 3/* ftautoh.h */ 4/* */ 5/* FreeType API for controlling the auto-hinter (specification only). */ 6/* */ 7/* Copyright 2012 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 18 19#ifndef __FTAUTOH_H__ 20#define __FTAUTOH_H__ 21 22#include <ft2build.h> 23#include FT_FREETYPE_H 24 25#ifdef FREETYPE_H 26#error "freetype.h of FreeType 1 has been loaded!" 27#error "Please fix the directory search order for header files" 28#error "so that freetype.h of FreeType 2 is found first." 29#endif 30 31 32FT_BEGIN_HEADER 33 34 35 /************************************************************************** 36 * 37 * @section: 38 * auto_hinter 39 * 40 * @title: 41 * The auto-hinter 42 * 43 * @abstract: 44 * Controlling the auto-hinting module. 45 * 46 * @description: 47 * While FreeType's auto-hinter doesn't expose API functions by itself, 48 * it is possible to control its behaviour with @FT_Property_Set and 49 * @FT_Property_Get. The following lists the available properties 50 * together with the necessary macros and structures. 51 * 52 * Note that the auto-hinter's module name is `autofitter' for 53 * historical reasons. 54 * 55 */ 56 57 58 /************************************************************************** 59 * 60 * @property: 61 * glyph-to-script-map 62 * 63 * @description: 64 * The auto-hinter provides various script modules to hint glyphs. 65 * Examples of supported scripts are Latin or CJK. Before a glyph is 66 * auto-hinted, the Unicode character map of the font gets examined, and 67 * the script is then determined based on Unicode character ranges, see 68 * below. 69 * 70 * OpenType fonts, however, often provide much more glyphs than 71 * character codes (small caps, superscripts, ligatures, swashes, etc.), 72 * to be controlled by so-called `features'. Handling OpenType features 73 * can be quite complicated and thus needs a separate library on top of 74 * FreeType. 75 * 76 * The mapping between glyph indices and scripts (in the auto-hinter 77 * sense, see the @FT_AUTOHINTER_SCRIPT_XXX values) is stored as an 78 * array with `num_glyphs' elements, as found in the font's @FT_Face 79 * structure. The `glyph-to-script-map' property returns a pointer to 80 * this array which can be modified as needed. Note that the 81 * modification should happen before the first glyph gets processed by 82 * the auto-hinter so that the global analysis of the font shapes 83 * actually uses the modified mapping. 84 * 85 * The following example code demonstrates how to access it (omitting 86 * the error handling). 87 * 88 * { 89 * FT_Library library; 90 * FT_Face face; 91 * FT_Prop_GlyphToScriptMap prop; 92 * 93 * 94 * FT_Init_FreeType( &library ); 95 * FT_New_Face( library, "foo.ttf", 0, &face ); 96 * 97 * prop.face = face; 98 * 99 * FT_Property_Get( library, "autofitter", 100 * "glyph-to-script-map", &prop ); 101 * 102 * // adjust `prop.map' as needed right here 103 * 104 * FT_Load_Glyph( face, ..., FT_LOAD_FORCE_AUTOHINT ); 105 * } 106 * 107 */ 108 109 110 /************************************************************************** 111 * 112 * @enum: 113 * FT_AUTOHINTER_SCRIPT_XXX 114 * 115 * @description: 116 * A list of constants used for the @glyph-to-script-map property to 117 * specify the script submodule the auto-hinter should use for hinting a 118 * particular glyph. 119 * 120 * @values: 121 * FT_AUTOHINTER_SCRIPT_NONE :: 122 * Don't auto-hint this glyph. 123 * 124 * FT_AUTOHINTER_SCRIPT_LATIN :: 125 * Apply the latin auto-hinter. For the auto-hinter, `latin' is a 126 * very broad term, including Cyrillic and Greek also since characters 127 * from those scripts share the same design constraints. 128 * 129 * By default, characters from the following Unicode ranges are 130 * assigned to this submodule. 131 * 132 * { 133 * U+0020 - U+007F // Basic Latin (no control characters) 134 * U+00A0 - U+00FF // Latin-1 Supplement (no control characters) 135 * U+0100 - U+017F // Latin Extended-A 136 * U+0180 - U+024F // Latin Extended-B 137 * U+0250 - U+02AF // IPA Extensions 138 * U+02B0 - U+02FF // Spacing Modifier Letters 139 * U+0300 - U+036F // Combining Diacritical Marks 140 * U+0370 - U+03FF // Greek and Coptic 141 * U+0400 - U+04FF // Cyrillic 142 * U+0500 - U+052F // Cyrillic Supplement 143 * U+1D00 - U+1D7F // Phonetic Extensions 144 * U+1D80 - U+1DBF // Phonetic Extensions Supplement 145 * U+1DC0 - U+1DFF // Combining Diacritical Marks Supplement 146 * U+1E00 - U+1EFF // Latin Extended Additional 147 * U+1F00 - U+1FFF // Greek Extended 148 * U+2000 - U+206F // General Punctuation 149 * U+2070 - U+209F // Superscripts and Subscripts 150 * U+20A0 - U+20CF // Currency Symbols 151 * U+2150 - U+218F // Number Forms 152 * U+2460 - U+24FF // Enclosed Alphanumerics 153 * U+2C60 - U+2C7F // Latin Extended-C 154 * U+2DE0 - U+2DFF // Cyrillic Extended-A 155 * U+2E00 - U+2E7F // Supplemental Punctuation 156 * U+A640 - U+A69F // Cyrillic Extended-B 157 * U+A720 - U+A7FF // Latin Extended-D 158 * U+FB00 - U+FB06 // Alphab. Present. Forms (Latin Ligatures) 159 * U+1D400 - U+1D7FF // Mathematical Alphanumeric Symbols 160 * U+1F100 - U+1F1FF // Enclosed Alphanumeric Supplement 161 * } 162 * 163 * FT_AUTOHINTER_SCRIPT_CJK :: 164 * Apply the CJK auto-hinter, covering Chinese, Japanese, Korean, old 165 * Vietnamese, and some other scripts. 166 * 167 * By default, characters from the following Unicode ranges are 168 * assigned to this submodule. 169 * 170 * { 171 * U+1100 - U+11FF // Hangul Jamo 172 * U+2E80 - U+2EFF // CJK Radicals Supplement 173 * U+2F00 - U+2FDF // Kangxi Radicals 174 * U+2FF0 - U+2FFF // Ideographic Description Characters 175 * U+3000 - U+303F // CJK Symbols and Punctuation 176 * U+3040 - U+309F // Hiragana 177 * U+30A0 - U+30FF // Katakana 178 * U+3100 - U+312F // Bopomofo 179 * U+3130 - U+318F // Hangul Compatibility Jamo 180 * U+3190 - U+319F // Kanbun 181 * U+31A0 - U+31BF // Bopomofo Extended 182 * U+31C0 - U+31EF // CJK Strokes 183 * U+31F0 - U+31FF // Katakana Phonetic Extensions 184 * U+3200 - U+32FF // Enclosed CJK Letters and Months 185 * U+3300 - U+33FF // CJK Compatibility 186 * U+3400 - U+4DBF // CJK Unified Ideographs Extension A 187 * U+4DC0 - U+4DFF // Yijing Hexagram Symbols 188 * U+4E00 - U+9FFF // CJK Unified Ideographs 189 * U+A960 - U+A97F // Hangul Jamo Extended-A 190 * U+AC00 - U+D7AF // Hangul Syllables 191 * U+D7B0 - U+D7FF // Hangul Jamo Extended-B 192 * U+F900 - U+FAFF // CJK Compatibility Ideographs 193 * U+FE10 - U+FE1F // Vertical forms 194 * U+FE30 - U+FE4F // CJK Compatibility Forms 195 * U+FF00 - U+FFEF // Halfwidth and Fullwidth Forms 196 * U+1B000 - U+1B0FF // Kana Supplement 197 * U+1D300 - U+1D35F // Tai Xuan Hing Symbols 198 * U+1F200 - U+1F2FF // Enclosed Ideographic Supplement 199 * U+20000 - U+2A6DF // CJK Unified Ideographs Extension B 200 * U+2A700 - U+2B73F // CJK Unified Ideographs Extension C 201 * U+2B740 - U+2B81F // CJK Unified Ideographs Extension D 202 * U+2F800 - U+2FA1F // CJK Compatibility Ideographs Supplement 203 * } 204 * 205 * FT_AUTOHINTER_SCRIPT_INDIC :: 206 * Apply the indic auto-hinter, covering all major scripts from the 207 * Indian sub-continent and some other related scripts like Thai, Lao, 208 * or Tibetan. 209 * 210 * By default, characters from the following Unicode ranges are 211 * assigned to this submodule. 212 * 213 * { 214 * U+0900 - U+0DFF // Indic Range 215 * U+0F00 - U+0FFF // Tibetan 216 * U+1900 - U+194F // Limbu 217 * U+1B80 - U+1BBF // Sundanese 218 * U+1C80 - U+1CDF // Meetei Mayak 219 * U+A800 - U+A82F // Syloti Nagri 220 * U+11800 - U+118DF // Sharada 221 * } 222 * 223 * Note that currently Indic support is rudimentary only, missing blue 224 * zone support. 225 * 226 */ 227#define FT_AUTOHINTER_SCRIPT_NONE 0 228#define FT_AUTOHINTER_SCRIPT_LATIN 1 229#define FT_AUTOHINTER_SCRIPT_CJK 2 230#define FT_AUTOHINTER_SCRIPT_INDIC 3 231 232 233 /************************************************************************** 234 * 235 * @struct: 236 * FT_Prop_GlyphToScriptMap 237 * 238 * @description: 239 * The data exchange structure for the @glyph-to-script-map property. 240 * 241 */ 242 typedef struct FT_Prop_GlyphToScriptMap_ 243 { 244 FT_Face face; 245 FT_Byte* map; 246 247 } FT_Prop_GlyphToScriptMap; 248 249 250 /************************************************************************** 251 * 252 * @property: 253 * fallback-script 254 * 255 * @description: 256 * If no auto-hinter script module can be assigned to a glyph, a 257 * fallback script gets assigned to it (see also the 258 * @glyph-to-script-map property). By default, this is 259 * @FT_AUTOHINTER_SCRIPT_CJK. Using the `fallback-script' property, 260 * this fallback value can be changed. 261 * 262 * { 263 * FT_Library library; 264 * FT_UInt fallback_script = FT_AUTOHINTER_SCRIPT_NONE; 265 * 266 * 267 * FT_Init_FreeType( &library ); 268 * 269 * FT_Property_Set( library, "autofitter", 270 * "fallback-script", &fallback_script ); 271 * } 272 * 273 * @note: 274 * This property can be used with @FT_Property_Get also. 275 * 276 * It's important to use the right timing for changing this value: The 277 * creation of the glyph-to-script map which eventually uses the 278 * fallback script value gets triggered either by setting or reading a 279 * face-specific property like @glyph-to-script-map, or by auto-hinting 280 * any glyph from that face. In particular, if you have already created 281 * an @FT_Face structure but not loaded any glyph (using the 282 * auto-hinter), a change of the fallback glyph will affect this face. 283 * 284 */ 285 286 287 /************************************************************************** 288 * 289 * @property: 290 * increase-x-height 291 * 292 * @description: 293 * For ppem values in the range 6~<= ppem <= `increase-x-height', round 294 * up the font's x~height much more often than normally. If the value 295 * is set to~0, which is the default, this feature is switched off. Use 296 * this property to improve the legibility of small font sizes if 297 * necessary. 298 * 299 * { 300 * FT_Library library; 301 * FT_Face face; 302 * FT_Prop_IncreaseXHeight prop; 303 * 304 * 305 * FT_Init_FreeType( &library ); 306 * FT_New_Face( library, "foo.ttf", 0, &face ); 307 * FT_Set_Char_Size( face, 10 * 64, 0, 72, 0 ); 308 * 309 * prop.face = face; 310 * prop.limit = 14; 311 * 312 * FT_Property_Set( library, "autofitter", 313 * "increase-x-height", &prop ); 314 * } 315 * 316 * @note: 317 * This property can be used with @FT_Property_Get also. 318 * 319 * Set this value right after calling @FT_Set_Char_Size, but before 320 * loading any glyph (using the auto-hinter). 321 * 322 */ 323 324 325 /************************************************************************** 326 * 327 * @struct: 328 * FT_Prop_IncreaseXHeight 329 * 330 * @description: 331 * The data exchange structure for the @increase-x-height property. 332 * 333 */ 334 typedef struct FT_Prop_IncreaseXHeight_ 335 { 336 FT_Face face; 337 FT_UInt limit; 338 339 } FT_Prop_IncreaseXHeight; 340 341 342 /* */ 343 344FT_END_HEADER 345 346#endif /* __FTAUTOH_H__ */ 347 348 349/* END */ 350