misc/libfreetype/src/sfnt/sfntpic.c
author Xeli
Sat, 12 Nov 2011 14:50:35 +0100
branchhedgeroid
changeset 6232 cf4b0f43d64d
parent 5172 88f2e05288ba
permissions -rw-r--r--
removed sdl_net which was 'borrowed' (?:P) from peyla's port we'll now be using the official port
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
/*  sfntpic.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 sfnt 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 "sfntpic.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 sfdriver.c */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    27
  FT_Error FT_Create_Class_sfnt_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_sfnt_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_sfnt_service_bdf( FT_Service_BDFRec*);
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    30
  void FT_Init_Class_sfnt_interface( FT_Library, SFNT_Interface*);
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    31
  void FT_Init_Class_sfnt_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
    32
  void FT_Init_Class_sfnt_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
    33
  void FT_Init_Class_tt_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
    34
  void FT_Init_Class_sfnt_service_sfnt_table( FT_Service_SFNT_TableRec*);
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
  /* forward declaration of PIC init functions from ttcmap.c */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    37
  FT_Error FT_Create_Class_tt_cmap_classes( FT_Library, TT_CMap_Class**);
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    38
  void FT_Destroy_Class_tt_cmap_classes( FT_Library, TT_CMap_Class*);
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
  void
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    41
  sfnt_module_class_pic_free(  FT_Library library )
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
    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
    44
    FT_Memory memory = library->memory;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    45
    if ( pic_container->sfnt )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    46
    {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    47
      sfntModulePIC* container = (sfntModulePIC*)pic_container->sfnt;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    48
      if(container->sfnt_services)
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    49
        FT_Destroy_Class_sfnt_services(library, container->sfnt_services);
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    50
      container->sfnt_services = NULL;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    51
      if(container->tt_cmap_classes)
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    52
        FT_Destroy_Class_tt_cmap_classes(library, container->tt_cmap_classes);
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    53
      container->tt_cmap_classes = NULL;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    54
      FT_FREE( container );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    55
      pic_container->sfnt = NULL;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    56
    }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    57
  }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    58
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    59
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    60
  FT_Error
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    61
  sfnt_module_class_pic_init(  FT_Library library )
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_PIC_Container*  pic_container = &library->pic_container;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    64
    FT_Error           error = SFNT_Err_Ok;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    65
    sfntModulePIC*     container;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    66
    FT_Memory          memory = library->memory;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    67
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    68
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    69
    /* 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
    70
    if ( FT_ALLOC ( container, sizeof ( *container ) ) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    71
      return error;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    72
    FT_MEM_SET( container, 0, sizeof ( *container ) );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    73
    pic_container->sfnt = container;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    74
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    75
    /* 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
    76
    error = FT_Create_Class_sfnt_services(library, &container->sfnt_services);
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    77
    if(error) 
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    78
      goto Exit;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    79
    error = FT_Create_Class_tt_cmap_classes(library, &container->tt_cmap_classes);
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
    FT_Init_Class_sfnt_service_glyph_dict(library, &container->sfnt_service_glyph_dict);
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    83
    FT_Init_Class_sfnt_service_ps_name(library, &container->sfnt_service_ps_name);
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    84
    FT_Init_Class_tt_service_get_cmap_info(library, &container->tt_service_get_cmap_info);
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    85
    FT_Init_Class_sfnt_service_sfnt_table(&container->sfnt_service_sfnt_table);
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    86
#ifdef TT_CONFIG_OPTION_BDF
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    87
    FT_Init_Class_sfnt_service_bdf(&container->sfnt_service_bdf);
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    88
#endif
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    89
    FT_Init_Class_sfnt_interface(library, &container->sfnt_interface);
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
Exit:
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    92
    if(error)
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    93
      sfnt_module_class_pic_free(library);
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    94
    return error;
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    98
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    99
#endif /* FT_CONFIG_OPTION_PIC */
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   102
/* END */