misc/libfreetype/src/autofit/afpic.c
author sheepluva
Wed, 17 Apr 2013 14:57:56 +0200
branch0.9.19
changeset 8902 a94c074fd483
parent 5172 88f2e05288ba
permissions -rw-r--r--
fix for issue #599: "Change graphics size settings to use qspinbox"? somebody ask unC0Rr if that's what he wanted :p
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
/*  afpic.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 autofit 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, 2011 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 "afpic.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 afmodule.c */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    27
  void FT_Init_Class_af_autofitter_service( FT_Library,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    28
                                            FT_AutoHinter_ServiceRec* );
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
  /* forward declaration of PIC init functions from script classes */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    31
#include "aflatin.h"
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    32
#include "aflatin2.h"
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    33
#include "afcjk.h"
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    34
#include "afdummy.h"
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    35
#include "afindic.h"
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
  void
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    38
  autofit_module_class_pic_free( FT_Library  library )
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
    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
    41
    FT_Memory          memory        = library->memory;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    42
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    43
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    44
    if ( pic_container->autofit )
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_FREE( pic_container->autofit );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    47
      pic_container->autofit = NULL;
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
  }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    50
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_Error
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    53
  autofit_module_class_pic_init( FT_Library  library )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    54
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    55
    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
    56
    FT_UInt            ss;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    57
    FT_Error           error         = AF_Err_Ok;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    58
    AFModulePIC*       container;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    59
    FT_Memory          memory        = library->memory;
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
    /* 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
    63
    if ( FT_ALLOC ( container, sizeof ( *container ) ) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    64
      return error;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    65
    FT_MEM_SET( container, 0, sizeof ( *container ) );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    66
    pic_container->autofit = container;
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
    /* initialize pointer table -                       */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    69
    /* 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
    70
    for ( ss = 0 ; ss < AF_SCRIPT_CLASSES_REC_COUNT ; ss++ )
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
      container->af_script_classes[ss] =
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    73
        &container->af_script_classes_rec[ss];
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
    container->af_script_classes[AF_SCRIPT_CLASSES_COUNT - 1] = NULL;
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
    /* add call to initialization function when you add new scripts */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    78
    ss = 0;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    79
    FT_Init_Class_af_dummy_script_class(
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    80
      &container->af_script_classes_rec[ss++] );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    81
#ifdef FT_OPTION_AUTOFIT2
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    82
    FT_Init_Class_af_latin2_script_class(
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    83
      &container->af_script_classes_rec[ss++] );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    84
#endif
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    85
    FT_Init_Class_af_latin_script_class(
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    86
      &container->af_script_classes_rec[ss++] );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    87
    FT_Init_Class_af_cjk_script_class(
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    88
      &container->af_script_classes_rec[ss++] );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    89
    FT_Init_Class_af_indic_script_class(
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    90
      &container->af_script_classes_rec[ss++] );
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
    FT_Init_Class_af_autofitter_service(
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    93
      library, &container->af_autofitter_service );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    94
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    95
/* Exit: */
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
    if ( error )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    98
      autofit_module_class_pic_free( library );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    99
    return error;
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   103
#endif /* FT_CONFIG_OPTION_PIC */
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
/* END */