vrshoot

annotate libs/ft2static/freetype/internal/autohint.h @ 0:b2f14e535253

initial commit
author John Tsiombikas <nuclear@member.fsf.org>
date Sat, 01 Feb 2014 19:58:19 +0200
parents
children
rev   line source
nuclear@0 1 /***************************************************************************/
nuclear@0 2 /* */
nuclear@0 3 /* autohint.h */
nuclear@0 4 /* */
nuclear@0 5 /* High-level `autohint' module-specific interface (specification). */
nuclear@0 6 /* */
nuclear@0 7 /* Copyright 1996-2001, 2002, 2007 by */
nuclear@0 8 /* David Turner, Robert Wilhelm, and Werner Lemberg. */
nuclear@0 9 /* */
nuclear@0 10 /* This file is part of the FreeType project, and may only be used, */
nuclear@0 11 /* modified, and distributed under the terms of the FreeType project */
nuclear@0 12 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */
nuclear@0 13 /* this file you indicate that you have read the license and */
nuclear@0 14 /* understand and accept it fully. */
nuclear@0 15 /* */
nuclear@0 16 /***************************************************************************/
nuclear@0 17
nuclear@0 18
nuclear@0 19 /*************************************************************************/
nuclear@0 20 /* */
nuclear@0 21 /* The auto-hinter is used to load and automatically hint glyphs if a */
nuclear@0 22 /* format-specific hinter isn't available. */
nuclear@0 23 /* */
nuclear@0 24 /*************************************************************************/
nuclear@0 25
nuclear@0 26
nuclear@0 27 #ifndef __AUTOHINT_H__
nuclear@0 28 #define __AUTOHINT_H__
nuclear@0 29
nuclear@0 30
nuclear@0 31 /*************************************************************************/
nuclear@0 32 /* */
nuclear@0 33 /* A small technical note regarding automatic hinting in order to */
nuclear@0 34 /* clarify this module interface. */
nuclear@0 35 /* */
nuclear@0 36 /* An automatic hinter might compute two kinds of data for a given face: */
nuclear@0 37 /* */
nuclear@0 38 /* - global hints: Usually some metrics that describe global properties */
nuclear@0 39 /* of the face. It is computed by scanning more or less */
nuclear@0 40 /* aggressively the glyphs in the face, and thus can be */
nuclear@0 41 /* very slow to compute (even if the size of global */
nuclear@0 42 /* hints is really small). */
nuclear@0 43 /* */
nuclear@0 44 /* - glyph hints: These describe some important features of the glyph */
nuclear@0 45 /* outline, as well as how to align them. They are */
nuclear@0 46 /* generally much faster to compute than global hints. */
nuclear@0 47 /* */
nuclear@0 48 /* The current FreeType auto-hinter does a pretty good job while */
nuclear@0 49 /* performing fast computations for both global and glyph hints. */
nuclear@0 50 /* However, we might be interested in introducing more complex and */
nuclear@0 51 /* powerful algorithms in the future, like the one described in the John */
nuclear@0 52 /* D. Hobby paper, which unfortunately requires a lot more horsepower. */
nuclear@0 53 /* */
nuclear@0 54 /* Because a sufficiently sophisticated font management system would */
nuclear@0 55 /* typically implement an LRU cache of opened face objects to reduce */
nuclear@0 56 /* memory usage, it is a good idea to be able to avoid recomputing */
nuclear@0 57 /* global hints every time the same face is re-opened. */
nuclear@0 58 /* */
nuclear@0 59 /* We thus provide the ability to cache global hints outside of the face */
nuclear@0 60 /* object, in order to speed up font re-opening time. Of course, this */
nuclear@0 61 /* feature is purely optional, so most client programs won't even notice */
nuclear@0 62 /* it. */
nuclear@0 63 /* */
nuclear@0 64 /* I initially thought that it would be a good idea to cache the glyph */
nuclear@0 65 /* hints too. However, my general idea now is that if you really need */
nuclear@0 66 /* to cache these too, you are simply in need of a new font format, */
nuclear@0 67 /* where all this information could be stored within the font file and */
nuclear@0 68 /* decoded on the fly. */
nuclear@0 69 /* */
nuclear@0 70 /*************************************************************************/
nuclear@0 71
nuclear@0 72
nuclear@0 73 #include <ft2build.h>
nuclear@0 74 #include FT_FREETYPE_H
nuclear@0 75
nuclear@0 76
nuclear@0 77 FT_BEGIN_HEADER
nuclear@0 78
nuclear@0 79
nuclear@0 80 typedef struct FT_AutoHinterRec_ *FT_AutoHinter;
nuclear@0 81
nuclear@0 82
nuclear@0 83 /*************************************************************************/
nuclear@0 84 /* */
nuclear@0 85 /* <FuncType> */
nuclear@0 86 /* FT_AutoHinter_GlobalGetFunc */
nuclear@0 87 /* */
nuclear@0 88 /* <Description> */
nuclear@0 89 /* Retrieves the global hints computed for a given face object the */
nuclear@0 90 /* resulting data is dissociated from the face and will survive a */
nuclear@0 91 /* call to FT_Done_Face(). It must be discarded through the API */
nuclear@0 92 /* FT_AutoHinter_GlobalDoneFunc(). */
nuclear@0 93 /* */
nuclear@0 94 /* <Input> */
nuclear@0 95 /* hinter :: A handle to the source auto-hinter. */
nuclear@0 96 /* */
nuclear@0 97 /* face :: A handle to the source face object. */
nuclear@0 98 /* */
nuclear@0 99 /* <Output> */
nuclear@0 100 /* global_hints :: A typeless pointer to the global hints. */
nuclear@0 101 /* */
nuclear@0 102 /* global_len :: The size in bytes of the global hints. */
nuclear@0 103 /* */
nuclear@0 104 typedef void
nuclear@0 105 (*FT_AutoHinter_GlobalGetFunc)( FT_AutoHinter hinter,
nuclear@0 106 FT_Face face,
nuclear@0 107 void** global_hints,
nuclear@0 108 long* global_len );
nuclear@0 109
nuclear@0 110
nuclear@0 111 /*************************************************************************/
nuclear@0 112 /* */
nuclear@0 113 /* <FuncType> */
nuclear@0 114 /* FT_AutoHinter_GlobalDoneFunc */
nuclear@0 115 /* */
nuclear@0 116 /* <Description> */
nuclear@0 117 /* Discards the global hints retrieved through */
nuclear@0 118 /* FT_AutoHinter_GlobalGetFunc(). This is the only way these hints */
nuclear@0 119 /* are freed from memory. */
nuclear@0 120 /* */
nuclear@0 121 /* <Input> */
nuclear@0 122 /* hinter :: A handle to the auto-hinter module. */
nuclear@0 123 /* */
nuclear@0 124 /* global :: A pointer to retrieved global hints to discard. */
nuclear@0 125 /* */
nuclear@0 126 typedef void
nuclear@0 127 (*FT_AutoHinter_GlobalDoneFunc)( FT_AutoHinter hinter,
nuclear@0 128 void* global );
nuclear@0 129
nuclear@0 130
nuclear@0 131 /*************************************************************************/
nuclear@0 132 /* */
nuclear@0 133 /* <FuncType> */
nuclear@0 134 /* FT_AutoHinter_GlobalResetFunc */
nuclear@0 135 /* */
nuclear@0 136 /* <Description> */
nuclear@0 137 /* This function is used to recompute the global metrics in a given */
nuclear@0 138 /* font. This is useful when global font data changes (e.g. Multiple */
nuclear@0 139 /* Masters fonts where blend coordinates change). */
nuclear@0 140 /* */
nuclear@0 141 /* <Input> */
nuclear@0 142 /* hinter :: A handle to the source auto-hinter. */
nuclear@0 143 /* */
nuclear@0 144 /* face :: A handle to the face. */
nuclear@0 145 /* */
nuclear@0 146 typedef void
nuclear@0 147 (*FT_AutoHinter_GlobalResetFunc)( FT_AutoHinter hinter,
nuclear@0 148 FT_Face face );
nuclear@0 149
nuclear@0 150
nuclear@0 151 /*************************************************************************/
nuclear@0 152 /* */
nuclear@0 153 /* <FuncType> */
nuclear@0 154 /* FT_AutoHinter_GlyphLoadFunc */
nuclear@0 155 /* */
nuclear@0 156 /* <Description> */
nuclear@0 157 /* This function is used to load, scale, and automatically hint a */
nuclear@0 158 /* glyph from a given face. */
nuclear@0 159 /* */
nuclear@0 160 /* <Input> */
nuclear@0 161 /* face :: A handle to the face. */
nuclear@0 162 /* */
nuclear@0 163 /* glyph_index :: The glyph index. */
nuclear@0 164 /* */
nuclear@0 165 /* load_flags :: The load flags. */
nuclear@0 166 /* */
nuclear@0 167 /* <Note> */
nuclear@0 168 /* This function is capable of loading composite glyphs by hinting */
nuclear@0 169 /* each sub-glyph independently (which improves quality). */
nuclear@0 170 /* */
nuclear@0 171 /* It will call the font driver with FT_Load_Glyph(), with */
nuclear@0 172 /* FT_LOAD_NO_SCALE set. */
nuclear@0 173 /* */
nuclear@0 174 typedef FT_Error
nuclear@0 175 (*FT_AutoHinter_GlyphLoadFunc)( FT_AutoHinter hinter,
nuclear@0 176 FT_GlyphSlot slot,
nuclear@0 177 FT_Size size,
nuclear@0 178 FT_UInt glyph_index,
nuclear@0 179 FT_Int32 load_flags );
nuclear@0 180
nuclear@0 181
nuclear@0 182 /*************************************************************************/
nuclear@0 183 /* */
nuclear@0 184 /* <Struct> */
nuclear@0 185 /* FT_AutoHinter_ServiceRec */
nuclear@0 186 /* */
nuclear@0 187 /* <Description> */
nuclear@0 188 /* The auto-hinter module's interface. */
nuclear@0 189 /* */
nuclear@0 190 typedef struct FT_AutoHinter_ServiceRec_
nuclear@0 191 {
nuclear@0 192 FT_AutoHinter_GlobalResetFunc reset_face;
nuclear@0 193 FT_AutoHinter_GlobalGetFunc get_global_hints;
nuclear@0 194 FT_AutoHinter_GlobalDoneFunc done_global_hints;
nuclear@0 195 FT_AutoHinter_GlyphLoadFunc load_glyph;
nuclear@0 196
nuclear@0 197 } FT_AutoHinter_ServiceRec, *FT_AutoHinter_Service;
nuclear@0 198
nuclear@0 199 #ifndef FT_CONFIG_OPTION_PIC
nuclear@0 200
nuclear@0 201 #define FT_DEFINE_AUTOHINTER_SERVICE(class_, reset_face_, get_global_hints_, \
nuclear@0 202 done_global_hints_, load_glyph_) \
nuclear@0 203 FT_CALLBACK_TABLE_DEF \
nuclear@0 204 const FT_AutoHinter_ServiceRec class_ = \
nuclear@0 205 { \
nuclear@0 206 reset_face_, get_global_hints_, done_global_hints_, load_glyph_ \
nuclear@0 207 };
nuclear@0 208
nuclear@0 209 #else /* FT_CONFIG_OPTION_PIC */
nuclear@0 210
nuclear@0 211 #define FT_DEFINE_AUTOHINTER_SERVICE(class_, reset_face_, get_global_hints_, \
nuclear@0 212 done_global_hints_, load_glyph_) \
nuclear@0 213 void \
nuclear@0 214 FT_Init_Class_##class_( FT_Library library, \
nuclear@0 215 FT_AutoHinter_ServiceRec* clazz) \
nuclear@0 216 { \
nuclear@0 217 FT_UNUSED(library); \
nuclear@0 218 clazz->reset_face = reset_face_; \
nuclear@0 219 clazz->get_global_hints = get_global_hints_; \
nuclear@0 220 clazz->done_global_hints = done_global_hints_; \
nuclear@0 221 clazz->load_glyph = load_glyph_; \
nuclear@0 222 }
nuclear@0 223
nuclear@0 224 #endif /* FT_CONFIG_OPTION_PIC */
nuclear@0 225
nuclear@0 226 FT_END_HEADER
nuclear@0 227
nuclear@0 228 #endif /* __AUTOHINT_H__ */
nuclear@0 229
nuclear@0 230
nuclear@0 231 /* END */