michael@0: /***************************************************************************/ michael@0: /* */ michael@0: /* ftautoh.h */ michael@0: /* */ michael@0: /* FreeType API for controlling the auto-hinter (specification only). */ michael@0: /* */ michael@0: /* Copyright 2012, 2013 by */ michael@0: /* David Turner, Robert Wilhelm, and Werner Lemberg. */ michael@0: /* */ michael@0: /* This file is part of the FreeType project, and may only be used, */ michael@0: /* modified, and distributed under the terms of the FreeType project */ michael@0: /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ michael@0: /* this file you indicate that you have read the license and */ michael@0: /* understand and accept it fully. */ michael@0: /* */ michael@0: /***************************************************************************/ michael@0: michael@0: michael@0: #ifndef __FTAUTOH_H__ michael@0: #define __FTAUTOH_H__ michael@0: michael@0: #include michael@0: #include FT_FREETYPE_H michael@0: michael@0: #ifdef FREETYPE_H michael@0: #error "freetype.h of FreeType 1 has been loaded!" michael@0: #error "Please fix the directory search order for header files" michael@0: #error "so that freetype.h of FreeType 2 is found first." michael@0: #endif michael@0: michael@0: michael@0: FT_BEGIN_HEADER michael@0: michael@0: michael@0: /************************************************************************** michael@0: * michael@0: * @section: michael@0: * auto_hinter michael@0: * michael@0: * @title: michael@0: * The auto-hinter michael@0: * michael@0: * @abstract: michael@0: * Controlling the auto-hinting module. michael@0: * michael@0: * @description: michael@0: * While FreeType's auto-hinter doesn't expose API functions by itself, michael@0: * it is possible to control its behaviour with @FT_Property_Set and michael@0: * @FT_Property_Get. The following lists the available properties michael@0: * together with the necessary macros and structures. michael@0: * michael@0: * Note that the auto-hinter's module name is `autofitter' for michael@0: * historical reasons. michael@0: * michael@0: */ michael@0: michael@0: michael@0: /************************************************************************** michael@0: * michael@0: * @property: michael@0: * glyph-to-script-map michael@0: * michael@0: * @description: michael@0: * *Experimental* *only* michael@0: * michael@0: * The auto-hinter provides various script modules to hint glyphs. michael@0: * Examples of supported scripts are Latin or CJK. Before a glyph is michael@0: * auto-hinted, the Unicode character map of the font gets examined, and michael@0: * the script is then determined based on Unicode character ranges, see michael@0: * below. michael@0: * michael@0: * OpenType fonts, however, often provide much more glyphs than michael@0: * character codes (small caps, superscripts, ligatures, swashes, etc.), michael@0: * to be controlled by so-called `features'. Handling OpenType features michael@0: * can be quite complicated and thus needs a separate library on top of michael@0: * FreeType. michael@0: * michael@0: * The mapping between glyph indices and scripts (in the auto-hinter michael@0: * sense, see the @FT_AUTOHINTER_SCRIPT_XXX values) is stored as an michael@0: * array with `num_glyphs' elements, as found in the font's @FT_Face michael@0: * structure. The `glyph-to-script-map' property returns a pointer to michael@0: * this array, which can be modified as needed. Note that the michael@0: * modification should happen before the first glyph gets processed by michael@0: * the auto-hinter so that the global analysis of the font shapes michael@0: * actually uses the modified mapping. michael@0: * michael@0: * The following example code demonstrates how to access it (omitting michael@0: * the error handling). michael@0: * michael@0: * { michael@0: * FT_Library library; michael@0: * FT_Face face; michael@0: * FT_Prop_GlyphToScriptMap prop; michael@0: * michael@0: * michael@0: * FT_Init_FreeType( &library ); michael@0: * FT_New_Face( library, "foo.ttf", 0, &face ); michael@0: * michael@0: * prop.face = face; michael@0: * michael@0: * FT_Property_Get( library, "autofitter", michael@0: * "glyph-to-script-map", &prop ); michael@0: * michael@0: * // adjust `prop.map' as needed right here michael@0: * michael@0: * FT_Load_Glyph( face, ..., FT_LOAD_FORCE_AUTOHINT ); michael@0: * } michael@0: * michael@0: */ michael@0: michael@0: michael@0: /************************************************************************** michael@0: * michael@0: * @enum: michael@0: * FT_AUTOHINTER_SCRIPT_XXX michael@0: * michael@0: * @description: michael@0: * *Experimental* *only* michael@0: * michael@0: * A list of constants used for the @glyph-to-script-map property to michael@0: * specify the script submodule the auto-hinter should use for hinting a michael@0: * particular glyph. michael@0: * michael@0: * @values: michael@0: * FT_AUTOHINTER_SCRIPT_NONE :: michael@0: * Don't auto-hint this glyph. michael@0: * michael@0: * FT_AUTOHINTER_SCRIPT_LATIN :: michael@0: * Apply the latin auto-hinter. For the auto-hinter, `latin' is a michael@0: * very broad term, including Cyrillic and Greek also since characters michael@0: * from those scripts share the same design constraints. michael@0: * michael@0: * By default, characters from the following Unicode ranges are michael@0: * assigned to this submodule. michael@0: * michael@0: * { michael@0: * U+0020 - U+007F // Basic Latin (no control characters) michael@0: * U+00A0 - U+00FF // Latin-1 Supplement (no control characters) michael@0: * U+0100 - U+017F // Latin Extended-A michael@0: * U+0180 - U+024F // Latin Extended-B michael@0: * U+0250 - U+02AF // IPA Extensions michael@0: * U+02B0 - U+02FF // Spacing Modifier Letters michael@0: * U+0300 - U+036F // Combining Diacritical Marks michael@0: * U+0370 - U+03FF // Greek and Coptic michael@0: * U+0400 - U+04FF // Cyrillic michael@0: * U+0500 - U+052F // Cyrillic Supplement michael@0: * U+1D00 - U+1D7F // Phonetic Extensions michael@0: * U+1D80 - U+1DBF // Phonetic Extensions Supplement michael@0: * U+1DC0 - U+1DFF // Combining Diacritical Marks Supplement michael@0: * U+1E00 - U+1EFF // Latin Extended Additional michael@0: * U+1F00 - U+1FFF // Greek Extended michael@0: * U+2000 - U+206F // General Punctuation michael@0: * U+2070 - U+209F // Superscripts and Subscripts michael@0: * U+20A0 - U+20CF // Currency Symbols michael@0: * U+2150 - U+218F // Number Forms michael@0: * U+2460 - U+24FF // Enclosed Alphanumerics michael@0: * U+2C60 - U+2C7F // Latin Extended-C michael@0: * U+2DE0 - U+2DFF // Cyrillic Extended-A michael@0: * U+2E00 - U+2E7F // Supplemental Punctuation michael@0: * U+A640 - U+A69F // Cyrillic Extended-B michael@0: * U+A720 - U+A7FF // Latin Extended-D michael@0: * U+FB00 - U+FB06 // Alphab. Present. Forms (Latin Ligatures) michael@0: * U+1D400 - U+1D7FF // Mathematical Alphanumeric Symbols michael@0: * U+1F100 - U+1F1FF // Enclosed Alphanumeric Supplement michael@0: * } michael@0: * michael@0: * FT_AUTOHINTER_SCRIPT_CJK :: michael@0: * Apply the CJK auto-hinter, covering Chinese, Japanese, Korean, old michael@0: * Vietnamese, and some other scripts. michael@0: * michael@0: * By default, characters from the following Unicode ranges are michael@0: * assigned to this submodule. michael@0: * michael@0: * { michael@0: * U+1100 - U+11FF // Hangul Jamo michael@0: * U+2E80 - U+2EFF // CJK Radicals Supplement michael@0: * U+2F00 - U+2FDF // Kangxi Radicals michael@0: * U+2FF0 - U+2FFF // Ideographic Description Characters michael@0: * U+3000 - U+303F // CJK Symbols and Punctuation michael@0: * U+3040 - U+309F // Hiragana michael@0: * U+30A0 - U+30FF // Katakana michael@0: * U+3100 - U+312F // Bopomofo michael@0: * U+3130 - U+318F // Hangul Compatibility Jamo michael@0: * U+3190 - U+319F // Kanbun michael@0: * U+31A0 - U+31BF // Bopomofo Extended michael@0: * U+31C0 - U+31EF // CJK Strokes michael@0: * U+31F0 - U+31FF // Katakana Phonetic Extensions michael@0: * U+3200 - U+32FF // Enclosed CJK Letters and Months michael@0: * U+3300 - U+33FF // CJK Compatibility michael@0: * U+3400 - U+4DBF // CJK Unified Ideographs Extension A michael@0: * U+4DC0 - U+4DFF // Yijing Hexagram Symbols michael@0: * U+4E00 - U+9FFF // CJK Unified Ideographs michael@0: * U+A960 - U+A97F // Hangul Jamo Extended-A michael@0: * U+AC00 - U+D7AF // Hangul Syllables michael@0: * U+D7B0 - U+D7FF // Hangul Jamo Extended-B michael@0: * U+F900 - U+FAFF // CJK Compatibility Ideographs michael@0: * U+FE10 - U+FE1F // Vertical forms michael@0: * U+FE30 - U+FE4F // CJK Compatibility Forms michael@0: * U+FF00 - U+FFEF // Halfwidth and Fullwidth Forms michael@0: * U+1B000 - U+1B0FF // Kana Supplement michael@0: * U+1D300 - U+1D35F // Tai Xuan Hing Symbols michael@0: * U+1F200 - U+1F2FF // Enclosed Ideographic Supplement michael@0: * U+20000 - U+2A6DF // CJK Unified Ideographs Extension B michael@0: * U+2A700 - U+2B73F // CJK Unified Ideographs Extension C michael@0: * U+2B740 - U+2B81F // CJK Unified Ideographs Extension D michael@0: * U+2F800 - U+2FA1F // CJK Compatibility Ideographs Supplement michael@0: * } michael@0: * michael@0: * FT_AUTOHINTER_SCRIPT_INDIC :: michael@0: * Apply the indic auto-hinter, covering all major scripts from the michael@0: * Indian sub-continent and some other related scripts like Thai, Lao, michael@0: * or Tibetan. michael@0: * michael@0: * By default, characters from the following Unicode ranges are michael@0: * assigned to this submodule. michael@0: * michael@0: * { michael@0: * U+0900 - U+0DFF // Indic Range michael@0: * U+0F00 - U+0FFF // Tibetan michael@0: * U+1900 - U+194F // Limbu michael@0: * U+1B80 - U+1BBF // Sundanese michael@0: * U+1C80 - U+1CDF // Meetei Mayak michael@0: * U+A800 - U+A82F // Syloti Nagri michael@0: * U+11800 - U+118DF // Sharada michael@0: * } michael@0: * michael@0: * Note that currently Indic support is rudimentary only, missing blue michael@0: * zone support. michael@0: * michael@0: */ michael@0: #define FT_AUTOHINTER_SCRIPT_NONE 0 michael@0: #define FT_AUTOHINTER_SCRIPT_LATIN 1 michael@0: #define FT_AUTOHINTER_SCRIPT_CJK 2 michael@0: #define FT_AUTOHINTER_SCRIPT_INDIC 3 michael@0: michael@0: michael@0: /************************************************************************** michael@0: * michael@0: * @struct: michael@0: * FT_Prop_GlyphToScriptMap michael@0: * michael@0: * @description: michael@0: * *Experimental* *only* michael@0: * michael@0: * The data exchange structure for the @glyph-to-script-map property. michael@0: * michael@0: */ michael@0: typedef struct FT_Prop_GlyphToScriptMap_ michael@0: { michael@0: FT_Face face; michael@0: FT_Byte* map; michael@0: michael@0: } FT_Prop_GlyphToScriptMap; michael@0: michael@0: michael@0: /************************************************************************** michael@0: * michael@0: * @property: michael@0: * fallback-script michael@0: * michael@0: * @description: michael@0: * *Experimental* *only* michael@0: * michael@0: * If no auto-hinter script module can be assigned to a glyph, a michael@0: * fallback script gets assigned to it (see also the michael@0: * @glyph-to-script-map property). By default, this is michael@0: * @FT_AUTOHINTER_SCRIPT_CJK. Using the `fallback-script' property, michael@0: * this fallback value can be changed. michael@0: * michael@0: * { michael@0: * FT_Library library; michael@0: * FT_UInt fallback_script = FT_AUTOHINTER_SCRIPT_NONE; michael@0: * michael@0: * michael@0: * FT_Init_FreeType( &library ); michael@0: * michael@0: * FT_Property_Set( library, "autofitter", michael@0: * "fallback-script", &fallback_script ); michael@0: * } michael@0: * michael@0: * @note: michael@0: * This property can be used with @FT_Property_Get also. michael@0: * michael@0: * It's important to use the right timing for changing this value: The michael@0: * creation of the glyph-to-script map that eventually uses the michael@0: * fallback script value gets triggered either by setting or reading a michael@0: * face-specific property like @glyph-to-script-map, or by auto-hinting michael@0: * any glyph from that face. In particular, if you have already created michael@0: * an @FT_Face structure but not loaded any glyph (using the michael@0: * auto-hinter), a change of the fallback script will affect this face. michael@0: * michael@0: */ michael@0: michael@0: michael@0: /************************************************************************** michael@0: * michael@0: * @property: michael@0: * default-script michael@0: * michael@0: * @description: michael@0: * *Experimental* *only* michael@0: * michael@0: * If Freetype gets compiled with FT_CONFIG_OPTION_USE_HARFBUZZ to make michael@0: * the HarfBuzz library access OpenType features for getting better michael@0: * glyph coverages, this property sets the (auto-fitter) script to be michael@0: * used for the default (OpenType) script data of a font's GSUB table. michael@0: * Features for the default script are intended for all scripts not michael@0: * explicitly handled in GSUB; an example is a `dlig' feature, michael@0: * containing the combination of the characters `T', `E', and `L' to michael@0: * form a `TEL' ligature. michael@0: * michael@0: * By default, this is @FT_AUTOHINTER_SCRIPT_LATIN. Using the michael@0: * `default-script' property, this default value can be changed. michael@0: * michael@0: * { michael@0: * FT_Library library; michael@0: * FT_UInt default_script = FT_AUTOHINTER_SCRIPT_NONE; michael@0: * michael@0: * michael@0: * FT_Init_FreeType( &library ); michael@0: * michael@0: * FT_Property_Set( library, "autofitter", michael@0: * "default-script", &default_script ); michael@0: * } michael@0: * michael@0: * @note: michael@0: * This property can be used with @FT_Property_Get also. michael@0: * michael@0: * It's important to use the right timing for changing this value: The michael@0: * creation of the glyph-to-script map that eventually uses the michael@0: * default script value gets triggered either by setting or reading a michael@0: * face-specific property like @glyph-to-script-map, or by auto-hinting michael@0: * any glyph from that face. In particular, if you have already created michael@0: * an @FT_Face structure but not loaded any glyph (using the michael@0: * auto-hinter), a change of the default script will affect this face. michael@0: * michael@0: */ michael@0: michael@0: michael@0: /************************************************************************** michael@0: * michael@0: * @property: michael@0: * increase-x-height michael@0: * michael@0: * @description: michael@0: * For ppem values in the range 6~<= ppem <= `increase-x-height', round michael@0: * up the font's x~height much more often than normally. If the value michael@0: * is set to~0, which is the default, this feature is switched off. Use michael@0: * this property to improve the legibility of small font sizes if michael@0: * necessary. michael@0: * michael@0: * { michael@0: * FT_Library library; michael@0: * FT_Face face; michael@0: * FT_Prop_IncreaseXHeight prop; michael@0: * michael@0: * michael@0: * FT_Init_FreeType( &library ); michael@0: * FT_New_Face( library, "foo.ttf", 0, &face ); michael@0: * FT_Set_Char_Size( face, 10 * 64, 0, 72, 0 ); michael@0: * michael@0: * prop.face = face; michael@0: * prop.limit = 14; michael@0: * michael@0: * FT_Property_Set( library, "autofitter", michael@0: * "increase-x-height", &prop ); michael@0: * } michael@0: * michael@0: * @note: michael@0: * This property can be used with @FT_Property_Get also. michael@0: * michael@0: * Set this value right after calling @FT_Set_Char_Size, but before michael@0: * loading any glyph (using the auto-hinter). michael@0: * michael@0: */ michael@0: michael@0: michael@0: /************************************************************************** michael@0: * michael@0: * @struct: michael@0: * FT_Prop_IncreaseXHeight michael@0: * michael@0: * @description: michael@0: * The data exchange structure for the @increase-x-height property. michael@0: * michael@0: */ michael@0: typedef struct FT_Prop_IncreaseXHeight_ michael@0: { michael@0: FT_Face face; michael@0: FT_UInt limit; michael@0: michael@0: } FT_Prop_IncreaseXHeight; michael@0: michael@0: michael@0: /* */ michael@0: michael@0: FT_END_HEADER michael@0: michael@0: #endif /* __FTAUTOH_H__ */ michael@0: michael@0: michael@0: /* END */