misc/libfreetype/src/truetype/ttpic.c
author nemo
Mon, 07 Jan 2013 08:35:29 -0500
changeset 8365 fbd799a1e95b
parent 5172 88f2e05288ba
permissions -rw-r--r--
correct rope tip
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
/*  ttpic.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 truetype 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 "ttpic.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 ttdriver.c */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    27
  FT_Error FT_Create_Class_tt_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_tt_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_tt_service_gx_multi_masters(FT_Service_MultiMastersRec*);
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    30
  void FT_Init_Class_tt_service_truetype_glyf(FT_Service_TTGlyfRec*);
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    31
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    32
  void
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    33
  tt_driver_class_pic_free(  FT_Library library )
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
    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
    36
    FT_Memory memory = library->memory;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    37
    if ( pic_container->truetype )
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
      TTModulePIC* container = (TTModulePIC*)pic_container->truetype;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    40
      if(container->tt_services)
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    41
        FT_Destroy_Class_tt_services(library, container->tt_services);
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    42
      container->tt_services = NULL;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    43
      FT_FREE( container );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    44
      pic_container->truetype = NULL;
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
  }
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
  FT_Error
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    50
  tt_driver_class_pic_init( FT_Library  library )
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
    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
    53
    FT_Error           error         = TT_Err_Ok;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    54
    TTModulePIC*       container;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    55
    FT_Memory          memory        = library->memory;
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
    /* 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
    59
    if ( FT_ALLOC ( container, sizeof ( *container ) ) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    60
      return error;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    61
    FT_MEM_SET( container, 0, sizeof(*container) );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    62
    pic_container->truetype = container;
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
    /* 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
    65
    error = FT_Create_Class_tt_services(library, &container->tt_services);
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    66
    if(error) 
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    67
      goto Exit;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    68
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    69
    FT_Init_Class_tt_service_gx_multi_masters(&container->tt_service_gx_multi_masters);
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    70
#endif
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    71
    FT_Init_Class_tt_service_truetype_glyf(&container->tt_service_truetype_glyf);
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    72
Exit:
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    73
    if(error)
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    74
      tt_driver_class_pic_free(library);
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    75
    return error;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    76
  }
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
#endif /* FT_CONFIG_OPTION_PIC */
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    81
/* END */