misc/libfreetype/src/type1/t1driver.c
author sheepluva
Wed, 05 Jun 2013 16:28:30 +0200
changeset 9137 d987230b85ed
parent 5172 88f2e05288ba
permissions -rw-r--r--
fixed all engine compilation hints and notes (that I could see)
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
/*  t1driver.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
/*    Type 1 driver interface (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-2001, 2002, 2003, 2004, 2006, 2007, 2009 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 "t1driver.h"
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    21
#include "t1gload.h"
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    22
#include "t1load.h"
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    23
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    24
#include "t1errors.h"
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    25
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    26
#ifndef T1_CONFIG_OPTION_NO_AFM
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    27
#include "t1afm.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_INTERNAL_DEBUG_H
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    31
#include FT_INTERNAL_STREAM_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 FT_SERVICE_MULTIPLE_MASTERS_H
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    34
#include FT_SERVICE_GLYPH_DICT_H
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    35
#include FT_SERVICE_XFREE86_NAME_H
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    36
#include FT_SERVICE_POSTSCRIPT_NAME_H
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    37
#include FT_SERVICE_POSTSCRIPT_CMAPS_H
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    38
#include FT_SERVICE_POSTSCRIPT_INFO_H
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    39
#include FT_SERVICE_KERNING_H
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
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
  /*                                                                       */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    44
  /* 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
    45
  /* 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
    46
  /* messages during execution.                                            */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    47
  /*                                                                       */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    48
#undef  FT_COMPONENT
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    49
#define FT_COMPONENT  trace_t1driver
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
 /*
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    52
  *  GLYPH DICT SERVICE
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
  static FT_Error
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    57
  t1_get_glyph_name( T1_Face     face,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    58
                     FT_UInt     glyph_index,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    59
                     FT_Pointer  buffer,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    60
                     FT_UInt     buffer_max )
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
    FT_STRCPYN( buffer, face->type1.glyph_names[glyph_index], buffer_max );
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
    return T1_Err_Ok;
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
  static FT_UInt
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    69
  t1_get_name_index( T1_Face     face,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    70
                     FT_String*  glyph_name )
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
    FT_Int      i;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    73
    FT_String*  gname;
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    76
    for ( i = 0; i < face->type1.num_glyphs; i++ )
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
      gname = face->type1.glyph_names[i];
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    79
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    80
      if ( !ft_strcmp( glyph_name, gname ) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    81
        return (FT_UInt)i;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    82
    }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    83
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    84
    return 0;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    85
  }
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    88
  static const FT_Service_GlyphDictRec  t1_service_glyph_dict =
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    89
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    90
    (FT_GlyphDict_GetNameFunc)  t1_get_glyph_name,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    91
    (FT_GlyphDict_NameIndexFunc)t1_get_name_index
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    92
  };
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    95
  /*
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    96
   *  POSTSCRIPT NAME SERVICE
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    97
   *
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    98
   */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    99
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   100
  static const char*
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   101
  t1_get_ps_name( T1_Face  face )
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
    return (const char*) face->type1.font_name;
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   106
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   107
  static const FT_Service_PsFontNameRec  t1_service_ps_name =
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   108
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   109
    (FT_PsName_GetFunc)t1_get_ps_name
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   112
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
   *  MULTIPLE MASTERS SERVICE
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   115
   *
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   116
   */
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
#ifndef T1_CONFIG_OPTION_NO_MM_SUPPORT
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   119
  static const FT_Service_MultiMastersRec  t1_service_multi_masters =
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
    (FT_Get_MM_Func)        T1_Get_Multi_Master,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   122
    (FT_Set_MM_Design_Func) T1_Set_MM_Design,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   123
    (FT_Set_MM_Blend_Func)  T1_Set_MM_Blend,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   124
    (FT_Get_MM_Var_Func)    T1_Get_MM_Var,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   125
    (FT_Set_Var_Design_Func)T1_Set_Var_Design
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
#endif
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   128
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   129
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   130
  /*
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   131
   *  POSTSCRIPT INFO SERVICE
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   132
   *
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   133
   */
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
  static FT_Error
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   136
  t1_ps_get_font_info( FT_Face          face,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   137
                       PS_FontInfoRec*  afont_info )
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
    *afont_info = ((T1_Face)face)->type1.font_info;
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
    return T1_Err_Ok;
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
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
  static FT_Error
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   146
  t1_ps_get_font_extra( FT_Face           face,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   147
                        PS_FontExtraRec*  afont_extra )
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
    *afont_extra = ((T1_Face)face)->type1.font_extra;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   150
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   151
    return T1_Err_Ok;
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
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
  static FT_Int
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   156
  t1_ps_has_glyph_names( FT_Face  face )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   157
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   158
    FT_UNUSED( face );
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
    return 1;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   161
  }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   162
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
  static FT_Error
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   165
  t1_ps_get_font_private( FT_Face         face,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   166
                          PS_PrivateRec*  afont_private )
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
    *afont_private = ((T1_Face)face)->type1.private_dict;
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
    return T1_Err_Ok;
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
  static const FT_Service_PsInfoRec  t1_service_ps_info =
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
    (PS_GetFontInfoFunc)   t1_ps_get_font_info,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   177
    (PS_GetFontExtraFunc)  t1_ps_get_font_extra,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   178
    (PS_HasGlyphNamesFunc) t1_ps_has_glyph_names,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   179
    (PS_GetFontPrivateFunc)t1_ps_get_font_private,
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   183
#ifndef T1_CONFIG_OPTION_NO_AFM
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   184
  static const FT_Service_KerningRec  t1_service_kerning =
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   185
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   186
    T1_Get_Track_Kerning,
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
#endif
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   189
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   190
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
   *  SERVICE LIST
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   193
   *
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   196
  static const FT_ServiceDescRec  t1_services[] =
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   197
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   198
    { FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &t1_service_ps_name },
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   199
    { FT_SERVICE_ID_GLYPH_DICT,           &t1_service_glyph_dict },
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   200
    { FT_SERVICE_ID_XF86_NAME,            FT_XF86_FORMAT_TYPE_1 },
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   201
    { FT_SERVICE_ID_POSTSCRIPT_INFO,      &t1_service_ps_info },
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   202
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   203
#ifndef T1_CONFIG_OPTION_NO_AFM
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   204
    { FT_SERVICE_ID_KERNING,              &t1_service_kerning },
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   205
#endif
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
#ifndef T1_CONFIG_OPTION_NO_MM_SUPPORT
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   208
    { FT_SERVICE_ID_MULTI_MASTERS,        &t1_service_multi_masters },
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   209
#endif
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   210
    { NULL, NULL }
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   214
  static FT_Module_Interface
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   215
  Get_Interface( FT_Driver         driver,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   216
                 const FT_String*  t1_interface )
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
    FT_UNUSED( driver );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   219
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   220
    return ft_service_list_lookup( t1_services, t1_interface );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   221
  }
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   224
#ifndef T1_CONFIG_OPTION_NO_AFM
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
  /*                                                                       */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   228
  /* <Function>                                                            */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   229
  /*    Get_Kerning                                                        */
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
  /* <Description>                                                         */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   232
  /*    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
   233
  /*    glyphs of the same face.                                           */
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
  /* <Input>                                                               */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   236
  /*    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
   237
  /*                                                                       */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   238
  /*    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
   239
  /*                                                                       */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   240
  /*    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
   241
  /*                                                                       */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   242
  /* <Output>                                                              */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   243
  /*    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
   244
  /*                   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
   245
  /*                   formats.                                            */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   246
  /*                                                                       */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   247
  /* <Return>                                                              */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   248
  /*    FreeType error code.  0 means success.                             */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   249
  /*                                                                       */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   250
  /* <Note>                                                                */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   251
  /*    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
   252
  /*    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
   253
  /*    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
   254
  /*    interface is meant to be simple).                                  */
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
  /*    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
   257
  /*                                                                       */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   258
  static FT_Error
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   259
  Get_Kerning( T1_Face     face,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   260
               FT_UInt     left_glyph,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   261
               FT_UInt     right_glyph,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   262
               FT_Vector*  kerning )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   263
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   264
    kerning->x = 0;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   265
    kerning->y = 0;
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
    if ( face->afm_data )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   268
      T1_Get_Kerning( (AFM_FontInfo)face->afm_data,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   269
                      left_glyph,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   270
                      right_glyph,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   271
                      kerning );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   272
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   273
    return T1_Err_Ok;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   274
  }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   275
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   276
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   277
#endif /* T1_CONFIG_OPTION_NO_AFM */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   278
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   279
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   280
  FT_CALLBACK_TABLE_DEF
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   281
  const FT_Driver_ClassRec  t1_driver_class =
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   282
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   283
    {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   284
      FT_MODULE_FONT_DRIVER       |
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   285
      FT_MODULE_DRIVER_SCALABLE   |
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   286
      FT_MODULE_DRIVER_HAS_HINTER,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   287
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   288
      sizeof( FT_DriverRec ),
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   289
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   290
      "type1",
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   291
      0x10000L,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   292
      0x20000L,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   293
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   294
      0,   /* format interface */
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
      (FT_Module_Constructor)T1_Driver_Init,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   297
      (FT_Module_Destructor) T1_Driver_Done,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   298
      (FT_Module_Requester)  Get_Interface,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   299
    },
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   300
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   301
    sizeof( T1_FaceRec ),
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   302
    sizeof( T1_SizeRec ),
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   303
    sizeof( T1_GlyphSlotRec ),
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   304
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   305
    (FT_Face_InitFunc)        T1_Face_Init,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   306
    (FT_Face_DoneFunc)        T1_Face_Done,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   307
    (FT_Size_InitFunc)        T1_Size_Init,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   308
    (FT_Size_DoneFunc)        T1_Size_Done,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   309
    (FT_Slot_InitFunc)        T1_GlyphSlot_Init,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   310
    (FT_Slot_DoneFunc)        T1_GlyphSlot_Done,
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
#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   313
    ft_stub_set_char_sizes,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   314
    ft_stub_set_pixel_sizes,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   315
#endif
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   316
    (FT_Slot_LoadFunc)        T1_Load_Glyph,
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
#ifdef T1_CONFIG_OPTION_NO_AFM
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   319
    (FT_Face_GetKerningFunc)  0,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   320
    (FT_Face_AttachFunc)      0,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   321
#else
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   322
    (FT_Face_GetKerningFunc)  Get_Kerning,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   323
    (FT_Face_AttachFunc)      T1_Read_Metrics,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   324
#endif
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   325
    (FT_Face_GetAdvancesFunc) T1_Get_Advances,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   326
    (FT_Size_RequestFunc)     T1_Size_Request,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   327
    (FT_Size_SelectFunc)      0
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   331
/* END */