misc/libfreetype/src/cff/cffpic.c
author sheepluva
Wed, 05 Jun 2013 16:28:30 +0200
changeset 9137 d987230b85ed
parent 5172 88f2e05288ba
permissions -rw-r--r--
fixed all engine compilation hints and notes (that I could see)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5172
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     1
/***************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     2
/*                                                                         */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     3
/*  cffpic.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
/*    The FreeType position independent code services for cff module.      */
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 2009, 2010 by                                                */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     8
/*  Oran Agra and Mickey Gabel.                                            */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     9
/*                                                                         */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    10
/*  This file is part of the FreeType project, and may only be used,       */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    11
/*  modified, and distributed under the terms of the FreeType project      */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    12
/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    13
/*  this file you indicate that you have read the license and              */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    14
/*  understand and accept it fully.                                        */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    15
/*                                                                         */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    16
/***************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    17
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    18
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    19
#include <ft2build.h>
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    20
#include FT_FREETYPE_H
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    21
#include FT_INTERNAL_OBJECTS_H
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    22
#include "cffpic.h"
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    23
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    24
#ifdef FT_CONFIG_OPTION_PIC
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    25
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    26
  /* forward declaration of PIC init functions from cffdrivr.c */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    27
  FT_Error FT_Create_Class_cff_services( FT_Library, FT_ServiceDescRec**);
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    28
  void FT_Destroy_Class_cff_services( FT_Library, FT_ServiceDescRec*);
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    29
  void FT_Init_Class_cff_service_ps_info( FT_Library, FT_Service_PsInfoRec*);
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    30
  void FT_Init_Class_cff_service_glyph_dict( FT_Library, FT_Service_GlyphDictRec*);
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    31
  void FT_Init_Class_cff_service_ps_name( FT_Library, FT_Service_PsFontNameRec*);
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    32
  void FT_Init_Class_cff_service_get_cmap_info( FT_Library, FT_Service_TTCMapsRec*);
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    33
  void FT_Init_Class_cff_service_cid_info( FT_Library, FT_Service_CIDRec*);
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
  /* forward declaration of PIC init functions from cffparse.c */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    36
  FT_Error FT_Create_Class_cff_field_handlers( FT_Library, CFF_Field_Handler**);
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    37
  void FT_Destroy_Class_cff_field_handlers( FT_Library, CFF_Field_Handler*);
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
  /* forward declaration of PIC init functions from cffcmap.c */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    40
  void FT_Init_Class_cff_cmap_encoding_class_rec( FT_Library, FT_CMap_ClassRec*);
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    41
  void FT_Init_Class_cff_cmap_unicode_class_rec( FT_Library, FT_CMap_ClassRec*);
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
  void
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    44
  cff_driver_class_pic_free(  FT_Library library )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    45
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    46
    FT_PIC_Container* pic_container = &library->pic_container;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    47
    FT_Memory memory = library->memory;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    48
    if ( pic_container->cff )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    49
    {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    50
      CffModulePIC* container = (CffModulePIC*)pic_container->cff;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    51
      if(container->cff_services)
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    52
        FT_Destroy_Class_cff_services(library, container->cff_services);
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    53
      container->cff_services = NULL;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    54
      if(container->cff_field_handlers)
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    55
        FT_Destroy_Class_cff_field_handlers(library, container->cff_field_handlers);
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    56
      container->cff_field_handlers = NULL;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    57
      FT_FREE( container );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    58
      pic_container->cff = NULL;
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
  FT_Error
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    64
  cff_driver_class_pic_init( FT_Library  library )
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_PIC_Container*  pic_container = &library->pic_container;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    67
    FT_Error           error         = CFF_Err_Ok;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    68
    CffModulePIC*      container;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    69
    FT_Memory          memory        = library->memory;
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
    /* allocate pointer, clear and set global container pointer */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    73
    if ( FT_ALLOC ( container, sizeof ( *container ) ) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    74
      return error;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    75
    FT_MEM_SET( container, 0, sizeof ( *container ) );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    76
    pic_container->cff = container;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    77
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    78
    /* initialize pointer table - this is how the module usually expects this data */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    79
    error = FT_Create_Class_cff_services(library, &container->cff_services);
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    80
    if(error) 
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    81
      goto Exit;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    82
    error = FT_Create_Class_cff_field_handlers(library, &container->cff_field_handlers);
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    83
    if(error) 
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    84
      goto Exit;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    85
    FT_Init_Class_cff_service_ps_info(library, &container->cff_service_ps_info);
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    86
    FT_Init_Class_cff_service_glyph_dict(library, &container->cff_service_glyph_dict);
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    87
    FT_Init_Class_cff_service_ps_name(library, &container->cff_service_ps_name);
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    88
    FT_Init_Class_cff_service_get_cmap_info(library, &container->cff_service_get_cmap_info);
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    89
    FT_Init_Class_cff_service_cid_info(library, &container->cff_service_cid_info);
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    90
    FT_Init_Class_cff_cmap_encoding_class_rec(library, &container->cff_cmap_encoding_class_rec);
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    91
    FT_Init_Class_cff_cmap_unicode_class_rec(library, &container->cff_cmap_unicode_class_rec);
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    92
Exit:
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    93
    if(error)
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    94
      cff_driver_class_pic_free(library);
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    95
    return error;
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    98
#endif /* FT_CONFIG_OPTION_PIC */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    99
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   100
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   101
/* END */