misc/libfreetype/src/base/ftotval.c
author koda
Thu, 25 Jul 2013 23:16:06 +0200
changeset 9371 f3840de881bd
parent 5172 88f2e05288ba
permissions -rw-r--r--
strip out our copy of libtremor SDL2_mixer comes with a more updated, better integrated version
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
/*  ftotval.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 API for validating OpenType tables (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 2004, 2006, 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
#include <ft2build.h>
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    19
#include FT_INTERNAL_OBJECTS_H
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    20
#include FT_SERVICE_OPENTYPE_VALIDATE_H
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    21
#include FT_OPENTYPE_VALIDATE_H
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    22
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
  /* documentation is in ftotval.h */
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
  FT_EXPORT_DEF( FT_Error )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    27
  FT_OpenType_Validate( FT_Face    face,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    28
                        FT_UInt    validation_flags,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    29
                        FT_Bytes  *BASE_table,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    30
                        FT_Bytes  *GDEF_table,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    31
                        FT_Bytes  *GPOS_table,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    32
                        FT_Bytes  *GSUB_table,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    33
                        FT_Bytes  *JSTF_table )
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_Service_OTvalidate  service;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    36
    FT_Error               error;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    37
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
    if ( !face )
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
      error = FT_Err_Invalid_Face_Handle;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    42
      goto Exit;
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    45
    if ( !( BASE_table &&
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    46
            GDEF_table &&
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    47
            GPOS_table &&
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    48
            GSUB_table &&
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    49
            JSTF_table ) )
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
      error = FT_Err_Invalid_Argument;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    52
      goto Exit;
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    55
    FT_FACE_FIND_GLOBAL_SERVICE( face, service, OPENTYPE_VALIDATE );
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
    if ( service )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    58
      error = service->validate( face,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    59
                                 validation_flags,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    60
                                 BASE_table,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    61
                                 GDEF_table,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    62
                                 GPOS_table,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    63
                                 GSUB_table,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    64
                                 JSTF_table );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    65
    else
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    66
      error = FT_Err_Unimplemented_Feature;
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
  Exit:
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    69
    return error;
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    73
  FT_EXPORT_DEF( void )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    74
  FT_OpenType_Free( FT_Face   face,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    75
                    FT_Bytes  table )
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
    FT_Memory  memory;
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
    if ( !face )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    81
      return;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    82
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    83
    memory = FT_FACE_MEMORY( face );
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
    FT_FREE( table );
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    88
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    89
/* END */