misc/libfreetype/src/cff/cffdrivr.c
author Stepan777 <stepik-777@mail.ru>
Thu, 09 Aug 2012 01:24:38 +0400
changeset 7528 f8cf277dca36
parent 5172 88f2e05288ba
permissions -rw-r--r--
FindFFMPEG.cmake (used only for frontend for now). +fix for linux (older version of Qt)
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
/*  cffdrivr.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
/*    OpenType 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-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,   */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     8
/*            2010 by                                                      */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     9
/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    10
/*                                                                         */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    11
/*  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
    12
/*  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
    13
/*  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
    14
/*  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
    15
/*  understand and accept it fully.                                        */
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    20
#include <ft2build.h>
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    21
#include FT_FREETYPE_H
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    22
#include FT_INTERNAL_DEBUG_H
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    23
#include FT_INTERNAL_STREAM_H
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    24
#include FT_INTERNAL_SFNT_H
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    25
#include FT_SERVICE_CID_H
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    26
#include FT_SERVICE_POSTSCRIPT_INFO_H
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    27
#include FT_SERVICE_POSTSCRIPT_NAME_H
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    28
#include FT_SERVICE_TT_CMAP_H
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 "cffdrivr.h"
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    31
#include "cffgload.h"
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    32
#include "cffload.h"
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    33
#include "cffcmap.h"
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    34
#include "cffparse.h"
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    35
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    36
#include "cfferrs.h"
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    37
#include "cffpic.h"
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    38
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    39
#include FT_SERVICE_XFREE86_NAME_H
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    40
#include FT_SERVICE_GLYPH_DICT_H
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
  /*                                                                       */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    45
  /* 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
    46
  /* 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
    47
  /* messages during execution.                                            */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    48
  /*                                                                       */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    49
#undef  FT_COMPONENT
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    50
#define FT_COMPONENT  trace_cffdriver
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
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
  /****                          F A C E S                              ****/
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
  /****                                                                 ****/
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
#undef  PAIR_TAG
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    67
#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
    68
                                     (FT_ULong)right        )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    69
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    70
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
  /* <Function>                                                            */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    74
  /*    cff_get_kerning                                                    */
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
  /* <Description>                                                         */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    77
  /*    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
    78
  /*    glyphs of the same face.                                           */
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
  /* <Input>                                                               */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    81
  /*    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
    82
  /*                                                                       */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    83
  /*    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
    84
  /*                                                                       */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    85
  /*    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
    86
  /*                                                                       */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    87
  /* <Output>                                                              */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    88
  /*    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
    89
  /*                   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
    90
  /*                   formats.                                            */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    91
  /*                                                                       */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    92
  /* <Return>                                                              */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    93
  /*    FreeType error code.  0 means success.                             */
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
  /* <Note>                                                                */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    96
  /*    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
    97
  /*    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
    98
  /*    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
    99
  /*    interface is meant to be simple).                                  */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   100
  /*                                                                       */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   101
  /*    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
   102
  /*                                                                       */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   103
  FT_CALLBACK_DEF( FT_Error )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   104
  cff_get_kerning( FT_Face     ttface,          /* TT_Face */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   105
                   FT_UInt     left_glyph,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   106
                   FT_UInt     right_glyph,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   107
                   FT_Vector*  kerning )
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
    TT_Face       face = (TT_Face)ttface;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   110
    SFNT_Service  sfnt = (SFNT_Service)face->sfnt;
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
    kerning->x = 0;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   114
    kerning->y = 0;
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
    if ( sfnt )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   117
      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
   118
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   119
    return CFF_Err_Ok;
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
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
#undef PAIR_TAG
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
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
  /* <Function>                                                            */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   129
  /*    Load_Glyph                                                         */
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
  /* <Description>                                                         */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   132
  /*    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
   133
  /*                                                                       */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   134
  /* <Input>                                                               */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   135
  /*    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
   136
  /*                   will be loaded.                                     */
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
  /*    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
   139
  /*                   must be scaled, loaded, etc.                        */
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
  /*    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
   142
  /*                                                                       */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   143
  /*    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
   144
  /*                   FT_LOAD_??? constants can be used to control the    */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   145
  /*                   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
   146
  /*                   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
   147
  /*                   whether to hint the outline, etc).                  */
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
  /* <Return>                                                              */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   150
  /*    FreeType error code.  0 means success.                             */
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
  FT_CALLBACK_DEF( FT_Error )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   153
  Load_Glyph( FT_GlyphSlot  cffslot,        /* CFF_GlyphSlot */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   154
              FT_Size       cffsize,        /* CFF_Size      */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   155
              FT_UInt       glyph_index,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   156
              FT_Int32      load_flags )
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_Error       error;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   159
    CFF_GlyphSlot  slot = (CFF_GlyphSlot)cffslot;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   160
    CFF_Size       size = (CFF_Size)cffsize;
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
    if ( !slot )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   164
      return CFF_Err_Invalid_Slot_Handle;
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
    /* check whether we want a scaled outline or bitmap */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   167
    if ( !size )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   168
      load_flags |= FT_LOAD_NO_SCALE | FT_LOAD_NO_HINTING;
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
    /* reset the size object if necessary */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   171
    if ( load_flags & FT_LOAD_NO_SCALE )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   172
      size = NULL;
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
    if ( size )
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
      /* these two objects must have the same parent */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   177
      if ( cffsize->face != cffslot->face )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   178
        return CFF_Err_Invalid_Face_Handle;
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
    /* now load the glyph outline if necessary */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   182
    error = cff_slot_load( slot, size, glyph_index, load_flags );
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
    /* 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
   185
    /* slot->outline.dropout_mode = 2; */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   186
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   187
    return error;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   188
  }
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
  FT_CALLBACK_DEF( FT_Error )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   192
  cff_get_advances( FT_Face    face,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   193
                    FT_UInt    start,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   194
                    FT_UInt    count,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   195
                    FT_Int32   flags,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   196
                    FT_Fixed*  advances )
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_UInt       nn;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   199
    FT_Error      error = CFF_Err_Ok;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   200
    FT_GlyphSlot  slot  = face->glyph;
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   203
    flags |= (FT_UInt32)FT_LOAD_ADVANCE_ONLY;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   204
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   205
    for ( nn = 0; nn < count; nn++ )
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
      error = Load_Glyph( slot, face->size, start + nn, flags );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   208
      if ( error )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   209
        break;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   210
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   211
      advances[nn] = ( flags & FT_LOAD_VERTICAL_LAYOUT )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   212
                     ? slot->linearVertAdvance
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   213
                     : slot->linearHoriAdvance;
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
    return error;
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   220
  /*
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   221
   *  GLYPH DICT SERVICE
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   225
  static FT_Error
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   226
  cff_get_glyph_name( CFF_Face    face,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   227
                      FT_UInt     glyph_index,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   228
                      FT_Pointer  buffer,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   229
                      FT_UInt     buffer_max )
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
    CFF_Font    font   = (CFF_Font)face->extra.data;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   232
    FT_String*  gname;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   233
    FT_UShort   sid;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   234
    FT_Error    error;
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   237
    if ( !font->psnames )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   238
    {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   239
      FT_ERROR(( "cff_get_glyph_name:"
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   240
                 " cannot get glyph name from CFF & CEF fonts\n"
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
                 " without the `PSNames' module\n" ));
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   243
      error = CFF_Err_Unknown_File_Format;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   244
      goto Exit;
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   247
    /* first, locate the sid in the charset table */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   248
    sid = font->charset.sids[glyph_index];
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
    /* now, lookup the name itself */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   251
    gname = cff_index_get_sid_string( font, sid );
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
    if ( gname )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   254
      FT_STRCPYN( buffer, gname, buffer_max );
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
    error = CFF_Err_Ok;
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
  Exit:
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   259
    return error;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   260
  }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   261
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
  static FT_UInt
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   264
  cff_get_name_index( CFF_Face    face,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   265
                      FT_String*  glyph_name )
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
    CFF_Font            cff;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   268
    CFF_Charset         charset;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   269
    FT_Service_PsCMaps  psnames;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   270
    FT_String*          name;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   271
    FT_UShort           sid;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   272
    FT_UInt             i;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   273
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
    cff     = (CFF_FontRec *)face->extra.data;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   276
    charset = &cff->charset;
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
    FT_FACE_FIND_GLOBAL_SERVICE( face, psnames, POSTSCRIPT_CMAPS );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   279
    if ( !psnames )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   280
      return 0;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   281
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   282
    for ( i = 0; i < cff->num_glyphs; i++ )
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
      sid = charset->sids[i];
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   285
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   286
      if ( sid > 390 )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   287
        name = cff_index_get_string( cff, sid - 391 );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   288
      else
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   289
        name = (FT_String *)psnames->adobe_std_strings( sid );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   290
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   291
      if ( !name )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   292
        continue;
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
      if ( !ft_strcmp( glyph_name, name ) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   295
        return i;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   296
    }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   297
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   298
    return 0;
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   302
  FT_DEFINE_SERVICE_GLYPHDICTREC(cff_service_glyph_dict,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   303
    (FT_GlyphDict_GetNameFunc)  cff_get_glyph_name,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   304
    (FT_GlyphDict_NameIndexFunc)cff_get_name_index
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   305
  )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   306
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   307
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   308
  /*
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   309
   *  POSTSCRIPT INFO SERVICE
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   310
   *
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   313
  static FT_Int
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   314
  cff_ps_has_glyph_names( FT_Face  face )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   315
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   316
    return ( face->face_flags & FT_FACE_FLAG_GLYPH_NAMES ) > 0;
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   319
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   320
  static FT_Error
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   321
  cff_ps_get_font_info( CFF_Face         face,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   322
                        PS_FontInfoRec*  afont_info )
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
    CFF_Font  cff   = (CFF_Font)face->extra.data;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   325
    FT_Error  error = CFF_Err_Ok;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   326
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   327
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   328
    if ( cff && cff->font_info == NULL )
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
      CFF_FontRecDict  dict   = &cff->top_font.font_dict;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   331
      PS_FontInfoRec  *font_info;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   332
      FT_Memory        memory = face->root.memory;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   333
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   334
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   335
      if ( FT_ALLOC( font_info, sizeof ( *font_info ) ) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   336
        goto Fail;
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
      font_info->version     = cff_index_get_sid_string( cff,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   339
                                                         dict->version );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   340
      font_info->notice      = cff_index_get_sid_string( cff,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   341
                                                         dict->notice );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   342
      font_info->full_name   = cff_index_get_sid_string( cff,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   343
                                                         dict->full_name );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   344
      font_info->family_name = cff_index_get_sid_string( cff,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   345
                                                         dict->family_name );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   346
      font_info->weight      = cff_index_get_sid_string( cff,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   347
                                                         dict->weight );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   348
      font_info->italic_angle        = dict->italic_angle;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   349
      font_info->is_fixed_pitch      = dict->is_fixed_pitch;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   350
      font_info->underline_position  = (FT_Short)dict->underline_position;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   351
      font_info->underline_thickness = (FT_Short)dict->underline_thickness;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   352
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   353
      cff->font_info = font_info;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   354
    }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   355
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   356
    if ( cff )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   357
      *afont_info = *cff->font_info;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   358
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   359
  Fail:
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   360
    return error;
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
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
  FT_DEFINE_SERVICE_PSINFOREC(cff_service_ps_info,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   365
    (PS_GetFontInfoFunc)   cff_ps_get_font_info,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   366
    (PS_GetFontExtraFunc)  NULL,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   367
    (PS_HasGlyphNamesFunc) cff_ps_has_glyph_names,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   368
    (PS_GetFontPrivateFunc)NULL         /* unsupported with CFF fonts */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   369
  )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   370
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
  /*
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   373
   *  POSTSCRIPT NAME SERVICE
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   374
   *
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   377
  static const char*
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   378
  cff_get_ps_name( CFF_Face  face )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   379
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   380
    CFF_Font  cff = (CFF_Font)face->extra.data;
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
    return (const char*)cff->font_name;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   384
  }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   385
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   386
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   387
  FT_DEFINE_SERVICE_PSFONTNAMEREC(cff_service_ps_name,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   388
    (FT_PsName_GetFunc)cff_get_ps_name
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   391
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   392
  /*
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   393
   * TT CMAP INFO
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   394
   *
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   395
   * If the charmap is a synthetic Unicode encoding cmap or
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   396
   * a Type 1 standard (or expert) encoding cmap, hide TT CMAP INFO
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   397
   * service defined in SFNT module.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   398
   *
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   399
   * Otherwise call the service function in the sfnt module.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   400
   *
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
  static FT_Error
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   403
  cff_get_cmap_info( FT_CharMap    charmap,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   404
                     TT_CMapInfo  *cmap_info )
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
    FT_CMap   cmap  = FT_CMAP( charmap );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   407
    FT_Error  error = CFF_Err_Ok;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   408
    FT_Face    face    = FT_CMAP_FACE( cmap );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   409
    FT_Library library = FT_FACE_LIBRARY( face );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   410
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   411
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   412
    cmap_info->language = 0;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   413
    cmap_info->format   = 0;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   414
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   415
    if ( cmap->clazz != &FT_CFF_CMAP_ENCODING_CLASS_REC_GET &&
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   416
         cmap->clazz != &FT_CFF_CMAP_UNICODE_CLASS_REC_GET  )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   417
    {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   418
      FT_Module           sfnt    = FT_Get_Module( library, "sfnt" );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   419
      FT_Service_TTCMaps  service =
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   420
        (FT_Service_TTCMaps)ft_module_get_service( sfnt,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   421
                                                   FT_SERVICE_ID_TT_CMAP );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   422
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
      if ( service && service->get_cmap_info )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   425
        error = service->get_cmap_info( charmap, cmap_info );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   426
    }
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
    return error;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   429
  }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   430
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   431
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   432
  FT_DEFINE_SERVICE_TTCMAPSREC(cff_service_get_cmap_info,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   433
    (TT_CMap_Info_GetFunc)cff_get_cmap_info
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   434
  )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   435
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   436
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   437
  /*
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   438
   *  CID INFO SERVICE
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
   */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   441
  static FT_Error
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   442
  cff_get_ros( CFF_Face      face,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   443
               const char*  *registry,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   444
               const char*  *ordering,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   445
               FT_Int       *supplement )
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
    FT_Error  error = CFF_Err_Ok;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   448
    CFF_Font  cff   = (CFF_Font)face->extra.data;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   449
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   450
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   451
    if ( cff )
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
      CFF_FontRecDict  dict = &cff->top_font.font_dict;
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   456
      if ( dict->cid_registry == 0xFFFFU )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   457
      {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   458
        error = CFF_Err_Invalid_Argument;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   459
        goto Fail;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   460
      }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   461
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   462
      if ( registry )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   463
      {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   464
        if ( cff->registry == NULL )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   465
          cff->registry = cff_index_get_sid_string( cff,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   466
                                                    dict->cid_registry );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   467
        *registry = cff->registry;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   468
      }
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
      if ( ordering )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   471
      {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   472
        if ( cff->ordering == NULL )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   473
          cff->ordering = cff_index_get_sid_string( cff,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   474
                                                    dict->cid_ordering );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   475
        *ordering = cff->ordering;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   476
      }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   477
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
       * XXX: According to Adobe TechNote #5176, the supplement in CFF
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   480
       *      can be a real number. We truncate it to fit public API
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   481
       *      since freetype-2.3.6.
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
      if ( supplement )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   484
      {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   485
        if ( dict->cid_supplement < FT_INT_MIN ||
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   486
             dict->cid_supplement > FT_INT_MAX )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   487
          FT_TRACE1(( "cff_get_ros: too large supplement %d is truncated\n",
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   488
                      dict->cid_supplement ));
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   489
        *supplement = (FT_Int)dict->cid_supplement;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   490
      }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   491
    }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   492
      
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   493
  Fail:
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   494
    return error;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   495
  }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   496
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   497
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   498
  static FT_Error
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   499
  cff_get_is_cid( CFF_Face  face,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   500
                  FT_Bool  *is_cid )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   501
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   502
    FT_Error  error = CFF_Err_Ok;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   503
    CFF_Font  cff   = (CFF_Font)face->extra.data;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   504
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   505
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   506
    *is_cid = 0;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   507
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   508
    if ( cff )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   509
    {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   510
      CFF_FontRecDict  dict = &cff->top_font.font_dict;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   511
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   512
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   513
      if ( dict->cid_registry != 0xFFFFU )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   514
        *is_cid = 1;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   515
    }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   516
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   517
    return error;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   518
  }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   519
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   520
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   521
  static FT_Error
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   522
  cff_get_cid_from_glyph_index( CFF_Face  face,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   523
                                FT_UInt   glyph_index,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   524
                                FT_UInt  *cid )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   525
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   526
    FT_Error  error = CFF_Err_Ok;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   527
    CFF_Font  cff;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   528
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   529
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   530
    cff = (CFF_Font)face->extra.data;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   531
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   532
    if ( cff )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   533
    {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   534
      FT_UInt          c;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   535
      CFF_FontRecDict  dict = &cff->top_font.font_dict;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   536
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   537
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   538
      if ( dict->cid_registry == 0xFFFFU )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   539
      {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   540
        error = CFF_Err_Invalid_Argument;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   541
        goto Fail;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   542
      }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   543
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   544
      if ( glyph_index > cff->num_glyphs )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   545
      {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   546
        error = CFF_Err_Invalid_Argument;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   547
        goto Fail;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   548
      }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   549
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   550
      c = cff->charset.sids[glyph_index];
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   551
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   552
      if ( cid )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   553
        *cid = c;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   554
    }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   555
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   556
  Fail:
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   557
    return error;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   558
  }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   559
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   560
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   561
  FT_DEFINE_SERVICE_CIDREC(cff_service_cid_info,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   562
    (FT_CID_GetRegistryOrderingSupplementFunc)cff_get_ros,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   563
    (FT_CID_GetIsInternallyCIDKeyedFunc)      cff_get_is_cid,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   564
    (FT_CID_GetCIDFromGlyphIndexFunc)         cff_get_cid_from_glyph_index
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   565
  )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   566
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   567
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   568
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   569
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   570
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   571
  /****                                                                 ****/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   572
  /****                                                                 ****/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   573
  /****                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
   574
  /****                                                                 ****/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   575
  /****                                                                 ****/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   576
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   577
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   578
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   579
#ifndef FT_CONFIG_OPTION_NO_GLYPH_NAMES
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   580
  FT_DEFINE_SERVICEDESCREC6(cff_services,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   581
    FT_SERVICE_ID_XF86_NAME,            FT_XF86_FORMAT_CFF,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   582
    FT_SERVICE_ID_POSTSCRIPT_INFO,      &FT_CFF_SERVICE_PS_INFO_GET,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   583
    FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &FT_CFF_SERVICE_PS_NAME_GET,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   584
    FT_SERVICE_ID_GLYPH_DICT,           &FT_CFF_SERVICE_GLYPH_DICT_GET,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   585
    FT_SERVICE_ID_TT_CMAP,              &FT_CFF_SERVICE_GET_CMAP_INFO_GET,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   586
    FT_SERVICE_ID_CID,                  &FT_CFF_SERVICE_CID_INFO_GET
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   587
  )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   588
#else
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   589
  FT_DEFINE_SERVICEDESCREC5(cff_services,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   590
    FT_SERVICE_ID_XF86_NAME,            FT_XF86_FORMAT_CFF,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   591
    FT_SERVICE_ID_POSTSCRIPT_INFO,      &FT_CFF_SERVICE_PS_INFO_GET,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   592
    FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &FT_CFF_SERVICE_PS_NAME_GET,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   593
    FT_SERVICE_ID_TT_CMAP,              &FT_CFF_SERVICE_GET_CMAP_INFO_GET,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   594
    FT_SERVICE_ID_CID,                  &FT_CFF_SERVICE_CID_INFO_GET
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   595
  )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   596
#endif
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   597
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   598
  FT_CALLBACK_DEF( FT_Module_Interface )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   599
  cff_get_interface( FT_Module    driver,       /* CFF_Driver */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   600
                     const char*  module_interface )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   601
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   602
    FT_Module            sfnt;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   603
    FT_Module_Interface  result;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   604
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   605
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   606
    result = ft_service_list_lookup( FT_CFF_SERVICES_GET, module_interface );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   607
    if ( result != NULL )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   608
      return  result;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   609
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   610
    if ( !driver )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   611
      return NULL;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   612
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   613
    /* we pass our request to the `sfnt' module */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   614
    sfnt = FT_Get_Module( driver->library, "sfnt" );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   615
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   616
    return sfnt ? sfnt->clazz->get_interface( sfnt, module_interface ) : 0;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   617
  }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   618
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   619
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   620
  /* 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
   621
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   622
#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   623
#define CFF_SIZE_SELECT cff_size_select
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   624
#else
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   625
#define CFF_SIZE_SELECT 0
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   626
#endif
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   627
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   628
  FT_DEFINE_DRIVER(cff_driver_class,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   629
      FT_MODULE_FONT_DRIVER       |
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   630
      FT_MODULE_DRIVER_SCALABLE   |
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   631
      FT_MODULE_DRIVER_HAS_HINTER,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   632
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   633
      sizeof( CFF_DriverRec ),
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   634
      "cff",
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   635
      0x10000L,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   636
      0x20000L,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   637
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   638
      0,   /* module-specific interface */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   639
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   640
      cff_driver_init,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   641
      cff_driver_done,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   642
      cff_get_interface,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   643
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   644
    /* now the specific driver fields */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   645
    sizeof( TT_FaceRec ),
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   646
    sizeof( CFF_SizeRec ),
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   647
    sizeof( CFF_GlyphSlotRec ),
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   648
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   649
    cff_face_init,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   650
    cff_face_done,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   651
    cff_size_init,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   652
    cff_size_done,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   653
    cff_slot_init,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   654
    cff_slot_done,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   655
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   656
    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
   657
    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
   658
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   659
    Load_Glyph,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   660
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   661
    cff_get_kerning,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   662
    0,                      /* FT_Face_AttachFunc      */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   663
    cff_get_advances,       /* FT_Face_GetAdvancesFunc */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   664
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   665
    cff_size_request,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   666
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   667
    CFF_SIZE_SELECT
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   668
  )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   669
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   670
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   671
/* END */