misc/libfreetype/src/truetype/ttdriver.c
author Xeli
Fri, 07 Oct 2011 14:17:07 +0200
branchhedgeroid
changeset 6035 bdd0528ee8a6
parent 5172 88f2e05288ba
permissions -rw-r--r--
Close a game without leaking memory. It should be noted that sending an SDL Quit event leaks memory
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5172
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     1
/***************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     2
/*                                                                         */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     3
/*  ttdriver.c                                                             */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     4
/*                                                                         */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     5
/*    TrueType font driver implementation (body).                          */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     6
/*                                                                         */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     7
/*  Copyright 1996-2011 by                                                 */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     8
/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     9
/*                                                                         */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    10
/*  This file is part of the FreeType project, and may only be used,       */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    11
/*  modified, and distributed under the terms of the FreeType project      */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    12
/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    13
/*  this file you indicate that you have read the license and              */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    14
/*  understand and accept it fully.                                        */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    15
/*                                                                         */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    16
/***************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    17
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    18
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    19
#include <ft2build.h>
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    20
#include FT_INTERNAL_DEBUG_H
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    21
#include FT_INTERNAL_STREAM_H
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    22
#include FT_INTERNAL_SFNT_H
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    23
#include FT_SERVICE_XFREE86_NAME_H
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    24
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    25
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    26
#include FT_MULTIPLE_MASTERS_H
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    27
#include FT_SERVICE_MULTIPLE_MASTERS_H
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    28
#endif
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    29
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    30
#include FT_SERVICE_TRUETYPE_ENGINE_H
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    31
#include FT_SERVICE_TRUETYPE_GLYF_H
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    32
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    33
#include "ttdriver.h"
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    34
#include "ttgload.h"
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    35
#include "ttpload.h"
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    36
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    37
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    38
#include "ttgxvar.h"
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    39
#endif
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    40
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    41
#include "tterrors.h"
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    42
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    43
#include "ttpic.h"
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    44
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    45
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    46
  /*                                                                       */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    47
  /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    48
  /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    49
  /* messages during execution.                                            */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    50
  /*                                                                       */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    51
#undef  FT_COMPONENT
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    52
#define FT_COMPONENT  trace_ttdriver
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    53
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    54
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    55
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    56
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    57
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    58
  /****                                                                 ****/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    59
  /****                                                                 ****/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    60
  /****                          F A C E S                              ****/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    61
  /****                                                                 ****/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    62
  /****                                                                 ****/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    63
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    64
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    65
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    66
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    67
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    68
#undef  PAIR_TAG
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    69
#define PAIR_TAG( left, right )  ( ( (FT_ULong)left << 16 ) | \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    70
                                     (FT_ULong)right        )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    71
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    72
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    73
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    74
  /*                                                                       */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    75
  /* <Function>                                                            */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    76
  /*    tt_get_kerning                                                     */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    77
  /*                                                                       */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    78
  /* <Description>                                                         */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    79
  /*    A driver method used to return the kerning vector between two      */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    80
  /*    glyphs of the same face.                                           */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    81
  /*                                                                       */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    82
  /* <Input>                                                               */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    83
  /*    face        :: A handle to the source face object.                 */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    84
  /*                                                                       */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    85
  /*    left_glyph  :: The index of the left glyph in the kern pair.       */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    86
  /*                                                                       */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    87
  /*    right_glyph :: The index of the right glyph in the kern pair.      */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    88
  /*                                                                       */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    89
  /* <Output>                                                              */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    90
  /*    kerning     :: The kerning vector.  This is in font units for      */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    91
  /*                   scalable formats, and in pixels for fixed-sizes     */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    92
  /*                   formats.                                            */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    93
  /*                                                                       */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    94
  /* <Return>                                                              */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    95
  /*    FreeType error code.  0 means success.                             */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    96
  /*                                                                       */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    97
  /* <Note>                                                                */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    98
  /*    Only horizontal layouts (left-to-right & right-to-left) are        */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    99
  /*    supported by this function.  Other layouts, or more sophisticated  */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   100
  /*    kernings, are out of scope of this method (the basic driver        */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   101
  /*    interface is meant to be simple).                                  */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   102
  /*                                                                       */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   103
  /*    They can be implemented by format-specific interfaces.             */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   104
  /*                                                                       */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   105
  static FT_Error
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   106
  tt_get_kerning( FT_Face     ttface,          /* TT_Face */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   107
                  FT_UInt     left_glyph,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   108
                  FT_UInt     right_glyph,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   109
                  FT_Vector*  kerning )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   110
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   111
    TT_Face       face = (TT_Face)ttface;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   112
    SFNT_Service  sfnt = (SFNT_Service)face->sfnt;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   113
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   114
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   115
    kerning->x = 0;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   116
    kerning->y = 0;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   117
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   118
    if ( sfnt )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   119
      kerning->x = sfnt->get_kerning( face, left_glyph, right_glyph );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   120
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   121
    return 0;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   122
  }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   123
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   124
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   125
#undef PAIR_TAG
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   126
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   127
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   128
  static FT_Error
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   129
  tt_get_advances( FT_Face    ttface,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   130
                   FT_UInt    start,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   131
                   FT_UInt    count,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   132
                   FT_Int32   flags,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   133
                   FT_Fixed  *advances )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   134
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   135
    FT_UInt  nn;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   136
    TT_Face  face  = (TT_Face) ttface;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   137
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   138
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   139
    /* XXX: TODO: check for sbits */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   140
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   141
    if ( flags & FT_LOAD_VERTICAL_LAYOUT )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   142
    {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   143
      for ( nn = 0; nn < count; nn++ )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   144
      {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   145
        FT_Short   tsb;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   146
        FT_UShort  ah;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   147
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   148
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   149
        TT_Get_VMetrics( face, start + nn, &tsb, &ah );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   150
        advances[nn] = ah;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   151
      }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   152
    }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   153
    else
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   154
    {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   155
      for ( nn = 0; nn < count; nn++ )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   156
      {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   157
        FT_Short   lsb;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   158
        FT_UShort  aw;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   159
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   160
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   161
        TT_Get_HMetrics( face, start + nn, &lsb, &aw );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   162
        advances[nn] = aw;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   163
      }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   164
    }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   165
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   166
    return TT_Err_Ok;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   167
  }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   168
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   169
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   170
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   171
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   172
  /****                                                                 ****/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   173
  /****                                                                 ****/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   174
  /****                           S I Z E S                             ****/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   175
  /****                                                                 ****/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   176
  /****                                                                 ****/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   177
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   178
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   179
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   180
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   181
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   182
#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   183
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   184
  static FT_Error
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   185
  tt_size_select( FT_Size   size,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   186
                  FT_ULong  strike_index )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   187
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   188
    TT_Face   ttface = (TT_Face)size->face;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   189
    TT_Size   ttsize = (TT_Size)size;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   190
    FT_Error  error  = TT_Err_Ok;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   191
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   192
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   193
    ttsize->strike_index = strike_index;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   194
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   195
    if ( FT_IS_SCALABLE( size->face ) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   196
    {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   197
      /* use the scaled metrics, even when tt_size_reset fails */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   198
      FT_Select_Metrics( size->face, strike_index );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   199
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   200
      tt_size_reset( ttsize );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   201
    }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   202
    else
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   203
    {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   204
      SFNT_Service      sfnt    = (SFNT_Service) ttface->sfnt;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   205
      FT_Size_Metrics*  metrics = &size->metrics;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   206
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   207
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   208
      error = sfnt->load_strike_metrics( ttface, strike_index, metrics );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   209
      if ( error )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   210
        ttsize->strike_index = 0xFFFFFFFFUL;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   211
    }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   212
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   213
    return error;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   214
  }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   215
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   216
#endif /* TT_CONFIG_OPTION_EMBEDDED_BITMAPS */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   217
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   218
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   219
  static FT_Error
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   220
  tt_size_request( FT_Size          size,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   221
                   FT_Size_Request  req )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   222
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   223
    TT_Size   ttsize = (TT_Size)size;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   224
    FT_Error  error  = TT_Err_Ok;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   225
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   226
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   227
#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   228
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   229
    if ( FT_HAS_FIXED_SIZES( size->face ) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   230
    {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   231
      TT_Face       ttface = (TT_Face)size->face;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   232
      SFNT_Service  sfnt   = (SFNT_Service) ttface->sfnt;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   233
      FT_ULong      strike_index;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   234
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   235
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   236
      error = sfnt->set_sbit_strike( ttface, req, &strike_index );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   237
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   238
      if ( error )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   239
        ttsize->strike_index = 0xFFFFFFFFUL;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   240
      else
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   241
        return tt_size_select( size, strike_index );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   242
    }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   243
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   244
#endif /* TT_CONFIG_OPTION_EMBEDDED_BITMAPS */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   245
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   246
    FT_Request_Metrics( size->face, req );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   247
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   248
    if ( FT_IS_SCALABLE( size->face ) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   249
      error = tt_size_reset( ttsize );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   250
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   251
    return error;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   252
  }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   253
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   254
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   255
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   256
  /*                                                                       */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   257
  /* <Function>                                                            */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   258
  /*    Load_Glyph                                                         */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   259
  /*                                                                       */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   260
  /* <Description>                                                         */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   261
  /*    A driver method used to load a glyph within a given glyph slot.    */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   262
  /*                                                                       */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   263
  /* <Input>                                                               */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   264
  /*    slot        :: A handle to the target slot object where the glyph  */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   265
  /*                   will be loaded.                                     */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   266
  /*                                                                       */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   267
  /*    size        :: A handle to the source face size at which the glyph */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   268
  /*                   must be scaled, loaded, etc.                        */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   269
  /*                                                                       */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   270
  /*    glyph_index :: The index of the glyph in the font file.            */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   271
  /*                                                                       */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   272
  /*    load_flags  :: A flag indicating what to load for this glyph.  The */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   273
  /*                   FT_LOAD_XXX constants can be used to control the    */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   274
  /*                   glyph loading process (e.g., whether the outline    */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   275
  /*                   should be scaled, whether to load bitmaps or not,   */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   276
  /*                   whether to hint the outline, etc).                  */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   277
  /*                                                                       */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   278
  /* <Return>                                                              */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   279
  /*    FreeType error code.  0 means success.                             */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   280
  /*                                                                       */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   281
  static FT_Error
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   282
  Load_Glyph( FT_GlyphSlot  ttslot,         /* TT_GlyphSlot */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   283
              FT_Size       ttsize,         /* TT_Size      */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   284
              FT_UInt       glyph_index,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   285
              FT_Int32      load_flags )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   286
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   287
    TT_GlyphSlot  slot = (TT_GlyphSlot)ttslot;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   288
    TT_Size       size = (TT_Size)ttsize;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   289
    FT_Face       face = ttslot->face;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   290
    FT_Error      error;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   291
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   292
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   293
    if ( !slot )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   294
      return TT_Err_Invalid_Slot_Handle;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   295
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   296
    if ( !size )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   297
      return TT_Err_Invalid_Size_Handle;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   298
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   299
    if ( !face )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   300
      return TT_Err_Invalid_Argument;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   301
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   302
#ifdef FT_CONFIG_OPTION_INCREMENTAL
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   303
    if ( glyph_index >= (FT_UInt)face->num_glyphs &&
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   304
         !face->internal->incremental_interface   )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   305
#else
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   306
    if ( glyph_index >= (FT_UInt)face->num_glyphs )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   307
#endif
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   308
      return TT_Err_Invalid_Argument;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   309
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   310
    if ( load_flags & FT_LOAD_NO_HINTING )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   311
    {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   312
      /* both FT_LOAD_NO_HINTING and FT_LOAD_NO_AUTOHINT   */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   313
      /* are necessary to disable hinting for tricky fonts */          
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   314
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   315
      if ( FT_IS_TRICKY( face ) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   316
        load_flags &= ~FT_LOAD_NO_HINTING;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   317
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   318
      if ( load_flags & FT_LOAD_NO_AUTOHINT )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   319
        load_flags |= FT_LOAD_NO_HINTING;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   320
    }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   321
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   322
    if ( load_flags & ( FT_LOAD_NO_RECURSE | FT_LOAD_NO_SCALE ) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   323
    {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   324
      load_flags |= FT_LOAD_NO_BITMAP | FT_LOAD_NO_SCALE;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   325
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   326
      if ( !FT_IS_TRICKY( face ) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   327
        load_flags |= FT_LOAD_NO_HINTING;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   328
    }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   329
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   330
    /* now load the glyph outline if necessary */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   331
    error = TT_Load_Glyph( size, slot, glyph_index, load_flags );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   332
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   333
    /* force drop-out mode to 2 - irrelevant now */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   334
    /* slot->outline.dropout_mode = 2; */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   335
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   336
    return error;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   337
  }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   338
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   339
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   340
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   341
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   342
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   343
  /****                                                                 ****/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   344
  /****                                                                 ****/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   345
  /****                D R I V E R  I N T E R F A C E                   ****/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   346
  /****                                                                 ****/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   347
  /****                                                                 ****/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   348
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   349
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   350
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   351
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   352
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   353
  FT_DEFINE_SERVICE_MULTIMASTERSREC(tt_service_gx_multi_masters,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   354
    (FT_Get_MM_Func)        NULL,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   355
    (FT_Set_MM_Design_Func) NULL,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   356
    (FT_Set_MM_Blend_Func)  TT_Set_MM_Blend,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   357
    (FT_Get_MM_Var_Func)    TT_Get_MM_Var,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   358
    (FT_Set_Var_Design_Func)TT_Set_Var_Design
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   359
  )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   360
#endif
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   361
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   362
  static const FT_Service_TrueTypeEngineRec  tt_service_truetype_engine =
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   363
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   364
#ifdef TT_USE_BYTECODE_INTERPRETER
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   365
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   366
#ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   367
    FT_TRUETYPE_ENGINE_TYPE_UNPATENTED
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   368
#else
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   369
    FT_TRUETYPE_ENGINE_TYPE_PATENTED
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   370
#endif
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   371
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   372
#else /* !TT_USE_BYTECODE_INTERPRETER */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   373
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   374
    FT_TRUETYPE_ENGINE_TYPE_NONE
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   375
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   376
#endif /* TT_USE_BYTECODE_INTERPRETER */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   377
  };
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   378
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   379
  FT_DEFINE_SERVICE_TTGLYFREC(tt_service_truetype_glyf,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   380
    (TT_Glyf_GetLocationFunc)tt_face_get_location
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   381
  )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   382
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   383
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   384
  FT_DEFINE_SERVICEDESCREC4(tt_services,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   385
    FT_SERVICE_ID_XF86_NAME,       FT_XF86_FORMAT_TRUETYPE,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   386
    FT_SERVICE_ID_MULTI_MASTERS,   &FT_TT_SERVICE_GX_MULTI_MASTERS_GET,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   387
    FT_SERVICE_ID_TRUETYPE_ENGINE, &tt_service_truetype_engine,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   388
    FT_SERVICE_ID_TT_GLYF,         &FT_TT_SERVICE_TRUETYPE_GLYF_GET
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   389
  )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   390
#else
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   391
  FT_DEFINE_SERVICEDESCREC3(tt_services,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   392
    FT_SERVICE_ID_XF86_NAME,       FT_XF86_FORMAT_TRUETYPE,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   393
    FT_SERVICE_ID_TRUETYPE_ENGINE, &tt_service_truetype_engine,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   394
    FT_SERVICE_ID_TT_GLYF,         &FT_TT_SERVICE_TRUETYPE_GLYF_GET
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   395
  )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   396
#endif
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   397
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   398
  FT_CALLBACK_DEF( FT_Module_Interface )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   399
  tt_get_interface( FT_Module    driver,    /* TT_Driver */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   400
                    const char*  tt_interface )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   401
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   402
    FT_Module_Interface  result;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   403
    FT_Module            sfntd;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   404
    SFNT_Service         sfnt;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   405
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   406
    result = ft_service_list_lookup( FT_TT_SERVICES_GET, tt_interface );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   407
    if ( result != NULL )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   408
      return result;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   409
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   410
    if ( !driver )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   411
      return NULL;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   412
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   413
    /* only return the default interface from the SFNT module */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   414
    sfntd = FT_Get_Module( driver->library, "sfnt" );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   415
    if ( sfntd )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   416
    {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   417
      sfnt = (SFNT_Service)( sfntd->clazz->module_interface );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   418
      if ( sfnt )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   419
        return sfnt->get_interface( driver, tt_interface );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   420
    }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   421
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   422
    return 0;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   423
  }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   424
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   425
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   426
  /* The FT_DriverInterface structure is defined in ftdriver.h. */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   427
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   428
#ifdef TT_USE_BYTECODE_INTERPRETER
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   429
#define TT_HINTER_FLAG   FT_MODULE_DRIVER_HAS_HINTER
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   430
#else
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   431
#define TT_HINTER_FLAG   0
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   432
#endif
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   433
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   434
#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   435
#define TT_SIZE_SELECT    tt_size_select
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   436
#else
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   437
#define TT_SIZE_SELECT    0
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   438
#endif
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   439
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   440
  FT_DEFINE_DRIVER(tt_driver_class,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   441
  
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   442
    
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   443
      FT_MODULE_FONT_DRIVER        |
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   444
      FT_MODULE_DRIVER_SCALABLE    |
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   445
      TT_HINTER_FLAG,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   446
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   447
      sizeof ( TT_DriverRec ),
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   448
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   449
      "truetype",      /* driver name                           */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   450
      0x10000L,        /* driver version == 1.0                 */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   451
      0x20000L,        /* driver requires FreeType 2.0 or above */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   452
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   453
      (void*)0,        /* driver specific interface */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   454
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   455
      tt_driver_init,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   456
      tt_driver_done,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   457
      tt_get_interface,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   458
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   459
    sizeof ( TT_FaceRec ),
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   460
    sizeof ( TT_SizeRec ),
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   461
    sizeof ( FT_GlyphSlotRec ),
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   462
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   463
    tt_face_init,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   464
    tt_face_done,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   465
    tt_size_init,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   466
    tt_size_done,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   467
    tt_slot_init,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   468
    0,                      /* FT_Slot_DoneFunc */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   469
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   470
    ft_stub_set_char_sizes, /* FT_CONFIG_OPTION_OLD_INTERNALS */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   471
    ft_stub_set_pixel_sizes, /* FT_CONFIG_OPTION_OLD_INTERNALS */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   472
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   473
    Load_Glyph,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   474
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   475
    tt_get_kerning,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   476
    0,                      /* FT_Face_AttachFunc      */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   477
    tt_get_advances,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   478
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   479
    tt_size_request,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   480
    TT_SIZE_SELECT
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   481
  )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   482
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   483
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   484
/* END */