vrshoot

diff libs/ft2static/freetype/internal/sfnt.h @ 0:b2f14e535253

initial commit
author John Tsiombikas <nuclear@member.fsf.org>
date Sat, 01 Feb 2014 19:58:19 +0200
parents
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/libs/ft2static/freetype/internal/sfnt.h	Sat Feb 01 19:58:19 2014 +0200
     1.3 @@ -0,0 +1,897 @@
     1.4 +/***************************************************************************/
     1.5 +/*                                                                         */
     1.6 +/*  sfnt.h                                                                 */
     1.7 +/*                                                                         */
     1.8 +/*    High-level `sfnt' driver interface (specification).                  */
     1.9 +/*                                                                         */
    1.10 +/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006 by                   */
    1.11 +/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
    1.12 +/*                                                                         */
    1.13 +/*  This file is part of the FreeType project, and may only be used,       */
    1.14 +/*  modified, and distributed under the terms of the FreeType project      */
    1.15 +/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
    1.16 +/*  this file you indicate that you have read the license and              */
    1.17 +/*  understand and accept it fully.                                        */
    1.18 +/*                                                                         */
    1.19 +/***************************************************************************/
    1.20 +
    1.21 +
    1.22 +#ifndef __SFNT_H__
    1.23 +#define __SFNT_H__
    1.24 +
    1.25 +
    1.26 +#include <ft2build.h>
    1.27 +#include FT_INTERNAL_DRIVER_H
    1.28 +#include FT_INTERNAL_TRUETYPE_TYPES_H
    1.29 +
    1.30 +
    1.31 +FT_BEGIN_HEADER
    1.32 +
    1.33 +
    1.34 +  /*************************************************************************/
    1.35 +  /*                                                                       */
    1.36 +  /* <FuncType>                                                            */
    1.37 +  /*    TT_Init_Face_Func                                                  */
    1.38 +  /*                                                                       */
    1.39 +  /* <Description>                                                         */
    1.40 +  /*    First part of the SFNT face object initialization.  This finds     */
    1.41 +  /*    the face in a SFNT file or collection, and load its format tag in  */
    1.42 +  /*    face->format_tag.                                                  */
    1.43 +  /*                                                                       */
    1.44 +  /* <Input>                                                               */
    1.45 +  /*    stream     :: The input stream.                                    */
    1.46 +  /*                                                                       */
    1.47 +  /*    face       :: A handle to the target face object.                  */
    1.48 +  /*                                                                       */
    1.49 +  /*    face_index :: The index of the TrueType font, if we are opening a  */
    1.50 +  /*                  collection.                                          */
    1.51 +  /*                                                                       */
    1.52 +  /*    num_params :: The number of additional parameters.                 */
    1.53 +  /*                                                                       */
    1.54 +  /*    params     :: Optional additional parameters.                      */
    1.55 +  /*                                                                       */
    1.56 +  /* <Return>                                                              */
    1.57 +  /*    FreeType error code.  0 means success.                             */
    1.58 +  /*                                                                       */
    1.59 +  /* <Note>                                                                */
    1.60 +  /*    The stream cursor must be at the font file's origin.               */
    1.61 +  /*                                                                       */
    1.62 +  /*    This function recognizes fonts embedded in a `TrueType             */
    1.63 +  /*    collection'.                                                       */
    1.64 +  /*                                                                       */
    1.65 +  /*    Once the format tag has been validated by the font driver, it      */
    1.66 +  /*    should then call the TT_Load_Face_Func() callback to read the rest */
    1.67 +  /*    of the SFNT tables in the object.                                  */
    1.68 +  /*                                                                       */
    1.69 +  typedef FT_Error
    1.70 +  (*TT_Init_Face_Func)( FT_Stream      stream,
    1.71 +                        TT_Face        face,
    1.72 +                        FT_Int         face_index,
    1.73 +                        FT_Int         num_params,
    1.74 +                        FT_Parameter*  params );
    1.75 +
    1.76 +
    1.77 +  /*************************************************************************/
    1.78 +  /*                                                                       */
    1.79 +  /* <FuncType>                                                            */
    1.80 +  /*    TT_Load_Face_Func                                                  */
    1.81 +  /*                                                                       */
    1.82 +  /* <Description>                                                         */
    1.83 +  /*    Second part of the SFNT face object initialization.  This loads    */
    1.84 +  /*    the common SFNT tables (head, OS/2, maxp, metrics, etc.) in the    */
    1.85 +  /*    face object.                                                       */
    1.86 +  /*                                                                       */
    1.87 +  /* <Input>                                                               */
    1.88 +  /*    stream     :: The input stream.                                    */
    1.89 +  /*                                                                       */
    1.90 +  /*    face       :: A handle to the target face object.                  */
    1.91 +  /*                                                                       */
    1.92 +  /*    face_index :: The index of the TrueType font, if we are opening a  */
    1.93 +  /*                  collection.                                          */
    1.94 +  /*                                                                       */
    1.95 +  /*    num_params :: The number of additional parameters.                 */
    1.96 +  /*                                                                       */
    1.97 +  /*    params     :: Optional additional parameters.                      */
    1.98 +  /*                                                                       */
    1.99 +  /* <Return>                                                              */
   1.100 +  /*    FreeType error code.  0 means success.                             */
   1.101 +  /*                                                                       */
   1.102 +  /* <Note>                                                                */
   1.103 +  /*    This function must be called after TT_Init_Face_Func().            */
   1.104 +  /*                                                                       */
   1.105 +  typedef FT_Error
   1.106 +  (*TT_Load_Face_Func)( FT_Stream      stream,
   1.107 +                        TT_Face        face,
   1.108 +                        FT_Int         face_index,
   1.109 +                        FT_Int         num_params,
   1.110 +                        FT_Parameter*  params );
   1.111 +
   1.112 +
   1.113 +  /*************************************************************************/
   1.114 +  /*                                                                       */
   1.115 +  /* <FuncType>                                                            */
   1.116 +  /*    TT_Done_Face_Func                                                  */
   1.117 +  /*                                                                       */
   1.118 +  /* <Description>                                                         */
   1.119 +  /*    A callback used to delete the common SFNT data from a face.        */
   1.120 +  /*                                                                       */
   1.121 +  /* <Input>                                                               */
   1.122 +  /*    face :: A handle to the target face object.                        */
   1.123 +  /*                                                                       */
   1.124 +  /* <Note>                                                                */
   1.125 +  /*    This function does NOT destroy the face object.                    */
   1.126 +  /*                                                                       */
   1.127 +  typedef void
   1.128 +  (*TT_Done_Face_Func)( TT_Face  face );
   1.129 +
   1.130 +
   1.131 +#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
   1.132 +
   1.133 +  /*************************************************************************/
   1.134 +  /*                                                                       */
   1.135 +  /* <FuncType>                                                            */
   1.136 +  /*    TT_Load_SFNT_HeaderRec_Func                                        */
   1.137 +  /*                                                                       */
   1.138 +  /* <Description>                                                         */
   1.139 +  /*    Loads the header of a SFNT font file.  Supports collections.       */
   1.140 +  /*                                                                       */
   1.141 +  /* <Input>                                                               */
   1.142 +  /*    face       :: A handle to the target face object.                  */
   1.143 +  /*                                                                       */
   1.144 +  /*    stream     :: The input stream.                                    */
   1.145 +  /*                                                                       */
   1.146 +  /*    face_index :: The index of the TrueType font, if we are opening a  */
   1.147 +  /*                  collection.                                          */
   1.148 +  /*                                                                       */
   1.149 +  /* <Output>                                                              */
   1.150 +  /*    sfnt       :: The SFNT header.                                     */
   1.151 +  /*                                                                       */
   1.152 +  /* <Return>                                                              */
   1.153 +  /*    FreeType error code.  0 means success.                             */
   1.154 +  /*                                                                       */
   1.155 +  /* <Note>                                                                */
   1.156 +  /*    The stream cursor must be at the font file's origin.               */
   1.157 +  /*                                                                       */
   1.158 +  /*    This function recognizes fonts embedded in a `TrueType             */
   1.159 +  /*    collection'.                                                       */
   1.160 +  /*                                                                       */
   1.161 +  /*    This function checks that the header is valid by looking at the    */
   1.162 +  /*    values of `search_range', `entry_selector', and `range_shift'.     */
   1.163 +  /*                                                                       */
   1.164 +  typedef FT_Error
   1.165 +  (*TT_Load_SFNT_HeaderRec_Func)( TT_Face      face,
   1.166 +                                  FT_Stream    stream,
   1.167 +                                  FT_Long      face_index,
   1.168 +                                  SFNT_Header  sfnt );
   1.169 +
   1.170 +
   1.171 +  /*************************************************************************/
   1.172 +  /*                                                                       */
   1.173 +  /* <FuncType>                                                            */
   1.174 +  /*    TT_Load_Directory_Func                                             */
   1.175 +  /*                                                                       */
   1.176 +  /* <Description>                                                         */
   1.177 +  /*    Loads the table directory into a face object.                      */
   1.178 +  /*                                                                       */
   1.179 +  /* <Input>                                                               */
   1.180 +  /*    face   :: A handle to the target face object.                      */
   1.181 +  /*                                                                       */
   1.182 +  /*    stream :: The input stream.                                        */
   1.183 +  /*                                                                       */
   1.184 +  /*    sfnt   :: The SFNT header.                                         */
   1.185 +  /*                                                                       */
   1.186 +  /* <Return>                                                              */
   1.187 +  /*    FreeType error code.  0 means success.                             */
   1.188 +  /*                                                                       */
   1.189 +  /* <Note>                                                                */
   1.190 +  /*    The stream cursor must be on the first byte after the 4-byte font  */
   1.191 +  /*    format tag.  This is the case just after a call to                 */
   1.192 +  /*    TT_Load_Format_Tag().                                              */
   1.193 +  /*                                                                       */
   1.194 +  typedef FT_Error
   1.195 +  (*TT_Load_Directory_Func)( TT_Face      face,
   1.196 +                             FT_Stream    stream,
   1.197 +                             SFNT_Header  sfnt );
   1.198 +
   1.199 +#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */
   1.200 +
   1.201 +
   1.202 +  /*************************************************************************/
   1.203 +  /*                                                                       */
   1.204 +  /* <FuncType>                                                            */
   1.205 +  /*    TT_Load_Any_Func                                                   */
   1.206 +  /*                                                                       */
   1.207 +  /* <Description>                                                         */
   1.208 +  /*    Load any font table into client memory.                            */
   1.209 +  /*                                                                       */
   1.210 +  /* <Input>                                                               */
   1.211 +  /*    face   :: The face object to look for.                             */
   1.212 +  /*                                                                       */
   1.213 +  /*    tag    :: The tag of table to load.  Use the value 0 if you want   */
   1.214 +  /*              to access the whole font file, else set this parameter   */
   1.215 +  /*              to a valid TrueType table tag that you can forge with    */
   1.216 +  /*              the MAKE_TT_TAG macro.                                   */
   1.217 +  /*                                                                       */
   1.218 +  /*    offset :: The starting offset in the table (or the file if         */
   1.219 +  /*              tag == 0).                                               */
   1.220 +  /*                                                                       */
   1.221 +  /*    length :: The address of the decision variable:                    */
   1.222 +  /*                                                                       */
   1.223 +  /*                If length == NULL:                                     */
   1.224 +  /*                  Loads the whole table.  Returns an error if          */
   1.225 +  /*                  `offset' == 0!                                       */
   1.226 +  /*                                                                       */
   1.227 +  /*                If *length == 0:                                       */
   1.228 +  /*                  Exits immediately; returning the length of the given */
   1.229 +  /*                  table or of the font file, depending on the value of */
   1.230 +  /*                  `tag'.                                               */
   1.231 +  /*                                                                       */
   1.232 +  /*                If *length != 0:                                       */
   1.233 +  /*                  Loads the next `length' bytes of table or font,      */
   1.234 +  /*                  starting at offset `offset' (in table or font too).  */
   1.235 +  /*                                                                       */
   1.236 +  /* <Output>                                                              */
   1.237 +  /*    buffer :: The address of target buffer.                            */
   1.238 +  /*                                                                       */
   1.239 +  /* <Return>                                                              */
   1.240 +  /*    TrueType error code.  0 means success.                             */
   1.241 +  /*                                                                       */
   1.242 +  typedef FT_Error
   1.243 +  (*TT_Load_Any_Func)( TT_Face    face,
   1.244 +                       FT_ULong   tag,
   1.245 +                       FT_Long    offset,
   1.246 +                       FT_Byte   *buffer,
   1.247 +                       FT_ULong*  length );
   1.248 +
   1.249 +
   1.250 +  /*************************************************************************/
   1.251 +  /*                                                                       */
   1.252 +  /* <FuncType>                                                            */
   1.253 +  /*    TT_Find_SBit_Image_Func                                            */
   1.254 +  /*                                                                       */
   1.255 +  /* <Description>                                                         */
   1.256 +  /*    Check whether an embedded bitmap (an `sbit') exists for a given    */
   1.257 +  /*    glyph, at a given strike.                                          */
   1.258 +  /*                                                                       */
   1.259 +  /* <Input>                                                               */
   1.260 +  /*    face          :: The target face object.                           */
   1.261 +  /*                                                                       */
   1.262 +  /*    glyph_index   :: The glyph index.                                  */
   1.263 +  /*                                                                       */
   1.264 +  /*    strike_index  :: The current strike index.                         */
   1.265 +  /*                                                                       */
   1.266 +  /* <Output>                                                              */
   1.267 +  /*    arange        :: The SBit range containing the glyph index.        */
   1.268 +  /*                                                                       */
   1.269 +  /*    astrike       :: The SBit strike containing the glyph index.       */
   1.270 +  /*                                                                       */
   1.271 +  /*    aglyph_offset :: The offset of the glyph data in `EBDT' table.     */
   1.272 +  /*                                                                       */
   1.273 +  /* <Return>                                                              */
   1.274 +  /*    FreeType error code.  0 means success.  Returns                    */
   1.275 +  /*    SFNT_Err_Invalid_Argument if no sbit exists for the requested      */
   1.276 +  /*    glyph.                                                             */
   1.277 +  /*                                                                       */
   1.278 +  typedef FT_Error
   1.279 +  (*TT_Find_SBit_Image_Func)( TT_Face          face,
   1.280 +                              FT_UInt          glyph_index,
   1.281 +                              FT_ULong         strike_index,
   1.282 +                              TT_SBit_Range   *arange,
   1.283 +                              TT_SBit_Strike  *astrike,
   1.284 +                              FT_ULong        *aglyph_offset );
   1.285 +
   1.286 +
   1.287 +  /*************************************************************************/
   1.288 +  /*                                                                       */
   1.289 +  /* <FuncType>                                                            */
   1.290 +  /*    TT_Load_SBit_Metrics_Func                                          */
   1.291 +  /*                                                                       */
   1.292 +  /* <Description>                                                         */
   1.293 +  /*    Get the big metrics for a given embedded bitmap.                   */
   1.294 +  /*                                                                       */
   1.295 +  /* <Input>                                                               */
   1.296 +  /*    stream      :: The input stream.                                   */
   1.297 +  /*                                                                       */
   1.298 +  /*    range       :: The SBit range containing the glyph.                */
   1.299 +  /*                                                                       */
   1.300 +  /* <Output>                                                              */
   1.301 +  /*    big_metrics :: A big SBit metrics structure for the glyph.         */
   1.302 +  /*                                                                       */
   1.303 +  /* <Return>                                                              */
   1.304 +  /*    FreeType error code.  0 means success.                             */
   1.305 +  /*                                                                       */
   1.306 +  /* <Note>                                                                */
   1.307 +  /*    The stream cursor must be positioned at the glyph's offset within  */
   1.308 +  /*    the `EBDT' table before the call.                                  */
   1.309 +  /*                                                                       */
   1.310 +  /*    If the image format uses variable metrics, the stream cursor is    */
   1.311 +  /*    positioned just after the metrics header in the `EBDT' table on    */
   1.312 +  /*    function exit.                                                     */
   1.313 +  /*                                                                       */
   1.314 +  typedef FT_Error
   1.315 +  (*TT_Load_SBit_Metrics_Func)( FT_Stream        stream,
   1.316 +                                TT_SBit_Range    range,
   1.317 +                                TT_SBit_Metrics  metrics );
   1.318 +
   1.319 +
   1.320 +  /*************************************************************************/
   1.321 +  /*                                                                       */
   1.322 +  /* <FuncType>                                                            */
   1.323 +  /*    TT_Load_SBit_Image_Func                                            */
   1.324 +  /*                                                                       */
   1.325 +  /* <Description>                                                         */
   1.326 +  /*    Load a given glyph sbit image from the font resource.  This also   */
   1.327 +  /*    returns its metrics.                                               */
   1.328 +  /*                                                                       */
   1.329 +  /* <Input>                                                               */
   1.330 +  /*    face ::                                                            */
   1.331 +  /*      The target face object.                                          */
   1.332 +  /*                                                                       */
   1.333 +  /*    strike_index ::                                                    */
   1.334 +  /*      The strike index.                                                */
   1.335 +  /*                                                                       */
   1.336 +  /*    glyph_index ::                                                     */
   1.337 +  /*      The current glyph index.                                         */
   1.338 +  /*                                                                       */
   1.339 +  /*    load_flags ::                                                      */
   1.340 +  /*      The current load flags.                                          */
   1.341 +  /*                                                                       */
   1.342 +  /*    stream ::                                                          */
   1.343 +  /*      The input stream.                                                */
   1.344 +  /*                                                                       */
   1.345 +  /* <Output>                                                              */
   1.346 +  /*    amap ::                                                            */
   1.347 +  /*      The target pixmap.                                               */
   1.348 +  /*                                                                       */
   1.349 +  /*    ametrics ::                                                        */
   1.350 +  /*      A big sbit metrics structure for the glyph image.                */
   1.351 +  /*                                                                       */
   1.352 +  /* <Return>                                                              */
   1.353 +  /*    FreeType error code.  0 means success.  Returns an error if no     */
   1.354 +  /*    glyph sbit exists for the index.                                   */
   1.355 +  /*                                                                       */
   1.356 +  /*  <Note>                                                               */
   1.357 +  /*    The `map.buffer' field is always freed before the glyph is loaded. */
   1.358 +  /*                                                                       */
   1.359 +  typedef FT_Error
   1.360 +  (*TT_Load_SBit_Image_Func)( TT_Face              face,
   1.361 +                              FT_ULong             strike_index,
   1.362 +                              FT_UInt              glyph_index,
   1.363 +                              FT_UInt              load_flags,
   1.364 +                              FT_Stream            stream,
   1.365 +                              FT_Bitmap           *amap,
   1.366 +                              TT_SBit_MetricsRec  *ametrics );
   1.367 +
   1.368 +
   1.369 +#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
   1.370 +
   1.371 +  /*************************************************************************/
   1.372 +  /*                                                                       */
   1.373 +  /* <FuncType>                                                            */
   1.374 +  /*    TT_Set_SBit_Strike_OldFunc                                         */
   1.375 +  /*                                                                       */
   1.376 +  /* <Description>                                                         */
   1.377 +  /*    Select an sbit strike for a given size request.                    */
   1.378 +  /*                                                                       */
   1.379 +  /* <Input>                                                               */
   1.380 +  /*    face          :: The target face object.                           */
   1.381 +  /*                                                                       */
   1.382 +  /*    req           :: The size request.                                 */
   1.383 +  /*                                                                       */
   1.384 +  /* <Output>                                                              */
   1.385 +  /*    astrike_index :: The index of the sbit strike.                     */
   1.386 +  /*                                                                       */
   1.387 +  /* <Return>                                                              */
   1.388 +  /*    FreeType error code.  0 means success.  Returns an error if no     */
   1.389 +  /*    sbit strike exists for the selected ppem values.                   */
   1.390 +  /*                                                                       */
   1.391 +  typedef FT_Error
   1.392 +  (*TT_Set_SBit_Strike_OldFunc)( TT_Face    face,
   1.393 +                                 FT_UInt    x_ppem,
   1.394 +                                 FT_UInt    y_ppem,
   1.395 +                                 FT_ULong*  astrike_index );
   1.396 +
   1.397 +
   1.398 +  /*************************************************************************/
   1.399 +  /*                                                                       */
   1.400 +  /* <FuncType>                                                            */
   1.401 +  /*    TT_CharMap_Load_Func                                               */
   1.402 +  /*                                                                       */
   1.403 +  /* <Description>                                                         */
   1.404 +  /*    Loads a given TrueType character map into memory.                  */
   1.405 +  /*                                                                       */
   1.406 +  /* <Input>                                                               */
   1.407 +  /*    face   :: A handle to the parent face object.                      */
   1.408 +  /*                                                                       */
   1.409 +  /*    stream :: A handle to the current stream object.                   */
   1.410 +  /*                                                                       */
   1.411 +  /* <InOut>                                                               */
   1.412 +  /*    cmap   :: A pointer to a cmap object.                              */
   1.413 +  /*                                                                       */
   1.414 +  /* <Return>                                                              */
   1.415 +  /*    FreeType error code.  0 means success.                             */
   1.416 +  /*                                                                       */
   1.417 +  /* <Note>                                                                */
   1.418 +  /*    The function assumes that the stream is already in use (i.e.,      */
   1.419 +  /*    opened).  In case of error, all partially allocated tables are     */
   1.420 +  /*    released.                                                          */
   1.421 +  /*                                                                       */
   1.422 +  typedef FT_Error
   1.423 +  (*TT_CharMap_Load_Func)( TT_Face    face,
   1.424 +                           void*      cmap,
   1.425 +                           FT_Stream  input );
   1.426 +
   1.427 +
   1.428 +  /*************************************************************************/
   1.429 +  /*                                                                       */
   1.430 +  /* <FuncType>                                                            */
   1.431 +  /*    TT_CharMap_Free_Func                                               */
   1.432 +  /*                                                                       */
   1.433 +  /* <Description>                                                         */
   1.434 +  /*    Destroys a character mapping table.                                */
   1.435 +  /*                                                                       */
   1.436 +  /* <Input>                                                               */
   1.437 +  /*    face :: A handle to the parent face object.                        */
   1.438 +  /*                                                                       */
   1.439 +  /*    cmap :: A handle to a cmap object.                                 */
   1.440 +  /*                                                                       */
   1.441 +  /* <Return>                                                              */
   1.442 +  /*    FreeType error code.  0 means success.                             */
   1.443 +  /*                                                                       */
   1.444 +  typedef FT_Error
   1.445 +  (*TT_CharMap_Free_Func)( TT_Face       face,
   1.446 +                           void*         cmap );
   1.447 +
   1.448 +#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */
   1.449 +
   1.450 +
   1.451 +  /*************************************************************************/
   1.452 +  /*                                                                       */
   1.453 +  /* <FuncType>                                                            */
   1.454 +  /*    TT_Set_SBit_Strike_Func                                            */
   1.455 +  /*                                                                       */
   1.456 +  /* <Description>                                                         */
   1.457 +  /*    Select an sbit strike for a given size request.                    */
   1.458 +  /*                                                                       */
   1.459 +  /* <Input>                                                               */
   1.460 +  /*    face          :: The target face object.                           */
   1.461 +  /*                                                                       */
   1.462 +  /*    req           :: The size request.                                 */
   1.463 +  /*                                                                       */
   1.464 +  /* <Output>                                                              */
   1.465 +  /*    astrike_index :: The index of the sbit strike.                     */
   1.466 +  /*                                                                       */
   1.467 +  /* <Return>                                                              */
   1.468 +  /*    FreeType error code.  0 means success.  Returns an error if no     */
   1.469 +  /*    sbit strike exists for the selected ppem values.                   */
   1.470 +  /*                                                                       */
   1.471 +  typedef FT_Error
   1.472 +  (*TT_Set_SBit_Strike_Func)( TT_Face          face,
   1.473 +                              FT_Size_Request  req,
   1.474 +                              FT_ULong*        astrike_index );
   1.475 +
   1.476 +
   1.477 +  /*************************************************************************/
   1.478 +  /*                                                                       */
   1.479 +  /* <FuncType>                                                            */
   1.480 +  /*    TT_Load_Strike_Metrics_Func                                        */
   1.481 +  /*                                                                       */
   1.482 +  /* <Description>                                                         */
   1.483 +  /*    Load the metrics of a given strike.                                */
   1.484 +  /*                                                                       */
   1.485 +  /* <Input>                                                               */
   1.486 +  /*    face          :: The target face object.                           */
   1.487 +  /*                                                                       */
   1.488 +  /*    strike_index  :: The strike index.                                 */
   1.489 +  /*                                                                       */
   1.490 +  /* <Output>                                                              */
   1.491 +  /*    metrics       :: the metrics of the strike.                        */
   1.492 +  /*                                                                       */
   1.493 +  /* <Return>                                                              */
   1.494 +  /*    FreeType error code.  0 means success.  Returns an error if no     */
   1.495 +  /*    such sbit strike exists.                                           */
   1.496 +  /*                                                                       */
   1.497 +  typedef FT_Error
   1.498 +  (*TT_Load_Strike_Metrics_Func)( TT_Face           face,
   1.499 +                                  FT_ULong          strike_index,
   1.500 +                                  FT_Size_Metrics*  metrics );
   1.501 +
   1.502 +
   1.503 +  /*************************************************************************/
   1.504 +  /*                                                                       */
   1.505 +  /* <FuncType>                                                            */
   1.506 +  /*    TT_Get_PS_Name_Func                                                */
   1.507 +  /*                                                                       */
   1.508 +  /* <Description>                                                         */
   1.509 +  /*    Get the PostScript glyph name of a glyph.                          */
   1.510 +  /*                                                                       */
   1.511 +  /* <Input>                                                               */
   1.512 +  /*    idx  :: The glyph index.                                           */
   1.513 +  /*                                                                       */
   1.514 +  /*    PSname :: The address of a string pointer.  Will be NULL in case   */
   1.515 +  /*              of error, otherwise it is a pointer to the glyph name.   */
   1.516 +  /*                                                                       */
   1.517 +  /*              You must not modify the returned string!                 */
   1.518 +  /*                                                                       */
   1.519 +  /* <Output>                                                              */
   1.520 +  /*    FreeType error code.  0 means success.                             */
   1.521 +  /*                                                                       */
   1.522 +  typedef FT_Error
   1.523 +  (*TT_Get_PS_Name_Func)( TT_Face      face,
   1.524 +                          FT_UInt      idx,
   1.525 +                          FT_String**  PSname );
   1.526 +
   1.527 +
   1.528 +  /*************************************************************************/
   1.529 +  /*                                                                       */
   1.530 +  /* <FuncType>                                                            */
   1.531 +  /*    TT_Load_Metrics_Func                                               */
   1.532 +  /*                                                                       */
   1.533 +  /* <Description>                                                         */
   1.534 +  /*    Load a metrics table, which is a table with a horizontal and a     */
   1.535 +  /*    vertical version.                                                  */
   1.536 +  /*                                                                       */
   1.537 +  /* <Input>                                                               */
   1.538 +  /*    face     :: A handle to the target face object.                    */
   1.539 +  /*                                                                       */
   1.540 +  /*    stream   :: The input stream.                                      */
   1.541 +  /*                                                                       */
   1.542 +  /*    vertical :: A boolean flag.  If set, load the vertical one.        */
   1.543 +  /*                                                                       */
   1.544 +  /* <Return>                                                              */
   1.545 +  /*    FreeType error code.  0 means success.                             */
   1.546 +  /*                                                                       */
   1.547 +  typedef FT_Error
   1.548 +  (*TT_Load_Metrics_Func)( TT_Face    face,
   1.549 +                           FT_Stream  stream,
   1.550 +                           FT_Bool    vertical );
   1.551 +
   1.552 +
   1.553 +  /*************************************************************************/
   1.554 +  /*                                                                       */
   1.555 +  /* <FuncType>                                                            */
   1.556 +  /*    TT_Get_Metrics_Func                                                */
   1.557 +  /*                                                                       */
   1.558 +  /* <Description>                                                         */
   1.559 +  /*    Load the horizontal or vertical header in a face object.           */
   1.560 +  /*                                                                       */
   1.561 +  /* <Input>                                                               */
   1.562 +  /*    face     :: A handle to the target face object.                    */
   1.563 +  /*                                                                       */
   1.564 +  /*    stream   :: The input stream.                                      */
   1.565 +  /*                                                                       */
   1.566 +  /*    vertical :: A boolean flag.  If set, load vertical metrics.        */
   1.567 +  /*                                                                       */
   1.568 +  /* <Return>                                                              */
   1.569 +  /*    FreeType error code.  0 means success.                             */
   1.570 +  /*                                                                       */
   1.571 +  typedef FT_Error
   1.572 +  (*TT_Get_Metrics_Func)( TT_Face     face,
   1.573 +                          FT_Bool     vertical,
   1.574 +                          FT_UInt     gindex,
   1.575 +                          FT_Short*   abearing,
   1.576 +                          FT_UShort*  aadvance );
   1.577 +
   1.578 +
   1.579 +  /*************************************************************************/
   1.580 +  /*                                                                       */
   1.581 +  /* <FuncType>                                                            */
   1.582 +  /*    TT_Load_Table_Func                                                 */
   1.583 +  /*                                                                       */
   1.584 +  /* <Description>                                                         */
   1.585 +  /*    Load a given TrueType table.                                       */
   1.586 +  /*                                                                       */
   1.587 +  /* <Input>                                                               */
   1.588 +  /*    face   :: A handle to the target face object.                      */
   1.589 +  /*                                                                       */
   1.590 +  /*    stream :: The input stream.                                        */
   1.591 +  /*                                                                       */
   1.592 +  /* <Return>                                                              */
   1.593 +  /*    FreeType error code.  0 means success.                             */
   1.594 +  /*                                                                       */
   1.595 +  /* <Note>                                                                */
   1.596 +  /*    The function uses `face->goto_table' to seek the stream to the     */
   1.597 +  /*    start of the table, except while loading the font directory.       */
   1.598 +  /*                                                                       */
   1.599 +  typedef FT_Error
   1.600 +  (*TT_Load_Table_Func)( TT_Face    face,
   1.601 +                         FT_Stream  stream );
   1.602 +
   1.603 +
   1.604 +  /*************************************************************************/
   1.605 +  /*                                                                       */
   1.606 +  /* <FuncType>                                                            */
   1.607 +  /*    TT_Free_Table_Func                                                 */
   1.608 +  /*                                                                       */
   1.609 +  /* <Description>                                                         */
   1.610 +  /*    Free a given TrueType table.                                       */
   1.611 +  /*                                                                       */
   1.612 +  /* <Input>                                                               */
   1.613 +  /*    face :: A handle to the target face object.                        */
   1.614 +  /*                                                                       */
   1.615 +  typedef void
   1.616 +  (*TT_Free_Table_Func)( TT_Face  face );
   1.617 +
   1.618 +
   1.619 +  /*
   1.620 +   * @functype:
   1.621 +   *    TT_Face_GetKerningFunc
   1.622 +   *
   1.623 +   * @description:
   1.624 +   *    Return the horizontal kerning value between two glyphs.
   1.625 +   *
   1.626 +   * @input:
   1.627 +   *    face        :: A handle to the source face object.
   1.628 +   *    left_glyph  :: The left glyph index.
   1.629 +   *    right_glyph :: The right glyph index.
   1.630 +   *
   1.631 +   * @return:
   1.632 +   *    The kerning value in font units.
   1.633 +   */
   1.634 +  typedef FT_Int
   1.635 +  (*TT_Face_GetKerningFunc)( TT_Face  face,
   1.636 +                             FT_UInt  left_glyph,
   1.637 +                             FT_UInt  right_glyph );
   1.638 +
   1.639 +
   1.640 +  /*************************************************************************/
   1.641 +  /*                                                                       */
   1.642 +  /* <Struct>                                                              */
   1.643 +  /*    SFNT_Interface                                                     */
   1.644 +  /*                                                                       */
   1.645 +  /* <Description>                                                         */
   1.646 +  /*    This structure holds pointers to the functions used to load and    */
   1.647 +  /*    free the basic tables that are required in a `sfnt' font file.     */
   1.648 +  /*                                                                       */
   1.649 +  /* <Fields>                                                              */
   1.650 +  /*    Check the various xxx_Func() descriptions for details.             */
   1.651 +  /*                                                                       */
   1.652 +  typedef struct  SFNT_Interface_
   1.653 +  {
   1.654 +    TT_Loader_GotoTableFunc      goto_table;
   1.655 +
   1.656 +    TT_Init_Face_Func            init_face;
   1.657 +    TT_Load_Face_Func            load_face;
   1.658 +    TT_Done_Face_Func            done_face;
   1.659 +    FT_Module_Requester          get_interface;
   1.660 +
   1.661 +    TT_Load_Any_Func             load_any;
   1.662 +
   1.663 +#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
   1.664 +    TT_Load_SFNT_HeaderRec_Func  load_sfnt_header;
   1.665 +    TT_Load_Directory_Func       load_directory;
   1.666 +#endif
   1.667 +
   1.668 +    /* these functions are called by `load_face' but they can also  */
   1.669 +    /* be called from external modules, if there is a need to do so */
   1.670 +    TT_Load_Table_Func           load_head;
   1.671 +    TT_Load_Metrics_Func         load_hhea;
   1.672 +    TT_Load_Table_Func           load_cmap;
   1.673 +    TT_Load_Table_Func           load_maxp;
   1.674 +    TT_Load_Table_Func           load_os2;
   1.675 +    TT_Load_Table_Func           load_post;
   1.676 +
   1.677 +    TT_Load_Table_Func           load_name;
   1.678 +    TT_Free_Table_Func           free_name;
   1.679 +
   1.680 +    /* optional tables */
   1.681 +#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
   1.682 +    TT_Load_Table_Func           load_hdmx_stub;
   1.683 +    TT_Free_Table_Func           free_hdmx_stub;
   1.684 +#endif
   1.685 +
   1.686 +    /* this field was called `load_kerning' up to version 2.1.10 */
   1.687 +    TT_Load_Table_Func           load_kern;
   1.688 +
   1.689 +    TT_Load_Table_Func           load_gasp;
   1.690 +    TT_Load_Table_Func           load_pclt;
   1.691 +
   1.692 +    /* see `ttload.h'; this field was called `load_bitmap_header' up to */
   1.693 +    /* version 2.1.10                                                   */
   1.694 +    TT_Load_Table_Func           load_bhed;
   1.695 +
   1.696 +#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
   1.697 +
   1.698 +    /* see `ttsbit.h' */
   1.699 +    TT_Set_SBit_Strike_OldFunc   set_sbit_strike_stub;
   1.700 +    TT_Load_Table_Func           load_sbits_stub;
   1.701 +
   1.702 +    /*
   1.703 +     *  The following two fields appeared in version 2.1.8, and were placed
   1.704 +     *  between `load_sbits' and `load_sbit_image'.  We support them as a
   1.705 +     *  special exception since they are used by Xfont library within the
   1.706 +     *  X.Org xserver, and because the probability that other rogue clients
   1.707 +     *  use the other version 2.1.7 fields below is _extremely_ low.
   1.708 +     *
   1.709 +     *  Note that this forces us to disable an interesting memory-saving
   1.710 +     *  optimization though...
   1.711 +     */
   1.712 +
   1.713 +    TT_Find_SBit_Image_Func      find_sbit_image;
   1.714 +    TT_Load_SBit_Metrics_Func    load_sbit_metrics;
   1.715 +
   1.716 +#endif
   1.717 +
   1.718 +    TT_Load_SBit_Image_Func      load_sbit_image;
   1.719 +
   1.720 +#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
   1.721 +    TT_Free_Table_Func           free_sbits_stub;
   1.722 +#endif
   1.723 +
   1.724 +    /* see `ttpost.h' */
   1.725 +    TT_Get_PS_Name_Func          get_psname;
   1.726 +    TT_Free_Table_Func           free_psnames;
   1.727 +
   1.728 +#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
   1.729 +    TT_CharMap_Load_Func         load_charmap_stub;
   1.730 +    TT_CharMap_Free_Func         free_charmap_stub;
   1.731 +#endif
   1.732 +
   1.733 +    /* starting here, the structure differs from version 2.1.7 */
   1.734 +
   1.735 +    /* this field was introduced in version 2.1.8, named `get_psname' */
   1.736 +    TT_Face_GetKerningFunc       get_kerning;
   1.737 +
   1.738 +    /* new elements introduced after version 2.1.10 */
   1.739 +
   1.740 +    /* load the font directory, i.e., the offset table and */
   1.741 +    /* the table directory                                 */
   1.742 +    TT_Load_Table_Func           load_font_dir;
   1.743 +    TT_Load_Metrics_Func         load_hmtx;
   1.744 +
   1.745 +    TT_Load_Table_Func           load_eblc;
   1.746 +    TT_Free_Table_Func           free_eblc;
   1.747 +
   1.748 +    TT_Set_SBit_Strike_Func      set_sbit_strike;
   1.749 +    TT_Load_Strike_Metrics_Func  load_strike_metrics;
   1.750 +
   1.751 +    TT_Get_Metrics_Func          get_metrics;
   1.752 +
   1.753 +  } SFNT_Interface;
   1.754 +
   1.755 +
   1.756 +  /* transitional */
   1.757 +  typedef SFNT_Interface*   SFNT_Service;
   1.758 +
   1.759 +#ifndef FT_CONFIG_OPTION_PIC
   1.760 +
   1.761 +#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
   1.762 +#define FT_DEFINE_DRIVERS_OLD_INTERNAL(a) \
   1.763 +  a, 
   1.764 +#else
   1.765 +  #define FT_DEFINE_DRIVERS_OLD_INTERNAL(a)
   1.766 +#endif
   1.767 +#define FT_INTERNAL(a) \
   1.768 +  a, 
   1.769 +
   1.770 +#define FT_DEFINE_SFNT_INTERFACE(class_,                                     \
   1.771 +    goto_table_, init_face_, load_face_, done_face_, get_interface_,         \
   1.772 +    load_any_, load_sfnt_header_, load_directory_, load_head_,               \
   1.773 +    load_hhea_, load_cmap_, load_maxp_, load_os2_, load_post_,               \
   1.774 +    load_name_, free_name_, load_hdmx_stub_, free_hdmx_stub_,                \
   1.775 +    load_kern_, load_gasp_, load_pclt_, load_bhed_,                          \
   1.776 +    set_sbit_strike_stub_, load_sbits_stub_, find_sbit_image_,               \
   1.777 +    load_sbit_metrics_, load_sbit_image_, free_sbits_stub_,                  \
   1.778 +    get_psname_, free_psnames_, load_charmap_stub_, free_charmap_stub_,      \
   1.779 +    get_kerning_, load_font_dir_, load_hmtx_, load_eblc_, free_eblc_,        \
   1.780 +    set_sbit_strike_, load_strike_metrics_, get_metrics_ )                   \
   1.781 +  static const SFNT_Interface class_ =                                       \
   1.782 +  {                                                                          \
   1.783 +    FT_INTERNAL(goto_table_) \
   1.784 +    FT_INTERNAL(init_face_) \
   1.785 +    FT_INTERNAL(load_face_) \
   1.786 +    FT_INTERNAL(done_face_) \
   1.787 +    FT_INTERNAL(get_interface_) \
   1.788 +    FT_INTERNAL(load_any_) \
   1.789 +    FT_DEFINE_DRIVERS_OLD_INTERNAL(load_sfnt_header_) \
   1.790 +    FT_DEFINE_DRIVERS_OLD_INTERNAL(load_directory_) \
   1.791 +    FT_INTERNAL(load_head_) \
   1.792 +    FT_INTERNAL(load_hhea_) \
   1.793 +    FT_INTERNAL(load_cmap_) \
   1.794 +    FT_INTERNAL(load_maxp_) \
   1.795 +    FT_INTERNAL(load_os2_) \
   1.796 +    FT_INTERNAL(load_post_) \
   1.797 +    FT_INTERNAL(load_name_) \
   1.798 +    FT_INTERNAL(free_name_) \
   1.799 +    FT_DEFINE_DRIVERS_OLD_INTERNAL(load_hdmx_stub_) \
   1.800 +    FT_DEFINE_DRIVERS_OLD_INTERNAL(free_hdmx_stub_) \
   1.801 +    FT_INTERNAL(load_kern_) \
   1.802 +    FT_INTERNAL(load_gasp_) \
   1.803 +    FT_INTERNAL(load_pclt_) \
   1.804 +    FT_INTERNAL(load_bhed_) \
   1.805 +    FT_DEFINE_DRIVERS_OLD_INTERNAL(set_sbit_strike_stub_) \
   1.806 +    FT_DEFINE_DRIVERS_OLD_INTERNAL(load_sbits_stub_) \
   1.807 +    FT_DEFINE_DRIVERS_OLD_INTERNAL(find_sbit_image_) \
   1.808 +    FT_DEFINE_DRIVERS_OLD_INTERNAL(load_sbit_metrics_) \
   1.809 +    FT_INTERNAL(load_sbit_image_) \
   1.810 +    FT_DEFINE_DRIVERS_OLD_INTERNAL(free_sbits_stub_) \
   1.811 +    FT_INTERNAL(get_psname_) \
   1.812 +    FT_INTERNAL(free_psnames_) \
   1.813 +    FT_DEFINE_DRIVERS_OLD_INTERNAL(load_charmap_stub_) \
   1.814 +    FT_DEFINE_DRIVERS_OLD_INTERNAL(free_charmap_stub_) \
   1.815 +    FT_INTERNAL(get_kerning_) \
   1.816 +    FT_INTERNAL(load_font_dir_) \
   1.817 +    FT_INTERNAL(load_hmtx_) \
   1.818 +    FT_INTERNAL(load_eblc_) \
   1.819 +    FT_INTERNAL(free_eblc_) \
   1.820 +    FT_INTERNAL(set_sbit_strike_) \
   1.821 +    FT_INTERNAL(load_strike_metrics_) \
   1.822 +    FT_INTERNAL(get_metrics_) \
   1.823 +  };
   1.824 +
   1.825 +#else /* FT_CONFIG_OPTION_PIC */ 
   1.826 +
   1.827 +#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
   1.828 +#define FT_DEFINE_DRIVERS_OLD_INTERNAL(a, a_) \
   1.829 +  clazz->a = a_;
   1.830 +#else
   1.831 +  #define FT_DEFINE_DRIVERS_OLD_INTERNAL(a, a_)
   1.832 +#endif
   1.833 +#define FT_INTERNAL(a, a_) \
   1.834 +  clazz->a = a_;
   1.835 +
   1.836 +#define FT_DEFINE_SFNT_INTERFACE(class_,                                     \
   1.837 +    goto_table_, init_face_, load_face_, done_face_, get_interface_,         \
   1.838 +    load_any_, load_sfnt_header_, load_directory_, load_head_,               \
   1.839 +    load_hhea_, load_cmap_, load_maxp_, load_os2_, load_post_,               \
   1.840 +    load_name_, free_name_, load_hdmx_stub_, free_hdmx_stub_,                \
   1.841 +    load_kern_, load_gasp_, load_pclt_, load_bhed_,                          \
   1.842 +    set_sbit_strike_stub_, load_sbits_stub_, find_sbit_image_,               \
   1.843 +    load_sbit_metrics_, load_sbit_image_, free_sbits_stub_,                  \
   1.844 +    get_psname_, free_psnames_, load_charmap_stub_, free_charmap_stub_,      \
   1.845 +    get_kerning_, load_font_dir_, load_hmtx_, load_eblc_, free_eblc_,        \
   1.846 +    set_sbit_strike_, load_strike_metrics_, get_metrics_ )                   \
   1.847 +  void                                                                       \
   1.848 +  FT_Init_Class_##class_( FT_Library library, SFNT_Interface*  clazz )       \
   1.849 +  {                                                                          \
   1.850 +    FT_UNUSED(library);                                                      \
   1.851 +    FT_INTERNAL(goto_table,goto_table_) \
   1.852 +    FT_INTERNAL(init_face,init_face_) \
   1.853 +    FT_INTERNAL(load_face,load_face_) \
   1.854 +    FT_INTERNAL(done_face,done_face_) \
   1.855 +    FT_INTERNAL(get_interface,get_interface_) \
   1.856 +    FT_INTERNAL(load_any,load_any_) \
   1.857 +    FT_DEFINE_DRIVERS_OLD_INTERNAL(load_sfnt_header,load_sfnt_header_) \
   1.858 +    FT_DEFINE_DRIVERS_OLD_INTERNAL(load_directory,load_directory_) \
   1.859 +    FT_INTERNAL(load_head,load_head_) \
   1.860 +    FT_INTERNAL(load_hhea,load_hhea_) \
   1.861 +    FT_INTERNAL(load_cmap,load_cmap_) \
   1.862 +    FT_INTERNAL(load_maxp,load_maxp_) \
   1.863 +    FT_INTERNAL(load_os2,load_os2_) \
   1.864 +    FT_INTERNAL(load_post,load_post_) \
   1.865 +    FT_INTERNAL(load_name,load_name_) \
   1.866 +    FT_INTERNAL(free_name,free_name_) \
   1.867 +    FT_DEFINE_DRIVERS_OLD_INTERNAL(load_hdmx_stub,load_hdmx_stub_) \
   1.868 +    FT_DEFINE_DRIVERS_OLD_INTERNAL(free_hdmx_stub,free_hdmx_stub_) \
   1.869 +    FT_INTERNAL(load_kern,load_kern_) \
   1.870 +    FT_INTERNAL(load_gasp,load_gasp_) \
   1.871 +    FT_INTERNAL(load_pclt,load_pclt_) \
   1.872 +    FT_INTERNAL(load_bhed,load_bhed_) \
   1.873 +    FT_DEFINE_DRIVERS_OLD_INTERNAL(set_sbit_strike_stub,set_sbit_strike_stub_) \
   1.874 +    FT_DEFINE_DRIVERS_OLD_INTERNAL(load_sbits_stub,load_sbits_stub_) \
   1.875 +    FT_DEFINE_DRIVERS_OLD_INTERNAL(find_sbit_image,find_sbit_image_) \
   1.876 +    FT_DEFINE_DRIVERS_OLD_INTERNAL(load_sbit_metrics,load_sbit_metrics_) \
   1.877 +    FT_INTERNAL(load_sbit_image,load_sbit_image_) \
   1.878 +    FT_DEFINE_DRIVERS_OLD_INTERNAL(free_sbits_stub,free_sbits_stub_) \
   1.879 +    FT_INTERNAL(get_psname,get_psname_) \
   1.880 +    FT_INTERNAL(free_psnames,free_psnames_) \
   1.881 +    FT_DEFINE_DRIVERS_OLD_INTERNAL(load_charmap_stub,load_charmap_stub_) \
   1.882 +    FT_DEFINE_DRIVERS_OLD_INTERNAL(free_charmap_stub,free_charmap_stub_) \
   1.883 +    FT_INTERNAL(get_kerning,get_kerning_) \
   1.884 +    FT_INTERNAL(load_font_dir,load_font_dir_) \
   1.885 +    FT_INTERNAL(load_hmtx,load_hmtx_) \
   1.886 +    FT_INTERNAL(load_eblc,load_eblc_) \
   1.887 +    FT_INTERNAL(free_eblc,free_eblc_) \
   1.888 +    FT_INTERNAL(set_sbit_strike,set_sbit_strike_) \
   1.889 +    FT_INTERNAL(load_strike_metrics,load_strike_metrics_) \
   1.890 +    FT_INTERNAL(get_metrics,get_metrics_) \
   1.891 +  } 
   1.892 +
   1.893 +#endif /* FT_CONFIG_OPTION_PIC */ 
   1.894 +
   1.895 +FT_END_HEADER
   1.896 +
   1.897 +#endif /* __SFNT_H__ */
   1.898 +
   1.899 +
   1.900 +/* END */