misc/libfreetype/src/pfr/pfrobjs.c
author koda
Mon, 03 Dec 2012 17:47:39 +0100
changeset 8202 9f0e79ab51f0
parent 5172 88f2e05288ba
permissions -rw-r--r--
GCI2012: Move Video Preferences in Settings Tab
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
/*  pfrobjs.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
/*    FreeType PFR object methods (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 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2010 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 "pfrobjs.h"
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    20
#include "pfrload.h"
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    21
#include "pfrgload.h"
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    22
#include "pfrcmap.h"
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    23
#include "pfrsbit.h"
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    24
#include FT_OUTLINE_H
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    25
#include FT_INTERNAL_DEBUG_H
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    26
#include FT_TRUETYPE_IDS_H 
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    27
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    28
#include "pfrerror.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
#undef  FT_COMPONENT
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    31
#define FT_COMPONENT  trace_pfr
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    34
  /*************************************************************************/
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
  /*****                                                               *****/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    37
  /*****                     FACE OBJECT METHODS                       *****/
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
  /*************************************************************************/
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
  FT_LOCAL_DEF( void )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    43
  pfr_face_done( FT_Face  pfrface )     /* PFR_Face */
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
    PFR_Face   face = (PFR_Face)pfrface;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    46
    FT_Memory  memory;
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    49
    if ( !face )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    50
      return;
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
    memory = pfrface->driver->root.memory;
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
    /* we don't want dangling pointers */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    55
    pfrface->family_name = NULL;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    56
    pfrface->style_name  = NULL;
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
    /* finalize the physical font record */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    59
    pfr_phy_font_done( &face->phy_font, FT_FACE_MEMORY( face ) );
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
    /* no need to finalize the logical font or the header */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    62
    FT_FREE( pfrface->available_sizes );
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
  FT_LOCAL_DEF( FT_Error )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    67
  pfr_face_init( FT_Stream      stream,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    68
                 FT_Face        pfrface,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    69
                 FT_Int         face_index,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    70
                 FT_Int         num_params,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    71
                 FT_Parameter*  params )
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
    PFR_Face  face = (PFR_Face)pfrface;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    74
    FT_Error  error;
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
    FT_UNUSED( num_params );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    77
    FT_UNUSED( params );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    78
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
    /* load the header and check it */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    81
    error = pfr_header_load( &face->header, stream );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    82
    if ( error )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    83
      goto Exit;
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
    if ( !pfr_header_check( &face->header ) )
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
      FT_TRACE4(( "pfr_face_init: not a valid PFR font\n" ));
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    88
      error = PFR_Err_Unknown_File_Format;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    89
      goto Exit;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    90
    }
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
    /* check face index */
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
      FT_UInt  num_faces;
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    97
      error = pfr_log_font_count( stream,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    98
                                  face->header.log_dir_offset,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    99
                                  &num_faces );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   100
      if ( error )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   101
        goto Exit;
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
      pfrface->num_faces = num_faces;
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
    if ( face_index < 0 )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   107
      goto Exit;
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
    if ( face_index >= pfrface->num_faces )
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
      FT_ERROR(( "pfr_face_init: invalid face index\n" ));
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   112
      error = PFR_Err_Invalid_Argument;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   113
      goto Exit;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   114
    }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   115
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   116
    /* load the face */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   117
    error = pfr_log_font_load(
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   118
               &face->log_font, stream, face_index,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   119
               face->header.log_dir_offset,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   120
               FT_BOOL( face->header.phy_font_max_size_high != 0 ) );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   121
    if ( error )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   122
      goto Exit;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   123
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   124
    /* now load the physical font descriptor */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   125
    error = pfr_phy_font_load( &face->phy_font, stream,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   126
                               face->log_font.phys_offset,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   127
                               face->log_font.phys_size );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   128
    if ( error )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   129
      goto Exit;
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
    /* now set up all root face fields */
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
      PFR_PhyFont  phy_font = &face->phy_font;
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   136
      pfrface->face_index = face_index;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   137
      pfrface->num_glyphs = phy_font->num_chars + 1;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   138
      pfrface->face_flags = FT_FACE_FLAG_SCALABLE;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   139
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   140
      /* if all characters point to the same gps_offset 0, we */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   141
      /* assume that the font only contains bitmaps           */
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
        FT_UInt  nn;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   144
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   145
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   146
        for ( nn = 0; nn < phy_font->num_chars; nn++ )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   147
          if ( phy_font->chars[nn].gps_offset != 0 )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   148
            break;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   149
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   150
        if ( nn == phy_font->num_chars )
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
          if ( phy_font->num_strikes > 0 )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   153
            pfrface->face_flags = 0;        /* not scalable */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   154
          else
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   155
          {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   156
            FT_ERROR(( "pfr_face_init: font doesn't contain glyphs\n" ));
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   157
            error = PFR_Err_Invalid_File_Format;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   158
            goto Exit;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   159
          }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   160
        }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   161
      }
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 ( (phy_font->flags & PFR_PHY_PROPORTIONAL) == 0 )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   164
        pfrface->face_flags |= FT_FACE_FLAG_FIXED_WIDTH;
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
      if ( phy_font->flags & PFR_PHY_VERTICAL )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   167
        pfrface->face_flags |= FT_FACE_FLAG_VERTICAL;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   168
      else
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   169
        pfrface->face_flags |= FT_FACE_FLAG_HORIZONTAL;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   170
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   171
      if ( phy_font->num_strikes > 0 )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   172
        pfrface->face_flags |= FT_FACE_FLAG_FIXED_SIZES;
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 ( phy_font->num_kern_pairs > 0 )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   175
        pfrface->face_flags |= FT_FACE_FLAG_KERNING;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   176
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   177
      /* If no family name was found in the "undocumented" auxiliary
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   178
       * data, use the font ID instead.  This sucks but is better than
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   179
       * nothing.
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
      pfrface->family_name = phy_font->family_name;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   182
      if ( pfrface->family_name == NULL )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   183
        pfrface->family_name = phy_font->font_id;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   184
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   185
      /* note that the style name can be NULL in certain PFR fonts,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   186
       * probably meaning "Regular"
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
      pfrface->style_name = phy_font->style_name;
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
      pfrface->num_fixed_sizes = 0;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   191
      pfrface->available_sizes = 0;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   192
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   193
      pfrface->bbox         = phy_font->bbox;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   194
      pfrface->units_per_EM = (FT_UShort)phy_font->outline_resolution;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   195
      pfrface->ascender     = (FT_Short) phy_font->bbox.yMax;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   196
      pfrface->descender    = (FT_Short) phy_font->bbox.yMin;
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
      pfrface->height = (FT_Short)( ( pfrface->units_per_EM * 12 ) / 10 );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   199
      if ( pfrface->height < pfrface->ascender - pfrface->descender )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   200
        pfrface->height = (FT_Short)(pfrface->ascender - pfrface->descender);
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
      if ( phy_font->num_strikes > 0 )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   203
      {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   204
        FT_UInt          n, count = phy_font->num_strikes;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   205
        FT_Bitmap_Size*  size;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   206
        PFR_Strike       strike;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   207
        FT_Memory        memory = pfrface->stream->memory;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   208
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   209
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   210
        if ( FT_NEW_ARRAY( pfrface->available_sizes, count ) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   211
          goto Exit;
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
        size   = pfrface->available_sizes;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   214
        strike = phy_font->strikes;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   215
        for ( n = 0; n < count; n++, size++, strike++ )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   216
        {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   217
          size->height = (FT_UShort)strike->y_ppm;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   218
          size->width  = (FT_UShort)strike->x_ppm;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   219
          size->size   = strike->y_ppm << 6;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   220
          size->x_ppem = strike->x_ppm << 6;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   221
          size->y_ppem = strike->y_ppm << 6;
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
        pfrface->num_fixed_sizes = count;
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   226
      /* now compute maximum advance width */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   227
      if ( ( phy_font->flags & PFR_PHY_PROPORTIONAL ) == 0 )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   228
        pfrface->max_advance_width = (FT_Short)phy_font->standard_advance;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   229
      else
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
        FT_Int    max = 0;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   232
        FT_UInt   count = phy_font->num_chars;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   233
        PFR_Char  gchar = phy_font->chars;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   234
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   235
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   236
        for ( ; count > 0; count--, gchar++ )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   237
        {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   238
          if ( max < gchar->advance )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   239
            max = gchar->advance;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   240
        }
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
        pfrface->max_advance_width = (FT_Short)max;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   243
      }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   244
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   245
      pfrface->max_advance_height = pfrface->height;
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
      pfrface->underline_position  = (FT_Short)( -pfrface->units_per_EM / 10 );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   248
      pfrface->underline_thickness = (FT_Short)(  pfrface->units_per_EM / 30 );
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
      /* create charmap */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   251
      {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   252
        FT_CharMapRec  charmap;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   253
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   254
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   255
        charmap.face        = pfrface;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   256
        charmap.platform_id = TT_PLATFORM_MICROSOFT;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   257
        charmap.encoding_id = TT_MS_ID_UNICODE_CS;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   258
        charmap.encoding    = FT_ENCODING_UNICODE;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   259
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   260
        error = FT_CMap_New( &pfr_cmap_class_rec, NULL, &charmap, NULL );
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
#if 0
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   263
        /* Select default charmap */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   264
        if ( pfrface->num_charmaps )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   265
          pfrface->charmap = pfrface->charmaps[0];
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   266
#endif
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   267
      }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   268
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   269
      /* check whether we've loaded any kerning pairs */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   270
      if ( phy_font->num_kern_pairs )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   271
        pfrface->face_flags |= FT_FACE_FLAG_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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   274
  Exit:
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   275
    return error;
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
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
  /*************************************************************************/
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
  /*****                    SLOT OBJECT METHOD                         *****/
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
  /*************************************************************************/
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   287
  FT_LOCAL_DEF( FT_Error )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   288
  pfr_slot_init( FT_GlyphSlot  pfrslot )        /* PFR_Slot */
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
    PFR_Slot        slot   = (PFR_Slot)pfrslot;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   291
    FT_GlyphLoader  loader = pfrslot->internal->loader;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   292
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   293
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   294
    pfr_glyph_init( &slot->glyph, loader );
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
    return 0;
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
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
  FT_LOCAL_DEF( void )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   301
  pfr_slot_done( FT_GlyphSlot  pfrslot )        /* PFR_Slot */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   302
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   303
    PFR_Slot  slot = (PFR_Slot)pfrslot;
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   306
    pfr_glyph_done( &slot->glyph );
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   310
  FT_LOCAL_DEF( FT_Error )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   311
  pfr_slot_load( FT_GlyphSlot  pfrslot,         /* PFR_Slot */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   312
                 FT_Size       pfrsize,         /* PFR_Size */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   313
                 FT_UInt       gindex,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   314
                 FT_Int32      load_flags )
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
    PFR_Slot     slot    = (PFR_Slot)pfrslot;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   317
    PFR_Size     size    = (PFR_Size)pfrsize;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   318
    FT_Error     error;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   319
    PFR_Face     face    = (PFR_Face)pfrslot->face;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   320
    PFR_Char     gchar;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   321
    FT_Outline*  outline = &pfrslot->outline;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   322
    FT_ULong     gps_offset;
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   325
    if ( gindex > 0 )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   326
      gindex--;
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 ( !face || gindex >= face->phy_font.num_chars )
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
      error = PFR_Err_Invalid_Argument;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   331
      goto Exit;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   332
    }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   333
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   334
    /* try to load an embedded bitmap */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   335
    if ( ( load_flags & ( FT_LOAD_NO_SCALE | FT_LOAD_NO_BITMAP ) ) == 0 )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   336
    {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   337
      error = pfr_slot_load_bitmap( slot, size, gindex );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   338
      if ( error == 0 )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   339
        goto Exit;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   340
    }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   341
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   342
    if ( load_flags & FT_LOAD_SBITS_ONLY )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   343
    {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   344
      error = PFR_Err_Invalid_Argument;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   345
      goto Exit;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   346
    }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   347
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   348
    gchar               = face->phy_font.chars + gindex;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   349
    pfrslot->format     = FT_GLYPH_FORMAT_OUTLINE;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   350
    outline->n_points   = 0;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   351
    outline->n_contours = 0;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   352
    gps_offset          = face->header.gps_section_offset;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   353
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   354
    /* load the glyph outline (FT_LOAD_NO_RECURSE isn't supported) */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   355
    error = pfr_glyph_load( &slot->glyph, face->root.stream,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   356
                            gps_offset, gchar->gps_offset, gchar->gps_size );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   357
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   358
    if ( !error )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   359
    {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   360
      FT_BBox            cbox;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   361
      FT_Glyph_Metrics*  metrics = &pfrslot->metrics;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   362
      FT_Pos             advance;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   363
      FT_Int             em_metrics, em_outline;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   364
      FT_Bool            scaling;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   365
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   366
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   367
      scaling = FT_BOOL( ( load_flags & FT_LOAD_NO_SCALE ) == 0 );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   368
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   369
      /* copy outline data */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   370
      *outline = slot->glyph.loader->base.outline;
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
      outline->flags &= ~FT_OUTLINE_OWNER;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   373
      outline->flags |= FT_OUTLINE_REVERSE_FILL;
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
      if ( size && pfrsize->metrics.y_ppem < 24 )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   376
        outline->flags |= FT_OUTLINE_HIGH_PRECISION;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   377
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   378
      /* compute the advance vector */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   379
      metrics->horiAdvance = 0;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   380
      metrics->vertAdvance = 0;
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
      advance    = gchar->advance;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   383
      em_metrics = face->phy_font.metrics_resolution;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   384
      em_outline = face->phy_font.outline_resolution;
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
      if ( em_metrics != em_outline )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   387
        advance = FT_MulDiv( advance, em_outline, em_metrics );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   388
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   389
      if ( face->phy_font.flags & PFR_PHY_VERTICAL )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   390
        metrics->vertAdvance = advance;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   391
      else
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   392
        metrics->horiAdvance = advance;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   393
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   394
      pfrslot->linearHoriAdvance = metrics->horiAdvance;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   395
      pfrslot->linearVertAdvance = metrics->vertAdvance;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   396
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   397
      /* make-up vertical metrics(?) */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   398
      metrics->vertBearingX = 0;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   399
      metrics->vertBearingY = 0;
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
#if 0 /* some fonts seem to be broken here! */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   402
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   403
      /* Apply the font matrix, if any.                 */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   404
      /* TODO: Test existing fonts with unusual matrix  */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   405
      /* whether we have to adjust Units per EM.        */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   406
      {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   407
        FT_Matrix font_matrix;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   408
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   409
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   410
        font_matrix.xx = face->log_font.matrix[0] << 8;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   411
        font_matrix.yx = face->log_font.matrix[1] << 8;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   412
        font_matrix.xy = face->log_font.matrix[2] << 8;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   413
        font_matrix.yy = face->log_font.matrix[3] << 8;
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
        FT_Outline_Transform( outline, &font_matrix );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   416
      }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   417
#endif
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   418
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   419
      /* scale when needed */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   420
      if ( scaling )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   421
      {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   422
        FT_Int      n;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   423
        FT_Fixed    x_scale = pfrsize->metrics.x_scale;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   424
        FT_Fixed    y_scale = pfrsize->metrics.y_scale;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   425
        FT_Vector*  vec     = outline->points;
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
        /* scale outline points */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   429
        for ( n = 0; n < outline->n_points; n++, vec++ )
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
          vec->x = FT_MulFix( vec->x, x_scale );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   432
          vec->y = FT_MulFix( vec->y, y_scale );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   433
        }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   434
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   435
        /* scale the advance */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   436
        metrics->horiAdvance = FT_MulFix( metrics->horiAdvance, x_scale );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   437
        metrics->vertAdvance = FT_MulFix( metrics->vertAdvance, y_scale );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   438
      }
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
      /* compute the rest of the metrics */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   441
      FT_Outline_Get_CBox( outline, &cbox );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   442
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   443
      metrics->width        = cbox.xMax - cbox.xMin;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   444
      metrics->height       = cbox.yMax - cbox.yMin;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   445
      metrics->horiBearingX = cbox.xMin;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   446
      metrics->horiBearingY = cbox.yMax - metrics->height;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   447
    }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   448
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   449
  Exit:
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   450
    return error;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   451
  }
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
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
  /*****                                                               *****/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   457
  /*****                      KERNING METHOD                           *****/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   458
  /*****                                                               *****/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   459
  /*************************************************************************/
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
  FT_LOCAL_DEF( FT_Error )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   463
  pfr_face_get_kerning( FT_Face     pfrface,        /* PFR_Face */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   464
                        FT_UInt     glyph1,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   465
                        FT_UInt     glyph2,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   466
                        FT_Vector*  kerning )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   467
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   468
    PFR_Face     face     = (PFR_Face)pfrface;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   469
    FT_Error     error    = PFR_Err_Ok;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   470
    PFR_PhyFont  phy_font = &face->phy_font;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   471
    FT_UInt32    code1, code2, pair;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   472
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   473
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   474
    kerning->x = 0;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   475
    kerning->y = 0;
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
    if ( glyph1 > 0 )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   478
      glyph1--;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   479
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   480
    if ( glyph2 > 0 )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   481
      glyph2--;
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
    /* convert glyph indices to character codes */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   484
    if ( glyph1 > phy_font->num_chars ||
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   485
         glyph2 > phy_font->num_chars )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   486
      goto Exit;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   487
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   488
    code1 = phy_font->chars[glyph1].char_code;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   489
    code2 = phy_font->chars[glyph2].char_code;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   490
    pair  = PFR_KERN_INDEX( code1, code2 );
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
    /* now search the list of kerning items */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   493
    {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   494
      PFR_KernItem  item   = phy_font->kern_items;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   495
      FT_Stream     stream = pfrface->stream;
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
      for ( ; item; item = item->next )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   499
      {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   500
        if ( pair >= item->pair1 && pair <= item->pair2 )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   501
          goto FoundPair;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   502
      }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   503
      goto Exit;
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
    FoundPair: /* we found an item, now parse it and find the value if any */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   506
      if ( FT_STREAM_SEEK( item->offset )                       ||
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   507
           FT_FRAME_ENTER( item->pair_count * item->pair_size ) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   508
        goto Exit;
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
      {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   511
        FT_UInt    count       = item->pair_count;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   512
        FT_UInt    size        = item->pair_size;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   513
        FT_UInt    power       = (FT_UInt)ft_highpow2( (FT_UInt32)count );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   514
        FT_UInt    probe       = power * size;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   515
        FT_UInt    extra       = count - power;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   516
        FT_Byte*   base        = stream->cursor;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   517
        FT_Bool    twobytes    = FT_BOOL( item->flags & 1 );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   518
        FT_Bool    twobyte_adj = FT_BOOL( item->flags & 2 );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   519
        FT_Byte*   p;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   520
        FT_UInt32  cpair;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   521
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   522
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   523
        if ( extra > 0 )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   524
        {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   525
          p = base + extra * size;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   526
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   527
          if ( twobytes )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   528
            cpair = FT_NEXT_ULONG( p );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   529
          else
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   530
            cpair = PFR_NEXT_KPAIR( p );
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 ( cpair == pair )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   533
            goto Found;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   534
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   535
          if ( cpair < pair )
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
            if ( twobyte_adj )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   538
              p += 2;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   539
            else
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   540
              p++;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   541
            base = p;
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   545
        while ( probe > size )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   546
        {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   547
          probe >>= 1;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   548
          p       = base + probe;
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
          if ( twobytes )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   551
            cpair = FT_NEXT_ULONG( p );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   552
          else
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   553
            cpair = PFR_NEXT_KPAIR( p );
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
          if ( cpair == pair )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   556
            goto Found;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   557
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   558
          if ( cpair < pair )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   559
            base += probe;
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   562
        p = base;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   563
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   564
        if ( twobytes )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   565
          cpair = FT_NEXT_ULONG( p );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   566
        else
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   567
          cpair = PFR_NEXT_KPAIR( p );
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
        if ( cpair == pair )
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
          FT_Int  value;
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   574
        Found:
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   575
          if ( twobyte_adj )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   576
            value = FT_PEEK_SHORT( p );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   577
          else
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   578
            value = p[0];
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   579
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   580
          kerning->x = item->base_adj + value;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   581
        }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   582
      }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   583
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   584
      FT_FRAME_EXIT();
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   585
    }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   586
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   587
  Exit:
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   588
    return error;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   589
  }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   590
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   591
/* END */