modules/freetype2/include/ftadvanc.h

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

michael@0 1 /***************************************************************************/
michael@0 2 /* */
michael@0 3 /* ftadvanc.h */
michael@0 4 /* */
michael@0 5 /* Quick computation of advance widths (specification only). */
michael@0 6 /* */
michael@0 7 /* Copyright 2008, 2013 by */
michael@0 8 /* David Turner, Robert Wilhelm, and Werner Lemberg. */
michael@0 9 /* */
michael@0 10 /* This file is part of the FreeType project, and may only be used, */
michael@0 11 /* modified, and distributed under the terms of the FreeType project */
michael@0 12 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */
michael@0 13 /* this file you indicate that you have read the license and */
michael@0 14 /* understand and accept it fully. */
michael@0 15 /* */
michael@0 16 /***************************************************************************/
michael@0 17
michael@0 18
michael@0 19 #ifndef __FTADVANC_H__
michael@0 20 #define __FTADVANC_H__
michael@0 21
michael@0 22
michael@0 23 #include <ft2build.h>
michael@0 24 #include FT_FREETYPE_H
michael@0 25
michael@0 26 #ifdef FREETYPE_H
michael@0 27 #error "freetype.h of FreeType 1 has been loaded!"
michael@0 28 #error "Please fix the directory search order for header files"
michael@0 29 #error "so that freetype.h of FreeType 2 is found first."
michael@0 30 #endif
michael@0 31
michael@0 32
michael@0 33 FT_BEGIN_HEADER
michael@0 34
michael@0 35
michael@0 36 /**************************************************************************
michael@0 37 *
michael@0 38 * @section:
michael@0 39 * quick_advance
michael@0 40 *
michael@0 41 * @title:
michael@0 42 * Quick retrieval of advance values
michael@0 43 *
michael@0 44 * @abstract:
michael@0 45 * Retrieve horizontal and vertical advance values without processing
michael@0 46 * glyph outlines, if possible.
michael@0 47 *
michael@0 48 * @description:
michael@0 49 * This section contains functions to quickly extract advance values
michael@0 50 * without handling glyph outlines, if possible.
michael@0 51 */
michael@0 52
michael@0 53
michael@0 54 /*************************************************************************/
michael@0 55 /* */
michael@0 56 /* <Const> */
michael@0 57 /* FT_ADVANCE_FLAG_FAST_ONLY */
michael@0 58 /* */
michael@0 59 /* <Description> */
michael@0 60 /* A bit-flag to be OR-ed with the `flags' parameter of the */
michael@0 61 /* @FT_Get_Advance and @FT_Get_Advances functions. */
michael@0 62 /* */
michael@0 63 /* If set, it indicates that you want these functions to fail if the */
michael@0 64 /* corresponding hinting mode or font driver doesn't allow for very */
michael@0 65 /* quick advance computation. */
michael@0 66 /* */
michael@0 67 /* Typically, glyphs that are either unscaled, unhinted, bitmapped, */
michael@0 68 /* or light-hinted can have their advance width computed very */
michael@0 69 /* quickly. */
michael@0 70 /* */
michael@0 71 /* Normal and bytecode hinted modes that require loading, scaling, */
michael@0 72 /* and hinting of the glyph outline, are extremely slow by */
michael@0 73 /* comparison. */
michael@0 74 /* */
michael@0 75 #define FT_ADVANCE_FLAG_FAST_ONLY 0x20000000UL
michael@0 76
michael@0 77
michael@0 78 /*************************************************************************/
michael@0 79 /* */
michael@0 80 /* <Function> */
michael@0 81 /* FT_Get_Advance */
michael@0 82 /* */
michael@0 83 /* <Description> */
michael@0 84 /* Retrieve the advance value of a given glyph outline in an */
michael@0 85 /* @FT_Face. */
michael@0 86 /* */
michael@0 87 /* <Input> */
michael@0 88 /* face :: The source @FT_Face handle. */
michael@0 89 /* */
michael@0 90 /* gindex :: The glyph index. */
michael@0 91 /* */
michael@0 92 /* load_flags :: A set of bit flags similar to those used when */
michael@0 93 /* calling @FT_Load_Glyph, used to determine what kind */
michael@0 94 /* of advances you need. */
michael@0 95 /* <Output> */
michael@0 96 /* padvance :: The advance value. If scaling is performed (based on */
michael@0 97 /* the value of `load_flags'), the advance value is in */
michael@0 98 /* 16.16 format. Otherwise, it is in font units. */
michael@0 99 /* */
michael@0 100 /* If @FT_LOAD_VERTICAL_LAYOUT is set, this is the */
michael@0 101 /* vertical advance corresponding to a vertical layout. */
michael@0 102 /* Otherwise, it is the horizontal advance in a */
michael@0 103 /* horizontal layout. */
michael@0 104 /* */
michael@0 105 /* <Return> */
michael@0 106 /* FreeType error code. 0 means success. */
michael@0 107 /* */
michael@0 108 /* <Note> */
michael@0 109 /* This function may fail if you use @FT_ADVANCE_FLAG_FAST_ONLY and */
michael@0 110 /* if the corresponding font backend doesn't have a quick way to */
michael@0 111 /* retrieve the advances. */
michael@0 112 /* */
michael@0 113 /* A scaled advance is returned in 16.16 format but isn't transformed */
michael@0 114 /* by the affine transformation specified by @FT_Set_Transform. */
michael@0 115 /* */
michael@0 116 FT_EXPORT( FT_Error )
michael@0 117 FT_Get_Advance( FT_Face face,
michael@0 118 FT_UInt gindex,
michael@0 119 FT_Int32 load_flags,
michael@0 120 FT_Fixed *padvance );
michael@0 121
michael@0 122
michael@0 123 /*************************************************************************/
michael@0 124 /* */
michael@0 125 /* <Function> */
michael@0 126 /* FT_Get_Advances */
michael@0 127 /* */
michael@0 128 /* <Description> */
michael@0 129 /* Retrieve the advance values of several glyph outlines in an */
michael@0 130 /* @FT_Face. */
michael@0 131 /* */
michael@0 132 /* <Input> */
michael@0 133 /* face :: The source @FT_Face handle. */
michael@0 134 /* */
michael@0 135 /* start :: The first glyph index. */
michael@0 136 /* */
michael@0 137 /* count :: The number of advance values you want to retrieve. */
michael@0 138 /* */
michael@0 139 /* load_flags :: A set of bit flags similar to those used when */
michael@0 140 /* calling @FT_Load_Glyph. */
michael@0 141 /* */
michael@0 142 /* <Output> */
michael@0 143 /* padvance :: The advance values. This array, to be provided by the */
michael@0 144 /* caller, must contain at least `count' elements. */
michael@0 145 /* */
michael@0 146 /* If scaling is performed (based on the value of */
michael@0 147 /* `load_flags'), the advance values are in 16.16 format. */
michael@0 148 /* Otherwise, they are in font units. */
michael@0 149 /* */
michael@0 150 /* If @FT_LOAD_VERTICAL_LAYOUT is set, these are the */
michael@0 151 /* vertical advances corresponding to a vertical layout. */
michael@0 152 /* Otherwise, they are the horizontal advances in a */
michael@0 153 /* horizontal layout. */
michael@0 154 /* */
michael@0 155 /* <Return> */
michael@0 156 /* FreeType error code. 0 means success. */
michael@0 157 /* */
michael@0 158 /* <Note> */
michael@0 159 /* This function may fail if you use @FT_ADVANCE_FLAG_FAST_ONLY and */
michael@0 160 /* if the corresponding font backend doesn't have a quick way to */
michael@0 161 /* retrieve the advances. */
michael@0 162 /* */
michael@0 163 /* Scaled advances are returned in 16.16 format but aren't */
michael@0 164 /* transformed by the affine transformation specified by */
michael@0 165 /* @FT_Set_Transform. */
michael@0 166 /* */
michael@0 167 FT_EXPORT( FT_Error )
michael@0 168 FT_Get_Advances( FT_Face face,
michael@0 169 FT_UInt start,
michael@0 170 FT_UInt count,
michael@0 171 FT_Int32 load_flags,
michael@0 172 FT_Fixed *padvances );
michael@0 173
michael@0 174 /* */
michael@0 175
michael@0 176
michael@0 177 FT_END_HEADER
michael@0 178
michael@0 179 #endif /* __FTADVANC_H__ */
michael@0 180
michael@0 181
michael@0 182 /* END */

mercurial