misc/libfreetype/src/base/ftgasp.c
author nemo
Sun, 11 Sep 2011 10:46:53 -0400
changeset 5856 ed97138dc414
parent 5172 88f2e05288ba
permissions -rw-r--r--
Should prevent a crasher when drowning while firing
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
/*  ftgasp.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
/*    Access of TrueType's `gasp' table (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 2007 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
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_GASP_H
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    21
#include FT_INTERNAL_TRUETYPE_TYPES_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
  FT_EXPORT_DEF( FT_Int )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    25
  FT_Get_Gasp( FT_Face  face,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    26
               FT_UInt  ppem )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    27
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    28
    FT_Int  result = FT_GASP_NO_TABLE;
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    31
    if ( face && FT_IS_SFNT( face ) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    32
    {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    33
      TT_Face  ttface = (TT_Face)face;
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    36
      if ( ttface->gasp.numRanges > 0 )
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
        TT_GaspRange  range     = ttface->gasp.gaspRanges;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    39
        TT_GaspRange  range_end = range + ttface->gasp.numRanges;
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    42
        while ( ppem > range->maxPPEM )
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
          range++;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    45
          if ( range >= range_end )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    46
            goto Exit;
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
        result = range->gaspFlag;
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
        /* ensure that we don't have spurious bits */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    52
        if ( ttface->gasp.version == 0 )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    53
          result &= 3;
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
    }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    56
  Exit:
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    57
    return result;
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    61
/* END */