00001 /***************************************************************************/ 00002 /* */ 00003 /* sfnt.h */ 00004 /* */ 00005 /* High-level `sfnt' driver interface (specification). */ 00006 /* */ 00007 /* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006 by */ 00008 /* David Turner, Robert Wilhelm, and Werner Lemberg. */ 00009 /* */ 00010 /* This file is part of the FreeType project, and may only be used, */ 00011 /* modified, and distributed under the terms of the FreeType project */ 00012 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 00013 /* this file you indicate that you have read the license and */ 00014 /* understand and accept it fully. */ 00015 /* */ 00016 /***************************************************************************/ 00017 00018 00019 #ifndef __SFNT_H__ 00020 #define __SFNT_H__ 00021 00022 00023 #include <ft2build.h> 00024 #include FT_INTERNAL_DRIVER_H 00025 #include FT_INTERNAL_TRUETYPE_TYPES_H 00026 00027 00028 FT_BEGIN_HEADER 00029 00030 00031 /*************************************************************************/ 00032 /* */ 00033 /* <FuncType> */ 00034 /* TT_Init_Face_Func */ 00035 /* */ 00036 /* <Description> */ 00037 /* First part of the SFNT face object initialization. This finds */ 00038 /* the face in a SFNT file or collection, and load its format tag in */ 00039 /* face->format_tag. */ 00040 /* */ 00041 /* <Input> */ 00042 /* stream :: The input stream. */ 00043 /* */ 00044 /* face :: A handle to the target face object. */ 00045 /* */ 00046 /* face_index :: The index of the TrueType font, if we are opening a */ 00047 /* collection. */ 00048 /* */ 00049 /* num_params :: The number of additional parameters. */ 00050 /* */ 00051 /* params :: Optional additional parameters. */ 00052 /* */ 00053 /* <Return> */ 00054 /* FreeType error code. 0 means success. */ 00055 /* */ 00056 /* <Note> */ 00057 /* The stream cursor must be at the font file's origin. */ 00058 /* */ 00059 /* This function recognizes fonts embedded in a `TrueType */ 00060 /* collection'. */ 00061 /* */ 00062 /* Once the format tag has been validated by the font driver, it */ 00063 /* should then call the TT_Load_Face_Func() callback to read the rest */ 00064 /* of the SFNT tables in the object. */ 00065 /* */ 00066 typedef FT_Error 00067 (*TT_Init_Face_Func)( FT_Stream stream, 00068 TT_Face face, 00069 FT_Int face_index, 00070 FT_Int num_params, 00071 FT_Parameter* params ); 00072 00073 00074 /*************************************************************************/ 00075 /* */ 00076 /* <FuncType> */ 00077 /* TT_Load_Face_Func */ 00078 /* */ 00079 /* <Description> */ 00080 /* Second part of the SFNT face object initialization. This loads */ 00081 /* the common SFNT tables (head, OS/2, maxp, metrics, etc.) in the */ 00082 /* face object. */ 00083 /* */ 00084 /* <Input> */ 00085 /* stream :: The input stream. */ 00086 /* */ 00087 /* face :: A handle to the target face object. */ 00088 /* */ 00089 /* face_index :: The index of the TrueType font, if we are opening a */ 00090 /* collection. */ 00091 /* */ 00092 /* num_params :: The number of additional parameters. */ 00093 /* */ 00094 /* params :: Optional additional parameters. */ 00095 /* */ 00096 /* <Return> */ 00097 /* FreeType error code. 0 means success. */ 00098 /* */ 00099 /* <Note> */ 00100 /* This function must be called after TT_Init_Face_Func(). */ 00101 /* */ 00102 typedef FT_Error 00103 (*TT_Load_Face_Func)( FT_Stream stream, 00104 TT_Face face, 00105 FT_Int face_index, 00106 FT_Int num_params, 00107 FT_Parameter* params ); 00108 00109 00110 /*************************************************************************/ 00111 /* */ 00112 /* <FuncType> */ 00113 /* TT_Done_Face_Func */ 00114 /* */ 00115 /* <Description> */ 00116 /* A callback used to delete the common SFNT data from a face. */ 00117 /* */ 00118 /* <Input> */ 00119 /* face :: A handle to the target face object. */ 00120 /* */ 00121 /* <Note> */ 00122 /* This function does NOT destroy the face object. */ 00123 /* */ 00124 typedef void 00125 (*TT_Done_Face_Func)( TT_Face face ); 00126 00127 00128 #ifdef FT_CONFIG_OPTION_OLD_INTERNALS 00129 00130 /*************************************************************************/ 00131 /* */ 00132 /* <FuncType> */ 00133 /* TT_Load_SFNT_HeaderRec_Func */ 00134 /* */ 00135 /* <Description> */ 00136 /* Loads the header of a SFNT font file. Supports collections. */ 00137 /* */ 00138 /* <Input> */ 00139 /* face :: A handle to the target face object. */ 00140 /* */ 00141 /* stream :: The input stream. */ 00142 /* */ 00143 /* face_index :: The index of the TrueType font, if we are opening a */ 00144 /* collection. */ 00145 /* */ 00146 /* <Output> */ 00147 /* sfnt :: The SFNT header. */ 00148 /* */ 00149 /* <Return> */ 00150 /* FreeType error code. 0 means success. */ 00151 /* */ 00152 /* <Note> */ 00153 /* The stream cursor must be at the font file's origin. */ 00154 /* */ 00155 /* This function recognizes fonts embedded in a `TrueType */ 00156 /* collection'. */ 00157 /* */ 00158 /* This function checks that the header is valid by looking at the */ 00159 /* values of `search_range', `entry_selector', and `range_shift'. */ 00160 /* */ 00161 typedef FT_Error 00162 (*TT_Load_SFNT_HeaderRec_Func)( TT_Face face, 00163 FT_Stream stream, 00164 FT_Long face_index, 00165 SFNT_Header sfnt ); 00166 00167 00168 /*************************************************************************/ 00169 /* */ 00170 /* <FuncType> */ 00171 /* TT_Load_Directory_Func */ 00172 /* */ 00173 /* <Description> */ 00174 /* Loads the table directory into a face object. */ 00175 /* */ 00176 /* <Input> */ 00177 /* face :: A handle to the target face object. */ 00178 /* */ 00179 /* stream :: The input stream. */ 00180 /* */ 00181 /* sfnt :: The SFNT header. */ 00182 /* */ 00183 /* <Return> */ 00184 /* FreeType error code. 0 means success. */ 00185 /* */ 00186 /* <Note> */ 00187 /* The stream cursor must be on the first byte after the 4-byte font */ 00188 /* format tag. This is the case just after a call to */ 00189 /* TT_Load_Format_Tag(). */ 00190 /* */ 00191 typedef FT_Error 00192 (*TT_Load_Directory_Func)( TT_Face face, 00193 FT_Stream stream, 00194 SFNT_Header sfnt ); 00195 00196 #endif /* FT_CONFIG_OPTION_OLD_INTERNALS */ 00197 00198 00199 /*************************************************************************/ 00200 /* */ 00201 /* <FuncType> */ 00202 /* TT_Load_Any_Func */ 00203 /* */ 00204 /* <Description> */ 00205 /* Load any font table into client memory. */ 00206 /* */ 00207 /* <Input> */ 00208 /* face :: The face object to look for. */ 00209 /* */ 00210 /* tag :: The tag of table to load. Use the value 0 if you want */ 00211 /* to access the whole font file, else set this parameter */ 00212 /* to a valid TrueType table tag that you can forge with */ 00213 /* the MAKE_TT_TAG macro. */ 00214 /* */ 00215 /* offset :: The starting offset in the table (or the file if */ 00216 /* tag == 0). */ 00217 /* */ 00218 /* length :: The address of the decision variable: */ 00219 /* */ 00220 /* If length == NULL: */ 00221 /* Loads the whole table. Returns an error if */ 00222 /* `offset' == 0! */ 00223 /* */ 00224 /* If *length == 0: */ 00225 /* Exits immediately; returning the length of the given */ 00226 /* table or of the font file, depending on the value of */ 00227 /* `tag'. */ 00228 /* */ 00229 /* If *length != 0: */ 00230 /* Loads the next `length' bytes of table or font, */ 00231 /* starting at offset `offset' (in table or font too). */ 00232 /* */ 00233 /* <Output> */ 00234 /* buffer :: The address of target buffer. */ 00235 /* */ 00236 /* <Return> */ 00237 /* TrueType error code. 0 means success. */ 00238 /* */ 00239 typedef FT_Error 00240 (*TT_Load_Any_Func)( TT_Face face, 00241 FT_ULong tag, 00242 FT_Long offset, 00243 FT_Byte *buffer, 00244 FT_ULong* length ); 00245 00246 00247 /*************************************************************************/ 00248 /* */ 00249 /* <FuncType> */ 00250 /* TT_Find_SBit_Image_Func */ 00251 /* */ 00252 /* <Description> */ 00253 /* Check whether an embedded bitmap (an `sbit') exists for a given */ 00254 /* glyph, at a given strike. */ 00255 /* */ 00256 /* <Input> */ 00257 /* face :: The target face object. */ 00258 /* */ 00259 /* glyph_index :: The glyph index. */ 00260 /* */ 00261 /* strike_index :: The current strike index. */ 00262 /* */ 00263 /* <Output> */ 00264 /* arange :: The SBit range containing the glyph index. */ 00265 /* */ 00266 /* astrike :: The SBit strike containing the glyph index. */ 00267 /* */ 00268 /* aglyph_offset :: The offset of the glyph data in `EBDT' table. */ 00269 /* */ 00270 /* <Return> */ 00271 /* FreeType error code. 0 means success. Returns */ 00272 /* SFNT_Err_Invalid_Argument if no sbit exists for the requested */ 00273 /* glyph. */ 00274 /* */ 00275 typedef FT_Error 00276 (*TT_Find_SBit_Image_Func)( TT_Face face, 00277 FT_UInt glyph_index, 00278 FT_ULong strike_index, 00279 TT_SBit_Range *arange, 00280 TT_SBit_Strike *astrike, 00281 FT_ULong *aglyph_offset ); 00282 00283 00284 /*************************************************************************/ 00285 /* */ 00286 /* <FuncType> */ 00287 /* TT_Load_SBit_Metrics_Func */ 00288 /* */ 00289 /* <Description> */ 00290 /* Get the big metrics for a given embedded bitmap. */ 00291 /* */ 00292 /* <Input> */ 00293 /* stream :: The input stream. */ 00294 /* */ 00295 /* range :: The SBit range containing the glyph. */ 00296 /* */ 00297 /* <Output> */ 00298 /* big_metrics :: A big SBit metrics structure for the glyph. */ 00299 /* */ 00300 /* <Return> */ 00301 /* FreeType error code. 0 means success. */ 00302 /* */ 00303 /* <Note> */ 00304 /* The stream cursor must be positioned at the glyph's offset within */ 00305 /* the `EBDT' table before the call. */ 00306 /* */ 00307 /* If the image format uses variable metrics, the stream cursor is */ 00308 /* positioned just after the metrics header in the `EBDT' table on */ 00309 /* function exit. */ 00310 /* */ 00311 typedef FT_Error 00312 (*TT_Load_SBit_Metrics_Func)( FT_Stream stream, 00313 TT_SBit_Range range, 00314 TT_SBit_Metrics metrics ); 00315 00316 00317 /*************************************************************************/ 00318 /* */ 00319 /* <FuncType> */ 00320 /* TT_Load_SBit_Image_Func */ 00321 /* */ 00322 /* <Description> */ 00323 /* Load a given glyph sbit image from the font resource. This also */ 00324 /* returns its metrics. */ 00325 /* */ 00326 /* <Input> */ 00327 /* face :: */ 00328 /* The target face object. */ 00329 /* */ 00330 /* strike_index :: */ 00331 /* The strike index. */ 00332 /* */ 00333 /* glyph_index :: */ 00334 /* The current glyph index. */ 00335 /* */ 00336 /* load_flags :: */ 00337 /* The current load flags. */ 00338 /* */ 00339 /* stream :: */ 00340 /* The input stream. */ 00341 /* */ 00342 /* <Output> */ 00343 /* amap :: */ 00344 /* The target pixmap. */ 00345 /* */ 00346 /* ametrics :: */ 00347 /* A big sbit metrics structure for the glyph image. */ 00348 /* */ 00349 /* <Return> */ 00350 /* FreeType error code. 0 means success. Returns an error if no */ 00351 /* glyph sbit exists for the index. */ 00352 /* */ 00353 /* <Note> */ 00354 /* The `map.buffer' field is always freed before the glyph is loaded. */ 00355 /* */ 00356 typedef FT_Error 00357 (*TT_Load_SBit_Image_Func)( TT_Face face, 00358 FT_ULong strike_index, 00359 FT_UInt glyph_index, 00360 FT_UInt load_flags, 00361 FT_Stream stream, 00362 FT_Bitmap *amap, 00363 TT_SBit_MetricsRec *ametrics ); 00364 00365 00366 #ifdef FT_CONFIG_OPTION_OLD_INTERNALS 00367 00368 /*************************************************************************/ 00369 /* */ 00370 /* <FuncType> */ 00371 /* TT_Set_SBit_Strike_OldFunc */ 00372 /* */ 00373 /* <Description> */ 00374 /* Select an sbit strike for a given size request. */ 00375 /* */ 00376 /* <Input> */ 00377 /* face :: The target face object. */ 00378 /* */ 00379 /* req :: The size request. */ 00380 /* */ 00381 /* <Output> */ 00382 /* astrike_index :: The index of the sbit strike. */ 00383 /* */ 00384 /* <Return> */ 00385 /* FreeType error code. 0 means success. Returns an error if no */ 00386 /* sbit strike exists for the selected ppem values. */ 00387 /* */ 00388 typedef FT_Error 00389 (*TT_Set_SBit_Strike_OldFunc)( TT_Face face, 00390 FT_UInt x_ppem, 00391 FT_UInt y_ppem, 00392 FT_ULong* astrike_index ); 00393 00394 00395 /*************************************************************************/ 00396 /* */ 00397 /* <FuncType> */ 00398 /* TT_CharMap_Load_Func */ 00399 /* */ 00400 /* <Description> */ 00401 /* Loads a given TrueType character map into memory. */ 00402 /* */ 00403 /* <Input> */ 00404 /* face :: A handle to the parent face object. */ 00405 /* */ 00406 /* stream :: A handle to the current stream object. */ 00407 /* */ 00408 /* <InOut> */ 00409 /* cmap :: A pointer to a cmap object. */ 00410 /* */ 00411 /* <Return> */ 00412 /* FreeType error code. 0 means success. */ 00413 /* */ 00414 /* <Note> */ 00415 /* The function assumes that the stream is already in use (i.e., */ 00416 /* opened). In case of error, all partially allocated tables are */ 00417 /* released. */ 00418 /* */ 00419 typedef FT_Error 00420 (*TT_CharMap_Load_Func)( TT_Face face, 00421 void* cmap, 00422 FT_Stream input ); 00423 00424 00425 /*************************************************************************/ 00426 /* */ 00427 /* <FuncType> */ 00428 /* TT_CharMap_Free_Func */ 00429 /* */ 00430 /* <Description> */ 00431 /* Destroys a character mapping table. */ 00432 /* */ 00433 /* <Input> */ 00434 /* face :: A handle to the parent face object. */ 00435 /* */ 00436 /* cmap :: A handle to a cmap object. */ 00437 /* */ 00438 /* <Return> */ 00439 /* FreeType error code. 0 means success. */ 00440 /* */ 00441 typedef FT_Error 00442 (*TT_CharMap_Free_Func)( TT_Face face, 00443 void* cmap ); 00444 00445 #endif /* FT_CONFIG_OPTION_OLD_INTERNALS */ 00446 00447 00448 /*************************************************************************/ 00449 /* */ 00450 /* <FuncType> */ 00451 /* TT_Set_SBit_Strike_Func */ 00452 /* */ 00453 /* <Description> */ 00454 /* Select an sbit strike for a given size request. */ 00455 /* */ 00456 /* <Input> */ 00457 /* face :: The target face object. */ 00458 /* */ 00459 /* req :: The size request. */ 00460 /* */ 00461 /* <Output> */ 00462 /* astrike_index :: The index of the sbit strike. */ 00463 /* */ 00464 /* <Return> */ 00465 /* FreeType error code. 0 means success. Returns an error if no */ 00466 /* sbit strike exists for the selected ppem values. */ 00467 /* */ 00468 typedef FT_Error 00469 (*TT_Set_SBit_Strike_Func)( TT_Face face, 00470 FT_Size_Request req, 00471 FT_ULong* astrike_index ); 00472 00473 00474 /*************************************************************************/ 00475 /* */ 00476 /* <FuncType> */ 00477 /* TT_Load_Strike_Metrics_Func */ 00478 /* */ 00479 /* <Description> */ 00480 /* Load the metrics of a given strike. */ 00481 /* */ 00482 /* <Input> */ 00483 /* face :: The target face object. */ 00484 /* */ 00485 /* strike_index :: The strike index. */ 00486 /* */ 00487 /* <Output> */ 00488 /* metrics :: the metrics of the strike. */ 00489 /* */ 00490 /* <Return> */ 00491 /* FreeType error code. 0 means success. Returns an error if no */ 00492 /* such sbit strike exists. */ 00493 /* */ 00494 typedef FT_Error 00495 (*TT_Load_Strike_Metrics_Func)( TT_Face face, 00496 FT_ULong strike_index, 00497 FT_Size_Metrics* metrics ); 00498 00499 00500 /*************************************************************************/ 00501 /* */ 00502 /* <FuncType> */ 00503 /* TT_Get_PS_Name_Func */ 00504 /* */ 00505 /* <Description> */ 00506 /* Get the PostScript glyph name of a glyph. */ 00507 /* */ 00508 /* <Input> */ 00509 /* idx :: The glyph index. */ 00510 /* */ 00511 /* PSname :: The address of a string pointer. Will be NULL in case */ 00512 /* of error, otherwise it is a pointer to the glyph name. */ 00513 /* */ 00514 /* You must not modify the returned string! */ 00515 /* */ 00516 /* <Output> */ 00517 /* FreeType error code. 0 means success. */ 00518 /* */ 00519 typedef FT_Error 00520 (*TT_Get_PS_Name_Func)( TT_Face face, 00521 FT_UInt idx, 00522 FT_String** PSname ); 00523 00524 00525 /*************************************************************************/ 00526 /* */ 00527 /* <FuncType> */ 00528 /* TT_Load_Metrics_Func */ 00529 /* */ 00530 /* <Description> */ 00531 /* Load a metrics table, which is a table with a horizontal and a */ 00532 /* vertical version. */ 00533 /* */ 00534 /* <Input> */ 00535 /* face :: A handle to the target face object. */ 00536 /* */ 00537 /* stream :: The input stream. */ 00538 /* */ 00539 /* vertical :: A boolean flag. If set, load the vertical one. */ 00540 /* */ 00541 /* <Return> */ 00542 /* FreeType error code. 0 means success. */ 00543 /* */ 00544 typedef FT_Error 00545 (*TT_Load_Metrics_Func)( TT_Face face, 00546 FT_Stream stream, 00547 FT_Bool vertical ); 00548 00549 00550 /*************************************************************************/ 00551 /* */ 00552 /* <FuncType> */ 00553 /* TT_Get_Metrics_Func */ 00554 /* */ 00555 /* <Description> */ 00556 /* Load the horizontal or vertical header in a face object. */ 00557 /* */ 00558 /* <Input> */ 00559 /* face :: A handle to the target face object. */ 00560 /* */ 00561 /* stream :: The input stream. */ 00562 /* */ 00563 /* vertical :: A boolean flag. If set, load vertical metrics. */ 00564 /* */ 00565 /* <Return> */ 00566 /* FreeType error code. 0 means success. */ 00567 /* */ 00568 typedef FT_Error 00569 (*TT_Get_Metrics_Func)( TT_Face face, 00570 FT_Bool vertical, 00571 FT_UInt gindex, 00572 FT_Short* abearing, 00573 FT_UShort* aadvance ); 00574 00575 00576 /*************************************************************************/ 00577 /* */ 00578 /* <FuncType> */ 00579 /* TT_Load_Table_Func */ 00580 /* */ 00581 /* <Description> */ 00582 /* Load a given TrueType table. */ 00583 /* */ 00584 /* <Input> */ 00585 /* face :: A handle to the target face object. */ 00586 /* */ 00587 /* stream :: The input stream. */ 00588 /* */ 00589 /* <Return> */ 00590 /* FreeType error code. 0 means success. */ 00591 /* */ 00592 /* <Note> */ 00593 /* The function uses `face->goto_table' to seek the stream to the */ 00594 /* start of the table, except while loading the font directory. */ 00595 /* */ 00596 typedef FT_Error 00597 (*TT_Load_Table_Func)( TT_Face face, 00598 FT_Stream stream ); 00599 00600 00601 /*************************************************************************/ 00602 /* */ 00603 /* <FuncType> */ 00604 /* TT_Free_Table_Func */ 00605 /* */ 00606 /* <Description> */ 00607 /* Free a given TrueType table. */ 00608 /* */ 00609 /* <Input> */ 00610 /* face :: A handle to the target face object. */ 00611 /* */ 00612 typedef void 00613 (*TT_Free_Table_Func)( TT_Face face ); 00614 00615 00616 /* 00617 * @functype: 00618 * TT_Face_GetKerningFunc 00619 * 00620 * @description: 00621 * Return the horizontal kerning value between two glyphs. 00622 * 00623 * @input: 00624 * face :: A handle to the source face object. 00625 * left_glyph :: The left glyph index. 00626 * right_glyph :: The right glyph index. 00627 * 00628 * @return: 00629 * The kerning value in font units. 00630 */ 00631 typedef FT_Int 00632 (*TT_Face_GetKerningFunc)( TT_Face face, 00633 FT_UInt left_glyph, 00634 FT_UInt right_glyph ); 00635 00636 00637 /*************************************************************************/ 00638 /* */ 00639 /* <Struct> */ 00640 /* SFNT_Interface */ 00641 /* */ 00642 /* <Description> */ 00643 /* This structure holds pointers to the functions used to load and */ 00644 /* free the basic tables that are required in a `sfnt' font file. */ 00645 /* */ 00646 /* <Fields> */ 00647 /* Check the various xxx_Func() descriptions for details. */ 00648 /* */ 00649 typedef struct SFNT_Interface_ 00650 { 00651 TT_Loader_GotoTableFunc goto_table; 00652 00653 TT_Init_Face_Func init_face; 00654 TT_Load_Face_Func load_face; 00655 TT_Done_Face_Func done_face; 00656 FT_Module_Requester get_interface; 00657 00658 TT_Load_Any_Func load_any; 00659 00660 #ifdef FT_CONFIG_OPTION_OLD_INTERNALS 00661 TT_Load_SFNT_HeaderRec_Func load_sfnt_header; 00662 TT_Load_Directory_Func load_directory; 00663 #endif 00664 00665 /* these functions are called by `load_face' but they can also */ 00666 /* be called from external modules, if there is a need to do so */ 00667 TT_Load_Table_Func load_head; 00668 TT_Load_Metrics_Func load_hhea; 00669 TT_Load_Table_Func load_cmap; 00670 TT_Load_Table_Func load_maxp; 00671 TT_Load_Table_Func load_os2; 00672 TT_Load_Table_Func load_post; 00673 00674 TT_Load_Table_Func load_name; 00675 TT_Free_Table_Func free_name; 00676 00677 /* optional tables */ 00678 #ifdef FT_CONFIG_OPTION_OLD_INTERNALS 00679 TT_Load_Table_Func load_hdmx_stub; 00680 TT_Free_Table_Func free_hdmx_stub; 00681 #endif 00682 00683 /* this field was called `load_kerning' up to version 2.1.10 */ 00684 TT_Load_Table_Func load_kern; 00685 00686 TT_Load_Table_Func load_gasp; 00687 TT_Load_Table_Func load_pclt; 00688 00689 /* see `ttload.h'; this field was called `load_bitmap_header' up to */ 00690 /* version 2.1.10 */ 00691 TT_Load_Table_Func load_bhed; 00692 00693 #ifdef FT_CONFIG_OPTION_OLD_INTERNALS 00694 00695 /* see `ttsbit.h' */ 00696 TT_Set_SBit_Strike_OldFunc set_sbit_strike_stub; 00697 TT_Load_Table_Func load_sbits_stub; 00698 00699 /* 00700 * The following two fields appeared in version 2.1.8, and were placed 00701 * between `load_sbits' and `load_sbit_image'. We support them as a 00702 * special exception since they are used by Xfont library within the 00703 * X.Org xserver, and because the probability that other rogue clients 00704 * use the other version 2.1.7 fields below is _extremely_ low. 00705 * 00706 * Note that this forces us to disable an interesting memory-saving 00707 * optimization though... 00708 */ 00709 00710 TT_Find_SBit_Image_Func find_sbit_image; 00711 TT_Load_SBit_Metrics_Func load_sbit_metrics; 00712 00713 #endif 00714 00715 TT_Load_SBit_Image_Func load_sbit_image; 00716 00717 #ifdef FT_CONFIG_OPTION_OLD_INTERNALS 00718 TT_Free_Table_Func free_sbits_stub; 00719 #endif 00720 00721 /* see `ttpost.h' */ 00722 TT_Get_PS_Name_Func get_psname; 00723 TT_Free_Table_Func free_psnames; 00724 00725 #ifdef FT_CONFIG_OPTION_OLD_INTERNALS 00726 TT_CharMap_Load_Func load_charmap_stub; 00727 TT_CharMap_Free_Func free_charmap_stub; 00728 #endif 00729 00730 /* starting here, the structure differs from version 2.1.7 */ 00731 00732 /* this field was introduced in version 2.1.8, named `get_psname' */ 00733 TT_Face_GetKerningFunc get_kerning; 00734 00735 /* new elements introduced after version 2.1.10 */ 00736 00737 /* load the font directory, i.e., the offset table and */ 00738 /* the table directory */ 00739 TT_Load_Table_Func load_font_dir; 00740 TT_Load_Metrics_Func load_hmtx; 00741 00742 TT_Load_Table_Func load_eblc; 00743 TT_Free_Table_Func free_eblc; 00744 00745 TT_Set_SBit_Strike_Func set_sbit_strike; 00746 TT_Load_Strike_Metrics_Func load_strike_metrics; 00747 00748 TT_Get_Metrics_Func get_metrics; 00749 00750 } SFNT_Interface; 00751 00752 00753 /* transitional */ 00754 typedef SFNT_Interface* SFNT_Service; 00755 00756 #ifndef FT_CONFIG_OPTION_PIC 00757 00758 #ifdef FT_CONFIG_OPTION_OLD_INTERNALS 00759 #define FT_DEFINE_DRIVERS_OLD_INTERNAL(a) \ 00760 a, 00761 #else 00762 #define FT_DEFINE_DRIVERS_OLD_INTERNAL(a) 00763 #endif 00764 #define FT_INTERNAL(a) \ 00765 a, 00766 00767 #define FT_DEFINE_SFNT_INTERFACE(class_, \ 00768 goto_table_, init_face_, load_face_, done_face_, get_interface_, \ 00769 load_any_, load_sfnt_header_, load_directory_, load_head_, \ 00770 load_hhea_, load_cmap_, load_maxp_, load_os2_, load_post_, \ 00771 load_name_, free_name_, load_hdmx_stub_, free_hdmx_stub_, \ 00772 load_kern_, load_gasp_, load_pclt_, load_bhed_, \ 00773 set_sbit_strike_stub_, load_sbits_stub_, find_sbit_image_, \ 00774 load_sbit_metrics_, load_sbit_image_, free_sbits_stub_, \ 00775 get_psname_, free_psnames_, load_charmap_stub_, free_charmap_stub_, \ 00776 get_kerning_, load_font_dir_, load_hmtx_, load_eblc_, free_eblc_, \ 00777 set_sbit_strike_, load_strike_metrics_, get_metrics_ ) \ 00778 static const SFNT_Interface class_ = \ 00779 { \ 00780 FT_INTERNAL(goto_table_) \ 00781 FT_INTERNAL(init_face_) \ 00782 FT_INTERNAL(load_face_) \ 00783 FT_INTERNAL(done_face_) \ 00784 FT_INTERNAL(get_interface_) \ 00785 FT_INTERNAL(load_any_) \ 00786 FT_DEFINE_DRIVERS_OLD_INTERNAL(load_sfnt_header_) \ 00787 FT_DEFINE_DRIVERS_OLD_INTERNAL(load_directory_) \ 00788 FT_INTERNAL(load_head_) \ 00789 FT_INTERNAL(load_hhea_) \ 00790 FT_INTERNAL(load_cmap_) \ 00791 FT_INTERNAL(load_maxp_) \ 00792 FT_INTERNAL(load_os2_) \ 00793 FT_INTERNAL(load_post_) \ 00794 FT_INTERNAL(load_name_) \ 00795 FT_INTERNAL(free_name_) \ 00796 FT_DEFINE_DRIVERS_OLD_INTERNAL(load_hdmx_stub_) \ 00797 FT_DEFINE_DRIVERS_OLD_INTERNAL(free_hdmx_stub_) \ 00798 FT_INTERNAL(load_kern_) \ 00799 FT_INTERNAL(load_gasp_) \ 00800 FT_INTERNAL(load_pclt_) \ 00801 FT_INTERNAL(load_bhed_) \ 00802 FT_DEFINE_DRIVERS_OLD_INTERNAL(set_sbit_strike_stub_) \ 00803 FT_DEFINE_DRIVERS_OLD_INTERNAL(load_sbits_stub_) \ 00804 FT_DEFINE_DRIVERS_OLD_INTERNAL(find_sbit_image_) \ 00805 FT_DEFINE_DRIVERS_OLD_INTERNAL(load_sbit_metrics_) \ 00806 FT_INTERNAL(load_sbit_image_) \ 00807 FT_DEFINE_DRIVERS_OLD_INTERNAL(free_sbits_stub_) \ 00808 FT_INTERNAL(get_psname_) \ 00809 FT_INTERNAL(free_psnames_) \ 00810 FT_DEFINE_DRIVERS_OLD_INTERNAL(load_charmap_stub_) \ 00811 FT_DEFINE_DRIVERS_OLD_INTERNAL(free_charmap_stub_) \ 00812 FT_INTERNAL(get_kerning_) \ 00813 FT_INTERNAL(load_font_dir_) \ 00814 FT_INTERNAL(load_hmtx_) \ 00815 FT_INTERNAL(load_eblc_) \ 00816 FT_INTERNAL(free_eblc_) \ 00817 FT_INTERNAL(set_sbit_strike_) \ 00818 FT_INTERNAL(load_strike_metrics_) \ 00819 FT_INTERNAL(get_metrics_) \ 00820 }; 00821 00822 #else /* FT_CONFIG_OPTION_PIC */ 00823 00824 #ifdef FT_CONFIG_OPTION_OLD_INTERNALS 00825 #define FT_DEFINE_DRIVERS_OLD_INTERNAL(a, a_) \ 00826 clazz->a = a_; 00827 #else 00828 #define FT_DEFINE_DRIVERS_OLD_INTERNAL(a, a_) 00829 #endif 00830 #define FT_INTERNAL(a, a_) \ 00831 clazz->a = a_; 00832 00833 #define FT_DEFINE_SFNT_INTERFACE(class_, \ 00834 goto_table_, init_face_, load_face_, done_face_, get_interface_, \ 00835 load_any_, load_sfnt_header_, load_directory_, load_head_, \ 00836 load_hhea_, load_cmap_, load_maxp_, load_os2_, load_post_, \ 00837 load_name_, free_name_, load_hdmx_stub_, free_hdmx_stub_, \ 00838 load_kern_, load_gasp_, load_pclt_, load_bhed_, \ 00839 set_sbit_strike_stub_, load_sbits_stub_, find_sbit_image_, \ 00840 load_sbit_metrics_, load_sbit_image_, free_sbits_stub_, \ 00841 get_psname_, free_psnames_, load_charmap_stub_, free_charmap_stub_, \ 00842 get_kerning_, load_font_dir_, load_hmtx_, load_eblc_, free_eblc_, \ 00843 set_sbit_strike_, load_strike_metrics_, get_metrics_ ) \ 00844 void \ 00845 FT_Init_Class_##class_( FT_Library library, SFNT_Interface* clazz ) \ 00846 { \ 00847 FT_UNUSED(library); \ 00848 FT_INTERNAL(goto_table,goto_table_) \ 00849 FT_INTERNAL(init_face,init_face_) \ 00850 FT_INTERNAL(load_face,load_face_) \ 00851 FT_INTERNAL(done_face,done_face_) \ 00852 FT_INTERNAL(get_interface,get_interface_) \ 00853 FT_INTERNAL(load_any,load_any_) \ 00854 FT_DEFINE_DRIVERS_OLD_INTERNAL(load_sfnt_header,load_sfnt_header_) \ 00855 FT_DEFINE_DRIVERS_OLD_INTERNAL(load_directory,load_directory_) \ 00856 FT_INTERNAL(load_head,load_head_) \ 00857 FT_INTERNAL(load_hhea,load_hhea_) \ 00858 FT_INTERNAL(load_cmap,load_cmap_) \ 00859 FT_INTERNAL(load_maxp,load_maxp_) \ 00860 FT_INTERNAL(load_os2,load_os2_) \ 00861 FT_INTERNAL(load_post,load_post_) \ 00862 FT_INTERNAL(load_name,load_name_) \ 00863 FT_INTERNAL(free_name,free_name_) \ 00864 FT_DEFINE_DRIVERS_OLD_INTERNAL(load_hdmx_stub,load_hdmx_stub_) \ 00865 FT_DEFINE_DRIVERS_OLD_INTERNAL(free_hdmx_stub,free_hdmx_stub_) \ 00866 FT_INTERNAL(load_kern,load_kern_) \ 00867 FT_INTERNAL(load_gasp,load_gasp_) \ 00868 FT_INTERNAL(load_pclt,load_pclt_) \ 00869 FT_INTERNAL(load_bhed,load_bhed_) \ 00870 FT_DEFINE_DRIVERS_OLD_INTERNAL(set_sbit_strike_stub,set_sbit_strike_stub_) \ 00871 FT_DEFINE_DRIVERS_OLD_INTERNAL(load_sbits_stub,load_sbits_stub_) \ 00872 FT_DEFINE_DRIVERS_OLD_INTERNAL(find_sbit_image,find_sbit_image_) \ 00873 FT_DEFINE_DRIVERS_OLD_INTERNAL(load_sbit_metrics,load_sbit_metrics_) \ 00874 FT_INTERNAL(load_sbit_image,load_sbit_image_) \ 00875 FT_DEFINE_DRIVERS_OLD_INTERNAL(free_sbits_stub,free_sbits_stub_) \ 00876 FT_INTERNAL(get_psname,get_psname_) \ 00877 FT_INTERNAL(free_psnames,free_psnames_) \ 00878 FT_DEFINE_DRIVERS_OLD_INTERNAL(load_charmap_stub,load_charmap_stub_) \ 00879 FT_DEFINE_DRIVERS_OLD_INTERNAL(free_charmap_stub,free_charmap_stub_) \ 00880 FT_INTERNAL(get_kerning,get_kerning_) \ 00881 FT_INTERNAL(load_font_dir,load_font_dir_) \ 00882 FT_INTERNAL(load_hmtx,load_hmtx_) \ 00883 FT_INTERNAL(load_eblc,load_eblc_) \ 00884 FT_INTERNAL(free_eblc,free_eblc_) \ 00885 FT_INTERNAL(set_sbit_strike,set_sbit_strike_) \ 00886 FT_INTERNAL(load_strike_metrics,load_strike_metrics_) \ 00887 FT_INTERNAL(get_metrics,get_metrics_) \ 00888 } 00889 00890 #endif /* FT_CONFIG_OPTION_PIC */ 00891 00892 FT_END_HEADER 00893 00894 #endif /* __SFNT_H__ */ 00895 00896 00897 /* END */