1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193
/***************************************************************************/
/* */
/* ttdriver.h */
/* */
/* High-level TrueType driver interface (specification). */
/* */
/* Copyright 1996-1999 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
/* modified, and distributed under the terms of the FreeType project */
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */
/* understand and accept it fully. */
/* */
/***************************************************************************/
#ifndef TTDRIVER_H
#define TTDRIVER_H
#include <freetype.h>
#include <ftdriver.h>
#include <ttobjs.h>
#include <tterrors.h>
#include <ttnameid.h>
/*************************************************************************/
/* */
/* <FuncType> */
/* TTDriver_getFontData */
/* */
/* <Description> */
/* Returns either a single font table or the whole font file into */
/* caller's memory. This function mimics the GetFontData() API */
/* function found in Windows. */
/* */
/* <Input> */
/* face :: A handle to the source TrueType face object. */
/* */
/* tag :: A 32-bit integer used to name the table you want to */
/* read. Use the macro MAKE_TT_TAG (defined in freetype.h) */
/* to create one. Use the value 0 if you want to access */
/* the whole file instead. */
/* */
/* offset :: The offset from the start of the table or file from */
/* which you want to read bytes. */
/* */
/* buffer :: The address of the target/read buffer where data will be */
/* copied. */
/* */
/* <InOut> */
/* length :: The length in bytes of the data to read. If it is set */
/* to 0 when this function is called, it will return */
/* immediately, setting the value of `length' to the */
/* requested table's size (or the whole font file if the */
/* tag is 0). It is thus possible to allocate and read an */
/* arbitrary table in two successive calls. */
/* <Return> */
/* TrueType error code. 0 means success. */
/* */
typedef TT_Error (*TTDriver_getFontData)( TT_Face face,
TT_ULong tag,
TT_ULong offset,
void* buffer,
TT_Long* length );
/*************************************************************************/
/* */
/* <FuncType> */
/* TTDriver_getFaceWidths */
/* */
/* <Description> */
/* Returns the widths and/or heights of a given range of glyph from */
/* a face. */
/* */
/* <Input> */
/* face :: A handle to the source FreeType face object. */
/* */
/* first_glyph :: The first glyph in the range. */
/* */
/* last_glyph :: The last glyph in the range. */
/* */
/* <Output> */
/* widths :: The address of the table receiving the widths */
/* expressed in font units (UShorts). Set this */
/* parameter to NULL if you're not interested in these */
/* values. */
/* */
/* heights :: The address of the table receiving the heights */
/* expressed in font units (UShorts). Set this */
/* parameter to NULL if you're not interested in these */
/* values. */
/* */
/* <Return> */
/* Error code. 0 means success. */
/* */
typedef TT_Error (*TTDriver_getFaceWidths)( TT_Face face,
TT_UShort first_glyph,
TT_UShort last_glyph,
TT_UShort* widths,
TT_UShort* heights );
/*************************************************************************/
/* */
/* <Struct> */
/* TT_DriverInterface */
/* */
/* <Description> */
/* The TrueType-specific interface of this driver. Note that some of */
/* the methods defined here are optional, as they're only used for */
/* for specific tasks of the driver. */
/* */
/* <Fields> */
/* get_font_data :: See the declaration of TTDriver_getFontData(). */
/* get_face_widths :: See the declaration of */
/* TTDriver_getFaceWidths(). */
/* */
typedef struct TT_DriverInterface_
{
TTDriver_getFontData get_font_data;
TTDriver_getFaceWidths get_face_widths;
} TT_DriverInterface;
EXPORT_DEF
const FT_DriverInterface tt_driver_interface;
EXPORT_DEF
const TT_DriverInterface tt_format_interface;
/*************************************************************************
*
* Here is a template of the code that should appear in each
* font driver's _interface_ file (the one included by "ftinit.c").
*
* It is used to build, at compile time, a simple linked list of
* the interfaces of the drivers which have been #included in
* "ftinit.c". See the source code of the latter file for details
*
* (Note that this is only required when you want your driver included
* in the set of default drivers loaded by FT_Init_FreeType. Other
* drivers can still be added manually at runtime with FT_Add_Driver.
*
* {
* #ifdef FTINIT_DRIVER_CHAIN
*
* static
* const FT_DriverChain ftinit_<FORMAT>_driver_chain =
* {
* FT_INIT_LAST_DRIVER_CHAIN,
* &<FORMAT>_driver_interface
* };
*
* #undef FT_INIT_LAST_DRIVER_CHAIN
* #define FT_INIT_LAST_DRIVER_CHAIN &ftinit_<FORMAT>_driver_chain
*
* #endif
* }
*
* replace <FORMAT> with your driver's prefix
*
*************************************************************************/
#ifdef FTINIT_DRIVER_CHAIN
static
const FT_DriverChain ftinit_tt_driver_chain =
{
FT_INIT_LAST_DRIVER_CHAIN,
&tt_driver_interface
};
#undef FT_INIT_LAST_DRIVER_CHAIN
#define FT_INIT_LAST_DRIVER_CHAIN &ftinit_tt_driver_chain
#endif /* FTINIT_DRIVER_CHAIN */
#endif /* TTDRIVER_H */
/* END */